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");
        }
Ejemplo n.º 3
0
        public GuiPlay()
        {
            var playStyle = new GUIStyle();
            Name = "GuiPlay";
            Style = playStyle;
            Size = new Vector2(1280, 720);
            Folder = GUICanvas.Instance;

            styleMain = new GUITextStyle();
            styleMain.FontType = "Arial22"; // @"data\images\MyFont";
            styleMain.TextColor[0] = Color.Red;
            styleMain.SizeToText = false;
            styleMain.Alignment = TextAlignment.JustifyCenter;
            styleMain.PreserveAspectRatio = true;

            _player1Health = new GUIText();
            _player1Health.Style = styleMain;
            _player1Health.Position = new Vector2(25, 25);
            _player1Health.Size = new Vector2(400, 120);
            _player1Health.Visible = true;
            _player1Health.Folder = this;
            _player1Health.Text = "Player Score:";

            _player2Health = new GUIText();
            _player2Health.Style = styleMain;
            _player2Health.Position = new Vector2(780, 25);
            _player2Health.Size = new Vector2(400, 120);
            _player2Health.Visible = true;
            _player2Health.Folder = this;
            _player2Health.Text = "Health Level";

            bitmapStyle = new GUIBitmapStyle();
            bitmapStyle.SizeToBitmap = false;

            Game.Instance.AiHealth = Game.Instance.PlayerHealth = 100;
        }
Ejemplo n.º 4
0
        protected override bool _OnNewStyle(GUIStyle style)
        {
            _style = (style as GUIBitmapStyle);

            Assert.Fatal(_style != null, "GUIBitmap._OnNewStyle - Control was assigned an invalid style!");

            if (_style == null || !base._OnNewStyle(style))
                return false;

            if (_style.SizeToBitmap && _material != null)
                Size = new Vector2(_bitmapSize.X, _bitmapSize.Y);

            return true;
        }
        private float maxHealthBarSize; // used to calculate size of health

        #endregion Fields

        #region Constructors

        public HealthBar_GUI()
        {
            #region Styles

            // Create Base Style
            GUIStyle playStyle = new GUIStyle();
            Name = "GuiPlay";
            Style = playStyle;
            Size = new Microsoft.Xna.Framework.Vector2(1024, 768);
            Folder = GUICanvas.Instance;

            // Create Text Style
            GUITextStyle styleText = new GUITextStyle();
            styleText.FontType = "Arial22"; // Change to desired
            styleText.TextColor[CustomColor.ColorBase] = Color.White; // Change to desired
            styleText.SizeToText = true;
            styleText.Alignment = TextAlignment.JustifyLeft;
            styleText.PreserveAspectRatio = true;

            // Create Pic Style
            GUIBitmapStyle bitmapStyle = new GUIBitmapStyle();
            bitmapStyle.SizeToBitmap = false;

            // Modify the bitmap Style to draw the health
            GUIStyle healthStyle = new GUIStyle();
            healthStyle.FillColor[CustomColor.ColorBase] = Color.Red;
            healthStyle.IsOpaque = true;

            #endregion

            #region GUIObjects

            // Create health text object
            GUIText healthText = new GUIText();
            healthText.Style = styleText; // Created above
            healthText.Text = "Health"; // Change to desired
            healthText.Size = new Vector2(75, 30); // If smaller than text, will be cut off
            healthText.Position = new Vector2(20, 20); // Change to desired
            healthText.Folder = this; // needed to draw
            healthText.Visible = true; // needed to draw

            // Create cyrstal text object
            crystalText = new GUIText();
            crystalText.Style = styleText;
            crystalText.Text = "";
            crystalText.Size = new Vector2(75, 30); // If smaller than text, will be cut off
            crystalText.Position = new Vector2(920, 57); // Change to desired
            crystalText.Folder = this;
            crystalText.Visible = true;

            // Create "x" text object, to make independent of the no. of crystals
            GUIText crossText = new GUIText();
            crossText.Style = styleText;
            crossText.Text = " x ";
            crossText.Size = new Vector2(75, 30); // If smaller than text, will be cut off
            crossText.Position = new Vector2(crystalText.Position.X + 30, crystalText.Position.Y); // offset position from crystalText
            crossText.Folder = this;
            crossText.Visible = true;

            // Create picture object
            GUIBitmap healthBarBorder = new GUIBitmap();
            healthBarBorder.Style = bitmapStyle;
            healthBarBorder.Size = new Vector2(310, 40); // The size of the health bar
            healthBarBorder.Bitmap = @"data\images\lifebar";
            healthBarBorder.Folder = this;
            healthBarBorder.Visible = true;
            healthBarBorder.Position = new Vector2(20, 60);

            // Create picture object
            GUIBitmap crystalBitmap = new GUIBitmap();
            crystalBitmap.Style = bitmapStyle;
            crystalBitmap.Size = new Vector2(30, 65); // The size of the crystal
            crystalBitmap.Bitmap = @"data\images\crystal";
            crystalBitmap.Folder = this;
            crystalBitmap.Visible = true;
            crystalBitmap.Position = new Vector2(crystalText.Position.X + 55, crystalText.Position.Y - 15); // offset position from crystalText

            // Create base object to fill with colour
            healthBar = new GUIControl();
            healthBar.Style = healthStyle;
            //healthBar.Size = new Vector2(healthBarBorder.Size.X - 8, healthBarBorder.Size.Y - 5);
            healthBar.Size = new Vector2(301, 34); // offset size to fit inside health bar
            healthBar.Folder = this;
            healthBar.Visible = true;
            //healthBar.Position = new Vector2(healthBarBorder.Position.X + 5, healthBarBorder.Position.Y + 3);
            healthBar.Position = new Vector2(25, 64); // offset pos to fit inside health bar

            // used calculate health bar size (see draw)
            maxHealthBarSize = healthBar.Size.X;

            #endregion
        }