181404010226 3 mesi fa
parent
commit
e923b6eff4

+ 112 - 34
assets/Scenes/GameLevel.scene

@@ -57,7 +57,7 @@
     },
     "autoReleaseAssets": false,
     "_globals": {
-      "__id__": 1350
+      "__id__": 1356
     },
     "_id": "29694223-a59c-44b3-acb0-80ab92d103f5"
   },
@@ -164,7 +164,7 @@
     "_prefab": null,
     "_lpos": {
       "__type__": "cc.Vec3",
-      "x": 359.99999999999994,
+      "x": 360,
       "y": 667,
       "z": 0
     },
@@ -373,7 +373,7 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 999.9999999999999,
+      "width": 1000,
       "height": 5
     },
     "_anchorPoint": {
@@ -740,7 +740,7 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 719.9999999999999,
+      "width": 720,
       "height": 1334
     },
     "_anchorPoint": {
@@ -852,7 +852,7 @@
     "_prefab": null,
     "_lpos": {
       "__type__": "cc.Vec3",
-      "x": 5.684341886080802e-14,
+      "x": 0,
       "y": 0,
       "z": 0
     },
@@ -9773,7 +9773,7 @@
     "_prefab": null,
     "_lpos": {
       "__type__": "cc.Vec3",
-      "x": 5.684341886080802e-14,
+      "x": 0,
       "y": 0,
       "z": 0
     },
@@ -9931,7 +9931,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": -610.68,
+      "y": -754.327,
       "z": 0
     },
     "_lrot": {
@@ -13426,7 +13426,7 @@
     "_prefab": null,
     "_lpos": {
       "__type__": "cc.Vec3",
-      "x": -309.99999999999994,
+      "x": -310,
       "y": 577.3409999999999,
       "z": 0
     },
@@ -13484,7 +13484,7 @@
     "_prefab": null,
     "_lpos": {
       "__type__": "cc.Vec3",
-      "x": 359.99999999999994,
+      "x": 360,
       "y": 667,
       "z": 0
     },
@@ -13614,7 +13614,7 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 719.9999999999999,
+      "width": 720,
       "height": 1334
     },
     "_anchorPoint": {
@@ -18366,7 +18366,7 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 719.9999999999999,
+      "width": 720,
       "height": 1334
     },
     "_anchorPoint": {
@@ -18806,7 +18806,7 @@
     "_prefab": null,
     "_lpos": {
       "__type__": "cc.Vec3",
-      "x": 5.684341886080802e-14,
+      "x": 0,
       "y": 97.5,
       "z": 0
     },
@@ -20890,7 +20890,7 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 719.9999999999999,
+      "width": 720,
       "height": 1334
     },
     "_anchorPoint": {
@@ -21028,7 +21028,7 @@
     "_prefab": null,
     "_lpos": {
       "__type__": "cc.Vec3",
-      "x": 0.1500000000000341,
+      "x": 0.14999999999997726,
       "y": -588.66,
       "z": 0
     },
@@ -34686,7 +34686,7 @@
     "_prefab": null,
     "_lpos": {
       "__type__": "cc.Vec3",
-      "x": 1.0000000000000568,
+      "x": 1,
       "y": -6,
       "z": 0
     },
@@ -36424,7 +36424,7 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 719.9999999999999,
+      "width": 720,
       "height": 1334
     },
     "_anchorPoint": {
@@ -36476,7 +36476,7 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 719.9999999999999,
+      "width": 720,
       "height": 1334
     },
     "_anchorPoint": {
@@ -36597,7 +36597,7 @@
     "_prefab": null,
     "_lpos": {
       "__type__": "cc.Vec3",
-      "x": -215.99999999999997,
+      "x": -216,
       "y": 138.5,
       "z": 0
     },
@@ -38385,7 +38385,7 @@
     "_prefab": null,
     "_lpos": {
       "__type__": "cc.Vec3",
-      "x": 215.99999999999997,
+      "x": 216,
       "y": 138.5,
       "z": 0
     },
@@ -39688,7 +39688,7 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 719.9999999999999,
+      "width": 720,
       "height": 469
     },
     "_anchorPoint": {
@@ -39830,7 +39830,7 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 999.9999999999999,
+      "width": 1000,
       "height": 5
     },
     "_anchorPoint": {
@@ -40204,7 +40204,7 @@
     "_prefab": null,
     "_lpos": {
       "__type__": "cc.Vec3",
-      "x": 1604.7059999999997,
+      "x": 1604.706,
       "y": 0,
       "z": 0
     },
@@ -40367,7 +40367,7 @@
     "_prefab": null,
     "_lpos": {
       "__type__": "cc.Vec3",
-      "x": 256.9999999999999,
+      "x": 257,
       "y": 175.274,
       "z": 0
     },
@@ -44235,7 +44235,7 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 608.9999999999998,
+      "width": 609,
       "height": 428
     },
     "_anchorPoint": {
@@ -44614,7 +44614,7 @@
     "_prefab": null,
     "_lpos": {
       "__type__": "cc.Vec3",
-      "x": 281.49999999999994,
+      "x": 281.5,
       "y": 485.124,
       "z": 0
     },
@@ -45737,7 +45737,7 @@
     "__prefab": null,
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 719.9999999999999,
+      "width": 720,
       "height": 1334
     },
     "_anchorPoint": {
@@ -45839,6 +45839,15 @@
       },
       {
         "__id__": 1347
+      },
+      {
+        "__id__": 1350
+      },
+      {
+        "__id__": 1352
+      },
+      {
+        "__id__": 1354
       }
     ],
     "nestedPrefabInstanceRoots": [
@@ -46123,31 +46132,100 @@
       "acB1uRv+ZI4aBLZfk/IrYy"
     ]
   },
+  {
+    "__type__": "cc.TargetOverrideInfo",
+    "source": {
+      "__id__": 438
+    },
+    "sourceInfo": null,
+    "propertyPath": [
+      "skillButtons",
+      "0"
+    ],
+    "target": {
+      "__id__": 289
+    },
+    "targetInfo": {
+      "__id__": 1351
+    }
+  },
+  {
+    "__type__": "cc.TargetInfo",
+    "localID": [
+      "9bckw8VnJAVJfh+LK/5rLp"
+    ]
+  },
+  {
+    "__type__": "cc.TargetOverrideInfo",
+    "source": {
+      "__id__": 438
+    },
+    "sourceInfo": null,
+    "propertyPath": [
+      "skillButtons",
+      "1"
+    ],
+    "target": {
+      "__id__": 337
+    },
+    "targetInfo": {
+      "__id__": 1353
+    }
+  },
+  {
+    "__type__": "cc.TargetInfo",
+    "localID": [
+      "9bckw8VnJAVJfh+LK/5rLp"
+    ]
+  },
+  {
+    "__type__": "cc.TargetOverrideInfo",
+    "source": {
+      "__id__": 438
+    },
+    "sourceInfo": null,
+    "propertyPath": [
+      "skillButtons",
+      "2"
+    ],
+    "target": {
+      "__id__": 385
+    },
+    "targetInfo": {
+      "__id__": 1355
+    }
+  },
+  {
+    "__type__": "cc.TargetInfo",
+    "localID": [
+      "9bckw8VnJAVJfh+LK/5rLp"
+    ]
+  },
   {
     "__type__": "cc.SceneGlobals",
     "ambient": {
-      "__id__": 1351
+      "__id__": 1357
     },
     "shadows": {
-      "__id__": 1352
+      "__id__": 1358
     },
     "_skybox": {
-      "__id__": 1353
+      "__id__": 1359
     },
     "fog": {
-      "__id__": 1354
+      "__id__": 1360
     },
     "octree": {
-      "__id__": 1355
+      "__id__": 1361
     },
     "skin": {
-      "__id__": 1356
+      "__id__": 1362
     },
     "lightProbeInfo": {
-      "__id__": 1357
+      "__id__": 1363
     },
     "postSettings": {
-      "__id__": 1358
+      "__id__": 1364
     },
     "bakedWithStationaryMainLight": false,
     "bakedWithHighpLightmap": false

+ 8 - 4
assets/resources/prefabs/Skill1.prefab

@@ -1112,7 +1112,7 @@
     },
     "_lpos": {
       "__type__": "cc.Vec3",
-      "x": -48.3065185546875,
+      "x": 47.6934814453125,
       "y": 23.8,
       "z": 0
     },
@@ -1449,7 +1449,7 @@
     },
     "_alignFlags": 9,
     "_target": null,
-    "_left": 0.3357758011814807,
+    "_left": 0.517891489957877,
     "_right": 0,
     "_top": 0.2681818181818182,
     "_bottom": 0,
@@ -1668,8 +1668,12 @@
     "skillSpriteNode": {
       "__id__": 2
     },
-    "skillNameNode": null,
-    "skillIntroduceNode": null,
+    "skillNameNode": {
+      "__id__": 46
+    },
+    "skillIntroduceNode": {
+      "__id__": 47
+    },
     "_id": ""
   },
   {

+ 25 - 3
assets/scripts/CombatSystem/EnemyController.ts

@@ -634,9 +634,28 @@ export class EnemyController extends BaseSingleton {
         const spawnWorldX = this.gameBounds.left + Math.random() * (this.gameBounds.right - this.gameBounds.left);
         const spawnWorldY = lineNode.worldPosition.y;
 
-        const worldPos = new Vec3(spawnWorldX, spawnWorldY, 0);
-        const localPos = enemyContainer.getComponent(UITransform).convertToNodeSpaceAR(worldPos);
-        enemy.position = localPos;
+        // 计算漂移距离(向墙体方向漂移)
+        // 上方生成的敌人漂移200px,下方生成的敌人漂移80px
+        const driftDistance = fromTop ? 100 : 90;
+        let driftWorldX = spawnWorldX;
+        let driftWorldY = spawnWorldY;
+        
+        // 根据生成位置决定漂移方向(靠近墙体方向)
+        if (fromTop) {
+            // 从上方生成,向下漂移(靠近上墙TopFence)
+            driftWorldY -= driftDistance;
+        } else {
+            // 从下方生成,向上漂移(靠近下墙BottomFence)
+            driftWorldY += driftDistance;
+        }
+        
+        // 设置初始位置(线上的位置)
+        const initialWorldPos = new Vec3(spawnWorldX, spawnWorldY, 0);
+        const initialLocalPos = enemyContainer.getComponent(UITransform).convertToNodeSpaceAR(initialWorldPos);
+        enemy.position = initialLocalPos;
+        
+        // 记录漂移目标位置(墙体附近的位置)
+        const driftWorldPos = new Vec3(driftWorldX, driftWorldY, 0);
         
         // === 根据配置设置敌人 ===
         const enemyComp = enemy.addComponent(EnemyInstance);
@@ -723,6 +742,9 @@ export class EnemyController extends BaseSingleton {
         // 额外的属性设置
         enemyComp.spawnFromTop = fromTop;
         enemyComp.targetFence = find(fromTop ? 'Canvas/GameLevelUI/GameArea/TopFence' : 'Canvas/GameLevelUI/GameArea/BottomFence');
+        
+        // 设置漂移目标位置(墙体附近的位置)
+        enemyComp.driftTargetPosition = driftWorldPos.clone();
 
         // 计算墙体上的随机目标位置
         if (enemyComp.targetFence && enemyComp.targetFence.isValid) {

+ 39 - 2
assets/scripts/CombatSystem/EnemyInstance.ts

@@ -20,6 +20,7 @@ interface EnemyControllerType {
 
 // 敌人状态枚举
 enum EnemyState {
+    DRIFTING, // 漂移中(从生成位置移动到线上)
     MOVING,   // 移动中
     ATTACKING, // 攻击中
     DEAD      // 死亡
@@ -50,6 +51,8 @@ export class EnemyInstance extends Component {
     public targetFence: Node | null = null;
     /** 目标位置(墙体上的随机点) */
     public targetPosition: Vec3 | null = null;
+    /** 漂移目标位置(线上的位置) */
+    public driftTargetPosition: Vec3 | null = null;
     
     // 移动相关属性
     public movingDirection: number = 1; // 1: 向右, -1: 向左
@@ -187,7 +190,7 @@ export class EnemyInstance extends Component {
             this.health = this.maxHealth;
         }
         
-        this.state = EnemyState.MOVING;
+        this.state = EnemyState.DRIFTING; // 从漂移状态开始
         // 只有在攻击间隔未设置时才使用默认值
         if (this.attackInterval <= 0) {
             this.attackInterval = 2.0; // 默认攻击间隔
@@ -533,7 +536,9 @@ export class EnemyInstance extends Component {
             return;
         }
         
-        if (this.state === EnemyState.MOVING) {
+        if (this.state === EnemyState.DRIFTING) {
+            this.updateDrifting(deltaTime);
+        } else if (this.state === EnemyState.MOVING) {
             this.updateMovement(deltaTime);
         } else if (this.state === EnemyState.ATTACKING) {
             this.updateAttack(deltaTime);
@@ -542,6 +547,38 @@ export class EnemyInstance extends Component {
         // 不再每帧播放攻击动画,避免日志刷屏
     }
     
+    // 更新漂移逻辑(从生成位置移动到线上)
+    private updateDrifting(deltaTime: number) {
+        if (!this.driftTargetPosition) {
+            // 如果没有漂移目标位置,直接切换到移动状态
+            this.state = EnemyState.MOVING;
+            return;
+        }
+        
+        const currentWorldPos = this.node.worldPosition.clone();
+        const targetWorldPos = this.driftTargetPosition.clone();
+        
+        const dir = targetWorldPos.subtract(currentWorldPos);
+        const distanceToTarget = dir.length();
+        
+        // 如果距离目标很近,切换到移动状态
+        const stopDistance = 10; // 停止距离
+        if (distanceToTarget <= stopDistance) {
+            this.state = EnemyState.MOVING;
+            return;
+        }
+        
+        if (distanceToTarget === 0) return;
+        dir.normalize();
+        
+        // 使用较快的速度进行漂移
+        const driftSpeed = this.speed * 5; // 漂移速度比正常移动快
+        const moveDistance = driftSpeed * deltaTime;
+        const newWorldPos = currentWorldPos.add(dir.multiplyScalar(moveDistance));
+        // 直接设置世界坐标
+        this.node.setWorldPosition(newWorldPos);
+    }
+
     // 更新移动逻辑
     private updateMovement(deltaTime: number) {
         // 继续移动到目标墙体

+ 43 - 44
assets/scripts/FourUI/ShopSystem/ShopController.ts

@@ -160,12 +160,14 @@ export class ShopController extends Component {
                 console.log('[ShopController] 迁移旧的costFreeUsed数据到新字段');
             }
             
-            // 确保新字段存在
+            // 确保新字段存在,设置默认值
             if (data.billCostFreeUsed === undefined) {
-                data.billCostFreeUsed = false;
+                data.billCostFreeUsed = true;  // 默认为true(可用)
+                console.log('[ShopController] 设置billCostFreeUsed默认值: true');
             }
             if (data.diamondCostFreeUsed === undefined) {
-                data.diamondCostFreeUsed = false;
+                data.diamondCostFreeUsed = true;  // 默认为true(可用)
+                console.log('[ShopController] 设置diamondCostFreeUsed默认值: true');
             }
             
             // 检查是否需要重置(新的一天)
@@ -192,8 +194,8 @@ export class ShopController extends Component {
             diamondsFreeCount: 0,
             diamondsAdCount: 0,
             costAdCount: 0,
-            billCostFreeUsed: false,
-            diamondCostFreeUsed: false
+            billCostFreeUsed: true,
+            diamondCostFreeUsed: true
         };
         this.saveDailyRewardData();
     }
@@ -397,22 +399,18 @@ export class ShopController extends Component {
         console.log('[ShopController] 显示钞票奖励广告');
         
         // 这里应该调用广告SDK显示广告
-        // 模拟广告观看成功
-        this.scheduleOnce(() => {
-            console.log('[ShopController] 广告观看完成,发放钞票奖励');
-            this.claimMoneyReward(true);
-        }, 1.0); // 模拟1秒广告时间
+        // 立即发放奖励,无延迟
+        console.log('[ShopController] 广告观看完成,发放钞票奖励');
+        this.claimMoneyReward(true);
     }
     
     private showAdForDiamondReward() {
         console.log('[ShopController] 显示钻石奖励广告');
         
         // 这里应该调用广告SDK显示广告
-        // 模拟广告观看成功
-        this.scheduleOnce(() => {
-            console.log('[ShopController] 广告观看完成,发放钻石奖励');
-            this.claimDiamondReward(true);
-        }, 1.0); // 模拟1秒广告时间
+        // 立即发放奖励,无延迟
+        console.log('[ShopController] 广告观看完成,发放钻石奖励');
+        this.claimDiamondReward(true);
     }
     
     private showRewardEffect(type: 'money' | 'diamonds', amount: number) {
@@ -433,7 +431,7 @@ export class ShopController extends Component {
             return;
         }
         
-        const costFreeUsed = this.dailyRewardData.billCostFreeUsed || false;
+        const costFreeUsed = this.dailyRewardData.billCostFreeUsed !== undefined ? this.dailyRewardData.billCostFreeUsed : true;
         console.log('[ShopController] 更新钞票Cost按钮UI状态,billCostFreeUsed:', costFreeUsed);
         
         if (this.billCostButton) {
@@ -442,33 +440,34 @@ export class ShopController extends Component {
             
             console.log('[ShopController] 按钮组件检查 - Label:', !!buttonLabel, 'Sprite:', !!buttonSprite);
             
-            if (!costFreeUsed) {
-                // 每天第一次,显示"免费"
-                this.billCostButton.interactable = true;
-                if (buttonLabel) {
-                    buttonLabel.string = "免费";
-                }
-                // 恢复原始图片
-                if (buttonSprite && this.originalBillButtonSprite) {
-                    buttonSprite.spriteFrame = this.originalBillButtonSprite;
-                    console.log('[ShopController] 恢复按钮原始图片');
-                }
+            if (costFreeUsed) {
+            // 每天第一次,显示"免费"
+            this.billCostButton.interactable = true;
+            if (buttonLabel) {
+                buttonLabel.string = "免费";
+            }
+            // 恢复原始图片
+            if (buttonSprite && this.originalBillButtonSprite) {
+                buttonSprite.spriteFrame = this.originalBillButtonSprite;
+                console.log('[ShopController] 恢复按钮原始图片');
+            }
+        } else {
+            // 免费已使用,按钮置灰,并更新对应的数值显示
+            this.billCostButton.interactable = false;
+            if (buttonLabel) {
+                buttonLabel.string = "已使用";
+            }
+            // 设置置灰图片
+            console.log('[ShopController] 尝试设置置灰图片 - buttonSprite:', !!buttonSprite, 'disabledButtonSprite:', !!this.disabledButtonSprite);
+            if (buttonSprite && this.disabledButtonSprite) {
+                buttonSprite.spriteFrame = this.disabledButtonSprite;
+                console.log('[ShopController] 设置按钮为置灰图片成功');
             } else {
-                // 免费已使用,按钮置灰,并更新对应的数值显示
-                this.billCostButton.interactable = false;
-                if (buttonLabel) {
-                    buttonLabel.string = "已使用";
-                }
-                // 设置置灰图片
-                if (buttonSprite && this.disabledButtonSprite) {
-                    buttonSprite.spriteFrame = this.disabledButtonSprite;
-                    console.log('[ShopController] 设置按钮为置灰图片');
-                } else {
-                    console.log('[ShopController] 警告:无法获取按钮Sprite组件或置灰图片资源');
-                }
-                // 更新钞票数值显示
-                this.updateMoneyAmountFromConfig();
+                console.log('[ShopController] 警告:无法设置置灰图片 - buttonSprite:', !!buttonSprite, 'disabledButtonSprite:', !!this.disabledButtonSprite);
             }
+            // 更新钞票数值显示
+            this.updateMoneyAmountFromConfig();
+        }
         }
     }
     
@@ -479,7 +478,7 @@ export class ShopController extends Component {
             return;
         }
         
-        const costFreeUsed = this.dailyRewardData.diamondCostFreeUsed || false;
+        const costFreeUsed = this.dailyRewardData.diamondCostFreeUsed !== undefined ? this.dailyRewardData.diamondCostFreeUsed : true;
         console.log('[ShopController] 更新钻石Cost按钮UI状态,diamondCostFreeUsed:', costFreeUsed);
         
         if (this.diamondCostButton) {
@@ -545,7 +544,7 @@ export class ShopController extends Component {
         
         if (costFreeUsed) {
             // 第一次免费点击
-            this.dailyRewardData.billCostFreeUsed = true;
+            this.dailyRewardData.billCostFreeUsed = false;
             // 增加钞票计数
             this.dailyRewardData.moneyFreeCount++;
             this.saveDailyRewardData();
@@ -566,7 +565,7 @@ export class ShopController extends Component {
         
         if (costFreeUsed) {
             // 第一次免费点击
-            this.dailyRewardData.diamondCostFreeUsed = true;
+            this.dailyRewardData.diamondCostFreeUsed = false;
             // 增加钻石计数
             this.dailyRewardData.diamondsFreeCount++;
             this.saveDailyRewardData();

+ 4 - 4
settings/v2/packages/information.json

@@ -4,19 +4,19 @@
     "customSplash": {
       "id": "customSplash",
       "label": "customSplash",
-      "enable": true,
+      "enable": false,
       "customSplash": {
         "complete": false,
-        "form": "https://creator-api.cocos.com/api/form/show?sid=f0e6e03f0114f158584a56be2a8c8e47"
+        "form": "https://creator-api.cocos.com/api/form/show?"
       }
     },
     "removeSplash": {
       "id": "removeSplash",
       "label": "removeSplash",
-      "enable": true,
+      "enable": false,
       "removeSplash": {
         "complete": false,
-        "form": "https://creator-api.cocos.com/api/form/show?sid=f0e6e03f0114f158584a56be2a8c8e47"
+        "form": "https://creator-api.cocos.com/api/form/show?"
       }
     }
   }