Beispiel #1
0
        /// <summary>
        /// Draw components.
        /// </summary>
        /// <param name="b">SpriteBatch instance to draw.</param>
        public override void draw(SpriteBatch b)
        {
            if (Config.FilterBackgroundInMenu)
            {
                //Darken background.
                b.Draw(Game1.fadeToBlackRect, new Rectangle(0, 0, Game1.viewport.Width, Game1.viewport.Height), Color.Black * 0.5f);
            }

            const int x = 16;
            int       y = 16;

            //Draw 'Automation' tab.
            drawTextureBox(b, _tabAutomation.Left, _tabAutomation.Top, _tabAutomation.Width, _tabAutomation.Height, Color.White * (_tabIndex == 0 ? 1.0f : 0.6f));
            b.DrawString(Game1.smallFont, _tabAutomationString, new Vector2(_tabAutomation.Left + 16, _tabAutomation.Top + (_tabAutomation.Height - _font.MeasureString(_tabAutomationString).Y) / 2), Color.Black * (_tabIndex == 0 ? 1.0f : 0.6f));

            //Draw 'Automation' tab.
            drawTextureBox(b, _tabUIs.Left, _tabUIs.Top, _tabUIs.Width, _tabUIs.Height, Color.White * (_tabIndex == 1 ? 1.0f : 0.6f));
            b.DrawString(Game1.smallFont, _tabUIsString, new Vector2(_tabUIs.Left + 16, _tabUIs.Top + (_tabUIs.Height - _font.MeasureString(_tabUIsString).Y) / 2), Color.Black * (_tabIndex == 1 ? 1.0f : 0.6f));

            //Draw 'Automation' tab.
            drawTextureBox(b, _tabMisc.Left, _tabMisc.Top, _tabMisc.Width, _tabMisc.Height, Color.White * (_tabIndex == 2 ? 1.0f : 0.6f));
            b.DrawString(Game1.smallFont, _tabMiscString, new Vector2(_tabMisc.Left + 16, _tabMisc.Top + (_tabMisc.Height - _font.MeasureString(_tabMiscString).Y) / 2), Color.Black * (_tabIndex == 2 ? 1.0f : 0.6f));

            //Draw 'Automation' tab.
            drawTextureBox(b, _tabControls.Left, _tabControls.Top, _tabControls.Width, _tabControls.Height, Color.White * (_tabIndex == 3 ? 1.0f : 0.6f));
            b.DrawString(Game1.smallFont, _tabControlsString, new Vector2(_tabControls.Left + 16, _tabControls.Top + (_tabControls.Height - _font.MeasureString(_tabControlsString).Y) / 2), Color.Black * (_tabIndex == 3 ? 1.0f : 0.6f));

            //Draw window frame.
            drawTextureBox(b, Game1.menuTexture, new Rectangle(0, 256, 60, 60), xPositionOnScreen, yPositionOnScreen, width, height, Color.White, 1.0f, false);
            base.draw(b);

            if (!CanDrawAll(0))
            {
                // All option elements can't be drawn at once.
                // Enabling the scroll bar.
                _scrollBar.visible = true;
                drawTextureBox(b, Game1.mouseCursors, new Rectangle(403, 383, 6, 6), _scrollBarRunner.X, _scrollBarRunner.Y, _scrollBarRunner.Width, _scrollBarRunner.Height, Color.White, 4f, false);
                _scrollBar.draw(b);
            }
            else
            {
                //Disabling the scroll bar.
                _scrollBar.visible = false;
            }

            {
                // Draw the window title (JoE Settings).
                int x2 = (Game1.viewport.Width - 400) / 2;
                drawTextureBox(b, x2, yPositionOnScreen - 108, 400, 100, Color.White);

                const string str  = "JoE Settings";
                Vector2      size = Game1.dialogueFont.MeasureString(str) * 1.1f;

                Utility.drawTextWithShadow(b, str, Game1.dialogueFont, new Vector2((Game1.viewport.Width - size.X) / 2, yPositionOnScreen - 50 - (int)size.Y / 2), Color.Black, 1.1f);
            }

            foreach (OptionsElement element in GetElementsToShow())
            {
                // Draw each option elements.
                element.draw(b, x + xPositionOnScreen, y + yPositionOnScreen);
                y += element.bounds.Height + 16;
            }

            //Draw scroll cursors.
            _upCursor.draw(b);
            _downCursor.draw(b);

            if (_listener != null)
            {
                //Draw the window of active ModifiedInputListener.
                Point size = _listener.GetListeningMessageWindowSize();
                drawTextureBox(b, (Game1.viewport.Width - size.X) / 2, (Game1.viewport.Height - size.Y) / 2, size.X, size.Y, Color.White);
                _listener.DrawStrings(b, (Game1.viewport.Width - size.X) / 2, (Game1.viewport.Height - size.Y) / 2);
            }

            if (_clickListener != null)
            {
                //Draw the window of active ModifiedClickListener.
                Point size = _clickListener.GetListeningMessageWindowSize();
                drawTextureBox(b, (Game1.viewport.Width - size.X) / 2, (Game1.viewport.Height - size.Y) / 2, size.X, size.Y, Color.White);
                _clickListener.DrawStrings(b, (Game1.viewport.Width - size.X) / 2, (Game1.viewport.Height - size.Y) / 2);
            }

            Util.DrawCursor();
        }