feat : 파티 정보 업데이트 기능 추가
This commit is contained in:
@@ -210,6 +210,32 @@ public class LoadChannelPacket
|
|||||||
} = new List<ChannelInfo>();
|
} = new List<ChannelInfo>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 채널 내 파티 정보 (INTO_CHANNEL 응답에 포함)
|
||||||
|
[ProtoContract]
|
||||||
|
public class PartyInfoData
|
||||||
|
{
|
||||||
|
[ProtoMember(1)]
|
||||||
|
public int PartyId
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
[ProtoMember(2)]
|
||||||
|
public int LeaderId
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
[ProtoMember(3)]
|
||||||
|
public List<int> MemberPlayerIds
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
} = new List<int>();
|
||||||
|
}
|
||||||
|
|
||||||
// INTO_CHANNEL 클라->서버: 입장할 채널 ID / 서버->클라: 채널 내 나 이외 플레이어 목록
|
// INTO_CHANNEL 클라->서버: 입장할 채널 ID / 서버->클라: 채널 내 나 이외 플레이어 목록
|
||||||
[ProtoContract]
|
[ProtoContract]
|
||||||
public class IntoChannelPacket
|
public class IntoChannelPacket
|
||||||
@@ -227,6 +253,13 @@ public class IntoChannelPacket
|
|||||||
get;
|
get;
|
||||||
set;
|
set;
|
||||||
} = new List<PlayerInfo>(); // 서버->클라: 채널 내 플레이어 목록
|
} = new List<PlayerInfo>(); // 서버->클라: 채널 내 플레이어 목록
|
||||||
|
|
||||||
|
[ProtoMember(3)]
|
||||||
|
public List<PartyInfoData> Parties
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
} = new List<PartyInfoData>(); // 서버->클라: 채널 내 파티 목록
|
||||||
}
|
}
|
||||||
|
|
||||||
// UPDATE_CHANNEL_USER 유저 접속/나감
|
// UPDATE_CHANNEL_USER 유저 접속/나감
|
||||||
|
|||||||
@@ -584,6 +584,28 @@ public class GameServer : ServerBase
|
|||||||
BroadcastToUsers(party.PartyMemberIds, data); // 전원 (리더 포함)
|
BroadcastToUsers(party.PartyMemberIds, data); // 전원 (리더 포함)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case PartyUpdateType.UPDATE:
|
||||||
|
{
|
||||||
|
if (!pm.UpdateParty(hashKey, req.PartyId, out PartyInfo? party))
|
||||||
|
{
|
||||||
|
SendError(peer, ErrorCode.PARTY_UPDATE_FAILED);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdatePartyPacket notify = new UpdatePartyPacket
|
||||||
|
{
|
||||||
|
PartyId = req.PartyId,
|
||||||
|
Type = PartyUpdateType.LEAVE,
|
||||||
|
LeaderId = party?.LeaderId ?? 0,
|
||||||
|
PlayerId = hashKey,
|
||||||
|
};
|
||||||
|
byte[] data = PacketSerializer.Serialize<UpdatePartyPacket>((ushort)PacketCode.UPDATE_PARTY, notify);
|
||||||
|
if (party != null)
|
||||||
|
{
|
||||||
|
BroadcastToUsers(party.PartyMemberIds, data); // 남은 멤버들에게
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -119,6 +119,27 @@ public class PartyManager
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 파티 업데이트
|
||||||
|
public bool UpdateParty(int leaderId, int partyId, out PartyInfo? party)
|
||||||
|
{
|
||||||
|
party = null;
|
||||||
|
|
||||||
|
if (!parties.TryGetValue(partyId, out party))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (party.LeaderId != leaderId)
|
||||||
|
{
|
||||||
|
party = null;
|
||||||
|
return false; // 리더만 업데이트 가능
|
||||||
|
}
|
||||||
|
|
||||||
|
// 파티 이름 변경
|
||||||
|
party.PartyName = party.PartyName;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// 전체 파티 목록 조회
|
// 전체 파티 목록 조회
|
||||||
public IEnumerable<PartyInfo> GetAllParties()
|
public IEnumerable<PartyInfo> GetAllParties()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -560,6 +560,7 @@ public enum ErrorCode : int
|
|||||||
PARTY_JOIN_FAILED = 10022,
|
PARTY_JOIN_FAILED = 10022,
|
||||||
PARTY_NOT_IN_PARTY = 10023,
|
PARTY_NOT_IN_PARTY = 10023,
|
||||||
PARTY_DELETE_FAILED = 10024,
|
PARTY_DELETE_FAILED = 10024,
|
||||||
|
PARTY_UPDATE_FAILED = 10025,
|
||||||
}
|
}
|
||||||
|
|
||||||
// ERROR (서버 -> 클라)
|
// ERROR (서버 -> 클라)
|
||||||
@@ -583,7 +584,8 @@ public enum PartyUpdateType
|
|||||||
CREATE,
|
CREATE,
|
||||||
DELETE,
|
DELETE,
|
||||||
JOIN,
|
JOIN,
|
||||||
LEAVE
|
LEAVE,
|
||||||
|
UPDATE
|
||||||
}
|
}
|
||||||
|
|
||||||
// REQUEST_PARTY (클라 -> 서버) - CREATE: PartyName 사용 / JOIN·LEAVE·DELETE: PartyId 사용
|
// REQUEST_PARTY (클라 -> 서버) - CREATE: PartyName 사용 / JOIN·LEAVE·DELETE: PartyId 사용
|
||||||
|
|||||||
Reference in New Issue
Block a user