示例#1
0
        private IEnumerator LoadGameScene()
        {
            OnMessage("正在初始化");
            var init = Assets.Initialize();

            yield return(init);

            if (string.IsNullOrEmpty(init.error))
            {
                Assets.AddSearchPath("Assets/XAsset/Demo/Scenes");
                init.Release();
                OnProgress(0);
                OnMessage("加载游戏场景");
                var scene = Assets.LoadSceneAsync(gameScene, false);
                while (!scene.isDone)
                {
                    OnProgress(scene.progress);
                    yield return(null);
                }
            }
            else
            {
                init.Release();
                var mb = MessageBox.Show("提示", "初始化异常错误:" + init.error + "请联系技术支持");
                yield return(mb);

                Quit();
            }
        }
示例#2
0
        private IEnumerator LoadGameScene()
        {
            OnMessage("正在初始化");
            Assets.runtimeMode = !developmentMode;
            var init = Assets.Initialize();

            yield return(init);

            if (string.IsNullOrEmpty(init.error))
            {
                Assets.AddSearchPath("Assets/HotUpdateResources/Controller");
                Assets.AddSearchPath("Assets/HotUpdateResources/Dll");
                Assets.AddSearchPath("Assets/HotUpdateResources/Material");
                Assets.AddSearchPath("Assets/HotUpdateResources/Other");
                Assets.AddSearchPath("Assets/HotUpdateResources/Prefab");
                Assets.AddSearchPath("Assets/HotUpdateResources/Scene");
                Assets.AddSearchPath("Assets/HotUpdateResources/ScriptableObject");
                Assets.AddSearchPath("Assets/HotUpdateResources/TextAsset");
                Assets.AddSearchPath("Assets/HotUpdateResources/UI");
                init.Release();
                // foreach (var s in Assets._searchPaths)
                // {
                //     Debug.Log("Assets._searchPaths: "+s);
                // }


                OnProgress(0);
                OnMessage("加载游戏场景");

                //获取不到全部资源路径...
                // var ss = Assets.GetAllAssetPaths();
                // foreach (var s in ss)
                // {
                //     print("从资源包里找到路径: "+s);
                // }
                // Debug.Log("资源包有"+ss.Length+"资源");

                var scene = Assets.LoadSceneAsync(gameScene, false);
                scene.completed += (AssetRequest request) =>
                {
                    FindObjectOfType <Init>().enabled = true;
                };
                while (!scene.isDone)
                {
                    OnProgress(scene.progress);
                    yield return(null);
                }
            }
            else
            {
                init.Release();
                var mb = MessageBox.Show("提示", "初始化异常错误:" + init.error + "请联系技术支持");
                yield return(mb);

                Quit();
            }
        }
示例#3
0
        private IEnumerator LoadGameScene()
        {
            OnMessage("正在初始化");
            Assets.runtimeMode = !development;
            var init = Assets.Initialize();

            yield return(init);

            if (string.IsNullOrEmpty(init.error))
            {
                Assets.AddSearchPath("Assets/HotUpdateResources/Controller");
                Assets.AddSearchPath("Assets/HotUpdateResources/Dll");
                Assets.AddSearchPath("Assets/HotUpdateResources/Material");
                Assets.AddSearchPath("Assets/HotUpdateResources/Other");
                Assets.AddSearchPath("Assets/HotUpdateResources/Prefab");
                Assets.AddSearchPath("Assets/HotUpdateResources/Scene");
                Assets.AddSearchPath("Assets/HotUpdateResources/ScriptableObject");
                Assets.AddSearchPath("Assets/HotUpdateResources/TextAsset");
                Assets.AddSearchPath("Assets/HotUpdateResources/UI");
                init.Release();

                OnProgress(0);
                OnMessage("加载游戏场景");

                var scene = Assets.LoadSceneAsync(gameScene, false);
                scene.completed += (AssetRequest request) =>
                {
                    FindObjectOfType <Init>().Load();
                    ClassBindMgr.Instantiate();
                    FindObjectOfType <Init>().OnHotFixLoaded();
                };
                while (!scene.isDone)
                {
                    OnProgress(scene.progress);
                    yield return(null);
                }
            }
            else
            {
                init.Release();
                var mb = MessageBox.Show("提示", "初始化异常错误:" + init.error + "请联系技术支持");
                yield return(mb);

                Quit();
            }
        }