Commit 0cb38e09 authored by unknown's avatar unknown

时间到了强行关闭游戏,解决提交问题

parent cac515e4
...@@ -1981,7 +1981,7 @@ ...@@ -1981,7 +1981,7 @@
"__id__": 78 "__id__": 78
} }
], ],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 83 "__id__": 83
......
...@@ -75,7 +75,7 @@ export class VHFillNumCtr extends Component { ...@@ -75,7 +75,7 @@ export class VHFillNumCtr extends Component {
} }
onCloseGameDescView() { onCloseGameDescView() {
this.gameState = GAME_STATE.RUN; // this.gameState = GAME_STATE.RUN;
} }
setGameData(resData: object) { setGameData(resData: object) {
...@@ -104,13 +104,14 @@ export class VHFillNumCtr extends Component { ...@@ -104,13 +104,14 @@ export class VHFillNumCtr extends Component {
director.on("VHFM_click", this.onItemClick, this); director.on("VHFM_click", this.onItemClick, this);
director.on("begin_countdown_end", () => { director.on("begin_countdown_end", () => {
//引导 //引导
if (!this.isShowGameDescViewOnce) { // if (!this.isShowGameDescViewOnce) {
this.gameState = GAME_STATE.PAUSE; // this.gameState = GAME_STATE.PAUSE;
this.showGameDescView(); // this.showGameDescView();
} // }
else { // else {
this.gameState = GAME_STATE.RUN; // this.gameState = GAME_STATE.RUN;
} // }
this.gameState = GAME_STATE.RUN;
}, this); }, this);
director.on("game_desc_close", this.onCloseGameDescView, this); director.on("game_desc_close", this.onCloseGameDescView, this);
this.gameStart(); this.gameStart();
...@@ -125,6 +126,22 @@ export class VHFillNumCtr extends Component { ...@@ -125,6 +126,22 @@ export class VHFillNumCtr extends Component {
if (this.gameState == GAME_STATE.READY || this.gameState == GAME_STATE.END || this.gameState == GAME_STATE.PAUSE) { if (this.gameState == GAME_STATE.READY || this.gameState == GAME_STATE.END || this.gameState == GAME_STATE.PAUSE) {
return; return;
} }
// 在视频中运行则到时间直接关闭
if (Utils.getValueFromHref("gameEndTime")) {
let gameEndTime = Number(Utils.getValueFromHref("gameEndTime"));
if (!this.isPlayCountdownMus && (gameEndTime - new Date().getTime()) / 1000 < 3.5 + 3) {
this.isPlayCountdownMus = true;
AudioMgr.playEffect(countdownMus);
}
if ((gameEndTime - new Date().getTime()) / 1000 <= 0 + 3) {
console.log(`游戏时间到`);
this.gameEnd(false);
return;
}
this.countdownLab.string = Utils.formatTime(gameEndTime - new Date().getTime());
return;
}
//
this.costTime += dt; this.costTime += dt;
if (!this.isPlayCountdownMus && this.totalTime - this.costTime < 3.5) { if (!this.isPlayCountdownMus && this.totalTime - this.costTime < 3.5) {
this.isPlayCountdownMus = true; this.isPlayCountdownMus = true;
......
...@@ -76,7 +76,7 @@ export class RingSumCtr extends Component { ...@@ -76,7 +76,7 @@ export class RingSumCtr extends Component {
//@ts-ignore //@ts-ignore
this.isShowGameDescViewOnce = false; this.isShowGameDescViewOnce = false;
} }
else{ else {
this.isShowGameDescViewOnce = true; this.isShowGameDescViewOnce = true;
} }
} }
...@@ -191,12 +191,12 @@ export class RingSumCtr extends Component { ...@@ -191,12 +191,12 @@ export class RingSumCtr extends Component {
this.curRSItem = null!; this.curRSItem = null!;
this.orgItemData = ""; this.orgItemData = "";
//看看是不是有相同数字 //看看是不是有相同数字
if(!this.circle.checkRepeat()){ if (!this.circle.checkRepeat()) {
if(this.checkWin()){ if (this.checkWin()) {
console.log(`赢了`); console.log(`赢了`);
this.gameEnd(true); this.gameEnd(true);
} }
else{ else {
console.log(`还没赢`); console.log(`还没赢`);
} }
} }
...@@ -228,11 +228,27 @@ export class RingSumCtr extends Component { ...@@ -228,11 +228,27 @@ export class RingSumCtr extends Component {
} }
} }
//倒计时 //倒计时
countdownTime(dt: number) { countdownTime(dt: number) {
if (this.gameState == GAME_STATE.READY || this.gameState == GAME_STATE.END || this.gameState == GAME_STATE.PAUSE) { if (this.gameState == GAME_STATE.READY || this.gameState == GAME_STATE.END || this.gameState == GAME_STATE.PAUSE) {
return; return;
} }
// 在视频中运行则到时间直接关闭
if (Utils.getValueFromHref("gameEndTime")) {
let gameEndTime = Number(Utils.getValueFromHref("gameEndTime"));
if (!this.isPlayCountdownMus && (gameEndTime - new Date().getTime()) / 1000 < 3.5 + 3) {
this.isPlayCountdownMus = true;
AudioMgr.playEffect(countdownMus);
}
if ((gameEndTime - new Date().getTime()) / 1000 <= 0 + 3) {
console.log(`游戏时间到`);
this.gameEnd(false);
return;
}
this.countdownLab.string = Utils.formatTime(gameEndTime - new Date().getTime());
return;
}
//
this.costTime += dt; this.costTime += dt;
if (!this.isPlayCountdownMus && this.totalTime - this.costTime < 3.5) { if (!this.isPlayCountdownMus && this.totalTime - this.costTime < 3.5) {
this.isPlayCountdownMus = true; this.isPlayCountdownMus = true;
...@@ -246,7 +262,7 @@ export class RingSumCtr extends Component { ...@@ -246,7 +262,7 @@ export class RingSumCtr extends Component {
this.countdownLab.string = Utils.formatTime(Math.floor((this.totalTime - this.costTime) * 1000)); this.countdownLab.string = Utils.formatTime(Math.floor((this.totalTime - this.costTime) * 1000));
} }
update (deltaTime: number) { update(deltaTime: number) {
// [4] // [4]
this.countdownTime(deltaTime); this.countdownTime(deltaTime);
} }
......
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