49 lines
1.1 KiB
C#
49 lines
1.1 KiB
C#
using GeometryTD.CustomEvent;
|
|
using UnityGameFramework.Runtime;
|
|
|
|
namespace GeometryTD.UI
|
|
{
|
|
public class MainForm : UGuiForm
|
|
{
|
|
private MainFormContext _context;
|
|
|
|
public void RefreshUI(MainFormContext context)
|
|
{
|
|
_context = context;
|
|
if (_context == null)
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
|
|
public void OnReturnButtonClick()
|
|
{
|
|
GameEntry.Event.Fire(this, ReturnButtonClickedEventArgs.Create());
|
|
}
|
|
|
|
public void OnRepoButtonClick()
|
|
{
|
|
GameEntry.Event.Fire(this, RepoButtonClickedEventArgs.Create());
|
|
}
|
|
|
|
protected override void OnOpen(object userData)
|
|
{
|
|
base.OnOpen(userData);
|
|
|
|
if (userData is MainFormContext context)
|
|
{
|
|
RefreshUI(context);
|
|
return;
|
|
}
|
|
|
|
Log.Warning("MainForm requires MainFormContext as userData.");
|
|
}
|
|
|
|
protected override void OnClose(bool isShutdown, object userData)
|
|
{
|
|
_context = null;
|
|
|
|
base.OnClose(isShutdown, userData);
|
|
}
|
|
}
|
|
} |