Ejemplo n.º 1
0
        public GUI_Menu()
        {
            //create the style for the main menu background
            GUIBitmapStyle bitmapStyle = new GUIBitmapStyle();
            Style = bitmapStyle;
            Bitmap = @"data\images\Background"; // Background image of menu

            //create the style for the menu buttons
            GUIButtonStyle buttonStyle = new GUIButtonStyle();
            buttonStyle.FontType = "Arial22"; //@"data\images\MyFont";
            buttonStyle.TextColor[CustomColor.ColorBase] = new Color(100, 100, 100, 255); //normal menu text color
            buttonStyle.TextColor[CustomColor.ColorHL] = Color.Red; //highlighter color
            buttonStyle.TextColor[CustomColor.ColorNA] = Color.Silver; //disabled color
            buttonStyle.TextColor[CustomColor.ColorSEL] = Color.DarkRed; //select color
            buttonStyle.Alignment = TextAlignment.JustifyCenter;
            buttonStyle.Focusable = true;

            // Based on 1024 * 768
            float positionX = 512;
            float positionY = 400;

            #region Buttons

            GUIButton playButton = new GUIButton();
            playButton.Style = buttonStyle;
            playButton.Size = new Vector2(500, 100);
            playButton.Position = new Vector2(positionX - (playButton.Size.X / 2), positionY);
            playButton.Visible = true;
            playButton.Folder = this;
            playButton.ButtonText = "Start Game";
            playButton.OnSelectedDelegate = On_Play;
            playButton.OnGainFocus(null);
            _buttons.Add(playButton);

            GUIButton optionsButton = new GUIButton();
            optionsButton.Style = buttonStyle;
            optionsButton.Size = new Vector2(500, 100);
            optionsButton.Position = new Vector2(positionX - (playButton.Size.X / 2), positionY + 50);
            optionsButton.Visible = true;
            optionsButton.Folder = this;
            optionsButton.ButtonText = "Options";
            optionsButton.OnSelectedDelegate = On_Options;
            _buttons.Add(optionsButton);

            GUIButton exitButton = new GUIButton();
            exitButton.Style = buttonStyle;
            exitButton.Size = new Vector2(500, 100);
            exitButton.Position = new Vector2(positionX - (playButton.Size.X / 2), positionY + 100);
            exitButton.Visible = true;
            exitButton.Folder = this;
            exitButton.ButtonText = "Exit";
            exitButton.OnSelectedDelegate = On_Exit;
            _buttons.Add(exitButton);

            #endregion

            //setup the input map
            SetupInputMap();
        }
Ejemplo n.º 2
0
        public GuiMainMenu()
        {
            Name = "GuiMainMenu";

            //create the style for the main menu background
            var bitmapStyle = new GUIBitmapStyle();
            Style = bitmapStyle;
            Bitmap = @"data\images\LandingPage";

            //create the style for the menu buttons
            var buttonStyle = new GUIButtonStyle();
            buttonStyle.FontType = "Arial22"; //@"data\images\MyFont";
            buttonStyle.TextColor[CustomColor.ColorBase] = new Color(100, 100, 100, 255); //normal menu text color
            buttonStyle.TextColor[CustomColor.ColorHL] = Color.Red; //highlighter color
            buttonStyle.TextColor[CustomColor.ColorNA] = Color.Silver; //disabled color
            buttonStyle.TextColor[CustomColor.ColorSEL] = Color.DarkRed; //select color
            buttonStyle.Alignment = TextAlignment.JustifyCenter;
            buttonStyle.Focusable = true;

            float positionX = 640;
            float positionY = 200;

            var option1 = new GUIButton();
            option1.Style = buttonStyle;
            option1.Size = new Vector2(520, 100);
            option1.Position = new Vector2(positionX - (option1.Size.X/2), positionY);
            option1.Visible = true;
            option1.Folder = this;
            option1.ButtonText = "Start New Game";
            option1.OnSelectedDelegate = OnStartGame;
            option1.OnGainFocus(null);
            _buttons.Add(option1);

            var option4 = new GUIButton();
            option4.Style = buttonStyle;
            option4.Size = new Vector2(500, 100);
            option4.Position = new Vector2(positionX - (option1.Size.X/2), positionY + 50);
            option4.Visible = true;
            option4.Folder = this;
            option4.ButtonText = "Quit";
            option4.OnSelectedDelegate = OnQuit;
            _buttons.Add(option4);

            //setup the input map
            SetupInputMap();

            Game.Instance.Player = "gaga";
            Game.Instance.Ai = "jackson";

               // Game.Instance.Sounds.PlaySound("soundtrack");
        }