Commit 65ee3b38 authored by zjz1994's avatar zjz1994

代码暂存

parent ec5e1354
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
function injectProps(p) { function injectProps(p) {
engine.injectProp(props, p); engine.injectProp(props, p);
} }
//# sourceMappingURL=props.js.map
function getTexture(uuid) { function getTexture(uuid) {
return engine.Texture.from(getAssetByUUID(uuid).uuid); return engine.Texture.from(getAssetByUUID(uuid).uuid);
...@@ -24,6 +25,7 @@ ...@@ -24,6 +25,7 @@
inst.source = 'asset://' + engine.getAssetByName(name).uuid; inst.source = 'asset://' + engine.getAssetByName(name).uuid;
return inst; return inst;
} }
//# sourceMappingURL=utils.js.map
var Element = (function (_super) { var Element = (function (_super) {
tslib.__extends(Element, _super); tslib.__extends(Element, _super);
...@@ -139,6 +141,7 @@ ...@@ -139,6 +141,7 @@
}; };
return Element; return Element;
}(engine.Container)); }(engine.Container));
//# sourceMappingURL=Element.js.map
var ElementType; var ElementType;
(function (ElementType) { (function (ElementType) {
...@@ -356,6 +359,7 @@ ...@@ -356,6 +359,7 @@
]; ];
return MapData; return MapData;
}()); }());
//# sourceMappingURL=MapData.js.map
var GameView = (function (_super) { var GameView = (function (_super) {
tslib.__extends(GameView, _super); tslib.__extends(GameView, _super);
...@@ -374,6 +378,7 @@ ...@@ -374,6 +378,7 @@
_this.ingameover = false; _this.ingameover = false;
_this.ingame = true; _this.ingame = true;
_this.level = 0; _this.level = 0;
_this.inrecord = false;
_this._seq = 1; _this._seq = 1;
_this.sptime = Date.now(); _this.sptime = Date.now();
_this._score = 0; _this._score = 0;
...@@ -500,6 +505,7 @@ ...@@ -500,6 +505,7 @@
this.ingameover = false; this.ingameover = false;
this.changeHomeShow(mode); this.changeHomeShow(mode);
this.initContainer(); this.initContainer();
this.sptime = Date.now();
}; };
Object.defineProperty(GameView.prototype, "score", { Object.defineProperty(GameView.prototype, "score", {
get: function () { get: function () {
...@@ -520,10 +526,10 @@ ...@@ -520,10 +526,10 @@
var lshowtime = Math.round(this._gametime); var lshowtime = Math.round(this._gametime);
var nshowtime = Math.round(time); var nshowtime = Math.round(time);
if (lshowtime != nshowtime) { if (lshowtime != nshowtime) {
engine.globalEvent.dispatchEvent('game-time-update', { time: nshowtime }); if (this.gamestat == 1 && nshowtime < 1) {
if (nshowtime <= 0) {
this.gameOver(); this.gameOver();
} }
engine.globalEvent.dispatchEvent('game-time-update', { time: nshowtime });
} }
this._gametime = time; this._gametime = time;
}, },
...@@ -535,10 +541,14 @@ ...@@ -535,10 +541,14 @@
this.unShowEleAttion(); this.unShowEleAttion();
this.anicontainer.removeChild(this.selectimg); this.anicontainer.removeChild(this.selectimg);
this.ingameover = true; this.ingameover = true;
this.checkGameOver(); console.log("倒计时结束1=============", this.ingameover, this.inEliminate, this.inrecord);
this.checkGameOver("time-over");
}; };
GameView.prototype.checkGameOver = function () { GameView.prototype.checkGameOver = function (type) {
if (this.ingameover && !this.inEliminate) { if (this.ingameover) {
console.log("倒计时已结束2==========", this.inEliminate, this.inrecord, type);
}
if (this.ingameover && !this.inEliminate && !this.inrecord) {
engine.globalEvent.dispatchEvent("game-over", { engine.globalEvent.dispatchEvent("game-over", {
score: this.score score: this.score
}); });
...@@ -608,7 +618,8 @@ ...@@ -608,7 +618,8 @@
this.attionEliShow(); this.attionEliShow();
} }
if (this.gametime && this.gametime > 0) { if (this.gametime && this.gametime > 0) {
this.gametime -= passtime / 1000; var ngtime = this.gametime - (passtime / 1000);
this.gametime = ngtime;
} }
} }
if (this.homeimgday) { if (this.homeimgday) {
...@@ -832,6 +843,7 @@ ...@@ -832,6 +843,7 @@
_this.selectArr = new Array(); _this.selectArr = new Array();
_this.recordGame(); _this.recordGame();
_this.changeEnable(true); _this.changeEnable(true);
_this.checkGameOver("changeElePos");
}); });
} }
}; };
...@@ -982,6 +994,9 @@ ...@@ -982,6 +994,9 @@
return [4, Promise.all(fallPromise)]; return [4, Promise.all(fallPromise)];
case 1: case 1:
_a.sent(); _a.sent();
if (type == "newlevel") {
this.sptime = Date.now();
}
this.checkEliminate(); this.checkEliminate();
if (this.eliminateArr.length > 0) { if (this.eliminateArr.length > 0) {
return [2, this.eliminate()]; return [2, this.eliminate()];
...@@ -991,9 +1006,11 @@ ...@@ -991,9 +1006,11 @@
isdiedata = this.attionEliminate(); isdiedata = this.attionEliminate();
if (isdiedata && isdiedata.length == 3) { if (isdiedata && isdiedata.length == 3) {
this.inEliminate = false; this.inEliminate = false;
this.recordGame(); if (type != "newlevel") {
this.recordGame();
}
this.changeEnable(true); this.changeEnable(true);
this.checkGameOver(); this.checkGameOver("fall");
} }
else { else {
this.solveDieMap("fall"); this.solveDieMap("fall");
...@@ -1231,14 +1248,19 @@ ...@@ -1231,14 +1248,19 @@
} }
this.changeEnable(true); this.changeEnable(true);
this.inEliminate = false; this.inEliminate = false;
this.checkGameOver(); this.checkGameOver("changeToFuHuoPos");
} }
return [2]; return [2];
} }
}); });
}); });
}; };
GameView.prototype.recordcomp = function () {
this.inrecord = false;
this.checkGameOver("recordcomp");
};
GameView.prototype.recordGame = function () { GameView.prototype.recordGame = function () {
this.inrecord = true;
this.eptime = Date.now(); this.eptime = Date.now();
engine.globalEvent.dispatchEvent('game-record', { engine.globalEvent.dispatchEvent('game-record', {
score: this.seqscore, score: this.seqscore,
...@@ -1656,6 +1678,7 @@ ...@@ -1656,6 +1678,7 @@
}; };
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);
...@@ -1668,6 +1691,7 @@ ...@@ -1668,6 +1691,7 @@
engine.globalEvent.addEventListener('game-start', _this.start, _this); engine.globalEvent.addEventListener('game-start', _this.start, _this);
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);
return _this; return _this;
} }
GameWrapper.prototype.init = function (event) { GameWrapper.prototype.init = function (event) {
...@@ -1693,8 +1717,12 @@ ...@@ -1693,8 +1717,12 @@
GameWrapper.prototype.resume = function () { GameWrapper.prototype.resume = function () {
this._gameView.resume(); this._gameView.resume();
}; };
GameWrapper.prototype.recordcomp = function () {
this._gameView.recordcomp();
};
return GameWrapper; return GameWrapper;
}(engine.Container)); }(engine.Container));
//# sourceMappingURL=GameWrapper.js.map
function index (props) { function index (props) {
prepareProps(); prepareProps();
...@@ -1702,6 +1730,7 @@ ...@@ -1702,6 +1730,7 @@
var instance = new GameWrapper(); var instance = new GameWrapper();
return instance; return instance;
} }
//# sourceMappingURL=index.js.map
return index; return index;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -102,6 +102,9 @@ ...@@ -102,6 +102,9 @@
}, },
"game-resume": { "game-resume": {
"alias": "继续" "alias": "继续"
},
"game-recordcomp": {
"alias": "记录完毕"
} }
}, },
"out": { "out": {
......
...@@ -71,6 +71,7 @@ export default class GameView extends engine.Container { ...@@ -71,6 +71,7 @@ export default class GameView extends engine.Container {
ingame = true; ingame = true;
level = 0; level = 0;
inrecord = false;
set gamestat(stat){//1游戏中,2,游戏外 set gamestat(stat){//1游戏中,2,游戏外
this._gamestat = stat; this._gamestat = stat;
if(stat==2){ if(stat==2){
...@@ -229,6 +230,7 @@ export default class GameView extends engine.Container { ...@@ -229,6 +230,7 @@ export default class GameView extends engine.Container {
this.ingameover = false; this.ingameover = false;
this.changeHomeShow(mode); this.changeHomeShow(mode);
this.initContainer(); this.initContainer();
this.sptime = Date.now();
} }
_score = 0; _score = 0;
set score(num){ set score(num){
...@@ -243,10 +245,10 @@ export default class GameView extends engine.Container { ...@@ -243,10 +245,10 @@ export default class GameView extends engine.Container {
let nshowtime = Math.round(time); let nshowtime = Math.round(time);
if(lshowtime!=nshowtime){ if(lshowtime!=nshowtime){
// console.log("倒计时更新",nshowtime); // console.log("倒计时更新",nshowtime);
engine.globalEvent.dispatchEvent('game-time-update',{time:nshowtime}); if(this.gamestat==1&&nshowtime<1){
if(nshowtime<=0){
this.gameOver(); this.gameOver();
} }
engine.globalEvent.dispatchEvent('game-time-update',{time:nshowtime});
} }
this._gametime = time; this._gametime = time;
} }
...@@ -255,16 +257,19 @@ export default class GameView extends engine.Container { ...@@ -255,16 +257,19 @@ export default class GameView extends engine.Container {
} }
inEliminate:boolean = false; inEliminate:boolean = false;
gameOver(){ gameOver(){
// console.log("游戏结束");
this.gamestat = 2; this.gamestat = 2;
this.unShowEleAttion(); this.unShowEleAttion();
this.anicontainer.removeChild(this.selectimg); this.anicontainer.removeChild(this.selectimg);
this.ingameover = true; this.ingameover = true;
console.log("倒计时结束1=============",this.ingameover,this.inEliminate,this.inrecord);
this.checkGameOver(); this.checkGameOver("time-over");
}; };
checkGameOver(){ checkGameOver(type){
if(this.ingameover&&!this.inEliminate){ if(this.ingameover){
console.log("倒计时已结束2==========",this.inEliminate,this.inrecord,type);
}
if(this.ingameover&&!this.inEliminate&&!this.inrecord){
engine.globalEvent.dispatchEvent("game-over",{ engine.globalEvent.dispatchEvent("game-over",{
score:this.score score:this.score
}) })
...@@ -328,7 +333,8 @@ export default class GameView extends engine.Container { ...@@ -328,7 +333,8 @@ export default class GameView extends engine.Container {
this.attionEliShow(); this.attionEliShow();
} }
if(this.gametime&&this.gametime>0){ if(this.gametime&&this.gametime>0){
this.gametime -= passtime/1000; let ngtime = this.gametime-(passtime/1000);
this.gametime = ngtime;
} }
} }
if(this.homeimgday){ if(this.homeimgday){
...@@ -586,6 +592,7 @@ export default class GameView extends engine.Container { ...@@ -586,6 +592,7 @@ export default class GameView extends engine.Container {
this.recordGame(); this.recordGame();
this.changeEnable(true); this.changeEnable(true);
this.checkGameOver("changeElePos");
}) })
} }
} }
...@@ -730,6 +737,10 @@ export default class GameView extends engine.Container { ...@@ -730,6 +737,10 @@ export default class GameView extends engine.Container {
} }
await Promise.all(fallPromise); await Promise.all(fallPromise);
if(type=="newlevel"){
this.sptime = Date.now();
}
this.checkEliminate(); this.checkEliminate();
if(this.eliminateArr.length>0){ if(this.eliminateArr.length>0){
return this.eliminate(); return this.eliminate();
...@@ -739,9 +750,11 @@ export default class GameView extends engine.Container { ...@@ -739,9 +750,11 @@ export default class GameView extends engine.Container {
if(isdiedata&&isdiedata.length==3){//没死 if(isdiedata&&isdiedata.length==3){//没死
this.inEliminate = false; this.inEliminate = false;
this.recordGame(); if(type!="newlevel"){
this.recordGame();
}
this.changeEnable(true); this.changeEnable(true);
this.checkGameOver(); this.checkGameOver("fall");
}else{//死图处理 }else{//死图处理
this.solveDieMap("fall"); this.solveDieMap("fall");
} }
...@@ -1019,12 +1032,17 @@ export default class GameView extends engine.Container { ...@@ -1019,12 +1032,17 @@ export default class GameView extends engine.Container {
} }
this.changeEnable(true); this.changeEnable(true);
this.inEliminate = false; this.inEliminate = false;
this.checkGameOver(); this.checkGameOver("changeToFuHuoPos");
} }
} }
recordcomp(){
this.inrecord = false;
this.checkGameOver("recordcomp");
}
//游戏记录 //游戏记录
recordGame(){ recordGame(){
//操作记录 //操作记录
this.inrecord = true;
this.eptime = Date.now(); this.eptime = Date.now();
engine.globalEvent.dispatchEvent('game-record', engine.globalEvent.dispatchEvent('game-record',
{ {
......
...@@ -19,6 +19,7 @@ export class GameWrapper extends engine.Container { ...@@ -19,6 +19,7 @@ export class GameWrapper extends engine.Container {
engine.globalEvent.addEventListener('game-start',this.start,this); engine.globalEvent.addEventListener('game-start',this.start,this);
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);
} }
init(event:engine.Event){ init(event:engine.Event){
...@@ -44,4 +45,7 @@ export class GameWrapper extends engine.Container { ...@@ -44,4 +45,7 @@ export class GameWrapper extends engine.Container {
resume(){ resume(){
this._gameView.resume(); this._gameView.resume();
} }
recordcomp(){
this._gameView.recordcomp();
}
} }
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