优化冻结,暂停功能等,
This commit is contained in:
parent
83b23cf958
commit
62fe4d309f
|
|
@ -24720,7 +24720,7 @@
|
|||
"_prefab": {
|
||||
"__id__": 566
|
||||
},
|
||||
"_opacity": 200,
|
||||
"_opacity": 250,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 0,
|
||||
|
|
|
|||
|
|
@ -1281,6 +1281,9 @@ export default class Block extends cc.Component {
|
|||
// 8. 延时检测游戏是否结束
|
||||
// ============================================
|
||||
removeAction(diraction, type) {
|
||||
// 记住这次操作开始时的冻结世代。移出动画完成前如果玩家才使用冻结,
|
||||
// 延时回调不能把这个新冻结解除。
|
||||
const actionFreezeVersion = MapConroler._instance.freezeVersion;
|
||||
this.node.off(cc.Node.EventType.TOUCH_START);
|
||||
this.node.off(cc.Node.EventType.TOUCH_MOVE);
|
||||
this.node.off(cc.Node.EventType.TOUCH_CANCEL);
|
||||
|
|
@ -1413,7 +1416,7 @@ export default class Block extends cc.Component {
|
|||
MapConroler._instance.upDoor(tempColor);
|
||||
}, 250);
|
||||
|
||||
MapConroler._instance.nextLevel(1);
|
||||
MapConroler._instance.nextLevel(1, actionFreezeVersion);
|
||||
let colorTemp = this.color;
|
||||
if (this.node) {
|
||||
this.over = true;
|
||||
|
|
|
|||
|
|
@ -132,6 +132,7 @@ export default class MapConroler extends cc.Component {
|
|||
buttonWall: any; //按钮墙数组
|
||||
riseFallBlock: any; //升降地块数组
|
||||
scheduleCallback: any;//倒计时用
|
||||
freezeVersion: number = 0;//每次启用时间冻结时递增,用于识别冻结前已排队的异步回调
|
||||
homeCanTouch: boolean = true;//按钮可用状态
|
||||
againCanTouch: boolean = true;//重玩按钮可以用状态
|
||||
gameOver: boolean = false;//游戏结束状态
|
||||
|
|
@ -3143,12 +3144,21 @@ export default class MapConroler extends cc.Component {
|
|||
}
|
||||
|
||||
//判断游戏成功下一关
|
||||
nextLevel(num: number) {
|
||||
nextLevel(num: number, actionFreezeVersion: number = this.freezeVersion) {
|
||||
if (num == 1) {
|
||||
this.openIce();
|
||||
if (this.node.parent.parent.parent.getChildByName("Pause").active == false && !this.shopPause) {
|
||||
// 方块移出动画是延时完成的。如果动画开始后才使用冻结,
|
||||
// 这个旧回调不应该立即解除新的冻结状态。
|
||||
const iceActive = this.node.parent.getChildByName("Ice").active;
|
||||
const actionStartedBeforeFreeze = iceActive && actionFreezeVersion != this.freezeVersion;
|
||||
if (!actionStartedBeforeFreeze) {
|
||||
this.openIce();
|
||||
}
|
||||
if (this.iceTrue() == false && this.node.parent.parent.parent.getChildByName("Pause").active == false && !this.shopPause) {
|
||||
this.pause = false;
|
||||
}
|
||||
else if (iceActive) {
|
||||
this.pause = true;
|
||||
}
|
||||
} else {
|
||||
if (this.iceTrue() == true) {
|
||||
this.pause = true;
|
||||
|
|
@ -3839,14 +3849,6 @@ export default class MapConroler extends cc.Component {
|
|||
return;
|
||||
}
|
||||
|
||||
if (this.node.parent.getChildByName("Ice").active) {
|
||||
this.freezeMask.active = false;
|
||||
let freezeBtn = this.node.parent.getChildByName("Bottom").getChildByName("timeBtn");
|
||||
freezeBtn.getComponent("btnControl").setTouch(true);
|
||||
this.node.parent.getChildByName("Ice").getChildByName("skeleton").active = false;
|
||||
this.node.parent.getChildByName("Ice").active = false;
|
||||
}
|
||||
|
||||
if (data.type == "time") {
|
||||
if (cc.fx.GameConfig.GM_INFO.review < 2)
|
||||
cc.fx.GameConfig.GM_INFO.review += 1;
|
||||
|
|
@ -3875,7 +3877,7 @@ export default class MapConroler extends cc.Component {
|
|||
this.gameOver = false;
|
||||
this.gameWin = false;
|
||||
|
||||
if (this.node.parent.parent.parent.getChildByName("Pause").active == false) {
|
||||
if (this.iceTrue() == false && this.node.parent.parent.parent.getChildByName("Pause").active == false && !this.shopPause) {
|
||||
this.pause = false;
|
||||
this.stopBoom();
|
||||
}
|
||||
|
|
@ -3947,7 +3949,7 @@ export default class MapConroler extends cc.Component {
|
|||
MiniGameSdk.API.showToast("继续游戏");
|
||||
this.gameOver = false;
|
||||
this.gameWin = false;
|
||||
if (this.node.parent.parent.parent.getChildByName("Pause").active == false) {
|
||||
if (this.iceTrue() == false && this.node.parent.parent.parent.getChildByName("Pause").active == false && !this.shopPause) {
|
||||
this.pause = false;
|
||||
}
|
||||
this.timeNumber = 21;
|
||||
|
|
@ -4451,6 +4453,8 @@ export default class MapConroler extends cc.Component {
|
|||
// 6. 时间归零时触发游戏失败
|
||||
// ============================================
|
||||
startTimeCutDown() {
|
||||
// 保证始终只有一个游戏倒计时回调,避免多次启动后时间成倍减少。
|
||||
this.stopTimeCutDown();
|
||||
this.startBoom();
|
||||
this.lastBlockClickTime = Date.now(); // 初始化上次点击时间
|
||||
this.noBlockClickDuration = 0; // 重置未点击持续时间
|
||||
|
|
@ -4588,6 +4592,7 @@ export default class MapConroler extends cc.Component {
|
|||
}
|
||||
cc.fx.AudioManager._instance.playEffect("timePause1", null);
|
||||
const timestamp = Date.now();
|
||||
this.freezeVersion += 1;
|
||||
this.freezeMask.active = true;
|
||||
this.stopBoom();
|
||||
this.pause = true;
|
||||
|
|
@ -4848,7 +4853,7 @@ export default class MapConroler extends cc.Component {
|
|||
this.hammer = false;
|
||||
this.ishammer = false;
|
||||
|
||||
if (this.node.parent.parent.parent.getChildByName("Pause").active == false && !this.shopPause) {
|
||||
if (this.iceTrue() == false && this.node.parent.parent.parent.getChildByName("Pause").active == false && !this.shopPause) {
|
||||
this.pause = false;
|
||||
if (this.gameStart == true) this.startBoom();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user