Beispiel #1
0
        //Remove the object of the board and remove it as child from the grid so it's gone
        public void destoryMap()
        {
            if (level != null)
            {
                main.mainGrid.Children.Remove(level);
                main.mainGrid.Children.Remove(dice);
                main.mainGrid.Children.Remove(skip);
                main.mainGrid.Children.Remove(winner);
                level = null;
                dice = null;
                skip = null;
                winner = null;
            }

            main.ToggleImageOpacityAndButtonGrid();
        }
Beispiel #2
0
        //Create a new board according to the type of board selected by the user input
        public void newBoard(int iHumanPlayers, String sBoardType, int playerTurn)
        {
            this.playerTurn = playerTurn;

            //Show the "hoofdmenu" button, allowing the user to return the the main menu
            main.label_mainmenu.Visibility = Visibility.Visible;
            main.label_save.Visibility = Visibility.Visible;

            if (sBoardType.Equals("normaal"))
            {
                createPlayers(iHumanPlayers, 5);
                levelModel = new Model.ModelLevelSlow();
                level = new View.ViewLevel(this, levelModel);
            }
            else
            {
                createPlayers(iHumanPlayers, 4);
                levelModel = new Model.ModelLevelFast();
                level = new View.ViewLevel(this, levelModel);
            }
            main.mainGrid.Children.Add(level);
            level.Visibility = Visibility.Visible;

            dice = new View.Dice(playerTurn);
            dice.HorizontalAlignment = HorizontalAlignment.Right;
            dice.Margin = new Thickness(0,0,10,0);
            main.mainGrid.Children.Add(dice);

            skip = new View.Skip(this);
            skip.HorizontalAlignment = HorizontalAlignment.Right;
            skip.Margin = new Thickness(0, 160, 10, 0);
            main.mainGrid.Children.Add(skip);

            winner = new View.WinnerMessage();
            winner.Visibility = Visibility.Collapsed;
            winner.HorizontalAlignment = HorizontalAlignment.Center;
            winner.VerticalAlignment = VerticalAlignment.Center;
            main.mainGrid.Children.Add(winner);
        }