feat : 파티매니저 채널에 종속되도록 변경

This commit is contained in:
qornwh1
2026-03-08 22:01:55 +09:00
parent a53d838e24
commit 06741f2a55
3 changed files with 23 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
using LiteNetLib; using LiteNetLib;
using MMOserver.Game.Channel.Maps; using MMOserver.Game.Channel.Maps;
using MMOserver.Game.Party;
namespace MMOserver.Game.Channel; namespace MMOserver.Game.Channel;
@@ -8,6 +9,9 @@ public class Channel
// 로비 // 로비
private Robby robby = new Robby(); private Robby robby = new Robby();
// 파티
private PartyManager partyManager = new PartyManager();
// 채널 내 유저 상태 (hashKey → Player) // 채널 내 유저 상태 (hashKey → Player)
private Dictionary<int, Player> connectUsers = new Dictionary<int, Player>(); private Dictionary<int, Player> connectUsers = new Dictionary<int, Player>();
@@ -97,4 +101,10 @@ public class Channel
{ {
return robby; return robby;
} }
// 파티매니저 가져옴
public PartyManager GetPartyManager()
{
return partyManager;
}
} }

View File

@@ -468,7 +468,15 @@ public class GameServer : ServerBase
private void OnRequestParty(NetPeer peer, int hashKey, byte[] payload) private void OnRequestParty(NetPeer peer, int hashKey, byte[] payload)
{ {
RequestPartyPacket req = Serializer.Deserialize<RequestPartyPacket>(new ReadOnlyMemory<byte>(payload)); RequestPartyPacket req = Serializer.Deserialize<RequestPartyPacket>(new ReadOnlyMemory<byte>(payload));
PartyManager pm = PartyManager.Instance;
ChannelManager cm = ChannelManager.Instance;
int channelId = cm.HasUser(hashKey);
if (channelId < 0)
{
return;
}
PartyManager pm = cm.GetChannel(channelId).GetPartyManager();
switch (req.Type) switch (req.Type)
{ {
@@ -525,7 +533,10 @@ public class GameServer : ServerBase
}; };
byte[] data = PacketSerializer.Serialize<UpdatePartyPacket>((ushort)PacketCode.UPDATE_PARTY, notify); byte[] data = PacketSerializer.Serialize<UpdatePartyPacket>((ushort)PacketCode.UPDATE_PARTY, notify);
if (party != null) if (party != null)
{
BroadcastToUsers(party.PartyMemberIds, data); // 남은 멤버들에게 BroadcastToUsers(party.PartyMemberIds, data); // 남은 멤버들에게
}
SendTo(peer, data); // 탈퇴자 본인에게 SendTo(peer, data); // 탈퇴자 본인에게
break; break;
} }

View File

@@ -2,7 +2,7 @@ using MMOserver.Utils;
namespace MMOserver.Game.Party; namespace MMOserver.Game.Party;
public class PartyManager : Singleton<PartyManager> public class PartyManager
{ {
private readonly UuidGenerator partyUuidGenerator = new UuidGenerator(); private readonly UuidGenerator partyUuidGenerator = new UuidGenerator();