|
|
@@ -18,6 +18,7 @@ import { ClearCellOperationComp } from "../bll/ClearCellOperation";
|
|
|
import { AddCellOperationComp } from "../bll/AddCellOperation";
|
|
|
import { FullVehicleOperationComp } from "../bll/FullVehicleOperation";
|
|
|
import { DataSdk, REPORT_EVENT } from "../../common/utils/datasdk";
|
|
|
+import { GameEvent } from "../../common/config/GameEvent";
|
|
|
|
|
|
|
|
|
const { ccclass, property } = _decorator;
|
|
|
@@ -35,6 +36,7 @@ export class CheckpointMainViewComp extends CCComp {
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
onLoad() {
|
|
|
const btnSkin = this.node.getChildByName("btn_skin")
|
|
|
const btnAddCell = this.node.getChildByPath("bottom/btn_add_cell")
|
|
|
@@ -65,6 +67,7 @@ export class CheckpointMainViewComp extends CCComp {
|
|
|
btnSetting.on(Node.EventType.TOUCH_END, this.onTouchEnd, this);
|
|
|
btnReward.on(Node.EventType.TOUCH_END, this.onTouchEnd, this);
|
|
|
this.initLevel()
|
|
|
+ oops.message.on(GameEvent.LevelPass,this.initLevel,this)
|
|
|
if (sys.platform === sys.Platform.BYTEDANCE_MINI_GAME) {
|
|
|
//判断用户是否支持侧边栏进入功能,有些旧版的抖音没有侧边栏,这种情况就把入口有礼那个按钮给隐藏掉
|
|
|
tt.checkScene({
|
|
|
@@ -101,7 +104,7 @@ export class CheckpointMainViewComp extends CCComp {
|
|
|
// return range;
|
|
|
|
|
|
// 直接处理1-5的特殊情况
|
|
|
- if (n >= 1 && n <= 5) {
|
|
|
+ if (n >= 1 && n < 5) {
|
|
|
return [1, 2, 3, 4, 5];
|
|
|
} else {
|
|
|
// 计算中间值的位置,确保n位于中间
|
|
|
@@ -205,6 +208,11 @@ export class CheckpointMainViewComp extends CCComp {
|
|
|
event.propagationStopped = true;
|
|
|
}
|
|
|
|
|
|
+ onDestroy(): void {
|
|
|
+ oops.message.off(GameEvent.LevelPass,this.initLevel,this)
|
|
|
+ super.onDestroy()
|
|
|
+ }
|
|
|
+
|
|
|
reset() {
|
|
|
this.node.destroy();
|
|
|
}
|