Commit f0511083 authored by zjz1994's avatar zjz1994

人才保险暂存

parent 9d869388
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -352,11 +352,11 @@ ...@@ -352,11 +352,11 @@
MapData.anispeed = 1000; MapData.anispeed = 1000;
MapData.levelData = [ MapData.levelData = [
[ [
[1, 2, 5, 3, 4], [2, 3, 4, 5, 4],
[3, 1, 2, 4, 5], [4, 5, 3, 2, 4],
[2, 5, 3, 4, 1], [2, 5, 3, 5, 1],
[5, 4, 1, 2, 3], [3, 4, 4, 5, 3],
[4, 1, 3, 5, 2], [1, 5, 2, 1, 4],
], ],
[ [
[5, 2, 1, 2, 1], [5, 2, 1, 2, 1],
...@@ -398,7 +398,7 @@ ...@@ -398,7 +398,7 @@
_this.lattices = {}; _this.lattices = {};
_this.eliminateArr = []; _this.eliminateArr = [];
_this.selectArr = []; _this.selectArr = [];
_this.conty = 140; _this.conty = 0;
_this.homex = 562; _this.homex = 562;
_this.homey = -20; _this.homey = -20;
_this.ination = false; _this.ination = false;
...@@ -411,6 +411,7 @@ ...@@ -411,6 +411,7 @@
_this.inrecord = false; _this.inrecord = false;
_this.requestGameOver = false; _this.requestGameOver = false;
_this.elitype = 1; _this.elitype = 1;
_this.inguide = false;
_this._seq = 1; _this._seq = 1;
_this.sptime = Date.now(); _this.sptime = Date.now();
_this.useBoom = false; _this.useBoom = false;
...@@ -444,6 +445,7 @@ ...@@ -444,6 +445,7 @@
configurable: true configurable: true
}); });
GameView.prototype.setup = function () { GameView.prototype.setup = function () {
console.log("setup----game");
MapData.initPoolEle(); MapData.initPoolEle();
this.selectimg = new engine.Image(getTextureByName("选中框")); this.selectimg = new engine.Image(getTextureByName("选中框"));
this.selectimg.mouseEnabled = false; this.selectimg.mouseEnabled = false;
...@@ -515,25 +517,13 @@ ...@@ -515,25 +517,13 @@
this.lastframeTime = Date.now(); this.lastframeTime = Date.now();
this.lastatime = Date.now(); this.lastatime = Date.now();
this.addEventListener(engine.Event.ENTER_FRAME, this.onUpdate, this); this.addEventListener(engine.Event.ENTER_FRAME, this.onUpdate, this);
var zhadanbtn = new engine.Label(); this.guideCont = new engine.Container();
zhadanbtn.text = "炸弹"; this.addChild(this.guideCont);
zhadanbtn.size = 56; this.guideDraw = new engine.Shape();
zhadanbtn.width = 200; this.guideCont.addChild(this.guideDraw);
zhadanbtn.height = 100; this.guideCont.visible = false;
this.addChild(zhadanbtn); this.guideCont.mouseEnabled = false;
zhadanbtn.y = 900; this.setGuidePath();
zhadanbtn.fillColor = "red";
zhadanbtn.addEventListener(engine.MouseEvent.CLICK, this.zhadanFunc, this);
var timebtn = new engine.Label();
timebtn.text = "加时";
timebtn.size = 56;
timebtn.width = 200;
timebtn.height = 100;
this.addChild(timebtn);
timebtn.y = 900;
timebtn.x = 500;
timebtn.fillColor = "red";
timebtn.addEventListener(engine.MouseEvent.CLICK, this.addTimeFunc, this);
}; };
GameView.prototype.zhadanFunc = function () { GameView.prototype.zhadanFunc = function () {
this.useBoom = true; this.useBoom = true;
...@@ -646,7 +636,7 @@ ...@@ -646,7 +636,7 @@
return [4, fallpro]; return [4, fallpro];
case 1: case 1:
_a.sent(); _a.sent();
testdata = MapData.levelData[this.level]; testdata = MapData.levelData[this.level - 1];
this.levelData = testdata; this.levelData = testdata;
this.fall("newlevel"); this.fall("newlevel");
return [2]; return [2];
...@@ -655,6 +645,7 @@ ...@@ -655,6 +645,7 @@
}); });
}; };
GameView.prototype.start = function () { GameView.prototype.start = function () {
console.log("game-start");
this.gamestat = 1; this.gamestat = 1;
this.requestGameOver = false; this.requestGameOver = false;
this.selectArr = new Array(); this.selectArr = new Array();
...@@ -669,7 +660,7 @@ ...@@ -669,7 +660,7 @@
}; };
GameView.prototype.onUpdate = function () { GameView.prototype.onUpdate = function () {
var ntime = Date.now(); var ntime = Date.now();
if (this.gamestat == 1 && this.ingame) { if (this.gamestat == 1 && this.ingame && !this.inguide) {
var passtime = ntime - this.lastframeTime; var passtime = ntime - this.lastframeTime;
if (ntime - this.lastatime >= 5000 && !this.ination && this.canation && this.selectArr.length == 0) { if (ntime - this.lastatime >= 5000 && !this.ination && this.canation && this.selectArr.length == 0) {
this.attionEliShow(); this.attionEliShow();
...@@ -697,7 +688,7 @@ ...@@ -697,7 +688,7 @@
else { else {
this.lattices = {}; this.lattices = {};
} }
var testdata = MapData.levelData[this.level]; var testdata = MapData.levelData[this.level - 1];
this.levelData = testdata; this.levelData = testdata;
for (var r = 0; r < testdata.length; r++) { for (var r = 0; r < testdata.length; r++) {
var rdata = testdata[r]; var rdata = testdata[r];
...@@ -897,6 +888,18 @@ ...@@ -897,6 +888,18 @@
engine.Tween.removeTweens(snode1); engine.Tween.removeTweens(snode1);
engine.Tween.removeTweens(snode2); engine.Tween.removeTweens(snode2);
if (this.eliminateArr.length > 0) { if (this.eliminateArr.length > 0) {
if (this.inguide) {
this.inguide = false;
engine.Tween.removeTweens(this.guideCont);
engine.Tween.get(this.guideCont)
.to({
alpha: 0
}, 200)
.call(function () {
_this.guideCont.visible = false;
engine.globalEvent.dispatchEvent('game-guidecomplete', {});
});
}
this.inEliminate = true; this.inEliminate = true;
engine.Tween.get(snode1).to({ engine.Tween.get(snode1).to({
x: snode2x, x: snode2x,
...@@ -1194,6 +1197,9 @@ ...@@ -1194,6 +1197,9 @@
ele.touch = v; ele.touch = v;
} }
} }
engine.globalEvent.dispatchEvent('game-touch', {
cantouch: v
});
if (v) { if (v) {
this.lastatime = Date.now(); this.lastatime = Date.now();
this.ination = false; this.ination = false;
...@@ -1826,6 +1832,39 @@ ...@@ -1826,6 +1832,39 @@
} }
this.eliminate(); this.eliminate();
}; };
GameView.prototype.setGuidePath = function () {
var path = [
[364, 7],
[364, 479],
[484, 479],
[484, 7],
];
this.guideDraw.clear();
this.guideDraw.beginFill(0x000000, 0.7);
this.guideDraw.moveTo(0, 0);
this.guideDraw.lineTo(609, 0);
this.guideDraw.lineTo(609, 607);
this.guideDraw.lineTo(0, 607);
this.guideDraw.lineTo(0, 0);
this.guideDraw.moveTo(path[0][0], path[0][1]);
for (var i = 1; i < path.length; i++) {
var idotx = path[i][0];
var idoty = path[i][1];
this.guideDraw.lineTo(idotx, idoty);
}
this.guideDraw.lineTo(path[0][0], path[0][1]);
this.guideDraw.endFill();
};
GameView.prototype.setGuideShow = function () {
this.inguide = true;
this.guideCont.visible = true;
this.guideCont.alpha = 0;
engine.Tween.removeTweens(this.guideCont);
engine.Tween.get(this.guideCont)
.to({
alpha: 1
}, 200);
};
return GameView; return GameView;
}(engine.Container)); }(engine.Container));
//# sourceMappingURL=GameView.js.map //# sourceMappingURL=GameView.js.map
...@@ -1842,6 +1881,7 @@ ...@@ -1842,6 +1881,7 @@
engine.globalEvent.addEventListener('game-pause', _this.pause, _this); engine.globalEvent.addEventListener('game-pause', _this.pause, _this);
engine.globalEvent.addEventListener('game-resume', _this.resume, _this); engine.globalEvent.addEventListener('game-resume', _this.resume, _this);
engine.globalEvent.addEventListener('game-recordcomp', _this.recordcomp, _this); engine.globalEvent.addEventListener('game-recordcomp', _this.recordcomp, _this);
engine.globalEvent.addEventListener('game-newuserguide', _this.newUserGuide, _this);
return _this; return _this;
} }
GameWrapper.prototype.init = function (event) { GameWrapper.prototype.init = function (event) {
...@@ -1868,6 +1908,9 @@ ...@@ -1868,6 +1908,9 @@
GameWrapper.prototype.recordcomp = function () { GameWrapper.prototype.recordcomp = function () {
this._gameView.recordcomp(); this._gameView.recordcomp();
}; };
GameWrapper.prototype.newUserGuide = function () {
this._gameView.setGuideShow();
};
return GameWrapper; return GameWrapper;
}(engine.Container)); }(engine.Container));
//# sourceMappingURL=GameWrapper.js.map //# sourceMappingURL=GameWrapper.js.map
......
This source diff could not be displayed because it is too large. You can view the blob instead.
{ {
"name": "消消乐", "name": "人保财险消消乐",
"desc": "消消乐模块", "desc": "消消乐模块",
"props": { "props": {
"threeEscore":{ "threeEscore":{
...@@ -66,18 +66,6 @@ ...@@ -66,18 +66,6 @@
"url": "//yun.duiba.com.cn/aurora/assets/438ca6e721eab32728aceaca5df0095e1387f340.png", "url": "//yun.duiba.com.cn/aurora/assets/438ca6e721eab32728aceaca5df0095e1387f340.png",
"uuid": "jiantou", "uuid": "jiantou",
"ext": ".png" "ext": ".png"
},
{
"name": "房子动画",
"url": "//yun.duiba.com.cn/aurora/assets/10d6c3c657e4f26eee2e6f1edca36ec468d57353.svga",
"uuid": "homeani",
"ext": ".svga"
},
{
"name": "夜晚房子",
"url": "//yun.duiba.com.cn/aurora/assets/aa9261273423b4b9343b4526b7e5f71a6a35a345.svga",
"uuid": "homenight",
"ext": ".svga"
} }
], ],
"events": { "events": {
...@@ -105,6 +93,9 @@ ...@@ -105,6 +93,9 @@
}, },
"game-recordcomp": { "game-recordcomp": {
"alias": "记录完毕" "alias": "记录完毕"
},
"game-newuserguide":{
"alias": "新手引导"
} }
}, },
"out": { "out": {
...@@ -135,6 +126,18 @@ ...@@ -135,6 +126,18 @@
"sptime":"操纵开始时间", "sptime":"操纵开始时间",
"eptime":"操作结束时间" "eptime":"操作结束时间"
} }
},
"game-touch": {
"alias": "按钮点击",
"data": {
"cantouch":""
}
},
"game-guidecomplete": {
"alias": "游戏引导完毕",
"data": {
}
} }
} }
} }
......
...@@ -7,9 +7,6 @@ import { playSound, createSvga,getTextureByName } from "./utils"; ...@@ -7,9 +7,6 @@ import { playSound, createSvga,getTextureByName } from "./utils";
import ObjectPool = engine.ObjectPool; import ObjectPool = engine.ObjectPool;
import MapData, { GameEvent, ElementType } from "./MapData"; import MapData, { GameEvent, ElementType } from "./MapData";
import Element from "./ele/Element"; import Element from "./ele/Element";
import CountDownGroup from "../../../recycling/src/game/views/CountDownGroup";
export default class GameView extends engine.Container { export default class GameView extends engine.Container {
constructor() { constructor() {
...@@ -38,7 +35,7 @@ export default class GameView extends engine.Container { ...@@ -38,7 +35,7 @@ export default class GameView extends engine.Container {
// homeimgday; // homeimgday;
// homeimgnight; // homeimgnight;
conty = 140; conty = 0;
homex = 562; homex = 562;
homey = -20; homey = -20;
...@@ -77,6 +74,13 @@ export default class GameView extends engine.Container { ...@@ -77,6 +74,13 @@ export default class GameView extends engine.Container {
requestGameOver = false; requestGameOver = false;
elitype = 1;//1原地消失,2飞到目标位置 elitype = 1;//1原地消失,2飞到目标位置
//新增新手引导
guideCont:engine.Container;
guideDraw:engine.Shape;
inguide:boolean = false;
set gamestat(stat){//1游戏中,2,游戏外 set gamestat(stat){//1游戏中,2,游戏外
this._gamestat = stat; this._gamestat = stat;
if(stat==2){ if(stat==2){
...@@ -101,6 +105,7 @@ export default class GameView extends engine.Container { ...@@ -101,6 +105,7 @@ export default class GameView extends engine.Container {
setup() { setup() {
console.log("setup----game");
MapData.initPoolEle(); MapData.initPoolEle();
this.selectimg = new engine.Image(getTextureByName("选中框")); this.selectimg = new engine.Image(getTextureByName("选中框"));
this.selectimg.mouseEnabled = false; this.selectimg.mouseEnabled = false;
...@@ -214,6 +219,17 @@ export default class GameView extends engine.Container { ...@@ -214,6 +219,17 @@ export default class GameView extends engine.Container {
this.lastatime = Date.now(); this.lastatime = Date.now();
this.addEventListener(engine.Event.ENTER_FRAME,this.onUpdate,this); this.addEventListener(engine.Event.ENTER_FRAME,this.onUpdate,this);
//新手引导遮罩
this.guideCont = new engine.Container();
this.addChild(this.guideCont);
this.guideDraw = new engine.Shape();
this.guideCont.addChild(this.guideDraw);
this.guideCont.visible = false;
this.guideCont.mouseEnabled = false;
this.setGuidePath();
// this.setGuideShow();
// //测试 // //测试
// let testbtn = new engine.Label(); // let testbtn = new engine.Label();
// testbtn.text = "reset"; // testbtn.text = "reset";
...@@ -227,27 +243,29 @@ export default class GameView extends engine.Container { ...@@ -227,27 +243,29 @@ export default class GameView extends engine.Container {
//炸弹道具 //炸弹道具
let zhadanbtn = new engine.Label(); // let zhadanbtn = new engine.Label();
zhadanbtn.text = "炸弹"; // zhadanbtn.text = "炸弹";
zhadanbtn.size = 56; // zhadanbtn.size = 56;
zhadanbtn.width = 200; // zhadanbtn.width = 200;
zhadanbtn.height = 100; // zhadanbtn.height = 100;
this.addChild(zhadanbtn); // this.addChild(zhadanbtn);
zhadanbtn.y = 900; // zhadanbtn.y = 900;
zhadanbtn.fillColor = "red"; // zhadanbtn.fillColor = "red";
zhadanbtn.addEventListener(engine.MouseEvent.CLICK,this.zhadanFunc,this); // zhadanbtn.addEventListener(engine.MouseEvent.CLICK,this.zhadanFunc,this);
//加时间道具 // //加时间道具
let timebtn = new engine.Label(); // let timebtn = new engine.Label();
timebtn.text = "加时"; // timebtn.text = "加时";
timebtn.size = 56; // timebtn.size = 56;
timebtn.width = 200; // timebtn.width = 200;
timebtn.height = 100; // timebtn.height = 100;
this.addChild(timebtn); // this.addChild(timebtn);
timebtn.y = 900; // timebtn.y = 900;
timebtn.x = 500; // timebtn.x = 500;
timebtn.fillColor = "red"; // timebtn.fillColor = "red";
timebtn.addEventListener(engine.MouseEvent.CLICK,this.addTimeFunc,this); // timebtn.addEventListener(engine.MouseEvent.CLICK,this.addTimeFunc,this);
} }
//炸弹 //炸弹
zhadanFunc(){ zhadanFunc(){
...@@ -363,11 +381,12 @@ export default class GameView extends engine.Container { ...@@ -363,11 +381,12 @@ export default class GameView extends engine.Container {
}) })
await fallpro; await fallpro;
let testdata = MapData.levelData[this.level]; let testdata = MapData.levelData[this.level-1];
this.levelData = testdata; this.levelData = testdata;
this.fall("newlevel"); this.fall("newlevel");
} }
start(){ start(){
console.log("game-start");
this.gamestat = 1; this.gamestat = 1;
this.requestGameOver = false; this.requestGameOver = false;
this.selectArr = new Array(); this.selectArr = new Array();
...@@ -384,7 +403,7 @@ export default class GameView extends engine.Container { ...@@ -384,7 +403,7 @@ export default class GameView extends engine.Container {
} }
onUpdate(){ onUpdate(){
let ntime = Date.now(); let ntime = Date.now();
if(this.gamestat==1&&this.ingame){ if(this.gamestat==1&&this.ingame&&!this.inguide){
let passtime = ntime - this.lastframeTime; let passtime = ntime - this.lastframeTime;
if(ntime-this.lastatime>=5000&&!this.ination&&this.canation&&this.selectArr.length==0){ if(ntime-this.lastatime>=5000&&!this.ination&&this.canation&&this.selectArr.length==0){
this.attionEliShow(); this.attionEliShow();
...@@ -425,7 +444,7 @@ export default class GameView extends engine.Container { ...@@ -425,7 +444,7 @@ export default class GameView extends engine.Container {
this.lattices = {}; this.lattices = {};
} }
let testdata = MapData.levelData[this.level]; let testdata = MapData.levelData[this.level-1];
this.levelData = testdata; this.levelData = testdata;
...@@ -665,6 +684,19 @@ export default class GameView extends engine.Container { ...@@ -665,6 +684,19 @@ export default class GameView extends engine.Container {
engine.Tween.removeTweens(snode2); engine.Tween.removeTweens(snode2);
if(this.eliminateArr.length>0){ if(this.eliminateArr.length>0){
if(this.inguide){
this.inguide = false;
engine.Tween.removeTweens(this.guideCont);
engine.Tween.get(this.guideCont)
.to({
alpha:0
},200)
.call(()=>{
this.guideCont.visible = false;
//引导完毕
engine.globalEvent.dispatchEvent('game-guidecomplete',{});
})
}
this.inEliminate = true; this.inEliminate = true;
engine.Tween.get(snode1).to({ engine.Tween.get(snode1).to({
x:snode2x, x:snode2x,
...@@ -969,6 +1001,9 @@ export default class GameView extends engine.Container { ...@@ -969,6 +1001,9 @@ export default class GameView extends engine.Container {
ele.touch = v; ele.touch = v;
} }
} }
engine.globalEvent.dispatchEvent('game-touch',{
cantouch:v
});
if(v){ if(v){
this.lastatime = Date.now(); this.lastatime = Date.now();
...@@ -1692,4 +1727,45 @@ export default class GameView extends engine.Container { ...@@ -1692,4 +1727,45 @@ export default class GameView extends engine.Container {
// console.log("使用炸弹消除的元素",this.eliminateArr); // console.log("使用炸弹消除的元素",this.eliminateArr);
this.eliminate(); this.eliminate();
} }
//指定新手引导
setGuidePath(){
let showidx = ["3_0","3_1","3_2","3_3"];
let ableidx = ["3_0","3_1"];
//非自动,手动算出path
let path = [
[364,7],
[364,479],
[484,479],
[484,7],
]
//画遮罩
//底框609,607
this.guideDraw.clear();
this.guideDraw.beginFill(0x000000,0.7);
this.guideDraw.moveTo(0,0);
this.guideDraw.lineTo(609,0);
this.guideDraw.lineTo(609,607);
this.guideDraw.lineTo(0,607);
this.guideDraw.lineTo(0,0);
this.guideDraw.moveTo(path[0][0],path[0][1]);
for(let i=1;i<path.length;i++){
let idotx = path[i][0];
let idoty = path[i][1];
this.guideDraw.lineTo(idotx,idoty);
}
this.guideDraw.lineTo(path[0][0],path[0][1]);
this.guideDraw.endFill();
}
setGuideShow(){
this.inguide = true;
this.guideCont.visible = true;
this.guideCont.alpha = 0;
engine.Tween.removeTweens(this.guideCont);
engine.Tween.get(this.guideCont)
.to({
alpha:1
},200)
}
} }
...@@ -20,6 +20,7 @@ export class GameWrapper extends engine.Container { ...@@ -20,6 +20,7 @@ export class GameWrapper extends engine.Container {
engine.globalEvent.addEventListener('game-pause',this.pause,this); engine.globalEvent.addEventListener('game-pause',this.pause,this);
engine.globalEvent.addEventListener('game-resume',this.resume,this); engine.globalEvent.addEventListener('game-resume',this.resume,this);
engine.globalEvent.addEventListener('game-recordcomp',this.recordcomp,this); engine.globalEvent.addEventListener('game-recordcomp',this.recordcomp,this);
engine.globalEvent.addEventListener('game-newuserguide',this.newUserGuide,this);
} }
init(event:engine.Event){ init(event:engine.Event){
...@@ -48,4 +49,7 @@ export class GameWrapper extends engine.Container { ...@@ -48,4 +49,7 @@ export class GameWrapper extends engine.Container {
recordcomp(){ recordcomp(){
this._gameView.recordcomp(); this._gameView.recordcomp();
} }
newUserGuide(){
this._gameView.setGuideShow();
}
} }
...@@ -38,11 +38,11 @@ export default class MapData{ ...@@ -38,11 +38,11 @@ export default class MapData{
static levelData:Array<Array<Array<number>>> = [ static levelData:Array<Array<Array<number>>> = [
[ [
[1,2,5,3,4], [2,3,4,5,4],
[3,1,2,4,5], [4,5,3,2,4],
[2,5,3,4,1], [2,5,3,5,1],
[5,4,1,2,3], [3,4,4,5,3],
[4,1,3,5,2], [1,5,2,1,4],
], ],
[ [
[5,2,1,2,1], [5,2,1,2,1],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment