Exemplo n.º 1
0
        public static async ETTask DownloadBundle()
        {
            if (Define.IsAsync)
            {
                try
                {
                    using (BundleDownloaderComponent bundleDownloaderComponent = Game.Scene.AddComponent <BundleDownloaderComponent>())
                    {
                        await bundleDownloaderComponent.StartAsync();

                        Game.EventSystem.Run(EventIdType.LoadingBegin);

                        await bundleDownloaderComponent.DownloadAsync();
                    }

                    Game.EventSystem.Run(EventIdType.LoadingFinish);

                    Game.Scene.GetComponent <ResourcesComponent>().LoadOneBundle("StreamingAssets");
                    ResourcesComponent.AssetBundleManifestObject = (AssetBundleManifest)Game.Scene.GetComponent <ResourcesComponent>().GetAsset("StreamingAssets", "AssetBundleManifest");
                }
                catch (Exception e)
                {
                    Log.LogError(e);
                }
            }
        }
Exemplo n.º 2
0
 public static async Task StartDownLoadResources()
 {
     if (Define.IsAsync)
     {
         try
         {
             using (BundleDownloaderComponent bundleDownloaderComponent = Game.Scene.AddComponent <BundleDownloaderComponent>())
             {
                 await bundleDownloaderComponent.StartAsync();
             }
             Game.Scene.GetComponent <ResourcesComponent>().LoadOneBundle("StreamingAssets");
             ResourcesComponent.AssetBundleManifestObject = Game.Scene.GetComponent <ResourcesComponent>().GetAsset <AssetBundleManifest>("StreamingAssets", "AssetBundleManifest");
         }
         catch (Exception e)
         {
             Log.Error(e.ToString());
         }
     }
 }