完善 服务器 玩家更换slotidx
This commit is contained in:
parent
3bbc24fc91
commit
51a4419d25
@ -373,10 +373,12 @@ namespace AxibugEmuOnline.Server
|
|||||||
ErrorCode errcode = ErrorCode.ErrorOk;
|
ErrorCode errcode = ErrorCode.ErrorOk;
|
||||||
Data_RoomData room = GetRoomData(_c.RoomState.RoomID);
|
Data_RoomData room = GetRoomData(_c.RoomState.RoomID);
|
||||||
if (room == null)
|
if (room == null)
|
||||||
errcode = ErrorCode.ErrorRoomNotFound;
|
|
||||||
|
|
||||||
if (errcode == ErrorCode.ErrorOk)
|
|
||||||
{
|
{
|
||||||
|
errcode = ErrorCode.ErrorRoomNotFound;
|
||||||
|
AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomChangePlayerWithJoy, (int)errcode, ProtoBufHelper.Serizlize(resp));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Dictionary<uint, uint> newSlotIdx2JoyIdx = new Dictionary<uint, uint>();
|
Dictionary<uint, uint> newSlotIdx2JoyIdx = new Dictionary<uint, uint>();
|
||||||
foreach (var slotinfo in msg.SlotWithJoy)
|
foreach (var slotinfo in msg.SlotWithJoy)
|
||||||
{
|
{
|
||||||
@ -384,16 +386,20 @@ namespace AxibugEmuOnline.Server
|
|||||||
if (room.GetPlayerUIDByIdx((uint)slotinfo.PlayerSlotIdx, out long UID))
|
if (room.GetPlayerUIDByIdx((uint)slotinfo.PlayerSlotIdx, out long UID))
|
||||||
{
|
{
|
||||||
//且人不是自己,则不允许换位
|
//且人不是自己,则不允许换位
|
||||||
if(UID != _c.UID)
|
if (UID != _c.UID)
|
||||||
errcode = ErrorCode.ErrorRoomSlotAlreadlyHadPlayer; break;
|
{
|
||||||
|
errcode = ErrorCode.ErrorRoomSlotAlreadlyHadPlayer;
|
||||||
|
AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomChangePlayerWithJoy, (int)errcode, ProtoBufHelper.Serizlize(resp));
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
newSlotIdx2JoyIdx[(uint)slotinfo.PlayerSlotIdx] = (uint)slotinfo.PlayerLocalJoyIdx;
|
newSlotIdx2JoyIdx[(uint)slotinfo.PlayerSlotIdx] = (uint)slotinfo.PlayerLocalJoyIdx;
|
||||||
}
|
}
|
||||||
|
room.SetPlayerSlotData(_c, ref newSlotIdx2JoyIdx);
|
||||||
|
|
||||||
room.SetPlayerSlotData(_c,ref newSlotIdx2JoyIdx);
|
AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomChangePlayerWithJoy, (int)errcode, ProtoBufHelper.Serizlize(resp));
|
||||||
}
|
|
||||||
AppSrv.g_ClientMgr.ClientSend(_c, (int)CommandID.CmdRoomMyRoomStateChanged, (int)errcode, ProtoBufHelper.Serizlize(resp));
|
Protobuf_Room_MyRoom_State_Change(room.RoomID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnHostPlayerUpdateStateRaw(Socket sk, byte[] reqData)
|
public void OnHostPlayerUpdateStateRaw(Socket sk, byte[] reqData)
|
||||||
|
Loading…
Reference in New Issue
Block a user