UILoginEvent.cs 1.1 KB

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. Log.Info($"11111111111111111111111111111111111111111111117");
  11. await ResourcesComponent.Instance.LoadBundleAsync(UIType.UILogin.StringToAB());
  12. Log.Info($"11111111111111111111111111111111111111111111118");
  13. GameObject bundleGameObject = (GameObject) ResourcesComponent.Instance.GetAsset(UIType.UILogin.StringToAB(), UIType.UILogin);
  14. GameObject gameObject = UnityEngine.Object.Instantiate(bundleGameObject);
  15. UI ui = uiComponent.AddChild<UI, string, GameObject>(UIType.UILogin, gameObject);
  16. Log.Info($"11111111111111111111111111111111111111111111119");
  17. ui.AddComponent<UILoginComponent>();
  18. return ui;
  19. }
  20. public override void OnRemove(UIComponent uiComponent)
  21. {
  22. ResourcesComponent.Instance.UnloadBundle(UIType.UILogin.StringToAB());
  23. }
  24. }
  25. }