public GUI_Pause()
        {
            //create the style for the main menu background
            GUIStyle pauseStyle = new GUIStyle();
            pauseStyle.IsOpaque = true;
            Style = pauseStyle;

            //create the style for the menu buttons
            GUITextStyle textStyle = new GUITextStyle();
            textStyle.FontType = "Arial22";
            textStyle.TextColor[CustomColor.ColorBase] = Color.DarkRed;
            textStyle.Alignment = TextAlignment.JustifyCenter;

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

            GUIText pauseText = new GUIText();
            pauseText.Style = textStyle;
            pauseText.Text = "Paused";
            pauseText.Size = new Vector2(150, 100);
            pauseText.Position = new Vector2(positionX - (pauseText.Size.X / 2), positionY);
            pauseText.Visible = true;
            pauseText.Folder = this;
        }
        public GameOver_GUI()
        {
            //create the style for the main menu background
            GUIStyle gameOverStyle = new GUIStyle();
            gameOverStyle.IsOpaque = true;
            Style = gameOverStyle;

            //create the style for the menu buttons
            GUITextStyle textStyle = new GUITextStyle();
            textStyle.FontType = "Arial22";
            textStyle.TextColor[CustomColor.ColorBase] = Color.White;
            textStyle.Alignment = TextAlignment.JustifyCenter;

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

            GUIText pauseText = new GUIText();
            pauseText.Style = textStyle;
            pauseText.Text = "Thanks for playing!!";
            pauseText.Size = new Vector2(300, 100);
            pauseText.Position = new Vector2(positionX - (pauseText.Size.X / 2), positionY);
            pauseText.Visible = true;
            pauseText.Folder = this;
        }
        private void Initialize(Vector2 textPosition)
        {
            GUITextStyle textStyle = new GUITextStyle();
            textStyle.FontType = "Arial22";
            textStyle.TextColor[CustomColor.ColorBase] = Color.Bisque;
            textStyle.Alignment = TextAlignment.JustifyCenter;

            text = new GUIText();
            text.Style = textStyle;
            text.Text = "Checkpoint Reached.";
            text.Size = new Vector2(100, 200);
            text.Position = textPosition;
            text.Folder = this;
            text.Visible = true;
        }
        public LoadingScreen_GUI()
        {
            //create the style for the main menu background
            GUIStyle pauseStyle = new GUIStyle();
            pauseStyle.IsOpaque = true;
            Style = pauseStyle;

            //create the style for the menu buttons
            GUITextStyle textStyle = new GUITextStyle();
            textStyle.FontType = "Arial22";
            textStyle.TextColor[CustomColor.ColorBase] = Color.White;
            textStyle.Alignment = TextAlignment.JustifyCenter;

            GUITextStyle controlsStyle = new GUITextStyle();
            controlsStyle.FontType = "Arial22";
            textStyle.TextColor[CustomColor.ColorBase] = Color.White;
            textStyle.Alignment = TextAlignment.JustifyLeft;

            // Based on 1024 * 768
            float positionX = 500;
            float positionY = 200;

            GUIText pauseText;
            string[] controls =
            {
                "Controls:", "A - Move Left", "D - Move Right",
                "Spacebar - Jump", "U - Punch", "I - Swipe"
            };

            for(int i = 0; i < controls.Length; ++i)
            {
                pauseText = new GUIText();
                pauseText.Style = textStyle;
                pauseText.Text = controls[i];
                pauseText.Size = new Vector2(pauseText.Size.X, pauseText.Size.Y+15);
                pauseText.Position = new Vector2(positionX - (pauseText.Size.X / 2), positionY + ((i + 1) * pauseText.Size.Y / 2));
                pauseText.Visible = true;
                pauseText.Folder = this;
            }

            pauseText = new GUIText();
            pauseText.Style = textStyle;
            pauseText.Text = "Loading...";
            pauseText.Size = new Vector2(pauseText.Size.X, pauseText.Size.Y + 15);
            pauseText.Position = new Vector2(positionX - (pauseText.Size.X / 2), positionY + (10 * pauseText.Size.Y / 2));
            pauseText.Visible = true;
            pauseText.Folder = this;
        }
Esempio n. 5
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;
        }
        private ProfileGUI()
        {
            // define gui styles
            GUIStyle rootStyle = new GUIStyle();
            rootStyle.IsOpaque = false;

            GUIStyle scrollerStyle = new GUIStyle();
            scrollerStyle.IsOpaque = true;
            scrollerStyle.FillColor[CustomColor.ColorBase] = new Color(0, 0, 0, 150);
            scrollerStyle.HasBorder = true;
            scrollerStyle.BorderColor[CustomColor.ColorBase] = new Color(0, 0, 0, 200);
            scrollerStyle.Focusable = true;

            GUIMLTextStyle bodyStyle = new GUIMLTextStyle();
            bodyStyle.Alignment = TextAlignment.JustifyLeft;
            bodyStyle.TextColor[CustomColor.ColorBase] = Color.White;
            bodyStyle.SizeToText = true;
            bodyStyle.AutoSizeHeightOnly = true;
            bodyStyle.FontType = "Courier14";

            GUITextStyle textStyle = new GUITextStyle();
            textStyle.Alignment = TextAlignment.JustifyRight;
            textStyle.TextColor[CustomColor.ColorBase] = Color.White;
            textStyle.SizeToText = true;
            textStyle.FontType = "Courier14";

            // init gui controls
            _root = new GUIControl();
            _root.Style = rootStyle;
            _root.HorizSizing = HorizSizing.Width;
            _root.VertSizing = VertSizing.Height;

            _scroll = new GUIScroll();
            _scroll.Style = scrollerStyle;
            _scroll.HorizSizing = HorizSizing.Relative;
            _scroll.VertSizing = VertSizing.Relative;
            _scroll.Position = new Vector2(10.0f, 10.0f);
            _scroll.Size = new Vector2(GUICanvas.Instance.Size.X - 20.0f, GUICanvas.Instance.Size.Y - 20.0f);
            _scroll.FocusOnWake = true;
            _scroll.Visible = true;
            _scroll.Folder = _root;
            _scroll.InputMap = new InputMap();

            int gamepadId = InputManager.Instance.FindDevice("gamepad0");
            _scroll.InputMap.BindAction(gamepadId, (int)XGamePadDevice.GamePadObjects.Left, _OnLeft);
            _scroll.InputMap.BindAction(gamepadId, (int)XGamePadDevice.GamePadObjects.Right, _OnRight);
            _scroll.InputMap.BindAction(gamepadId, (int)XGamePadDevice.GamePadObjects.Start, _OnStart);

            _page = new GUIText();
            _page.Style = textStyle;
            _page.HorizSizing = HorizSizing.Relative;
            _page.VertSizing = VertSizing.Relative;
            _page.Position = new Vector2(GUICanvas.Instance.Size.X - 180.0f, 40.0f);
            _page.Text = string.Empty;
            _page.Visible = true;
            _page.Folder = _root;

            _saveToFile = new GUIText();
            _saveToFile.Style = textStyle;
            _saveToFile.HorizSizing = HorizSizing.Relative;
            _saveToFile.VertSizing = VertSizing.Relative;
            _saveToFile.Position = new Vector2(GUICanvas.Instance.Size.X - 260, 20.0f);
            _saveToFile.Text = string.Empty;
            #if !XBOX
            _saveToFile.Visible = true;
            _saveToFile.Folder = _root;
            #endif // !XBOX

            _text = new GUIMLText();
            _text.Style = bodyStyle;
            _text.HorizSizing = HorizSizing.Width;
            _text.VertSizing = VertSizing.Height;
            _text.Position = new Vector2(3.0f, 3.0f);
            _text.Size = new Vector2(GUICanvas.Instance.Size.X - 40.0f, GUICanvas.Instance.Size.Y - 20.0f);
            _text.Text = "Torque X Profiler\n\nNo profiles have been taken yet.\nPress (F2) to take a snapshot since the last profile.\n\nIf the profiler doesn't seem to be responding, there may be a stack overflow. Make sure that \nfor each StartBlock call there is an EndBlock call. If the code you're profiling has multiple \nreturn paths you will need multiple EndBlock calls: one before each return statement. If \nthis is an issue, try profiling with a debug build to catch the overflow assert (you might \nneed to run your app for a while before you get it, depending on the cause of the overflow).\n\nEnjoy! ;)";
            _text.Visible = true;
            _text.Folder = _scroll;
        }
        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
        }
        public StartMenu_GUI()
        {
            //create the style for the main menu background
            GUIBitmapStyle bitmapStyle = new GUIBitmapStyle();
            Style = bitmapStyle;
            Bitmap = @"data\images\startMenu"; // 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.JustifyLeft;
            buttonStyle.Focusable = true;

            GUITextStyle textStyle = new GUITextStyle();
            textStyle.FontType = "Arial22";
            textStyle.TextColor[CustomColor.ColorBase] = new Color(1.0f, 1.0f, 1.0f, 1.0f);
            textStyle.Alignment = TextAlignment.JustifyCenter;

            // Based on 1024 * 768
            float positionX = 350;
            float positionY = 300;

            #region Buttons
            GUIText text = new GUIText();
            text.Style = textStyle;
            text.Size = new Vector2(800, 100);
            text.Position = new Vector2(400, 150);
            text.Visible = true;
            text.Folder = this;
            text.Text = "The Scarab Gauntlet";

            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();
        }