Beispiel #1
0
        public void Ready(MatchmakingReadyRequest req)
        {
            var resp = new MatchmakingReadyResponse(_client.Config.MatchamkingBotUser.JidUser, req.QueueId);

            _messanger.Send(resp);
        }
Beispiel #2
0
        private void OnMatchmakingReadyResponse(MatchmakingReadyResponse obj)
        {
            if (obj.QueueId != this.QueueId)
                return;
            lock (_users)
            {
				Log.InfoFormat("[{0}]{1} Got Ready Response from user",this,obj.From);
                if (State != MatchmakingQueueState.WaitingForReadyUsers)
                {
					Log.InfoFormat("[{0}] Not in ready queue anymore, so forget it.",this);
                    return;
                }
                var user = _users.FirstOrDefault(x => x == obj.From);
                if (user != null)
                    user.IsReady = true;

                if (_users.Where(x => x.IsInReadyQueue).All(x => x.IsReady))
                {
					Log.InfoFormat("[{0}] All users are ready, spin up a game",this);
                    // All users are ready.
                    // Spin up a gameserver for them to join
                    var agamename = string.Format("Matchmaking: {0}[{1}]", this.GameName, this.GameMode);
                    _waitingRequestId = Bot.BeginHostGame(this.GameId, this.GameVersion, agamename,"",obj.QueueId.ToString().ToLower(), this.GameName, typeof(XmppClient).Assembly.GetName().Version, true);
                    State = MatchmakingQueueState.WaitingForHostedGame;
                    _hostGameTimeout.SetRun();
                }
            }
        }