12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- 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);
- _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();
- }
- }
- }
- }
|