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