From 537670a1e4dbdf26af45356a2f01c69a8d7dfee7 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期二, 02 九月 2025 14:53:09 +0800
Subject: [PATCH] 50 【主界面】核心主体 - 主界面装备特效

---
 Main/Component/UI/Effect/EffectPlayer.cs |   28 +++++++++++++++++-----------
 1 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/Main/Component/UI/Effect/EffectPlayer.cs b/Main/Component/UI/Effect/EffectPlayer.cs
index 22b7ab3..b187168 100644
--- a/Main/Component/UI/Effect/EffectPlayer.cs
+++ b/Main/Component/UI/Effect/EffectPlayer.cs
@@ -167,7 +167,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 +186,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 +213,7 @@
         // 鍔犺浇spine鐗规晥璧勬簮
         if (effectConfig.isSpine != 0)
         {
-            PlaySpineEffect();
+            PlaySpineEffect(closePMA);
         }
         else
         {
@@ -240,7 +242,7 @@
 
 
 
-    protected void PlaySpineEffect()
+    protected void PlaySpineEffect(bool closePMA = false)
     {
 
         // 浠庣壒鏁堥鍒朵綋姹犺幏鍙栫壒鏁�
@@ -253,7 +255,7 @@
         {
             //LoadAsset 宸茬粡鏈夌紦瀛楽keletonDataAsset
             spineComp.skeletonDataAsset = ResManager.Instance.LoadAsset<SkeletonDataAsset>("UIEffect/" + effectConfig.packageName, effectConfig.fxName);
-
+            spineComp.MeshGenerator.settings.pmaVertexColors = !closePMA;   //涓簍rue鏃朵細鏈夐儴鍒嗙壒鏁堜笉鏄剧ず 濡備富鐣岄潰瑁呭鐗规晥
             spineComp.raycastTarget = false;
             spineComp.Initialize(true);
             spineComp.timeScale = speedRate;
@@ -282,13 +284,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 +371,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)
         {

--
Gitblit v1.8.0