From ad0f5ce802b0009974934f2add0f7e57d17a8f96 Mon Sep 17 00:00:00 2001 From: Misfiy <85962933+obvEve@users.noreply.github.com> Date: Wed, 7 Jan 2026 21:48:44 +0100 Subject: [PATCH 1/3] SSSS additions for sending values --- SecretAPI/Features/UserSettings/CustomSetting.cs | 7 +++++++ SecretAPI/Features/UserSettings/CustomSliderSetting.cs | 6 ++++++ SecretAPI/Features/UserSettings/CustomTwoButtonSetting.cs | 6 ++++++ 3 files changed, 19 insertions(+) diff --git a/SecretAPI/Features/UserSettings/CustomSetting.cs b/SecretAPI/Features/UserSettings/CustomSetting.cs index 9f65019..793d3f7 100644 --- a/SecretAPI/Features/UserSettings/CustomSetting.cs +++ b/SecretAPI/Features/UserSettings/CustomSetting.cs @@ -252,6 +252,13 @@ public static void SendSettingsToPlayer(Player player, int? version = null) ListPool.Shared.Return(ordered); } + /// + /// Checks whether a is equal to . + /// + /// The to check. + /// Whether is equal to Owner . + internal bool IsKnownOwnerHub(ReferenceHub? hub) => hub && KnownOwner?.ReferenceHub == hub; + /// /// Resyncs the setting to its owner. /// diff --git a/SecretAPI/Features/UserSettings/CustomSliderSetting.cs b/SecretAPI/Features/UserSettings/CustomSliderSetting.cs index 98b7e4e..4b33328 100644 --- a/SecretAPI/Features/UserSettings/CustomSliderSetting.cs +++ b/SecretAPI/Features/UserSettings/CustomSliderSetting.cs @@ -83,5 +83,11 @@ public float MaximumValue /// Gets a value indicating whether to use integer. False will use float. /// public bool UseInteger => Base.Integer; + + /// + /// Sends an update to that this has been updated on Server. Only works if is true. + /// + /// The new value that this is set to. + public void SendServerUpdate(float value) => Base.SendValueUpdate(value, false, IsKnownOwnerHub); } } \ No newline at end of file diff --git a/SecretAPI/Features/UserSettings/CustomTwoButtonSetting.cs b/SecretAPI/Features/UserSettings/CustomTwoButtonSetting.cs index 4a48a2a..446a85a 100644 --- a/SecretAPI/Features/UserSettings/CustomTwoButtonSetting.cs +++ b/SecretAPI/Features/UserSettings/CustomTwoButtonSetting.cs @@ -48,5 +48,11 @@ protected CustomTwoButtonSetting(int? id, string label, string optionA, string o /// Gets a value indicating whether the selected option is currently set to the default. /// public bool IsDefault => Base.DefaultIsB ? IsOptionB : IsOptionA; + + /// + /// Sends an update to that this has been updated on Server. Only works if is true. + /// + /// Whether the setting is set to B value now. + public void SendServerUpdate(bool isB) => Base.SendValueUpdate(isB, false, IsKnownOwnerHub); } } \ No newline at end of file From 8ec1ba7fbd9cb86e67d81f1c04bb206f8b2a7c13 Mon Sep 17 00:00:00 2001 From: Misfiy <85962933+obvEve@users.noreply.github.com> Date: Thu, 8 Jan 2026 12:19:30 +0100 Subject: [PATCH 2/3] SSSS additions!! --- .../Features/UserSettings/CustomSetting.cs | 10 +++ .../UserSettings/CustomSliderSetting.cs | 63 +++++++++++++++++-- .../UserSettings/CustomTwoButtonSetting.cs | 31 +++++++++ 3 files changed, 98 insertions(+), 6 deletions(-) diff --git a/SecretAPI/Features/UserSettings/CustomSetting.cs b/SecretAPI/Features/UserSettings/CustomSetting.cs index 793d3f7..fb23c9f 100644 --- a/SecretAPI/Features/UserSettings/CustomSetting.cs +++ b/SecretAPI/Features/UserSettings/CustomSetting.cs @@ -75,6 +75,11 @@ public bool IsServerOnly set => Base.IsServerOnly = value; } + /// + /// Gets a value indicating whether the setting is the default and not tied to a . + /// + public bool IsDefaultSetting => KnownOwner == null; + /// /// Gets or sets the current label. /// @@ -252,6 +257,11 @@ public static void SendSettingsToPlayer(Player player, int? version = null) ListPool.Shared.Return(ordered); } + /// + /// Sends an update to that or has changed. + /// + public void SendSettingUpdate() => Base.SendUpdate(Label, DescriptionHint, false, IsKnownOwnerHub); + /// /// Checks whether a is equal to . /// diff --git a/SecretAPI/Features/UserSettings/CustomSliderSetting.cs b/SecretAPI/Features/UserSettings/CustomSliderSetting.cs index 4b33328..c995f53 100644 --- a/SecretAPI/Features/UserSettings/CustomSliderSetting.cs +++ b/SecretAPI/Features/UserSettings/CustomSliderSetting.cs @@ -56,13 +56,43 @@ protected CustomSliderSetting( /// public int SelectedValueInt => Base.SyncIntValue; + /// + /// Gets or sets the value to string format. + /// + public string ValueToStringFormat + { + get => Base.ValueToStringFormat; + set + { + Base.ValueToStringFormat = value; + SendSliderUpdate(); + } + } + + /// + /// Gets or sets the final display display format. + /// + public string FinalDisplayFormat + { + get => Base.FinalDisplayFormat; + set + { + Base.FinalDisplayFormat = value; + SendSliderUpdate(); + } + } + /// /// Gets or sets the minimum value of the setting. /// public float MinimumValue { get => Base.MinValue; - set => Base.MinValue = value; + set + { + Base.MinValue = value; + SendSliderUpdate(); + } } /// @@ -71,23 +101,44 @@ public float MinimumValue public float MaximumValue { get => Base.MaxValue; - set => Base.MaxValue = value; + set + { + Base.MaxValue = value; + SendSliderUpdate(); + } } /// - /// Gets the default value of the setting. + /// Gets or sets the default value of the setting. /// - public float DefaultValue => Base.DefaultValue; + public float DefaultValue + { + get => Base.DefaultValue; + set => Base.DefaultValue = value; + } /// - /// Gets a value indicating whether to use integer. False will use float. + /// Gets or sets a value indicating whether to use integer. False will use float. /// - public bool UseInteger => Base.Integer; + public bool UseInteger + { + get => Base.Integer; + set + { + Base.Integer = value; + SendSliderUpdate(); + } + } /// /// Sends an update to that this has been updated on Server. Only works if is true. /// /// The new value that this is set to. public void SendServerUpdate(float value) => Base.SendValueUpdate(value, false, IsKnownOwnerHub); + + /// + /// Sends an update that any of the slider values have been updated. + /// + public void SendSliderUpdate() => Base.SendSliderUpdate(MinimumValue, MaximumValue, UseInteger, ValueToStringFormat, FinalDisplayFormat, false, IsKnownOwnerHub); } } \ No newline at end of file diff --git a/SecretAPI/Features/UserSettings/CustomTwoButtonSetting.cs b/SecretAPI/Features/UserSettings/CustomTwoButtonSetting.cs index 446a85a..7b7b2c9 100644 --- a/SecretAPI/Features/UserSettings/CustomTwoButtonSetting.cs +++ b/SecretAPI/Features/UserSettings/CustomTwoButtonSetting.cs @@ -34,6 +34,32 @@ protected CustomTwoButtonSetting(int? id, string label, string optionA, string o /// public new SSTwoButtonsSetting Base { get; } + /// + /// Gets or sets the current text for the first option. + /// + public string OptionA + { + get => Base.OptionA; + set + { + Base.OptionA = value; + SendOptionsUpdate(); + } + } + + /// + /// Gets or sets the current text for the second option. + /// + public string OptionB + { + get => Base.OptionB; + set + { + Base.OptionB = value; + SendOptionsUpdate(); + } + } + /// /// Gets a value indicating whether the selected option is currently the first. /// @@ -54,5 +80,10 @@ protected CustomTwoButtonSetting(int? id, string label, string optionA, string o /// /// Whether the setting is set to B value now. public void SendServerUpdate(bool isB) => Base.SendValueUpdate(isB, false, IsKnownOwnerHub); + + /// + /// Sends an update to the that or has changed values. + /// + public void SendOptionsUpdate() => Base.SendTwoButtonUpdate(OptionA, OptionB, false, IsKnownOwnerHub); } } \ No newline at end of file From 33d426e7c09abcb3bfa8ecac4b3f41e6f50290f6 Mon Sep 17 00:00:00 2001 From: Misfiy <85962933+obvEve@users.noreply.github.com> Date: Thu, 8 Jan 2026 12:42:36 +0100 Subject: [PATCH 3/3] Do all settings properly --- .../UserSettings/CustomButtonSetting.cs | 29 +++++++++-- .../UserSettings/CustomDropdownSetting.cs | 17 ++++++- .../Features/UserSettings/CustomHeader.cs | 2 + .../UserSettings/CustomPlainTextSetting.cs | 48 ++++++++++++++++--- .../Features/UserSettings/CustomSetting.cs | 22 ++++++--- .../UserSettings/CustomSliderSetting.cs | 4 +- .../UserSettings/CustomTextAreaSetting.cs | 9 ++++ .../UserSettings/CustomTwoButtonSetting.cs | 2 +- 8 files changed, 112 insertions(+), 21 deletions(-) diff --git a/SecretAPI/Features/UserSettings/CustomButtonSetting.cs b/SecretAPI/Features/UserSettings/CustomButtonSetting.cs index 3076fb3..7ef676c 100644 --- a/SecretAPI/Features/UserSettings/CustomButtonSetting.cs +++ b/SecretAPI/Features/UserSettings/CustomButtonSetting.cs @@ -40,13 +40,34 @@ protected CustomButtonSetting(int? id, string label, string buttonText, float? h public TimeSpan LastPress => Base.SyncLastPress.Elapsed; /// - /// Gets the text of the button. + /// Gets or sets the text of the button. /// - public string Text => Base.ButtonText; + public string Text + { + get => Base.ButtonText; + set + { + Base.ButtonText = value; + SendButtonUpdate(); + } + } + + /// + /// Gets or sets the amount of time to hold the button in seconds. + /// + public float RequiredHoldTime + { + get => Base.HoldTimeSeconds; + set + { + Base.HoldTimeSeconds = value; + SendButtonUpdate(); + } + } /// - /// Gets the amount of time to hold the button in seconds. + /// Sends an update to that or has updated. /// - public float HoldTime => Base.HoldTimeSeconds; + private void SendButtonUpdate() => Base.SendButtonUpdate(Text, RequiredHoldTime, false, IsKnownOwnerHub); } } \ No newline at end of file diff --git a/SecretAPI/Features/UserSettings/CustomDropdownSetting.cs b/SecretAPI/Features/UserSettings/CustomDropdownSetting.cs index 00626a1..f2ae73c 100644 --- a/SecretAPI/Features/UserSettings/CustomDropdownSetting.cs +++ b/SecretAPI/Features/UserSettings/CustomDropdownSetting.cs @@ -58,12 +58,27 @@ protected CustomDropdownSetting( public string[] Options { get => Base.Options; - set => Base.Options = value; + set + { + Base.Options = value; + SendDropdownUpdate(); + } } /// /// Gets the selected option as string. /// public string SelectedOption => Options[ValidatedSelectedIndex]; + + /// + /// Sends an update to that this has been updated on Server. Only works if is true. + /// + /// The new ID selected. + public void SendServerUpdate(int selectionId) => Base.SendValueUpdate(selectionId, false, IsKnownOwnerHub); + + /// + /// Sends an update to that has been updated. + /// + private void SendDropdownUpdate() => Base.SendDropdownUpdate(Options, false, IsKnownOwnerHub); } } \ No newline at end of file diff --git a/SecretAPI/Features/UserSettings/CustomHeader.cs b/SecretAPI/Features/UserSettings/CustomHeader.cs index bc7c7b5..d638121 100644 --- a/SecretAPI/Features/UserSettings/CustomHeader.cs +++ b/SecretAPI/Features/UserSettings/CustomHeader.cs @@ -1,5 +1,6 @@ namespace SecretAPI.Features.UserSettings { + using System; using global::UserSettings.ServerSpecific; /// @@ -21,6 +22,7 @@ public CustomHeader(string label, bool reducedPadding = false, string? hint = nu /// /// Gets a for Gameplay purposes. /// + [Obsolete("3.0 will remove this - Please handle your setting header yourself!")] public static CustomHeader Gameplay { get; } = new("Gameplay", hint: "Features that affect gameplay"); /// diff --git a/SecretAPI/Features/UserSettings/CustomPlainTextSetting.cs b/SecretAPI/Features/UserSettings/CustomPlainTextSetting.cs index 963f93d..6b947b2 100644 --- a/SecretAPI/Features/UserSettings/CustomPlainTextSetting.cs +++ b/SecretAPI/Features/UserSettings/CustomPlainTextSetting.cs @@ -1,5 +1,6 @@ namespace SecretAPI.Features.UserSettings { + using System; using global::UserSettings.ServerSpecific; using TMPro; @@ -47,18 +48,53 @@ protected CustomPlainTextSetting( public string InputText => Base.SyncInputText; /// - /// Gets the content type. + /// Gets or sets the content type. /// - public TMP_InputField.ContentType ContentType => Base.ContentType; + public TMP_InputField.ContentType ContentType + { + get => Base.ContentType; + set + { + Base.ContentType = value; + SendPlaintextUpdate(); + } + } + + /// + /// Gets or sets the placeholder. + /// + public string Placeholder + { + get => Base.Placeholder; + set + { + Base.Placeholder = value; + SendPlaintextUpdate(); + } + } + + /// + /// Gets or sets the character limit. + /// + public int CharacterLimit + { + get => Base.CharacterLimit; + set + { + Base.CharacterLimit = value; + SendPlaintextUpdate(); + } + } /// - /// Gets the placeholder. + /// Sends an update to that this has been updated on Server. Only works if is true. /// - public string Placeholder => Base.Placeholder; + /// The new text. + public void SendServerUpdate(string text) => Base.SendValueUpdate(text, false, IsKnownOwnerHub); /// - /// Gets the character limit. + /// Sends an update to the that or has changed values. /// - public int CharacterLimit => Base.CharacterLimit; + private void SendPlaintextUpdate() => Base.SendPlaintextUpdate(Placeholder, (ushort)Math.Clamp(CharacterLimit, ushort.MinValue, ushort.MaxValue), ContentType, false, IsKnownOwnerHub); } } \ No newline at end of file diff --git a/SecretAPI/Features/UserSettings/CustomSetting.cs b/SecretAPI/Features/UserSettings/CustomSetting.cs index fb23c9f..9c46abf 100644 --- a/SecretAPI/Features/UserSettings/CustomSetting.cs +++ b/SecretAPI/Features/UserSettings/CustomSetting.cs @@ -86,7 +86,11 @@ public bool IsServerOnly public string Label { get => Base.Label; - set => Base.Label = value; + set + { + Base.Label = value; + SendSettingUpdate(); + } } /// @@ -95,7 +99,11 @@ public string Label public string DescriptionHint { get => Base.HintDescription; - set => Base.HintDescription = value; + set + { + Base.HintDescription = value; + SendSettingUpdate(); + } } /// @@ -257,11 +265,6 @@ public static void SendSettingsToPlayer(Player player, int? version = null) ListPool.Shared.Return(ordered); } - /// - /// Sends an update to that or has changed. - /// - public void SendSettingUpdate() => Base.SendUpdate(Label, DescriptionHint, false, IsKnownOwnerHub); - /// /// Checks whether a is equal to . /// @@ -343,5 +346,10 @@ private static CustomSetting EnsurePlayerSpecificSetting(Player player, CustomSe return currentSetting; } + + /// + /// Sends an update to that or has changed. + /// + private void SendSettingUpdate() => Base.SendUpdate(Label, DescriptionHint, false, IsKnownOwnerHub); } } diff --git a/SecretAPI/Features/UserSettings/CustomSliderSetting.cs b/SecretAPI/Features/UserSettings/CustomSliderSetting.cs index c995f53..17912a9 100644 --- a/SecretAPI/Features/UserSettings/CustomSliderSetting.cs +++ b/SecretAPI/Features/UserSettings/CustomSliderSetting.cs @@ -70,7 +70,7 @@ public string ValueToStringFormat } /// - /// Gets or sets the final display display format. + /// Gets or sets the final display format. /// public string FinalDisplayFormat { @@ -139,6 +139,6 @@ public bool UseInteger /// /// Sends an update that any of the slider values have been updated. /// - public void SendSliderUpdate() => Base.SendSliderUpdate(MinimumValue, MaximumValue, UseInteger, ValueToStringFormat, FinalDisplayFormat, false, IsKnownOwnerHub); + private void SendSliderUpdate() => Base.SendSliderUpdate(MinimumValue, MaximumValue, UseInteger, ValueToStringFormat, FinalDisplayFormat, false, IsKnownOwnerHub); } } \ No newline at end of file diff --git a/SecretAPI/Features/UserSettings/CustomTextAreaSetting.cs b/SecretAPI/Features/UserSettings/CustomTextAreaSetting.cs index ea4b4d8..e70c67c 100644 --- a/SecretAPI/Features/UserSettings/CustomTextAreaSetting.cs +++ b/SecretAPI/Features/UserSettings/CustomTextAreaSetting.cs @@ -39,6 +39,15 @@ protected CustomTextAreaSetting( /// public new SSTextArea Base { get; } + /// + /// Gets or sets the current content. This is equal to . + /// + public string Content + { + get => Label; + set => Label = value; + } + /// /// Gets the foldout mode. /// diff --git a/SecretAPI/Features/UserSettings/CustomTwoButtonSetting.cs b/SecretAPI/Features/UserSettings/CustomTwoButtonSetting.cs index 7b7b2c9..f9f4bdf 100644 --- a/SecretAPI/Features/UserSettings/CustomTwoButtonSetting.cs +++ b/SecretAPI/Features/UserSettings/CustomTwoButtonSetting.cs @@ -84,6 +84,6 @@ public string OptionB /// /// Sends an update to the that or has changed values. /// - public void SendOptionsUpdate() => Base.SendTwoButtonUpdate(OptionA, OptionB, false, IsKnownOwnerHub); + private void SendOptionsUpdate() => Base.SendTwoButtonUpdate(OptionA, OptionB, false, IsKnownOwnerHub); } } \ No newline at end of file