54 lines
1.4 KiB
C#
54 lines
1.4 KiB
C#
using GeometryTD.CustomEvent;
|
|
using UnityGameFramework.Runtime;
|
|
|
|
namespace GeometryTD.UI
|
|
{
|
|
public class TestMenuForm : UGuiForm
|
|
{
|
|
private TestMenuFormContext _context;
|
|
|
|
public void RefreshUI(TestMenuFormContext context)
|
|
{
|
|
_context = context;
|
|
if (_context == null)
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
|
|
public void OnCombatButtonClick()
|
|
{
|
|
GameEntry.Event.Fire(this, TestMenuNodeClickEventArgs.Create(TestMenuNodeType.Combat));
|
|
}
|
|
|
|
public void OnEventButtonClick()
|
|
{
|
|
GameEntry.Event.Fire(this, TestMenuNodeClickEventArgs.Create(TestMenuNodeType.Event));
|
|
}
|
|
|
|
public void OnShopButtonClick()
|
|
{
|
|
GameEntry.Event.Fire(this, TestMenuNodeClickEventArgs.Create(TestMenuNodeType.Shop));
|
|
}
|
|
|
|
protected override void OnOpen(object userData)
|
|
{
|
|
base.OnOpen(userData);
|
|
|
|
if (userData is TestMenuFormContext context)
|
|
{
|
|
RefreshUI(context);
|
|
return;
|
|
}
|
|
|
|
Log.Warning("TestMenuForm requires TestMenuFormContext as userData.");
|
|
}
|
|
|
|
protected override void OnClose(bool isShutdown, object userData)
|
|
{
|
|
_context = null;
|
|
|
|
base.OnClose(isShutdown, userData);
|
|
}
|
|
}
|
|
} |