Esempio n. 1
0
        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);
            PostProcessor.begin();
            ScreenManager.FadeBackBufferToBlack(byte.MaxValue);
            GuiData.startDraw();
            PatternDrawer.draw(
                new Rectangle(0, 0, ScreenManager.GraphicsDevice.Viewport.Width,
                              ScreenManager.GraphicsDevice.Viewport.Height), 0.5f, Color.Black, new Color(2, 2, 2),
                GuiData.spriteBatch);
            if (Button.doButton(999, 10, 10, 200, 30, "<- Back", Color.Gray))
            {
                SettingsLoader.writeStatusFile();
                ExitScreen();
            }
            TextItem.doLabel(new Vector2(400f, 65f), "Resolutions", new Color?());
            var num = currentResIndex;

            currentResIndex = SelectableTextList.doFancyList(10, 400, 100, 200, 450, resolutions, currentResIndex,
                                                             new Color?(), false);
            if (!mouseHasBeenReleasedOnThisScreen)
            {
                currentResIndex = num;
            }
            else if (SelectableTextList.wasActivated)
            {
                resolutionChanged = true;
            }
            TextItem.doLabel(new Vector2(100f, 64f), "Fullscreen", new Color?());
            windowed = CheckBox.doCheckBox(20, 100, 100, windowed, new Color?());
            TextItem.doLabel(new Vector2(100f, 124f), "Bloom", new Color?());
            PostProcessor.bloomEnabled = CheckBox.doCheckBox(21, 100, 160, PostProcessor.bloomEnabled, new Color?());
            TextItem.doLabel(new Vector2(100f, 184f), "Scanlines", new Color?());
            PostProcessor.scanlinesEnabled = CheckBox.doCheckBox(22, 100, 220, PostProcessor.scanlinesEnabled,
                                                                 new Color?());
            TextItem.doLabel(new Vector2(100f, 244f), "Sound Enabled", new Color?());
            MusicManager.setIsMuted(!CheckBox.doCheckBox(23, 100, 280, !MusicManager.isMuted, new Color?()));
            TextItem.doLabel(new Vector2(100f, 305f), "Music Volume", new Color?());
            MusicManager.setVolume(SliderBar.doSliderBar(24, 100, 350, 210, 30, 1f, 0.0f, MusicManager.getVolume(),
                                                         1.0f / 1000.0f));
            TextItem.doLabel(new Vector2(100f, 384f), "Text Size", new Color?());
            currentFontIndex = SelectableTextList.doFancyList(25, 100, 414, 200, 160, fontConfigs, currentFontIndex,
                                                              new Color?(), false);
            if (Button.doButton(990, 10, ScreenManager.GraphicsDevice.Viewport.Height - 120, 200, 30, "Apply Changes",
                                Color.LightBlue))
            {
                needsApply = true;
            }
            GuiData.endDraw();
            PostProcessor.end();
        }
Esempio n. 2
0
        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);
            PostProcessor.begin();
            this.ScreenManager.FadeBackBufferToBlack((int)byte.MaxValue);
            GuiData.startDraw();
            int      x        = 0;
            int      y        = 0;
            Viewport viewport = this.ScreenManager.GraphicsDevice.Viewport;
            int      width    = viewport.Width;

            viewport = this.ScreenManager.GraphicsDevice.Viewport;
            int height = viewport.Height;

            PatternDrawer.draw(new Rectangle(x, y, width, height), 0.5f, Color.Black, new Color(2, 2, 2), GuiData.spriteBatch);
            if (Button.doButton(999, 10, 10, 220, 30, "<- " + LocaleTerms.Loc("Back"), new Color?(Color.Gray)))
            {
                SettingsLoader.writeStatusFile();
                this.ExitScreen();
            }
            if (Button.doButton(9907, 10, 44, 220, 20, LocaleTerms.Loc("Apply Changes"), new Color?(Color.LightBlue)))
            {
                this.needsApply = true;
            }
            int num1 = 100;

            TextItem.doLabel(new Vector2(400f, (float)num1), LocaleTerms.Loc("Resolutions"), new Color?(), 200f);
            int currentResIndex = this.currentResIndex;

            this.currentResIndex = SelectableTextList.doFancyList(10, 400, num1 + 36, 200, 450, this.resolutions, this.currentResIndex, new Color?(), false);
            if (!this.mouseHasBeenReleasedOnThisScreen)
            {
                this.currentResIndex = currentResIndex;
            }
            else if (SelectableTextList.wasActivated)
            {
                this.resolutionChanged = true;
            }
            if (!this.startedFromGameContext)
            {
                TextItem.doLabel(new Vector2(620f, (float)num1), LocaleTerms.Loc("Language"), new Color?(), 200f);
                int currentLocaleIndex = this.currentLocaleIndex;
                this.currentLocaleIndex = SelectableTextList.doFancyList(1013, 620, num1 + 36, 200, 450, this.localeNames, this.currentLocaleIndex, new Color?(), false);
                if (!this.mouseHasBeenReleasedOnThisScreen)
                {
                    this.currentLocaleIndex = currentLocaleIndex;
                }
                else if (SelectableTextList.wasActivated)
                {
                    LocaleActivator.ActivateLocale(LocaleActivator.SupportedLanguages[this.currentLocaleIndex].Code, Game1.getSingleton().Content);
                    Settings.ActiveLocale = LocaleActivator.SupportedLanguages[this.currentLocaleIndex].Code;
                }
            }
            int   num2     = 64;
            float MaxWidth = 280f;
            int   num3;

            TextItem.doLabel(new Vector2(100f, (float)(num3 = num2 + 36)), LocaleTerms.Loc("Fullscreen"), new Color?(), MaxWidth);
            int num4;

            this.windowed = CheckBox.doCheckBox(20, 100, num4 = num3 + 34, this.windowed, new Color?());
            int num5;

            TextItem.doLabel(new Vector2(100f, (float)(num5 = num4 + 32)), LocaleTerms.Loc("Bloom"), new Color?(), MaxWidth);
            int num6;

            PostProcessor.bloomEnabled = CheckBox.doCheckBox(21, 100, num6 = num5 + 34, PostProcessor.bloomEnabled, new Color?());
            int num7;

            TextItem.doLabel(new Vector2(100f, (float)(num7 = num6 + 32)), LocaleTerms.Loc("Scanlines"), new Color?(), MaxWidth);
            int num8;

            PostProcessor.scanlinesEnabled = CheckBox.doCheckBox(22, 100, num8 = num7 + 34, PostProcessor.scanlinesEnabled, new Color?());
            int num9;

            TextItem.doLabel(new Vector2(100f, (float)(num9 = num8 + 32)), LocaleTerms.Loc("Multisampling"), new Color?(), MaxWidth);
            bool shouldMultisample = SettingsLoader.ShouldMultisample;
            int  num10;

            SettingsLoader.ShouldMultisample = CheckBox.doCheckBox(221, 100, num10 = num9 + 34, SettingsLoader.ShouldMultisample, new Color?());
            if (shouldMultisample != SettingsLoader.ShouldMultisample)
            {
                this.resolutionChanged = true;
            }
            int num11;

            TextItem.doLabel(new Vector2(100f, (float)(num11 = num10 + 32)), LocaleTerms.Loc("Audio Visualiser"), new Color?(), MaxWidth);
            int num12;

            SettingsLoader.ShouldDrawMusicVis = CheckBox.doCheckBox(223, 100, num12 = num11 + 34, SettingsLoader.ShouldDrawMusicVis, new Color?());
            int num13;

            TextItem.doLabel(new Vector2(100f, (float)(num13 = num12 + 32)), LocaleTerms.Loc("Sound Enabled"), new Color?(), MaxWidth);
            int num14;

            MusicManager.setIsMuted(!CheckBox.doCheckBox(23, 100, num14 = num13 + 34, !MusicManager.isMuted, new Color?()));
            int num15;

            TextItem.doLabel(new Vector2(100f, (float)(num15 = num14 + 32)), LocaleTerms.Loc("Music Volume"), new Color?(), MaxWidth);
            int num16;

            MusicManager.setVolume(SliderBar.doSliderBar(24, 100, num16 = num15 + 34, 210, 30, 1f, 0.0f, MusicManager.getVolume(), 1f / 1000f));
            int num17;

            TextItem.doLabel(new Vector2(100f, (float)(num17 = num16 + 32)), LocaleTerms.Loc("Text Size"), new Color?(), MaxWidth);
            int currentFontIndex = this.currentFontIndex;
            int num18;

            this.currentFontIndex = SelectableTextList.doFancyList(25, 100, num18 = num17 + 34, 200, 160, this.fontConfigs, this.currentFontIndex, new Color?(), false);
            if (this.currentFontIndex != currentFontIndex && this.startedFromGameContext)
            {
                try
                {
                    if (OS.currentInstance != null)
                    {
                        OS.currentInstance.terminal.reset();
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine((object)ex);
                    Utils.AppendToErrorFile(Utils.GenerateReportFromException(ex));
                }
            }
            if (Button.doButton(990, 10, num18 + 150, 220, 30, LocaleTerms.Loc("Apply Changes"), new Color?(Color.LightBlue)))
            {
                this.needsApply = true;
            }
            GuiData.endDraw();
            PostProcessor.end();
        }