feat : 세션 끊길때 같은 채널에 나가는 메시지 보냄

This commit is contained in:
qornwh1
2026-03-05 17:04:50 +09:00
parent c27e8464b4
commit 85c3276207

View File

@@ -147,10 +147,22 @@ public class GameServer : ServerBase
protected override void OnSessionDisconnected(NetPeer peer, long hashKey, DisconnectInfo info)
{
ChannelManager cm = ChannelManager.Instance;
// 제거 전에 채널/플레이어 정보 저장 (브로드캐스트에 필요)
int channelId = cm.HasUser(hashKey);
Player? player = channelId >= 0 ? cm.GetChannel(channelId).GetPlayer(hashKey) : null;
if (cm.RemoveUser(hashKey))
{
Log.Information("[GameServer] 세션 해제 HashKey={Key} Reason={Reason}", hashKey, info.Reason);
// 같은 채널 유저들에게 나갔다고 알림
if (channelId >= 0 && player != null)
{
SendExitChannelPacket(peer, hashKey, channelId, player);
}
}
UuidGeneratorManager.Instance.Release(hashKey);
}