Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Virtex.Lib.Vrtc.GUI.vxGUITheme"/> class.
        /// </summary>
        /// <param name="Engine">Engine.</param>
        public vxGUITheme(vxEngine Engine)
        {
            this.Engine = Engine;

            //vxButtons = new vxThemeButton(Engine);
            //vxMenuEntries = new vxMenuEntryTheme(Engine);
            vxTextboxes = new vxThemeTextbox(Engine);
            //vxDialogs = new vxThemeDialog(Engine);
            vxLoadingScreen = new vxLoadingScreen(Engine);

            //Load the Default Theme first
            //LoadTheme (PathTooFiles, Engine.EngineContentManager);

            //Initialise Art Providers
            ArtProviderForButtons         = new vxButtonArtProvider(Engine);
            ArtProviderForMenuScreen      = new vxMenuScreenArtProvider(Engine);
            ArtProviderForMenuScreenItems = new vxMenuItemArtProvider(Engine);
            ArtProviderForMessageBoxes    = new vxMessageBoxArtProvider(Engine);
            ArtProviderForDialogs         = new vxDialogArtProvider(Engine);

            SetDefaultTheme();
        }
Пример #2
0
 public virtual void SetArtProvider(vxMessageBoxArtProvider NewArtProvider)
 {
     this.ArtProvider = (vxMessageBoxArtProvider)NewArtProvider.Clone();
 }
Пример #3
0
        /// <summary>
        /// Loads graphics content for this screen. This uses the shared ContentManager
        /// provided by the Game class, so the content will remain loaded forever.
        /// Whenever a subsequent MessageBoxScreen tries to load this same content,
        /// it will just get back another reference to the already loaded data.
        /// </summary>
        public override void LoadContent()
        {
            xGUIManager = new vxGuiManager();

            SetButtonText();

            Vector2 viewportSize = new Vector2(vxEngine.GraphicsDevice.Viewport.Width, vxEngine.GraphicsDevice.Viewport.Height);

            //Setup Buttons
            Btn_Apply           = new vxButton(vxEngine, btn_Apply_text, new Vector2(viewportSize.X / 2 - 115, viewportSize.Y / 2 + 20));
            Btn_Apply.Clicked  += Btn_Apply_Clicked;
            Btn_Ok              = new vxButton(vxEngine, btn_ok_text, new Vector2(viewportSize.X / 2 - 115, viewportSize.Y / 2 + 20));
            Btn_Ok.Clicked     += Btn_Ok_Clicked;
            Btn_Cancel          = new vxButton(vxEngine, btn_ok_Cancel, new Vector2(viewportSize.X / 2 + 15, viewportSize.Y / 2 + 20));
            Btn_Cancel.Clicked += Btn_Cancel_Clicked;

            if (ButtonTypes == vxEnumButtonTypes.OkApplyCancel)
            {
                xGUIManager.Add(Btn_Apply);
            }

            xGUIManager.Add(Btn_Ok);
            xGUIManager.Add(Btn_Cancel);


            spriteBatch = vxEngine.SpriteBatch;
            font        = vxEngine.vxGUITheme.Font;

            // Center the message text in the viewport.
            viewport          = vxEngine.GraphicsDevice.Viewport;
            textTitleSize     = font.MeasureString(Title);
            textSize          = font.MeasureString(message);
            textPosition      = (viewportSize - textSize) / 2;
            textTitlePosition = textPosition - new Vector2(0, 2 * vPad + textTitleSize.Y);

            //Set Gui Item Positions

            int length = Math.Max(vxEngine.vxGUITheme.ArtProviderForButtons.DefaultWidth * 2 + (int)vxEngine.vxGUITheme.Padding.X * 2, (int)textSize.X);

            backgroundRectangle = new Rectangle(
                (int)textPosition.X - hPad,
                (int)textPosition.Y - vPad,
                length + hPad * 2,
                (int)textSize.Y + vPad + vxEngine.vxGUITheme.ArtProviderForButtons.DefaultHeight + vPad * 2);

            TitleRectangle = new Rectangle(
                (int)textPosition.X - hPad,
                (int)textPosition.Y - (int)textTitleSize.Y - vPad * 2 - 5,
                length + hPad * 2,
                (int)textTitleSize.Y + vPad);

            SpriteFont ButtonFont = vxEngine.vxGUITheme.ArtProviderForButtons.Font;

            Btn_Apply.Position = new Vector2(backgroundRectangle.X, backgroundRectangle.Y) + new Vector2(
                backgroundRectangle.Width - vxEngine.vxGUITheme.ArtProviderForButtons.DefaultWidth * 3 - vxEngine.vxGUITheme.Padding.X * 3,
                backgroundRectangle.Height - vxEngine.vxGUITheme.ArtProviderForButtons.DefaultHeight - vxEngine.vxGUITheme.Padding.Y * 2);


            Btn_Ok.Position = new Vector2(backgroundRectangle.X, backgroundRectangle.Y) + new Vector2(
                backgroundRectangle.Width - vxEngine.vxGUITheme.ArtProviderForButtons.DefaultWidth * 2 - vxEngine.vxGUITheme.Padding.X * 2,
                backgroundRectangle.Height - vxEngine.vxGUITheme.ArtProviderForButtons.DefaultHeight - vxEngine.vxGUITheme.Padding.Y * 2);

            Btn_Cancel.Position = new Vector2(backgroundRectangle.X, backgroundRectangle.Y) + new Vector2(
                backgroundRectangle.Width - vxEngine.vxGUITheme.ArtProviderForButtons.DefaultWidth - vxEngine.vxGUITheme.Padding.X,
                backgroundRectangle.Height - vxEngine.vxGUITheme.ArtProviderForButtons.DefaultHeight - vxEngine.vxGUITheme.Padding.Y * 2);


            this.ArtProvider = (vxMessageBoxArtProvider)vxEngine.vxGUITheme.ArtProviderForMessageBoxes.Clone();
        }