예제 #1
0
        protected override bool Process(GameClient sender, SetChannelMessageClient message)
        {
            // Figure out if the client does not know which channel to select.
            if (message.Channel == ChannelType.None || message.Channel == ChannelType.None2)
            {
                message.Channel = Channels.AiConfig != AiServerType.AiOnly
                    ? ChannelType.CQC
                    : ChannelType.Ai;
            }

            // Find target channel.
            var targetChannel = Channels.Get(message.Channel);

            if (targetChannel == null)
            {
                return(false);
            }

            // Remove from current channel if set.
            sender.Channel?.Remove(sender);

            if (!targetChannel.Add(sender))
            {
                return(false);
            }

            sender.Send(SetChannelResponseBuilder.Build(sender));

            var roomList = sender.Channel.RoomsOnPage(0, false);

            sender.Send(RoomListBuilder.Build(sender, 0, false, roomList));

            return(true);
        }
예제 #2
0
        protected override bool Process(GameClient sender, RoomListMessageClient message)
        {
            if (sender.Channel == null)
            {
                return(true); // Ignore
            }
            var roomList = sender.Channel.RoomsOnPage(message.Page, message.WaitingOnly);

            sender.Send(RoomListBuilder.Build(sender, message.Page, message.WaitingOnly, roomList));

            return(true);
        }