123456789101112131415161718192021222324 |
- using System;
- using UnityEngine;
- namespace ET.Client
- {
- [UIEvent(UIType.UIMain)]
- public class UIMainEvent : AUIEvent
- {
- public override async ETTask<UI> OnCreate(UIComponent uiComponent, UILayer uiLayer)
- {
- await uiComponent.DomainScene().GetComponent<ResourcesLoaderComponent>().LoadAsync(UIType.UIMain.StringToAB());
- GameObject bundleGameObject = (GameObject) ResourcesComponent.Instance.GetAsset(UIType.UIMain.StringToAB(), UIType.UIMain);
- GameObject gameObject = UnityEngine.Object.Instantiate(bundleGameObject, UIEventComponent.Instance.GetLayer((int)uiLayer));
- UI ui = uiComponent.AddChild<UI, string, GameObject>(UIType.UIMain, gameObject);
- ui.AddComponent<UIMainComponent>();
- return ui;
- }
- public override void OnRemove(UIComponent uiComponent)
- {
- ResourcesComponent.Instance.UnloadBundle(UIType.UIMain.StringToAB());
- }
- }
- }
|