其他玩家下线 清理其手柄位的键值

This commit is contained in:
sin365 2024-12-13 19:19:11 +08:00
parent 183ec611e1
commit 30dd2ee9aa
2 changed files with 4 additions and 16 deletions

View File

@ -103,6 +103,7 @@ namespace AxibugEmuOnline.Server.Manager
{ {
UserInfo = miniinfo, UserInfo = miniinfo,
}; };
//回执给自己 //回执给自己
AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdUpdateSelfUserInfo, (int)ErrorCode.ErrorOk, ProtoBufHelper.Serizlize(infodata)); AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdUpdateSelfUserInfo, (int)ErrorCode.ErrorOk, ProtoBufHelper.Serizlize(infodata));

View File

@ -557,7 +557,6 @@ namespace AxibugEmuOnline.Server
public Google.Protobuf.ByteString? NextStateRaw { get; private set; } public Google.Protobuf.ByteString? NextStateRaw { get; private set; }
public Google.Protobuf.ByteString? ScreenRaw { get; private set; } public Google.Protobuf.ByteString? ScreenRaw { get; private set; }
public bool[] PlayerReadyState { get; private set; } public bool[] PlayerReadyState { get; private set; }
public List<long> SynUIDs; public List<long> SynUIDs;
//public RoomPlayerState PlayerState => getPlayerState(); //public RoomPlayerState PlayerState => getPlayerState();
private RoomGameState mGameState; private RoomGameState mGameState;
@ -587,13 +586,10 @@ namespace AxibugEmuOnline.Server
} }
} }
} }
/// <summary> /// <summary>
/// 服务器提前帧数 /// 服务器提前帧数
/// </summary> /// </summary>
public uint SrvForwardFrames { get; set; } public uint SrvForwardFrames { get; set; }
bool IsAllReady() bool IsAllReady()
{ {
bool Ready = true; bool Ready = true;
@ -611,7 +607,6 @@ namespace AxibugEmuOnline.Server
} }
return Ready; return Ready;
} }
public void Init(int roomID, int gameRomID, string roomHash, long hostUId, bool bloadState = false) public void Init(int roomID, int gameRomID, string roomHash, long hostUId, bool bloadState = false)
{ {
RoomID = roomID; RoomID = roomID;
@ -630,7 +625,6 @@ namespace AxibugEmuOnline.Server
mInputQueue = new Queue<(uint, ServerInputSnapShot)>(); mInputQueue = new Queue<(uint, ServerInputSnapShot)>();
mDictPlayerIdx2SendQueue = new Dictionary<int, Queue<byte[]>>(); mDictPlayerIdx2SendQueue = new Dictionary<int, Queue<byte[]>>();
} }
public void SetPlayerUID(int PlayerIdx, ClientInfo _c) public void SetPlayerUID(int PlayerIdx, ClientInfo _c)
{ {
long oldUID = -1; long oldUID = -1;
@ -647,7 +641,6 @@ namespace AxibugEmuOnline.Server
AppSrv.g_Log.Debug($"SetPlayerUID RoomID->{RoomID} _c.UID->{_c.UID} PlayerIdx->{PlayerIdx}"); AppSrv.g_Log.Debug($"SetPlayerUID RoomID->{RoomID} _c.UID->{_c.UID} PlayerIdx->{PlayerIdx}");
_c.RoomState.SetRoomData(this.RoomID, PlayerIdx); _c.RoomState.SetRoomData(this.RoomID, PlayerIdx);
} }
public void RemovePlayer(ClientInfo _c) public void RemovePlayer(ClientInfo _c)
{ {
int PlayerIdx = GetPlayerIdx(_c); int PlayerIdx = GetPlayerIdx(_c);
@ -660,7 +653,6 @@ namespace AxibugEmuOnline.Server
} }
_c.RoomState.ClearRoomData(); _c.RoomState.ClearRoomData();
} }
int GetPlayerIdx(ClientInfo _c) int GetPlayerIdx(ClientInfo _c)
{ {
if (Player1_UID == _c.UID) return 0; if (Player1_UID == _c.UID) return 0;
@ -669,7 +661,6 @@ namespace AxibugEmuOnline.Server
if (Player4_UID == _c.UID) return 3; if (Player4_UID == _c.UID) return 3;
return -1; return -1;
} }
public bool GetPlayerUIDByIdx(int Idx, out long UID) public bool GetPlayerUIDByIdx(int Idx, out long UID)
{ {
switch (Idx) switch (Idx)
@ -693,7 +684,6 @@ namespace AxibugEmuOnline.Server
return true; return true;
} }
public List<long> GetAllPlayerUIDs() public List<long> GetAllPlayerUIDs()
{ {
List<long> list = new List<long>(); List<long> list = new List<long>();
@ -703,7 +693,6 @@ namespace AxibugEmuOnline.Server
if (Player4_UID > 0) list.Add(Player4_UID); if (Player4_UID > 0) list.Add(Player4_UID);
return list; return list;
} }
public List<ClientInfo> GetAllPlayerClientList() public List<ClientInfo> GetAllPlayerClientList()
{ {
List<ClientInfo> list = new List<ClientInfo>(); List<ClientInfo> list = new List<ClientInfo>();
@ -720,7 +709,6 @@ namespace AxibugEmuOnline.Server
return list; return list;
} }
public void SetPlayerInput(int PlayerIdx, long mFrameID, ServerInputSnapShot allinput) public void SetPlayerInput(int PlayerIdx, long mFrameID, ServerInputSnapShot allinput)
{ {
switch (PlayerIdx) switch (PlayerIdx)
@ -731,9 +719,9 @@ namespace AxibugEmuOnline.Server
case 3: mCurrInputData.p4_byte = allinput.p1_byte; break; case 3: mCurrInputData.p4_byte = allinput.p1_byte; break;
} }
} }
public void ClearPlayerInput(ClientInfo _c)
public void ClearPlayerInput(int PlayerIdx)
{ {
int PlayerIdx = GetPlayerIdx(_c);
switch (PlayerIdx) switch (PlayerIdx)
{ {
case 0: mCurrInputData.p1_byte = 0; break; case 0: mCurrInputData.p1_byte = 0; break;
@ -742,7 +730,6 @@ namespace AxibugEmuOnline.Server
case 3: mCurrInputData.p4_byte = 0; break; case 3: mCurrInputData.p4_byte = 0; break;
} }
} }
public int GetPlayerCount() public int GetPlayerCount()
{ {
int count = 0; int count = 0;
@ -752,7 +739,6 @@ namespace AxibugEmuOnline.Server
if (Player4_UID > 0) count++; if (Player4_UID > 0) count++;
return count; return count;
} }
void StartNewTick() void StartNewTick()
{ {
mInputQueue.Clear(); mInputQueue.Clear();
@ -902,6 +888,7 @@ namespace AxibugEmuOnline.Server
{ {
int oldPlayerCount = GetPlayerCount(); int oldPlayerCount = GetPlayerCount();
RemovePlayer(_c); RemovePlayer(_c);
ClearPlayerInput(_c);
int newPlayerCount = GetPlayerCount(); int newPlayerCount = GetPlayerCount();
errcode = ErrorCode.ErrorOk; errcode = ErrorCode.ErrorOk;
bHadRoomStateChange = CheckRoomStateChange(oldPlayerCount, newPlayerCount); bHadRoomStateChange = CheckRoomStateChange(oldPlayerCount, newPlayerCount);