예제 #1
0
        protected override void ProcessTournamentStartedMessage(Jid from, TournamentStartedMessage tournamentStartedMessage)
        {
            _bots = new Dictionary<string, IPlayerBot>();

            foreach (var game in tournamentStartedMessage.Games)
            {
                _bots.Add(game.GameId, _createBotFunc());
            }

            base.ProcessTournamentStartedMessage(from, tournamentStartedMessage);
        }
        private void TournamentStartedHandler(object sender, TournamentStartedEventArgs e)
        {
            var tournamentStartedMessageXml = new TournamentStartedMessage
            {
                Games = e.Games.Select(x => new GameStartMessage
                {
                    GameId = x.GameId,
                    MaxMoves = x.MaxMoves,
                    Player1 = x.Player1,
                    Player2 = x.Player2
                }).ToArray()
            }.ToXml();

            foreach (var player in e.Players)
            {
                Connection.Send(new Message(player, tournamentStartedMessageXml));
            }
        }
예제 #3
0
 protected virtual void ProcessTournamentStartedMessage(Jid from, TournamentStartedMessage tournamentStartedMessage)
 {
     OnTournamentStarted(tournamentStartedMessage.Games.Select(x =>
     {
         return new GameStartInfo
         {
             GameId = x.GameId,
             MaxMoves = x.MaxMoves,
             Player1 = x.Player1,
             Player2 = x.Player2
         };
     }));
 }