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)}" : ""); } }
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); }
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); }
private static void Game_GameTurnCompleted(GameTurn gameTurn) { Console.WriteLine(gameTurn.Print()); }