1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- 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.CreateObj(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)
- {
- PrefabManager.Instance.Restore(_gameObject);
- //GameObject.DestroyImmediate(_gameObject);
- _gameObject = null;
- }
- if (_wrapper != null)
- {
- if(_wrapper.wrapTarget != null)
- {
- _wrapper.wrapTarget = null;
- }
- _wrapper.Dispose();
- }
- }
- public GameObject GetObj()
- {
- return _gameObject;
- }
- }
- }
|