UILoginEvent.cs 972 B

123456789101112131415161718192021222324
  1. using System;
  2. using UnityEngine;
  3. namespace ET
  4. {
  5. [UIEvent(UIType.UILogin)]
  6. public class UILoginEvent: AUIEvent
  7. {
  8. public override async ETTask<UI> OnCreate(UIComponent uiComponent, UILayer uiLayer)
  9. {
  10. await uiComponent.Domain.GetComponent<ResourcesLoaderComponent>().LoadAsync(UIType.UILogin.StringToAB());
  11. GameObject bundleGameObject = (GameObject) ResourcesComponent.Instance.GetAsset(UIType.UILogin.StringToAB(), UIType.UILogin);
  12. GameObject gameObject = UnityEngine.Object.Instantiate(bundleGameObject, UIEventComponent.Instance.UILayers[(int)uiLayer]);
  13. UI ui = uiComponent.AddChild<UI, string, GameObject>(UIType.UILogin, gameObject);
  14. ui.AddComponent<UILoginComponent>();
  15. return ui;
  16. }
  17. public override void OnRemove(UIComponent uiComponent)
  18. {
  19. ResourcesComponent.Instance.UnloadBundle(UIType.UILogin.StringToAB());
  20. }
  21. }
  22. }