private async void LoadWindowAsync(Action loadedHandle = null) { IResourcesManager tmpResMgr = GameModuleManager.GetModule <IResourcesManager>(); await tmpResMgr.LoadBundleByTypeAsync(EABType.UI, BundleName); if (null != loadedHandle) { loadedHandle(); loadedHandle = null; } if (mIsDestroyed || mIsInited) { tmpResMgr.UnLoadBundleByType(EABType.UI, BundleName); return; } GameObject tmpGo = Hotfix.Instantiate(tmpResMgr.GetAssetByType <GameObject>(EABType.UI, BundleName)); InitWindow(tmpGo); if (mIsShowAfterLoaded) { Show(); } }
private void LoadWindowSync(Action loadedHandle = null) { IResourcesManager tmpResMgr = GameModuleManager.GetModule <IResourcesManager>(); tmpResMgr.LoadBundleByType(EABType.UI, BundleName); GameObject tmpGo = Hotfix.Instantiate(tmpResMgr.GetAssetByType <GameObject>(EABType.UI, BundleName)); InitWindow(tmpGo); loadedHandle?.Invoke(); }
static IObjectPool <T> GetObjectPool <T>() where T : Component { IObjectPoolManager tmpPoolMgr = GameModuleManager.GetModule <IObjectPoolManager>(); IObjectPool <T> tmpObjPool = null; if (null != tmpPoolMgr) { tmpObjPool = tmpPoolMgr.GetObjectPool <T>(); } return(tmpObjPool); }
private void OnDisConnectHandle(int customSrvID) { var tmpArg = ReferencePool.Fetch <ServiceDisConnectEventArgs>(); tmpArg.CustomServerID = customSrvID; IEventManager tmpEventMgr = GameModuleManager.GetModule <IEventManager>(); if (null != tmpEventMgr) { tmpEventMgr.FireNow(this, tmpArg); } }
public void Destroy() { BeforeDestory(); mIsInited = false; mIsDestroyed = true; if (mGameObejct) { GameObject.Destroy(mGameObejct); mGameObejct = null; IResourcesManager tmpResMgr = GameModuleManager.GetModule <IResourcesManager>(); tmpResMgr.UnLoadBundleByType(EABType.UI, BundleName); } }
public virtual void Dispose() { IsDispose = true; if (this.IsFromPool) { IObjectPoolManager tmpPoolMgr = GameModuleManager.GetModule <IObjectPoolManager>(); if (null != tmpPoolMgr) { var tmpObjPool = tmpPoolMgr.GetObjectPoolByType(this.GetType()); tmpObjPool.Unspawn(this); } } }
public static T Create <T, A, B, C>(Entity entity, A a, B b, C c) where T : Component { T tmpDisposer = GetObjectPool <T>().Spawn(); tmpDisposer.IsFromPool = true; tmpDisposer.Parent = entity; var tmpObjMgr = GameModuleManager.GetModule <IObjectManager>(); if (null != tmpObjMgr) { tmpObjMgr.Awake(tmpDisposer, a, b, c); } return(tmpDisposer); }