UILobbyEvent.cs 1013 B

12345678910111213141516171819202122232425
  1. using UnityEngine;
  2. namespace ET.Client
  3. {
  4. [UIEvent(UIType.UILobby)]
  5. public class UILobbyEvent: AUIEvent
  6. {
  7. public override async ETTask<UI> OnCreate(UIComponent uiComponent, UILayer uiLayer)
  8. {
  9. await ETTask.CompletedTask;
  10. await uiComponent.DomainScene().GetComponent<ResourcesLoaderComponent>().LoadAsync(UIType.UILobby.StringToAB());
  11. GameObject bundleGameObject = (GameObject) ResourcesComponent.Instance.GetAsset(UIType.UILobby.StringToAB(), UIType.UILobby);
  12. GameObject gameObject = UnityEngine.Object.Instantiate(bundleGameObject, UIEventComponent.Instance.GetLayer((int)uiLayer));
  13. UI ui = uiComponent.AddChild<UI, string, GameObject>(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. }