using MMOserver.Game.Channel.Maps; namespace MMOserver.Game.Channel; public class Channel { // 로비 private Robby robby = new Robby(); // 채널 내 유저 상태 (hashKey → Player) private Dictionary connectUsers = new Dictionary(); public int ChannelId { get; private set; } public int UserCount { get; private set; } public int UserCountMax { get; private set; } = 100; public Channel(int channelId) { ChannelId = channelId; } public void AddUser(long userId, Player player) { connectUsers[userId] = player; UserCount++; } public void RemoveUser(long userId) { connectUsers.Remove(userId); UserCount--; } // 채널 내 모든 유저의 hashKey 반환 public IEnumerable GetConnectUsers() { return connectUsers.Keys; } // 채널 내 모든 Player 반환 public IEnumerable GetPlayers() { return connectUsers.Values; } // 특정 유저의 Player 반환 public Player? GetPlayer(long userId) { connectUsers.TryGetValue(userId, out Player? player); return player; } public int HasUser(long userId) { if (connectUsers.ContainsKey(userId)) { return ChannelId; } return -1; } // 로비 가져옴 public Robby GetRobby() { return robby; } }