Quellcode durchsuchen

MMO-18476:把原来蓄力进度条的表现加回来,需要蓄力指示器显示几秒编辑器直接配就好,配了进度条的技能被打断了直接一起消失

lvlh vor 3 Jahren
Ursprung
Commit
c5730d4a48

+ 3 - 0
Common/CommonAI/Zone/Data.cs

@@ -1443,6 +1443,9 @@ namespace CommonAI.Zone
         public string ActionEffectFileName;
         [DescAttribute("动作是否循环", "Action")]
         public bool IsCycAction;
+        [DescAttribute("显示蓄力倒计时条时间(毫秒)", "Action")]
+        public float ShowChargeTimeMS = 0f;
+
 
         [DescAttribute("移动可取消动作", "状态")]
         public bool IsCancelable = false;

+ 41 - 0
Common/CommonAI/ZoneClient/ZoneObject.Unit.Status.cs

@@ -483,6 +483,11 @@ namespace CommonAI.ZoneClient
             //CD状态变化事件
             public System.Action OnCDStateChange;
 
+            //蓄力状态发生了变化
+            public System.Action OnChargeStateChange;
+            //蓄力条进度
+            public float ChargeProgress { private set; get; }
+
             internal SkillState(SkillTemplate data, ZoneUnit owner)
             {
                 this.Data = data;
@@ -548,6 +553,16 @@ namespace CommonAI.ZoneClient
                     //ClientLog.LogError("is_skill_end: true");
                 }
                 OnCDStateChange?.Invoke();
+                if (Data.ActionQueue[CurrentActionID].ShowChargeTimeMS > 0)
+                {
+                    ChargeProgress = 0f;
+                    OnChargeStateChange?.Invoke();
+                }
+                else if (ChargeProgress > 0 && ChargeProgress < 1)
+                {
+                    ChargeProgress = 1f;
+                    OnChargeStateChange?.Invoke();
+                }
             }
             public byte NextAction()
             {
@@ -610,6 +625,11 @@ namespace CommonAI.ZoneClient
                 this.stop_time_ms = pass_time_ms;
                 this.is_skill_end = true;
                 this.is_Skill_Block = false;
+                if (ChargeProgress > 0 && ChargeProgress < 1)
+                {
+                    ChargeProgress = 1f;
+                    OnChargeStateChange?.Invoke();
+                }
             }
             internal void Sync(ClientStruct.UnitSkillStatus syn)
             {
@@ -638,6 +658,11 @@ namespace CommonAI.ZoneClient
                 this.is_skill_end = true;
                 internal_update();
                 OnCDStateChange?.Invoke();
+                if(ChargeProgress > 0 && ChargeProgress < 1)
+                {
+                    ChargeProgress = 1f;
+                    OnChargeStateChange?.Invoke();
+                }
             }
             internal void Update(int intervalMS)
             {
@@ -648,6 +673,22 @@ namespace CommonAI.ZoneClient
                 {
                     SetMutilTime();
                 }
+
+                var aq = Data.ActionQueue[CurrentActionID];
+                if (aq.ShowChargeTimeMS > 0)
+                {
+                    if (ChargeProgress < 1)
+                    {
+                        ChargeProgress = pass_time_ms / aq.ShowChargeTimeMS;
+                        if (ChargeProgress > 1) ChargeProgress = 1f;
+                        OnChargeStateChange?.Invoke();
+                    }
+                }
+                else if (ChargeProgress > 0 && ChargeProgress < 1)
+                {
+                    ChargeProgress = 1f;
+                    OnChargeStateChange?.Invoke();
+                }
             }
             internal void SetPassTime(int passTime)
             {