Dominion.HumanReadableGameLog.EndGame C# (CSharp) Method

EndGame() public method

public EndGame ( GameState gameState ) : void
gameState GameState
return void
        public void EndGame(GameState gameState)
        {
            this.textWriter.WriteLine("Game ended in {0} turns.", this.roundNumber);
            this.textWriter.WriteLine();

            PlayerState[] winners = gameState.WinningPlayers;

            if (winners.Length == 1)
            {
                this.textWriter.WriteLine("{0} Won!", winners[0].actions.PlayerName);
            }
            else
            {
                this.textWriter.Write("There was a tie between: ");
                foreach (PlayerState player in winners)
                {
                    this.textWriter.Write("{0}, ", player.actions.PlayerName);
                }
                this.textWriter.WriteLine();
            }
            this.textWriter.WriteLine();

            foreach (PlayerState player in gameState.players.AllPlayers)
            {
                this.textWriter.WriteLine("{0} Total Score is: {1}", player.actions.PlayerName, player.TotalScore());
                this.PushScope();
                this.WriteAllOwnedCards(player);
                if (player.VictoryTokenCount > 0)
                    this.textWriter.WriteLine("{0} points from Victory Tokens.", player.VictoryTokenCount);
                this.PopScope();
                this.textWriter.WriteLine();
            }

            this.textWriter.Write("Trash contains: ");
            this.WriteAllCards(gameState.trash);

            this.textWriter.WriteLine();
        }