public List <GameInfoPacket> getCurrentGameInfos()
        {
            List <GameInfoPacket> gameList = new List <GameInfoPacket>();

            foreach (PreGame p in AlbotPreGameModule.getCurrentJoinableGames())
            {
                gameList.Add(p.convertToGameInfoPacket());
            }
            foreach (PreTournamentGame t in AlbotTournamentModule.getCurrentTournaments())
            {
                gameList.Add(t.convertToGameInfoPacket());
            }

            return(gameList);
        }
Пример #2
0
        public void initAndInvite(bool forceRestart)
        {
            if (forceRestart == false && (state != RoundState.Idle && hasAllPlayers() == false))
            {
                return;
            }

            thePregame = AlbotPreGameModule.createTournamentGame(gameSpecs, admin);
            if (getNonNPCPlayers().Count == 0)   //If we have no human players in the game, we automaticly select a bot to win the game
            {
                forceRandomWinner();
                return;
            }

            initHostAndBots();
            getNonNPCPlayers().ForEach(p => p.peer.SendMessage((short)CustomMasterServerMSG.tournamentRoundPreStarted, thePregame.specs.roomID));
            setState(RoundState.Lobby);
        }
Пример #3
0
        public void reportResult(GameOverMsg result)
        {
            AlbotPreGameModule.removeGame(thePregame, thePregame.specs.roomID);
            if (result.score.winState == GameOverState.draw)
            {
                score.draws++;
            }
            else
            {
                score.wins[extractWinningPlayerIndex(result.score.winOrder)]++;
            }

            checkForGameOver();
            if (state != RoundState.Over)
            {
                rematch();
            }
        }
Пример #4
0
 public void startGame()
 {
     AlbotPreGameModule.startTournamentgame(thePregame);
     score.roundsCounter++;
     setState(RoundState.Playing);
 }