From f1e6527fd1a9281e254c000e21afb96c2da92e1c Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期三, 29 十月 2025 16:26:48 +0800
Subject: [PATCH] 125 战斗 追击反击连击效果 飘字效果更新

---
 Main/Component/UI/Common/SkeletonIllusionShadow.cs |   40 ++++---
 Main/System/Battle/Skill/SkillBase.cs              |  100 +++++++++++++++++---
 Main/System/Battle/Motion/MotionBase.cs            |    4 
 Main/System/Battle/UIComp/BattleHeroInfoBar.cs     |   37 +++++-
 Main/System/Battle/UIComp/BattleTips.cs            |   63 +++++++++++-
 5 files changed, 195 insertions(+), 49 deletions(-)

diff --git a/Main/Component/UI/Common/SkeletonIllusionShadow.cs b/Main/Component/UI/Common/SkeletonIllusionShadow.cs
index 29244ac..73343f3 100644
--- a/Main/Component/UI/Common/SkeletonIllusionShadow.cs
+++ b/Main/Component/UI/Common/SkeletonIllusionShadow.cs
@@ -13,37 +13,40 @@
     private readonly List<GameObject> illusionShadows = new List<GameObject>();
     private SkeletonAnimation skeletonAnimation;
 
+    private Color color = Color.white;
+
     private bool createSwitch = false;
 
     private int curFrame = 0;
-    private int frameInteral = 4;
+    private int frameInteral = 6;
 
     public void SetSkeletonAnimation(SkeletonAnimation _skeletonAnimation)
     {
         skeletonAnimation = _skeletonAnimation;
     }
 
-    public void Show(bool v)
+    public void Show(bool v, Color _color = default)
     {
         createSwitch = v;
         curFrame = 0;
+        color = _color;
         
         if (!v)
         {
             // 娓呯悊鎵�鏈夋畫褰卞璞�
-            for (int i = illusionShadows.Count - 1; i >= 0; i--)
-            {
-                var go = illusionShadows[i];
-                if (go != null)
-                {
-                    DOTween.Kill(go, complete: false);
-                    if (Application.isPlaying)
-                        Destroy(go);
-                    else
-                        DestroyImmediate(go);
-                }
-            }
-            illusionShadows.Clear();
+            // for (int i = illusionShadows.Count - 1; i >= 0; i--)
+            // {
+            //     var go = illusionShadows[i];
+            //     if (go != null)
+            //     {
+            //         DOTween.Kill(go, complete: false);
+            //         if (Application.isPlaying)
+            //             Destroy(go);
+            //         else
+            //             DestroyImmediate(go);
+            //     }
+            // }
+            // illusionShadows.Clear();
 
         }
     }
@@ -91,9 +94,12 @@
         sa.timeScale = 0;
 
         RendererAdjuster parent = skeletonAnimation.GetComponentInParent<RendererAdjuster>();
-        objTest.AddMissingComponent<RendererAdjuster>().SetSortingOrder(parent.sortingOrder);
+        objTest.AddMissingComponent<RendererAdjuster>().SetSortingOrder(parent.sortingOrder - 1);
 
-        sa.skeleton.A = skeletonAnimation.skeleton.A;
+        sa.skeleton.R = color.r;
+        sa.skeleton.G = color.g;
+        sa.skeleton.B = color.b;
+        sa.skeleton.A = 0.5F; //skeletonAnimation.skeleton.A;
         // 浣跨敤DoTween鍋歛lpha娣″嚭锛孴ween涓巓bjTest缁戝畾锛屼究浜庣粺涓�Kill
         DOTween.To(() => sa.skeleton.A, x => { sa.skeleton.A = x; sa.LateUpdate(); }, 0f, 1f)
             .SetTarget(objTest);
diff --git a/Main/System/Battle/Motion/MotionBase.cs b/Main/System/Battle/Motion/MotionBase.cs
index 818808b..b086126 100644
--- a/Main/System/Battle/Motion/MotionBase.cs
+++ b/Main/System/Battle/Motion/MotionBase.cs
@@ -382,12 +382,12 @@
         if (skeletonAnim != null) skeletonAnim.timeScale = ratio;
     }
 
-    public void ShowIllusionShadow(bool isVisible)
+    public void ShowIllusionShadow(bool isVisible, Color color = default)
     {
         if (illusionShadow != null)
         {
             illusionShadow.SetSkeletonAnimation(skeletonAnim);
-            illusionShadow.Show(isVisible);
+            illusionShadow.Show(isVisible, color);
         }
     }
 }
\ No newline at end of file
diff --git a/Main/System/Battle/Skill/SkillBase.cs b/Main/System/Battle/Skill/SkillBase.cs
index 2cb5134..43eb4e1 100644
--- a/Main/System/Battle/Skill/SkillBase.cs
+++ b/Main/System/Battle/Skill/SkillBase.cs
@@ -9,6 +9,13 @@
 {
     const float moveTime = 0.5f;
 
+    private static readonly Color colorGreen = new Color(33f / 255f,
+                                                        133f / 255f,
+                                                        6f / 255f);
+    private static readonly Color colorBlue = new Color(40f / 255f,
+                                                        87f / 255f,
+                                                        189f / 255f);
+
     protected SkillEffect skillEffect;
     protected HB427_tagSCUseSkill tagUseSkillAttack;
     public SkillConfig skillConfig;
@@ -23,6 +30,8 @@
     protected bool moveFinished = false;
     public int fromSkillId;
     public bool isPlay = false;
+
+    private float MoveSpeed = 750f;
 
     private Dictionary<int, BattleDrops> tempDropList = new Dictionary<int, BattleDrops>();
     private Dictionary<int, HB422_tagMCTurnFightObjDead> tempDeadPackList = new Dictionary<int, HB422_tagMCTurnFightObjDead>();
@@ -76,6 +85,44 @@
         }
     }
 
+    protected void ShadowIllutionCreate(bool create)
+    {
+        if (create)
+        {
+            Color color = Color.white;
+            //1-杩炲嚮锛�2-鍙嶅嚮锛�3-杩藉嚮
+            //  鍙嶅嚮钃濊壊
+            //  杩藉嚮杩炲嚮缁胯壊
+            bool change = false;
+            if (tagUseSkillAttack.BattleType == 1)
+            {
+                color = colorGreen;
+                change = true;
+            }
+            else if (tagUseSkillAttack.BattleType == 2)
+            {
+                color = colorBlue;
+                change = true;
+            }
+            else if (tagUseSkillAttack.BattleType == 3)
+            {
+                color = colorGreen;
+                change = true;
+            }
+            
+            if (change)
+            {
+                MoveSpeed = 1125f;
+                caster.motionBase.ShowIllusionShadow(true, color);
+            }
+        }
+        else
+        {
+            MoveSpeed = 750f;
+            caster.motionBase.ShowIllusionShadow(false);
+        }
+    }
+
     // 鎶�鑳介噴鏀句富閫昏緫锛氬箍鎾簨浠躲�侀珮浜洰鏍囥�佹墽琛岄噴鏀�
     public virtual void Cast()
     {
@@ -104,6 +151,7 @@
             if (hintConfig != null)
             {
                 caster.heroInfoBar.ShowTips(((char)hintConfig.prefix).ToString(), true);
+                // Debug.Break();
             }
         }
 
@@ -148,7 +196,12 @@
         RectTransform target = battleField.GetTeamNode(caster.GetEnemyCamp(), skillConfig);
         ExecuteMoveAndCastSequence(target, () =>
         {
-            MoveToTarget(battleField.GetTeamNode(caster.Camp, caster.teamHero.positionNum), Vector2.zero, OnAttackFinish, 750F);
+            // ShadowIllutionCreate(true);
+            MoveToTarget(battleField.GetTeamNode(caster.Camp, caster.teamHero.positionNum), Vector2.zero, () =>
+            {
+                // ShadowIllutionCreate(false);
+                OnAttackFinish();
+            }, MoveSpeed);
         });
     }
 
@@ -169,7 +222,12 @@
         ExecuteMoveAndCastSequence(targetTrans, () =>
         {
             RectTransform rectTransform = battleField.GetTeamNode(caster.Camp, caster.teamHero.positionNum);
-            MoveToTarget(rectTransform, Vector2.zero, OnAttackFinish, 750F);
+            // ShadowIllutionCreate(true);
+            MoveToTarget(rectTransform, Vector2.zero, () =>
+            {
+                // ShadowIllutionCreate(false);
+                OnAttackFinish();
+            }, MoveSpeed);
         });
     }
 
@@ -179,17 +237,24 @@
         RectTransform target = battleField.GetTeamNode(caster.Camp, skillConfig);
         ExecuteMoveAndCastSequence(target, () =>
         {
-            MoveToTarget(battleField.GetTeamNode(caster.Camp, caster.teamHero.positionNum), Vector2.zero, OnAttackFinish, 750F);
+            // ShadowIllutionCreate(true);
+            MoveToTarget(battleField.GetTeamNode(caster.Camp, caster.teamHero.positionNum), Vector2.zero, () =>
+            {
+                // ShadowIllutionCreate(false);
+                OnAttackFinish();
+            }, MoveSpeed);
         });
     }
 
     // 鎵ц绉诲姩-鏂芥硶-杩斿洖搴忓垪锛氶�氱敤鐨勭Щ鍔ㄦ敾鍑绘祦绋�
     private void ExecuteMoveAndCastSequence(RectTransform target, Action onReturnComplete)
     {
+        ShadowIllutionCreate(true);
         MoveToTarget(target, new Vector2(skillConfig.CastDistance, 0), () =>
         {
             TurnBack(() =>
             {
+                ShadowIllutionCreate(false);
                 CastImpl(() =>
                 {
                     TurnBack(() => 
@@ -210,7 +275,7 @@
     }
 
     // 绉诲姩鍒扮洰鏍囦綅缃細澶勭悊瑙掕壊鐨勭Щ鍔ㄥ姩鐢诲拰閫昏緫
-    protected void MoveToTarget(RectTransform target, Vector2 offset, Action _onComplete = null, float speed = 500f)
+    protected void MoveToTarget(RectTransform target, Vector2 offset, Action _onComplete = null, float speed = 750f)
     {
         if (skillConfig.CastDistance >= 9999)
         {
@@ -645,8 +710,8 @@
     public void OnSkillFinished()
     {
         // 淇锛氫娇鐢ㄥ惊鐜唬鏇块�掑綊锛岄伩鍏嶆爤婧㈠嚭椋庨櫓
-        try
-        {
+        // try
+        // {
             while (true)
             {
                 // 楠岃瘉鎶�鑳芥晥鏋滄槸鍚﹀畬鎴�
@@ -698,17 +763,22 @@
                 }
 
                 if (pack is CustomB421ActionPack actionPack)
+                {
                     actionPack.Distribute();
-                PackageRegedit.Distribute(pack);
+                }
+                else
+                {
+                    PackageRegedit.Distribute(pack);
+                }
             }
-        }
-        catch (Exception ex)
-        {
-            Debug.LogError($"OnSkillFinished寮傚父: {ex.Message}锛屾妧鑳絀D={skillConfig.SkillID}");
-            // 纭繚鐘舵�佷竴鑷存�э紝鍗充娇鍑虹幇寮傚父涔熻鏍囪瀹屾垚
-            isFinished = true;
-            throw; // 閲嶆柊鎶涘嚭寮傚父渚涗笂灞傚鐞�
-        }
+        // }
+        // catch (Exception ex)
+        // {
+        //     Debug.LogError($"OnSkillFinished寮傚父: {ex.Message}锛屾妧鑳絀D={skillConfig.SkillID}");
+        //     // 纭繚鐘舵�佷竴鑷存�э紝鍗充娇鍑虹幇寮傚父涔熻鏍囪瀹屾垚
+        //     isFinished = true;
+        //     throw; // 閲嶆柊鎶涘嚭寮傚父渚涗笂灞傚鐞�
+        // }
 
         isFinished = true;
     }
diff --git a/Main/System/Battle/UIComp/BattleHeroInfoBar.cs b/Main/System/Battle/UIComp/BattleHeroInfoBar.cs
index e870384..cfa66d5 100644
--- a/Main/System/Battle/UIComp/BattleHeroInfoBar.cs
+++ b/Main/System/Battle/UIComp/BattleHeroInfoBar.cs
@@ -7,6 +7,13 @@
 
 public class BattleHeroInfoBar : MonoBehaviour
 {
+    public class TipsInfo
+    {
+        public string message;
+        public bool useArtText;
+        public bool followCharacter;
+    }
+
     protected BattleObject battleObject;
 
     public Slider sliderHp;
@@ -20,7 +27,7 @@
 
     [SerializeField] public List<BattleBuffCell> buffCells = new List<BattleBuffCell>();
 
-    protected List<KeyValuePair<string, bool>> messages = new List<KeyValuePair<string, bool>>();
+    protected List<TipsInfo> messages = new List<TipsInfo>();
 
     public BasicHeroInfoContainer heroInfoContainer;
  
@@ -80,9 +87,14 @@
         }
         tipsList.Clear();
     }
-    public void ShowTips(string message, bool useArtText = false)
+    public void ShowTips(string message, bool useArtText = false, bool followCharacter = false)
     {
-        messages.Add(new KeyValuePair<string, bool>(message, useArtText));
+        messages.Add(new TipsInfo
+        {
+            message = message,
+            useArtText = useArtText,
+            followCharacter = followCharacter
+        });
     }
 
     public void SetActive(bool active)
@@ -90,13 +102,22 @@
         gameObject.SetActive(active);
     }
 
-    public void PopUpTipsDirectly(string message, bool useArtText = false)
+    public void PopUpTipsDirectly(string message, bool useArtText = false, bool followCharacter = false)
     {
         GameObject prefab = textTips.gameObject;
 
-        GameObject go = GameObject.Instantiate(prefab, transform);
+        GameObject go = GameObject.Instantiate(prefab, followCharacter ? transform : battleObject.battleField.battleRootNode.transform);
 
         BattleTips tips = go.GetComponent<BattleTips>();
+
+        if (!followCharacter)
+        {
+            go.transform.position = prefab.transform.position;
+            tips.beginPos = go.transform.localPosition;
+            tips.endPos = tips.endPos + new Vector2(go.transform.localPosition.x, go.transform.localPosition.y);
+        }
+
+        tips.SetSpeedRatio(battleObject.battleField.speedRatio);
 
         tips.SetText(message, useArtText);
 
@@ -163,15 +184,15 @@
             tipsList[i].Run();
         }
 
-        timer += Time.deltaTime;
+        timer += 1f / (float)BattleConst.skillMotionFps * battleObject.battleField.speedRatio;
 
         if (messages.Count > 0 && timer >= PopUpInterval)
         {
             // 鎾斁椋樺瓧
-            KeyValuePair<string, bool> message = messages[0];
+            TipsInfo message = messages[0];
             messages.RemoveAt(0);
 
-            PopUpTipsDirectly(message.Key, message.Value);
+            PopUpTipsDirectly(message.message, message.useArtText, message.followCharacter);
 
             timer = 0f;
         }
diff --git a/Main/System/Battle/UIComp/BattleTips.cs b/Main/System/Battle/UIComp/BattleTips.cs
index 1243441..dfaff7c 100644
--- a/Main/System/Battle/UIComp/BattleTips.cs
+++ b/Main/System/Battle/UIComp/BattleTips.cs
@@ -1,4 +1,3 @@
-
 using UnityEngine;
 using System;
 using UnityEngine.UI;
@@ -6,9 +5,16 @@
 public class BattleTips : MonoBehaviour
 {
     public Vector2 beginPos = Vector2.zero;
-    public Vector2 endPos = new Vector2(0, 100);
-    public float showTime = 0.4f;
+    public Vector2 endPos = new Vector2(0, 150);
+
+    public float scaleChangeTime = 0.2667f; // 7~8甯� (8/30=0.2667绉�)
+    public float totalShowTime = 0.8f; // 鎬绘椂闂寸害24甯� (8+16=24甯�)
     public float timer = 0f;
+
+    public Vector3 beginScale = new Vector3(4f, 4f, 4f);
+    public Vector3 endScale = new Vector3(2f, 2f, 2f);
+    public Color beginColor = new Color(1f, 1f, 1f, 0.5f);
+    public Color endColor = new Color(1f, 1f, 1f, 1f);
 
     public RectTransform rectTransform;
 
@@ -18,21 +24,37 @@
 
     public Action OnFinish;
 
+    private float speedRatio = 1f;
+
+    public void SetSpeedRatio(float ratio)
+    {
+        speedRatio = ratio;
+    }
+
     public void SetText(string text, bool useArtText = false)
     {
-        rectTransform.anchoredPosition = Vector2.zero;
+        //  鍒濆鏀惧ぇ200% 閫忔槑搴�50% 7~8甯у唴缂╁洖100% 閫忔槑搴﹀埌100% 鍐嶅線涓婇14~16甯� 鐒跺悗娑堝け 锛�30甯�/绉�)
+
+        // 8+16/30=0.8绉�
+        
+
+        rectTransform.anchoredPosition = beginPos;
+        rectTransform.localScale = beginScale;
+
         timer = 0f;
         gameObject.SetActive(true);
 
         if (useArtText)
         {
             artText.text = text;
+            artText.color = beginColor;
             tipText.gameObject.SetActive(false);
             artText.gameObject.SetActive(true);
         }
         else
         {
             tipText.text = text;
+            tipText.color = beginColor;
             artText.gameObject.SetActive(false);
             tipText.gameObject.SetActive(true);
         }
@@ -45,14 +67,41 @@
         if (!gameObject.activeSelf)
             return;
 
-        if (timer >= showTime)
+        if (timer >= totalShowTime)
         {
+            gameObject.SetActive(false);
             OnFinish?.Invoke();
             OnFinish = null;
             return;
         }
 
-        rectTransform.anchoredPosition = Vector2.Lerp(beginPos, endPos, timer / showTime);
-        timer += Time.deltaTime;
+        // 鏁翠釜杩囩▼閮藉線涓婇
+        float moveProgress = timer / totalShowTime;
+        rectTransform.anchoredPosition = Vector2.Lerp(beginPos, endPos, moveProgress);
+
+        // 闃舵1: 7~8甯у唴缂╂斁浠巄eginScale鍒癳ndScale锛岄�忔槑搴︿粠50%鍒�100%
+        if (timer < scaleChangeTime)
+        {
+            float scaleProgress = timer / scaleChangeTime;
+            rectTransform.localScale = Vector3.Lerp(beginScale, endScale, scaleProgress);
+
+            Color currentColor = Color.Lerp(beginColor, endColor, scaleProgress);
+            if (tipText.gameObject.activeSelf)
+                tipText.color = currentColor;
+            if (artText.gameObject.activeSelf)
+                artText.color = currentColor;
+        }
+        // 闃舵2: 缂╂斁瀹屾垚鍚庯紝淇濇寔endScale鍜�100%閫忔槑搴︼紝缁х画寰�涓婇
+        else
+        {
+            rectTransform.localScale = endScale;
+            
+            if (tipText.gameObject.activeSelf)
+                tipText.color = endColor;
+            if (artText.gameObject.activeSelf)
+                artText.color = endColor;
+        }
+
+        timer += 1f / (float)BattleConst.skillMotionFps * speedRatio;
     }
 }
\ No newline at end of file

--
Gitblit v1.8.0