public async Task OnMessage(ClientConnection connection, object requestData)
        {
            var request = (JoinMatchmakingQueueRequest)requestData;
            await connection.SendMessage(new JoinMatchmakingQueueResponse()
            {
                ResponseId = request.RequestId
            });

            MatchmakingQueueAssignmentNotification assignmentNotification = new MatchmakingQueueAssignmentNotification()
            {
                Reason = "",
                MatchmakingQueueInfo = new LobbyMatchmakingQueueInfo()
                {
                    ShowQueueSize    = true,
                    QueuedPlayers    = 7,
                    PlayersPerMinute = 4,
                    GameConfig       = new LobbyGameConfig(),
                    QueueStatus      = QueueStatus.Success,
                    AverageWaitTime  = TimeSpan.FromSeconds(100),
                }
            };
            await connection.SendMessage(assignmentNotification);

            QueueManager.AddPlayerToQueue(connection);
        }
Ejemplo n.º 2
0
        private async static Task SendNotification()
        {
            foreach (var client in Instance.Queue)
            {
                MatchmakingQueueAssignmentNotification notification = new MatchmakingQueueAssignmentNotification()
                {
                    Reason = "",
                    MatchmakingQueueInfo = new LobbyMatchmakingQueueInfo()
                    {
                        ShowQueueSize    = true,
                        QueuedPlayers    = QueuedPlayers[client.SelectedGameType],
                        AverageWaitTime  = TimeSpan.FromSeconds(100),
                        PlayersPerMinute = 0,
                        GameConfig       = new LobbyGameConfig(),
                        QueueStatus      = QueueStatus.QueueDoesntHaveEnoughHumans
                    }
                };

                await client.SendMessage(notification);
            }
        }
Ejemplo n.º 3
0
        public void AddPlayer(LobbyServerConnection client)
        {
            //Log.Print(LogType.Lobby, $"Player {client.PlayerInfo.GetHandle()} joined {GameType.ToString()} Queue");

            Players.Add(client);
            QueueInfo.QueuedPlayers++;

            LobbyMatchmakingQueueInfo info = QueueInfo.Clone();

            info.QueueStatus = Framework.Constants.Enums.QueueStatus.Success;


            MatchmakingQueueAssignmentNotification assignmentNotification = new MatchmakingQueueAssignmentNotification()
            {
                Reason = "",
                MatchmakingQueueInfo = info
            };

            _ = client.SendMessage(assignmentNotification);

            Update();
        }