Esempio n. 1
0
        protected void LoadMesh()
        {
            m_MeshHolder = null;

            ResLoader loader = ResLoader.Allocate(null);

            loader.Add2Load(m_MeshHolderName, OnMeshLoadResult);

            if (m_PreLoader != null)
            {
                m_PreLoader.Recycle2Cache();
                m_PreLoader = null;
            }

            m_PreLoader = m_Loader;

            m_Loader = loader;

            if (m_AsyncLoad)
            {
                m_Loader.LoadAsync();
            }
            else
            {
                m_Loader.LoadSync();
            }
        }
Esempio n. 2
0
        private UIRoot LoadUIRoot()
        {
            ResLoader loader = ResLoader.Allocate("UIMgr", null);

            loader.Add2Load(ProjectPathConfig.uiRootPath);
            loader.LoadSync();

            IRes res = ResMgr.S.GetRes(ProjectPathConfig.uiRootPath, false);

            if (res == null || res.asset == null)
            {
                loader.Recycle2Cache();
                return(null);
            }

            GameObject prefab = res.asset as GameObject;

            if (prefab == null)
            {
                loader.Recycle2Cache();
                return(null);
            }

            GameObject uiRoot = GameObject.Instantiate(prefab);

            loader.Recycle2Cache();
            return(uiRoot.GetComponent <UIRoot>());
        }
Esempio n. 3
0
        private void OnNextPanelOpen(AbstractPanel panel)
        {
            if (m_NextPanelResLoader != null)
            {
                m_NextPanelResLoader.Recycle2Cache();
                m_NextPanelResLoader = null;
            }

            /*
             * if (panel == null)
             * {
             *  CloseSelfPanel();
             *  return;
             * }
             */
            m_NextPanel = panel;

            if (m_Action.transitionSameTime)
            {
                m_Action.TransitionIn(m_OpenParam.prePanel);
                m_Action.TransitionOut(panel);
            }
            else
            {
                m_Action.TransitionOut(panel);
            }
        }
Esempio n. 4
0
        private static AppConfig LoadInstance()
        {
            ResLoader loader = ResLoader.Allocate("AppConfig", null);

            UnityEngine.Object obj = loader.LoadSync(ProjectPathConfig.appConfigPath);
            if (obj == null)
            {
                Log.w("Not Find App Config, Will Use Default App Config.");
                loader.ReleaseAllRes();
                obj = loader.LoadSync(ProjectPathConfig.DEFAULT_APP_CONFIG_PATH);
                if (obj == null)
                {
                    Log.e("Not Find Default App Config File!");
                    loader.Recycle2Cache();
                    loader = null;
                    return(null);
                }
            }

            //Log.i("Success Load App Config.");
            s_Instance = obj as AppConfig;

            AppConfig newAB = GameObject.Instantiate(s_Instance);

            s_Instance = newAB;

            loader.Recycle2Cache();

            return(s_Instance);
        }
Esempio n. 5
0
 public void ReleaseAllGlobalRes()
 {
     if (m_GlobalResLoader != null)
     {
         m_GlobalResLoader.Recycle2Cache();
         m_GlobalResLoader = null;
     }
 }
Esempio n. 6
0
 private void ClearLoader()
 {
     if (m_Loader != null)
     {
         m_Loader.Recycle2Cache();
         m_Loader = null;
     }
 }
Esempio n. 7
0
 protected void OnDestroy()
 {
     if (m_Loader != null)
     {
         m_Loader.Recycle2Cache();
         m_Loader = null;
     }
 }
Esempio n. 8
0
 public void OnTransitionDestroy()
 {
     if (m_ResLoader != null)
     {
         m_ResLoader.Recycle2Cache();
         m_ResLoader = null;
     }
 }
Esempio n. 9
0
 private void OnDestroy()
 {
     if (!MonoSingleton.isApplicationQuit)
     {
         if (m_ResLoader != null)
         {
             m_ResLoader.Recycle2Cache();
             m_ResLoader = null;
         }
     }
 }
Esempio n. 10
0
        public bool LoadBuildInSceneSync(string sceneName, LoadSceneMode mode = LoadSceneMode.Single)
        {
            if (m_CurrentLoader != null)
            {
                m_CurrentLoader.ReleaseAllRes();
                m_CurrentLoader.Recycle2Cache();
                m_CurrentLoader = null;
            }

            try
            {
                SceneManager.LoadScene(sceneName, mode);
            }
            catch (Exception e)
            {
                Log.e("SceneManager LoadBuildInSceneSysn Failed! SceneName:" + sceneName);
                Log.e(e);
                return(false);
            }

            return(true);
        }
Esempio n. 11
0
        private void CleanPreRes()
        {
            if (m_ResLoader != null)
            {
                m_ResLoader.Recycle2Cache();
                m_ResLoader = null;
            }

            if (m_TimerID > 0)
            {
                Timer.S.Cancel(m_TimerID);
                m_TimerID = 0;
                return;
            }
        }
Esempio n. 12
0
            public void SetAudio(GameObject root, string name, bool loop, bool isEnable)
            {
                if (string.IsNullOrEmpty(name))
                {
                    return;
                }

                if (m_Name == name)
                {
                    return;
                }

                if (m_Source == null)
                {
                    m_Source = root.AddComponent <AudioSource>();
                    if (!isEnable)
                    {
                        m_Source.enabled = isEnable;
                    }
                }

                //防止卸载后立马加载的情况
                ResLoader preLoader = m_Loader;

                m_Loader = null;
                CleanResources();

                RegisterActiveAudioUnit(this);

                m_Loader = ResLoader.Allocate("AudioUnit");

                m_IsLoop = loop;
                m_Name   = name;

                m_Loader.Add2Load(name, OnResLoadFinish);

                if (preLoader != null)
                {
                    preLoader.Recycle2Cache();
                    preLoader = null;
                }

                if (m_Loader != null)
                {
                    m_Loader.LoadAsync();
                }
            }
Esempio n. 13
0
            private void CleanResources()
            {
                if (m_OnStopListener != null)
                {
                    m_OnStopListener(m_ID);
                }

                UnRegisterActiveAudioUnit(this);
                m_Name             = null;
                m_PlayCount        = 0;
                m_IsPause          = false;
                m_OnFinishListener = null;
                m_OnStopListener   = null;
                m_LeftDelayTime    = -1;
                m_CustomEventID    = -1;

                if (m_TimeItemID > 0)
                {
                    Timer.S.Cancel(m_TimeItemID);
                    m_TimeItemID = -1;
                }

                if (m_Source != null)
                {
                    if (m_Source.clip == m_AudioClip)
                    {
                        if (m_Source.enabled)
                        {
                            m_Source.Stop();
                        }
                        m_Source.clip = null;
                    }
                    m_Source.volume = 1.0f;
                    m_Source.pitch  = 1.0f;
                }

                m_AudioClip = null;

                if (m_Loader != null)
                {
                    m_Loader.Recycle2Cache();
                    m_Loader = null;
                }
            }
Esempio n. 14
0
            public void OnCacheReset()
            {
                m_Panel             = null;
                m_NextMaster        = -1;
                m_PanelID           = -1;
                m_UIID              = -1;
                m_SortIndex         = -1;
                m_PanelState        = ePanelState.UnInit;
                m_OpenListeners     = null;
                m_CustomVisibleFlag = true;

                m_ResLoader.Recycle2Cache();
                m_ResLoader = null;

                if (m_PageWrapList != null)
                {
                    m_PageWrapList.Clear();
                }

                if (m_OpenInfoList != null)
                {
                    m_OpenInfoList.Clear();
                }
            }