Esempio n. 1
0
        public MainMenu(Framework framework)
        {
            BaseConstructor(framework, 360, 420);

            mainMenu_TitleText = new TextBlock()
            {
                FontSize        = 60,
                Text            = "Metal Lynch",
                RenderTransform = new TranslateTransform(480, 50)
                                  //Instantiates the TextBlock for the game title.
            };
            menu_Canvas.Children.Add(mainMenu_TitleText);
            //Adds the TextBlock to the Menu Canvas.

            mainMenu_PlayButton = new Button()
            {
                Width           = 200,
                Height          = 60,
                FontSize        = 40,
                Content         = "Play",
                RenderTransform = new TranslateTransform(540, 150)
                                  //Instantiates the play Button.
            };
            mainMenu_PlayButton.Click += PlayButtonClickEvent;
            menu_Canvas.Children.Add(mainMenu_PlayButton);
            //Adds the play Button to the Menu Canvas.

            mainMenu_TutorialButton = new Button()
            {
                IsEnabled = false,

                Width           = 200,
                Height          = 60,
                FontSize        = 40,
                Content         = "Tutorial",
                RenderTransform = new TranslateTransform(540, 220)
                                  //Instantiates the tutorial Button.
            };
            menu_Canvas.Children.Add(mainMenu_TutorialButton);
            //Adds the tutorial Button to the Menu Canvas.

            mainMenu_SettingsButton = new Button()
            {
                IsEnabled = false,

                Width           = 200,
                Height          = 60,
                FontSize        = 40,
                Content         = "Settings",
                RenderTransform = new TranslateTransform(540, 290)
                                  //Instantiates the settings Button.
            };
            menu_Canvas.Children.Add(mainMenu_SettingsButton);
            //Adds the settings Button to the Menu Canvas.

            mainMenu_QuitButton = new Button()
            {
                Width           = 200,
                Height          = 60,
                FontSize        = 40,
                Content         = "Quit Game",
                RenderTransform = new TranslateTransform(540, 360)
                                  //Instantiates the quit Button.
            };
            mainMenu_QuitButton.Click += QuitButtonClickEvent;
            menu_Canvas.Children.Add(mainMenu_QuitButton);
            //Adds the quit Button to the Menu Canvas.

            AddToCanvas();
            //Adds the Menu Canvas to the Framework Canvas.
        }
Esempio n. 2
0
        public GameMenu(Framework framework)
        {
            BaseConstructor(framework, 640, 360);

            gameMenu_PlayButton = new Button()
            {
                Width           = 240,
                Height          = 100,
                FontSize        = 60,
                Content         = "Play",
                RenderTransform = new TranslateTransform(520, 50)
                                  //Instantiates the play Button.
            };
            gameMenu_PlayButton.Click += PlayButtonClickEvent;
            menu_Canvas.Children.Add(gameMenu_PlayButton);
            //Adds the play Button to the Menu Canvas.

            gameMenu_MainMenuButton = new Button()
            {
                Width           = 80,
                Height          = 40,
                FontSize        = 14,
                Content         = "Return to\n Main Menu",
                RenderTransform = new TranslateTransform(10, 10)
                                  //Instantiates the play Button.
            };
            gameMenu_MainMenuButton.Click += MainMenuButtonClickEvent;
            menu_Canvas.Children.Add(gameMenu_MainMenuButton);
            //Adds the Main Menu Button to the Menu Canvas.

            gameMenu_1v1ComboBoxItem = new ComboBoxItem()
            {
                Content = "1v1"
            };
            gameMenu_TrainingComboBoxItem = new ComboBoxItem()
            {
                Content = "Training"
            };

            gameMenu_ModeSelector = new ComboBox()
            {
                Width           = 240,
                Height          = 50,
                FontSize        = 30,
                FontStyle       = FontStyles.Italic,
                IsEditable      = true,
                IsReadOnly      = true,
                Text            = "--Select Mode--",
                RenderTransform = new TranslateTransform(360, 170)
            };
            gameMenu_ModeSelector.Items.Add(gameMenu_TrainingComboBoxItem);
            gameMenu_ModeSelector.Items.Add(gameMenu_1v1ComboBoxItem);
            gameMenu_ModeSelector.DropDownClosed += DropDownClosedEvent;
            menu_Canvas.Children.Add(gameMenu_ModeSelector);

            gameMenu_ModeDescriptor = new TextBlock()
            {
                FontSize        = 18,
                FontStyle       = FontStyles.Oblique,
                RenderTransform = new TranslateTransform(640, 170)
            };
            menu_Canvas.Children.Add(gameMenu_ModeDescriptor);

            gameMenu_Player1UsernamePrompt = new UsernamePrompt(1, 230);
            gameMenu_Player2UsernamePrompt = new UsernamePrompt(2, 305);

            AddToCanvas();
            //Adds the Menu Canvas to the Framework Canvas.
        }