using FairyGUI; using UnityEngine; namespace GFGGame { public class EffectUI { private GameObject _gameObject; private GoWrapper _wrapper; public bool isDisposed; public void Reset(GGraph holder, string uiName, string resName, float scale = 100, EffectUIType effectUIType = EffectUIType.UI ) { if (!isDisposed) Dispose(); isDisposed = false; string resPath; switch(effectUIType) { case EffectUIType.Card: resPath = ResPathUtil.GetCardAnimationPath(resName); break; default: resPath = ResPathUtil.GetViewEffectPath(uiName, resName); break; } _gameObject = DressUpUtil.CreateAnimationObj(resPath); if(_gameObject == null) { return; } _gameObject.transform.localScale = new Vector3(scale, scale, scale); _wrapper = new GoWrapper(_gameObject); holder.SetNativeObject(_wrapper); } public void Dispose() { isDisposed = true; if (_gameObject != null) { GameObject.DestroyImmediate(_gameObject); _gameObject = null; } if (_wrapper != null) { _wrapper.Dispose(); } } public GameObject GetObj() { return _gameObject; } } }