From fa8c642a69716be57233ff946ba670577d891186 Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Sat, 14 Sep 2024 15:56:15 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=9B=E5=85=A5=E6=88=BF=E9=97=B4create=20ro?= =?UTF-8?q?m?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AxibugEmuOnline.Client/Assets/Script/Manager/AppRoom.cs | 6 ++++-- .../Assets/Script/Manager/RomLib/RomFile.cs | 1 + .../Assets/Script/UI/InGameUI/InGameUI.cs | 8 +++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/AxibugEmuOnline.Client/Assets/Script/Manager/AppRoom.cs b/AxibugEmuOnline.Client/Assets/Script/Manager/AppRoom.cs index 3e95763..e737cb6 100644 --- a/AxibugEmuOnline.Client/Assets/Script/Manager/AppRoom.cs +++ b/AxibugEmuOnline.Client/Assets/Script/Manager/AppRoom.cs @@ -254,9 +254,11 @@ namespace AxibugEmuOnline.Client.Manager /// 离开房间 /// /// - public void SendLeavnRoom(int RoomID) + public void SendLeavnRoom() { - _Protobuf_Room_Leave.RoomID = RoomID; + if (!InRoom) + return; + _Protobuf_Room_Leave.RoomID = mineRoomMiniInfo.RoomID; App.log.Info($"创建房间"); App.network.SendToServer((int)CommandID.CmdRoomLeave, ProtoBufHelper.Serizlize(_Protobuf_Room_Leave)); } diff --git a/AxibugEmuOnline.Client/Assets/Script/Manager/RomLib/RomFile.cs b/AxibugEmuOnline.Client/Assets/Script/Manager/RomLib/RomFile.cs index bde787d..5dc30e9 100644 --- a/AxibugEmuOnline.Client/Assets/Script/Manager/RomLib/RomFile.cs +++ b/AxibugEmuOnline.Client/Assets/Script/Manager/RomLib/RomFile.cs @@ -41,6 +41,7 @@ namespace AxibugEmuOnline.Client public int Index { get; private set; } /// 在查询结果中的所在页 public int Page { get; private set; } + public string Hash => webData != null ? webData.hash : string.Empty; public event Action OnDownloadOver; public event Action OnInfoFilled; diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/InGameUI/InGameUI.cs b/AxibugEmuOnline.Client/Assets/Script/UI/InGameUI/InGameUI.cs index fa811a5..727efe9 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/InGameUI/InGameUI.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/InGameUI/InGameUI.cs @@ -13,7 +13,7 @@ namespace AxibugEmuOnline.Client public override bool Enable => gameObject.activeInHierarchy; /// ָʾ¸ÃÓÎϷʵÀýÊÇ·ñ´¦ÓÚÁªÍøģʽ - public bool IsOnline { get; private set; } + public bool IsOnline => App.roomMgr.RoomState <= AxibugProtobuf.RoomGameState.OnlyHost; private RomFile m_rom; private object m_core; @@ -74,6 +74,11 @@ namespace AxibugEmuOnline.Client m_rom = currentRom; m_core = core; + if (App.user.IsLoggedIn) + { + App.roomMgr.SendCreateRoom(m_rom.ID, 0, m_rom.Hash); + } + gameObject.SetActiveEx(true); } @@ -91,6 +96,7 @@ namespace AxibugEmuOnline.Client public void QuitGame() { + App.roomMgr.SendLeavnRoom(); App.emu.StopGame(); } }