UILoginEvent.cs 904 B

1234567891011121314151617181920212223242526
  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)
  9. {
  10. await ResourcesComponent.Instance.LoadBundleAsync(UIType.UILogin.StringToAB());
  11. GameObject bundleGameObject = (GameObject) ResourcesComponent.Instance.GetAsset(UIType.UILogin.StringToAB(), UIType.UILogin);
  12. GameObject gameObject = UnityEngine.Object.Instantiate(bundleGameObject);
  13. UI ui = EntityFactory.CreateWithParent<UI, string, GameObject>(uiComponent, 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. }