using System; using UnityEngine; namespace ET.Client { [UIEvent(UIType.UIInvate)] public class UIInvateEvent : AUIEvent { public override async ETTask OnCreate(UIComponent uiComponent, UILayer uiLayer, params object[] param) { await ETTask.CompletedTask; await uiComponent.DomainScene().GetComponent().LoadAsync(UIType.UIInvate.StringToAB()); GameObject bundleGameObject = (GameObject) ResourcesComponent.Instance.GetAsset(UIType.UIInvate.StringToAB(), UIType.UIInvate); GameObject gameObject = UnityEngine.Object.Instantiate(bundleGameObject, UIEventComponent.Instance.GetLayer((int)uiLayer)); UI ui = uiComponent.AddChild(UIType.UIInvate, gameObject); ui.AddComponent(); return ui; } public override void OnRemove(UIComponent uiComponent) { ResourcesComponent.Instance.UnloadBundle(UIType.UIInvate.StringToAB()); } } }