From 6c8e2133cac11db6c25053477d2d44b707243f79 Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Fri, 8 Nov 2024 11:49:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E4=B8=80=E4=BA=9B=E7=BD=91?= =?UTF-8?q?=E7=BB=9C=E7=8A=B6=E6=80=81=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AxibugEmuOnline.Client/Assets/Script/App.cs | 2 +- .../Assets/Script/NesEmulator/CoreSupporter.cs | 2 +- .../Assets/Script/UI/InGameUI/InGameUI.cs | 18 ++++++++++++++---- .../Script/UI/InGameUI/InGameUI_LoadState.cs | 4 ++-- .../Script/UI/InGameUI/InGameUI_SaveState.cs | 4 ++-- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/AxibugEmuOnline.Client/Assets/Script/App.cs b/AxibugEmuOnline.Client/Assets/Script/App.cs index 8232c2f..aaeb8c6 100644 --- a/AxibugEmuOnline.Client/Assets/Script/App.cs +++ b/AxibugEmuOnline.Client/Assets/Script/App.cs @@ -101,7 +101,7 @@ namespace AxibugEmuOnline.Client.ClientCore yield break; int platform = 0; - bool bTest = false; + bool bTest = true; if (bTest) { yield return null; diff --git a/AxibugEmuOnline.Client/Assets/Script/NesEmulator/CoreSupporter.cs b/AxibugEmuOnline.Client/Assets/Script/NesEmulator/CoreSupporter.cs index a0960d8..29f527f 100644 --- a/AxibugEmuOnline.Client/Assets/Script/NesEmulator/CoreSupporter.cs +++ b/AxibugEmuOnline.Client/Assets/Script/NesEmulator/CoreSupporter.cs @@ -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 _)) { diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/InGameUI/InGameUI.cs b/AxibugEmuOnline.Client/Assets/Script/UI/InGameUI/InGameUI.cs index 22f3f50..13e514a 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/InGameUI/InGameUI.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/InGameUI/InGameUI.cs @@ -11,8 +11,18 @@ namespace AxibugEmuOnline.Client public RomFile RomFile => m_rom; public override bool Enable => gameObject.activeInHierarchy; - /// 指示该游戏实例是否处于联网模式 - public bool IsOnline => App.user.IsLoggedIn ? App.roomMgr.RoomState > AxibugProtobuf.RoomGameState.OnlyHost : false; + /// 指示该游戏实例是否处于联机模式 + 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(); } diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/InGameUI/InGameUI_LoadState.cs b/AxibugEmuOnline.Client/Assets/Script/UI/InGameUI/InGameUI_LoadState.cs index 8ef1eea..2132ad6 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/InGameUI/InGameUI_LoadState.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/InGameUI/InGameUI_LoadState.cs @@ -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(); diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/InGameUI/InGameUI_SaveState.cs b/AxibugEmuOnline.Client/Assets/Script/UI/InGameUI/InGameUI_SaveState.cs index e5ffb51..d3d347b 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/InGameUI/InGameUI_SaveState.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/InGameUI/InGameUI_SaveState.cs @@ -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();