Exemplo n.º 1
0
 public void HandleAction(Game game, GameAction action)
 {
     foreach (Tag tag in action.Tags)
     {
         HandleTag(game, action, tag);
     }
 }
Exemplo n.º 2
0
        public void HandleTag(Game game, GameAction action, Tag tag)
        {
            if (string.Equals(tag.Name, "TURN"))
                HandleTurnTag(game, action, tag);

            if (string.Equals(tag.Name, "ZONE") &&
                string.Equals(tag.Value, "HAND") &&
                string.Equals(action.SubType, "TRIGGER"))
                HandleTurnDrawTag(game, action, tag);
        }
Exemplo n.º 3
0
        public void HandleTurnTag(Game game, GameAction action, Tag tag)
        {
            var turn = new Turn();
            turn.TurnIndex = int.Parse(tag.Value);
            if (game.Draw != null)
            {
                turn.Draw = game.Draw;
                game.Draw = null;
            }

            game.Turns.Add(turn);
        }
Exemplo n.º 4
0
 public void HandleTurnDrawTag(Game game, GameAction action, Tag tag)
 {
     game.Draw = tag.Entity.Card;
 }
Exemplo n.º 5
0
 public Game ParseGame(string fileName)
 {
     var game = new Game();
     this.Parse(fileName);
     var actions = this.ParseActions();
     foreach (GameAction action in actions)
     {
         HandleAction(game, action);
     }
     return game;
 }