From 49fc368c838442a00be7bf432e2b7c26eb524fbc Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期二, 22 七月 2025 17:25:39 +0800
Subject: [PATCH] 125 【战斗】战斗系统 特效部分更新

---
 Main/System/Battle/BattleField/BattleField.cs       |   13 ++
 Main/System/UIBase/UIBase.cs                        |   11 -
 /dev/null                                           |   12 --
 Main/Config/Configs/EffectConfig.cs                 |   20 ++--
 Main/System/Battle/SkillEffect/NormalSkillEffect.cs |   13 +-
 Main/Utility/EffectPenetrationBlocker.cs            |   25 ++++
 Main/System/Battle/BattleWin.cs                     |    6 
 Main/Component/UI/Effect/EffectPlayer.cs            |  188 +++++++++++++++++++++++--------------
 Main/System/Battle/BattleEffectMgr.cs               |    3 
 Main/System/Battle/SkillEffect/BulletSkillEffect.cs |    3 
 10 files changed, 174 insertions(+), 120 deletions(-)

diff --git a/Main/Component/UI/Effect/ActorEffectEvent.cs b/Main/Component/UI/Effect/ActorEffectEvent.cs
deleted file mode 100644
index 5139a51..0000000
--- a/Main/Component/UI/Effect/ActorEffectEvent.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-锘縰sing System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class ActorEffectEvent : MonoBehaviour
-{
-
-    public void PlayEffect(int _effectId)
-    {
-        SFXPlayUtility.Instance.Play(_effectId, this.transform);
-    }
-
-
-}
diff --git a/Main/Component/UI/Effect/ActorEffectEvent.cs.meta b/Main/Component/UI/Effect/ActorEffectEvent.cs.meta
deleted file mode 100644
index 1a731fd..0000000
--- a/Main/Component/UI/Effect/ActorEffectEvent.cs.meta
+++ /dev/null
@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: 7923f721c33fe1247b0ec0a309b68355
-timeCreated: 1508464348
-licenseType: Pro
-MonoImporter:
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 
diff --git a/Main/Component/UI/Effect/EffectPlayer.cs b/Main/Component/UI/Effect/EffectPlayer.cs
index cc2211a..26427fa 100644
--- a/Main/Component/UI/Effect/EffectPlayer.cs
+++ b/Main/Component/UI/Effect/EffectPlayer.cs
@@ -4,16 +4,17 @@
 using Spine.Unity;
 using UnityEngine;
 using Spine;
+using UnityEngine.UI;
 
 public class EffectPlayer : MonoBehaviour
 {
     public int effectId;
 
-    public bool autoDestroy = false;
-
-    public float destroyDelay = 0f;
+    public EffectConfig effectConfig;
 
     public Action<EffectPlayer> onDestroy;
+
+    public float speedRate = 1f;
 
     [HideInInspector] public Canvas canvas = null;
 
@@ -21,9 +22,63 @@
 
     protected EffectPenetrationBlocker blocker = null;
 
+    protected bool isInit = false;
+
+    protected List<ParticleSystem> particleList = new List<ParticleSystem>();
+
+    protected List<Animator> animatorList = new List<Animator>();
+
+    protected List<Renderer> rendererList = new List<Renderer>();
+
+    protected SkeletonGraphic spineComp;
+
     protected void Start()
     {
         ReStart();
+    }
+
+    protected void InitCompnent()
+    {
+        if (effectId <= 0)
+        {
+            effectConfig = null;
+            Debug.LogError("EffectPlayer effectId is not set");
+#if UNITY_EDITOR
+            UnityEditor.Selection.activeGameObject = gameObject;
+            UnityEditor.EditorGUIUtility.PingObject(gameObject);
+#endif
+            return;
+        }
+
+        effectConfig = EffectConfig.Get(effectId);
+
+        if (null == effectConfig)
+        {
+            Debug.LogError("could not find effect config, effect id is " + effectId);
+#if UNITY_EDITOR
+            UnityEditor.Selection.activeGameObject = gameObject;
+            UnityEditor.EditorGUIUtility.PingObject(gameObject);
+#endif
+            return;
+        }
+
+
+        particleList.Clear();
+        animatorList.Clear();
+        rendererList.Clear();
+        spineComp = null;
+
+        if (effectConfig.isSpine != 0)
+        {
+            spineComp = gameObject.GetComponentInChildren<SkeletonGraphic>(true);
+        }
+        else
+        {
+            //  鏀堕泦缁勪欢
+            particleList.AddRange(gameObject.GetComponentsInChildren<ParticleSystem>(true));
+            animatorList.AddRange(gameObject.GetComponentsInChildren<Animator>(true));
+        }
+        rendererList.AddRange(gameObject.GetComponentsInChildren<Renderer>(true));
     }
 
     public void Stop()
@@ -33,20 +88,29 @@
             DestroyImmediate(effectTarget);
             effectTarget = null;
         }
+
+        isInit = false;
+
+        particleList.Clear();
+        animatorList.Clear();
+        rendererList.Clear();
+        spineComp = null;
     }
 
     public void Play()
     {
-        if (!isActiveAndEnabled)
-        {
-            gameObject.SetActive(true);
-        }
         ReStart();
     }
 
 
     protected void ReStart()
     {
+        if (!isInit)
+        {
+            isInit = true;
+            InitCompnent();
+        }
+
         if (EffectMgr.Instance.IsNotShowBySetting(effectId))
         {
             return;
@@ -58,67 +122,42 @@
             effectTarget = null;
         }
 
-        EffectConfig effectCfg = EffectConfig.Get(effectId);
-
-        if (null == effectCfg)
-        {
-            return;
-        }
-
         //	YYL TODO
         //	鍦ㄨ繖閲岃�冭檻鐢ㄦ睜鐨勮瘽鍙兘璧伴厤缃ソ涓�鐐� 鍘熸湰鐨勬槸鏃犺濡備綍閮借蛋姹� 浣嗘槸瀹為檯涓婃湁浜涚壒鏁堝苟涓嶉渶瑕�
 
         // 鍔犺浇鐗规晥璧勬簮
-        var effectPrefab = ResManager.Instance.LoadAsset<GameObject>("UIEffect/" + effectCfg.packageName, effectCfg.fxName);
+        var effectPrefab = ResManager.Instance.LoadAsset<GameObject>("UIEffect/" + effectConfig.packageName, effectConfig.fxName);
         if (effectPrefab == null)
         {
-            Debug.LogError($"鍔犺浇UI鐗规晥澶辫触: {effectCfg.packageName}");
+            Debug.LogError($"鍔犺浇UI鐗规晥澶辫触: {effectConfig.packageName}");
             return;
         }
 
         // 瀹炰緥鍖栫壒鏁�
         effectTarget = Instantiate(effectPrefab, transform);
-        effectTarget.name = $"Effect_{effectCfg.fxName}";
+        effectTarget.name = $"Effect_{effectConfig.fxName}";
 
+        //  鎬濊�冧竴涓嬪湪娌℃湁鎸傚湪鑺傜偣鐨勬椂鍊�
         if (null == canvas)
             canvas = GetComponentInParent<Canvas>();
 
-        if (null == canvas)
-        {
-            Debug.LogError("can not find canvas for UIEffect " + effectId);
-            return;
-        }
 
         // 娣诲姞鐗规晥绌块�忛樆鎸″櫒
         blocker = effectTarget.AddMissingComponent<EffectPenetrationBlocker>();
-        blocker.parentCanvas = canvas;
 
-        //  寤惰繜涓�甯ф墠鐢熸晥
-        this.DelayFrame(blocker.UpdateSortingOrder);
-
-        // blocker.UpdateSortingOrder();
+        //  濡傛灉娌℃湁canvas鐨勮瘽 姝e父鏄洜涓轰笉鍦˙attleWin涓嬮潰鐨勮妭鐐� 鎰忔�濆氨鏄綋鍓嶆病鏈夋樉绀� 绛夊埌鍒囧洖鎴樻枟鐨勬椂鍊欏啀閫氳繃BattleField.UpdateCanvas鏉ユ洿鏂�
+        if (canvas != null)
+        {
+            blocker.SetParentCanvas(canvas);
+        }
 
         // 鑷姩閿�姣�
-        if (autoDestroy)
+        if (effectConfig.autoDestroy != 0)
         {
-            Destroy(effectTarget, destroyDelay);
+            Destroy(effectTarget, effectConfig.destroyDelay);
         }
     }
 
-    public void SetSortingOrderOffset(int offset)
-    {
-        // 琚獶estroy涔嬪悗effectTarget == null 涓� true 浣嗘槸璁块棶鍐呭浼氭姤閿�
-        if (blocker != null && effectTarget != null)
-        {
-            blocker.sortingOrderOffset = offset;
-            blocker.UpdateSortingOrder();
-        }
-        else
-        {
-            blocker = null;
-            effectTarget = null;
-        }
-    }
 
     protected void OnDestroy()
     {
@@ -130,7 +169,7 @@
     }
 
     //  鍒涘缓鍚庣殑鐗规晥浼氳嚜鍔ㄩ殣钘� 闇�瑕佹墜鍔ㄨ皟鐢≒lay鎵嶈兘鎾斁
-    public static EffectPlayer Create(int effectId, Transform parent, bool createNewChild = false, bool _autoDestroy = true, float _destroyDelay = 5f)
+    public static EffectPlayer Create(int effectId, Transform parent, bool createNewChild = false)
     {
         EffectPlayer effectPlayer = null;
 
@@ -144,10 +183,8 @@
         {
             effectPlayer = parent.AddMissingComponent<EffectPlayer>();
             effectPlayer.effectId = effectId;
-            effectPlayer.autoDestroy = _autoDestroy;
-            effectPlayer.destroyDelay = _destroyDelay;
         }
-        effectPlayer.SetActive(false);
+        effectPlayer.SetActive(true);
         return effectPlayer;
     }
 
@@ -156,22 +193,21 @@
         if (effectTarget == null) return;
 
         // Spine鍔ㄧ敾
-        var spineGraphics = effectTarget.GetComponentsInChildren<SkeletonGraphic>(true);
-        foreach (var sg in spineGraphics)
+        // var spineGraphics = effectTarget.GetComponentsInChildren<SkeletonGraphic>(true);
+        // foreach (var sg in spineGraphics)
+        if (spineComp != null)
         {
-            sg.timeScale = 0f;
+            spineComp.timeScale = 0f;
         }
 
         // Animator鍔ㄧ敾
-        var animators = effectTarget.GetComponentsInChildren<Animator>(true);
-        foreach (var animator in animators)
+        foreach (var animator in animatorList)
         {
             animator.speed = 0f;
         }
 
         // 绮掑瓙鐗规晥
-        var particles = effectTarget.GetComponentsInChildren<ParticleSystem>(true);
-        foreach (var ps in particles)
+        foreach (var ps in particleList)
         {
             ps.Pause();
         }
@@ -181,23 +217,19 @@
     {
         if (effectTarget == null) return;
 
-        // Spine鍔ㄧ敾
-        var spineGraphics = effectTarget.GetComponentsInChildren<SkeletonGraphic>(true);
-        foreach (var sg in spineGraphics)
+        if (spineComp != null)
         {
-            sg.timeScale = 1f;
+            spineComp.timeScale = speedRate;
         }
 
         // Animator鍔ㄧ敾
-        var animators = effectTarget.GetComponentsInChildren<Animator>(true);
-        foreach (var animator in animators)
+        foreach (var animator in animatorList)
         {
-            animator.speed = 1f;
+            animator.speed = speedRate;
         }
 
         // 绮掑瓙鐗规晥
-        var particles = effectTarget.GetComponentsInChildren<ParticleSystem>(true);
-        foreach (var ps in particles)
+        foreach (var ps in particleList)
         {
             ps.Play();
         }
@@ -208,18 +240,13 @@
         if (effectTarget == null) return true;
 
         // Spine鍔ㄧ敾
-        var spineGraphics = effectTarget.GetComponentsInChildren<SkeletonGraphic>(true);
-        foreach (var sg in spineGraphics)
+        if (!spineComp.AnimationState.GetCurrent(0).IsComplete)
         {
-            if (!sg.AnimationState.GetCurrent(0).IsComplete)
-            {
-                return false;
-            }
+            return false;
         }
 
         // Animator鍔ㄧ敾
-        var animators = effectTarget.GetComponentsInChildren<Animator>(true);
-        foreach (var animator in animators)
+        foreach (var animator in animatorList)
         {
             AnimatorStateInfo stateInfo = animator.GetCurrentAnimatorStateInfo(0);
 
@@ -231,8 +258,7 @@
         }
 
         // 绮掑瓙鐗规晥
-        var particles = effectTarget.GetComponentsInChildren<ParticleSystem>(true);
-        foreach (var ps in particles)
+        foreach (var ps in particleList)
         {
             if (ps.IsAlive())
             {
@@ -242,4 +268,20 @@
 
         return true;
     }
+
+    /// <summary>
+    /// 璁剧疆閬僵锛堟敮鎸丷ectMask2D銆丮ask銆丼moothMask绛夛級
+    /// </summary>
+    public void SetMask(RectTransform maskArea = null)
+    {
+        if (effectTarget == null || blocker == null)
+            return;
+
+        // 浼樺厛浣跨敤浼犲叆鐨刴askArea
+        if (maskArea != null)
+        {
+            blocker.PerformMask(maskArea);
+            return;
+        }
+    }
 }
diff --git a/Main/Config/Configs/EffectConfig.cs b/Main/Config/Configs/EffectConfig.cs
index 6cf5d89..69df1c6 100644
--- a/Main/Config/Configs/EffectConfig.cs
+++ b/Main/Config/Configs/EffectConfig.cs
@@ -1,6 +1,6 @@
 锘�//--------------------------------------------------------
 //    [Author]:           YYL
-//    [  Date ]:           Friday, June 27, 2025
+//    [  Date ]:           2025骞�7鏈�22鏃�
 //--------------------------------------------------------
 
 using System.Collections.Generic;
@@ -15,13 +15,13 @@
 
     public int id;
 	public string packageName;
+	public int isSpine;
 	public string fxName;
-	public int job;
 	public int audio;
-	public int stopImmediate;
-	public int setParent;
 	public string nodeName;
 	public int notShow;
+	public int autoDestroy;
+	public float destroyDelay;
 
     public override int LoadKey(string _key)
     {
@@ -37,19 +37,19 @@
 
 			packageName = tables[1];
 
-			fxName = tables[2];
+			int.TryParse(tables[2],out isSpine); 
 
-			int.TryParse(tables[3],out job); 
+			fxName = tables[3];
 
 			int.TryParse(tables[4],out audio); 
 
-			int.TryParse(tables[5],out stopImmediate); 
+			nodeName = tables[5];
 
-			int.TryParse(tables[6],out setParent); 
+			int.TryParse(tables[6],out notShow); 
 
-			nodeName = tables[7];
+			int.TryParse(tables[7],out autoDestroy); 
 
-			int.TryParse(tables[8],out notShow); 
+			float.TryParse(tables[8],out destroyDelay); 
         }
         catch (Exception exception)
         {
diff --git a/Main/Core/SFX/SFXController.cs b/Main/Core/SFX/SFXController.cs
deleted file mode 100644
index 4cc70ec..0000000
--- a/Main/Core/SFX/SFXController.cs
+++ /dev/null
@@ -1,223 +0,0 @@
-锘�
-using UnityEngine;
-using UnityEngine.Events;
-
-public class SFXController : MonoBehaviour
-{
-    public struct ParticleProperties
-    {
-        public float simulationSpeed;
-    }
-
-    public float duration = 2;
-    [System.NonSerialized]
-    public UnityAction<SFXController> m_OnFinished;
-
-    [HideInInspector]
-    public int effectId;
-
-    [HideInInspector]
-    public float startTime;
-
-    public int DelayFrameCount
-    {
-        get; set;
-    }
-
-    [HideInInspector]
-    public EffectConfig config;
-
-    public bool releaseHideChildren = true;
-
-    private float m_AnimatorSpeed = 1;
-    private ParticleSystem[] m_CacheParticleSystem;
-    private ParticleProperties[] m_ParticleProperties;
-    private TrailRenderer[] m_CacheTrailRenderer;
-    private Animator[] m_CacheAnimator;
-    private Renderer[] m_Renderers;
-
-    private bool m_Active;
-
-    private void Awake()
-    {
-        if (m_CacheParticleSystem == null)
-        {
-            m_CacheParticleSystem = gameObject.GetComponentsInChildren<ParticleSystem>(true);
-            if (m_CacheParticleSystem != null)
-            {
-                m_ParticleProperties = new ParticleProperties[m_CacheParticleSystem.Length];
-                for (int i = 0; i < m_CacheParticleSystem.Length; ++i)
-                {
-                    m_ParticleProperties[i] = new ParticleProperties()
-                    {
-                        simulationSpeed = m_CacheParticleSystem[i].main.simulationSpeed
-                    };
-                }
-            }
-        }
-
-        if (m_CacheTrailRenderer == null)
-        {
-            m_CacheTrailRenderer = gameObject.GetComponentsInChildren<TrailRenderer>(true);
-        }
-
-        if (m_CacheAnimator == null)
-        {
-            m_CacheAnimator = gameObject.GetComponentsInChildren<Animator>(true);
-        }
-
-        if (m_Renderers == null)
-        {
-            m_Renderers = gameObject.GetComponentsInChildren<Renderer>(true);
-        }
-    }
-
-    void Update()
-    {
-        if (m_AnimatorSpeed == 0)
-        {
-            return;
-        }
-
-        startTime += Time.deltaTime;
-
-        if (duration > 0
-         && startTime >= duration)
-        {
-            m_AnimatorSpeed = 1;
-            SFXPlayUtility.Instance.Release(this);
-
-            if (m_OnFinished != null)
-            {
-                m_OnFinished(this);
-                m_OnFinished = null;
-            }
-        }
-    }
-
-    public void SetActive(bool active)
-    {
-        m_Active = active;
-
-        if (m_CacheParticleSystem != null && m_CacheParticleSystem.Length > 0)
-        {
-            for (int i = 0; i < m_CacheParticleSystem.Length; ++i)
-            {
-                if (active)
-                {
-                    m_CacheParticleSystem[i].Play();
-                }
-                else
-                {
-                    m_CacheParticleSystem[i].Stop();
-                }
-            }
-        }
-
-        if (m_CacheAnimator != null && m_CacheAnimator.Length > 0)
-        {
-            for (int i = 0; i < m_CacheAnimator.Length; ++i)
-            {
-                if (active)
-                {
-                    m_CacheAnimator[i].enabled = true;
-                    if (m_CacheAnimator[i].runtimeAnimatorController)
-                    {
-                        m_CacheAnimator[i].Play(m_CacheAnimator[i].GetCurrentAnimatorStateInfo(0).shortNameHash, 0, 0);
-                        m_CacheAnimator[i].Update(0);
-                    }
-                }
-                else
-                {
-                    m_CacheAnimator[i].enabled = false;
-                }
-            }
-
-            //if (!active && releaseHideChildren)
-            //{
-            //    if (m_Renderers != null && m_Renderers.Length > 0)
-            //    {
-            //        for (int i = 0; i < m_Renderers.Length; ++i)
-            //        {
-            //            if (m_Renderers[i].gameObject.activeSelf)
-            //            {
-            //                m_Renderers[i].SetActive(active);
-            //            }
-            //        }
-            //    }
-
-            //    if (m_CacheParticleSystem != null && m_CacheParticleSystem.Length > 0)
-            //    {
-            //        for (int i = 0; i < m_CacheParticleSystem.Length; ++i)
-            //        {
-            //            if (m_CacheParticleSystem[i].gameObject.activeSelf)
-            //            {
-            //                m_CacheParticleSystem[i].SetActive(active);
-            //            }
-            //        }
-            //    }
-            //}
-        }
-    }
-
-    public void SetAnimatorSpeed(float speed)
-    {
-        m_AnimatorSpeed = speed;
-        if (m_CacheAnimator != null)
-        {
-            for (int i = 0; i < m_CacheAnimator.Length; ++i)
-            {
-                var animator = m_CacheAnimator[i];
-                if (animator != null)
-                {
-                    m_CacheAnimator[i].speed = m_AnimatorSpeed;
-                }
-            }
-        }
-    }
-
-    public void SetPaticleSystemSpeed(float speed)
-    {
-        if (m_CacheParticleSystem != null)
-        {
-            ParticleSystem.MainModule _mainModule;
-            for (int i = 0; i < m_CacheParticleSystem.Length; ++i)
-            {
-                if (m_CacheParticleSystem[i])
-                {
-                    _mainModule = m_CacheParticleSystem[i].main;
-                    _mainModule.simulationSpeed = m_ParticleProperties[i].simulationSpeed * speed;
-                }
-            }
-        }
-    }
-
-    public void SetParticleEmissionRateOverTime(float value)
-    {
-        if (m_CacheParticleSystem != null)
-        {
-            ParticleSystem.EmissionModule _emissioinModule;
-            for (int i = 0; i < m_CacheParticleSystem.Length; ++i)
-            {
-                if (m_CacheParticleSystem[i])
-                {
-                    _emissioinModule = m_CacheParticleSystem[i].emission;
-                    _emissioinModule.rateOverTime = value;
-                }
-            }
-        }
-    }
-
-    private void SetChildActive(Transform transforms, bool active)
-    {
-        for (int i = 0; i < transforms.childCount; ++i)
-        {
-            transforms.GetChild(i).SetActive(active);
-
-            if (transforms.GetChild(i).childCount > 0)
-            {
-                SetChildActive(transforms.GetChild(i), active);
-            }
-        }
-    }
-}
diff --git a/Main/Core/SFX/SFXController.cs.meta b/Main/Core/SFX/SFXController.cs.meta
deleted file mode 100644
index 12b89e3..0000000
--- a/Main/Core/SFX/SFXController.cs.meta
+++ /dev/null
@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: d398e1aa1bff9054e84a7cd84cbc2a8b
-timeCreated: 1504525311
-licenseType: Pro
-MonoImporter:
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 
diff --git a/Main/Core/SFX/SFXPlayUtility.cs b/Main/Core/SFX/SFXPlayUtility.cs
deleted file mode 100644
index cc3a6d4..0000000
--- a/Main/Core/SFX/SFXPlayUtility.cs
+++ /dev/null
@@ -1,288 +0,0 @@
-锘縰sing UnityEngine;
-using System.Collections.Generic;
-
-using System;
-using System.Collections;
-
-
-public class SFXPlayUtility : SingletonMonobehaviour<SFXPlayUtility>
-{
-
-    private Dictionary<int, ObjectPool<SFXController>> m_PoolDict = new Dictionary<int, ObjectPool<SFXController>>();
-
-    public SFXController PlayEffectAsync(int id, Transform parent, float scale = 1)
-    {
-        var config = EffectConfig.Get(id);
-        var bundleName = StringUtility.Contact(ResourcesPath.EFFECT_Folder_Name, config.packageName);
-        if (!AssetSource.isUseAssetBundle || AssetBundleUtility.Instance.JudgeExistAsset(bundleName, config.fxName))
-        {
-            return PlayBattleEffect(id, parent, scale);
-        }
-        else
-        {
-            AssetBundleUtility.Instance.Co_LoadAsset(bundleName, config.fxName, OnEffectLoaded);
-            return null;
-        }
-    }
-
-    private void OnEffectLoaded(bool result, UnityEngine.Object obj)
-    {
-        if (result)
-        {
-            var _prefab = obj as GameObject;
-            if (_prefab)
-            {
-                //Debug.LogFormat("寮傛鍔犺浇...  {0} ....鎴愬姛.", obj.name);
-                GameObjectPoolManager.Instance.CacheGameObject(_prefab, 1, false);
-            }
-        }
-    }
-
-    public SFXController PlayBattleEffect(int id, Transform parent, float scale = 1f)
-    {
-        if (parent == null)
-        {
-            return null;
-        }
-        SFXController _controller = Play(id, parent, scale);
-        return _controller;
-    }
-
-    public SFXController PlayBattleEffect(int id, Vector3 position, Vector3 forward, float scale = 1f)
-    {
-        SFXController _controller = Play(id, position, forward, scale);
-
-        return _controller;
-    }
-
-    public SFXController PlayEffectAsync(int id, Vector3 position, Vector3 forward, float scale = 1)
-    {
-        var config = EffectConfig.Get(id);
-        var bundleName = StringUtility.Contact(ResourcesPath.EFFECT_Folder_Name, config.packageName);
-        if (!AssetSource.isUseAssetBundle || AssetBundleUtility.Instance.JudgeExistAsset(bundleName, config.fxName))
-        {
-            return PlayBattleEffect(id, position, forward, scale);
-        }
-        else
-        {
-            // Debug.LogFormat("[{0}] 寮�濮嬪紓姝ュ姞杞�: {1}", System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), config.fxName);
-            AssetBundleUtility.Instance.Co_LoadAsset(bundleName, config.fxName, OnEffectLoaded);
-            return null;
-        }
-    }
-
-    public SFXController Play(int id, Transform parent, float scale = 1f)
-    {
-        if (parent == null)
-            return null;
-
-        SFXController _controller = Request(id);
-
-        if (_controller == null)
-        {
-            return null;
-        }
-
-        EffectConfig _effectModel = EffectConfig.Get(id);
-
-        if (_effectModel.setParent > 0)
-        {
-            _controller.transform.SetParent(parent);
-            _controller.transform.localPosition = Vector3.zero;
-            _controller.transform.localRotation = Quaternion.identity;
-            _controller.transform.localScale = Vector3.one * scale;
-        }
-        else
-        {
-            _controller.transform.position = parent.position;
-            _controller.transform.forward = parent.forward;
-            _controller.transform.localScale = Vector3.one * scale;
-        }
-
-        _controller.startTime = 0;
-        _controller.effectId = id;
-
-        _controller.gameObject.SetActive(true);
-
-        var config = EffectConfig.Get(id);
-        if (config != null)
-        {
-            SoundPlayer.Instance.PlayUIAudio(config.audio);
-        }
-
-        return _controller;
-    }
-
-    public SFXController Play(int id, Vector3 position, Vector3 forward, float scale = 1f)
-    {
-        SFXController _controller = Request(id);
-
-        if (_controller == null)
-        {
-            return null;
-        }
-
-        _controller.startTime = 0;
-        _controller.effectId = id;
-        _controller.transform.position = position;
-        if (forward != Vector3.zero)
-        {
-            _controller.transform.forward = forward;
-        }
-        _controller.transform.localScale = Vector3.one * scale;
-        _controller.gameObject.SetActive(true);
-
-        var config = EffectConfig.Get(id);
-        if (config != null)
-        {
-            SoundPlayer.Instance.PlayUIAudio(config.audio);
-        }
-
-        return _controller;
-    }
-
-    public SFXController PlayWithEulerAngle(int id, Vector3 position, Vector3 eulerAngle, float scale = 1f)
-    {
-        SFXController _controller = Request(id);
-
-        if (_controller == null)
-        {
-            return null;
-        }
-        if (1044 == id)
-        {
-            Debug.Log("PlayWithEulerAngle: " + 1044);
-        }
-        _controller.startTime = 0;
-        _controller.effectId = id;
-        _controller.transform.position = position;
-        _controller.transform.eulerAngles = eulerAngle;
-        _controller.transform.localScale = Vector3.one * scale;
-        _controller.gameObject.SetActive(true);
-
-        var config = EffectConfig.Get(id);
-        if (config != null)
-        {
-            SoundPlayer.Instance.PlayUIAudio(config.audio);
-        }
-
-        return _controller;
-    }
-
-    public SFXController Request(int id)
-    {
-        ObjectPool<SFXController> _pool = null;
-
-        if (m_PoolDict.TryGetValue(id, out _pool) == false)
-        {
-            _pool = new ObjectPool<SFXController>(OnGetSFX, OnReleaseSFX);
-            m_PoolDict.Add(id, _pool);
-        }
-
-        SFXController _controller = null;
-
-        if (_pool.inactivedCount == 0)
-        {
-            _controller = Create(id);
-        }
-        else
-        {
-            _controller = _pool.Get();
-        }
-
-        if (_controller != null)
-        {
-            _controller.transform.SetParent(null);
-        }
-
-        return _controller;
-    }
-
-    public void Release(SFXController sfx)
-    {
-        if (sfx == null)
-        {
-            return;
-        }
-
-        ObjectPool<SFXController> _pool = null;
-
-        if (m_PoolDict.TryGetValue(sfx.effectId, out _pool) == false)
-        {
-            _pool = new ObjectPool<SFXController>(OnGetSFX, OnReleaseSFX);
-            m_PoolDict.Add(sfx.effectId, _pool);
-        }
-
-        sfx.SetAnimatorSpeed(1);
-        sfx.SetPaticleSystemSpeed(1);
-        _pool.Release(sfx);
-    }
-
-    public void ReleaseAndDestroy(SFXController sfx)
-    {
-        if (sfx == null)
-        {
-            return;
-        }
-
-        ObjectPool<SFXController> _pool = null;
-
-        if (m_PoolDict.TryGetValue(sfx.effectId, out _pool))
-        {
-            _pool.Clear();
-        }
-
-
-    }
-
-    private SFXController Create(int id)
-    {
-        EffectConfig effectCfg = EffectConfig.Get(id);
-
-        if (null == effectCfg)
-        {
-            return null;
-        }
-
-        var _prefab = ResManager.Instance.LoadAsset<GameObject>("UIEffect/" + effectCfg.packageName, effectCfg.fxName);
-        if (_prefab == null)
-        {
-            return null;
-        }
-
-        GameObject _sfx = GameObjectPoolManager.Instance.RequestGameObject(_prefab);
-
-        SFXController _controller = _sfx.AddMissingComponent<SFXController>();
-        _controller.config = EffectConfig.Get(id);
-
-        return _controller;
-    }
-
-    private void OnGetSFX(SFXController controller)
-    {
-        controller.enabled = true;
-        controller.SetActive(true);
-        controller.DelayFrameCount = 0;
-        controller.startTime = 0;
-    }
-
-    private void OnReleaseSFX(SFXController controller)
-    {
-        controller.SetActive(false);
-        controller.DelayFrameCount = 0;
-        controller.transform.SetParent(transform);
-        controller.transform.position = Constants.Special_Hide_Position;
-        controller.enabled = false;
-    }
-
-    public void Unitialize()
-    {
-        //foreach (var _pool in m_PoolDict.Values)
-        //{
-        //    _pool.Clear();
-        //}
-
-        //m_PoolDict.Clear();
-    }
-
-}
diff --git a/Main/Core/SFX/SFXPlayUtility.cs.meta b/Main/Core/SFX/SFXPlayUtility.cs.meta
deleted file mode 100644
index b277a03..0000000
--- a/Main/Core/SFX/SFXPlayUtility.cs.meta
+++ /dev/null
@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: e99ddc16d544764428241e3521d29f82
-timeCreated: 1504525312
-licenseType: Pro
-MonoImporter:
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 
diff --git a/Main/System/Battle/BattleEffectMgr.cs b/Main/System/Battle/BattleEffectMgr.cs
index 494d4d9..d6ce2a6 100644
--- a/Main/System/Battle/BattleEffectMgr.cs
+++ b/Main/System/Battle/BattleEffectMgr.cs
@@ -48,12 +48,11 @@
             effectDict[effectId] = new List<EffectPlayer>();
         }
 
-        EffectPlayer effectPlayer = EffectPlayer.Create(effectId, parent, true, false);
+        EffectPlayer effectPlayer = EffectPlayer.Create(effectId, parent);
         effectPlayer.onDestroy = OnEffectDestroy;
         if (effectPlayer != null)
         {
             effectDict[effectId].Add(effectPlayer);
-            effectPlayer.Play();
         }
         return effectPlayer;
     }
diff --git a/Main/System/Battle/BattleField/BattleField.cs b/Main/System/Battle/BattleField/BattleField.cs
index 44bdcd1..00b4f8a 100644
--- a/Main/System/Battle/BattleField/BattleField.cs
+++ b/Main/System/Battle/BattleField/BattleField.cs
@@ -290,4 +290,17 @@
         // return round > xxx;
         return false;
     }
+
+    public void UpdateCanvas(Canvas canvas)
+    {
+        EffectPenetrationBlocker[] blockers = battleRootNode.GetComponentsInChildren<EffectPenetrationBlocker>(true);
+
+        if (null != blockers)
+        {
+            foreach (var blocker in blockers)
+            {
+                blocker.SetParentCanvas(canvas);
+            }
+        }
+    }
 }
\ No newline at end of file
diff --git a/Main/System/Battle/BattleWin.cs b/Main/System/Battle/BattleWin.cs
index 796710b..76c25d1 100644
--- a/Main/System/Battle/BattleWin.cs
+++ b/Main/System/Battle/BattleWin.cs
@@ -35,10 +35,7 @@
     protected override void OnPreOpen()
     {
         base.OnPreOpen();
-
-        SetBattleField(BattleManager.Instance.storyBattleField);
-
-        
+        // SetBattleField(BattleManager.Instance.storyBattleField);
     }
 
     protected override void OnPreClose()
@@ -96,5 +93,6 @@
         }
 
         ui.SetBattleField(battleField);
+        battleField.UpdateCanvas(canvas);
     }
 }
diff --git a/Main/System/Battle/SkillEffect/BulletSkillEffect.cs b/Main/System/Battle/SkillEffect/BulletSkillEffect.cs
index dd9b9c2..3f42303 100644
--- a/Main/System/Battle/SkillEffect/BulletSkillEffect.cs
+++ b/Main/System/Battle/SkillEffect/BulletSkillEffect.cs
@@ -76,7 +76,6 @@
     {
         EffectPlayer effectPlayer = caster.battleField.battleEffectMgr.PlayEffect(caster.ObjID, skillConfig.EffectId, caster.effectNode);
 
-        effectPlayer.Play();
 
         RectTransform effectTrans = effectPlayer.transform as RectTransform;
 
@@ -88,7 +87,7 @@
             //  鍑讳腑灏遍攢姣佸瓙寮�
             caster.battleField.battleEffectMgr.RemoveEffect(skillConfig.EffectId, effectPlayer);
             //  鎾斁瀛愬脊鐖嗙偢鐗规晥
-            caster.battleField.battleEffectMgr.PlayEffect(caster.ObjID, skillConfig.ExplotionEffectId, target).Play();
+            caster.battleField.battleEffectMgr.PlayEffect(caster.ObjID, skillConfig.ExplotionEffectId, target);
         });
 
         caster.battleField.battleTweenMgr.OnPlayTween(tween);
diff --git a/Main/System/Battle/SkillEffect/NormalSkillEffect.cs b/Main/System/Battle/SkillEffect/NormalSkillEffect.cs
index 91b98e9..d0e9a54 100644
--- a/Main/System/Battle/SkillEffect/NormalSkillEffect.cs
+++ b/Main/System/Battle/SkillEffect/NormalSkillEffect.cs
@@ -21,14 +21,15 @@
     public override void Play(Action<int, List<H0604_tagUseSkillAttack.tagSkillHurtObj>> _onHit)
     {
 
-        Action<int, List<H0604_tagUseSkillAttack.tagSkillHurtObj>> onHitFormation = (_hitIndex, _hurtList) =>
+        // 鐗规晥鐐稿紑鍦ㄩ樀瀹圭殑涓棿鐨勫洖璋�
+        Action<int, List<H0604_tagUseSkillAttack.tagSkillHurtObj>> onHitLineUpCenter = (_hitIndex, _hurtList) =>
         {
             _onHit?.Invoke(_hitIndex, tagUseSkillAttack.HurtList.ToList());
         };
 
         if (skillConfig.effectAnchor == SkillEffectAnchor.Caster)
         {
-            CastInTarget(caster.heroGo.transform as RectTransform, onHitFormation);
+            CastInTarget(caster.heroGo.transform as RectTransform, onHitLineUpCenter);
         }
         else if (skillConfig.effectAnchor == SkillEffectAnchor.Target)
         {
@@ -53,11 +54,11 @@
         }
         else if (skillConfig.effectAnchor == SkillEffectAnchor.AlliesCenter)
         {
-            CastInTarget(caster.battleField.GetTeamNode(caster.Camp), onHitFormation);
+            CastInTarget(caster.battleField.GetTeamNode(caster.Camp), onHitLineUpCenter);
         }
         else if (skillConfig.effectAnchor == SkillEffectAnchor.EnemiesCenter)
         {
-            CastInTarget(caster.battleField.GetTeamNode(caster.Camp == BattleCamp.Blue ? BattleCamp.Red : BattleCamp.Blue), onHitFormation);
+            CastInTarget(caster.battleField.GetTeamNode(caster.Camp == BattleCamp.Blue ? BattleCamp.Red : BattleCamp.Blue), onHitLineUpCenter);
         }
         else
         {
@@ -69,8 +70,6 @@
     {
         EffectPlayer effectPlayer = caster.battleField.battleEffectMgr.PlayEffect(caster.ObjID, skillConfig.EffectId, caster.effectNode);
 
-        effectPlayer.Play();
-
         RectTransform effectTrans = effectPlayer.transform as RectTransform;
 
         _onHit?.Invoke(0, null);
@@ -78,7 +77,7 @@
         //  閿�姣佽嚜韬笂鐨勭壒鏁堝簲璇ユ槸绛夌壒鏁堟挱鏀惧畬姣曚箣鍚�
         // caster.battleField.battleEffectMgr.RemoveEffect(skillConfig.EffectId, effectPlayer);
         //  鎾斁鍙楀嚮鐗规晥
-        caster.battleField.battleEffectMgr.PlayEffect(caster.ObjID, skillConfig.ExplotionEffectId, target).Play();
+        caster.battleField.battleEffectMgr.PlayEffect(caster.ObjID, skillConfig.ExplotionEffectId, target);
 
     }
 
diff --git a/Main/System/UIBase/UIBase.cs b/Main/System/UIBase/UIBase.cs
index efdcddc..2c5b83d 100644
--- a/Main/System/UIBase/UIBase.cs
+++ b/Main/System/UIBase/UIBase.cs
@@ -358,19 +358,12 @@
     /// <param name="autoDestroy">鏄惁鑷姩閿�姣侊紝榛樿涓簍rue</param>
     /// <param name="destroyDelay">鑷姩閿�姣佸欢杩熸椂闂达紝榛樿涓�5绉�</param>
     /// <returns>鐗规晥娓告垙瀵硅薄</returns>
-    public EffectPlayer PlayUIEffect(int id, Transform parent = null, bool autoDestroy = true, float destroyDelay = 5f)
+    public EffectPlayer PlayUIEffect(int id, Transform parent = null)
     {
         // 浣跨敤榛樿鍊�
         if (parent == null) parent = transform;
-        
-        EffectPlayer player = parent.gameObject.AddComponent<EffectPlayer>();
 
-        player.effectId = id;
-        player.autoDestroy = autoDestroy;
-        player.destroyDelay = destroyDelay;
-        player.canvas = canvas;
-
-        return player;
+        return EffectPlayer.Create(id, parent, false);
     }
     
     #endregion
diff --git a/Main/Utility/EffectPenetrationBlocker.cs b/Main/Utility/EffectPenetrationBlocker.cs
index 5636595..0c40fd2 100644
--- a/Main/Utility/EffectPenetrationBlocker.cs
+++ b/Main/Utility/EffectPenetrationBlocker.cs
@@ -133,7 +133,30 @@
         parentCanvas = canvas;
         if (autoAdjustSorting)
         {
-            UpdateSortingOrder();
+            this.DelayFrame(UpdateSortingOrder);
+        }
+    }
+
+    /// <summary>
+    /// 搴旂敤閬僵鍖哄煙锛圧ectTransform锛夛紝鍙敤浜庤鍓壒鏁�
+    /// </summary>
+    public void PerformMask(RectTransform maskRect)
+    {
+        // 杩欓噷鍙槸绀轰緥锛屽疄闄呭彲鏍规嵁浣犵殑Shader鎴栫壒鏁堟潗璐ㄥ仛瑁佸壀
+        foreach (Renderer renderer in effectRenderers)
+        {
+            if (renderer != null && renderer.material != null && maskRect != null)
+            {
+                Vector3[] corners = new Vector3[4];
+                maskRect.GetWorldCorners(corners);
+                Vector4 clipRect = new Vector4(corners[0].x, corners[0].y, corners[2].x, corners[2].y);
+                renderer.material.SetVector("_ClipRect", clipRect);
+                renderer.material.SetFloat("_UseClipRect", 1);
+            }
+            else if (renderer != null && renderer.material != null)
+            {
+                renderer.material.SetFloat("_UseClipRect", 0);
+            }
         }
     }
 

--
Gitblit v1.8.0