예제 #1
0
 private void InvokePreGame()
 {
     if (PreGame != null)
     {
         PreGame.Invoke(this, GenerateEventArgs());
     }
 }
예제 #2
0
        public GameState(Phase _phase, PColor _turn, AbstractField[] _fields, DiceState _dicestate, PreGame _preGame)
        {
            this._dicestate = _dicestate;
            this._turn      = _turn;
            this._fields    = _fields;
            this._phase     = _phase;
            this.CurPreGame = _preGame;

            CalculatePossibleMoves();
        }
        public void preGameStarted(PreGame game, RunningGameInfoMsg initMsg)
        {
            if (game.hasSpectators() == false)
            {
                return;
            }

            foreach (IPeer p in game.getSpectatorsClone())
            {
                p.SendMessage((short)CustomMasterServerMSG.spectateGameStarted, initMsg);
            }
        }
        private void removeSpectator(PreGame game, IPeer peer)
        {
            if (adminToRooms.ContainsKey(peer.Id) != false)
            {
                adminToRooms.Remove(peer.Id);
            }
            if (game == null)
            {
                return;
            }

            game.removeSpectator(peer.Id);
        }
        private bool findGame(string key, out PreGame game, IIncommingMessage rawMsg = null)
        {
            if (allGames.TryGetValue(key, out game))
            {
                return(true);
            }

            if (rawMsg != null)
            {
                rawMsg.Respond("Could not find matching game", ResponseStatus.Error);
            }

            game = null;
            return(false);
        }
예제 #6
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);
        }
 public void preGameRemoved(PreGame game)
 {
     game.getSpectatorsClone().ForEach(p => removeSpectator(game, p));
 }