feat : 파티 패킷 추가 / 채널 접속시 모든 파티 리스트 전달
This commit is contained in:
@@ -541,6 +541,44 @@ public class ErrorPacket
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// 파티
|
||||
// ============================================================
|
||||
|
||||
public enum PartyUpdateType
|
||||
{
|
||||
CREATE,
|
||||
DELETE,
|
||||
JOIN,
|
||||
LEAVE
|
||||
}
|
||||
|
||||
// REQUEST_PARTY (클라 -> 서버) - CREATE: PartyName 사용 / JOIN·LEAVE·DELETE: PartyId 사용
|
||||
[ProtoContract]
|
||||
public class RequestPartyPacket
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public PartyUpdateType Type
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[ProtoMember(2)]
|
||||
public int PartyId
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} // JOIN, LEAVE, DELETE 시 사용
|
||||
|
||||
[ProtoMember(3)]
|
||||
public string PartyName
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} // CREATE 시 사용
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// 채팅
|
||||
// ============================================================
|
||||
@@ -598,40 +636,6 @@ public class ChatPacket
|
||||
// 파티
|
||||
// ============================================================
|
||||
|
||||
public enum PartyUpdateType
|
||||
{
|
||||
CREATE,
|
||||
DELETE,
|
||||
JOIN,
|
||||
LEAVE
|
||||
}
|
||||
|
||||
// REQUEST_PARTY (클라 -> 서버) - CREATE: PartyName 사용 / JOIN·LEAVE·DELETE: PartyId 사용
|
||||
[ProtoContract]
|
||||
public class RequestPartyPacket
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public PartyUpdateType Type
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[ProtoMember(2)]
|
||||
public int PartyId
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} // JOIN, LEAVE, DELETE 시 사용
|
||||
|
||||
[ProtoMember(3)]
|
||||
public string PartyName
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} // CREATE 시 사용
|
||||
}
|
||||
|
||||
// UPDATE_PARTY (서버 -> 클라) - 파티 생성/삭제: LeaderId 사용 / 파티원 추가/제거: PlayerId 사용
|
||||
[ProtoContract]
|
||||
public class UpdatePartyPacket
|
||||
|
||||
@@ -251,7 +251,7 @@ public class GameServer : ServerBase
|
||||
Channel.Channel channel = cm.GetChannel(channelId);
|
||||
Player? myPlayer = channel.GetPlayer(hashKey);
|
||||
|
||||
// 1. 새 유저에게: 자신을 제외한 기존 채널 유저 목록 전송
|
||||
// 1. 새 유저에게: 자신을 제외한 기존 채널 유저 목록 + 파티 목록 전송
|
||||
IntoChannelPacket response = new IntoChannelPacket { ChannelId = channelId };
|
||||
foreach (int userId in channel.GetConnectUsers())
|
||||
{
|
||||
@@ -267,6 +267,16 @@ public class GameServer : ServerBase
|
||||
}
|
||||
}
|
||||
|
||||
foreach (PartyInfo party in channel.GetPartyManager().GetAllParties())
|
||||
{
|
||||
response.Parties.Add(new PartyInfoData
|
||||
{
|
||||
PartyId = party.PartyId,
|
||||
LeaderId = party.LeaderId,
|
||||
MemberPlayerIds = new List<int>(party.PartyMemberIds),
|
||||
});
|
||||
}
|
||||
|
||||
byte[] toNewUser = PacketSerializer.Serialize<IntoChannelPacket>((ushort)PacketCode.INTO_CHANNEL, response);
|
||||
SendTo(peer, toNewUser);
|
||||
|
||||
|
||||
@@ -119,6 +119,12 @@ public class PartyManager
|
||||
return true;
|
||||
}
|
||||
|
||||
// 전체 파티 목록 조회
|
||||
public IEnumerable<PartyInfo> GetAllParties()
|
||||
{
|
||||
return parties.Values;
|
||||
}
|
||||
|
||||
// 조회
|
||||
public PartyInfo? GetParty(int partyId)
|
||||
{
|
||||
|
||||
@@ -210,6 +210,32 @@ public class LoadChannelPacket
|
||||
} = 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 / 서버->클라: 채널 내 나 이외 플레이어 목록
|
||||
[ProtoContract]
|
||||
public class IntoChannelPacket
|
||||
@@ -227,6 +253,13 @@ public class IntoChannelPacket
|
||||
get;
|
||||
set;
|
||||
} = new List<PlayerInfo>(); // 서버->클라: 채널 내 플레이어 목록
|
||||
|
||||
[ProtoMember(3)]
|
||||
public List<PartyInfoData> Parties
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = new List<PartyInfoData>(); // 서버->클라: 채널 내 파티 목록
|
||||
}
|
||||
|
||||
// UPDATE_CHANNEL_USER 유저 접속/나감
|
||||
|
||||
Reference in New Issue
Block a user