public void SetUp()
 {
     player1 = new Player("Player 1");
     player2 = new Player("Player 2");
     game = Game.CreateNewGame(10, 10, player1, player2);
     log = new JsonMessageLog();
 }
예제 #2
0
        public static Game CreateNewGame(int x, int y, params Player[] players)
        {
            var game = new Game(x, y);

            foreach (var player in players)
                game.AddPlayer(player);

            return game;
        }
예제 #3
0
 public abstract void Execute(Game game, IMessageLog log);
예제 #4
0
        public void UpdateScores(Game game)
        {
            JsonObject obj = BuildGameMessageJson(GameMessageType.ScoresUpdated, msg =>
            {
                msg.scores = new JsonArray(
                    game.Players.Select(p =>
                    {
                        dynamic scoreEntry = new JsonObject();
                        scoreEntry.name = p.Name;
                        scoreEntry.value = p.Score;
                        return (JsonValue)scoreEntry;
                    })
                );
            });

            Messages.Add(obj);
        }
예제 #5
0
        public void StartGame(Game game)
        {
            JsonObject obj = BuildGameMessageJson(GameMessageType.NewGame, msg =>
            {
                msg.dimensions = new JsonObject();
                msg.dimensions.width = game.Board.Width;
                msg.dimensions.height = game.Board.Height;
            });

            Messages.Add(obj);
        }
예제 #6
0
 public void SetUp()
 {
     player1 = new Player("Player 1");
     player2 = new Player("Player 2");
     game = Game.CreateNewGame(10, 10, player1, player2);
 }
예제 #7
0
 public HostedGame(GameConfiguration config)
 {
     this.config = config;
     clients = new WebSocketCollection<GameWebSocketService>();
     game = new PushFrenzy.Rules.Game(config.BoardWidth, config.BoardHeight);
 }
예제 #8
0
 public HostedGame(GameConfiguration config)
 {
     this.config = config;
     clients     = new WebSocketCollection <GameWebSocketService>();
     game        = new PushFrenzy.Rules.Game(config.BoardWidth, config.BoardHeight);
 }
예제 #9
0
 public PiecesInARowClearingRule(Game game, int target)
 {
     this.game = game;
     Target = target;
 }