示例#1
0
            public void LoadPanelResAsync()
            {
                if (m_PanelState != ePanelState.UnInit)
                {
                    return;
                }

                m_PanelState = ePanelState.Loading;

                UIData data = UIDataTable.Get(m_UIID);

                if (data == null)
                {
                    return;
                }

                PrepareDynamicResource(data);

                m_ResLoader.Add2Load(data.fullPath, (state, res) =>
                {
                    if (!state)
                    {
                        return;
                    }

                    OnPanelResLoadSuccess((GameObject)res.asset);
                });

                m_ResLoader.LoadSync();
            }
示例#2
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>());
        }
示例#3
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);
        }
示例#4
0
        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();
        }
示例#5
0
        private bool AddSceneAB2Loader(string sceneName, ResLoader loader)
        {
            string abName = GetSceneAssetBundleName(sceneName);

            if (string.IsNullOrEmpty(abName))
            {
                return(false);
            }

            loader.Add2Load(abName);

            return(true);
        }
示例#6
0
        /// <summary>
        /// 添加常驻音频资源,建议尽早添加,不要在用的时候再添加
        /// </summary>
        void AddRetainAudio(string audioName)
        {
            if (mRetainResLoader == null)
            {
                mRetainResLoader = ResLoader.Allocate();
            }
            if (mRetainAudioNames == null)
            {
                mRetainAudioNames = new List <string>();
            }

            if (!mRetainAudioNames.Contains(audioName))
            {
                mRetainAudioNames.Add(audioName);
                mRetainResLoader.Add2Load(audioName);
                mRetainResLoader.LoadAsync();
            }
        }
示例#7
0
        public void SetAudio(GameObject root, string name, bool loop)
        {
            if (string.IsNullOrEmpty(name))
            {
                return;
            }

            if (mName == name)
            {
                return;
            }

            if (mAudioSource == null)
            {
                mAudioSource = root.AddComponent <AudioSource>();
            }

            //防止卸载后立马加载的情况
            var preLoader = mLoader;

            mLoader = null;

            CleanResources();

            mLoader = ResLoader.Allocate();

            mIsLoop = loop;
            mName   = name;

            mLoader.Add2Load(name, OnResLoadFinish);

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

            if (mLoader != null)
            {
                mLoader.LoadAsync();
            }
        }
示例#8
0
        protected void AddAssistUI2Holder(EngineUI uiid)
        {
            var data = UIDataTable.Get(uiid);

            m_Loader.Add2Load(data.fullPath);
        }