]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Add generic settings tab and move a bunch of settings over (And add the ability to...
authorVasilis <vasilis@pikachu.systems>
Wed, 13 Dec 2023 01:58:20 +0000 (02:58 +0100)
committerGitHub <noreply@github.com>
Wed, 13 Dec 2023 01:58:20 +0000 (17:58 -0800)
Content.Client/Options/UI/OptionsMenu.xaml
Content.Client/Options/UI/OptionsMenu.xaml.cs
Content.Client/Options/UI/Tabs/GraphicsTab.xaml
Content.Client/Options/UI/Tabs/GraphicsTab.xaml.cs
Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs
Content.Client/Options/UI/Tabs/MiscTab.xaml [new file with mode: 0644]
Content.Client/Options/UI/Tabs/MiscTab.xaml.cs [new file with mode: 0644]
Resources/Locale/en-US/escape-menu/ui/options-menu.ftl

index 5d028879fe886c7ecf22ff4785f5f7f2bd250372..ab3b88ca4e6543ef8f98766058f6fe43c09fc9c2 100644 (file)
@@ -3,6 +3,7 @@
             Title="{Loc 'ui-options-title'}"
             MinSize="800 450">
     <TabContainer Name="Tabs" Access="Public">
+        <tabs:MiscTab Name="MiscTab" />
         <tabs:GraphicsTab Name="GraphicsTab" />
         <tabs:KeyRebindTab Name="KeyRebindTab" />
         <tabs:AudioTab Name="AudioTab" />
index 1a924d2af17ec56c802c4425676ea19e1447f97f..c3a8e664705ceee31106ce1a897a22711d9f237f 100644 (file)
@@ -15,10 +15,11 @@ namespace Content.Client.Options.UI
             RobustXamlLoader.Load(this);
             IoCManager.InjectDependencies(this);
 
-            Tabs.SetTabTitle(0, Loc.GetString("ui-options-tab-graphics"));
-            Tabs.SetTabTitle(1, Loc.GetString("ui-options-tab-controls"));
-            Tabs.SetTabTitle(2, Loc.GetString("ui-options-tab-audio"));
-            Tabs.SetTabTitle(3, Loc.GetString("ui-options-tab-network"));
+            Tabs.SetTabTitle(0, Loc.GetString("ui-options-tab-misc"));
+            Tabs.SetTabTitle(1, Loc.GetString("ui-options-tab-graphics"));
+            Tabs.SetTabTitle(2, Loc.GetString("ui-options-tab-controls"));
+            Tabs.SetTabTitle(3, Loc.GetString("ui-options-tab-audio"));
+            Tabs.SetTabTitle(4, Loc.GetString("ui-options-tab-network"));
 
             UpdateTabs();
         }
index e3d45c19dae5d93fe38280fd741b51dec746ac38..74a0c78c526df1f3cf0b67b6fb6bcebb2e272422 100644 (file)
                 <Control MinSize="4 0" />
                 <OptionButton Name="HudThemeOption" />
             </BoxContainer>
-            <CheckBox Name="ShowHeldItemCheckBox" Text="{Loc 'ui-options-show-held-item'}" />
-            <CheckBox Name="ShowCombatModeIndicatorsCheckBox" Text="{Loc 'ui-options-show-combat-mode-indicators'}" />
-            <CheckBox Name="OpaqueStorageWindowCheckBox" Text="{Loc 'ui-options-opaque-storage-window'}" />
-            <CheckBox Name="ShowLoocAboveHeadCheckBox" Text="{Loc 'ui-options-show-looc-on-head'}" />
-            <CheckBox Name="FancySpeechBubblesCheckBox" Text="{Loc 'ui-options-fancy-speech'}" />
-            <CheckBox Name="FancyNameBackgroundsCheckBox" Text="{Loc 'ui-options-fancy-name-background'}" />
             <BoxContainer Orientation="Horizontal">
                 <CheckBox Name="ViewportStretchCheckBox" Text="{Loc 'ui-options-vp-stretch'}" />
                 <BoxContainer Name="ViewportScaleBox" Orientation="Horizontal">
index 7a11885a89d72c10067ffc85176a2cdc7f7f197f..1773b2abe5dc98027dc9b995cd5dffe8c8bd2f39 100644 (file)
@@ -101,13 +101,6 @@ namespace Content.Client.Options.UI.Tabs
                 UpdateApplyButton();
             };
 
-            ShowHeldItemCheckBox.OnToggled += OnCheckBoxToggled;
-            ShowCombatModeIndicatorsCheckBox.OnToggled += OnCheckBoxToggled;
-            OpaqueStorageWindowCheckBox.OnToggled += OnCheckBoxToggled;
-            ShowLoocAboveHeadCheckBox.OnToggled += OnCheckBoxToggled;
-            ShowLoocAboveHeadCheckBox.OnToggled += OnCheckBoxToggled;
-            FancySpeechBubblesCheckBox.OnToggled += OnCheckBoxToggled;
-            FancyNameBackgroundsCheckBox.OnToggled += OnCheckBoxToggled;
             IntegerScalingCheckBox.OnToggled += OnCheckBoxToggled;
             ViewportLowResCheckBox.OnToggled += OnCheckBoxToggled;
             ParallaxLowQualityCheckBox.OnToggled += OnCheckBoxToggled;
@@ -124,12 +117,6 @@ namespace Content.Client.Options.UI.Tabs
             ViewportLowResCheckBox.Pressed = !_cfg.GetCVar(CCVars.ViewportScaleRender);
             ParallaxLowQualityCheckBox.Pressed = _cfg.GetCVar(CCVars.ParallaxLowQuality);
             FpsCounterCheckBox.Pressed = _cfg.GetCVar(CCVars.HudFpsCounterVisible);
-            ShowHeldItemCheckBox.Pressed = _cfg.GetCVar(CCVars.HudHeldItemShow);
-            ShowCombatModeIndicatorsCheckBox.Pressed = _cfg.GetCVar(CCVars.CombatModeIndicatorsPointShow);
-            OpaqueStorageWindowCheckBox.Pressed = _cfg.GetCVar(CCVars.OpaqueStorageWindow);
-            ShowLoocAboveHeadCheckBox.Pressed = _cfg.GetCVar(CCVars.LoocAboveHeadShow);
-            FancySpeechBubblesCheckBox.Pressed = _cfg.GetCVar(CCVars.ChatEnableFancyBubbles);
-            FancyNameBackgroundsCheckBox.Pressed = _cfg.GetCVar(CCVars.ChatFancyNameBackground);
             ViewportWidthSlider.Value = _cfg.GetCVar(CCVars.ViewportWidth);
 
             _cfg.OnValueChanged(CCVars.ViewportMinimumWidth, _ => UpdateViewportWidthRange());
@@ -175,12 +162,6 @@ namespace Content.Client.Options.UI.Tabs
                          IntegerScalingCheckBox.Pressed ? CCVars.ViewportSnapToleranceMargin.DefaultValue : 0);
             _cfg.SetCVar(CCVars.ViewportScaleRender, !ViewportLowResCheckBox.Pressed);
             _cfg.SetCVar(CCVars.ParallaxLowQuality, ParallaxLowQualityCheckBox.Pressed);
-            _cfg.SetCVar(CCVars.HudHeldItemShow, ShowHeldItemCheckBox.Pressed);
-            _cfg.SetCVar(CCVars.CombatModeIndicatorsPointShow, ShowCombatModeIndicatorsCheckBox.Pressed);
-            _cfg.SetCVar(CCVars.OpaqueStorageWindow, OpaqueStorageWindowCheckBox.Pressed);
-            _cfg.SetCVar(CCVars.LoocAboveHeadShow, ShowLoocAboveHeadCheckBox.Pressed);
-            _cfg.SetCVar(CCVars.ChatEnableFancyBubbles, FancySpeechBubblesCheckBox.Pressed);
-            _cfg.SetCVar(CCVars.ChatFancyNameBackground, FancyNameBackgroundsCheckBox.Pressed);
             _cfg.SetCVar(CCVars.HudFpsCounterVisible, FpsCounterCheckBox.Pressed);
             _cfg.SetCVar(CCVars.ViewportWidth, (int) ViewportWidthSlider.Value);
 
@@ -216,12 +197,6 @@ namespace Content.Client.Options.UI.Tabs
             var isIntegerScalingSame = IntegerScalingCheckBox.Pressed == (_cfg.GetCVar(CCVars.ViewportSnapToleranceMargin) != 0);
             var isVPResSame = ViewportLowResCheckBox.Pressed == !_cfg.GetCVar(CCVars.ViewportScaleRender);
             var isPLQSame = ParallaxLowQualityCheckBox.Pressed == _cfg.GetCVar(CCVars.ParallaxLowQuality);
-            var isShowHeldItemSame = ShowHeldItemCheckBox.Pressed == _cfg.GetCVar(CCVars.HudHeldItemShow);
-            var isCombatModeIndicatorsSame = ShowCombatModeIndicatorsCheckBox.Pressed == _cfg.GetCVar(CCVars.CombatModeIndicatorsPointShow);
-            var isOpaqueStorageWindow = OpaqueStorageWindowCheckBox.Pressed == _cfg.GetCVar(CCVars.OpaqueStorageWindow);
-            var isLoocShowSame = ShowLoocAboveHeadCheckBox.Pressed == _cfg.GetCVar(CCVars.LoocAboveHeadShow);
-            var isFancyChatSame = FancySpeechBubblesCheckBox.Pressed == _cfg.GetCVar(CCVars.ChatEnableFancyBubbles);
-            var isFancyBackgroundSame = FancyNameBackgroundsCheckBox.Pressed == _cfg.GetCVar(CCVars.ChatFancyNameBackground);
             var isFpsCounterVisibleSame = FpsCounterCheckBox.Pressed == _cfg.GetCVar(CCVars.HudFpsCounterVisible);
             var isWidthSame = (int) ViewportWidthSlider.Value == _cfg.GetCVar(CCVars.ViewportWidth);
             var isLayoutSame = HudLayoutOption.SelectedMetadata is string opt && opt == _cfg.GetCVar(CCVars.UILayout);
@@ -236,12 +211,6 @@ namespace Content.Client.Options.UI.Tabs
                                    isVPResSame &&
                                    isPLQSame &&
                                    isHudThemeSame &&
-                                   isShowHeldItemSame &&
-                                   isCombatModeIndicatorsSame &&
-                                   isOpaqueStorageWindow &&
-                                   isLoocShowSame &&
-                                   isFancyChatSame &&
-                                   isFancyBackgroundSame &&
                                    isFpsCounterVisibleSame &&
                                    isWidthSame &&
                                    isLayoutSame;
index d8ca500486d7ed2689e68aae4f6c4a1f84d481d9..ce5cf421aef1138b1e2df8881d0396a21717d856 100644 (file)
@@ -183,7 +183,6 @@ namespace Content.Client.Options.UI.Tabs
             AddButton(ContentKeyFunctions.SwapHands);
             AddButton(ContentKeyFunctions.MoveStoredItem);
             AddButton(ContentKeyFunctions.RotateStoredItem);
-            AddCheckBox("ui-options-static-storage-ui", _cfg.GetCVar(CCVars.StaticStorageUI), HandleStaticStorageUI);
 
             AddHeader("ui-options-header-interaction-adv");
             AddButton(ContentKeyFunctions.SmartEquipBackpack);
diff --git a/Content.Client/Options/UI/Tabs/MiscTab.xaml b/Content.Client/Options/UI/Tabs/MiscTab.xaml
new file mode 100644 (file)
index 0000000..8097578
--- /dev/null
@@ -0,0 +1,41 @@
+<tabs:MiscTab xmlns="https://spacestation14.io"
+                  xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
+                  xmlns:tabs="clr-namespace:Content.Client.Options.UI.Tabs"
+                  xmlns:xNamespace="http://schemas.microsoft.com/winfx/2006/xaml"
+                  xmlns:s="clr-namespace:Content.Client.Stylesheets">
+    <BoxContainer Orientation="Vertical">
+        <BoxContainer Orientation="Vertical" Margin="8 8 8 8" VerticalExpand="True">
+            <Label Text="{Loc 'ui-options-general-discord'}"
+                   FontColorOverride="{xNamespace:Static s:StyleNano.NanoGold}"
+                   StyleClasses="LabelKeyText"/>
+            <CheckBox Name="DiscordRich" Text="{Loc 'ui-options-discordrich'}" />
+            <Label Text="{Loc 'ui-options-general-speech'}"
+                   FontColorOverride="{xNamespace:Static s:StyleNano.NanoGold}"
+                   StyleClasses="LabelKeyText"/>
+            <CheckBox Name="ShowLoocAboveHeadCheckBox" Text="{Loc 'ui-options-show-looc-on-head'}" />
+            <CheckBox Name="FancySpeechBubblesCheckBox" Text="{Loc 'ui-options-fancy-speech'}" />
+            <CheckBox Name="FancyNameBackgroundsCheckBox" Text="{Loc 'ui-options-fancy-name-background'}" />
+            <Label Text="{Loc 'ui-options-general-cursor'}"
+                   FontColorOverride="{xNamespace:Static s:StyleNano.NanoGold}"
+                   StyleClasses="LabelKeyText"/>
+            <CheckBox Name="ShowHeldItemCheckBox" Text="{Loc 'ui-options-show-held-item'}" />
+            <CheckBox Name="ShowCombatModeIndicatorsCheckBox" Text="{Loc 'ui-options-show-combat-mode-indicators'}" />
+            <Label Text="{Loc 'ui-options-general-storage'}"
+                   FontColorOverride="{xNamespace:Static s:StyleNano.NanoGold}"
+                   StyleClasses="LabelKeyText"/>
+            <CheckBox Name="OpaqueStorageWindowCheckBox" Text="{Loc 'ui-options-opaque-storage-window'}" />
+            <CheckBox Name="StaticStorageUI" Text="{Loc 'ui-options-static-storage-ui'}" />
+            <!-- <CheckBox Name="ToggleWalk" Text="{Loc 'ui-options-hotkey-toggle-walk'}" /> -->
+
+        </BoxContainer>
+        <controls:StripeBack HasBottomEdge="False" HasMargins="False">
+            <Button Name="ApplyButton"
+                    Text="{Loc 'ui-options-apply'}"
+                    TextAlign="Center"
+                    HorizontalAlignment="Right" />
+        </controls:StripeBack>
+    </BoxContainer>
+</tabs:MiscTab>
+
+
+
diff --git a/Content.Client/Options/UI/Tabs/MiscTab.xaml.cs b/Content.Client/Options/UI/Tabs/MiscTab.xaml.cs
new file mode 100644 (file)
index 0000000..e870bcb
--- /dev/null
@@ -0,0 +1,94 @@
+using Content.Shared.CCVar;
+using Robust.Client.AutoGenerated;
+using Robust.Client.UserInterface;
+using Robust.Client.UserInterface.Controls;
+using Robust.Client.UserInterface.XAML;
+using Robust.Shared;
+using Robust.Shared.Configuration;
+using Robust.Shared.Input;
+
+namespace Content.Client.Options.UI.Tabs
+{
+    [GenerateTypedNameReferences]
+    public sealed partial class MiscTab : Control
+    {
+
+        [Dependency] private readonly IConfigurationManager _cfg = default!;
+
+        public MiscTab()
+        {
+            RobustXamlLoader.Load(this);
+            IoCManager.InjectDependencies(this);
+
+            DiscordRich.OnToggled += OnCheckBoxToggled;
+            ShowLoocAboveHeadCheckBox.OnToggled += OnCheckBoxToggled;
+            ShowHeldItemCheckBox.OnToggled += OnCheckBoxToggled;
+            ShowCombatModeIndicatorsCheckBox.OnToggled += OnCheckBoxToggled;
+            OpaqueStorageWindowCheckBox.OnToggled += OnCheckBoxToggled;
+            FancySpeechBubblesCheckBox.OnToggled += OnCheckBoxToggled;
+            FancyNameBackgroundsCheckBox.OnToggled += OnCheckBoxToggled;
+            // ToggleWalk.OnToggled += OnCheckBoxToggled;
+            StaticStorageUI.OnToggled += OnCheckBoxToggled;
+
+            DiscordRich.Pressed = _cfg.GetCVar(CVars.DiscordEnabled);
+            ShowLoocAboveHeadCheckBox.Pressed = _cfg.GetCVar(CCVars.LoocAboveHeadShow);
+            ShowHeldItemCheckBox.Pressed = _cfg.GetCVar(CCVars.HudHeldItemShow);
+            ShowCombatModeIndicatorsCheckBox.Pressed = _cfg.GetCVar(CCVars.CombatModeIndicatorsPointShow);
+            OpaqueStorageWindowCheckBox.Pressed = _cfg.GetCVar(CCVars.OpaqueStorageWindow);
+            FancySpeechBubblesCheckBox.Pressed = _cfg.GetCVar(CCVars.ChatEnableFancyBubbles);
+            FancyNameBackgroundsCheckBox.Pressed = _cfg.GetCVar(CCVars.ChatFancyNameBackground);
+            // ToggleWalk.Pressed = _cfg.GetCVar(CCVars.ToggleWalk);
+            StaticStorageUI.Pressed = _cfg.GetCVar(CCVars.StaticStorageUI);
+
+
+            ApplyButton.OnPressed += OnApplyButtonPressed;
+            UpdateApplyButton();
+        }
+
+        private void OnCheckBoxToggled(BaseButton.ButtonToggledEventArgs args)
+        {
+            UpdateApplyButton();
+        }
+
+        private void OnApplyButtonPressed(BaseButton.ButtonEventArgs args)
+        {
+            _cfg.SetCVar(CVars.DiscordEnabled, DiscordRich.Pressed);
+            _cfg.SetCVar(CCVars.HudHeldItemShow, ShowHeldItemCheckBox.Pressed);
+            _cfg.SetCVar(CCVars.CombatModeIndicatorsPointShow, ShowCombatModeIndicatorsCheckBox.Pressed);
+            _cfg.SetCVar(CCVars.OpaqueStorageWindow, OpaqueStorageWindowCheckBox.Pressed);
+            _cfg.SetCVar(CCVars.LoocAboveHeadShow, ShowLoocAboveHeadCheckBox.Pressed);
+            _cfg.SetCVar(CCVars.ChatEnableFancyBubbles, FancySpeechBubblesCheckBox.Pressed);
+            _cfg.SetCVar(CCVars.ChatFancyNameBackground, FancyNameBackgroundsCheckBox.Pressed);
+            // _cfg.SetCVar(CCVars.ToggleWalk, ToggleWalk.Pressed);
+            _cfg.SetCVar(CCVars.StaticStorageUI, StaticStorageUI.Pressed);
+
+            _cfg.SaveToFile();
+            UpdateApplyButton();
+        }
+
+        private void UpdateApplyButton()
+        {
+            var isDiscordSame = DiscordRich.Pressed == _cfg.GetCVar(CVars.DiscordEnabled);
+            var isShowHeldItemSame = ShowHeldItemCheckBox.Pressed == _cfg.GetCVar(CCVars.HudHeldItemShow);
+            var isCombatModeIndicatorsSame = ShowCombatModeIndicatorsCheckBox.Pressed == _cfg.GetCVar(CCVars.CombatModeIndicatorsPointShow);
+            var isOpaqueStorageWindow = OpaqueStorageWindowCheckBox.Pressed == _cfg.GetCVar(CCVars.OpaqueStorageWindow);
+            var isLoocShowSame = ShowLoocAboveHeadCheckBox.Pressed == _cfg.GetCVar(CCVars.LoocAboveHeadShow);
+            var isFancyChatSame = FancySpeechBubblesCheckBox.Pressed == _cfg.GetCVar(CCVars.ChatEnableFancyBubbles);
+            var isFancyBackgroundSame = FancyNameBackgroundsCheckBox.Pressed == _cfg.GetCVar(CCVars.ChatFancyNameBackground);
+            // var isToggleWalkSame = ToggleWalk.Pressed == _cfg.GetCVar(CCVars.ToggleWalk);
+            var isStaticStorageUISame = StaticStorageUI.Pressed == _cfg.GetCVar(CCVars.StaticStorageUI);
+
+            ApplyButton.Disabled = isDiscordSame &&
+                                   isShowHeldItemSame &&
+                                   isCombatModeIndicatorsSame &&
+                                   isOpaqueStorageWindow &&
+                                   isLoocShowSame &&
+                                   isFancyChatSame &&
+                                   isFancyBackgroundSame &&
+                                   // isToggleWalkSame &&
+                                   isStaticStorageUISame;
+        }
+
+    }
+
+}
index e9b14b0317b3fa2f6691fa61408ede7d4de206b5..d68e6f2e76daeb87c2295a738fc6042b89587535 100644 (file)
@@ -5,11 +5,20 @@ ui-options-tab-graphics = Graphics
 ui-options-tab-controls = Controls
 ui-options-tab-audio = Audio
 ui-options-tab-network = Network
+ui-options-tab-misc = General
 
 ui-options-apply = Apply
 ui-options-reset-all = Reset All
 ui-options-default = Default
 
+# Misc/General menu
+
+ui-options-discordrich = Enable Discord Rich Presence
+ui-options-general-discord = Discord
+ui-options-general-cursor = Cursor
+ui-options-general-speech = Speech
+ui-options-general-storage = Storage
+
 ## Audio menu
 
 ui-options-master-volume = Master Volume: