|
|
@@ -2,7 +2,7 @@
|
|
|
* @Author: mojunshou 1637302775@qq.com
|
|
|
* @Date: 2025-03-20 15:01:09
|
|
|
* @LastEditors: mojunshou 1637302775@qq.com
|
|
|
- * @LastEditTime: 2025-04-23 16:45:39
|
|
|
+ * @LastEditTime: 2025-04-23 19:03:04
|
|
|
* @Description: 消除游戏主场景
|
|
|
*/
|
|
|
import { _decorator, Button, Color, EventTouch, instantiate, JsonAsset, Label, Node, Prefab, randomRangeInt, Sprite, tween, UITransform, Vec2, Vec3, Widget } from "cc";
|
|
|
@@ -138,6 +138,9 @@ export class EliminateViewComp extends CCComp {
|
|
|
@property({ type: Node, displayName: "ComboNode" })
|
|
|
private comboNode: Node = null!;
|
|
|
|
|
|
+ @property({ type: Node, displayName: "自动放置Node拦截事件" })
|
|
|
+ private autoNode: Node = null!;
|
|
|
+
|
|
|
|
|
|
//游戏配置行列
|
|
|
private rows: number = 8; // 行数
|
|
|
@@ -247,9 +250,7 @@ export class EliminateViewComp extends CCComp {
|
|
|
}
|
|
|
//更新福利点
|
|
|
this.updateWelfarePoint();
|
|
|
-
|
|
|
DCHandler.inst.reportData(3000005);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -316,6 +317,7 @@ export class EliminateViewComp extends CCComp {
|
|
|
this.operateFlag = true
|
|
|
this.shouldResetEliminateCount = true;
|
|
|
this.currentCombo = 0;
|
|
|
+ this.autoNode.active = false;
|
|
|
}
|
|
|
|
|
|
//设置数据
|
|
|
@@ -337,6 +339,9 @@ export class EliminateViewComp extends CCComp {
|
|
|
this.lab_goldNum.string = `${num + 1}`;
|
|
|
this.gameState = GameState.PLAYING;
|
|
|
this.randomList = this.getRandomUniqueInts();
|
|
|
+
|
|
|
+ const curLevel = smc.account.AccountModel.curLevel;
|
|
|
+ DCHandler.inst.reportData(3000500, curLevel);
|
|
|
}
|
|
|
|
|
|
updateCoin() {
|
|
|
@@ -918,7 +923,7 @@ export class EliminateViewComp extends CCComp {
|
|
|
// 触摸开始事件
|
|
|
brickNode.on(Node.EventType.TOUCH_START, (event: EventTouch) => {
|
|
|
// 如果正在编辑其他方块,则忽略
|
|
|
- if (!this.operateFlag) return;
|
|
|
+ if (!this.operateFlag && this.autoState) return;
|
|
|
// 清空编辑中的数据
|
|
|
this.editingData.brickData = null;
|
|
|
this.editingData.gridList.length = 0;
|
|
|
@@ -942,7 +947,7 @@ export class EliminateViewComp extends CCComp {
|
|
|
|
|
|
// 触摸移动事件
|
|
|
brickNode.on(Node.EventType.TOUCH_MOVE, (event: EventTouch) => {
|
|
|
- if (!this.operateFlag) return;
|
|
|
+ if (!this.operateFlag && this.autoState) return;
|
|
|
|
|
|
const movePos: Vec2 = event.getUILocation().subtract(this.touchStartPos)
|
|
|
// 挪动很小时,不移动方块组合
|
|
|
@@ -1012,10 +1017,9 @@ export class EliminateViewComp extends CCComp {
|
|
|
}
|
|
|
});
|
|
|
}, this);
|
|
|
-
|
|
|
// 触摸结束或取消事件
|
|
|
const touchEndHandler = (event: EventTouch) => {
|
|
|
-
|
|
|
+ if (this.autoState) return;
|
|
|
if (this.adShowingFlag || !this.operateFlag) return
|
|
|
this.operateFlag = false
|
|
|
// 单击旋转
|
|
|
@@ -1842,6 +1846,8 @@ export class EliminateViewComp extends CCComp {
|
|
|
this.initButtonState(false);
|
|
|
this.autoState = false;
|
|
|
}
|
|
|
+ const curLevel = smc.account.AccountModel.curLevel;
|
|
|
+ DCHandler.inst.reportData(3000501, curLevel);
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1955,6 +1961,7 @@ export class EliminateViewComp extends CCComp {
|
|
|
this.executeAutoPlace();
|
|
|
this.autoFunction = this.executeAutoPlace;
|
|
|
this.schedule(this.autoFunction, 1.5);
|
|
|
+ this.autoNode.active = true;
|
|
|
} else {
|
|
|
//关闭
|
|
|
if (this.autoFunction) {
|
|
|
@@ -1963,6 +1970,7 @@ export class EliminateViewComp extends CCComp {
|
|
|
this.autoFunction = null;
|
|
|
this.initButtonState(false);
|
|
|
this.autoState = false;
|
|
|
+ this.autoNode.active = false;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -2175,7 +2183,7 @@ export class EliminateViewComp extends CCComp {
|
|
|
this.initButtonState(this.autoState);
|
|
|
}
|
|
|
this.callback = function () {
|
|
|
- if (!this.adShowingFlag && this.gameState === GameState.PLAYING) {
|
|
|
+ if (!this.adShowingFlag && this.gameState === GameState.PLAYING && this.autoState) {
|
|
|
this.doubleSpeedTime--
|
|
|
//修改剩余时间,秒格式化成时分10:59
|
|
|
const minutes = Math.floor(this.doubleSpeedTime / 60);
|
|
|
@@ -2193,6 +2201,9 @@ export class EliminateViewComp extends CCComp {
|
|
|
this.unschedule(this.callback);
|
|
|
}
|
|
|
}
|
|
|
+ if (!this.autoState && this.doubleSpeedTime) {
|
|
|
+ this.lab_doubleTime.string = "二倍速";
|
|
|
+ }
|
|
|
}
|
|
|
this.schedule(this.callback, 1);
|
|
|
}
|