feat : 보스전 채널 생성, 파티 함께 채널 이동 구현
This commit is contained in:
@@ -6,7 +6,11 @@ namespace MMOserver.Game.Channel;
|
||||
public class ChannelManager : Singleton<ChannelManager>
|
||||
{
|
||||
// 채널 관리
|
||||
private List<Channel> channels = new List<Channel>();
|
||||
private Dictionary<int, Channel> channels = new Dictionary<int, Channel>();
|
||||
|
||||
// 보스 레이드 채널
|
||||
private readonly int bossChannelStart = 10000;
|
||||
private readonly int bossChannelSize = 10;
|
||||
|
||||
// 채널별 유저 관리 (유저 key, 채널 val)
|
||||
private Dictionary<int, int> connectUsers = new Dictionary<int, int>();
|
||||
@@ -18,9 +22,16 @@ public class ChannelManager : Singleton<ChannelManager>
|
||||
|
||||
public void Initializer(int channelSize = 1)
|
||||
{
|
||||
for (int i = 0; i <= channelSize; i++)
|
||||
for (int i = 1; i <= channelSize; i++)
|
||||
{
|
||||
channels.Add(new Channel(i));
|
||||
channels.Add(i, new Channel(i));
|
||||
}
|
||||
|
||||
// 보스 채널 생성
|
||||
for (int i = 1; i <= bossChannelSize; i++)
|
||||
{
|
||||
int bossChannel = i + bossChannelStart;
|
||||
channels.Add(bossChannel, new Channel(bossChannel));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,15 +40,15 @@ public class ChannelManager : Singleton<ChannelManager>
|
||||
return channels[channelId];
|
||||
}
|
||||
|
||||
public List<Channel> GetChannels()
|
||||
public Dictionary<int, Channel> GetChannels()
|
||||
{
|
||||
return channels;
|
||||
}
|
||||
|
||||
public void AddUser(int channelId, int userId, Player player, NetPeer peer)
|
||||
{
|
||||
// 유저 추가
|
||||
connectUsers.Add(userId, channelId);
|
||||
// 유저 추가 (채널 이동 시 기존 매핑 덮어쓰기 허용)
|
||||
connectUsers[userId] = channelId;
|
||||
// 채널에 유저 + peer 추가
|
||||
channels[channelId].AddUser(userId, player, peer);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user