CTT/Unity/Assets/HotfixView/UI/NoticeUI/NoticeUI.cs

52 lines
1.3 KiB
C#

using ET;
using System;
using System.Collections.Generic;
namespace ET
{
public class NoticeUIAwakeSyatem : AwakeSystem<NoticeUI>
{
public override void Awake(NoticeUI self)
{
self.Awake();
}
}
public class NoticeUIDestroySyatem : DestroySystem<NoticeUI>
{
public override void Destroy(NoticeUI self)
{
self.Destroy();
}
}
public class NoticeUI : Entity
{
public FUI_NoticeUI ui;
public Action closeAction;
private bool isNotDisplayNotice;
private Scene zoneScene;
public void Awake()
{
zoneScene = this.ZoneScene();
ui = GetParent<FUI_NoticeUI>();
isNotDisplayNotice = false;
AwakeAsync().Coroutine();
}
private async ETVoid AwakeAsync()
{
G2C_GetNotice ret = await zoneScene.GetComponent<SessionComponent>().Call<G2C_GetNotice>(new C2G_GetNotice());
ui.m_title.text = ret.Notice;
ui.m_btnNotDisplay.self.onClick.Set(() =>
{
isNotDisplayNotice = !isNotDisplayNotice;
});
await ETTask.CompletedTask;
}
public void Destroy()
{
if (isNotDisplayNotice) closeAction?.Invoke();
}
}
}