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