UILoadingComponentSystem.cs 817 B

1234567891011121314151617181920212223242526272829303132
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. namespace ET
  4. {
  5. public class UiLoadingComponentAwakeSystem : AwakeSystem<UILoadingComponent>
  6. {
  7. public override void Awake(UILoadingComponent self)
  8. {
  9. self.text = self.GetParent<UI>().GameObject.Get<GameObject>("Text").GetComponent<Text>();
  10. self.StartAsync().Coroutine();
  11. }
  12. }
  13. public static class UiLoadingComponentSystem
  14. {
  15. public static async ETVoid StartAsync(this UILoadingComponent self)
  16. {
  17. long instanceId = self.InstanceId;
  18. while (true)
  19. {
  20. await TimerComponent.Instance.WaitAsync(1000);
  21. if (self.InstanceId != instanceId)
  22. {
  23. return;
  24. }
  25. }
  26. }
  27. }
  28. }