From c6ea64fb4e4755c4290bf5228d8cd463bc81c21f Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期四, 13 十一月 2025 21:42:16 +0800
Subject: [PATCH] 0312 英雄之路红点受限每日任务开启;增加检测装备输出

---
 Main/Component/UI/Effect/UIEffectPlayer.cs |  186 ++++------------------------------------------
 1 files changed, 16 insertions(+), 170 deletions(-)

diff --git a/Main/Component/UI/Effect/UIEffectPlayer.cs b/Main/Component/UI/Effect/UIEffectPlayer.cs
index c71396f..5d70f0f 100644
--- a/Main/Component/UI/Effect/UIEffectPlayer.cs
+++ b/Main/Component/UI/Effect/UIEffectPlayer.cs
@@ -11,184 +11,22 @@
 //UI鐗规晥澶ч儴鍒嗘儏鍐典笉浼氭敼鍙樼壒鏁堬紝鏃犻渶閿�姣�
 public class UIEffectPlayer : EffectPlayer
 {
-    [Header("鏄惁寰幆鎾斁spine鐗规晥")]
-    public bool isPlaySpineLoop = false;
-
-    [Header("鏄惁鍦ㄦ樉绀烘椂鎾斁")]
-    public bool isPlayOnEnable = false;
-
-    [Header("寤惰繜鎾斁(姣)")]
-    public int playDelayTime = 0;
-
-    int playSpineAnimIndex = -1; //鎾斁spine鐗规晥鍔ㄧ敾绱㈠紩,
 
 
-
-    protected override void OnEnable()
-    {
-        playSpineAnimIndex = -1;
-        if (isPlayOnEnable)
-        {
-            PlayAsync(false).Forget();
-        }
-        else if (spineComp != null)
-        {
-            if (!isPlaying)
-            {
-                //闅愯棌锛屼細鏈夐潤鎬佹樉绀洪棶棰�
-                spineComp.enabled = false;
-            }
-        }
-    }
-
-    public override void Play(bool showLog = true)
-    {
-        isPlaying = true;
-        if (!isInit)
-        {
-            InitComponent(showLog);
-            isInit = true;
-        }
-        else
-        {
-            //閬垮厤閲嶅鍒涘缓
-            if (!this.gameObject.activeSelf)
-            {
-                this.gameObject.SetActive(true);
-            }
-            if (effectConfig.isSpine != 0)
-            {
-                PlayerTheSpineAnim();
-            }
-            return;
-        }
-
-        if (EffectMgr.IsNotShowBySetting(effectId))
-        {
-            return;
-        }
-
-        if (null != effectTarget)
-        {
-            if (pool != null)
-                pool.Release(effectTarget);
-            effectTarget = null;
-        }
-
-        if (!this.gameObject.activeSelf)
-        {
-            this.gameObject.SetActive(true);
-        }
-
-        // 鍔犺浇spine鐗规晥璧勬簮
-        if (effectConfig.isSpine != 0)
-        {
-            PlaySpineEffect();
-        }
-        else
-        {
-            PlayerEffect(false);
-        }
-        SoundPlayer.Instance.PlayUIAudio(effectConfig.audio);
-    }
-
-
-    protected override void PlaySpineEffect()
-    {
-        if (spineComp == null)
-        {
-            spineComp = gameObject.AddMissingComponent<SkeletonGraphic>();
-        }
-
-        if (spineComp.skeletonDataAsset == null)
-        {
-            //LoadAsset 宸茬粡鏈夌紦瀛楽keletonDataAsset
-            spineComp.skeletonDataAsset = ResManager.Instance.LoadAsset<SkeletonDataAsset>("UIEffect/" + effectConfig.packageName, effectConfig.fxName);
-            spineComp.raycastTarget = false;
-            spineComp.Initialize(true);
-
-            // 妫�鏌ュ姩鐢绘槸鍚︽湁鐩稿姞妯″紡
-            bool hasAdditiveBlend = CheckForAdditiveBlend(spineComp.Skeleton);
-            if (hasAdditiveBlend)
-            {
-                spineComp.material = ResManager.Instance.LoadAsset<Material>("UIEffect/" + effectConfig.packageName, effectConfig.fxName.Split('_')[0] + "_Material-Additive");
-            }
-            else
-            {
-                spineComp.material = null;
-            }
-
-            spineAnimationState = spineComp.AnimationState;
-            spineAnimationState.Data.DefaultMix = 0f;
-            spineAnimationState.Complete -= OnSpineAnimationComplete;
-            spineAnimationState.Complete += OnSpineAnimationComplete;
-        }
-
-        spineComp.enabled = true;
-        PlayerTheSpineAnim();
-    }
-
-    private bool CheckForAdditiveBlend(Spine.Skeleton skeleton)
-    {
-        // 閬嶅巻鎵�鏈夋彃妲斤紝妫�鏌ユ槸鍚︽湁鐩稿姞妯″紡
-        foreach (var slot in skeleton.Slots)
-        {
-            if (slot.Data.BlendMode == Spine.BlendMode.Additive)
-            {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    public void Play(int index, bool showLog = true)
+    //spine閲岀殑绗嚑涓姩鐢伙紝锛侊紒closePMA鍙傛暟鏃犳晥鏆傛椂鐣欑潃
+    public void Play(int index, bool showLog = true, bool closePMA = false)
     {
         playSpineAnimIndex = index;
-        PlayAsync(showLog).Forget();
+        PlayAsync(showLog, closePMA).Forget();
     }
 
-    async UniTask PlayAsync(bool showLog = true)
+    //閰嶇疆鍔ㄧ敾缁勬暟缁勭储寮�
+    public void PlayByArrIndex(int index, bool showLog = true, bool closePMA = false)
     {
-        await UniTask.Delay(playDelayTime);
-        Play(showLog);
+        var config = EffectConfig.Get(effectId);
+        playSpineAnimIndex = index < config.animIndex.Length ? config.animIndex[index] : 0;
+        PlayAsync(showLog, closePMA).Forget();
     }
-
-    // 鎾斁鎸囧畾鍔ㄧ敾
-    void PlayerTheSpineAnim()
-    {
-        spineComp.enabled = true;
-        var skeletonData = spineComp.Skeleton.Data;
-        if (skeletonData.Animations.Count > 0)
-        {
-            string defaultAnimationName = skeletonData.Animations.Items[playSpineAnimIndex == -1 ? effectConfig.animIndex : playSpineAnimIndex].Name;
-            spineAnimationState.SetAnimation(0, defaultAnimationName, isPlaySpineLoop);
-        }
-        else
-        {
-            Debug.LogError("Spine 鏁版嵁涓病鏈夋壘鍒颁换浣曞姩鐢伙紒" + effectConfig.id);
-        }
-    }
-
-
-
-    //鍗曟鎾斁瀹屾瘯灏变細瑙﹀彂锛屽嵆浣挎槸寰幆
-    protected override void OnSpineAnimationComplete(Spine.TrackEntry trackEntry)
-    {
-        if (!isPlaySpineLoop)
-        {
-            spineComp.enabled = false;
-            isPlaying = false;
-            if (isReleaseImmediately)
-            {
-                Stop();
-            }
-            else
-            {
-                onComplete?.Invoke();
-            }
-        }
-    }
-
 
 
     //  鍒涘缓鍚庣殑鐗规晥浼氳嚜鍔ㄩ殣钘� 闇�瑕佹墜鍔ㄨ皟鐢≒lay鎵嶈兘鎾斁
@@ -212,4 +50,12 @@
     }
 
 
+	public void SetEnabled(bool isEnable)
+	{ 
+		if (spineComp == null)
+		{
+			return;
+		}
+		spineComp.enabled = isEnable;
+	}
 }

--
Gitblit v1.8.0