2024-09-13 13:28:33 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace AxibugEmuOnline.Client
|
|
|
|
|
{
|
|
|
|
|
public class InGameUI : CommandExecuter
|
|
|
|
|
{
|
|
|
|
|
public static InGameUI Instance { get; private set; }
|
|
|
|
|
|
|
|
|
|
public RomFile RomFile => m_rom;
|
|
|
|
|
public override bool Enable => gameObject.activeInHierarchy;
|
|
|
|
|
private RomFile m_rom;
|
|
|
|
|
private object m_core;
|
2024-09-13 17:39:48 +08:00
|
|
|
|
private object m_state;
|
2024-09-13 13:28:33 +08:00
|
|
|
|
|
2024-09-13 17:39:48 +08:00
|
|
|
|
private InGameUI_SaveState m_saveStateMenu;
|
|
|
|
|
private InGameUI_LoadState m_loadStateMenu;
|
2024-09-13 13:28:33 +08:00
|
|
|
|
|
|
|
|
|
protected override void Awake()
|
|
|
|
|
{
|
|
|
|
|
Instance = this;
|
|
|
|
|
gameObject.SetActiveEx(false);
|
|
|
|
|
base.Awake();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnDestroy()
|
|
|
|
|
{
|
|
|
|
|
Instance = null;
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-13 17:39:48 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><>ȡģ<C8A1><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <typeparam name="T">ģ<><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></typeparam>
|
2024-09-13 13:28:33 +08:00
|
|
|
|
public T GetCore<T>() => (T)m_core;
|
2024-09-13 17:39:48 +08:00
|
|
|
|
/// <summary> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٿ<EFBFBD><D9BF><EFBFBD> </summary>
|
|
|
|
|
public void SaveQuickState(object state)
|
|
|
|
|
{
|
|
|
|
|
m_state = state;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><>ȡ<EFBFBD><C8A1><EFBFBD>ٿ<EFBFBD><D9BF><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <typeparam name="T"></typeparam>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public bool GetQuickState<T>(out T state)
|
|
|
|
|
{
|
|
|
|
|
state = default(T);
|
|
|
|
|
|
|
|
|
|
if (m_state is T)
|
|
|
|
|
{
|
|
|
|
|
state = (T)m_state;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
2024-09-13 13:28:33 +08:00
|
|
|
|
|
|
|
|
|
public void Show(RomFile currentRom, object core)
|
|
|
|
|
{
|
|
|
|
|
CommandDispatcher.Instance.RegistController(this);
|
|
|
|
|
|
2024-09-13 17:39:48 +08:00
|
|
|
|
m_saveStateMenu = new InGameUI_SaveState(this);
|
|
|
|
|
m_loadStateMenu = new InGameUI_LoadState(this);
|
|
|
|
|
|
2024-09-13 13:28:33 +08:00
|
|
|
|
m_rom = currentRom;
|
|
|
|
|
m_core = core;
|
2024-09-13 17:39:48 +08:00
|
|
|
|
|
2024-09-13 13:28:33 +08:00
|
|
|
|
gameObject.SetActiveEx(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Hide()
|
|
|
|
|
{
|
|
|
|
|
CommandDispatcher.Instance.UnRegistController(this);
|
|
|
|
|
|
|
|
|
|
gameObject.SetActiveEx(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnCmdOptionMenu()
|
|
|
|
|
{
|
2024-09-13 17:39:48 +08:00
|
|
|
|
OptionUI.Instance.Pop(new List<OptionMenu> { m_saveStateMenu, m_loadStateMenu });
|
2024-09-13 13:28:33 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|