Explorar o código

【bug】修改复活游戏逻辑

mojunshou hai 7 meses
pai
achega
f0dbabde0d

+ 2 - 2
assets/script/game/common/manager/ADHandler.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-04-11 10:14:44
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-25 17:20:58
+ * @LastEditTime: 2025-04-25 17:49:11
  * @Description: 
  */
 // ADHandler.ts
@@ -136,7 +136,7 @@ export class ADHandler {
             //如果是复活,分数减半
             if (smc.game.GameModel.viewType === "revive_reward") {
                 smc.game.GameModel.viewType = "";
-                ServerHandler.inst.RestartGame();
+                oops.message.dispatchEvent(GameEvent.RestartGame);
             }
         } else {
             //通关奖励,没看完也能过下一关

+ 3 - 5
assets/script/game/common/manager/ProtocolEvent.ts

@@ -2,15 +2,13 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-04-07 10:17:16
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-25 16:38:52
+ * @LastEditTime: 2025-04-25 17:29:20
  * @Description: 消息定义
  */
 
-// const server_url = "http://192.168.10.103:8880";
+const server_url = "http://192.168.10.103:8880";
 // https://central-test.atmob.com
-const server_url = "https://central-test.atmob.com";
-
-
+// const server_url = "https://central-test.atmob.com";
 export enum ProtocolEvent {
     /**微信登录*/
     WechatLogin = server_url + "/project/playlet/v1/user/login",

+ 23 - 3
assets/script/game/view/EliminateViewComp.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-03-20 15:01:09
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-25 16:44:26
+ * @LastEditTime: 2025-04-25 17:38:15
  * @Description: 消除游戏主场景
  */
 import { _decorator, Button, Color, EventTouch, instantiate, JsonAsset, v3, Label, Node, Prefab, randomRangeInt, Sprite, tween, UITransform, Vec2, Vec3, Widget } from "cc";
@@ -369,7 +369,9 @@ export class EliminateViewComp extends CCComp {
 
     //开始自动游戏
     startAutoGame() {
-        this.autoGame();
+        if (!this.autoState) {
+            this.autoGame();
+        }
     }
 
 
@@ -1047,7 +1049,25 @@ export class EliminateViewComp extends CCComp {
             if (index > -1) {
                 this.editingData.brickData = this.bricksList.splice(index, 1)[0];
             } else {
-                console.error("未找到方块数据:", brickData);
+                //返回原位置
+                console.error(">>this.bricksList>>>>>>", JSON.stringify(this.bricksList));
+                console.error("未找到方块数据:", JSON.stringify(brickData));
+                this.bricksList.push(brickData)
+                if (brickData.brickNode) {
+                    tween(brickData.brickNode)
+                        .to(0.15, {
+                            worldPosition: brickData.brickInitPos,
+                            scale: new Vec3(0.8, 0.8, 0.8)
+                        })
+                        .call(() => {
+                            if (brickData.brickNode) {
+                                this.operateFlag = true
+                                this.brickNode.addChild(brickData.brickNode)
+                                brickData.brickNode.setWorldPosition(brickData.brickInitPos)
+                            }
+                        })
+                        .start()
+                }
             }
         }, this);