示例#1
0
        internal static bool Draw(ref OptionsMenu __instance, GameTime gameTime)
        {
            if (!isInPathfinderMenu)
            {
                return(true);
            }

            PostProcessor.begin();
            GuiData.startDraw();
            PatternDrawer.draw(new Rectangle(0, 0, __instance.ScreenManager.GraphicsDevice.Viewport.Width, __instance.ScreenManager.GraphicsDevice.Viewport.Height), 0.5f, Color.Black, new Color(2, 2, 2), GuiData.spriteBatch);

            if (ReturnButton.Do())
            {
                currentTabName     = null;
                isInPathfinderMenu = false;
                GuiData.endDraw();
                PostProcessor.end();
                var saveEvent = new CustomOptionsSaveEvent();
                EventManager <CustomOptionsSaveEvent> .InvokeAll(saveEvent);

                return(false);
            }

            var tabs = OptionsManager.Tabs;

            int tabX = 10;

            foreach (var tab in tabs.Values)
            {
                if (currentTabName == null)
                {
                    currentTabName = tab.Name;
                }
                var active = currentTabName == tab.Name;
                // Display tab button
                if (Button.doButton(tab.ButtonID, tabX, 70, 128, 20, tab.Name, active ? Color.Green : Color.Gray))
                {
                    currentTabName = tab.Name;
                    break;
                }
                tabX += 128 + 10;

                if (currentTabName != tab.Name)
                {
                    continue;
                }

                // Display options
                int optX = 80, optY = 110;
                foreach (var option in tab.Options)
                {
                    option.Draw(optX, optY);
                    optY += 10 + option.SizeY;
                }
            }

            GuiData.endDraw();
            PostProcessor.end();
            return(false);
        }
        private static void onOptionsSave(CustomOptionsSaveEvent _)
        {
            PathfinderAPIPlugin.Config.TryGetEntry <bool>("PathfinderAPI", "PreloadAllThemes", out var preloadAllThemesVal);
            PathfinderAPIPlugin.Config.TryGetEntry <bool>("PathfinderAPI", "DisableSteamCloudMessage", out var disableCloudMessage);

            preloadAllThemesVal.Value = PreloadAllThemes.Value;
            disableCloudMessage.Value = DisableSteamCloudError.Value;
            PathfinderAPIPlugin.Config.Save();
        }
示例#3
0
 internal static void OptionsSaved(CustomOptionsSaveEvent args)
 {
     PathfinderUpdaterPlugin.IsEnabled.Value         = IsEnabledBox.Value;
     PathfinderUpdaterPlugin.EnablePreReleases.Value = IncludePrerelease.Value;
     PathfinderUpdaterPlugin.NoRestartPrompt.Value   = NoRestartPrompt.Value;
     if (popupScreen != null)
     {
         popupScreen.NoRestartPrompt.Value = PathfinderUpdaterPlugin.NoRestartPrompt.Value;
     }
 }