服务端房间功能

This commit is contained in:
sin365 2024-07-09 17:22:09 +08:00
parent 90a64b85fe
commit b394410ab0
15 changed files with 5586 additions and 88 deletions

View File

@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.8.34511.84
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AxibugEmuOnline.Server", "AxibugEmuOnline.Server\AxibugEmuOnline.Server.csproj", "{38E193D4-3BEC-42D0-9616-53D7AF3937FC}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Lib", "Lib", "{F151804D-CF60-437E-ACE6-F1C04DCECBF8}"
ProjectSection(SolutionItems) = preProject
..\Lib\Google.Protobuf.dll = ..\Lib\Google.Protobuf.dll
..\Lib\HaoYueNet.ServerNetwork.dll = ..\Lib\HaoYueNet.ServerNetwork.dll
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{38E193D4-3BEC-42D0-9616-53D7AF3937FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{38E193D4-3BEC-42D0-9616-53D7AF3937FC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{38E193D4-3BEC-42D0-9616-53D7AF3937FC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{38E193D4-3BEC-42D0-9616-53D7AF3937FC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {705EF8E0-A868-4412-BC48-A7DD735C2DBD}
EndGlobalSection
EndGlobal

View File

@ -111,7 +111,7 @@ namespace AxibugEmuOnline.Server.Event
}
catch (Exception e)
{
ServerManager.g_Log.Error(e.Message);
AppSrv.g_Log.Error(e.Message);
}
}
}
@ -130,7 +130,7 @@ namespace AxibugEmuOnline.Server.Event
}
catch (Exception e)
{
ServerManager.g_Log.Error(e.Message);
AppSrv.g_Log.Error(e.Message);
}
}
}
@ -149,7 +149,7 @@ namespace AxibugEmuOnline.Server.Event
}
catch (Exception e)
{
ServerManager.g_Log.Error(e.Message);
AppSrv.g_Log.Error(e.Message);
}
}
}
@ -168,7 +168,7 @@ namespace AxibugEmuOnline.Server.Event
}
catch (Exception e)
{
ServerManager.g_Log.Error(e.Message + ", method name : " + callback.Method);
AppSrv.g_Log.Error(e.Message + ", method name : " + callback.Method);
}
}
}
@ -188,7 +188,7 @@ namespace AxibugEmuOnline.Server.Event
}
catch (Exception e)
{
ServerManager.g_Log.Error(e.Message);
AppSrv.g_Log.Error(e.Message);
}
}
}

View File

@ -5,13 +5,14 @@ using System.Net;
namespace AxibugEmuOnline.Server
{
public static class ServerManager
public static class AppSrv
{
public static ClientManager g_ClientMgr;
public static LogManager g_Log;
public static LoginManager g_Login;
public static ChatManager g_Chat;
public static IOCPNetWork g_SocketMgr;
public static RoomManager g_Room;
public static GameManager g_Game;
public static void InitServer(int port)
@ -23,6 +24,7 @@ namespace AxibugEmuOnline.Server
g_Chat = new ChatManager();
//g_SocketMgr = new IOCPNetWork(1024, 1024);
g_SocketMgr = new IOCPNetWork(1024, 4096);
g_Room = new RoomManager();
g_Game = new GameManager();
g_SocketMgr.Init();

View File

@ -14,8 +14,8 @@ namespace AxibugEmuOnline.Server.Manager
public void RecvPlayerChatMsg(Socket sk, byte[] reqData)
{
ClientInfo _c = ServerManager.g_ClientMgr.GetClientForSocket(sk);
ServerManager.g_Log.Debug("收到聊天消息请求");
ClientInfo _c = AppSrv.g_ClientMgr.GetClientForSocket(sk);
AppSrv.g_Log.Debug("收到聊天消息请求");
Protobuf_ChatMsg msg = ProtoBufHelper.DeSerizlize<Protobuf_ChatMsg>(reqData);
byte[] respData = ProtoBufHelper.Serizlize(new Protobuf_ChatMsg_RESP()
{
@ -23,7 +23,7 @@ namespace AxibugEmuOnline.Server.Manager
NickName = _c.Account,
Date = Helper.GetNowTimeStamp()
});
ServerManager.g_ClientMgr.ClientSendALL((int)CommandID.CmdChatmsg, (int)ErrorCode.ErrorOk, respData);
AppSrv.g_ClientMgr.ClientSendALL((int)CommandID.CmdChatmsg, (int)ErrorCode.ErrorOk, respData);
}
}
}

View File

@ -7,6 +7,7 @@ namespace AxibugEmuOnline.Server.Manager
public class ClientInfo
{
public long UID { get; set; }
public string NickName { get; set; }
public string Account { get; set; }
public Socket _socket { get; set; }
public bool IsOffline { get; set; } = false;
@ -125,13 +126,13 @@ namespace AxibugEmuOnline.Server.Manager
ClientList.Remove(client);
}
}
}
/// <summary>
/// 清理连接
/// </summary>
/// <param name="client"></param>
public bool GetClientByUID(long uid,out ClientInfo client)
public bool GetClientByUID(long uid, out ClientInfo client, bool bNeedOnline = false)
{
lock (ClientList)
{
@ -142,6 +143,10 @@ namespace AxibugEmuOnline.Server.Manager
}
client = _DictUIDClient[uid];
if (bNeedOnline && client.IsOffline)
return false;
return true;
}
}
@ -209,14 +214,14 @@ namespace AxibugEmuOnline.Server.Manager
if(SkipUID > -1 && _toclientlist[i].UID == SkipUID)
continue;
ServerManager.g_SocketMgr.SendToSocket(_toclientlist[i]._socket, CMDID, ERRCODE, data);
AppSrv.g_SocketMgr.SendToSocket(_toclientlist[i]._socket, CMDID, ERRCODE, data);
}
}
public void ClientSend(Socket _socket, int CMDID, int ERRCODE, byte[] data)
{
//Console.WriteLine("发送数据 CMDID->"+ CMDID);
ServerManager.g_SocketMgr.SendToSocket(_socket, CMDID, ERRCODE, data);
AppSrv.g_SocketMgr.SendToSocket(_socket, CMDID, ERRCODE, data);
}
/// <summary>
@ -230,7 +235,7 @@ namespace AxibugEmuOnline.Server.Manager
{
if (_c == null || _c.IsOffline)
return;
ServerManager.g_SocketMgr.SendToSocket(_c._socket, CMDID, ERRCODE, data);
AppSrv.g_SocketMgr.SendToSocket(_c._socket, CMDID, ERRCODE, data);
}
public int GetOnlineClient()

View File

@ -17,10 +17,21 @@ namespace AxibugEmuOnline.Server
public void OnCmdScreen(Socket sk, byte[] reqData)
{
ServerManager.g_Log.Debug($"OnCmdScreen lenght:{reqData.Length}");
ClientInfo _c = ServerManager.g_ClientMgr.GetClientForSocket(sk);
AppSrv.g_Log.Debug($"OnCmdScreen lenght:{reqData.Length}");
ClientInfo _c = AppSrv.g_ClientMgr.GetClientForSocket(sk);
Protobuf_Screnn_Frame msg = ProtoBufHelper.DeSerizlize<Protobuf_Screnn_Frame>(reqData);
ServerManager.g_ClientMgr.ClientSendALL((int)CommandID.CmdScreen, (int)ErrorCode.ErrorOk, reqData, _c.UID);
Data_RoomData room = AppSrv.g_Room.GetRoomData(msg.RoomID);
if (room == null)
{
AppSrv.g_ClientMgr.ClientSend(_c,(int)CommandID.CmdScreen, (int)ErrorCode.ErrorRoomNotFound, new byte[1]);
return;
}
List<ClientInfo> userlist = room.GetAllPlayerClientList();
AppSrv.g_ClientMgr.ClientSend(userlist, (int)CommandID.CmdScreen, (int)ErrorCode.ErrorOk, reqData, _c.UID);
}
}
}

View File

@ -14,9 +14,9 @@ namespace AxibugEmuOnline.Server.Manager
public void UserLogin(Socket _socket, byte[] reqData)
{
ServerManager.g_Log.Debug("收到新的登录请求");
AppSrv.g_Log.Debug("收到新的登录请求");
Protobuf_Login msg = ProtoBufHelper.DeSerizlize<Protobuf_Login>(reqData);
ClientInfo cinfo = ServerManager.g_ClientMgr.JoinNewClient(msg, _socket);
ClientInfo cinfo = AppSrv.g_ClientMgr.JoinNewClient(msg, _socket);
byte[] respData = ProtoBufHelper.Serizlize(new Protobuf_Login_RESP()
{

View File

@ -0,0 +1,370 @@
using AxibugEmuOnline.Server.Common;
using AxibugEmuOnline.Server.Manager;
using AxibugEmuOnline.Server.NetWork;
using AxibugProtobuf;
using System.Net;
using System.Net.Sockets;
using static System.Runtime.InteropServices.JavaScript.JSType;
namespace AxibugEmuOnline.Server
{
public class RoomManager
{
Dictionary<int, Data_RoomData> mDictRoom = new Dictionary<int, Data_RoomData>();
int RoomIDSeed = 1;
public RoomManager()
{
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomList, OnCmdRoomList);
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomCreate, OnCmdRoomCreate);
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomJoin, OnCmdRoomJoin);
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdRoomLeave, OnCmdRoomLeave);
}
#region
int GetNewRoomID()
{
return RoomIDSeed++;
}
void AddRoom(Data_RoomData data)
{
lock (mDictRoom)
{
if (!mDictRoom.ContainsKey(data.RoomID))
{
mDictRoom.Add(data.RoomID, data);
}
}
}
void RemoveRoom(int RoomID)
{
lock(mDictRoom)
{
if (mDictRoom.ContainsKey(RoomID))
{
mDictRoom.Remove(RoomID);
}
}
}
public Data_RoomData GetRoomData(int RoomID)
{
if (!mDictRoom.ContainsKey(RoomID))
return null;
return mDictRoom[RoomID];
}
List<Data_RoomData> GetRoomList()
{
lock (mDictRoom)
{
List<Data_RoomData> temp = new List<Data_RoomData>();
foreach (var room in mDictRoom)
{
temp.AddRange(mDictRoom.Values);
}
return temp;
}
}
#endregion
private Protobuf_Room_MiniInfo GetProtoDataRoom(Data_RoomData room)
{
Protobuf_Room_MiniInfo result = new Protobuf_Room_MiniInfo()
{
GameRomID = room.GameRomID,
RoomID = room.RoomID,
GameRomHash = room.RomHash,
GameState = room.GameState,
PlayerState = room.PlayerState,
ObsUserCount = 0,//TODO
Player1UID = room.Player1_UID,
Player2UID = room.Player2_UID,
};
if (result.Player1UID >= 0 && AppSrv.g_ClientMgr.GetClientByUID(result.Player1UID, out ClientInfo _c1))
result.Player1NickName = _c1.NickName;
if (result.Player2UID >= 0 && AppSrv.g_ClientMgr.GetClientByUID(result.Player2UID, out ClientInfo _c2))
result.Player2NickName = _c2.NickName;
return result;
}
public void OnCmdRoomList(Socket sk, byte[] reqData)
{
AppSrv.g_Log.Debug($"OnCmdRoomList ");
ClientInfo _c = AppSrv.g_ClientMgr.GetClientForSocket(sk);
Protobuf_Room_List msg = ProtoBufHelper.DeSerizlize<Protobuf_Room_List>(reqData);
Protobuf_Room_List_RESP resp = new Protobuf_Room_List_RESP();
List<Data_RoomData> temp = GetRoomList();
foreach (var room in temp)
resp.RoomMiniInfoList.Add(GetProtoDataRoom(room));
AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdChatmsg, (int)ErrorCode.ErrorOk, ProtoBufHelper.Serizlize(resp));
}
/// <summary>
///
/// </summary>
/// <param name="RoomID"></param>
/// <param name="type">//[0] 更新或新增 [1] 删除</param>
public void SendRoomUpdateToAll(int RoomID,int type)
{
Data_RoomData room = GetRoomData(RoomID);
if (room == null)
return;
Protobuf_Room_Update_RESP resp = new Protobuf_Room_Update_RESP()
{
UpdateType = type,
RoomMiniInfo = GetProtoDataRoom(room)
};
AppSrv.g_ClientMgr.ClientSendALL((int)CommandID.CmdRoomListUpdate, (int)ErrorCode.ErrorOk, ProtoBufHelper.Serizlize(resp));
}
public void OnCmdRoomCreate(Socket sk, byte[] reqData)
{
AppSrv.g_Log.Debug($"OnCmdRoomCreate ");
ClientInfo _c = AppSrv.g_ClientMgr.GetClientForSocket(sk);
Protobuf_Room_Create msg = ProtoBufHelper.DeSerizlize<Protobuf_Room_Create>(reqData);
Data_RoomData newRoom = new Data_RoomData();
newRoom.Init(GetNewRoomID(), msg.GameRomID,msg.GameRomHash);
AddRoom(newRoom);
//加入
if (!Join(newRoom.GameRomID, 0, _c, out ErrorCode joinErrcode))
{
AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomCreate, (int)joinErrcode, new byte[1]);
return;
}
//创建成功下行
Protobuf_Room_Create_RESP resp = new Protobuf_Room_Create_RESP()
{
RoomMiniInfo = GetProtoDataRoom(newRoom)
};
AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomCreate, (int)ErrorCode.ErrorOk, ProtoBufHelper.Serizlize(resp));
}
public void OnCmdRoomJoin(Socket sk, byte[] reqData)
{
AppSrv.g_Log.Debug($"OnCmdRoomJoin ");
ClientInfo _c = AppSrv.g_ClientMgr.GetClientForSocket(sk);
Protobuf_Room_Join msg = ProtoBufHelper.DeSerizlize<Protobuf_Room_Join>(reqData);
//加入
if (!Join(msg.RoomID, msg.PlayerNum, _c, out ErrorCode joinErrcode))
{
AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomJoin, (int)joinErrcode, new byte[1]);
return;
}
Data_RoomData roomData = GetRoomData(msg.RoomID);
//创建成功下行
Protobuf_Room_Join_RESP resp = new Protobuf_Room_Join_RESP()
{
RoomMiniInfo = GetProtoDataRoom(roomData)
};
AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomJoin, (int)ErrorCode.ErrorOk, ProtoBufHelper.Serizlize(resp));
Protobuf_Room_MyRoom_State_Change(msg.RoomID);
}
public void OnCmdRoomLeave(Socket sk, byte[] reqData)
{
AppSrv.g_Log.Debug($"OnCmdRoomJoin ");
ClientInfo _c = AppSrv.g_ClientMgr.GetClientForSocket(sk);
Protobuf_Room_Leave msg = ProtoBufHelper.DeSerizlize<Protobuf_Room_Leave>(reqData);
//加入
if (!Leave(msg.RoomID, _c, out ErrorCode joinErrcode))
{
AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomLeave, (int)joinErrcode, new byte[1]);
return;
}
//创建成功下行
Protobuf_Room_Leave_RESP resp = new Protobuf_Room_Leave_RESP()
{
RoomID = msg.RoomID,
};
AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomLeave, (int)ErrorCode.ErrorOk, ProtoBufHelper.Serizlize(resp));
Protobuf_Room_MyRoom_State_Change(msg.RoomID);
}
/// <summary>
/// 广播房间状态变化
/// </summary>
/// <param name="RoomID"></param>
public void Protobuf_Room_MyRoom_State_Change(int RoomID)
{
Data_RoomData room = GetRoomData(RoomID);
if (room == null)
return;
Protobuf_Room_MyRoom_State_Change resp = new Protobuf_Room_MyRoom_State_Change()
{
RoomMiniInfo = GetProtoDataRoom(room)
};
List<ClientInfo> userlist = room.GetAllPlayerClientList();
foreach(ClientInfo _c in userlist)
{
AppSrv.g_ClientMgr.ClientSend(_c,(int)CommandID.CmdRoomMyRoomStateChanged, (int)ErrorCode.ErrorOk, ProtoBufHelper.Serizlize(resp));
}
}
#region
/// <summary>
/// 进入房间
/// </summary>
/// <param name="RoomID"></param>
/// <param name="PlayerNum"></param>
/// <param name="_c"></param>
/// <param name="errcode"></param>
/// <returns></returns>
bool Join(int RoomID,int PlayerNum,ClientInfo _c,out ErrorCode errcode)
{
Data_RoomData room = GetRoomData(RoomID);
if (room == null)
{
errcode = ErrorCode.ErrorRoomNotFound;
return false;
}
//玩家1
if (PlayerNum == 0)
{
if (room.PlayerState != RoomPlayerState.NonePlayerState)
{
errcode = ErrorCode.ErrorRoomSlotReadlyHadPlayer;
return false;
}
room.Player1_UID = _c.UID;
}
//其他玩家
else
{
if (room.PlayerState != RoomPlayerState.OnlyP1)
{
errcode = ErrorCode.ErrorRoomSlotReadlyHadPlayer;
return false;
}
room.Player2_UID = _c.UID;
}
//广播房间
SendRoomUpdateToAll(RoomID, 0);
errcode = ErrorCode.ErrorOk;
return true;
}
/// <summary>
/// 离开房间
/// </summary>
/// <param name="RoomID"></param>
/// <param name="_c"></param>
/// <param name="errcode"></param>
/// <returns></returns>
bool Leave(int RoomID, ClientInfo _c, out ErrorCode errcode)
{
Data_RoomData room = GetRoomData(RoomID);
if (room == null)
{
errcode = ErrorCode.ErrorRoomNotFound;
return false;
}
if (room.Player1_UID == _c.UID)
room.Player1_UID = -1;
if (room.Player2_UID == _c.UID)
room.Player2_UID = -1;
if (room.PlayerState == RoomPlayerState.NonePlayerState)
{
SendRoomUpdateToAll(RoomID, 1);
RemoveRoom(RoomID);
}
else
{
//广播房间变化
SendRoomUpdateToAll(RoomID, 0);
}
errcode = ErrorCode.ErrorOk;
return true;
}
#endregion
}
public class Data_RoomData
{
public int RoomID;
public int GameRomID;
public string RomHash;
public long Player1_UID;
public long Player2_UID;
public RoomPlayerState PlayerState => getPlayerState();
public RoomGameState GameState;
public void Init(int roomID,int gameRomID,string roomHash)
{
RoomID = roomID;
GameRomID = gameRomID;
RomHash = roomHash;
Player1_UID = -1;
Player2_UID = -1;
GameState = RoomGameState.NoneGameState;
}
RoomPlayerState getPlayerState()
{
if (Player1_UID < 0 && Player2_UID < 0)
return RoomPlayerState.NonePlayerState;
if (Player1_UID < 0)
return RoomPlayerState.OnlyP2;
if (Player2_UID < 0)
return RoomPlayerState.OnlyP1;
return RoomPlayerState.BothOnline;
}
public List<long> GetAllPlayerUIDs()
{
List<long> list = new List<long>();
if (Player1_UID > 0) list.Add(Player1_UID);
if (Player2_UID > 0) list.Add(Player2_UID);
return list;
}
public List<ClientInfo> GetAllPlayerClientList()
{
List<ClientInfo> list = new List<ClientInfo>();
List<long> Uids = GetAllPlayerUIDs();
foreach (long uid in Uids)
{
if (!AppSrv.g_ClientMgr.GetClientByUID(uid, out ClientInfo _c,true))
continue;
list.Add(_c);
}
return list;
}
}
}

View File

@ -32,7 +32,7 @@ namespace AxibugEmuOnline.Server.NetWork
public void DataCallBack(Socket sk, int CMDID, byte[] data)
{
//ServerManager.g_Log.Debug("收到消息 CMDID =>" + CMDID + " 数据长度=>" + data.Length);
//AppSrv.g_Log.Debug("收到消息 CMDID =>" + CMDID + " 数据长度=>" + data.Length);
try
{
//抛出网络数据
@ -51,12 +51,12 @@ namespace AxibugEmuOnline.Server.NetWork
public void OnDisconnect(AsyncUserToken token)
{
Console.WriteLine("断开连接");
ServerManager.g_ClientMgr.SetClientOfflineForSocket(token.Socket);
AppSrv.g_ClientMgr.SetClientOfflineForSocket(token.Socket);
}
public void OnShowNetLog(string msg)
{
ServerManager.g_Log.Debug(msg);
AppSrv.g_Log.Debug(msg);
}
}

View File

@ -68,7 +68,7 @@ namespace AxibugEmuOnline.Server.NetWork
}
catch (Exception e)
{
ServerManager.g_Log.Error(e.Message);
AppSrv.g_Log.Error(e.Message);
}
}
}

View File

@ -7,7 +7,7 @@
{
Console.ForegroundColor = ConsoleColor.Green;
Console.Title = Title;
ServerManager.InitServer(10492);
AppSrv.InitServer(10492);
while (true)
{
Console.ReadLine();

View File

@ -12,5 +12,5 @@ for /f "delims=" %%i in ('dir /b proto "proto/*.proto"') do (
echo "==>>build finish"
echo "==>>copy cs"
::copy %cd%\out\CS\ ..\AxibugEmuOnline.Server\AxibugEmuOnline.Server\Protobuf
copy %cd%\out\CS\ ..\AxibugEmuOnline.Server\AxibugEmuOnline.Server\Protobuf
pause

File diff suppressed because it is too large Load Diff

View File

@ -10,18 +10,21 @@ enum CommandID
CMD_CHATMSG = 4001; //广 | Protobuf_ChatMsg | Protobuf_ChatMsg_RESP
//
//
CMD_Room_List = 5001; // | Protobuf_Room_List | Protobuf_Room_List_RESP
CMD_Room_List_Update = 5002; // Protobuf_Room_Update_RESP
CMD_Room_List_Update = 5002; // Protobuf_Room_Update_RESP
CMD_Room_Create = 5003; // Protobuf_Room_Create
//
CMD_Room_Create = 5101; // Protobuf_Room_Create | Protobuf_Room_Create_RESP
CMD_Room_Leave = 5004; // Protobuf_Room_Leave
CMD_Room_Join = 5105; // Protobuf_Room_Join | Protobuf_Room_Join_RESP
CMD_Room_Join = 5005; // Protobuf_Room_Join
CMD_Room_Leave = 5106; // Protobuf_Room_Leave | Protobuf_Room_Leave_RESP
//
CMD_Room_MyRoom_State_Changed = 5110; // Protobuf_Room_MyRoom_State_Change;
//
CMD_Screen = 6001; // | 广 Protobuf_Screnn_Frame
}
@ -29,6 +32,9 @@ enum ErrorCode
{
ERROR_DEFAUL = 0;//使
ERROR_OK = 1; //
ERROR_ROOM_NOT_FOUND = 10;//
ERROR_ROOM_SLOT_READLY_HAD_PLAYER=11;//
}
enum LoginType
@ -47,7 +53,7 @@ enum DeviceType
enum RoomPlayerState
{
None = 0;//
None_PlayerState = 0;//
OnlyP1 = 1; //P1
OnlyP2 = 2; //P2
BothOnline = 3; //
@ -55,7 +61,7 @@ enum RoomPlayerState
enum RoomGameState
{
None = 0;//
None_GameState = 0;//
InGame = 1;//
Pause = 2;//
}
@ -116,19 +122,21 @@ message Protobuf_Room_List_RESP
message Protobuf_Room_MiniInfo
{
int32 RoomID = 1;//ID
int32 GameID = 2;//ID
RoomPlayerState PlayerState = 3;//
RoomGameState GameState = 4;//
int32 ObsUserCount = 5;//
int64 Player1_UID = 6;//1 UID
string Player1_NickName = 7;//1
int64 Player2_UID = 8;//2 UID
string Player2_NickName = 9;//2
int32 GameRomID = 2;//ID
string GameRomHash = 3;
RoomPlayerState PlayerState = 4;//
RoomGameState GameState = 5;//
int32 ObsUserCount = 6;//
int64 Player1_UID = 7;//1 UID
string Player1_NickName = 8;//1
int64 Player2_UID = 9;//2 UID
string Player2_NickName = 10;//2
}
message Protobuf_Room_Update_RESP
{
Protobuf_Room_MiniInfo RoomMiniInfo = 1;//
int32 UpdateType = 1;//[0] [1]
Protobuf_Room_MiniInfo RoomMiniInfo = 2;//
}
message Protobuf_Screnn_Frame
@ -136,4 +144,41 @@ message Protobuf_Screnn_Frame
int32 RoomID = 1;//ID
int32 FrameID = 2;//
bytes RawBitmap = 3;//
}
message Protobuf_Room_Create
{
int32 GameRomID = 1;
string GameRomHash = 2;
}
message Protobuf_Room_Create_RESP
{
Protobuf_Room_MiniInfo RoomMiniInfo = 1;//
}
message Protobuf_Room_Join
{
int32 RoomID = 1;//ID
int32 PlayerNum = 2;// [0]1 [1]2
}
message Protobuf_Room_Join_RESP
{
Protobuf_Room_MiniInfo RoomMiniInfo = 1;//
}
message Protobuf_Room_Leave
{
int32 RoomID = 1;//ID
}
message Protobuf_Room_Leave_RESP
{
int32 RoomID = 1;//ID
}
message Protobuf_Room_MyRoom_State_Change
{
Protobuf_Room_MiniInfo RoomMiniInfo = 1;//
}