|
|
@@ -2,10 +2,10 @@
|
|
|
* @Author: mojunshou 1637302775@qq.com
|
|
|
* @Date: 2025-03-20 15:01:09
|
|
|
* @LastEditors: mojunshou 1637302775@qq.com
|
|
|
- * @LastEditTime: 2025-04-23 19:03:04
|
|
|
+ * @LastEditTime: 2025-04-24 10:57:36
|
|
|
* @Description: 消除游戏主场景
|
|
|
*/
|
|
|
-import { _decorator, Button, Color, EventTouch, instantiate, JsonAsset, Label, Node, Prefab, randomRangeInt, Sprite, tween, UITransform, Vec2, Vec3, Widget } from "cc";
|
|
|
+import { _decorator, Button, Color, EventTouch, instantiate, JsonAsset, v3, Label, Node, Prefab, randomRangeInt, Sprite, tween, UITransform, Vec2, Vec3, Widget } from "cc";
|
|
|
import { oops } from "db://oops-framework/core/Oops";
|
|
|
import { DeviceUtil } from "db://oops-framework/core/utils/DeviceUtil";
|
|
|
import { ecs } from "db://oops-framework/libs/ecs/ECS";
|
|
|
@@ -17,6 +17,7 @@ import { ServerHandler } from "../common/manager/ServerHandler";
|
|
|
import { smc } from "../common/SingletonModuleComp";
|
|
|
import { Format } from "../utils/Format";
|
|
|
import { DCHandler } from "../common/manager/DCHandler";
|
|
|
+import { Tween } from "cc";
|
|
|
|
|
|
const { ccclass, property } = _decorator;
|
|
|
|
|
|
@@ -135,6 +136,19 @@ export class EliminateViewComp extends CCComp {
|
|
|
@property({ type: Node, displayName: "引导层" })
|
|
|
private guideNode: Node = null!;
|
|
|
|
|
|
+
|
|
|
+ @property({ type: Node, displayName: "引导item1" })
|
|
|
+ private guideItem1: Node = null!;
|
|
|
+
|
|
|
+ @property({ type: Node, displayName: "引导item2" })
|
|
|
+ private guideItem2: Node = null!;
|
|
|
+
|
|
|
+ @property({ type: Node, displayName: "引导item3" })
|
|
|
+ private guideItem3: Node = null!;
|
|
|
+ //引导手指
|
|
|
+ @property({ type: Node, displayName: "引导手指" })
|
|
|
+ private guideFinger: Node = null!;
|
|
|
+
|
|
|
@property({ type: Node, displayName: "ComboNode" })
|
|
|
private comboNode: Node = null!;
|
|
|
|
|
|
@@ -290,19 +304,18 @@ export class EliminateViewComp extends CCComp {
|
|
|
//初始化按钮状态
|
|
|
private initButtonState(state: boolean) {
|
|
|
//自动按钮默认关闭
|
|
|
- if (this.autoBtn) {
|
|
|
- //关闭
|
|
|
- const on = this.autoBtn.node.getChildByName("on");
|
|
|
- on ? on.active = state : null;
|
|
|
- const off = this.autoBtn.node.getChildByName("off");
|
|
|
- off ? off.active = !state : null;
|
|
|
- // this.autoState = state;
|
|
|
- }
|
|
|
- //第一关隐藏二倍速和自动放置按钮
|
|
|
- const curLevel = smc.account.AccountModel.curLevel;
|
|
|
- this.autoBtn.node.active = curLevel > 1;
|
|
|
- this.doubleSpeedBtn.node.active = curLevel > 1;
|
|
|
-
|
|
|
+ // if (this.autoBtn) {
|
|
|
+ // //关闭
|
|
|
+ // const on = this.autoBtn.node.getChildByName("on");
|
|
|
+ // on ? on.active = state : null;
|
|
|
+ // const off = this.autoBtn.node.getChildByName("off");
|
|
|
+ // off ? off.active = !state : null;
|
|
|
+ // // this.autoState = state;
|
|
|
+ // }
|
|
|
+ // //第一关隐藏二倍速和自动放置按钮
|
|
|
+ // const curLevel = smc.account.AccountModel.curLevel;
|
|
|
+ // this.autoBtn.node.active = curLevel > 1;
|
|
|
+ // this.doubleSpeedBtn.node.active = curLevel > 1;
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -322,13 +335,16 @@ export class EliminateViewComp extends CCComp {
|
|
|
|
|
|
//设置数据
|
|
|
setData() {
|
|
|
- if (smc.game.GameModel.curLevelConfig.eliminateScope) {
|
|
|
- this.eliminateInterval = smc.game.GameModel.curLevelConfig.eliminateScope || [];
|
|
|
+ if (DeviceUtil.isAndroid && DeviceUtil.isNative) {
|
|
|
+ if (smc.game.GameModel.curLevelConfig.eliminateScope) {
|
|
|
+ this.eliminateInterval = smc.game.GameModel.curLevelConfig.eliminateScope || [];
|
|
|
+ }
|
|
|
}
|
|
|
this.score = smc.game.GameModel.curScore;
|
|
|
this.money = smc.account.AccountModel.wxCoin;
|
|
|
this.cash = smc.account.AccountModel.hbCoin;
|
|
|
this.targetScore = smc.game.GameModel.targetScore;
|
|
|
+ // this.targetScore = 1000;
|
|
|
this.popupType = smc.game.GameModel.popupType;
|
|
|
this.lab_score.string = this.score.toString();
|
|
|
this.lab_wxCoin.string = Format.formatWxCoin(this.money);
|
|
|
@@ -430,86 +446,17 @@ export class EliminateViewComp extends CCComp {
|
|
|
tips.string = this.guideTips[step - 1];
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
if (step === 1) {
|
|
|
- const emptyIndex = Math.floor(this.cols / 2)
|
|
|
- for (let c = 0; c < this.cols; c++) {
|
|
|
- if (c !== emptyIndex) {
|
|
|
- const g = this.gridList[0][c]
|
|
|
- g.status = 1
|
|
|
- g.type = 1;
|
|
|
- this.generateGrid(g)
|
|
|
- }
|
|
|
- }
|
|
|
- this.createGuideBrick([{ row: 0, column: 0 }], "Brick1", 1, 1)
|
|
|
+ this.guideStep1()
|
|
|
}
|
|
|
else if (step === 2) {
|
|
|
- for (let r = 0; r < this.rows; r++) {
|
|
|
- if (r !== 0) {
|
|
|
- const g = this.gridList[r][3]
|
|
|
- g.status = 1
|
|
|
- g.type = 1;
|
|
|
- this.generateGrid(g)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- this.createGuideBrick([{ row: 0, column: 0 }], "Brick1", 1, 1)
|
|
|
+ this.guideStep2()
|
|
|
}
|
|
|
else if (step === 3) {
|
|
|
- // 填满前两列,除去 [2][0] 这个位置,制造一个L型缺口
|
|
|
- for (let r = 0; r < this.rows; r++) {
|
|
|
- for (let c = 3; c < 5; c++) {
|
|
|
- if (r === 2 && c === 3) continue
|
|
|
- if (r === 1 && c === 3) continue
|
|
|
- if (r === 3 && c === 3) continue
|
|
|
- if (r === 2 && c === 4) continue
|
|
|
- if (r === 1 && c === 4) continue
|
|
|
- if (r === 3 && c === 4) continue
|
|
|
- const g = this.gridList[r][c]
|
|
|
- g.status = 1
|
|
|
- g.type = 1;
|
|
|
- this.generateGrid(g)
|
|
|
- }
|
|
|
- }
|
|
|
- // 创建一个L型方块,引导玩家旋转后放置
|
|
|
- this.createGuideBrick([
|
|
|
- { row: 0, column: 0 },
|
|
|
- { row: 0, column: 1 },
|
|
|
- { row: 0, column: 2 },
|
|
|
- { row: 1, column: 0 },
|
|
|
- { row: 1, column: 1 },
|
|
|
- { row: 1, column: 2 }
|
|
|
- ], "BrickII", 1, 1, true) //这要双II
|
|
|
+ this.guideStep3()
|
|
|
}
|
|
|
else if (step === 4) {
|
|
|
- const centerRow = Math.floor(this.rows / 2);
|
|
|
- const centerCol = Math.floor(this.cols / 2);
|
|
|
-
|
|
|
- // 遍历整个网格
|
|
|
- for (let r = 0; r < this.rows; r++) {
|
|
|
- for (let c = 0; c < this.cols; c++) {
|
|
|
- const inCenter =
|
|
|
- r >= centerRow && r <= centerRow + 1 &&
|
|
|
- c >= centerCol && c <= centerCol + 1;
|
|
|
-
|
|
|
- const isCross =
|
|
|
- r === centerRow || r === centerRow + 1 || // 中间两行
|
|
|
- c === centerCol || c === centerCol + 1; // 中间两列
|
|
|
-
|
|
|
- if (isCross && !inCenter) {
|
|
|
- const g = this.gridList[r][c];
|
|
|
- g.status = 1;
|
|
|
- g.type = 1;
|
|
|
- this.generateGrid(g);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- this.createGuideBrick([
|
|
|
- { row: 0, column: 0 },
|
|
|
- { row: 0, column: 1 },
|
|
|
- { row: 1, column: 0 },
|
|
|
- { row: 1, column: 1 }
|
|
|
- ], "BrickO", 1, 1)
|
|
|
+ this.guideStep4()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -562,8 +509,168 @@ export class EliminateViewComp extends CCComp {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //引导步骤1
|
|
|
+ private guideStep1() {
|
|
|
+ // this.guideFinger.setPosition(v3(55, -461));
|
|
|
+ const emptyIndex = Math.floor(this.cols / 2)
|
|
|
+ for (let c = 0; c < this.cols; c++) {
|
|
|
+ if (c !== emptyIndex) {
|
|
|
+ const g = this.gridList[4][c]
|
|
|
+ g.status = 1
|
|
|
+ g.type = 1;
|
|
|
+ this.generateGrid(g)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.createGuideBrick([
|
|
|
+ { row: 0, column: 0 },
|
|
|
+ ], "Brick1", 1, 1)
|
|
|
+ //手指显示,方块显示
|
|
|
+ this.guideFinger.active = true;
|
|
|
+ this.guideItem1.active = true;
|
|
|
+ //拿出this.guideFinger.x y
|
|
|
+
|
|
|
+
|
|
|
+ tween(this.guideFinger)
|
|
|
+ .delay(0.2)
|
|
|
+ .by(1, { position: v3(45, 500, 0) })
|
|
|
+ .delay(0.2)
|
|
|
+ .to(0.01, { position: v3(60, -450, 0) }) //原点
|
|
|
+ .union()
|
|
|
+ .repeatForever()
|
|
|
+ .start()
|
|
|
+ //方块
|
|
|
+ tween(this.guideItem1)
|
|
|
+ .delay(0.2)
|
|
|
+ .by(1, { position: v3(37, 515, 0) })
|
|
|
+ .delay(0.2)
|
|
|
+ .to(0.01, { position: v3(0, -410, 0) }) //原点
|
|
|
+ .union()
|
|
|
+ .repeatForever()
|
|
|
+ .start()
|
|
|
|
|
|
+ }
|
|
|
|
|
|
+ //引导步骤2
|
|
|
+ private guideStep2() {
|
|
|
+ for (let r = 0; r < this.rows; r++) {
|
|
|
+ if (r !== 4) {
|
|
|
+ const g = this.gridList[r][4]
|
|
|
+ g.status = 1
|
|
|
+ g.type = 1;
|
|
|
+ this.generateGrid(g)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.createGuideBrick([{ row: 0, column: 0 }], "Brick1", 1, 1)
|
|
|
+ }
|
|
|
+
|
|
|
+ //引导步骤3
|
|
|
+ private guideStep3() {
|
|
|
+ // 填满前两列,除去 [2][0] 这个位置,制造一个L型缺口
|
|
|
+ for (let r = 0; r < this.rows; r++) {
|
|
|
+ for (let c = 3; c < 5; c++) {
|
|
|
+ if (r === 3 && c === 3) continue
|
|
|
+ if (r === 4 && c === 3) continue
|
|
|
+ if (r === 5 && c === 3) continue
|
|
|
+ if (r === 3 && c === 4) continue
|
|
|
+ if (r === 4 && c === 4) continue
|
|
|
+ if (r === 5 && c === 4) continue
|
|
|
+ const g = this.gridList[r][c]
|
|
|
+ g.status = 1
|
|
|
+ g.type = 1;
|
|
|
+ this.generateGrid(g)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 创建一个L型方块,引导玩家旋转后放置
|
|
|
+ this.createGuideBrick([
|
|
|
+ { row: 0, column: 0 },
|
|
|
+ { row: 0, column: 1 },
|
|
|
+ { row: 0, column: 2 },
|
|
|
+ { row: 1, column: 0 },
|
|
|
+ { row: 1, column: 1 },
|
|
|
+ { row: 1, column: 2 }
|
|
|
+ ], "BrickII", 1, 1, true) //这要双II
|
|
|
+
|
|
|
+ //引导三
|
|
|
+ this.guideItem1.active = false;
|
|
|
+ this.guideItem2.active = true;
|
|
|
+ //停止之前的tween
|
|
|
+ this.guideFinger.setPosition(v3(55, -461));
|
|
|
+ Tween.stopAllByTarget(this.guideFinger);
|
|
|
+ Tween.stopAllByTarget(this.guideItem1);
|
|
|
+ tween(this.guideFinger)
|
|
|
+ .delay(0.2)
|
|
|
+ .by(1, { position: v3(0, 500, 0) })
|
|
|
+ .delay(0.2)
|
|
|
+ .to(0.01, { position: v3(55, -450, 0) }) //原点
|
|
|
+ .union()
|
|
|
+ .repeatForever()
|
|
|
+ .start()
|
|
|
+ //方块
|
|
|
+ tween(this.guideItem2)
|
|
|
+ .delay(0.2)
|
|
|
+ .by(1, { position: v3(0, 515, 0) })
|
|
|
+ .delay(0.2)
|
|
|
+ .to(0.01, { position: v3(0, -410, 0) }) //原点
|
|
|
+ .union()
|
|
|
+ .repeatForever()
|
|
|
+ .start()
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //引导步骤4
|
|
|
+ private guideStep4() {
|
|
|
+ const centerRow = 3;
|
|
|
+ const centerCol = 3;
|
|
|
+ // 遍历整个网格
|
|
|
+ for (let r = 0; r < this.rows; r++) {
|
|
|
+ for (let c = 0; c < this.cols; c++) {
|
|
|
+ const inCenter =
|
|
|
+ r >= centerRow && r <= centerRow + 1 &&
|
|
|
+ c >= centerCol && c <= centerCol + 1;
|
|
|
+
|
|
|
+ const isCross =
|
|
|
+ r === centerRow || r === centerRow + 1 || // 中间两行
|
|
|
+ c === centerCol || c === centerCol + 1; // 中间两列
|
|
|
+
|
|
|
+ if (isCross && !inCenter) {
|
|
|
+ const g = this.gridList[r][c];
|
|
|
+ g.status = 1;
|
|
|
+ g.type = 1;
|
|
|
+ this.generateGrid(g);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.createGuideBrick([
|
|
|
+ { row: 0, column: 0 },
|
|
|
+ { row: 0, column: 1 },
|
|
|
+ { row: 1, column: 0 },
|
|
|
+ { row: 1, column: 1 }
|
|
|
+ ], "BrickO", 1, 1)
|
|
|
+ this.guideItem2.active = false;
|
|
|
+ Tween.stopAllByTarget(this.guideFinger);
|
|
|
+ Tween.stopAllByTarget(this.guideItem2);
|
|
|
+ this.guideFinger.setPosition(v3(55, -461));
|
|
|
+ this.guideItem3.active = true;
|
|
|
+ tween(this.guideFinger)
|
|
|
+ .delay(0.2)
|
|
|
+ .by(1, { position: v3(0, 440, 0) })
|
|
|
+ .delay(0.2)
|
|
|
+ .to(0.01, { position: v3(55, -450, 0) }) //原点
|
|
|
+ .union()
|
|
|
+ .repeatForever()
|
|
|
+ .start()
|
|
|
+ //方块
|
|
|
+ tween(this.guideItem3)
|
|
|
+ .delay(0.2)
|
|
|
+ .by(1, { position: v3(0, 440, 0) })
|
|
|
+ .delay(0.2)
|
|
|
+ .to(0.01, { position: v3(0, -410, 0) }) //原点
|
|
|
+ .union()
|
|
|
+ .repeatForever()
|
|
|
+ .start()
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
|
|
|
//显示金币动画 --是否只计算红包
|
|
|
@@ -585,7 +692,7 @@ export class EliminateViewComp extends CCComp {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- if (smc.game.GameModel.changeWxCoin) {
|
|
|
+ if (smc.game.GameModel.changeWxCoin > 0) {
|
|
|
// 添加回调函数,在金币动画完成后显示微信分数增加
|
|
|
this.createCoinFlyAnimation(
|
|
|
this.coinPrefab,
|
|
|
@@ -923,7 +1030,7 @@ export class EliminateViewComp extends CCComp {
|
|
|
// 触摸开始事件
|
|
|
brickNode.on(Node.EventType.TOUCH_START, (event: EventTouch) => {
|
|
|
// 如果正在编辑其他方块,则忽略
|
|
|
- if (!this.operateFlag && this.autoState) return;
|
|
|
+ if (!this.operateFlag) return;
|
|
|
// 清空编辑中的数据
|
|
|
this.editingData.brickData = null;
|
|
|
this.editingData.gridList.length = 0;
|
|
|
@@ -947,7 +1054,7 @@ export class EliminateViewComp extends CCComp {
|
|
|
|
|
|
// 触摸移动事件
|
|
|
brickNode.on(Node.EventType.TOUCH_MOVE, (event: EventTouch) => {
|
|
|
- if (!this.operateFlag && this.autoState) return;
|
|
|
+ if (!this.operateFlag) return;
|
|
|
|
|
|
const movePos: Vec2 = event.getUILocation().subtract(this.touchStartPos)
|
|
|
// 挪动很小时,不移动方块组合
|
|
|
@@ -1019,7 +1126,6 @@ export class EliminateViewComp extends CCComp {
|
|
|
}, this);
|
|
|
// 触摸结束或取消事件
|
|
|
const touchEndHandler = (event: EventTouch) => {
|
|
|
- if (this.autoState) return;
|
|
|
if (this.adShowingFlag || !this.operateFlag) return
|
|
|
this.operateFlag = false
|
|
|
// 单击旋转
|
|
|
@@ -1169,6 +1275,8 @@ export class EliminateViewComp extends CCComp {
|
|
|
} else {
|
|
|
this.isGuideMode = false;
|
|
|
this.guideNode.active = false;
|
|
|
+ Tween.stopAllByTarget(this.guideFinger);
|
|
|
+ Tween.stopAllByTarget(this.guideItem3);
|
|
|
this.initGrid();
|
|
|
}
|
|
|
}, 0.3)
|
|
|
@@ -1386,7 +1494,7 @@ export class EliminateViewComp extends CCComp {
|
|
|
const num = this.isDoubleSpeed ? this.doubleNum : 1;
|
|
|
gridEliminateList.forEach((gridData) => {
|
|
|
if (gridData.gridNode?.children[0]) {
|
|
|
- const startPos = gridData.gridNode.getWorldPosition();
|
|
|
+ // const startPos = gridData.gridNode.getWorldPosition();
|
|
|
tween(gridData.gridNode.children[0])
|
|
|
.to(0.2 / num, { scale: new Vec3(0.5, 0.5) })
|
|
|
.call(() => {
|
|
|
@@ -1394,22 +1502,6 @@ export class EliminateViewComp extends CCComp {
|
|
|
this.generateGrid(gridData)
|
|
|
})
|
|
|
.start()
|
|
|
-
|
|
|
- if (this.coinPrefab && this.lab_wxCoin?.node) {
|
|
|
- this.createCoinFlyAnimation(
|
|
|
- this.coinPrefab,
|
|
|
- startPos,
|
|
|
- this.lab_wxCoin.node.getWorldPosition(),
|
|
|
- 5
|
|
|
- );
|
|
|
- }
|
|
|
- //增加红包
|
|
|
- this.createCoinFlyAnimation(
|
|
|
- this.redPacketPrefab,
|
|
|
- startPos,
|
|
|
- this.lab_hbCoin.node.getWorldPosition(),
|
|
|
- 3
|
|
|
- );
|
|
|
}
|
|
|
})
|
|
|
|
|
|
@@ -1436,64 +1528,28 @@ export class EliminateViewComp extends CCComp {
|
|
|
score: this.score,
|
|
|
level: smc.account.AccountModel.curLevel,
|
|
|
})
|
|
|
- } else {
|
|
|
- //要服务器请求完了出了数据才展示动画
|
|
|
- const lastGrid = gridEliminateList[gridEliminateList.length - 1];
|
|
|
- if (lastGrid?.gridNode && this.coinPrefab && this.lab_wxCoin?.node) {
|
|
|
- const lastPos = lastGrid.gridNode.getWorldPosition();
|
|
|
-
|
|
|
- // 添加回调函数,在金币动画完成后显示微信分数增加
|
|
|
- this.createCoinFlyAnimation(
|
|
|
- this.coinPrefab,
|
|
|
- lastPos,
|
|
|
- this.lab_wxCoin.node.getWorldPosition(),
|
|
|
- 3,
|
|
|
- () => {
|
|
|
- // 显示微信分数增加动画
|
|
|
- this.showWechatScoreAnimation();
|
|
|
- }
|
|
|
- );
|
|
|
-
|
|
|
- // 添加回调函数,在红包动画完成后显示红包分数增加
|
|
|
- if (this.cash > 0) {
|
|
|
- this.createCoinFlyAnimation(
|
|
|
- this.redPacketPrefab,
|
|
|
- lastPos,
|
|
|
- this.lab_hbCoin.node.getWorldPosition(),
|
|
|
- 3,
|
|
|
- () => {
|
|
|
- // 显示红包分数增加动画
|
|
|
- this.showRedPacketScoreAnimation();
|
|
|
- }
|
|
|
- );
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
+ if (DeviceUtil.isAndroid && DeviceUtil.isNative) {
|
|
|
+ if (this.eliminateInterval.length == 0) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const minNum = this.eliminateInterval[0]
|
|
|
+ const maxNum = this.eliminateInterval[1]
|
|
|
+ const randomNum = randomRangeInt(minNum, maxNum + 1);
|
|
|
+ //这个数可以被总消除次数整除那就可以弹广告
|
|
|
+ if (this.eliminateTotal % randomNum === 0) {
|
|
|
+ // oops.gui.open(UIID.DoubleSpeed);
|
|
|
+ //如果有自动就暂停自动
|
|
|
+ this.gameState = GameState.PAUSED;
|
|
|
+ console.log("弹出翻倍广告");
|
|
|
+ ServerHandler.inst.getDoubleSurprise();
|
|
|
+ //弹出广告
|
|
|
+ }
|
|
|
+ }
|
|
|
// 告诉调用者有消除发生
|
|
|
resolve(true)
|
|
|
- // 检查是否需要继续消除
|
|
|
- this.scheduleOnce(() => {
|
|
|
- // 递归调用,检查并处理连锁消除
|
|
|
- this.gridEliminate().then(() => {
|
|
|
- if (this.eliminateInterval.length == 0) {
|
|
|
- return;
|
|
|
- }
|
|
|
- const minNum = this.eliminateInterval[0]
|
|
|
- const maxNum = this.eliminateInterval[1]
|
|
|
- const randomNum = randomRangeInt(minNum, maxNum + 1);
|
|
|
- //这个数可以被总消除次数整除那就可以弹广告
|
|
|
- if (this.eliminateTotal % randomNum === 0) {
|
|
|
- // oops.gui.open(UIID.DoubleSpeed);
|
|
|
- //如果有自动就暂停自动
|
|
|
- this.gameState = GameState.PAUSED;
|
|
|
- console.log("弹出翻倍广告");
|
|
|
- ServerHandler.inst.getDoubleSurprise();
|
|
|
- //弹出广告
|
|
|
- }
|
|
|
- });
|
|
|
- }, 0.2);
|
|
|
- }, 0.2)
|
|
|
+ }, 0.1)
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -1533,7 +1589,6 @@ export class EliminateViewComp extends CCComp {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 修改 createCoinFlyAnimation 方法,添加回调
|
|
|
private createCoinFlyAnimation(prefab: Prefab, startPos: Vec3, endPos: Vec3, count: number, callback?: Function) {
|
|
|
if (!prefab) return;
|
|
|
|
|
|
@@ -1543,10 +1598,8 @@ export class EliminateViewComp extends CCComp {
|
|
|
for (let i = 0; i < totalCoins; i++) {
|
|
|
const coin = instantiate(prefab);
|
|
|
this.node.addChild(coin);
|
|
|
-
|
|
|
//设置位置,取舞台中间位置世界坐标
|
|
|
coin.setWorldPosition(startPos);
|
|
|
-
|
|
|
// 创建曲线动画
|
|
|
const num = this.isDoubleSpeed ? this.doubleNum : 1;
|
|
|
tween(coin)
|
|
|
@@ -1951,9 +2004,6 @@ export class EliminateViewComp extends CCComp {
|
|
|
|
|
|
//自动放置
|
|
|
private btn_auto() {
|
|
|
- if (this.gameState !== GameState.PLAYING) {
|
|
|
- return;
|
|
|
- }
|
|
|
this.autoState = !this.autoState;
|
|
|
this.initButtonState(this.autoState);
|
|
|
if (this.autoState) {
|
|
|
@@ -2167,6 +2217,7 @@ export class EliminateViewComp extends CCComp {
|
|
|
if (this.callback) {
|
|
|
this.unschedule(this.callback);
|
|
|
}
|
|
|
+ oops.gui.toast("二倍速时长已增加3分钟~")
|
|
|
|
|
|
this.isDoubleSpeed = true;
|
|
|
this.doubleNum = 2;
|