UILobbyEvent.cs 892 B

12345678910111213141516171819202122232425
  1. using System;
  2. using UnityEngine;
  3. namespace ET
  4. {
  5. [UIEvent(UIType.UILobby)]
  6. public class UILobbyEvent: AUIEvent
  7. {
  8. public override async ETTask<UI> OnCreate(UIComponent uiComponent)
  9. {
  10. ResourcesComponent.Instance.LoadBundle(UIType.UILobby.StringToAB());
  11. GameObject bundleGameObject = (GameObject) ResourcesComponent.Instance.GetAsset(UIType.UILobby.StringToAB(), UIType.UILobby);
  12. GameObject gameObject = UnityEngine.Object.Instantiate(bundleGameObject);
  13. UI ui = EntityFactory.CreateWithParent<UI, string, GameObject>(uiComponent, UIType.UILobby, gameObject);
  14. ui.AddComponent<UILobbyComponent>();
  15. return ui;
  16. }
  17. public override void OnRemove(UIComponent uiComponent)
  18. {
  19. ResourcesComponent.Instance.UnloadBundle(UIType.UILobby.StringToAB());
  20. }
  21. }
  22. }