Exemple #1
0
        public void CreateSuccessfully()
        {
            var player1 = LocalId.NewShortId();
            var player2 = LocalId.NewShortId();

            PackageExplorer explorer = null;
            var             gameView = new GameView();

            gameView.Create(explorer);
            gameView.Players = new GamePlayer[]
            {
                new GamePlayer()
                {
                    OwnerId = player1,
                    Board   = new GameBoard(4, 4),
                },
                new GamePlayer()
                {
                    OwnerId = player2,
                    Board   = new GameBoard(4, 4),
                }
            };

            gameView.Apply(new DeclareResourceAction()
            {
                Client             = player1,
                ResourceIdentifier = "1"
            });
            gameView.Apply(new PlaceResourceAction()
            {
                Client             = player1,
                ResourceIdentifier = "1",
                ResourcePosition   = new Integer2(1, 1)
            });
            gameView.Apply(new PlaceResourceAction()
            {
                Client             = player2,
                ResourceIdentifier = "1",
                ResourcePosition   = new Integer2(3, 3)
            });
            gameView.Apply(new EndTurnAction()
            {
                Client = player1
            });

            gameView.Apply(new DeclareResourceAction()
            {
                Client             = player2,
                ResourceIdentifier = "2"
            });
            gameView.Apply(new PlaceResourceAction()
            {
                Client             = player1,
                ResourceIdentifier = "2",
                ResourcePosition   = new Integer2(2, 1)
            });
            gameView.Apply(new PlaceResourceAction()
            {
                Client             = player2,
                ResourceIdentifier = "2",
                ResourcePosition   = new Integer2(2, 1)
            });
            gameView.Apply(new EndTurnAction()
            {
                Client = player2
            });

            gameView.Apply(new DeclareResourceAction()
            {
                Client             = player1,
                ResourceIdentifier = "3"
            });
            gameView.Apply(new PlaceResourceAction()
            {
                Client             = player1,
                ResourceIdentifier = "3",
                ResourcePosition   = new Integer2(1, 2)
            });
            gameView.Apply(new PlaceResourceAction()
            {
                Client             = player2,
                ResourceIdentifier = "3",
                ResourcePosition   = new Integer2(1, 2)
            });

            DrawGameState(gameView);

            gameView.Apply(new BuildBuildingAction()
            {
                Client             = player1,
                BuildingIdentifier = "building",
                BuildingPosition   = new Integer2(2, 2),
                Offset             = new Integer2(1, 1),
                Orientation        = BuildingOrientation.None
            });
            gameView.Apply(new EndTurnAction()
            {
                Client = player1
            });

            DrawGameState(gameView);
        }