Compare commits

...

2 Commits

Author SHA1 Message Date
7971b4a4ba Merge pull request '完善一些网络状态判断' (#43) from Alienjack/AxibugEmuOnline:master into master
Reviewed-on: #43
2024-11-08 11:51:30 +08:00
ALIENJACK\alien
6c8e2133ca 完善一些网络状态判断 2024-11-08 11:49:33 +08:00
5 changed files with 20 additions and 10 deletions

View File

@ -101,7 +101,7 @@ namespace AxibugEmuOnline.Client.ClientCore
yield break;
int platform = 0;
bool bTest = false;
bool bTest = true;
if (bTest)
{
yield return null;

View File

@ -100,7 +100,7 @@ namespace AxibugEmuOnline.Client
public void SampleInput()
{
if (InGameUI.Instance.IsOnline)
if (InGameUI.Instance.IsNetPlay)
{
if (App.roomMgr.netReplay.NextFrame(out var replayData, out int _))
{

View File

@ -11,8 +11,18 @@ namespace AxibugEmuOnline.Client
public RomFile RomFile => m_rom;
public override bool Enable => gameObject.activeInHierarchy;
/// <summary> 指示该游戏实例是否处于联网模式 </summary>
public bool IsOnline => App.user.IsLoggedIn ? App.roomMgr.RoomState > AxibugProtobuf.RoomGameState.OnlyHost : false;
/// <summary> 指示该游戏实例是否处于联机模式 </summary>
public bool IsNetPlay
{
get
{
if (!App.user.IsLoggedIn) return false;
if (App.roomMgr.mineRoomMiniInfo == null) return false;
if (App.roomMgr.RoomState <= AxibugProtobuf.RoomGameState.OnlyHost) return false;
return true;
}
}
private RomFile m_rom;
public IEmuCore Core { get; private set; }
@ -92,7 +102,7 @@ namespace AxibugEmuOnline.Client
{
OptionUI.Instance.Pop(menus);
if (!IsOnline)//单人模式暂停模拟器
if (!IsNetPlay)//单人模式暂停模拟器
{
Core.Pause();
}
@ -101,7 +111,7 @@ namespace AxibugEmuOnline.Client
//菜单关闭时候
private void PopMenu_OnHide()
{
if (!IsOnline)//单人模式恢复模拟器的暂停
if (!IsNetPlay)//单人模式恢复模拟器的暂停
Core.Resume();
}

View File

@ -6,7 +6,7 @@ namespace AxibugEmuOnline.Client
public class InGameUI_LoadState : ExecuteMenu
{
private InGameUI m_gameUI;
public override bool Visible => !m_gameUI.IsOnline;
public override bool Visible => !m_gameUI.IsNetPlay;
public InGameUI_LoadState(InGameUI gameUI) : base("뗍혤우亮", null)
{
@ -15,7 +15,7 @@ namespace AxibugEmuOnline.Client
public override void OnExcute()
{
if (m_gameUI.IsOnline) return;
if (m_gameUI.IsNetPlay) return;
object state = m_gameUI.GetQuickState();
Stopwatch sw = Stopwatch.StartNew();

View File

@ -10,7 +10,7 @@ namespace AxibugEmuOnline.Client
{
private InGameUI m_gameUI;
public override bool Visible => !m_gameUI.IsOnline;
public override bool Visible => !m_gameUI.IsNetPlay;
public InGameUI_SaveState(InGameUI gameUI) : base("괏닸우亮", null)
{
@ -19,7 +19,7 @@ namespace AxibugEmuOnline.Client
public override void OnExcute()
{
if (m_gameUI.IsOnline) return;
if (m_gameUI.IsNetPlay) return;
Stopwatch sw = Stopwatch.StartNew();
object state = m_gameUI.Core.GetState();