diff --git a/Content.Client/Options/UI/OptionDropDown.xaml b/Content.Client/Options/UI/OptionDropDown.xaml
new file mode 100644
index 00000000000000..58dcdca6c8bcd6
--- /dev/null
+++ b/Content.Client/Options/UI/OptionDropDown.xaml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/Content.Client/Options/UI/OptionDropDown.xaml.cs b/Content.Client/Options/UI/OptionDropDown.xaml.cs
new file mode 100644
index 00000000000000..506e241a06ed6d
--- /dev/null
+++ b/Content.Client/Options/UI/OptionDropDown.xaml.cs
@@ -0,0 +1,21 @@
+using Robust.Client.AutoGenerated;
+using Robust.Client.UserInterface;
+
+namespace Content.Client.Options.UI;
+
+///
+/// Standard UI control used for drop-downs in the options menu. Intended for use with .
+///
+///
+[GenerateTypedNameReferences]
+public sealed partial class OptionDropDown : Control
+{
+ ///
+ /// The text describing what this drop-down controls.
+ ///
+ public string? Title
+ {
+ get => NameLabel.Text;
+ set => NameLabel.Text = value;
+ }
+}
diff --git a/Content.Client/Options/UI/OptionSlider.xaml b/Content.Client/Options/UI/OptionSlider.xaml
new file mode 100644
index 00000000000000..fa2d78c67ffbbe
--- /dev/null
+++ b/Content.Client/Options/UI/OptionSlider.xaml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Content.Client/Options/UI/OptionSlider.xaml.cs b/Content.Client/Options/UI/OptionSlider.xaml.cs
new file mode 100644
index 00000000000000..6a377f7ee19262
--- /dev/null
+++ b/Content.Client/Options/UI/OptionSlider.xaml.cs
@@ -0,0 +1,22 @@
+using Robust.Client.AutoGenerated;
+using Robust.Client.UserInterface;
+
+namespace Content.Client.Options.UI;
+
+///
+/// Standard UI control used for sliders in the options menu. Intended for use with .
+///
+///
+///
+[GenerateTypedNameReferences]
+public sealed partial class OptionSlider : Control
+{
+ ///
+ /// The text describing what this slider controls.
+ ///
+ public string? Title
+ {
+ get => NameLabel.Text;
+ set => NameLabel.Text = value;
+ }
+}
diff --git a/Content.Client/Options/UI/OptionsMenu.xaml b/Content.Client/Options/UI/OptionsMenu.xaml
index 4f624c1bb69a68..90486a196ad196 100644
--- a/Content.Client/Options/UI/OptionsMenu.xaml
+++ b/Content.Client/Options/UI/OptionsMenu.xaml
@@ -7,5 +7,6 @@
+
diff --git a/Content.Client/Options/UI/OptionsMenu.xaml.cs b/Content.Client/Options/UI/OptionsMenu.xaml.cs
index 35a3f751bbfe6e..61037f4e4afc4c 100644
--- a/Content.Client/Options/UI/OptionsMenu.xaml.cs
+++ b/Content.Client/Options/UI/OptionsMenu.xaml.cs
@@ -1,9 +1,6 @@
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
-using Robust.Shared.IoC;
-using Content.Client.Options.UI.Tabs;
-
namespace Content.Client.Options.UI
{
@@ -19,13 +16,17 @@ public OptionsMenu()
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-accessibility"));
UpdateTabs();
}
public void UpdateTabs()
{
- GraphicsTab.UpdateProperties();
+ GraphicsTab.Control.ReloadValues();
+ MiscTab.Control.ReloadValues();
+ AccessibilityTab.Control.ReloadValues();
+ AudioTab.Control.ReloadValues();
}
}
}
diff --git a/Content.Client/Options/UI/OptionsTabControlRow.xaml b/Content.Client/Options/UI/OptionsTabControlRow.xaml
new file mode 100644
index 00000000000000..fafdee4df761ee
--- /dev/null
+++ b/Content.Client/Options/UI/OptionsTabControlRow.xaml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/Content.Client/Options/UI/OptionsTabControlRow.xaml.cs b/Content.Client/Options/UI/OptionsTabControlRow.xaml.cs
new file mode 100644
index 00000000000000..31dd9897f4e479
--- /dev/null
+++ b/Content.Client/Options/UI/OptionsTabControlRow.xaml.cs
@@ -0,0 +1,684 @@
+using System.Linq;
+using Content.Client.Stylesheets;
+using Robust.Client.AutoGenerated;
+using Robust.Client.UserInterface;
+using Robust.Client.UserInterface.Controls;
+using Robust.Client.UserInterface.XAML;
+using Robust.Shared.Collections;
+using Robust.Shared.Configuration;
+
+namespace Content.Client.Options.UI;
+
+///
+/// Control used on all tabs of the in-game options menu,
+/// contains the "save" and "reset" buttons and controls the entire logic.
+///
+///
+///
+/// Basic operation is simple: options tabs put this control at the bottom of the tab,
+/// they bind UI controls to it with calls such as ,
+/// then they call . The rest is all handled by the control.
+///
+///
+/// Individual options are implementations of . See the type for details.
+/// Common implementations for building on top of CVars are already exist,
+/// but tabs can define their own if they need to.
+///
+///
+/// Generally, options are added via helper methods such as ,
+/// however it is totally possible to directly instantiate the backing types
+/// and add them via .
+///
+///
+/// The options system is general purpose enough that does not, itself,
+/// know what a CVar is. It does automatically save CVars to config when save is pressed, but otherwise CVar interaction
+/// is handled by implementations.
+///
+///
+/// Behaviorally, the row has 3 control buttons: save, reset changed, and reset to default.
+/// "Save" writes the configuration changes and saves the configuration.
+/// "Reset changed" discards changes made in the menu and re-loads the saved settings.
+/// "Reset to default" resets the settings on the menu to be the default, out-of-the-box values.
+/// Note that "Reset to default" does not save immediately, the user must still press save manually.
+///
+///
+/// The disabled state of the 3 buttons is updated dynamically based on the values of the options.
+///
+///
+[GenerateTypedNameReferences]
+public sealed partial class OptionsTabControlRow : Control
+{
+ [Dependency] private readonly ILocalizationManager _loc = default!;
+ [Dependency] private readonly IConfigurationManager _cfg = default!;
+
+ private ValueList _options;
+
+ public OptionsTabControlRow()
+ {
+ RobustXamlLoader.Load(this);
+ IoCManager.InjectDependencies(this);
+
+ ResetButton.StyleClasses.Add(StyleBase.ButtonOpenRight);
+ ApplyButton.OnPressed += ApplyButtonPressed;
+ ResetButton.OnPressed += ResetButtonPressed;
+ DefaultButton.OnPressed += DefaultButtonPressed;
+ }
+
+ ///
+ /// Add a new option to be tracked by the control.
+ ///
+ /// The option object that manages this object's logic
+ ///
+ /// The type of option being passed in. Necessary to allow the return type to match the parameter type
+ /// for easy chaining.
+ ///
+ /// The same as passed in, for easy chaining.
+ public T AddOption(T option) where T : BaseOption
+ {
+ _options.Add(option);
+ return option;
+ }
+
+ ///
+ /// Add a checkbox option backed by a simple boolean CVar.
+ ///
+ /// The CVar represented by the checkbox.
+ /// The UI control for the option.
+ ///
+ /// If true, the checkbox is inverted relative to the CVar: if the CVar is true, the checkbox will be unchecked.
+ ///
+ /// The option instance backing the added option.
+ ///
+ public OptionCheckboxCVar AddOptionCheckBox(CVarDef cVar, CheckBox checkBox, bool invert = false)
+ {
+ return AddOption(new OptionCheckboxCVar(this, _cfg, cVar, checkBox, invert));
+ }
+
+ ///
+ /// Add a slider option, displayed in percent, backed by a simple float CVar.
+ ///
+ /// The CVar represented by the slider.
+ /// The UI control for the option.
+ /// The minimum value the slider should allow. The default value represents "0%"
+ /// The maximum value the slider should allow. The default value represents "100%"
+ ///
+ /// Scale with which to multiply slider values when mapped to the backing CVar.
+ /// For example, if a scale of 2 is set, a slider at 75% writes a value of 1.5 to the CVar.
+ ///
+ /// The option instance backing the added option.
+ ///
+ ///
+ /// Note that percentage values are represented as ratios in code, i.e. a value of 100% is "1".
+ ///
+ ///
+ public OptionSliderFloatCVar AddOptionPercentSlider(
+ CVarDef cVar,
+ OptionSlider slider,
+ float min = 0,
+ float max = 1,
+ float scale = 1)
+ {
+ return AddOption(new OptionSliderFloatCVar(this, _cfg, cVar, slider, min, max, scale, FormatPercent));
+ }
+
+ ///
+ /// Add a slider option, backed by a simple integer CVar.
+ ///
+ /// The CVar represented by the slider.
+ /// The UI control for the option.
+ /// The minimum value the slider should allow.
+ /// The maximum value the slider should allow.
+ ///
+ /// An optional delegate used to format the textual value display of the slider.
+ /// If not provided, the default behavior is to directly format the integer value as text.
+ ///
+ /// The option instance backing the added option.
+ public OptionSliderIntCVar AddOptionSlider(
+ CVarDef cVar,
+ OptionSlider slider,
+ int min,
+ int max,
+ Func? format = null)
+ {
+ return AddOption(new OptionSliderIntCVar(this, _cfg, cVar, slider, min, max, format ?? FormatInt));
+ }
+
+ ///
+ /// Add a drop-down option, backed by a CVar.
+ ///
+ /// The CVar represented by the drop-down.
+ /// The UI control for the option.
+ ///
+ /// The set of options that will be shown in the drop-down. Items are ordered as provided.
+ ///
+ /// The type of the CVar being controlled.
+ /// The option instance backing the added option.
+ public OptionDropDownCVar AddOptionDropDown(
+ CVarDef cVar,
+ OptionDropDown dropDown,
+ IReadOnlyCollection.ValueOption> options)
+ where T : notnull
+ {
+ return AddOption(new OptionDropDownCVar(this, _cfg, cVar, dropDown, options));
+ }
+
+ ///
+ /// Initializes the control row. This should be called after all options have been added.
+ ///
+ public void Initialize()
+ {
+ foreach (var option in _options)
+ {
+ option.LoadValue();
+ }
+
+ UpdateButtonState();
+ }
+
+ ///
+ /// Re-loads options in the settings from backing values.
+ /// Should be called when the options window is opened to make sure all values are up-to-date.
+ ///
+ public void ReloadValues()
+ {
+ Initialize();
+ }
+
+ ///
+ /// Called by to signal that an option's value changed through user interaction.
+ ///
+ ///
+ /// implementations should not call this function directly,
+ /// instead they should call .
+ ///
+ public void ValueChanged()
+ {
+ UpdateButtonState();
+ }
+
+ private void UpdateButtonState()
+ {
+ var anyModified = _options.Any(option => option.IsModified());
+ var anyModifiedFromDefault = _options.Any(option => option.IsModifiedFromDefault());
+
+ DefaultButton.Disabled = !anyModifiedFromDefault;
+ ApplyButton.Disabled = !anyModified;
+ ResetButton.Disabled = !anyModified;
+ }
+
+ private void ApplyButtonPressed(BaseButton.ButtonEventArgs obj)
+ {
+ foreach (var option in _options)
+ {
+ if (option.IsModified())
+ option.SaveValue();
+ }
+
+ _cfg.SaveToFile();
+ UpdateButtonState();
+ }
+
+ private void ResetButtonPressed(BaseButton.ButtonEventArgs obj)
+ {
+ foreach (var option in _options)
+ {
+ option.LoadValue();
+ }
+
+ UpdateButtonState();
+ }
+
+ private void DefaultButtonPressed(BaseButton.ButtonEventArgs obj)
+ {
+ foreach (var option in _options)
+ {
+ option.ResetToDefault();
+ }
+
+ UpdateButtonState();
+ }
+
+ private string FormatPercent(OptionSliderFloatCVar slider, float value)
+ {
+ return _loc.GetString("ui-options-value-percent", ("value", value));
+ }
+
+ private static string FormatInt(OptionSliderIntCVar slider, int value)
+ {
+ return value.ToString();
+ }
+}
+
+///
+/// Base class of a single "option" for .
+///
+///
+///
+/// Implementations of this class handle loading values from backing storage or defaults,
+/// handling UI controls, and saving. The main does not know what a CVar is.
+///
+///
+/// is a derived class that makes it easier to work with options
+/// backed by a single CVar.
+///
+///
+/// The control row that owns this option.
+///
+public abstract class BaseOption(OptionsTabControlRow controller)
+{
+ ///
+ /// Should be called by derived implementations to indicate that their value changed, due to user interaction.
+ ///
+ protected virtual void ValueChanged()
+ {
+ controller.ValueChanged();
+ }
+
+ ///
+ /// Loads the value represented by this option from its backing store, into the UI state.
+ ///
+ public abstract void LoadValue();
+
+ ///
+ /// Saves the value in the UI state to the backing store.
+ ///
+ public abstract void SaveValue();
+
+ ///
+ /// Resets the UI state to that of the factory-default value. This should not write to the backing store.
+ ///
+ public abstract void ResetToDefault();
+
+ ///
+ /// Called to check if this option's UI value is different from the backing store value.
+ ///
+ /// If true, the UI value is different and was modified by the user.
+ public abstract bool IsModified();
+
+ ///
+ /// Called to check if this option's UI value is different from the backing store's default value.
+ ///
+ /// If true, the UI value is different.
+ public abstract bool IsModifiedFromDefault();
+}
+
+///
+/// Derived class of intended for making mappings to simple CVars easier.
+///
+/// The type of the CVar.
+///
+public abstract class BaseOptionCVar : BaseOption
+ where TValue : notnull
+{
+ ///
+ /// Raised immediately when the UI value of this option is changed by the user, even before saving.
+ ///
+ ///
+ ///
+ /// This can be used to update parts of the options UI based on the state of a checkbox.
+ ///
+ ///
+ public event Action? ImmediateValueChanged;
+
+ private readonly IConfigurationManager _cfg;
+ private readonly CVarDef _cVar;
+
+ ///
+ /// Sets and gets the actual CVar value to/from the frontend UI state or control.
+ ///
+ ///
+ ///
+ /// In the simplest case, this function should set a UI control's state to represent the CVar,
+ /// and inversely conver the UI control's state to the CVar value. For simple controls like a checkbox or slider,
+ /// this just means passing through their value property.
+ ///
+ ///
+ protected abstract TValue Value { get; set; }
+
+ protected BaseOptionCVar(
+ OptionsTabControlRow controller,
+ IConfigurationManager cfg,
+ CVarDef cVar)
+ : base(controller)
+ {
+ _cfg = cfg;
+ _cVar = cVar;
+ }
+
+ public override void LoadValue()
+ {
+ Value = _cfg.GetCVar(_cVar);
+ }
+
+ public override void SaveValue()
+ {
+ _cfg.SetCVar(_cVar, Value);
+ }
+
+ public override void ResetToDefault()
+ {
+ Value = _cVar.DefaultValue;
+ }
+
+ public override bool IsModified()
+ {
+ return !IsValueEqual(Value, _cfg.GetCVar(_cVar));
+ }
+
+ public override bool IsModifiedFromDefault()
+ {
+ return !IsValueEqual(Value, _cVar.DefaultValue);
+ }
+
+ protected virtual bool IsValueEqual(TValue a, TValue b)
+ {
+ // Use different logic for floats so there's some error margin.
+ // This check is handled cleanly at compile-time by the JIT.
+ if (typeof(TValue) == typeof(float))
+ return MathHelper.CloseToPercent((float) (object) a, (float) (object) b);
+
+ return EqualityComparer.Default.Equals(a, b);
+ }
+
+ protected override void ValueChanged()
+ {
+ base.ValueChanged();
+
+ ImmediateValueChanged?.Invoke(Value);
+ }
+}
+
+///
+/// Implementation of a CVar option that simply corresponds with a .
+///
+///
+///
+/// Generally, you should just call AddOption methods on
+/// instead of instantiating this type directly.
+///
+///
+///
+public sealed class OptionCheckboxCVar : BaseOptionCVar
+{
+ private readonly CheckBox _checkBox;
+ private readonly bool _invert;
+
+ protected override bool Value
+ {
+ get => _checkBox.Pressed ^ _invert;
+ set => _checkBox.Pressed = value ^ _invert;
+ }
+
+ ///
+ /// Creates a new instance of this type.
+ ///
+ /// The control row that owns this option.
+ /// The configuration manager to get and set values from.
+ /// The CVar that is being controlled by this option.
+ /// The UI control for the option.
+ ///
+ /// If true, the checkbox is inverted relative to the CVar: if the CVar is true, the checkbox will be unchecked.
+ ///
+ ///
+ ///
+ /// It is generally more convenient to call overloads on
+ /// such as instead of instantiating this type directly.
+ ///
+ ///
+ public OptionCheckboxCVar(
+ OptionsTabControlRow controller,
+ IConfigurationManager cfg,
+ CVarDef cVar,
+ CheckBox checkBox,
+ bool invert)
+ : base(controller, cfg, cVar)
+ {
+ _checkBox = checkBox;
+ _invert = invert;
+ checkBox.OnToggled += _ =>
+ {
+ ValueChanged();
+ };
+ }
+}
+
+///
+/// Implementation of a CVar option that simply corresponds with a floating-point .
+///
+///
+public sealed class OptionSliderFloatCVar : BaseOptionCVar
+{
+ ///
+ /// Scale with which to multiply slider values when mapped to the backing CVar.
+ ///
+ ///
+ /// For example, if a scale of 2 is set, a slider at 75% writes a value of 1.5 to the CVar.
+ ///
+ public float Scale { get; }
+
+ private readonly OptionSlider _slider;
+ private readonly Func _format;
+
+ protected override float Value
+ {
+ get => _slider.Slider.Value * Scale;
+ set
+ {
+ _slider.Slider.Value = value / Scale;
+ UpdateLabelValue();
+ }
+ }
+
+ ///
+ /// Creates a new instance of this type.
+ ///
+ ///
+ ///
+ /// It is generally more convenient to call overloads on
+ /// such as instead of instantiating this type directly.
+ ///
+ ///
+ /// The control row that owns this option.
+ /// The configuration manager to get and set values from.
+ /// The CVar that is being controlled by this option.
+ /// The UI control for the option.
+ /// The minimum value the slider should allow.
+ /// The maximum value the slider should allow.
+ ///
+ /// Scale with which to multiply slider values when mapped to the backing CVar. See .
+ ///
+ /// Function that will be called to format the value display next to the slider.
+ public OptionSliderFloatCVar(
+ OptionsTabControlRow controller,
+ IConfigurationManager cfg,
+ CVarDef cVar,
+ OptionSlider slider,
+ float minValue,
+ float maxValue,
+ float scale,
+ Func format) : base(controller, cfg, cVar)
+ {
+ Scale = scale;
+ _slider = slider;
+ _format = format;
+
+ slider.Slider.MinValue = minValue;
+ slider.Slider.MaxValue = maxValue;
+
+ slider.Slider.OnValueChanged += _ =>
+ {
+ ValueChanged();
+ UpdateLabelValue();
+ };
+ }
+
+ private void UpdateLabelValue()
+ {
+ _slider.ValueLabel.Text = _format(this, _slider.Slider.Value);
+ }
+}
+
+///
+/// Implementation of a CVar option that simply corresponds with an integer .
+///
+///
+public sealed class OptionSliderIntCVar : BaseOptionCVar
+{
+ private readonly OptionSlider _slider;
+ private readonly Func _format;
+
+ protected override int Value
+ {
+ get => (int) _slider.Slider.Value;
+ set
+ {
+ _slider.Slider.Value = value;
+ UpdateLabelValue();
+ }
+ }
+
+ ///
+ /// Creates a new instance of this type.
+ ///
+ ///
+ ///
+ /// It is generally more convenient to call overloads on
+ /// such as instead of instantiating this type directly.
+ ///
+ ///
+ /// The control row that owns this option.
+ /// The configuration manager to get and set values from.
+ /// The CVar that is being controlled by this option.
+ /// The UI control for the option.
+ /// The minimum value the slider should allow.
+ /// The maximum value the slider should allow.
+ /// Function that will be called to format the value display next to the slider.
+ public OptionSliderIntCVar(
+ OptionsTabControlRow controller,
+ IConfigurationManager cfg,
+ CVarDef cVar,
+ OptionSlider slider,
+ int minValue,
+ int maxValue,
+ Func format) : base(controller, cfg, cVar)
+ {
+ _slider = slider;
+ _format = format;
+
+ slider.Slider.MinValue = minValue;
+ slider.Slider.MaxValue = maxValue;
+ slider.Slider.Rounded = true;
+
+ slider.Slider.OnValueChanged += _ =>
+ {
+ ValueChanged();
+ UpdateLabelValue();
+ };
+ }
+
+ private void UpdateLabelValue()
+ {
+ _slider.ValueLabel.Text = _format(this, (int) _slider.Slider.Value);
+ }
+}
+
+///
+/// Implementation of a CVar option via a drop-down.
+///
+///
+public sealed class OptionDropDownCVar : BaseOptionCVar where T : notnull
+{
+ private readonly OptionDropDown _dropDown;
+ private readonly ItemEntry[] _entries;
+
+ protected override T Value
+ {
+ get => (T) _dropDown.Button.SelectedMetadata!;
+ set => _dropDown.Button.SelectId(FindValueId(value));
+ }
+
+ ///
+ /// Creates a new instance of this type.
+ ///
+ ///
+ ///
+ /// It is generally more convenient to call overloads on
+ /// such as instead of instantiating this type directly.
+ ///
+ ///
+ /// The control row that owns this option.
+ /// The configuration manager to get and set values from.
+ /// The CVar that is being controlled by this option.
+ /// The UI control for the option.
+ /// The list of options shown to the user.
+ public OptionDropDownCVar(
+ OptionsTabControlRow controller,
+ IConfigurationManager cfg,
+ CVarDef cVar,
+ OptionDropDown dropDown,
+ IReadOnlyCollection options) : base(controller, cfg, cVar)
+ {
+ if (options.Count == 0)
+ throw new ArgumentException("Need at least one option!");
+
+ _dropDown = dropDown;
+ _entries = new ItemEntry[options.Count];
+
+ var button = dropDown.Button;
+ var i = 0;
+ foreach (var option in options)
+ {
+ _entries[i] = new ItemEntry
+ {
+ Key = option.Key,
+ };
+
+ button.AddItem(option.Label, i);
+ button.SetItemMetadata(button.GetIdx(i), option.Key);
+ i += 1;
+ }
+
+ dropDown.Button.OnItemSelected += args =>
+ {
+ dropDown.Button.SelectId(args.Id);
+ ValueChanged();
+ };
+ }
+
+ private int FindValueId(T value)
+ {
+ for (var i = 0; i < _entries.Length; i++)
+ {
+ if (IsValueEqual(_entries[i].Key, value))
+ return i;
+ }
+
+ // This will just default select the first entry or whatever.
+ return 0;
+ }
+
+ ///
+ /// A single option for a drop-down.
+ ///
+ /// The value that this option has. This is what will be written to the CVar if selected.
+ /// The visual text shown to the user for the option.
+ ///
+ ///
+ public sealed class ValueOption(T key, string label)
+ {
+ ///
+ /// The value that this option has. This is what will be written to the CVar if selected.
+ ///
+ public readonly T Key = key;
+
+ ///
+ /// The visual text shown to the user for the option.
+ ///
+ public readonly string Label = label;
+ }
+
+ private struct ItemEntry
+ {
+ public T Key;
+ }
+}
diff --git a/Content.Client/Options/UI/Tabs/AccessibilityTab.xaml b/Content.Client/Options/UI/Tabs/AccessibilityTab.xaml
new file mode 100644
index 00000000000000..54d92b2b11c88b
--- /dev/null
+++ b/Content.Client/Options/UI/Tabs/AccessibilityTab.xaml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Content.Client/Options/UI/Tabs/AccessibilityTab.xaml.cs b/Content.Client/Options/UI/Tabs/AccessibilityTab.xaml.cs
new file mode 100644
index 00000000000000..15182fbf126b8a
--- /dev/null
+++ b/Content.Client/Options/UI/Tabs/AccessibilityTab.xaml.cs
@@ -0,0 +1,24 @@
+using Content.Shared.CCVar;
+using Robust.Client.AutoGenerated;
+using Robust.Client.UserInterface;
+using Robust.Client.UserInterface.XAML;
+
+namespace Content.Client.Options.UI.Tabs;
+
+[GenerateTypedNameReferences]
+public sealed partial class AccessibilityTab : Control
+{
+ public AccessibilityTab()
+ {
+ RobustXamlLoader.Load(this);
+
+ Control.AddOptionCheckBox(CCVars.ChatEnableColorName, EnableColorNameCheckBox);
+ Control.AddOptionCheckBox(CCVars.AccessibilityColorblindFriendly, ColorblindFriendlyCheckBox);
+ Control.AddOptionCheckBox(CCVars.ReducedMotion, ReducedMotionCheckBox);
+ Control.AddOptionPercentSlider(CCVars.ChatWindowOpacity, ChatWindowOpacitySlider);
+ Control.AddOptionPercentSlider(CCVars.ScreenShakeIntensity, ScreenShakeIntensitySlider);
+
+ Control.Initialize();
+ }
+}
+
diff --git a/Content.Client/Options/UI/Tabs/AudioTab.xaml b/Content.Client/Options/UI/Tabs/AudioTab.xaml
index e54b0dc34ee845..c374af31c588fb 100644
--- a/Content.Client/Options/UI/Tabs/AudioTab.xaml
+++ b/Content.Client/Options/UI/Tabs/AudioTab.xaml
@@ -1,128 +1,26 @@
+ xmlns:ui="clr-namespace:Content.Client.Options.UI">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
diff --git a/Content.Client/Options/UI/Tabs/AudioTab.xaml.cs b/Content.Client/Options/UI/Tabs/AudioTab.xaml.cs
index 470ca7d799d8f6..78186d446c7625 100644
--- a/Content.Client/Options/UI/Tabs/AudioTab.xaml.cs
+++ b/Content.Client/Options/UI/Tabs/AudioTab.xaml.cs
@@ -3,200 +3,72 @@
using Robust.Client.Audio;
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 Range = Robust.Client.UserInterface.Controls.Range;
-namespace Content.Client.Options.UI.Tabs
-{
- [GenerateTypedNameReferences]
- public sealed partial class AudioTab : Control
- {
- [Dependency] private readonly IConfigurationManager _cfg = default!;
- private readonly IAudioManager _audio;
-
- public AudioTab()
- {
- RobustXamlLoader.Load(this);
- IoCManager.InjectDependencies(this);
-
- _audio = IoCManager.Resolve();
- LobbyMusicCheckBox.Pressed = _cfg.GetCVar(CCVars.LobbyMusicEnabled);
- RestartSoundsCheckBox.Pressed = _cfg.GetCVar(CCVars.RestartSoundsEnabled);
- EventMusicCheckBox.Pressed = _cfg.GetCVar(CCVars.EventMusicEnabled);
- AdminSoundsCheckBox.Pressed = _cfg.GetCVar(CCVars.AdminSoundsEnabled);
-
- ApplyButton.OnPressed += OnApplyButtonPressed;
- ResetButton.OnPressed += OnResetButtonPressed;
- MasterVolumeSlider.OnValueChanged += OnMasterVolumeSliderChanged;
- MidiVolumeSlider.OnValueChanged += OnMidiVolumeSliderChanged;
- AmbientMusicVolumeSlider.OnValueChanged += OnAmbientMusicVolumeSliderChanged;
- AmbienceVolumeSlider.OnValueChanged += OnAmbienceVolumeSliderChanged;
- AmbienceSoundsSlider.OnValueChanged += OnAmbienceSoundsSliderChanged;
- LobbyVolumeSlider.OnValueChanged += OnLobbyVolumeSliderChanged;
- InterfaceVolumeSlider.OnValueChanged += OnInterfaceVolumeSliderChanged;
- LobbyMusicCheckBox.OnToggled += OnLobbyMusicCheckToggled;
- RestartSoundsCheckBox.OnToggled += OnRestartSoundsCheckToggled;
- EventMusicCheckBox.OnToggled += OnEventMusicCheckToggled;
- AdminSoundsCheckBox.OnToggled += OnAdminSoundsCheckToggled;
-
- AmbienceSoundsSlider.MinValue = _cfg.GetCVar(CCVars.MinMaxAmbientSourcesConfigured);
- AmbienceSoundsSlider.MaxValue = _cfg.GetCVar(CCVars.MaxMaxAmbientSourcesConfigured);
-
- Reset();
- }
-
- protected override void Dispose(bool disposing)
- {
- ApplyButton.OnPressed -= OnApplyButtonPressed;
- ResetButton.OnPressed -= OnResetButtonPressed;
- MasterVolumeSlider.OnValueChanged -= OnMasterVolumeSliderChanged;
- MidiVolumeSlider.OnValueChanged -= OnMidiVolumeSliderChanged;
- AmbientMusicVolumeSlider.OnValueChanged -= OnAmbientMusicVolumeSliderChanged;
- AmbienceVolumeSlider.OnValueChanged -= OnAmbienceVolumeSliderChanged;
- LobbyVolumeSlider.OnValueChanged -= OnLobbyVolumeSliderChanged;
- InterfaceVolumeSlider.OnValueChanged -= OnInterfaceVolumeSliderChanged;
- base.Dispose(disposing);
- }
-
- private void OnLobbyVolumeSliderChanged(Range obj)
- {
- UpdateChanges();
- }
-
- private void OnInterfaceVolumeSliderChanged(Range obj)
- {
- UpdateChanges();
- }
-
- private void OnAmbientMusicVolumeSliderChanged(Range obj)
- {
- UpdateChanges();
- }
-
- private void OnAmbienceVolumeSliderChanged(Range obj)
- {
- UpdateChanges();
- }
-
- private void OnAmbienceSoundsSliderChanged(Range obj)
- {
- UpdateChanges();
- }
-
- private void OnMasterVolumeSliderChanged(Range range)
- {
- _audio.SetMasterGain(MasterVolumeSlider.Value / 100f * ContentAudioSystem.MasterVolumeMultiplier);
- UpdateChanges();
- }
+namespace Content.Client.Options.UI.Tabs;
- private void OnMidiVolumeSliderChanged(Range range)
- {
- UpdateChanges();
- }
-
- private void OnLobbyMusicCheckToggled(BaseButton.ButtonEventArgs args)
- {
- UpdateChanges();
- }
- private void OnRestartSoundsCheckToggled(BaseButton.ButtonEventArgs args)
- {
- UpdateChanges();
- }
- private void OnEventMusicCheckToggled(BaseButton.ButtonEventArgs args)
- {
- UpdateChanges();
- }
-
- private void OnAdminSoundsCheckToggled(BaseButton.ButtonEventArgs args)
- {
- UpdateChanges();
- }
-
- private void OnApplyButtonPressed(BaseButton.ButtonEventArgs args)
- {
- _cfg.SetCVar(CVars.AudioMasterVolume, MasterVolumeSlider.Value / 100f * ContentAudioSystem.MasterVolumeMultiplier);
- // Want the CVar updated values to have the multiplier applied
- // For the UI we just display 0-100 still elsewhere
- _cfg.SetCVar(CVars.MidiVolume, MidiVolumeSlider.Value / 100f * ContentAudioSystem.MidiVolumeMultiplier);
- _cfg.SetCVar(CCVars.AmbienceVolume, AmbienceVolumeSlider.Value / 100f * ContentAudioSystem.AmbienceMultiplier);
- _cfg.SetCVar(CCVars.AmbientMusicVolume, AmbientMusicVolumeSlider.Value / 100f * ContentAudioSystem.AmbientMusicMultiplier);
- _cfg.SetCVar(CCVars.LobbyMusicVolume, LobbyVolumeSlider.Value / 100f * ContentAudioSystem.LobbyMultiplier);
- _cfg.SetCVar(CCVars.InterfaceVolume, InterfaceVolumeSlider.Value / 100f * ContentAudioSystem.InterfaceMultiplier);
-
- _cfg.SetCVar(CCVars.MaxAmbientSources, (int)AmbienceSoundsSlider.Value);
-
- _cfg.SetCVar(CCVars.LobbyMusicEnabled, LobbyMusicCheckBox.Pressed);
- _cfg.SetCVar(CCVars.RestartSoundsEnabled, RestartSoundsCheckBox.Pressed);
- _cfg.SetCVar(CCVars.EventMusicEnabled, EventMusicCheckBox.Pressed);
- _cfg.SetCVar(CCVars.AdminSoundsEnabled, AdminSoundsCheckBox.Pressed);
- _cfg.SaveToFile();
- UpdateChanges();
- }
-
- private void OnResetButtonPressed(BaseButton.ButtonEventArgs args)
- {
- Reset();
- }
-
- private void Reset()
- {
- MasterVolumeSlider.Value = _cfg.GetCVar(CVars.AudioMasterVolume) * 100f / ContentAudioSystem.MasterVolumeMultiplier;
- MidiVolumeSlider.Value = _cfg.GetCVar(CVars.MidiVolume) * 100f / ContentAudioSystem.MidiVolumeMultiplier;
- AmbienceVolumeSlider.Value = _cfg.GetCVar(CCVars.AmbienceVolume) * 100f / ContentAudioSystem.AmbienceMultiplier;
- AmbientMusicVolumeSlider.Value = _cfg.GetCVar(CCVars.AmbientMusicVolume) * 100f / ContentAudioSystem.AmbientMusicMultiplier;
- LobbyVolumeSlider.Value = _cfg.GetCVar(CCVars.LobbyMusicVolume) * 100f / ContentAudioSystem.LobbyMultiplier;
- InterfaceVolumeSlider.Value = _cfg.GetCVar(CCVars.InterfaceVolume) * 100f / ContentAudioSystem.InterfaceMultiplier;
-
- AmbienceSoundsSlider.Value = _cfg.GetCVar(CCVars.MaxAmbientSources);
-
- LobbyMusicCheckBox.Pressed = _cfg.GetCVar(CCVars.LobbyMusicEnabled);
- RestartSoundsCheckBox.Pressed = _cfg.GetCVar(CCVars.RestartSoundsEnabled);
- EventMusicCheckBox.Pressed = _cfg.GetCVar(CCVars.EventMusicEnabled);
- AdminSoundsCheckBox.Pressed = _cfg.GetCVar(CCVars.AdminSoundsEnabled);
- UpdateChanges();
- }
+[GenerateTypedNameReferences]
+public sealed partial class AudioTab : Control
+{
+ [Dependency] private readonly IConfigurationManager _cfg = default!;
+ [Dependency] private readonly IAudioManager _audio = default!;
- private void UpdateChanges()
- {
- // y'all need jesus.
- var isMasterVolumeSame =
- Math.Abs(MasterVolumeSlider.Value - _cfg.GetCVar(CVars.AudioMasterVolume) * 100f / ContentAudioSystem.MasterVolumeMultiplier) < 0.01f;
- var isMidiVolumeSame =
- Math.Abs(MidiVolumeSlider.Value - _cfg.GetCVar(CVars.MidiVolume) * 100f / ContentAudioSystem.MidiVolumeMultiplier) < 0.01f;
- var isAmbientVolumeSame =
- Math.Abs(AmbienceVolumeSlider.Value - _cfg.GetCVar(CCVars.AmbienceVolume) * 100f / ContentAudioSystem.AmbienceMultiplier) < 0.01f;
- var isAmbientMusicVolumeSame =
- Math.Abs(AmbientMusicVolumeSlider.Value - _cfg.GetCVar(CCVars.AmbientMusicVolume) * 100f / ContentAudioSystem.AmbientMusicMultiplier) < 0.01f;
- var isLobbyVolumeSame =
- Math.Abs(LobbyVolumeSlider.Value - _cfg.GetCVar(CCVars.LobbyMusicVolume) * 100f / ContentAudioSystem.LobbyMultiplier) < 0.01f;
- var isInterfaceVolumeSame =
- Math.Abs(InterfaceVolumeSlider.Value - _cfg.GetCVar(CCVars.InterfaceVolume) * 100f / ContentAudioSystem.InterfaceMultiplier) < 0.01f;
+ public AudioTab()
+ {
+ RobustXamlLoader.Load(this);
+ IoCManager.InjectDependencies(this);
+
+ var masterVolume = Control.AddOptionPercentSlider(
+ CVars.AudioMasterVolume,
+ SliderVolumeMaster,
+ scale: ContentAudioSystem.MasterVolumeMultiplier);
+ masterVolume.ImmediateValueChanged += OnMasterVolumeSliderChanged;
+
+ Control.AddOptionPercentSlider(
+ CVars.MidiVolume,
+ SliderVolumeMidi,
+ scale: ContentAudioSystem.MidiVolumeMultiplier);
+
+ Control.AddOptionPercentSlider(
+ CCVars.AmbientMusicVolume,
+ SliderVolumeAmbientMusic,
+ scale: ContentAudioSystem.AmbientMusicMultiplier);
+
+ Control.AddOptionPercentSlider(
+ CCVars.AmbienceVolume,
+ SliderVolumeAmbience,
+ scale: ContentAudioSystem.AmbienceMultiplier);
+
+ Control.AddOptionPercentSlider(
+ CCVars.LobbyMusicVolume,
+ SliderVolumeLobby,
+ scale: ContentAudioSystem.LobbyMultiplier);
+
+ Control.AddOptionPercentSlider(
+ CCVars.InterfaceVolume,
+ SliderVolumeInterface,
+ scale: ContentAudioSystem.InterfaceMultiplier);
+
+ Control.AddOptionSlider(
+ CCVars.MaxAmbientSources,
+ SliderMaxAmbienceSounds,
+ _cfg.GetCVar(CCVars.MinMaxAmbientSourcesConfigured),
+ _cfg.GetCVar(CCVars.MaxMaxAmbientSourcesConfigured));
+
+ Control.AddOptionCheckBox(CCVars.LobbyMusicEnabled, LobbyMusicCheckBox);
+ Control.AddOptionCheckBox(CCVars.RestartSoundsEnabled, RestartSoundsCheckBox);
+ Control.AddOptionCheckBox(CCVars.EventMusicEnabled, EventMusicCheckBox);
+ Control.AddOptionCheckBox(CCVars.AdminSoundsEnabled, AdminSoundsCheckBox);
+
+ Control.Initialize();
+ }
- var isAmbientSoundsSame = (int)AmbienceSoundsSlider.Value == _cfg.GetCVar(CCVars.MaxAmbientSources);
- var isLobbySame = LobbyMusicCheckBox.Pressed == _cfg.GetCVar(CCVars.LobbyMusicEnabled);
- var isRestartSoundsSame = RestartSoundsCheckBox.Pressed == _cfg.GetCVar(CCVars.RestartSoundsEnabled);
- var isEventSame = EventMusicCheckBox.Pressed == _cfg.GetCVar(CCVars.EventMusicEnabled);
- var isAdminSoundsSame = AdminSoundsCheckBox.Pressed == _cfg.GetCVar(CCVars.AdminSoundsEnabled);
- var isEverythingSame = isMasterVolumeSame && isMidiVolumeSame && isAmbientVolumeSame && isAmbientMusicVolumeSame && isAmbientSoundsSame && isLobbySame && isRestartSoundsSame && isEventSame
- && isAdminSoundsSame && isLobbyVolumeSame && isInterfaceVolumeSame;
- ApplyButton.Disabled = isEverythingSame;
- ResetButton.Disabled = isEverythingSame;
- MasterVolumeLabel.Text =
- Loc.GetString("ui-options-volume-percent", ("volume", MasterVolumeSlider.Value / 100));
- MidiVolumeLabel.Text =
- Loc.GetString("ui-options-volume-percent", ("volume", MidiVolumeSlider.Value / 100));
- AmbientMusicVolumeLabel.Text =
- Loc.GetString("ui-options-volume-percent", ("volume", AmbientMusicVolumeSlider.Value / 100));
- AmbienceVolumeLabel.Text =
- Loc.GetString("ui-options-volume-percent", ("volume", AmbienceVolumeSlider.Value / 100));
- LobbyVolumeLabel.Text =
- Loc.GetString("ui-options-volume-percent", ("volume", LobbyVolumeSlider.Value / 100));
- InterfaceVolumeLabel.Text =
- Loc.GetString("ui-options-volume-percent", ("volume", InterfaceVolumeSlider.Value / 100));
- AmbienceSoundsLabel.Text = ((int)AmbienceSoundsSlider.Value).ToString();
- }
+ private void OnMasterVolumeSliderChanged(float value)
+ {
+ // TODO: I was thinking of giving OptionsTabControlRow a flag to "set CVar immediately", but I'm deferring that
+ // until there's a proper system for enforcing people don't close the window with pending changes.
+ _audio.SetMasterGain(value);
}
}
diff --git a/Content.Client/Options/UI/Tabs/GraphicsTab.xaml b/Content.Client/Options/UI/Tabs/GraphicsTab.xaml
index ec1b9aa002f8b0..f1b9743cad385b 100644
--- a/Content.Client/Options/UI/Tabs/GraphicsTab.xaml
+++ b/Content.Client/Options/UI/Tabs/GraphicsTab.xaml
@@ -1,53 +1,38 @@
+ xmlns:tabs="clr-namespace:Content.Client.Options.UI.Tabs"
+ xmlns:ui="clr-namespace:Content.Client.Options.UI">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
diff --git a/Content.Client/Options/UI/Tabs/GraphicsTab.xaml.cs b/Content.Client/Options/UI/Tabs/GraphicsTab.xaml.cs
index a22adf3e632960..f53a2edd95793b 100644
--- a/Content.Client/Options/UI/Tabs/GraphicsTab.xaml.cs
+++ b/Content.Client/Options/UI/Tabs/GraphicsTab.xaml.cs
@@ -7,220 +7,141 @@
using Robust.Shared;
using Robust.Shared.Configuration;
-namespace Content.Client.Options.UI.Tabs
+namespace Content.Client.Options.UI.Tabs;
+
+[GenerateTypedNameReferences]
+public sealed partial class GraphicsTab : Control
{
- [GenerateTypedNameReferences]
- public sealed partial class GraphicsTab : Control
- {
- private static readonly float[] UIScaleOptions =
- {
- 0f,
- 0.75f,
- 1f,
- 1.25f,
- 1.50f,
- 1.75f,
- 2f
- };
-
- [Dependency] private readonly IConfigurationManager _cfg = default!;
-
- public GraphicsTab()
- {
- IoCManager.InjectDependencies(this);
- RobustXamlLoader.Load(this);
-
- VSyncCheckBox.OnToggled += OnCheckBoxToggled;
- FullscreenCheckBox.OnToggled += OnCheckBoxToggled;
-
- LightingPresetOption.AddItem(Loc.GetString("ui-options-lighting-very-low"));
- LightingPresetOption.AddItem(Loc.GetString("ui-options-lighting-low"));
- LightingPresetOption.AddItem(Loc.GetString("ui-options-lighting-medium"));
- LightingPresetOption.AddItem(Loc.GetString("ui-options-lighting-high"));
- LightingPresetOption.OnItemSelected += OnLightingQualityChanged;
-
- UIScaleOption.AddItem(Loc.GetString("ui-options-scale-auto",
- ("scale", UserInterfaceManager.DefaultUIScale)));
- UIScaleOption.AddItem(Loc.GetString("ui-options-scale-75"));
- UIScaleOption.AddItem(Loc.GetString("ui-options-scale-100"));
- UIScaleOption.AddItem(Loc.GetString("ui-options-scale-125"));
- UIScaleOption.AddItem(Loc.GetString("ui-options-scale-150"));
- UIScaleOption.AddItem(Loc.GetString("ui-options-scale-175"));
- UIScaleOption.AddItem(Loc.GetString("ui-options-scale-200"));
- UIScaleOption.OnItemSelected += OnUIScaleChanged;
-
- ViewportStretchCheckBox.OnToggled += _ =>
- {
- UpdateViewportScale();
- UpdateApplyButton();
- };
+ [Dependency] private readonly IConfigurationManager _cfg = default!;
- ViewportScaleSlider.OnValueChanged += _ =>
- {
- UpdateApplyButton();
- UpdateViewportScale();
- };
+ public GraphicsTab()
+ {
+ IoCManager.InjectDependencies(this);
+ RobustXamlLoader.Load(this);
+
+ Control.AddOptionCheckBox(CVars.DisplayVSync, VSyncCheckBox);
+ Control.AddOption(new OptionFullscreen(Control, _cfg, FullscreenCheckBox));
+ Control.AddOption(new OptionLightingQuality(Control, _cfg, DropDownLightingQuality));
+
+ Control.AddOptionDropDown(
+ CVars.DisplayUIScale,
+ DropDownUIScale,
+ [
+ new OptionDropDownCVar.ValueOption(
+ 0f,
+ Loc.GetString("ui-options-scale-auto", ("scale", UserInterfaceManager.DefaultUIScale))),
+ new OptionDropDownCVar.ValueOption(0.75f, Loc.GetString("ui-options-scale-75")),
+ new OptionDropDownCVar.ValueOption(1.00f, Loc.GetString("ui-options-scale-100")),
+ new OptionDropDownCVar.ValueOption(1.25f, Loc.GetString("ui-options-scale-125")),
+ new OptionDropDownCVar.ValueOption(1.50f, Loc.GetString("ui-options-scale-150")),
+ new OptionDropDownCVar.ValueOption(1.75f, Loc.GetString("ui-options-scale-175")),
+ new OptionDropDownCVar.ValueOption(2.00f, Loc.GetString("ui-options-scale-200")),
+ ]);
+
+ var vpStretch = Control.AddOptionCheckBox(CCVars.ViewportStretch, ViewportStretchCheckBox);
+ var vpVertFit = Control.AddOptionCheckBox(CCVars.ViewportVerticalFit, ViewportVerticalFitCheckBox);
+ Control.AddOptionSlider(
+ CCVars.ViewportFixedScaleFactor,
+ ViewportScaleSlider,
+ 1,
+ 5,
+ (_, value) => Loc.GetString("ui-options-vp-scale-value", ("scale", value)));
+
+ vpStretch.ImmediateValueChanged += _ => UpdateViewportSettingsVisibility();
+ vpVertFit.ImmediateValueChanged += _ => UpdateViewportSettingsVisibility();
+
+ Control.AddOptionSlider(
+ CCVars.ViewportWidth,
+ ViewportWidthSlider,
+ (int)ViewportWidthSlider.Slider.MinValue,
+ (int)ViewportWidthSlider.Slider.MaxValue);
+
+ Control.AddOption(new OptionIntegerScaling(Control, _cfg, IntegerScalingCheckBox));
+ Control.AddOptionCheckBox(CCVars.ViewportScaleRender, ViewportLowResCheckBox, invert: true);
+ Control.AddOptionCheckBox(CCVars.ParallaxLowQuality, ParallaxLowQualityCheckBox);
+ Control.AddOptionCheckBox(CCVars.HudFpsCounterVisible, FpsCounterCheckBox);
+
+ Control.Initialize();
+
+ _cfg.OnValueChanged(CCVars.ViewportMinimumWidth, _ => UpdateViewportWidthRange());
+ _cfg.OnValueChanged(CCVars.ViewportMaximumWidth, _ => UpdateViewportWidthRange());
+
+ UpdateViewportWidthRange();
+ UpdateViewportSettingsVisibility();
+ }
- ViewportWidthSlider.OnValueChanged += _ =>
- {
- UpdateViewportWidthDisplay();
- UpdateApplyButton();
- };
+ private void UpdateViewportSettingsVisibility()
+ {
+ ViewportScaleSlider.Visible = !ViewportStretchCheckBox.Pressed;
+ IntegerScalingCheckBox.Visible = ViewportStretchCheckBox.Pressed;
+ ViewportVerticalFitCheckBox.Visible = ViewportStretchCheckBox.Pressed;
+ ViewportWidthSlider.Visible = !ViewportStretchCheckBox.Pressed || !ViewportVerticalFitCheckBox.Pressed;
+ }
- ViewportVerticalFitCheckBox.OnToggled += _ =>
- {
- UpdateViewportScale();
- UpdateApplyButton();
- };
+ private void UpdateViewportWidthRange()
+ {
+ var min = _cfg.GetCVar(CCVars.ViewportMinimumWidth);
+ var max = _cfg.GetCVar(CCVars.ViewportMaximumWidth);
- IntegerScalingCheckBox.OnToggled += OnCheckBoxToggled;
- ViewportLowResCheckBox.OnToggled += OnCheckBoxToggled;
- ParallaxLowQualityCheckBox.OnToggled += OnCheckBoxToggled;
- FpsCounterCheckBox.OnToggled += OnCheckBoxToggled;
- ApplyButton.OnPressed += OnApplyButtonPressed;
- VSyncCheckBox.Pressed = _cfg.GetCVar(CVars.DisplayVSync);
- FullscreenCheckBox.Pressed = ConfigIsFullscreen;
- LightingPresetOption.SelectId(GetConfigLightingQuality());
- UIScaleOption.SelectId(GetConfigUIScalePreset(ConfigUIScale));
- ViewportScaleSlider.Value = _cfg.GetCVar(CCVars.ViewportFixedScaleFactor);
- ViewportStretchCheckBox.Pressed = _cfg.GetCVar(CCVars.ViewportStretch);
- IntegerScalingCheckBox.Pressed = _cfg.GetCVar(CCVars.ViewportSnapToleranceMargin) != 0;
- ViewportVerticalFitCheckBox.Pressed = _cfg.GetCVar(CCVars.ViewportVerticalFit);
- ViewportLowResCheckBox.Pressed = !_cfg.GetCVar(CCVars.ViewportScaleRender);
- ParallaxLowQualityCheckBox.Pressed = _cfg.GetCVar(CCVars.ParallaxLowQuality);
- FpsCounterCheckBox.Pressed = _cfg.GetCVar(CCVars.HudFpsCounterVisible);
- ViewportWidthSlider.Value = _cfg.GetCVar(CCVars.ViewportWidth);
-
- _cfg.OnValueChanged(CCVars.ViewportMinimumWidth, _ => UpdateViewportWidthRange());
- _cfg.OnValueChanged(CCVars.ViewportMaximumWidth, _ => UpdateViewportWidthRange());
-
- UpdateViewportWidthRange();
- UpdateViewportWidthDisplay();
- UpdateViewportScale();
- UpdateApplyButton();
- }
+ ViewportWidthSlider.Slider.MinValue = min;
+ ViewportWidthSlider.Slider.MaxValue = max;
+ }
- private void OnUIScaleChanged(OptionButton.ItemSelectedEventArgs args)
- {
- UIScaleOption.SelectId(args.Id);
- UpdateApplyButton();
- }
+ private sealed class OptionLightingQuality : BaseOption
+ {
+ private readonly IConfigurationManager _cfg;
+ private readonly OptionDropDown _dropDown;
- private void OnApplyButtonPressed(BaseButton.ButtonEventArgs args)
- {
- _cfg.SetCVar(CVars.DisplayVSync, VSyncCheckBox.Pressed);
- SetConfigLightingQuality(LightingPresetOption.SelectedId);
-
- _cfg.SetCVar(CVars.DisplayWindowMode,
- (int) (FullscreenCheckBox.Pressed ? WindowMode.Fullscreen : WindowMode.Windowed));
- _cfg.SetCVar(CVars.DisplayUIScale, UIScaleOptions[UIScaleOption.SelectedId]);
- _cfg.SetCVar(CCVars.ViewportStretch, ViewportStretchCheckBox.Pressed);
- _cfg.SetCVar(CCVars.ViewportFixedScaleFactor, (int) ViewportScaleSlider.Value);
- _cfg.SetCVar(CCVars.ViewportSnapToleranceMargin,
- IntegerScalingCheckBox.Pressed ? CCVars.ViewportSnapToleranceMargin.DefaultValue : 0);
- _cfg.SetCVar(CCVars.ViewportVerticalFit, ViewportVerticalFitCheckBox.Pressed);
- _cfg.SetCVar(CCVars.ViewportScaleRender, !ViewportLowResCheckBox.Pressed);
- _cfg.SetCVar(CCVars.ParallaxLowQuality, ParallaxLowQualityCheckBox.Pressed);
- _cfg.SetCVar(CCVars.HudFpsCounterVisible, FpsCounterCheckBox.Pressed);
- _cfg.SetCVar(CCVars.ViewportWidth, (int) ViewportWidthSlider.Value);
-
- _cfg.SaveToFile();
- UpdateApplyButton();
- }
+ private const int QualityVeryLow = 0;
+ private const int QualityLow = 1;
+ private const int QualityMedium = 2;
+ private const int QualityHigh = 3;
- private void OnCheckBoxToggled(BaseButton.ButtonToggledEventArgs args)
- {
- UpdateApplyButton();
- }
+ private const int QualityDefault = QualityMedium;
- private void OnLightingQualityChanged(OptionButton.ItemSelectedEventArgs args)
+ public OptionLightingQuality(OptionsTabControlRow controller, IConfigurationManager cfg, OptionDropDown dropDown) : base(controller)
{
- LightingPresetOption.SelectId(args.Id);
- UpdateApplyButton();
+ _cfg = cfg;
+ _dropDown = dropDown;
+ var button = dropDown.Button;
+ button.AddItem(Loc.GetString("ui-options-lighting-very-low"), QualityVeryLow);
+ button.AddItem(Loc.GetString("ui-options-lighting-low"), QualityLow);
+ button.AddItem(Loc.GetString("ui-options-lighting-medium"), QualityMedium);
+ button.AddItem(Loc.GetString("ui-options-lighting-high"), QualityHigh);
+ button.OnItemSelected += OnOptionSelected;
}
- private void UpdateApplyButton()
+ private void OnOptionSelected(OptionButton.ItemSelectedEventArgs obj)
{
- var isVSyncSame = VSyncCheckBox.Pressed == _cfg.GetCVar(CVars.DisplayVSync);
- var isFullscreenSame = FullscreenCheckBox.Pressed == ConfigIsFullscreen;
- var isLightingQualitySame = LightingPresetOption.SelectedId == GetConfigLightingQuality();
- var isUIScaleSame = MathHelper.CloseToPercent(UIScaleOptions[UIScaleOption.SelectedId], ConfigUIScale);
- var isVPStretchSame = ViewportStretchCheckBox.Pressed == _cfg.GetCVar(CCVars.ViewportStretch);
- var isVPScaleSame = (int) ViewportScaleSlider.Value == _cfg.GetCVar(CCVars.ViewportFixedScaleFactor);
- var isIntegerScalingSame = IntegerScalingCheckBox.Pressed == (_cfg.GetCVar(CCVars.ViewportSnapToleranceMargin) != 0);
- var isVPVerticalFitSame = ViewportVerticalFitCheckBox.Pressed == _cfg.GetCVar(CCVars.ViewportVerticalFit);
- var isVPResSame = ViewportLowResCheckBox.Pressed == !_cfg.GetCVar(CCVars.ViewportScaleRender);
- var isPLQSame = ParallaxLowQualityCheckBox.Pressed == _cfg.GetCVar(CCVars.ParallaxLowQuality);
- var isFpsCounterVisibleSame = FpsCounterCheckBox.Pressed == _cfg.GetCVar(CCVars.HudFpsCounterVisible);
- var isWidthSame = (int) ViewportWidthSlider.Value == _cfg.GetCVar(CCVars.ViewportWidth);
-
- ApplyButton.Disabled = isVSyncSame &&
- isFullscreenSame &&
- isLightingQualitySame &&
- isUIScaleSame &&
- isVPStretchSame &&
- isVPScaleSame &&
- isIntegerScalingSame &&
- isVPVerticalFitSame &&
- isVPResSame &&
- isPLQSame &&
- isFpsCounterVisibleSame &&
- isWidthSame;
+ _dropDown.Button.SelectId(obj.Id);
+ ValueChanged();
}
- private bool ConfigIsFullscreen =>
- _cfg.GetCVar(CVars.DisplayWindowMode) == (int) WindowMode.Fullscreen;
-
- public void UpdateProperties()
+ public override void LoadValue()
{
- FullscreenCheckBox.Pressed = ConfigIsFullscreen;
+ _dropDown.Button.SelectId(GetConfigLightingQuality());
}
-
- private float ConfigUIScale => _cfg.GetCVar(CVars.DisplayUIScale);
-
- private int GetConfigLightingQuality()
+ public override void SaveValue()
{
- var val = _cfg.GetCVar(CVars.LightResolutionScale);
- var soft = _cfg.GetCVar(CVars.LightSoftShadows);
- if (val <= 0.125)
- {
- return 0;
- }
- else if ((val <= 0.5) && !soft)
- {
- return 1;
- }
- else if (val <= 0.5)
+ switch (_dropDown.Button.SelectedId)
{
- return 2;
- }
- else
- {
- return 3;
- }
- }
-
- private void SetConfigLightingQuality(int value)
- {
- switch (value)
- {
- case 0:
+ case QualityVeryLow:
_cfg.SetCVar(CVars.LightResolutionScale, 0.125f);
_cfg.SetCVar(CVars.LightSoftShadows, false);
_cfg.SetCVar(CVars.LightBlur, false);
break;
- case 1:
+ case QualityLow:
_cfg.SetCVar(CVars.LightResolutionScale, 0.5f);
_cfg.SetCVar(CVars.LightSoftShadows, false);
_cfg.SetCVar(CVars.LightBlur, true);
break;
- case 2:
+ default: // = QualityMedium
_cfg.SetCVar(CVars.LightResolutionScale, 0.5f);
_cfg.SetCVar(CVars.LightSoftShadows, true);
_cfg.SetCVar(CVars.LightBlur, true);
break;
- case 3:
+ case QualityHigh:
_cfg.SetCVar(CVars.LightResolutionScale, 1);
_cfg.SetCVar(CVars.LightSoftShadows, true);
_cfg.SetCVar(CVars.LightBlur, true);
@@ -228,40 +149,83 @@ private void SetConfigLightingQuality(int value)
}
}
- private static int GetConfigUIScalePreset(float value)
+ public override void ResetToDefault()
{
- for (var i = 0; i < UIScaleOptions.Length; i++)
- {
- if (MathHelper.CloseToPercent(UIScaleOptions[i], value))
- {
- return i;
- }
- }
+ _dropDown.Button.SelectId(QualityDefault);
+ }
+
+ public override bool IsModified()
+ {
+ return _dropDown.Button.SelectedId != GetConfigLightingQuality();
+ }
+
+ public override bool IsModifiedFromDefault()
+ {
+ return _dropDown.Button.SelectedId != QualityDefault;
+ }
+
+ private int GetConfigLightingQuality()
+ {
+ var val = _cfg.GetCVar(CVars.LightResolutionScale);
+ var soft = _cfg.GetCVar(CVars.LightSoftShadows);
+ if (val <= 0.125)
+ return QualityVeryLow;
+
+ if ((val <= 0.5) && !soft)
+ return QualityLow;
- return 0;
+ if (val <= 0.5)
+ return QualityMedium;
+
+ return QualityHigh;
}
+ }
+
+ private sealed class OptionFullscreen : BaseOptionCVar
+ {
+ private readonly CheckBox _checkBox;
- private void UpdateViewportScale()
+ protected override int Value
{
- ViewportScaleBox.Visible = !ViewportStretchCheckBox.Pressed;
- IntegerScalingCheckBox.Visible = ViewportStretchCheckBox.Pressed;
- ViewportVerticalFitCheckBox.Visible = ViewportStretchCheckBox.Pressed;
- ViewportWidthSlider.Visible = ViewportWidthSliderDisplay.Visible = !ViewportStretchCheckBox.Pressed || ViewportStretchCheckBox.Pressed && !ViewportVerticalFitCheckBox.Pressed;
- ViewportScaleText.Text = Loc.GetString("ui-options-vp-scale", ("scale", ViewportScaleSlider.Value));
+ get => _checkBox.Pressed ? (int) WindowMode.Fullscreen : (int) WindowMode.Windowed;
+ set => _checkBox.Pressed = (value == (int) WindowMode.Fullscreen);
}
- private void UpdateViewportWidthRange()
+ public OptionFullscreen(
+ OptionsTabControlRow controller,
+ IConfigurationManager cfg,
+ CheckBox checkBox)
+ : base(controller, cfg, CVars.DisplayWindowMode)
{
- var min = _cfg.GetCVar(CCVars.ViewportMinimumWidth);
- var max = _cfg.GetCVar(CCVars.ViewportMaximumWidth);
+ _checkBox = checkBox;
+ _checkBox.OnToggled += _ =>
+ {
+ ValueChanged();
+ };
+ }
+ }
- ViewportWidthSlider.MinValue = min;
- ViewportWidthSlider.MaxValue = max;
+ private sealed class OptionIntegerScaling : BaseOptionCVar
+ {
+ private readonly CheckBox _checkBox;
+
+ protected override int Value
+ {
+ get => _checkBox.Pressed ? CCVars.ViewportSnapToleranceMargin.DefaultValue : 0;
+ set => _checkBox.Pressed = (value != 0);
}
- private void UpdateViewportWidthDisplay()
+ public OptionIntegerScaling(
+ OptionsTabControlRow controller,
+ IConfigurationManager cfg,
+ CheckBox checkBox)
+ : base(controller, cfg, CCVars.ViewportSnapToleranceMargin)
{
- ViewportWidthSliderDisplay.Text = Loc.GetString("ui-options-vp-width", ("width", (int) ViewportWidthSlider.Value));
+ _checkBox = checkBox;
+ _checkBox.OnToggled += _ =>
+ {
+ ValueChanged();
+ };
}
}
}
diff --git a/Content.Client/Options/UI/Tabs/MiscTab.xaml b/Content.Client/Options/UI/Tabs/MiscTab.xaml
index 0c6ec3804245da..c1733e209dbe7f 100644
--- a/Content.Client/Options/UI/Tabs/MiscTab.xaml
+++ b/Content.Client/Options/UI/Tabs/MiscTab.xaml
@@ -1,76 +1,34 @@
+ xmlns:tabs="clr-namespace:Content.Client.Options.UI.Tabs"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:ui="clr-namespace:Content.Client.Options.UI">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
+
diff --git a/Content.Client/Options/UI/Tabs/MiscTab.xaml.cs b/Content.Client/Options/UI/Tabs/MiscTab.xaml.cs
index 13e3fd05f550ff..2aad4e1d0b6274 100644
--- a/Content.Client/Options/UI/Tabs/MiscTab.xaml.cs
+++ b/Content.Client/Options/UI/Tabs/MiscTab.xaml.cs
@@ -5,201 +5,54 @@
using Robust.Client.AutoGenerated;
using Robust.Client.Player;
using Robust.Client.UserInterface;
-using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared;
-using Robust.Shared.Configuration;
-using Robust.Shared.Network;
-using Robust.Shared.Player;
using Robust.Shared.Prototypes;
-using Range = Robust.Client.UserInterface.Controls.Range;
-namespace Content.Client.Options.UI.Tabs
-{
- [GenerateTypedNameReferences]
- public sealed partial class MiscTab : Control
- {
- [Dependency] private readonly IPlayerManager _playerManager = default!;
- [Dependency] private readonly IConfigurationManager _cfg = default!;
- [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
-
- private readonly Dictionary _hudThemeIdToIndex = new();
-
- public MiscTab()
- {
- RobustXamlLoader.Load(this);
- IoCManager.InjectDependencies(this);
-
- var themes = _prototypeManager.EnumeratePrototypes().ToList();
- themes.Sort();
- foreach (var gear in themes)
- {
- HudThemeOption.AddItem(Loc.GetString(gear.Name));
- _hudThemeIdToIndex.Add(gear.ID, HudThemeOption.GetItemId(HudThemeOption.ItemCount - 1));
- }
-
- var hudLayout = _cfg.GetCVar(CCVars.UILayout);
- var id = 0;
- foreach (var layout in Enum.GetValues(typeof(ScreenType)))
- {
- var name = layout.ToString()!;
- HudLayoutOption.AddItem(name, id);
- if (name == hudLayout)
- {
- HudLayoutOption.SelectId(id);
- }
- HudLayoutOption.SetItemMetadata(id, name);
-
- id++;
- }
-
- HudLayoutOption.OnItemSelected += args =>
- {
- HudLayoutOption.SelectId(args.Id);
- UpdateApplyButton();
- };
-
- // Channel can be null in replays so.
- // ReSharper disable once ConditionalAccessQualifierIsNonNullableAccordingToAPIContract
- ShowOocPatronColor.Visible = _playerManager.LocalSession?.Channel?.UserData.PatronTier is { };
-
- HudThemeOption.OnItemSelected += OnHudThemeChanged;
- DiscordRich.OnToggled += OnCheckBoxToggled;
- ShowOocPatronColor.OnToggled += OnCheckBoxToggled;
- ShowLoocAboveHeadCheckBox.OnToggled += OnCheckBoxToggled;
- ShowHeldItemCheckBox.OnToggled += OnCheckBoxToggled;
- ShowCombatModeIndicatorsCheckBox.OnToggled += OnCheckBoxToggled;
- OpaqueStorageWindowCheckBox.OnToggled += OnCheckBoxToggled;
- FancySpeechBubblesCheckBox.OnToggled += OnCheckBoxToggled;
- FancyNameBackgroundsCheckBox.OnToggled += OnCheckBoxToggled;
- EnableColorNameCheckBox.OnToggled += OnCheckBoxToggled;
- ColorblindFriendlyCheckBox.OnToggled += OnCheckBoxToggled;
- ReducedMotionCheckBox.OnToggled += OnCheckBoxToggled;
- ChatWindowOpacitySlider.OnValueChanged += OnChatWindowOpacitySliderChanged;
- ScreenShakeIntensitySlider.OnValueChanged += OnScreenShakeIntensitySliderChanged;
- // ToggleWalk.OnToggled += OnCheckBoxToggled;
- StaticStorageUI.OnToggled += OnCheckBoxToggled;
-
- HudThemeOption.SelectId(_hudThemeIdToIndex.GetValueOrDefault(_cfg.GetCVar(CVars.InterfaceTheme), 0));
- DiscordRich.Pressed = _cfg.GetCVar(CVars.DiscordEnabled);
- ShowOocPatronColor.Pressed = _cfg.GetCVar(CCVars.ShowOocPatronColor);
- 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);
- EnableColorNameCheckBox.Pressed = _cfg.GetCVar(CCVars.ChatEnableColorName);
- ColorblindFriendlyCheckBox.Pressed = _cfg.GetCVar(CCVars.AccessibilityColorblindFriendly);
- ReducedMotionCheckBox.Pressed = _cfg.GetCVar(CCVars.ReducedMotion);
- ChatWindowOpacitySlider.Value = _cfg.GetCVar(CCVars.ChatWindowOpacity);
- ScreenShakeIntensitySlider.Value = _cfg.GetCVar(CCVars.ScreenShakeIntensity) * 100f;
- // ToggleWalk.Pressed = _cfg.GetCVar(CCVars.ToggleWalk);
- StaticStorageUI.Pressed = _cfg.GetCVar(CCVars.StaticStorageUI);
-
-
- ApplyButton.OnPressed += OnApplyButtonPressed;
- UpdateApplyButton();
- }
+namespace Content.Client.Options.UI.Tabs;
- private void OnCheckBoxToggled(BaseButton.ButtonToggledEventArgs args)
- {
- UpdateApplyButton();
- }
+[GenerateTypedNameReferences]
+public sealed partial class MiscTab : Control
+{
+ [Dependency] private readonly IPlayerManager _playerManager = default!;
+ [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
- private void OnHudThemeChanged(OptionButton.ItemSelectedEventArgs args)
- {
- HudThemeOption.SelectId(args.Id);
- UpdateApplyButton();
- }
+ public MiscTab()
+ {
+ RobustXamlLoader.Load(this);
+ IoCManager.InjectDependencies(this);
- private void OnChatWindowOpacitySliderChanged(Range range)
+ var themes = _prototypeManager.EnumeratePrototypes().ToList();
+ themes.Sort();
+ var themeEntries = new List.ValueOption>();
+ foreach (var gear in themes)
{
- ChatWindowOpacityLabel.Text = Loc.GetString("ui-options-chat-window-opacity-percent",
- ("opacity", range.Value));
- UpdateApplyButton();
+ themeEntries.Add(new OptionDropDownCVar.ValueOption(gear.ID, Loc.GetString(gear.Name)));
}
- private void OnScreenShakeIntensitySliderChanged(Range obj)
+ var layoutEntries = new List.ValueOption>();
+ foreach (var layout in Enum.GetValues(typeof(ScreenType)))
{
- ScreenShakeIntensityLabel.Text = Loc.GetString("ui-options-screen-shake-percent", ("intensity", ScreenShakeIntensitySlider.Value / 100f));
- UpdateApplyButton();
+ layoutEntries.Add(new OptionDropDownCVar.ValueOption(layout.ToString()!, layout.ToString()!));
}
- private void OnApplyButtonPressed(BaseButton.ButtonEventArgs args)
- {
- foreach (var theme in _prototypeManager.EnumeratePrototypes())
- {
- if (_hudThemeIdToIndex[theme.ID] != HudThemeOption.SelectedId)
- continue;
- _cfg.SetCVar(CVars.InterfaceTheme, theme.ID);
- break;
- }
-
- _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.ShowOocPatronColor, ShowOocPatronColor.Pressed);
- _cfg.SetCVar(CCVars.LoocAboveHeadShow, ShowLoocAboveHeadCheckBox.Pressed);
- _cfg.SetCVar(CCVars.ChatEnableFancyBubbles, FancySpeechBubblesCheckBox.Pressed);
- _cfg.SetCVar(CCVars.ChatFancyNameBackground, FancyNameBackgroundsCheckBox.Pressed);
- _cfg.SetCVar(CCVars.ChatEnableColorName, EnableColorNameCheckBox.Pressed);
- _cfg.SetCVar(CCVars.AccessibilityColorblindFriendly, ColorblindFriendlyCheckBox.Pressed);
- _cfg.SetCVar(CCVars.ReducedMotion, ReducedMotionCheckBox.Pressed);
- _cfg.SetCVar(CCVars.ChatWindowOpacity, ChatWindowOpacitySlider.Value);
- _cfg.SetCVar(CCVars.ScreenShakeIntensity, ScreenShakeIntensitySlider.Value / 100f);
- // _cfg.SetCVar(CCVars.ToggleWalk, ToggleWalk.Pressed);
- _cfg.SetCVar(CCVars.StaticStorageUI, StaticStorageUI.Pressed);
-
- if (HudLayoutOption.SelectedMetadata is string opt)
- {
- _cfg.SetCVar(CCVars.UILayout, opt);
- }
+ // Channel can be null in replays so.
+ // ReSharper disable once ConditionalAccessQualifierIsNonNullableAccordingToAPIContract
+ ShowOocPatronColor.Visible = _playerManager.LocalSession?.Channel?.UserData.PatronTier is { };
- _cfg.SaveToFile();
- UpdateApplyButton();
- }
+ Control.AddOptionDropDown(CVars.InterfaceTheme, DropDownHudTheme, themeEntries);
+ Control.AddOptionDropDown(CCVars.UILayout, DropDownHudLayout, layoutEntries);
- private void UpdateApplyButton()
- {
- var isHudThemeSame = HudThemeOption.SelectedId == _hudThemeIdToIndex.GetValueOrDefault(_cfg.GetCVar(CVars.InterfaceTheme), 0);
- var isLayoutSame = HudLayoutOption.SelectedMetadata is string opt && opt == _cfg.GetCVar(CCVars.UILayout);
- 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 isOocPatronColorShowSame = ShowOocPatronColor.Pressed == _cfg.GetCVar(CCVars.ShowOocPatronColor);
- 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 isEnableColorNameSame = EnableColorNameCheckBox.Pressed == _cfg.GetCVar(CCVars.ChatEnableColorName);
- var isColorblindFriendly = ColorblindFriendlyCheckBox.Pressed == _cfg.GetCVar(CCVars.AccessibilityColorblindFriendly);
- var isReducedMotionSame = ReducedMotionCheckBox.Pressed == _cfg.GetCVar(CCVars.ReducedMotion);
- var isChatWindowOpacitySame = Math.Abs(ChatWindowOpacitySlider.Value - _cfg.GetCVar(CCVars.ChatWindowOpacity)) < 0.01f;
- var isScreenShakeIntensitySame = Math.Abs(ScreenShakeIntensitySlider.Value / 100f - _cfg.GetCVar(CCVars.ScreenShakeIntensity)) < 0.01f;
- // var isToggleWalkSame = ToggleWalk.Pressed == _cfg.GetCVar(CCVars.ToggleWalk);
- var isStaticStorageUISame = StaticStorageUI.Pressed == _cfg.GetCVar(CCVars.StaticStorageUI);
-
- ApplyButton.Disabled = isHudThemeSame &&
- isLayoutSame &&
- isDiscordSame &&
- isShowHeldItemSame &&
- isCombatModeIndicatorsSame &&
- isOpaqueStorageWindow &&
- isOocPatronColorShowSame &&
- isLoocShowSame &&
- isFancyChatSame &&
- isFancyBackgroundSame &&
- isEnableColorNameSame &&
- isColorblindFriendly &&
- isReducedMotionSame &&
- isChatWindowOpacitySame &&
- isScreenShakeIntensitySame &&
- // isToggleWalkSame &&
- isStaticStorageUISame;
- }
+ Control.AddOptionCheckBox(CVars.DiscordEnabled, DiscordRich);
+ Control.AddOptionCheckBox(CCVars.ShowOocPatronColor, ShowOocPatronColor);
+ Control.AddOptionCheckBox(CCVars.LoocAboveHeadShow, ShowLoocAboveHeadCheckBox);
+ Control.AddOptionCheckBox(CCVars.HudHeldItemShow, ShowHeldItemCheckBox);
+ Control.AddOptionCheckBox(CCVars.CombatModeIndicatorsPointShow, ShowCombatModeIndicatorsCheckBox);
+ Control.AddOptionCheckBox(CCVars.OpaqueStorageWindow, OpaqueStorageWindowCheckBox);
+ Control.AddOptionCheckBox(CCVars.ChatEnableFancyBubbles, FancySpeechBubblesCheckBox);
+ Control.AddOptionCheckBox(CCVars.ChatFancyNameBackground, FancyNameBackgroundsCheckBox);
+ Control.AddOptionCheckBox(CCVars.StaticStorageUI, StaticStorageUI);
+ Control.Initialize();
}
-
}
diff --git a/Content.Server.Database/Migrations/Postgres/20240621120713_ConnectionLogTimeIndex.Designer.cs b/Content.Server.Database/Migrations/Postgres/20240621120713_ConnectionLogTimeIndex.Designer.cs
new file mode 100644
index 00000000000000..8bd837236af4e6
--- /dev/null
+++ b/Content.Server.Database/Migrations/Postgres/20240621120713_ConnectionLogTimeIndex.Designer.cs
@@ -0,0 +1,1915 @@
+//
+using System;
+using System.Net;
+using System.Text.Json;
+using Content.Server.Database;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+using NpgsqlTypes;
+
+#nullable disable
+
+namespace Content.Server.Database.Migrations.Postgres
+{
+ [DbContext(typeof(PostgresServerDbContext))]
+ [Migration("20240621120713_ConnectionLogTimeIndex")]
+ partial class ConnectionLogTimeIndex
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "8.0.0")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+ modelBuilder.Entity("Content.Server.Database.Admin", b =>
+ {
+ b.Property("UserId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid")
+ .HasColumnName("user_id");
+
+ b.Property("AdminRankId")
+ .HasColumnType("integer")
+ .HasColumnName("admin_rank_id");
+
+ b.Property("Title")
+ .HasColumnType("text")
+ .HasColumnName("title");
+
+ b.HasKey("UserId")
+ .HasName("PK_admin");
+
+ b.HasIndex("AdminRankId")
+ .HasDatabaseName("IX_admin_admin_rank_id");
+
+ b.ToTable("admin", (string)null);
+ });
+
+ modelBuilder.Entity("Content.Server.Database.AdminFlag", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("admin_flag_id");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("AdminId")
+ .HasColumnType("uuid")
+ .HasColumnName("admin_id");
+
+ b.Property("Flag")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("flag");
+
+ b.Property("Negative")
+ .HasColumnType("boolean")
+ .HasColumnName("negative");
+
+ b.HasKey("Id")
+ .HasName("PK_admin_flag");
+
+ b.HasIndex("AdminId")
+ .HasDatabaseName("IX_admin_flag_admin_id");
+
+ b.HasIndex("Flag", "AdminId")
+ .IsUnique();
+
+ b.ToTable("admin_flag", (string)null);
+ });
+
+ modelBuilder.Entity("Content.Server.Database.AdminLog", b =>
+ {
+ b.Property("RoundId")
+ .HasColumnType("integer")
+ .HasColumnName("round_id");
+
+ b.Property("Id")
+ .HasColumnType("integer")
+ .HasColumnName("admin_log_id");
+
+ b.Property("Date")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("date");
+
+ b.Property("Impact")
+ .HasColumnType("smallint")
+ .HasColumnName("impact");
+
+ b.Property("Json")
+ .IsRequired()
+ .HasColumnType("jsonb")
+ .HasColumnName("json");
+
+ b.Property("Message")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("message");
+
+ b.Property("Type")
+ .HasColumnType("integer")
+ .HasColumnName("type");
+
+ b.HasKey("RoundId", "Id")
+ .HasName("PK_admin_log");
+
+ b.HasIndex("Date");
+
+ b.HasIndex("Message")
+ .HasAnnotation("Npgsql:TsVectorConfig", "english");
+
+ NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("Message"), "GIN");
+
+ b.HasIndex("Type")
+ .HasDatabaseName("IX_admin_log_type");
+
+ b.ToTable("admin_log", (string)null);
+ });
+
+ modelBuilder.Entity("Content.Server.Database.AdminLogPlayer", b =>
+ {
+ b.Property("RoundId")
+ .HasColumnType("integer")
+ .HasColumnName("round_id");
+
+ b.Property("LogId")
+ .HasColumnType("integer")
+ .HasColumnName("log_id");
+
+ b.Property("PlayerUserId")
+ .HasColumnType("uuid")
+ .HasColumnName("player_user_id");
+
+ b.HasKey("RoundId", "LogId", "PlayerUserId")
+ .HasName("PK_admin_log_player");
+
+ b.HasIndex("PlayerUserId")
+ .HasDatabaseName("IX_admin_log_player_player_user_id");
+
+ b.ToTable("admin_log_player", (string)null);
+ });
+
+ modelBuilder.Entity("Content.Server.Database.AdminMessage", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("admin_messages_id");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("CreatedAt")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("created_at");
+
+ b.Property("CreatedById")
+ .HasColumnType("uuid")
+ .HasColumnName("created_by_id");
+
+ b.Property("Deleted")
+ .HasColumnType("boolean")
+ .HasColumnName("deleted");
+
+ b.Property("DeletedAt")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("deleted_at");
+
+ b.Property("DeletedById")
+ .HasColumnType("uuid")
+ .HasColumnName("deleted_by_id");
+
+ b.Property("Dismissed")
+ .HasColumnType("boolean")
+ .HasColumnName("dismissed");
+
+ b.Property("ExpirationTime")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("expiration_time");
+
+ b.Property("LastEditedAt")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("last_edited_at");
+
+ b.Property("LastEditedById")
+ .HasColumnType("uuid")
+ .HasColumnName("last_edited_by_id");
+
+ b.Property("Message")
+ .IsRequired()
+ .HasMaxLength(4096)
+ .HasColumnType("character varying(4096)")
+ .HasColumnName("message");
+
+ b.Property("PlayerUserId")
+ .HasColumnType("uuid")
+ .HasColumnName("player_user_id");
+
+ b.Property("PlaytimeAtNote")
+ .HasColumnType("interval")
+ .HasColumnName("playtime_at_note");
+
+ b.Property("RoundId")
+ .HasColumnType("integer")
+ .HasColumnName("round_id");
+
+ b.Property("Seen")
+ .HasColumnType("boolean")
+ .HasColumnName("seen");
+
+ b.HasKey("Id")
+ .HasName("PK_admin_messages");
+
+ b.HasIndex("CreatedById");
+
+ b.HasIndex("DeletedById");
+
+ b.HasIndex("LastEditedById");
+
+ b.HasIndex("PlayerUserId")
+ .HasDatabaseName("IX_admin_messages_player_user_id");
+
+ b.HasIndex("RoundId")
+ .HasDatabaseName("IX_admin_messages_round_id");
+
+ b.ToTable("admin_messages", null, t =>
+ {
+ t.HasCheckConstraint("NotDismissedAndSeen", "NOT dismissed OR seen");
+ });
+ });
+
+ modelBuilder.Entity("Content.Server.Database.AdminNote", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("admin_notes_id");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("CreatedAt")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("created_at");
+
+ b.Property("CreatedById")
+ .HasColumnType("uuid")
+ .HasColumnName("created_by_id");
+
+ b.Property("Deleted")
+ .HasColumnType("boolean")
+ .HasColumnName("deleted");
+
+ b.Property("DeletedAt")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("deleted_at");
+
+ b.Property("DeletedById")
+ .HasColumnType("uuid")
+ .HasColumnName("deleted_by_id");
+
+ b.Property("ExpirationTime")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("expiration_time");
+
+ b.Property("LastEditedAt")
+ .IsRequired()
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("last_edited_at");
+
+ b.Property("LastEditedById")
+ .HasColumnType("uuid")
+ .HasColumnName("last_edited_by_id");
+
+ b.Property("Message")
+ .IsRequired()
+ .HasMaxLength(4096)
+ .HasColumnType("character varying(4096)")
+ .HasColumnName("message");
+
+ b.Property("PlayerUserId")
+ .HasColumnType("uuid")
+ .HasColumnName("player_user_id");
+
+ b.Property("PlaytimeAtNote")
+ .HasColumnType("interval")
+ .HasColumnName("playtime_at_note");
+
+ b.Property("RoundId")
+ .HasColumnType("integer")
+ .HasColumnName("round_id");
+
+ b.Property("Secret")
+ .HasColumnType("boolean")
+ .HasColumnName("secret");
+
+ b.Property("Severity")
+ .HasColumnType("integer")
+ .HasColumnName("severity");
+
+ b.HasKey("Id")
+ .HasName("PK_admin_notes");
+
+ b.HasIndex("CreatedById");
+
+ b.HasIndex("DeletedById");
+
+ b.HasIndex("LastEditedById");
+
+ b.HasIndex("PlayerUserId")
+ .HasDatabaseName("IX_admin_notes_player_user_id");
+
+ b.HasIndex("RoundId")
+ .HasDatabaseName("IX_admin_notes_round_id");
+
+ b.ToTable("admin_notes", (string)null);
+ });
+
+ modelBuilder.Entity("Content.Server.Database.AdminRank", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("admin_rank_id");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("name");
+
+ b.HasKey("Id")
+ .HasName("PK_admin_rank");
+
+ b.ToTable("admin_rank", (string)null);
+ });
+
+ modelBuilder.Entity("Content.Server.Database.AdminRankFlag", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("admin_rank_flag_id");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("AdminRankId")
+ .HasColumnType("integer")
+ .HasColumnName("admin_rank_id");
+
+ b.Property("Flag")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("flag");
+
+ b.HasKey("Id")
+ .HasName("PK_admin_rank_flag");
+
+ b.HasIndex("AdminRankId");
+
+ b.HasIndex("Flag", "AdminRankId")
+ .IsUnique();
+
+ b.ToTable("admin_rank_flag", (string)null);
+ });
+
+ modelBuilder.Entity("Content.Server.Database.AdminWatchlist", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("admin_watchlists_id");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("CreatedAt")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("created_at");
+
+ b.Property("CreatedById")
+ .HasColumnType("uuid")
+ .HasColumnName("created_by_id");
+
+ b.Property("Deleted")
+ .HasColumnType("boolean")
+ .HasColumnName("deleted");
+
+ b.Property("DeletedAt")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("deleted_at");
+
+ b.Property("DeletedById")
+ .HasColumnType("uuid")
+ .HasColumnName("deleted_by_id");
+
+ b.Property("ExpirationTime")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("expiration_time");
+
+ b.Property("LastEditedAt")
+ .IsRequired()
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("last_edited_at");
+
+ b.Property("LastEditedById")
+ .HasColumnType("uuid")
+ .HasColumnName("last_edited_by_id");
+
+ b.Property("Message")
+ .IsRequired()
+ .HasMaxLength(4096)
+ .HasColumnType("character varying(4096)")
+ .HasColumnName("message");
+
+ b.Property("PlayerUserId")
+ .HasColumnType("uuid")
+ .HasColumnName("player_user_id");
+
+ b.Property("PlaytimeAtNote")
+ .HasColumnType("interval")
+ .HasColumnName("playtime_at_note");
+
+ b.Property("RoundId")
+ .HasColumnType("integer")
+ .HasColumnName("round_id");
+
+ b.HasKey("Id")
+ .HasName("PK_admin_watchlists");
+
+ b.HasIndex("CreatedById");
+
+ b.HasIndex("DeletedById");
+
+ b.HasIndex("LastEditedById");
+
+ b.HasIndex("PlayerUserId")
+ .HasDatabaseName("IX_admin_watchlists_player_user_id");
+
+ b.HasIndex("RoundId")
+ .HasDatabaseName("IX_admin_watchlists_round_id");
+
+ b.ToTable("admin_watchlists", (string)null);
+ });
+
+ modelBuilder.Entity("Content.Server.Database.Antag", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("antag_id");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("AntagName")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("antag_name");
+
+ b.Property("ProfileId")
+ .HasColumnType("integer")
+ .HasColumnName("profile_id");
+
+ b.HasKey("Id")
+ .HasName("PK_antag");
+
+ b.HasIndex("ProfileId", "AntagName")
+ .IsUnique();
+
+ b.ToTable("antag", (string)null);
+ });
+
+ modelBuilder.Entity("Content.Server.Database.AssignedUserId", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("assigned_user_id_id");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("UserId")
+ .HasColumnType("uuid")
+ .HasColumnName("user_id");
+
+ b.Property("UserName")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("user_name");
+
+ b.HasKey("Id")
+ .HasName("PK_assigned_user_id");
+
+ b.HasIndex("UserId")
+ .IsUnique();
+
+ b.HasIndex("UserName")
+ .IsUnique();
+
+ b.ToTable("assigned_user_id", (string)null);
+ });
+
+ modelBuilder.Entity("Content.Server.Database.ConnectionLog", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("connection_log_id");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Address")
+ .IsRequired()
+ .HasColumnType("inet")
+ .HasColumnName("address");
+
+ b.Property("Denied")
+ .HasColumnType("smallint")
+ .HasColumnName("denied");
+
+ b.Property("HWId")
+ .HasColumnType("bytea")
+ .HasColumnName("hwid");
+
+ b.Property("ServerId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasDefaultValue(0)
+ .HasColumnName("server_id");
+
+ b.Property("Time")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("time");
+
+ b.Property("UserId")
+ .HasColumnType("uuid")
+ .HasColumnName("user_id");
+
+ b.Property("UserName")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("user_name");
+
+ b.HasKey("Id")
+ .HasName("PK_connection_log");
+
+ b.HasIndex("ServerId")
+ .HasDatabaseName("IX_connection_log_server_id");
+
+ b.HasIndex("Time");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("connection_log", null, t =>
+ {
+ t.HasCheckConstraint("AddressNotIPv6MappedIPv4", "NOT inet '::ffff:0.0.0.0/96' >>= address");
+ });
+ });
+
+ modelBuilder.Entity("Content.Server.Database.Job", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("job_id");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("JobName")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("job_name");
+
+ b.Property("Priority")
+ .HasColumnType("integer")
+ .HasColumnName("priority");
+
+ b.Property("ProfileId")
+ .HasColumnType("integer")
+ .HasColumnName("profile_id");
+
+ b.HasKey("Id")
+ .HasName("PK_job");
+
+ b.HasIndex("ProfileId");
+
+ b.HasIndex("ProfileId", "JobName")
+ .IsUnique();
+
+ b.HasIndex(new[] { "ProfileId" }, "IX_job_one_high_priority")
+ .IsUnique()
+ .HasFilter("priority = 3");
+
+ b.ToTable("job", (string)null);
+ });
+
+ modelBuilder.Entity("Content.Server.Database.PlayTime", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("play_time_id");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("PlayerId")
+ .HasColumnType("uuid")
+ .HasColumnName("player_id");
+
+ b.Property("TimeSpent")
+ .HasColumnType("interval")
+ .HasColumnName("time_spent");
+
+ b.Property("Tracker")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("tracker");
+
+ b.HasKey("Id")
+ .HasName("PK_play_time");
+
+ b.HasIndex("PlayerId", "Tracker")
+ .IsUnique();
+
+ b.ToTable("play_time", (string)null);
+ });
+
+ modelBuilder.Entity("Content.Server.Database.Player", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("player_id");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("FirstSeenTime")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("first_seen_time");
+
+ b.Property("LastReadRules")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("last_read_rules");
+
+ b.Property("LastSeenAddress")
+ .IsRequired()
+ .HasColumnType("inet")
+ .HasColumnName("last_seen_address");
+
+ b.Property("LastSeenHWId")
+ .HasColumnType("bytea")
+ .HasColumnName("last_seen_hwid");
+
+ b.Property("LastSeenTime")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("last_seen_time");
+
+ b.Property("LastSeenUserName")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("last_seen_user_name");
+
+ b.Property("UserId")
+ .HasColumnType("uuid")
+ .HasColumnName("user_id");
+
+ b.HasKey("Id")
+ .HasName("PK_player");
+
+ b.HasAlternateKey("UserId")
+ .HasName("ak_player_user_id");
+
+ b.HasIndex("LastSeenUserName");
+
+ b.HasIndex("UserId")
+ .IsUnique();
+
+ b.ToTable("player", null, t =>
+ {
+ t.HasCheckConstraint("LastSeenAddressNotIPv6MappedIPv4", "NOT inet '::ffff:0.0.0.0/96' >>= last_seen_address");
+ });
+ });
+
+ modelBuilder.Entity("Content.Server.Database.Preference", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("preference_id");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("AdminOOCColor")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("admin_ooc_color");
+
+ b.Property("SelectedCharacterSlot")
+ .HasColumnType("integer")
+ .HasColumnName("selected_character_slot");
+
+ b.Property("UserId")
+ .HasColumnType("uuid")
+ .HasColumnName("user_id");
+
+ b.HasKey("Id")
+ .HasName("PK_preference");
+
+ b.HasIndex("UserId")
+ .IsUnique();
+
+ b.ToTable("preference", (string)null);
+ });
+
+ modelBuilder.Entity("Content.Server.Database.Profile", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("profile_id");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Age")
+ .HasColumnType("integer")
+ .HasColumnName("age");
+
+ b.Property("CharacterName")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("char_name");
+
+ b.Property("EyeColor")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("eye_color");
+
+ b.Property("FacialHairColor")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("facial_hair_color");
+
+ b.Property("FacialHairName")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("facial_hair_name");
+
+ b.Property("FlavorText")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("flavor_text");
+
+ b.Property("Gender")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("gender");
+
+ b.Property("HairColor")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("hair_color");
+
+ b.Property("HairName")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("hair_name");
+
+ b.Property("Markings")
+ .HasColumnType("jsonb")
+ .HasColumnName("markings");
+
+ b.Property("PreferenceId")
+ .HasColumnType("integer")
+ .HasColumnName("preference_id");
+
+ b.Property("PreferenceUnavailable")
+ .HasColumnType("integer")
+ .HasColumnName("pref_unavailable");
+
+ b.Property("Sex")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("sex");
+
+ b.Property("SkinColor")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("skin_color");
+
+ b.Property("Slot")
+ .HasColumnType("integer")
+ .HasColumnName("slot");
+
+ b.Property("SpawnPriority")
+ .HasColumnType("integer")
+ .HasColumnName("spawn_priority");
+
+ b.Property("Species")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("species");
+
+ b.HasKey("Id")
+ .HasName("PK_profile");
+
+ b.HasIndex("PreferenceId")
+ .HasDatabaseName("IX_profile_preference_id");
+
+ b.HasIndex("Slot", "PreferenceId")
+ .IsUnique();
+
+ b.ToTable("profile", (string)null);
+ });
+
+ modelBuilder.Entity("Content.Server.Database.ProfileLoadout", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("profile_loadout_id");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("LoadoutName")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("loadout_name");
+
+ b.Property("ProfileLoadoutGroupId")
+ .HasColumnType("integer")
+ .HasColumnName("profile_loadout_group_id");
+
+ b.HasKey("Id")
+ .HasName("PK_profile_loadout");
+
+ b.HasIndex("ProfileLoadoutGroupId");
+
+ b.ToTable("profile_loadout", (string)null);
+ });
+
+ modelBuilder.Entity("Content.Server.Database.ProfileLoadoutGroup", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("profile_loadout_group_id");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("GroupName")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("group_name");
+
+ b.Property("ProfileRoleLoadoutId")
+ .HasColumnType("integer")
+ .HasColumnName("profile_role_loadout_id");
+
+ b.HasKey("Id")
+ .HasName("PK_profile_loadout_group");
+
+ b.HasIndex("ProfileRoleLoadoutId");
+
+ b.ToTable("profile_loadout_group", (string)null);
+ });
+
+ modelBuilder.Entity("Content.Server.Database.ProfileRoleLoadout", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("profile_role_loadout_id");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ProfileId")
+ .HasColumnType("integer")
+ .HasColumnName("profile_id");
+
+ b.Property("RoleName")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("role_name");
+
+ b.HasKey("Id")
+ .HasName("PK_profile_role_loadout");
+
+ b.HasIndex("ProfileId");
+
+ b.ToTable("profile_role_loadout", (string)null);
+ });
+
+ modelBuilder.Entity("Content.Server.Database.RoleWhitelist", b =>
+ {
+ b.Property("PlayerUserId")
+ .HasColumnType("uuid")
+ .HasColumnName("player_user_id");
+
+ b.Property("RoleId")
+ .HasColumnType("text")
+ .HasColumnName("role_id");
+
+ b.HasKey("PlayerUserId", "RoleId")
+ .HasName("PK_role_whitelists");
+
+ b.ToTable("role_whitelists", (string)null);
+ });
+
+ modelBuilder.Entity("Content.Server.Database.Round", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("round_id");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ServerId")
+ .HasColumnType("integer")
+ .HasColumnName("server_id");
+
+ b.Property("StartDate")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("start_date");
+
+ b.HasKey("Id")
+ .HasName("PK_round");
+
+ b.HasIndex("ServerId")
+ .HasDatabaseName("IX_round_server_id");
+
+ b.HasIndex("StartDate");
+
+ b.ToTable("round", (string)null);
+ });
+
+ modelBuilder.Entity("Content.Server.Database.Server", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("server_id");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("name");
+
+ b.HasKey("Id")
+ .HasName("PK_server");
+
+ b.ToTable("server", (string)null);
+ });
+
+ modelBuilder.Entity("Content.Server.Database.ServerBan", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("server_ban_id");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Address")
+ .HasColumnType("inet")
+ .HasColumnName("address");
+
+ b.Property("AutoDelete")
+ .HasColumnType("boolean")
+ .HasColumnName("auto_delete");
+
+ b.Property("BanTime")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("ban_time");
+
+ b.Property("BanningAdmin")
+ .HasColumnType("uuid")
+ .HasColumnName("banning_admin");
+
+ b.Property("ExemptFlags")
+ .HasColumnType("integer")
+ .HasColumnName("exempt_flags");
+
+ b.Property("ExpirationTime")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("expiration_time");
+
+ b.Property("HWId")
+ .HasColumnType("bytea")
+ .HasColumnName("hwid");
+
+ b.Property("Hidden")
+ .HasColumnType("boolean")
+ .HasColumnName("hidden");
+
+ b.Property("LastEditedAt")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("last_edited_at");
+
+ b.Property("LastEditedById")
+ .HasColumnType("uuid")
+ .HasColumnName("last_edited_by_id");
+
+ b.Property("PlayerUserId")
+ .HasColumnType("uuid")
+ .HasColumnName("player_user_id");
+
+ b.Property("PlaytimeAtNote")
+ .HasColumnType("interval")
+ .HasColumnName("playtime_at_note");
+
+ b.Property("Reason")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("reason");
+
+ b.Property("RoundId")
+ .HasColumnType("integer")
+ .HasColumnName("round_id");
+
+ b.Property("Severity")
+ .HasColumnType("integer")
+ .HasColumnName("severity");
+
+ b.HasKey("Id")
+ .HasName("PK_server_ban");
+
+ b.HasIndex("Address");
+
+ b.HasIndex("BanningAdmin");
+
+ b.HasIndex("LastEditedById");
+
+ b.HasIndex("PlayerUserId")
+ .HasDatabaseName("IX_server_ban_player_user_id");
+
+ b.HasIndex("RoundId")
+ .HasDatabaseName("IX_server_ban_round_id");
+
+ b.ToTable("server_ban", null, t =>
+ {
+ t.HasCheckConstraint("AddressNotIPv6MappedIPv4", "NOT inet '::ffff:0.0.0.0/96' >>= address");
+
+ t.HasCheckConstraint("HaveEitherAddressOrUserIdOrHWId", "address IS NOT NULL OR player_user_id IS NOT NULL OR hwid IS NOT NULL");
+ });
+ });
+
+ modelBuilder.Entity("Content.Server.Database.ServerBanExemption", b =>
+ {
+ b.Property("UserId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid")
+ .HasColumnName("user_id");
+
+ b.Property("Flags")
+ .HasColumnType("integer")
+ .HasColumnName("flags");
+
+ b.HasKey("UserId")
+ .HasName("PK_server_ban_exemption");
+
+ b.ToTable("server_ban_exemption", null, t =>
+ {
+ t.HasCheckConstraint("FlagsNotZero", "flags != 0");
+ });
+ });
+
+ modelBuilder.Entity("Content.Server.Database.ServerBanHit", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("server_ban_hit_id");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("BanId")
+ .HasColumnType("integer")
+ .HasColumnName("ban_id");
+
+ b.Property("ConnectionId")
+ .HasColumnType("integer")
+ .HasColumnName("connection_id");
+
+ b.HasKey("Id")
+ .HasName("PK_server_ban_hit");
+
+ b.HasIndex("BanId")
+ .HasDatabaseName("IX_server_ban_hit_ban_id");
+
+ b.HasIndex("ConnectionId")
+ .HasDatabaseName("IX_server_ban_hit_connection_id");
+
+ b.ToTable("server_ban_hit", (string)null);
+ });
+
+ modelBuilder.Entity("Content.Server.Database.ServerRoleBan", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("server_role_ban_id");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Address")
+ .HasColumnType("inet")
+ .HasColumnName("address");
+
+ b.Property("BanTime")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("ban_time");
+
+ b.Property("BanningAdmin")
+ .HasColumnType("uuid")
+ .HasColumnName("banning_admin");
+
+ b.Property("ExpirationTime")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("expiration_time");
+
+ b.Property("HWId")
+ .HasColumnType("bytea")
+ .HasColumnName("hwid");
+
+ b.Property("Hidden")
+ .HasColumnType("boolean")
+ .HasColumnName("hidden");
+
+ b.Property("LastEditedAt")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("last_edited_at");
+
+ b.Property("LastEditedById")
+ .HasColumnType("uuid")
+ .HasColumnName("last_edited_by_id");
+
+ b.Property("PlayerUserId")
+ .HasColumnType("uuid")
+ .HasColumnName("player_user_id");
+
+ b.Property("PlaytimeAtNote")
+ .HasColumnType("interval")
+ .HasColumnName("playtime_at_note");
+
+ b.Property("Reason")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("reason");
+
+ b.Property("RoleId")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("role_id");
+
+ b.Property("RoundId")
+ .HasColumnType("integer")
+ .HasColumnName("round_id");
+
+ b.Property("Severity")
+ .HasColumnType("integer")
+ .HasColumnName("severity");
+
+ b.HasKey("Id")
+ .HasName("PK_server_role_ban");
+
+ b.HasIndex("Address");
+
+ b.HasIndex("BanningAdmin");
+
+ b.HasIndex("LastEditedById");
+
+ b.HasIndex("PlayerUserId")
+ .HasDatabaseName("IX_server_role_ban_player_user_id");
+
+ b.HasIndex("RoundId")
+ .HasDatabaseName("IX_server_role_ban_round_id");
+
+ b.ToTable("server_role_ban", null, t =>
+ {
+ t.HasCheckConstraint("AddressNotIPv6MappedIPv4", "NOT inet '::ffff:0.0.0.0/96' >>= address");
+
+ t.HasCheckConstraint("HaveEitherAddressOrUserIdOrHWId", "address IS NOT NULL OR player_user_id IS NOT NULL OR hwid IS NOT NULL");
+ });
+ });
+
+ modelBuilder.Entity("Content.Server.Database.ServerRoleUnban", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("role_unban_id");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("BanId")
+ .HasColumnType("integer")
+ .HasColumnName("ban_id");
+
+ b.Property("UnbanTime")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("unban_time");
+
+ b.Property("UnbanningAdmin")
+ .HasColumnType("uuid")
+ .HasColumnName("unbanning_admin");
+
+ b.HasKey("Id")
+ .HasName("PK_server_role_unban");
+
+ b.HasIndex("BanId")
+ .IsUnique();
+
+ b.ToTable("server_role_unban", (string)null);
+ });
+
+ modelBuilder.Entity("Content.Server.Database.ServerUnban", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("unban_id");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("BanId")
+ .HasColumnType("integer")
+ .HasColumnName("ban_id");
+
+ b.Property("UnbanTime")
+ .HasColumnType("timestamp with time zone")
+ .HasColumnName("unban_time");
+
+ b.Property("UnbanningAdmin")
+ .HasColumnType("uuid")
+ .HasColumnName("unbanning_admin");
+
+ b.HasKey("Id")
+ .HasName("PK_server_unban");
+
+ b.HasIndex("BanId")
+ .IsUnique();
+
+ b.ToTable("server_unban", (string)null);
+ });
+
+ modelBuilder.Entity("Content.Server.Database.Trait", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("trait_id");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ProfileId")
+ .HasColumnType("integer")
+ .HasColumnName("profile_id");
+
+ b.Property("TraitName")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasColumnName("trait_name");
+
+ b.HasKey("Id")
+ .HasName("PK_trait");
+
+ b.HasIndex("ProfileId", "TraitName")
+ .IsUnique();
+
+ b.ToTable("trait", (string)null);
+ });
+
+ modelBuilder.Entity("Content.Server.Database.UploadedResourceLog", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("uploaded_resource_log_id");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property