Commit 0cb38e09 authored by unknown's avatar unknown

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

parent cac515e4
......@@ -1981,7 +1981,7 @@
"__id__": 78
}
],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 83
......
......@@ -75,7 +75,7 @@ export class VHFillNumCtr extends Component {
}
onCloseGameDescView() {
this.gameState = GAME_STATE.RUN;
// this.gameState = GAME_STATE.RUN;
}
setGameData(resData: object) {
......@@ -104,13 +104,14 @@ export class VHFillNumCtr extends Component {
director.on("VHFM_click", this.onItemClick, this);
director.on("begin_countdown_end", () => {
//引导
if (!this.isShowGameDescViewOnce) {
this.gameState = GAME_STATE.PAUSE;
this.showGameDescView();
}
else {
this.gameState = GAME_STATE.RUN;
}
// if (!this.isShowGameDescViewOnce) {
// this.gameState = GAME_STATE.PAUSE;
// this.showGameDescView();
// }
// else {
// this.gameState = GAME_STATE.RUN;
// }
this.gameState = GAME_STATE.RUN;
}, this);
director.on("game_desc_close", this.onCloseGameDescView, this);
this.gameStart();
......@@ -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) {
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;
if (!this.isPlayCountdownMus && this.totalTime - this.costTime < 3.5) {
this.isPlayCountdownMus = true;
......
......@@ -76,7 +76,7 @@ export class RingSumCtr extends Component {
//@ts-ignore
this.isShowGameDescViewOnce = false;
}
else{
else {
this.isShowGameDescViewOnce = true;
}
}
......@@ -191,12 +191,12 @@ export class RingSumCtr extends Component {
this.curRSItem = null!;
this.orgItemData = "";
//看看是不是有相同数字
if(!this.circle.checkRepeat()){
if(this.checkWin()){
if (!this.circle.checkRepeat()) {
if (this.checkWin()) {
console.log(`赢了`);
this.gameEnd(true);
}
else{
else {
console.log(`还没赢`);
}
}
......@@ -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) {
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;
if (!this.isPlayCountdownMus && this.totalTime - this.costTime < 3.5) {
this.isPlayCountdownMus = true;
......@@ -246,7 +262,7 @@ export class RingSumCtr extends Component {
this.countdownLab.string = Utils.formatTime(Math.floor((this.totalTime - this.costTime) * 1000));
}
update (deltaTime: number) {
update(deltaTime: number) {
// [4]
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