예제 #1
0
        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();
            }
        }
예제 #2
0
        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();
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
            }
        }
예제 #5
0
        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);
            }
        }
예제 #6
0
        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);
                }
            }
        }
예제 #7
0
        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);
        }