AlicizaX/Client/Assets/Scripts/Hotfix/GameLogic/UI/UILoadUpdate.cs
2025-11-17 16:56:03 +08:00

78 lines
1.7 KiB
C#

using AlicizaX;
using AlicizaX.Resource.Runtime;
using AlicizaX.UI.Runtime;
using Cysharp.Threading.Tasks;
using Game.UI;
using GameLogic.Event;
using GameLogic.UI;
using UnityEngine;
[UIUpdate]
[Window(UILayer.UI, false, 160)]
public class UILoadUpdate : UITabWindow<ui_UILoadUpdateWindow>
{
private UICardWidget testa;
private UICardWidget testb;
protected override void OnInitialize()
{
baseui.ImgBackGround.color = Color.gray;
baseui.BtnTest.onClick.AddListener(OnTestClick);
CreateTest();
}
protected override void OnRegisterEvent(EventListenerProxy proxy)
{
proxy.AddUIEvent<TestUIOpenEvent>(OnHandleTestUIOpenEevent);
}
private void OnHandleTestUIOpenEevent(TestUIOpenEvent obj)
{
}
private void CreateTest()
{
testa= CreateWidgetSync<UICardWidget>(baseui.RectTransform);
testb=CreateWidgetSync<UICardWidget>(baseui.RectTransform);
GameApp.Timer.AddTimer((t) =>
{
DestroyTest();
}, 5f);
}
private void DestroyTest()
{
testa.Destroy();
testb.Destroy();
GameApp.Timer.AddTimer((t) =>
{
CreateTest();
}, 10f);
}
private void OnTestClick()
{
EventPublisher.Publish(new TestUIOpenEvent("Test", false));
}
public async UniTask TestFuncA()
{
await UniTask.Delay(1000);
Debug.Log("TestFuncA");
}
public void TestFuncB()
{
TestFuncA();
Debug.Log("TestFuncB");
}
protected override void OnOpen()
{
Debug.Log("OnOpen");
}
protected override void OnClose()
{
Debug.Log("OnClose");
}
}