示例#1
0
文件: GameTurn.cs 项目: djericj/Uno
 public static string Print(this GameTurn turn)
 {
     if (turn.Round < 0)
     {
         return($@"{turn.Stage}: {turn.Action}");
     }
     else
     {
         return(turn != null ? $@"{turn.Stage}: {turn.Player?.Name}, Round {turn.Round}, FC: {CardExtensions.FormatCard(turn.FaceCard)}, {turn.Action}, Hand: {CardExtensions.FormatHand(turn.Player?.Hand)}" : "");
     }
 }
示例#2
0
文件: Game.cs 项目: djericj/Uno
        private void Log(string stage, Player player, int round, string action)
        {
            var log = new GameTurn()
            {
                Stage          = stage,
                Player         = player,
                Round          = round,
                Action         = action,
                CardsRemaining = player.CardsRemaining,
                Hand           = player.Hand,
                HasUno         = player.Hand != null?player.Hand.Count() == 1 : false,
                FaceCard       = FaceCard
            };

            GameLog.Add(log);
            OnGameTurnCompleted <GameTurn>(log);
        }
示例#3
0
文件: Game.cs 项目: djericj/Uno
        private void Log(string stage, string action)
        {
            var log = new GameTurn()
            {
                Stage          = stage,
                Player         = null,
                Round          = -1,
                Action         = action,
                CardsRemaining = -1,
                Hand           = null,
                HasUno         = false,
                IsWinner       = false,
                FaceCard       = null
            };

            GameLog.Add(log);
            OnGameTurnCompleted <GameTurn>(log);
        }
示例#4
0
文件: Program.cs 项目: djericj/Uno
 private static void Game_GameTurnCompleted(GameTurn gameTurn)
 {
     Console.WriteLine(gameTurn.Print());
 }