Beispiel #1
0
        private IEnumerator Initialize()
        {
            foreach (var abName in PreloadingList)
            {
                var sceneName = abName.Substring(0, abName.IndexOf("/"));
                yield return(AssetBundleManager.GetInstance().LoadAssetBundle(sceneName, abName));
            }

            LuaDefine.LuaEnv.AddLoader(CustomizeLoader);
            LuaDefine.LuaEnv.DoString("require 'LuaCore/Scripts/LuaInstaller'");
            LuaDefine.LuaEnv.Global.Get("InstallerEnv", out InstallerEnv);
            InstallerEnv.Set("self", this);
            InstallerEnv.Set("Container", Container);
            InstallerEnv.Get("Initialize", out luaInitialize);
            InstallerEnv.Get("OnSceneLoaded", out luaOnSceneLoaded);
            InstallerEnv.Get("OnEnable", out luaOnEnable);
            InstallerEnv.Get("Update", out luaUpdate);
            InstallerEnv.Get("OnDisbale", out luaOnDisable);

            luaInitialize?.Invoke();

            while (ABLoaderManager.GetDownloadProgress() < 1)
            {
                yield return(null);
            }

            var manifest = ABManifestLoader.GetInstance().GetABManifest();

            foreach (var abName in ABManifestLoader.GetInstance().AssetBundleList)
            {
                var sceneName = abName.Substring(0, abName.IndexOf("/"));
                if (sceneName.StartsWith("lua"))
                {
                    yield return(StartCoroutine(AssetBundleManager.GetInstance().LoadAssetBundle(sceneName, abName)));
                }
            }

            isInitialized = true;

            for (int i = 0; i < SceneManager.sceneCount; i++)
            {
                OnSceneLoaded(SceneManager.GetSceneAt(i), i == 0 ? LoadSceneMode.Single : LoadSceneMode.Additive);
            }
        }
Beispiel #2
0
 private IEnumerator Start()
 {
     Debug.Log(GetType() + "Start AssetBundle Framework Test!");
     StartCoroutine(AssetBundleManager.GetInstance().DownloadAssetBundle());
     while (ABLoaderManager.GetDownloadProgress() < 1)
     {
         Debug.Log(string.Format("Download Progress {0}%, Downloaded Size {1}KB/{2}KB", ABLoaderManager.GetDownloadProgress(), ABLoaderManager.GetDownloadedSize().ToString("0"), ABLoaderManager.GetContentSize().ToString("0")));
         yield return(null);
     }
     Debug.Log(string.Format("Download Progress {0}%, Downloaded Size {1}KB/{2}KB", ABLoaderManager.GetDownloadProgress(), ABLoaderManager.GetDownloadedSize().ToString("0"), ABLoaderManager.GetContentSize().ToString("0")));
     StartCoroutine(AssetBundleManager.GetInstance().LoadAssetBundle(sceneName, bundleName, OnLoadCompleted));
 }