Commit f2c6af7b authored by zjz1994's avatar zjz1994

代码暂存

parent f0511083
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -51,9 +51,13 @@ function launchWithCustomModule(customModule) { ...@@ -51,9 +51,13 @@ function launchWithCustomModule(customModule) {
mode:"day" mode:"day"
}); });
}, 500); }, 500);
setTimeout(() => { setTimeout(() => {
engine.globalEvent.dispatchEvent('game-start'); engine.globalEvent.dispatchEvent('game-newuserguide');
}, 700); }, 700);
// setTimeout(() => {
// engine.globalEvent.dispatchEvent('game-start');
// }, 700);
}); });
} }
......
...@@ -525,12 +525,6 @@ ...@@ -525,12 +525,6 @@
this.guideCont.mouseEnabled = false; this.guideCont.mouseEnabled = false;
this.setGuidePath(); this.setGuidePath();
}; };
GameView.prototype.zhadanFunc = function () {
this.useBoom = true;
};
GameView.prototype.addTimeFunc = function () {
console.log("加时间");
};
GameView.prototype.changeAni = function () { GameView.prototype.changeAni = function () {
this.changeHomeShow("night"); this.changeHomeShow("night");
}; };
...@@ -604,10 +598,7 @@ ...@@ -604,10 +598,7 @@
}; };
GameView.prototype.reset = function (time, level, mode) { GameView.prototype.reset = function (time, level, mode) {
return tslib.__awaiter(this, void 0, void 0, function () { return tslib.__awaiter(this, void 0, void 0, function () {
var key, rcname, rcele, rcelex, rceley, rcetype, fallpro, testdata;
return tslib.__generator(this, function (_a) { return tslib.__generator(this, function (_a) {
switch (_a.label) {
case 0:
this.anicontainer.removeChild(this.selectimg); this.anicontainer.removeChild(this.selectimg);
this.selectArr = new Array(); this.selectArr = new Array();
this.gametime = time; this.gametime = time;
...@@ -617,30 +608,8 @@ ...@@ -617,30 +608,8 @@
this.seq = 1; this.seq = 1;
this.changeHomeShow(mode); this.changeHomeShow(mode);
this.changeEnable(false); this.changeEnable(false);
for (key in this.lattices) { this.fall();
rcname = this.lattices[key];
rcele = this.container.getChildByName(rcname);
if (rcele) {
rcelex = rcele.x;
rceley = rcele.y;
rcetype = rcele.type;
this.lattices[key] = "empty";
this.goDisplayAni1(rcele, rcetype, rcelex, rceley);
}
}
fallpro = new Promise(function (res) {
setTimeout(function () {
res();
}, 400);
});
return [4, fallpro];
case 1:
_a.sent();
testdata = MapData.levelData[this.level - 1];
this.levelData = testdata;
this.fall("newlevel");
return [2]; return [2];
}
}); });
}); });
}; };
...@@ -653,6 +622,7 @@ ...@@ -653,6 +622,7 @@
}; };
GameView.prototype.pause = function () { GameView.prototype.pause = function () {
this.ingame = false; this.ingame = false;
this.unShowEleAttion();
}; };
GameView.prototype.resume = function () { GameView.prototype.resume = function () {
this.lastframeTime = Date.now(); this.lastframeTime = Date.now();
...@@ -769,7 +739,12 @@ ...@@ -769,7 +739,12 @@
} }
}; };
GameView.prototype.selectele = function (e) { GameView.prototype.selectele = function (e) {
console.log("选中元素");
if (!this.ingame) {
return;
}
var data = e.data; var data = e.data;
console.log(data);
var sr = data.r; var sr = data.r;
var sc = data.c; var sc = data.c;
var type = data.type; var type = data.type;
...@@ -1796,6 +1771,7 @@ ...@@ -1796,6 +1771,7 @@
}; };
GameView.prototype.boomeEle = function (row, col) { GameView.prototype.boomeEle = function (row, col) {
this.useBoom = false; this.useBoom = false;
engine.globalEvent.dispatchEvent('game-useboomafter', {});
this.anicontainer.removeChild(this.selectimg); this.anicontainer.removeChild(this.selectimg);
this.changeEnable(false); this.changeEnable(false);
this.selectArr = new Array(); this.selectArr = new Array();
...@@ -1859,15 +1835,40 @@ ...@@ -1859,15 +1835,40 @@
this.inguide = true; this.inguide = true;
this.guideCont.visible = true; this.guideCont.visible = true;
this.guideCont.alpha = 0; this.guideCont.alpha = 0;
var ableidx = ["0_3", "1_3"];
for (var key in this.lattices) {
var isinable = ableidx.indexOf(key);
var ieliname = this.lattices[key];
var ielinode = this.container.getChildByName(ieliname);
if (ielinode) {
if (isinable == -1) {
ielinode.touch = false;
}
else {
ielinode.touch = true;
}
}
}
engine.Tween.removeTweens(this.guideCont); engine.Tween.removeTweens(this.guideCont);
engine.Tween.get(this.guideCont) engine.Tween.get(this.guideCont)
.to({ .to({
alpha: 1 alpha: 1
}, 200); }, 200);
}; };
GameView.prototype.usetool = function (data) {
var tooltype = data.tooltype;
if (tooltype == "time") {
var addtime = data.addtime;
var ngtime = this.gametime + addtime;
this.gametime = ngtime;
}
else if (tooltype == "boom") {
var use = data.useboom;
this.useBoom = use;
}
};
return GameView; return GameView;
}(engine.Container)); }(engine.Container));
//# sourceMappingURL=GameView.js.map
var GameWrapper = (function (_super) { var GameWrapper = (function (_super) {
tslib.__extends(GameWrapper, _super); tslib.__extends(GameWrapper, _super);
...@@ -1882,6 +1883,7 @@ ...@@ -1882,6 +1883,7 @@
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); engine.globalEvent.addEventListener('game-newuserguide', _this.newUserGuide, _this);
engine.globalEvent.addEventListener('game-usetool', _this.usetool, _this);
return _this; return _this;
} }
GameWrapper.prototype.init = function (event) { GameWrapper.prototype.init = function (event) {
...@@ -1911,6 +1913,10 @@ ...@@ -1911,6 +1913,10 @@
GameWrapper.prototype.newUserGuide = function () { GameWrapper.prototype.newUserGuide = function () {
this._gameView.setGuideShow(); this._gameView.setGuideShow();
}; };
GameWrapper.prototype.usetool = function (event) {
var data = event.data;
this._gameView.usetool(data);
};
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.
...@@ -96,6 +96,9 @@ ...@@ -96,6 +96,9 @@
}, },
"game-newuserguide":{ "game-newuserguide":{
"alias": "新手引导" "alias": "新手引导"
},
"game-usetool":{
"alias": "使用道具"
} }
}, },
"out": { "out": {
...@@ -137,6 +140,12 @@ ...@@ -137,6 +140,12 @@
"alias": "游戏引导完毕", "alias": "游戏引导完毕",
"data": { "data": {
}
},
"game-useboomafter": {
"alias": "炸弹使用完毕",
"data": {
} }
} }
} }
......
...@@ -266,14 +266,6 @@ export default class GameView extends engine.Container { ...@@ -266,14 +266,6 @@ export default class GameView extends engine.Container {
// timebtn.addEventListener(engine.MouseEvent.CLICK,this.addTimeFunc,this); // timebtn.addEventListener(engine.MouseEvent.CLICK,this.addTimeFunc,this);
}
//炸弹
zhadanFunc(){
this.useBoom = true;
}
//加时间
addTimeFunc(){
console.log("加时间");
} }
changeAni(){ changeAni(){
this.changeHomeShow("night"); this.changeHomeShow("night");
...@@ -358,32 +350,32 @@ export default class GameView extends engine.Container { ...@@ -358,32 +350,32 @@ export default class GameView extends engine.Container {
this.changeHomeShow(mode); this.changeHomeShow(mode);
this.changeEnable(false); this.changeEnable(false);
for(let key in this.lattices){ // for(let key in this.lattices){
let rcname = this.lattices[key]; // let rcname = this.lattices[key];
let rcele:Element = this.container.getChildByName(rcname); // let rcele:Element = this.container.getChildByName(rcname);
if(rcele){ // if(rcele){
let rcelex = rcele.x; // let rcelex = rcele.x;
let rceley = rcele.y; // let rceley = rcele.y;
let rcetype = rcele.type; // let rcetype = rcele.type;
// this.container.removeChild(rcele); // // this.container.removeChild(rcele);
// MapData.recoverEle(rcele,rcetype); // // MapData.recoverEle(rcele,rcetype);
this.lattices[key] = "empty"; // this.lattices[key] = "empty";
// this.goDisplayAni(rcetype,rcelex,rceley); // // this.goDisplayAni(rcetype,rcelex,rceley);
this.goDisplayAni1(rcele,rcetype,rcelex,rceley); // this.goDisplayAni1(rcele,rcetype,rcelex,rceley);
} // }
} // }
let fallpro = new Promise(res=>{ // let fallpro = new Promise(res=>{
setTimeout(function(){ // setTimeout(function(){
res(); // res();
},400); // },400);
}) // })
await fallpro; // await fallpro;
let testdata = MapData.levelData[this.level-1]; // let testdata = MapData.levelData[this.level-1];
this.levelData = testdata; // this.levelData = testdata;
this.fall("newlevel"); this.fall();
} }
start(){ start(){
console.log("game-start"); console.log("game-start");
...@@ -395,6 +387,7 @@ export default class GameView extends engine.Container { ...@@ -395,6 +387,7 @@ export default class GameView extends engine.Container {
pause(){ pause(){
// console.log("游戏暂停"); // console.log("游戏暂停");
this.ingame = false; this.ingame = false;
this.unShowEleAttion();
} }
resume(){ resume(){
// console.log("游戏继续"); // console.log("游戏继续");
...@@ -543,6 +536,9 @@ export default class GameView extends engine.Container { ...@@ -543,6 +536,9 @@ export default class GameView extends engine.Container {
newSelect:boolean = false; newSelect:boolean = false;
//选择元素 //选择元素
selectele(e:engine.Event){ selectele(e:engine.Event){
if(!this.ingame){
return;
}
let data = e.data; let data = e.data;
let sr = data.r; let sr = data.r;
let sc = data.c; let sc = data.c;
...@@ -1686,6 +1682,9 @@ export default class GameView extends engine.Container { ...@@ -1686,6 +1682,9 @@ export default class GameView extends engine.Container {
//使用炸弹 //使用炸弹
boomeEle(row,col){ boomeEle(row,col){
this.useBoom = false; this.useBoom = false;
//炸弹使用完毕
engine.globalEvent.dispatchEvent('game-useboomafter',{});
this.anicontainer.removeChild(this.selectimg); this.anicontainer.removeChild(this.selectimg);
this.changeEnable(false); this.changeEnable(false);
this.selectArr = new Array(); this.selectArr = new Array();
...@@ -1730,8 +1729,8 @@ export default class GameView extends engine.Container { ...@@ -1730,8 +1729,8 @@ export default class GameView extends engine.Container {
//指定新手引导 //指定新手引导
setGuidePath(){ setGuidePath(){
let showidx = ["3_0","3_1","3_2","3_3"]; let showidx = ["0_3","1_3","2_3","3_3"];
let ableidx = ["3_0","3_1"];
//非自动,手动算出path //非自动,手动算出path
let path = [ let path = [
[364,7], [364,7],
...@@ -1762,10 +1761,38 @@ export default class GameView extends engine.Container { ...@@ -1762,10 +1761,38 @@ export default class GameView extends engine.Container {
this.inguide = true; this.inguide = true;
this.guideCont.visible = true; this.guideCont.visible = true;
this.guideCont.alpha = 0; this.guideCont.alpha = 0;
let ableidx = ["0_3","1_3"];
for(let key in this.lattices){
let isinable = ableidx.indexOf(key);
let ieliname = this.lattices[key];
let ielinode:Element = this.container.getChildByName(ieliname);
if(ielinode){
if(isinable==-1){
ielinode.touch = false;
}else{
ielinode.touch = true;
}
}
}
engine.Tween.removeTweens(this.guideCont); engine.Tween.removeTweens(this.guideCont);
engine.Tween.get(this.guideCont) engine.Tween.get(this.guideCont)
.to({ .to({
alpha:1 alpha:1
},200) },200)
} }
//使用道具
usetool(data){
let tooltype = data.tooltype;
if(tooltype=="time"){//加时道具
let addtime = data.addtime;
let ngtime = this.gametime+addtime;
this.gametime = ngtime;
}else if(tooltype=="boom"){//炸弹道具
let use = data.useboom;
this.useBoom = use;
}
}
} }
...@@ -21,6 +21,7 @@ export class GameWrapper extends engine.Container { ...@@ -21,6 +21,7 @@ export class GameWrapper extends engine.Container {
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); engine.globalEvent.addEventListener('game-newuserguide',this.newUserGuide,this);
engine.globalEvent.addEventListener('game-usetool',this.usetool,this);
} }
init(event:engine.Event){ init(event:engine.Event){
...@@ -52,4 +53,8 @@ export class GameWrapper extends engine.Container { ...@@ -52,4 +53,8 @@ export class GameWrapper extends engine.Container {
newUserGuide(){ newUserGuide(){
this._gameView.setGuideShow(); this._gameView.setGuideShow();
} }
usetool(event:engine.Event){
let data = event.data;
this._gameView.usetool(data);
}
} }
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