Example #1
0
        private UIRoot LoadUIRoot()
        {
            ResLoader loader = ResLoader.Allocate(null);

            loader.Add2Load(ProjectPathConfigTemp.UI_ROOT_PATH);
            loader.LoadSync();

            IRes res = ResMgr.Instance.GetRes(ProjectPathConfigTemp.UI_ROOT_PATH, false);

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

            GameObject prefab = res.asset as GameObject;

            if (prefab == null)
            {
                return(null);
            }

            GameObject uiRoot = GameObject.Instantiate(prefab);

            loader.ReleaseAllRes();
            loader.Recycle2Cache();
            return(uiRoot.GetComponent <UIRoot>());
        }
Example #2
0
        private static AppConfig LoadInstance()
        {
            if (m_ResLoader != null)
            {
                m_ResLoader.ReleaseAllRes();
            }

            if (m_ResLoader == null)
            {
                m_ResLoader = ResLoader.Allocate(null);
            }

            m_ResLoader.Add2Load(ProjectPathConfigTemp.APP_CONFIG_PATH);

            m_ResLoader.LoadSync();

            IRes res = ResMgr.Instance.GetRes(ProjectPathConfigTemp.APP_CONFIG_PATH, false);

            if (res != null)
            {
                s_Instance = res.asset as AppConfig;
            }

            return(s_Instance);
        }
        public void LoadTexture(string path)
        {
            if (m_RawImage == null)
            {
                return;
            }

            m_RawImage.texture = null;
            if (m_AutoHide)
            {
                m_RawImage.enabled = false;
            }
            if (m_ResLoader != null)
            {
                m_ResLoader.ReleaseAllRes();
            }

            m_TexturePath = path;

            if (string.IsNullOrEmpty(m_TexturePath))
            {
                return;
            }

            if (m_ResLoader == null)
            {
                m_ResLoader = new ResLoader();
            }

            m_ResLoader.Add2Load(m_TexturePath, OnResLoadFinish);
            m_ResLoader.LoadAsync();
        }
Example #4
0
 /// <summary>
 /// 关闭
 /// </summary>
 void IUI.Close(bool destroy = true)
 {
     OnClose();
     if (destroy)
     {
         GameObject.Destroy(gameObject);
     }
     mResLoader.ReleaseAllRes();
     mResLoader.Recycle2Cache();
     mResLoader = null;
 }
Example #5
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);
        }
Example #6
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.ReleaseAllRes();

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

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