UILoadingComponentSystem.cs 997 B

12345678910111213141516171819202122232425262728293031323334353637
  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. }
  11. }
  12. public class UiLoadingComponentStartSystem : StartSystem<UILoadingComponent>
  13. {
  14. public override void Start(UILoadingComponent self)
  15. {
  16. StartAsync(self).Coroutine();
  17. }
  18. public async ETVoid StartAsync(UILoadingComponent self)
  19. {
  20. TimerComponent timerComponent = Game.Scene.GetComponent<TimerComponent>();
  21. long instanceId = self.InstanceId;
  22. while (true)
  23. {
  24. await timerComponent.WaitAsync(1000);
  25. if (self.InstanceId != instanceId)
  26. {
  27. return;
  28. }
  29. }
  30. }
  31. }
  32. }