woso_javan 3 месяцев назад
Родитель
Сommit
532d2575cb

+ 1 - 1
assets/module_take_goblet/Script/Component/CocktailCup.ts

@@ -55,7 +55,7 @@ export class CocktailCup extends Component {
         this.colorB.color = color;
     }
 
-    // 添加水层 倒水时调用
+    /** 添加图层 接水动画*/
     async addLayer() {
         this.currentLayers++;
         this.playAnimationByState(CocktailCupState.GetWater);

+ 17 - 1
assets/module_take_goblet/Script/Component/OriginCup.ts

@@ -7,6 +7,7 @@ import { Water } from './Water';
 import { OriginArea } from './OriginArea';
 import { LevelManager } from '../Manager/LevelMgr';
 import { tgxUITips } from 'db://assets/core_tgx/tgx';
+import { GameUtil } from '../GameUtil';
 const { ccclass, property, executeInEditMode } = _decorator;
 
 //原浆杯状态 默认 抬起 倒水
@@ -130,7 +131,22 @@ export class OriginCup extends Component {
         }
     }
 
-    //播放动画根据状态
+    fillWater() {
+        const activeWaters = this.waters.children.filter(n => n.active);
+        const topIndex = this.waters.children.length - activeWaters.length;
+        if (activeWaters.length >= 0) {
+            this.playAnimation(OriginCupState.PourWater, topIndex + 1);
+        }
+    }
+
+    hideCurrentWaterLayer() {
+        const activeWaters = this.waters.children.filter(n => n.active);
+        if (activeWaters.length >= 0) {
+            activeWaters[activeWaters.length - 1].active = false;
+        }
+    }
+
+    //播放原浆杯倒水动画
     playAnimation(state: OriginCupState, index?: number) {
         switch (state) {
             case OriginCupState.Up:

+ 4 - 1
assets/module_take_goblet/Script/Component/TempCup.ts

@@ -3,6 +3,7 @@ import { CupHeight, WaterColorHex, WaterColors } from '../TakeGobletGlobalInstan
 import { Water } from './Water';
 import { EventDispatcher } from 'db://assets/core_tgx/easy_ui_framework/EventDispatcher';
 import { GameEvent } from '../Enum/GameEvent';
+import { GameUtil } from '../GameUtil';
 const { ccclass, property } = _decorator;
 
 @ccclass('TempCup')
@@ -51,7 +52,8 @@ export class TempCup extends Component {
         }
     }
 
-    fill(color: WaterColors) {
+    /**暂存杯 接水动画*/
+    async fill(color: WaterColors) {
         if (this._isFull) return;
 
         const waterNode = this.waters.children[0];
@@ -67,6 +69,7 @@ export class TempCup extends Component {
             this.colorB.setAnimation(0, 'pick_01', false);
             this.cupSkeleton.setAnimation(0, 'pick_01', false);
             this._isFull = true;
+            await GameUtil.delay(0.5);
         }
     }
 

+ 4 - 3
assets/module_take_goblet/Script/LevelAction.ts

@@ -252,15 +252,17 @@ export class LevelAction extends Component {
                     targetIsTemp
                 );
 
-                await this.hideCurrentWaterLayer(originCup);
+                originCup.fillWater();
                 // 更新目标杯
                 if (targetIsTemp) {
                     const tempCupComp = targetNode.getComponent(TempCup)!;
-                    tempCupComp.fill(color);
+                    await tempCupComp.fill(color);
                 } else {
                     const cocktailCup = targetNode.getComponent(CocktailCup)!;
                     await cocktailCup.addLayer(); // 等待添加水层流程完成
                 }
+
+                originCup.hideCurrentWaterLayer();
             }
 
             // 处理完所有颜色后检查剩余水层
@@ -429,7 +431,6 @@ export class LevelAction extends Component {
         const topIndex = originCup.waters.children.length - activeWaters.length;
         if (activeWaters.length >= 0) {
             originCup.getComponent(OriginCup)?.playAnimation(OriginCupState.PourWater, topIndex + 1);
-            await GameUtil.delay(0.2);
             activeWaters[activeWaters.length - 1].active = false;
         }
     }