UILoginEvent.cs 947 B

123456789101112131415161718192021222324252627
  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. ResourcesComponent resourcesComponent = Game.Scene.GetComponent<ResourcesComponent>();
  11. await resourcesComponent.LoadBundleAsync(UIType.UILogin.StringToAB());
  12. GameObject bundleGameObject = (GameObject) resourcesComponent.GetAsset(UIType.UILogin.StringToAB(), UIType.UILogin);
  13. GameObject gameObject = UnityEngine.Object.Instantiate(bundleGameObject);
  14. UI ui = EntityFactory.Create<UI, string, GameObject>(uiComponent.Domain, UIType.UILogin, gameObject);
  15. ui.AddComponent<UILoginComponent>();
  16. return ui;
  17. }
  18. public override void OnRemove(UIComponent uiComponent)
  19. {
  20. uiComponent.Remove(UIType.UILogin);
  21. }
  22. }
  23. }