Ejemplo 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);
                }
            }
        }
Ejemplo 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());
         }
     }
 }
Ejemplo n.º 3
0
        public override async void Start(UILoadingComponent self)
        {
            TimerComponent timerComponent = Game.Scene.GetComponent <TimerComponent>();

            while (true)
            {
                await timerComponent.WaitAsync(1000);

                if (self.IsDisposed)
                {
                    return;
                }

                BundleDownloaderComponent bundleDownloaderComponent = Game.Scene.GetComponent <BundleDownloaderComponent>();
                if (bundleDownloaderComponent == null)
                {
                    continue;
                }
                self.text.text = $"{bundleDownloaderComponent.Progress}%";
            }
        }
Ejemplo n.º 4
0
        public async void Start()
        {
            UILoadingComponent self = this.Get();

            TimerComponent timerComponent = Game.Scene.GetComponent <TimerComponent>();

            while (true)
            {
                await timerComponent.WaitAsync(1000);

                if (self.Id == 0)
                {
                    return;
                }

                BundleDownloaderComponent bundleDownloaderComponent = Game.Scene.GetComponent <BundleDownloaderComponent>();
                if (bundleDownloaderComponent == null)
                {
                    continue;
                }
                self.text.text = $"{bundleDownloaderComponent.Progress}%";
            }
        }