From 1ab047b5fdd933c38ba0519ec2e83a44512ea8d7 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期四, 26 三月 2026 17:46:11 +0800
Subject: [PATCH] webgl代码合并 1

---
 Main/Component/UI/Effect/EffectPlayer.cs |   34 ++++++++++++++++++++++++----------
 1 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/Main/Component/UI/Effect/EffectPlayer.cs b/Main/Component/UI/Effect/EffectPlayer.cs
index cda8d4c..c506f18 100644
--- a/Main/Component/UI/Effect/EffectPlayer.cs
+++ b/Main/Component/UI/Effect/EffectPlayer.cs
@@ -288,17 +288,22 @@
             // {
             //     spineComp.material = null;
             // }
-            ResManager.Instance.LoadAssetAsync<Material>("Materials", "SkeletonGraphicDefault-Straight").ContinueWith(material =>
+            var material = await ResManager.Instance.LoadAssetAsync<Material>("Materials", "SkeletonGraphicDefault-Straight");
+            if (material != null)
             {
-                if (material != null)
-                {
-                    spineComp.material = material;
-                }
-                else
-                {
-                    Debug.LogError("Failed to load material for Spine effect: " + effectConfig.fxName);
-                }
-            }).Forget();
+                spineComp.material = material;
+                #if UNITY_WEBGL && !UNITY_EDITOR
+                Debug.Log($"[SpineEffect][WebGL] effectId={effectConfig.id} fxName={effectConfig.fxName}" +
+                    $" mat={material.name} shader={material.shader.name}" +
+                    $" straightAlpha={material.IsKeywordEnabled("_STRAIGHT_ALPHA_INPUT")}" +
+                    $" canvasGroup={material.IsKeywordEnabled("_CANVAS_GROUP_COMPATIBLE")}" +
+                    $" pmaVert={spineComp.MeshGenerator.settings.pmaVertexColors}");
+                #endif
+            }
+            else
+            {
+                Debug.LogError("Failed to load material for Spine effect: " + effectConfig.fxName);
+            }
 
             spineAnimationState = spineComp.AnimationState;
             spineAnimationState.TimeScale = speedRate;
@@ -310,6 +315,15 @@
         spineComp.enabled = true;
         PlayerTheSpineAnim();
         SoundPlayer.Instance.PlayUIAudioDelay(effectConfig.audio).Forget();
+
+        #if UNITY_EDITOR
+        // 缂栬緫鍣ㄦā寮忎笅寮哄埗鍒锋柊鏉愯川鐞冿紝瑙e喅閮ㄥ垎鐗规晥涓嶆樉绀洪棶棰�
+        await UniTask.Delay(100);
+        if (spineComp != null && this != null && spineComp.material != null)
+        {
+            spineComp.material.shader = Shader.Find(spineComp.material.shader.name);
+        }
+        #endif
     }
 
         // 鎾斁鎸囧畾鍔ㄧ敾

--
Gitblit v1.8.0