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