diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/InGameUI/InGameUI.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/InGameUI/InGameUI.cs
index c58f61b..21a28f4 100644
--- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/InGameUI/InGameUI.cs
+++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/InGameUI/InGameUI.cs
@@ -1,5 +1,6 @@
-using AxibugEmuOnline.Client.ClientCore;
+锘縰sing AxibugEmuOnline.Client.ClientCore;
using AxibugEmuOnline.Client.Event;
+using System;
using System.Collections.Generic;
namespace AxibugEmuOnline.Client
@@ -11,7 +12,7 @@ namespace AxibugEmuOnline.Client
public RomFile RomFile => m_rom;
public override bool Enable => gameObject.activeInHierarchy;
- /// 指示该游戏实例是否处于联机模式
+ /// 鎸囩ず璇ユ父鎴忓疄渚嬫槸鍚﹀浜庤仈鏈烘ā寮
public bool IsNetPlay
{
get
@@ -53,13 +54,13 @@ namespace AxibugEmuOnline.Client
base.OnDestroy();
}
- /// 保存快速快照
+ /// 淇濆瓨蹇熷揩鐓
public void SaveQuickState(object state)
{
m_state = state;
}
///
- /// 读取快速快照
+ /// 璇诲彇蹇熷揩鐓
///
///
///
@@ -68,21 +69,31 @@ namespace AxibugEmuOnline.Client
return m_state;
}
+ private bool m_delayCreateRoom;
public void Show(RomFile currentRom, IEmuCore core)
{
- m_state = null;//清空游戏快照
+ m_delayCreateRoom = false;
+ m_state = null;//娓呯┖娓告垙蹇収
CommandDispatcher.Instance.RegistController(this);
m_rom = currentRom;
Core = core;
m_stepPerformer.Reset();
- if (App.user.IsLoggedIn && !App.roomMgr.InRoom)
- {
- App.roomMgr.SendCreateRoom(m_rom.ID, 0, m_rom.Hash);
+ if (!App.roomMgr.InRoom)
+ {
+ if (App.user.IsLoggedIn)
+ App.roomMgr.SendCreateRoom(m_rom.ID, 0, m_rom.Hash);
+ else
+ {
+ m_delayCreateRoom = true;
+ OverlayManager.PopTip("绋嶅悗灏嗕細寤虹珛鎴块棿");
+ }
}
+ Eventer.Instance.RegisterEvent(EEvent.OnLoginSucceed, OnLoggedIn);
Eventer.Instance.RegisterEvent(EEvent.OnRoomWaitStepChange, OnServerStepUpdate);
+ Eventer.Instance.RegisterEvent(EEvent.OnMineJoinRoom, OnRoomJoin);
gameObject.SetActiveEx(true);
@@ -95,8 +106,21 @@ namespace AxibugEmuOnline.Client
filter.ApplyPreset(preset);
App.filter.EnableFilter(filter);
}
- }
-
+ }
+
+ private void OnRoomJoin()
+ {
+ m_delayCreateRoom = false;
+ }
+
+ private void OnLoggedIn()
+ {
+ if (m_delayCreateRoom)
+ {
+ App.roomMgr.SendCreateRoom(m_rom.ID, 0, m_rom.Hash);
+ }
+ }
+
private void OnServerStepUpdate(int step)
{
m_stepPerformer.Perform(step);
@@ -114,23 +138,21 @@ namespace AxibugEmuOnline.Client
{
OverlayManager.PopSideBar(menus, 0, PopMenu_OnHide);
- if (!IsNetPlay)//单人模式暂停模拟器
- {
+ if (!IsNetPlay)//鍗曚汉妯″紡鏆傚仠妯℃嫙鍣
Core.Pause();
- }
}
- //菜单关闭时候
+ //鑿滃崟鍏抽棴鏃跺
private void PopMenu_OnHide()
{
- if (!IsNetPlay)//单人模式恢复模拟器的暂停
+ if (!IsNetPlay)//鍗曚汉妯″紡鎭㈠妯℃嫙鍣ㄧ殑鏆傚仠
Core.Resume();
}
-
-
public void QuitGame()
{
Eventer.Instance.UnregisterEvent(EEvent.OnRoomWaitStepChange, OnServerStepUpdate);
+ Eventer.Instance.UnregisterEvent(EEvent.OnLoginSucceed, OnLoggedIn);
+ Eventer.Instance.UnregisterEvent(EEvent.OnMineJoinRoom, OnRoomJoin);
App.roomMgr.SendLeavnRoom();
App.emu.StopGame();
}