From fa401262d2ca2891aa9c88b9667f66aa1175736c Mon Sep 17 00:00:00 2001
From: lcy <1459594991@qq.com>
Date: 星期一, 02 三月 2026 11:22:13 +0800
Subject: [PATCH] 461 限时冲刺-客户端 修改可领取物品摇动动画

---
 Main/System/TimeRush/TimeRushTaskCell.cs |  139 +++++++++++++++++++++++++++-------------------
 1 files changed, 81 insertions(+), 58 deletions(-)

diff --git a/Main/System/TimeRush/TimeRushTaskCell.cs b/Main/System/TimeRush/TimeRushTaskCell.cs
index 18dac4a..b6e57f7 100644
--- a/Main/System/TimeRush/TimeRushTaskCell.cs
+++ b/Main/System/TimeRush/TimeRushTaskCell.cs
@@ -1,4 +1,5 @@
 using System.Collections.Generic;
+using DG.Tweening;
 using UnityEngine;
 
 public class TimeRushTaskCell : MonoBehaviour
@@ -10,7 +11,18 @@
     [SerializeField] TextEx sliderText;
     [SerializeField] ItemCell[] itemCells;
     [SerializeField] ImageEx[] grays;
-    [SerializeField] RotationTween[] tweens;
+
+    [SerializeField] RectTransform[] tweenTargets;
+    
+    [SerializeField, Tooltip("鍗曡竟鎽嗗姩鐨勫熀纭�鑰楁椂(绉�)")] 
+    float timeMultiplier = 0.5f;
+    
+    [SerializeField, Tooltip("涓�杞憜鍔ㄧ粨鏉熷悗鐨勫仠椤跨鏁�")] 
+    float pauseDuration = 0.2f; 
+    
+    [SerializeField, Tooltip("宸﹀彸鎽囨憜鐨勬渶澶ф棆杞搴�")] 
+    float shakeAngle = 15f; 
+
     [SerializeField] UIEffectPlayer uiEffectPlayer;
 
     int awardIndex;
@@ -18,76 +30,24 @@
     int tabType;
     TimeRushManager manager { get { return TimeRushManager.Instance; } }
 
-    private void OnEnable()
-    {
-        manager.PlayAnimationSync += OnPlaySyncAnimation;
-        for (int i = 0; i < tweens.Length; i++)
-        {
-            tweens[i].Stop();
-            tweens[i].SetStartState();
-        }
-
-        if (!manager.TryGetOperationInfo(out var act))
-            return;
-        if (!act.TryGetRoundInfoByIndex(roundType, awardIndex, out var awardInfo, out int listIndex) || awardInfo.AwardItemList == null)
-            return;
-        int state = manager.GetAwardState(roundType, awardIndex);
-        for (int i = 0; i < tweens.Length; i++)
-        {
-            if (i < awardInfo.AwardItemList.Length)
-            {
-                if (state == 1)
-                {
-                    tweens[i].Play();
-                }
-            }
-        }
-
-    }
-
-    private void OnDisable()
-    {
-        manager.PlayAnimationSync -= OnPlaySyncAnimation;
-    }
-
-    private void OnPlaySyncAnimation()
-    {
-        if (tabType != 1)
-            return;
-        for (int i = 0; i < tweens.Length; i++)
-        {
-            tweens[i].Stop();
-            tweens[i].SetStartState();
-        }
-        if (!manager.TryGetOperationInfo(out var act))
-            return;
-        if (!act.TryGetRoundInfoByIndex(roundType, awardIndex, out var awardInfo, out int listIndex) || awardInfo.AwardItemList == null)
-            return;
-        int state = manager.GetAwardState(roundType, awardIndex);
-        for (int i = 0; i < tweens.Length; i++)
-        {
-            if (tweens[i].isActiveAndEnabled && state == 1)
-            {
-                tweens[i].Play();
-            }
-        }
-    }
-
     public void Display(int index, CellView cell, List<HAA88_tagMCActLunhuidianInfo.tagMCActLunhuidianAward> taskList)
     {
-
         roundType = cell.info.Value.infoInt1;
         tabType = cell.info.Value.infoInt2;
         if (taskList.IsNullOrEmpty() || index < 0 || index >= taskList.Count)
             return;
+
         var task = taskList[index];
         awardIndex = task.AwardIndex;
+
         if (!manager.TryGetOperationInfo(out var act))
             return;
         if (!act.TryGetRound(roundType, out var round))
             return;
         if (!manager.TryGetPlayerInfo(roundType, out var playerInfo))
             return;
+        RefreshAnimations();
+
         int state = manager.GetAwardState(roundType, awardIndex);
         maskImage.SetActive(state == 2);
         uiEffectPlayer.SetActive(state == 1);
@@ -133,4 +93,67 @@
         });
     }
 
-}
+    private void OnEnable()
+    {
+        manager.PlayAnimationSync += OnPlaySyncAnimation;
+        RefreshAnimations();
+    }
+
+    private void OnDisable()
+    {
+        manager.PlayAnimationSync -= OnPlaySyncAnimation;
+        StopAllTweens();
+    }
+
+    private void OnPlaySyncAnimation()
+    {
+        if (tabType != 1) return;
+        RefreshAnimations();
+    }
+
+    // 缁熶竴澶勭悊鍔ㄧ敾鐨勫埛鏂板拰鍚姩
+    private void RefreshAnimations()
+    {
+        StopAllTweens();
+
+        if (!manager.TryGetOperationInfo(out var act)) return;
+        if (!act.TryGetRoundInfoByIndex(roundType, awardIndex, out var awardInfo, out int listIndex) || awardInfo.AwardItemList == null) return;
+
+        int state = manager.GetAwardState(roundType, awardIndex);
+
+        for (int i = 0; i < tweenTargets.Length; i++)
+        {
+            if (i < awardInfo.AwardItemList.Length && tweenTargets[i].gameObject.activeInHierarchy && state == 1)
+            {
+                PlayShakeAnimation(tweenTargets[i]);
+            }
+        }
+    }
+
+    // 瀹夊叏鍋滄鎵�鏈夊姩鐢诲苟閲嶇疆鐘舵��
+    private void StopAllTweens()
+    {
+        // 褰诲簳娓呯悊 DOTween 鐘舵�佸苟鍥炴
+        for (int i = 0; i < tweenTargets.Length; i++)
+        {
+            if (tweenTargets[i] != null)
+            {
+                tweenTargets[i].DOKill();
+                tweenTargets[i].localEulerAngles = Vector3.zero;
+            }
+        }
+    }
+
+    private void PlayShakeAnimation(RectTransform target)
+    {
+        Sequence shakeSequence = DOTween.Sequence();
+
+        shakeSequence.Append(target.DOLocalRotate(new Vector3(0, 0, -shakeAngle), timeMultiplier * 1).SetEase(Ease.Linear))
+                     .Append(target.DOLocalRotate(new Vector3(0, 0, shakeAngle), timeMultiplier * 2).SetEase(Ease.Linear))
+                     .Append(target.DOLocalRotate(new Vector3(0, 0, -shakeAngle), timeMultiplier * 2).SetEase(Ease.Linear))
+                     .Append(target.DOLocalRotate(Vector3.zero, timeMultiplier * 1).SetEase(Ease.Linear))
+                     .AppendInterval(pauseDuration);  // 娣诲姞鍋滈】
+        shakeSequence.SetLoops(-1);
+        shakeSequence.SetTarget(target);
+    }
+}
\ No newline at end of file

--
Gitblit v1.8.0