using UnityEngine; using UnityEngine.UI; namespace ETModel { [ObjectSystem] public class UiLoadingComponentAwakeSystem : AwakeSystem { public override void Awake(UILoadingComponent self) { self.text = self.GetParent().GameObject.Get("Text").GetComponent(); } } [ObjectSystem] public class UiLoadingComponentStartSystem : StartSystem { public override async void Start(UILoadingComponent self) { TimerComponent timerComponent = Game.Scene.GetComponent(); long instanceId = self.InstanceId; while (true) { await timerComponent.WaitAsync(1000); if (self.InstanceId != instanceId) { return; } BundleDownloaderComponent bundleDownloaderComponent = Game.Scene.GetComponent(); if (bundleDownloaderComponent == null) { continue; } self.text.text = $"{bundleDownloaderComponent.Progress}%"; } } } public class UILoadingComponent : Component { public Text text; } }