feat : 서버 실패 코드 메시지 기능 추가
This commit is contained in:
@@ -484,6 +484,7 @@ public class GameServer : ServerBase
|
||||
{
|
||||
if (!pm.CreateParty(hashKey, req.PartyName, out PartyInfo? party))
|
||||
{
|
||||
SendError(peer, ErrorCode.PARTY_ALREADY_IN_PARTY);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -503,6 +504,7 @@ public class GameServer : ServerBase
|
||||
{
|
||||
if (!pm.JoinParty(hashKey, req.PartyId, out PartyInfo? party))
|
||||
{
|
||||
SendError(peer, ErrorCode.PARTY_JOIN_FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -521,6 +523,7 @@ public class GameServer : ServerBase
|
||||
{
|
||||
if (!pm.LeaveParty(hashKey, out PartyInfo? party))
|
||||
{
|
||||
SendError(peer, ErrorCode.PARTY_NOT_IN_PARTY);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -544,6 +547,7 @@ public class GameServer : ServerBase
|
||||
{
|
||||
if (!pm.DeleteParty(hashKey, req.PartyId, out PartyInfo? party))
|
||||
{
|
||||
SendError(peer, ErrorCode.PARTY_DELETE_FAILED);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -560,6 +564,13 @@ public class GameServer : ServerBase
|
||||
}
|
||||
}
|
||||
|
||||
private void SendError(NetPeer peer, ErrorCode code)
|
||||
{
|
||||
ErrorPacket err = new ErrorPacket { Code = code };
|
||||
byte[] data = PacketSerializer.Serialize<ErrorPacket>((ushort)PacketCode.ERROR, err);
|
||||
SendTo(peer, data);
|
||||
}
|
||||
|
||||
private void BroadcastToUsers(IEnumerable<int> userIds, byte[] data, DeliveryMethod method = DeliveryMethod.ReliableOrdered)
|
||||
{
|
||||
foreach (int userId in userIds)
|
||||
|
||||
Reference in New Issue
Block a user