|
|
@@ -2,7 +2,7 @@
|
|
|
* @Author: mojunshou 1637302775@qq.com
|
|
|
* @Date: 2025-03-20 15:01:09
|
|
|
* @LastEditors: mojunshou 1637302775@qq.com
|
|
|
- * @LastEditTime: 2025-04-21 11:01:14
|
|
|
+ * @LastEditTime: 2025-04-21 16:38:46
|
|
|
* @Description: 消除游戏主场景
|
|
|
*/
|
|
|
import { _decorator, Button, Color, EventTouch, instantiate, JsonAsset, Label, Node, Prefab, randomRangeInt, Sprite, tween, UITransform, Vec2, Vec3, Widget } from "cc";
|
|
|
@@ -312,9 +312,9 @@ export class EliminateViewComp extends CCComp {
|
|
|
this.lab_hbCoin.string = Format.formatRedPacketCoin(this.cash);
|
|
|
this.lab_taget.string = this.targetScore.toString();
|
|
|
this.lab_goldNum.string = smc.account.AccountModel.goldCoin.toString();
|
|
|
+ this.gameState = GameState.PLAYING;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
updateCoin() {
|
|
|
this.money = smc.account.AccountModel.wxCoin;
|
|
|
this.cash = smc.account.AccountModel.hbCoin;
|
|
|
@@ -565,6 +565,8 @@ export class EliminateViewComp extends CCComp {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+ this.updateGameScore();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1095,7 +1097,6 @@ export class EliminateViewComp extends CCComp {
|
|
|
centerPos.y /= validGridCount;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
// 放置方块到网格
|
|
|
this.editingData.gridList.forEach(grid => {
|
|
|
grid.status = CellState.FILLED;
|
|
|
@@ -1236,9 +1237,7 @@ export class EliminateViewComp extends CCComp {
|
|
|
// 添加到场景中
|
|
|
this.node.addChild(scoreLabel);
|
|
|
scoreLabel.setWorldPosition(position);
|
|
|
-
|
|
|
const num = this.isDoubleSpeed ? this.doubleNum : 1;
|
|
|
-
|
|
|
// 创建动画效果
|
|
|
tween(scoreLabel)
|
|
|
.to(0.5 / num, {
|
|
|
@@ -1393,7 +1392,6 @@ export class EliminateViewComp extends CCComp {
|
|
|
}
|
|
|
|
|
|
this.score += score;
|
|
|
- this.updateGameScore();
|
|
|
if (DeviceUtil.isNative && DeviceUtil.isAndroid) {
|
|
|
ServerHandler.inst.updateEliminationReward({
|
|
|
count: totalEliminationsInThisRound,
|
|
|
@@ -1806,6 +1804,7 @@ export class EliminateViewComp extends CCComp {
|
|
|
this.gameState = GameState.GAME_OVER
|
|
|
this.setGameState(GameState.GAME_OVER)
|
|
|
console.log("游戏结束")
|
|
|
+ smc.game.GameModel.curScore = this.score;
|
|
|
oops.gui.open(UIID.GameOver);
|
|
|
}
|
|
|
|
|
|
@@ -1820,12 +1819,9 @@ export class EliminateViewComp extends CCComp {
|
|
|
if (DeviceUtil.isNative && DeviceUtil.isAndroid) {
|
|
|
ServerHandler.inst.getGameAwardInfo();
|
|
|
} else {
|
|
|
- console.log("打开通关奖励");
|
|
|
+ oops.gui.open(UIID.GamePass);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- //是否展示翻倍广告
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1907,9 +1903,11 @@ export class EliminateViewComp extends CCComp {
|
|
|
|
|
|
//自动放置
|
|
|
private btn_auto() {
|
|
|
+ if (this.gameState !== GameState.PLAYING) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
this.autoState = !this.autoState;
|
|
|
this.initButtonState(this.autoState);
|
|
|
- this.gameState = GameState.PLAYING
|
|
|
if (this.autoState) {
|
|
|
this.executeAutoPlace();
|
|
|
}
|
|
|
@@ -2155,7 +2153,6 @@ export class EliminateViewComp extends CCComp {
|
|
|
//重新开始
|
|
|
private restartGame() {
|
|
|
if (this.gameState === GameState.READY) return;
|
|
|
- console.log("重新开始")
|
|
|
this.initData();
|
|
|
this.setData();
|
|
|
this.reopenGrid();
|
|
|
@@ -2193,18 +2190,15 @@ export class EliminateViewComp extends CCComp {
|
|
|
// this.popupType = "weal_3";
|
|
|
switch (this.popupType) {
|
|
|
case "weal_1":
|
|
|
- // this.btn_warmReminder();
|
|
|
oops.gui.open(UIID.WarmReminder);
|
|
|
ServerHandler.inst.GetGuideInfo();
|
|
|
break;
|
|
|
case "weal_2":
|
|
|
- // this.btn_cashRebate();
|
|
|
//打开福利二
|
|
|
oops.gui.open(UIID.WelfareTwo);
|
|
|
ServerHandler.inst.GetGuideInfo();
|
|
|
break;
|
|
|
case "weal_3":
|
|
|
- // this.btn_doubleRewards();
|
|
|
//打开福利三
|
|
|
oops.gui.open(UIID.WelfareThree);
|
|
|
break;
|
|
|
@@ -2220,33 +2214,6 @@ export class EliminateViewComp extends CCComp {
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- //温馨提示
|
|
|
- private btn_warmReminder() {
|
|
|
- oops.gui.open(UIID.WarmReminder);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- //界面测试
|
|
|
- btn_tongguan() {
|
|
|
- if (DeviceUtil.isNative && DeviceUtil.isAndroid) {
|
|
|
- ServerHandler.inst.getGameAwardInfo();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- btn_tx() {
|
|
|
- if (DeviceUtil.isNative && DeviceUtil.isAndroid) {
|
|
|
- ServerHandler.inst.getTxbfInfo();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- btn_gxfb() {
|
|
|
- if (DeviceUtil.isNative && DeviceUtil.isAndroid) {
|
|
|
- ServerHandler.inst.getDoubleSurprise();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
btn_text() {
|
|
|
// const param = {
|
|
|
// "showReward": [
|