private static Square[] InitializeSquares()
        {
            var squares = new Square[NumberOfSquares];

            _railroadSquares = new RailroadSquare[NumberOfRailroadSquares];

            var railroadGroup   = new PropertyGroup();
            var utilityGroup    = new PropertyGroup();
            var indigoGroup     = new PropertyGroup();
            var skyBlueGroup    = new PropertyGroup();
            var darkOrchidGroup = new PropertyGroup();
            var orangeGroup     = new PropertyGroup();
            var redGroup        = new PropertyGroup();
            var yellowGroup     = new PropertyGroup();
            var greenGroup      = new PropertyGroup();
            var blueGroup       = new PropertyGroup();

            squares[0]  = new GoSquare("Go", 0);
            squares[1]  = new BuildableSquare("Mediterranean Avenue", 1, indigoGroup, 60, 50, 0, 0, 0, 0, 0, 0);
            squares[2]  = new RegularSquare("Community Chest", 2);
            squares[3]  = new BuildableSquare("Baltic Avenue", 3, indigoGroup, 60, 50, 0, 0, 0, 0, 0, 0);
            squares[4]  = new IncomeTaxSquare("Income Tax", 4);
            squares[5]  = _railroadSquares[0] = new RailroadSquare("Reading Railroad", 5, railroadGroup, 200);
            squares[6]  = new BuildableSquare("Oriental Avenue", 6, skyBlueGroup, 100, 0, 0, 0, 0, 0, 0, 0);
            squares[7]  = new RegularSquare("Chance", 7);
            squares[8]  = new BuildableSquare("Vermont Avenue", 8, skyBlueGroup, 100, 0, 0, 0, 0, 0, 0, 0);
            squares[9]  = new BuildableSquare("Connecticut Avenue", 9, skyBlueGroup, 120, 0, 0, 0, 0, 0, 0, 0);
            squares[10] = new RegularSquare("In Jail/Just Visiting", 10);
            squares[11] = new BuildableSquare("St. Charles Place", 11, darkOrchidGroup, 140, 100, 0, 0, 0, 0, 0, 0);
            squares[12] = new UtilitySquare("Electric Company", 12, utilityGroup, 150);
            squares[13] = new BuildableSquare("States Avenue", 13, darkOrchidGroup, 140, 100, 0, 0, 0, 0, 0, 0);
            squares[14] = new BuildableSquare("Virginia Avenue", 14, darkOrchidGroup, 160, 100, 0, 0, 0, 0, 0, 0);
            squares[15] = _railroadSquares[1] = new RailroadSquare("Pennsylvania Railroad", 15, railroadGroup, 200);
            squares[16] = new BuildableSquare("St. James Place", 16, orangeGroup, 180, 100, 0, 0, 0, 0, 0, 0);
            squares[17] = new RegularSquare("Community Chest", 17);
            squares[18] = new BuildableSquare("Tennessee Avenue", 18, orangeGroup, 180, 100, 0, 0, 0, 0, 0, 0);
            squares[19] = new BuildableSquare("New York Avenue", 19, orangeGroup, 200, 100, 0, 0, 0, 0, 0, 0);
            squares[20] = new RegularSquare("Free Parking", 20);
            squares[21] = new BuildableSquare("Kentucky Avenue", 21, redGroup, 220, 150, 0, 0, 0, 0, 0, 0);
            squares[22] = new RegularSquare("Chance", 22);
            squares[23] = new BuildableSquare("Indiana Avenue", 23, redGroup, 220, 150, 0, 0, 0, 0, 0, 0);
            squares[24] = new BuildableSquare("Illinois Avenue", 24, redGroup, 240, 150, 0, 0, 0, 0, 0, 0);
            squares[25] = _railroadSquares[2] = new RailroadSquare("B&O Railroad", 25, railroadGroup, 200);
            squares[26] = new BuildableSquare("Atlantic Avenue", 26, yellowGroup, 260, 150, 0, 0, 0, 0, 0, 0);
            squares[27] = new BuildableSquare("Ventnor Avenue", 27, yellowGroup, 260, 150, 0, 0, 0, 0, 0, 0);
            squares[28] = new UtilitySquare("Water Works", 28, utilityGroup, 150);
            squares[29] = new BuildableSquare("Marvin Gardens", 29, yellowGroup, 280, 150, 0, 0, 0, 0, 0, 0);
            squares[30] = new RegularSquare("Go To Jail", 30);
            squares[31] = new BuildableSquare("Pacific Avenue", 31, greenGroup, 300, 200, 0, 0, 0, 0, 0, 0);
            squares[32] = new BuildableSquare("North Carolina Avenue", 32, greenGroup, 300, 200, 0, 0, 0, 0, 0, 0);
            squares[33] = new RegularSquare("Community Chest", 33);
            squares[34] = new BuildableSquare("Pennsylvania Avenue", 34, greenGroup, 320, 200, 0, 0, 0, 0, 0, 0);
            squares[35] = _railroadSquares[3] = new RailroadSquare("Short Line", 35, railroadGroup, 200);
            squares[36] = new RegularSquare("Chance", 36);
            squares[37] = new BuildableSquare("Park Place", 37, blueGroup, 350, 200, 0, 0, 0, 0, 0, 0);
            squares[38] = new LuxuryTaxSquare("Luxury Tax", 38);
            squares[39] = new BuildableSquare("Boardwalk", 39, blueGroup, 400, 200, 0, 0, 0, 0, 0, 0);

            return(squares);
        }
Beispiel #2
0
        private static Square[] BuildSquares()
        {
            var squares = new Square[40];

            for (var i = 1; i <= 40; i++)
            {
                squares[i - 1] = new RegularSquare("Square " + i, i - 1);
            }
            return(squares);
        }
Beispiel #3
0
        public void SetNextSquareTest()
        {
            var square1 = new RegularSquare("Square1", 0);
            var square2 = new RegularSquare("Square2", 1);

            square1.SetNextSquare(square2);
            square2.SetNextSquare(square1);

            Assert.AreEqual(square2, square1.GetNextSquare());
            Assert.AreEqual(square1, square2.GetNextSquare());
        }
        public PlayArea(Page pPage, int pSize)
        {
            mPage = pPage;
            Grid bottomButtons = new Grid();

            mUndoButton = new Button()
            {
                Text = "Undo Turn"
            };
            mUndoButton.Pressed += BackPressed;
            bottomButtons.Children.AddHorizontal(mUndoButton);

            Button button = new Button()
            {
                Text = "End Turn"
            };

            button.Pressed += EndTurnPressed;
            bottomButtons.Children.AddHorizontal(button);

            button = new Button()
            {
                Text = "Solve Turn"
            };
            button.Pressed += SolveTurn;;
            bottomButtons.Children.AddHorizontal(button);

            Padding             = 0;
            Margin              = 0;
            RowSpacing          = 3;
            ColumnSpacing       = 3;
            BackgroundColor     = Color.Black;
            mSize               = pSize;
            mPlayerUnits        = new List <PlayerUnit>();
            mEnemyUnits         = new List <EnemyUnit>();
            mGridBuildings      = new List <GridBuilding>();
            mHighlightedSquares = new List <Square>();
            mEmergingSquares    = new List <Square>();
            mSquares            = new Square[mSize, mSize];
            mActionStackNew     = new ActionStack(this);
            string board = "rrfmmrrr,rrrrmfrr,rffmrrrr,frrrrrrm,rrrrrrfr,rrrrrrrr,fffrrrrm,rrrrrrmm";

            string[] rows = board.Split(',');
            string   r;
            char     s;
            Square   square;

            for (int row = 0; row < mSize; ++row)
            {
                r = rows[row];
                for (int col = 0; col < mSize; ++col)
                {
                    s = r[col];
                    switch (s)
                    {
                    case 'f':
                        square = new ForestSquare(this, row, col);
                        break;

                    case 'm':
                        square = new RegularSquare(this, row, col);
                        new Mountain(square);
                        break;

                    default:
                        square = new RegularSquare(this, row, col);
                        break;
                    }

                    mSquares[row, col] = square;
                    Children.Add(square, col, row);
                }
            }
            mPlayerUnits.Add(new GravityMech(mSquares[3, 2], null));
            mPlayerUnits.Add(new SiegeMech(mSquares[4, 2], null));
            mPlayerUnits.Add(new JudoMech(mSquares[3, 4], new ChenRong()));
            mPlayerUnits.Add(new OldArtillery(mSquares[3, 3]));
            mPlayerUnits[3].Damage(1, DamageType.Direct);

            mEnemyUnits.Add(new Scorpion(mSquares[5, 2]));
            mEnemyUnits[0].Damage(1, DamageType.Direct);
            mEnemyUnits.Add(new Scorpion(mSquares[2, 5]));
            mEnemyUnits.Add(new Firefly(mSquares[5, 4]));
            mEnemyUnits.Add(new Scorpion(mSquares[3, 5]));

            mGridBuildings.Add(new GridBuilding(mSquares[1, 1], 1));
            mGridBuildings.Add(new ObjectiveGridBuilding(mSquares[1, 3], 1));
            mGridBuildings.Add(new GridBuilding(mSquares[2, 4], 1));
            mGridBuildings.Add(new GridBuilding(mSquares[2, 7], 1));
            mGridBuildings.Add(new GridBuilding(mSquares[4, 1], 2));
            mGridBuildings.Add(new GridBuilding(mSquares[4, 7], 2));
            mGridBuildings.Add(new GridBuilding(mSquares[5, 1], 2));
            mGridBuildings.Add(new GridBuilding(mSquares[5, 7], 2));

            ToggleEmerging(mSquares[5, 3]);
            ToggleEmerging(mSquares[7, 4]);

            mSquares[6, 1].ApplyStatus(SquareStatus.Fire);

            //other = new Mountain(mSquares[3, 4]);
            //other = new EnemyUnit(mSquares[4, 6], 3);
            //mEnemyUnits[1].MoveSquares().ForEach(sq => sq.BackgroundColor = Color.Red);
            //List<PlayerAttack> attacks = mPlayerUnits[3].PossibleAttacks();
            //attacks.ForEach(a => a.TargetSquare.BackgroundColor = Color.Blue);
            //attacks[0].Do(mActionStack);
            //attacks = unit.PossibleAttacks();
            //attacks[0].Do(mActionStack);
            //UndoLastAttack();
            //attacks.ForEach(a => { if (a.TargetSquare.Equals(mSquares[3, 3])) a.Do(mActionStack); });

            Children.Add(bottomButtons, 0, mSize, mSize, mSize + 1);
        }