private void OnMatchmakingFail(MatchmakingReadyFail obj) { if (_onMatchmakingUpdate != null) { _onMatchmakingUpdate(obj); } }
public void UserLeave(Jid user) { lock (_users) { Log.InfoFormat("[{0}] {1} User Left", this, user); var usr = _users.FirstOrDefault(x => x == user); if (usr == null) { return; } switch (State) { case MatchmakingQueueState.WaitingForReadyUsers: case MatchmakingQueueState.WaitingForHostedGame: if (usr.IsInReadyQueue) { Log.InfoFormat("[{0}] {1} User was in ready queue, so cancel that.", this, usr); State = MatchmakingQueueState.WaitingForUsers; foreach (var u in _users) { u.IsInReadyQueue = false; u.IsReady = false; } var msg = new MatchmakingReadyFail(null, this.QueueId); Log.InfoFormat("[{0}] {1} Tell everyone ready queue failed.", this, usr); foreach (var u in _users.Where(x => x.IsInReadyQueue && x != usr)) { msg.To = u.JidUser; this.Bot.Messanger.Send(msg); } } break; } Log.InfoFormat("[{0}] {1} Actually remove the user", this, usr); _users.Remove(usr); } }