예제 #1
0
 /// <summary>
 /// 跳转场景
 /// </summary>
 /// <param name="sceneName">场景名</param>
 /// <param name="isAsync">是否异步加载</param>
 /// <param name="isUnloadOtherAssetBundle">加载后是否卸载其他的AssetBundle</param>
 /// <param name="tableName">全局Table名</param>
 public void JumpScene(string sceneName, bool isAsync, bool isUnloadOtherAssetBundle, string tableName)
 {
     if (_sceneTable == null && !string.IsNullOrEmpty(tableName))
     {
         _sceneTable = LuaEnvMgr.Instance.LuaEnv.Global.Get <SceneTable>(tableName);
     }
     JumpScene(sceneName, isAsync, isUnloadOtherAssetBundle, _sceneTable);
 }
예제 #2
0
 /// <summary>
 /// 加载模块资源
 /// </summary>
 private void LoadAssetBundle(bool isAsync, SceneTable table, Action complete)
 {
     ResMgr.Instance.InitAssetBundle(Name, (float progress) => {
         if (table != null && table.Progress != null)
         {
             float progressEnd = isAsync == true ? 1 : 0.9f;
             table.Progress(Name, progress * progressEnd);
         }
     }, complete);
 }
예제 #3
0
        public void Jump(string moduleName, string sceneName, bool isAsync, SceneTable table, Action complete)
        {
            if (_isLoading)
            {
                Debug.LogError("正在跳转中。。请不要连续跳转");
                return;
            }
            _isLoading  = true;
            _moduleName = moduleName;
            _sceneName  = sceneName;
            _isAsync    = isAsync;
            _sceneTable = table;
            _complete   = complete;

            if (Application.CanStreamedLevelBeLoaded(_sceneName))
            {
                SceneManager.sceneLoaded += OnSceneLoaded;
                if (_isAsync)
                {
                    StartCoroutine(IELoadSceneHandler());
                }
                else
                {
                    SceneManager.LoadScene(_sceneName);
                }
            }
            else
            {
                Debug.LogError("场景:" + sceneName + " 跳转场景失败, 检查是否已经把Modules下面所有场景添加到File->Build Settings中");
                if (_sceneTable != null && _sceneTable.Error != null)
                {
                    _sceneTable.Error(moduleName);
                }
                Clear();
            }
        }
예제 #4
0
 public void JumpScene(string sceneName, bool isAsync, bool isUnloadOtherAssetBundle, SceneTable table)
 {
     //初始化资源
     LoadAssetBundle(isAsync, table, () =>
     {
         LuaEnvMgr.Instance.FastTick();
         SceneMgr.Instance.Jump(Name, sceneName, isAsync, table, () =>
         {
             if (isUnloadOtherAssetBundle)
             {
                 ResMgr.Instance.ClearOtherModule(Name);
             }
         });
     });
 }