From eb27e5fd31f73b998a4bbd85511a31e40b8c61b7 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期五, 21 十一月 2025 17:03:47 +0800
Subject: [PATCH] 0312 关闭游戏内日志

---
 Main/Component/UI/Effect/EffectPlayer.cs |   49 +++++++++++++++++++++++++++++++------------------
 1 files changed, 31 insertions(+), 18 deletions(-)

diff --git a/Main/Component/UI/Effect/EffectPlayer.cs b/Main/Component/UI/Effect/EffectPlayer.cs
index 6f1d9d5..eec97f3 100644
--- a/Main/Component/UI/Effect/EffectPlayer.cs
+++ b/Main/Component/UI/Effect/EffectPlayer.cs
@@ -24,6 +24,7 @@
         {
             if (value != m_EffectID)
             {
+                Stop();
                 isInit = false;
                 m_EffectID = value;
             }
@@ -60,7 +61,11 @@
     protected EffectPenetrationBlocker blocker = null;
 
     protected bool isInit = false;
-    protected bool isPlaying = false;
+    public bool isPlaying
+    {
+        get;
+        protected set;
+    }
 
     protected List<ParticleSystem> particleList = new List<ParticleSystem>();
 
@@ -80,7 +85,7 @@
         
         if (isPlayOnEnable)
         {
-            PlayAsync(false).Forget();
+            Play(false);
         }
         else if (spineComp != null)
         {
@@ -167,7 +172,7 @@
         Clear();
     }
 
-    public virtual void Play(bool showLog = true)
+    public virtual void Play(bool showLog = true, bool closePMA = false)
     {
         isPlaying = true;
         if (!isInit)
@@ -186,15 +191,17 @@
             //闃茶寖effeid 涓�0
             if (effectConfig != null && effectConfig.isSpine != 0)
             {
-                PlaySpineEffect();
+                PlaySpineEffect(closePMA);
             }
             return;
         }
+        if (effectConfig == null)
+            return;
 
         if (EffectMgr.IsNotShowBySetting(effectId))
-        {
-            return;
-        }
+            {
+                return;
+            }
 
         if (null != effectTarget)
         {
@@ -211,7 +218,7 @@
         // 鍔犺浇spine鐗规晥璧勬簮
         if (effectConfig.isSpine != 0)
         {
-            PlaySpineEffect();
+            PlaySpineEffect(closePMA);
         }
         else
         {
@@ -240,7 +247,7 @@
 
 
 
-    protected void PlaySpineEffect()
+    protected void PlaySpineEffect(bool closePMA = false)
     {
 
         // 浠庣壒鏁堥鍒朵綋姹犺幏鍙栫壒鏁�
@@ -253,10 +260,11 @@
         {
             //LoadAsset 宸茬粡鏈夌紦瀛楽keletonDataAsset
             spineComp.skeletonDataAsset = ResManager.Instance.LoadAsset<SkeletonDataAsset>("UIEffect/" + effectConfig.packageName, effectConfig.fxName);
-
+            //涓簍rue鏃朵細鏈夐儴鍒嗙壒鏁堜笉鏄剧ず 濡傛弧绾х粡楠屾潯锛涙敼鎴愪冀椹悗閮ㄥ垎鐗规晥姝e父锛岃繕鏈夐儴鍒嗕緷鐒惰鏀规璁剧疆
+            spineComp.MeshGenerator.settings.pmaVertexColors = !closePMA;   
             spineComp.raycastTarget = false;
             spineComp.Initialize(true);
-            spineComp.timeScale = 1f;
+            spineComp.timeScale = speedRate;
             // 妫�鏌ュ姩鐢绘槸鍚︽湁鐩稿姞妯″紡
             // bool hasAdditiveBlend = CheckForAdditiveBlend(spineComp.Skeleton);
             // if (hasAdditiveBlend)
@@ -282,13 +290,17 @@
         // 鎾斁鎸囧畾鍔ㄧ敾
     void PlayerTheSpineAnim()
     {
-
         spineComp.enabled = true;
         var skeletonData = spineComp.Skeleton.Data;
         if (skeletonData.Animations.Count > 0)
         {
             //鎸夐厤缃垨鑰呴粯璁ょ涓�涓�
             int defaultAnimIndex = Math.Max(0, effectConfig.animIndex.Length == 0 ? 0 : effectConfig.animIndex[0]);
+            if (playSpineAnimIndex >= skeletonData.Animations.Count)
+            {
+                playSpineAnimIndex = -1;
+                Debug.LogError("鐗规晥锛�" + effectConfig.id + " 绱㈠紩瓒呭嚭鎾斁榛樿鍔ㄧ敾銆� error锛�" + playSpineAnimIndex);
+            }
             string defaultAnimationName = skeletonData.Animations.Items[playSpineAnimIndex == -1 ? defaultAnimIndex : playSpineAnimIndex].Name;
             spineAnimationState.SetAnimation(0, defaultAnimationName, isPlaySpineLoop);
         }
@@ -365,12 +377,12 @@
         }
     }
 
-    public async UniTask PlayAsync(bool showLog = true)
+    public async UniTask PlayAsync(bool showLog = true, bool closePMA = false)
     {
         await UniTask.Delay(playDelayTime);
         try
         {
-            Play(showLog);
+            Play(showLog, closePMA);
         }
         catch (Exception e)
         {
@@ -404,10 +416,11 @@
             spineComp.enabled = false;
             isPlaying = false;
             onComplete?.Invoke();
-            if (isReleaseImmediately)
-            {
-                Release();
-            }
+            // TODO 浼氭姤閿欐殏鏃舵敞閲�
+            // if (isReleaseImmediately)
+            // {
+            //     Release();
+            // }
 
         }
     }

--
Gitblit v1.8.0