UILoadingEvent.cs 857 B

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using UnityEngine;
  3. namespace ET
  4. {
  5. [UIEvent(UIType.UILoading)]
  6. public class UILoadingEvent: AUIEvent
  7. {
  8. public override async ETTask<UI> OnCreate(UIComponent uiComponent, UILayer uiLayer)
  9. {
  10. try
  11. {
  12. await ETTask.CompletedTask;
  13. GameObject bundleGameObject = ((GameObject)Resources.Load("KV")).Get<GameObject>(UIType.UILoading);
  14. GameObject go = UnityEngine.Object.Instantiate(bundleGameObject);
  15. go.layer = LayerMask.NameToLayer(LayerNames.UI);
  16. UI ui = uiComponent.AddChild<UI, string, GameObject>(UIType.UILoading, go);
  17. ui.AddComponent<UILoadingComponent>();
  18. return ui;
  19. }
  20. catch (Exception e)
  21. {
  22. Log.Error(e);
  23. return null;
  24. }
  25. }
  26. public override void OnRemove(UIComponent uiComponent)
  27. {
  28. }
  29. }
  30. }