This commit is contained in:
ALIENJACK\alien 2024-09-14 09:47:00 +08:00
commit 2771e887e1
4 changed files with 59 additions and 8 deletions

View File

@ -45,7 +45,23 @@ namespace AxibugEmuOnline.Client.Manager
{ {
App.log.Info("登录失败"); App.log.Info("登录失败");
} }
#if UNITY_EDITOR
//TestCreate();
#endif
} }
#region
void TestCreate()
{
App.roomMgr.SendCreateRoom(1, 0, string.Empty);
}
long TestFrameID = 0;
void TestEmuUpdate()
{
}
#endregion
} }
} }

View File

@ -123,6 +123,7 @@ namespace AxibugEmuOnline.Server.Manager
UID = GetNextUID(), UID = GetNextUID(),
_socket = _socket, _socket = _socket,
Account = data.Account, Account = data.Account,
NickName = data.Account,
IsOffline = false, IsOffline = false,
}; };
AddClient(cinfo); AddClient(cinfo);
@ -241,7 +242,7 @@ namespace AxibugEmuOnline.Server.Manager
while (true) while (true)
{ {
pingTickARE.WaitOne(); pingTickARE.WaitOne();
AppSrv.g_Log.Info("PingAll"); //AppSrv.g_Log.Info("PingAll");
PingAll(); PingAll();
} }
} }
@ -263,7 +264,7 @@ namespace AxibugEmuOnline.Server.Manager
} }
public void OnCmdPing(Socket sk, byte[] reqData) public void OnCmdPing(Socket sk, byte[] reqData)
{ {
AppSrv.g_Log.Debug($"OnCmdPing"); //AppSrv.g_Log.Debug($"OnCmdPing");
ClientInfo _c = AppSrv.g_ClientMgr.GetClientForSocket(sk); ClientInfo _c = AppSrv.g_ClientMgr.GetClientForSocket(sk);
Protobuf_Ping msg = ProtoBufHelper.DeSerizlize<Protobuf_Ping>(reqData); Protobuf_Ping msg = ProtoBufHelper.DeSerizlize<Protobuf_Ping>(reqData);
@ -276,7 +277,7 @@ namespace AxibugEmuOnline.Server.Manager
} }
public void OnCmdPong(Socket sk, byte[] reqData) public void OnCmdPong(Socket sk, byte[] reqData)
{ {
AppSrv.g_Log.Debug($"OnCmdPong"); //AppSrv.g_Log.Debug($"OnCmdPong");
ClientInfo _c = AppSrv.g_ClientMgr.GetClientForSocket(sk); ClientInfo _c = AppSrv.g_ClientMgr.GetClientForSocket(sk);
Protobuf_Pong msg = ProtoBufHelper.DeSerizlize<Protobuf_Pong>(reqData); Protobuf_Pong msg = ProtoBufHelper.DeSerizlize<Protobuf_Pong>(reqData);

View File

@ -49,7 +49,7 @@ namespace AxibugEmuOnline.Server
if (!mDictRoom.ContainsKey(data.RoomID)) if (!mDictRoom.ContainsKey(data.RoomID))
{ {
mDictRoom.Add(data.RoomID, data); mDictRoom.Add(data.RoomID, data);
mKeyRoomList.Remove(data.RoomID); mKeyRoomList.Add(data.RoomID);
} }
} }
} }
@ -73,7 +73,7 @@ namespace AxibugEmuOnline.Server
return data; return data;
} }
List<Data_RoomData> GetRoomList() public List<Data_RoomData> GetRoomList()
{ {
lock (mDictRoom) lock (mDictRoom)
{ {
@ -461,7 +461,7 @@ namespace AxibugEmuOnline.Server
case 2: oldUID = Player3_UID; Player3_UID = _c.UID; break; case 2: oldUID = Player3_UID; Player3_UID = _c.UID; break;
case 3: oldUID = Player4_UID; Player4_UID = _c.UID; break; case 3: oldUID = Player4_UID; Player4_UID = _c.UID; break;
} }
if (oldUID <= 0) if (oldUID >= 0)
SynUIDs.Remove(oldUID); SynUIDs.Remove(oldUID);
SynUIDs.Add(_c.UID); SynUIDs.Add(_c.UID);
_c.RoomState.SetRoomData(this.RoomID, PlayerIdx); _c.RoomState.SetRoomData(this.RoomID, PlayerIdx);
@ -491,15 +491,15 @@ namespace AxibugEmuOnline.Server
public bool GetPlayerUIDByIdx(int Idx, out long UID) public bool GetPlayerUIDByIdx(int Idx, out long UID)
{ {
UID = -1;
switch (Idx) switch (Idx)
{ {
case 0: UID = Player1_UID; break; case 0: UID = Player1_UID; break;
case 1: UID = Player2_UID; break; case 1: UID = Player2_UID; break;
case 2: UID = Player3_UID; break; case 2: UID = Player3_UID; break;
case 3: UID = Player4_UID; break; case 3: UID = Player4_UID; break;
default: UID = -1; break;
} }
return UID != 0; return UID > 0;
} }
public bool GetPlayerClientByIdx(int Idx, out ClientInfo _c) public bool GetPlayerClientByIdx(int Idx, out ClientInfo _c)
{ {

View File

@ -17,6 +17,40 @@ namespace AxibugEmuOnline.Server
Command = ((CommandStr.IndexOf(" ") <= 0) ? CommandStr : CommandStr.Substring(0, CommandStr.IndexOf(" "))); Command = ((CommandStr.IndexOf(" ") <= 0) ? CommandStr : CommandStr.Substring(0, CommandStr.IndexOf(" ")));
switch (Command) switch (Command)
{ {
case "rlist":
{
var roomlist = AppSrv.g_Room.GetRoomList();
AppSrv.g_Log.Info($"RoomCount:{roomlist.Count}");
foreach (var room in roomlist)
{
AppSrv.g_Log.Info($"----- RoomID:{room.RoomID} -----");
AppSrv.g_Log.Info($"GameRomID:{room.GameRomID}");
AppSrv.g_Log.Info($"GameState:{room.GameState}");
AppSrv.g_Log.Info($"HostUID:{room.HostUID}");
AppSrv.g_Log.Info($"mCurrFrameId:{room.mCurrFrameId}");
AppSrv.g_Log.Info($"input all:{room.mCurrInputData.all}");
AppSrv.g_Log.Info($"input p1:{room.mCurrInputData.p1}");
AppSrv.g_Log.Info($"input p2:{room.mCurrInputData.p2}");
AppSrv.g_Log.Info($"input p3:{room.mCurrInputData.p3}");
AppSrv.g_Log.Info($"input p4:{room.mCurrInputData.p4}");
AppSrv.g_Log.Info($"GetPlayerCount:{room.GetPlayerCount()}");
for (int i = 0; i < 4; i++)
{
AppSrv.g_Log.Info($" P{i}");
if (room.GetPlayerClientByIdx(i, out ClientInfo _c))
{
AppSrv.g_Log.Info($" UID->{_c.UID}");
AppSrv.g_Log.Info($" NickName->{_c.NickName}");
AppSrv.g_Log.Info($" AveNetDelay->{_c.AveNetDelay}");
}
else
{
AppSrv.g_Log.Info($" None");
}
}
}
}
break;
case "list": case "list":
{ {
AppSrv.g_Log.Info("当前在线:" + AppSrv.g_ClientMgr.GetOnlineClient()); AppSrv.g_Log.Info("当前在线:" + AppSrv.g_ClientMgr.GetOnlineClient());