From f1b26281fdc08c4a5b40250e1b3daf18bd73f972 Mon Sep 17 00:00:00 2001 From: Trevlouw <45270312+Trevlouw@users.noreply.github.com> Date: Sat, 4 Jan 2025 11:45:31 -0500 Subject: [PATCH 1/3] feat: ShadowType More features for the Light wrapper --- EXILED/Exiled.API/Features/Toys/Light.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/EXILED/Exiled.API/Features/Toys/Light.cs b/EXILED/Exiled.API/Features/Toys/Light.cs index eee6269282..9496f6b833 100644 --- a/EXILED/Exiled.API/Features/Toys/Light.cs +++ b/EXILED/Exiled.API/Features/Toys/Light.cs @@ -113,6 +113,15 @@ public LightType LightType set => Base.NetworkLightType = value; } + /// + /// Gets or sets the type of shadows the light casts. + /// + public LightShadows ShadowType + { + get => Base.NetworkShadowType; + set => Base.NetworkShadowType = value; + } + /// /// Creates a new . /// From af71507badb6408ebe32698c5437deb0d4db401c Mon Sep 17 00:00:00 2001 From: Trevlouw <45270312+Trevlouw@users.noreply.github.com> Date: Sun, 26 Jan 2025 15:25:46 -0500 Subject: [PATCH 2/3] Why did we make this This is about as cooked as the other EXILED SSS stuff, only useful in OnEnabled(); --- .../Features/Core/UserSettings/SettingBase.cs | 2 + .../Core/UserSettings/SliderInputSetting.cs | 124 ++++++++++++++++++ .../Core/UserSettings/UserTextInputSetting.cs | 94 +++++++++++++ 3 files changed, 220 insertions(+) create mode 100644 EXILED/Exiled.API/Features/Core/UserSettings/SliderInputSetting.cs create mode 100644 EXILED/Exiled.API/Features/Core/UserSettings/UserTextInputSetting.cs diff --git a/EXILED/Exiled.API/Features/Core/UserSettings/SettingBase.cs b/EXILED/Exiled.API/Features/Core/UserSettings/SettingBase.cs index 5af5f615e7..2bf65451b9 100644 --- a/EXILED/Exiled.API/Features/Core/UserSettings/SettingBase.cs +++ b/EXILED/Exiled.API/Features/Core/UserSettings/SettingBase.cs @@ -176,6 +176,8 @@ public static bool TryGetSetting(Player player, int id, out T setting) SSGroupHeader header => new HeaderSetting(header), SSKeybindSetting keybindSetting => new KeybindSetting(keybindSetting), SSTwoButtonsSetting twoButtonsSetting => new TwoButtonsSetting(twoButtonsSetting), + SSPlaintextSetting plainTextSetting => new UserTextInputSetting(plainTextSetting), + SSSliderSetting sliderSetting => new SliderInputSetting(sliderSetting), _ => new SettingBase(settingBase) }; diff --git a/EXILED/Exiled.API/Features/Core/UserSettings/SliderInputSetting.cs b/EXILED/Exiled.API/Features/Core/UserSettings/SliderInputSetting.cs new file mode 100644 index 0000000000..5917aba21b --- /dev/null +++ b/EXILED/Exiled.API/Features/Core/UserSettings/SliderInputSetting.cs @@ -0,0 +1,124 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Features.Core.UserSettings +{ + using System; + + using Exiled.API.Interfaces; + using global::UserSettings.ServerSpecific; + + /// + /// Represents a text input setting. + /// + public class SliderInputSetting : SettingBase, IWrapper + { + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// /// + public SliderInputSetting(int id, string label, float minValue, float maxValue, float defaultValue, bool isInteger = false, string stringFormat = "0.##", string displayFormat = "{0}", string hintDescription = null) + : this(new SSSliderSetting(id, label, minValue, maxValue, defaultValue, isInteger, stringFormat, displayFormat, hintDescription)) + { + Base = (SSSliderSetting)base.Base; + } + + /// + /// Initializes a new instance of the class. + /// + /// A instance. + internal SliderInputSetting(SSSliderSetting settingBase) + : base(settingBase) + { + Base = settingBase; + } + + /// + /// Gets or sets the minimum value of the slider. + /// + public float MinimumValue + { + get => Base.MinValue; + set => Base.MinValue = value; + } + + /// + /// Gets or sets the maximum value of the slider. + /// + public float MaximumValue + { + get => Base.MaxValue; + set => Base.MaxValue = value; + } + + /// + /// Gets or sets the default value of the slider. + /// + public float DefaultValue + { + get => Base.DefaultValue; + set => Base.DefaultValue = value; + } + + /// + /// Gets or sets a value indicating whether the slider uses integers. + /// + public bool IsInteger + { + get => Base.Integer; + set => Base.Integer = value; + } + + /// + /// Gets a value indicating whether the slider is currently being dragged. + /// + public bool IsBeingDragged => Base.SyncDragging; + + /// + /// Gets a float that represents the current value of the slider. + /// + public float SliderValue => Base.Integer ? Base.SyncIntValue : Base.SyncFloatValue; + + /// + /// Gets or sets the formatting used for the number in the slider. + /// + public string StringFormat + { + get => Base.ValueToStringFormat; + set => Base.ValueToStringFormat = value; + } + + /// + /// Gets or sets the formatting used for the final display of the value of the slider. + /// + public string DisplayFormat + { + get => Base.FinalDisplayFormat; + set => Base.FinalDisplayFormat = value; + } + + /// + public new SSSliderSetting Base { get; } + + /// + /// Returns a representation of this . + /// + /// A string in human-readable format. + public override string ToString() + { + return base.ToString() + $" /{MinimumValue}/ *{MaximumValue}* +{DefaultValue}+ '{SliderValue}'"; + } + } +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Core/UserSettings/UserTextInputSetting.cs b/EXILED/Exiled.API/Features/Core/UserSettings/UserTextInputSetting.cs new file mode 100644 index 0000000000..2c4e7d8b97 --- /dev/null +++ b/EXILED/Exiled.API/Features/Core/UserSettings/UserTextInputSetting.cs @@ -0,0 +1,94 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Features.Core.UserSettings +{ + using System; + + using Exiled.API.Interfaces; + using global::UserSettings.ServerSpecific; + using TMPro; + + /// + /// Represents a text input setting. + /// + public class UserTextInputSetting : SettingBase, IWrapper + { + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + /// + /// + /// /// + public UserTextInputSetting(int id, string label, string placeHolder = "", int characterLimit = 64, TMP_InputField.ContentType contentType = TMP_InputField.ContentType.Standard, string hintDescription = null) + : this(new SSPlaintextSetting(id, label, placeHolder, characterLimit, contentType, hintDescription)) + { + Base = (SSPlaintextSetting)base.Base; + } + + /// + /// Initializes a new instance of the class. + /// + /// A instance. + internal UserTextInputSetting(SSPlaintextSetting settingBase) + : base(settingBase) + { + Base = settingBase; + } + + /// + public new SSPlaintextSetting Base { get; } + + /// + /// Gets or sets the value of the text shown to a client (currently testing). + /// + public string Text + { + get => Base.SyncInputText; + set => Base.SyncInputText = value; + } + + /// + /// Gets or sets a value indicating the placeholder shown within the PlainTextSetting. + /// + public string PlaceHolder + { + get => Base.Placeholder; + set => Base.Placeholder = value; + } + + /// + /// Gets or sets a value indicating the type of content within the PlainTextSetting. + /// + public TMP_InputField.ContentType ContentType + { + get => Base.ContentType; + set => Base.ContentType = value; + } + + /// + /// Gets or sets a value indicating the max number of characters in the PlainTextSetting. + /// + public int CharacterLimit + { + get => Base.CharacterLimit; + set => Base.CharacterLimit = value; + } + + /// + /// Returns a representation of this . + /// + /// A string in human-readable format. + public override string ToString() + { + return base.ToString() + $" /{Text}/ *{ContentType}* +{CharacterLimit}+"; + } + } +} \ No newline at end of file From 33213c4669cb9de5bbc5018a4658acbab6ef0572 Mon Sep 17 00:00:00 2001 From: Trevlouw <45270312+Trevlouw@users.noreply.github.com> Date: Sun, 26 Jan 2025 15:33:41 -0500 Subject: [PATCH 3/3] I definitely didnt forget to cover my copy pasting --- .../Features/Core/UserSettings/SettingBase.cs | 2 +- ...SliderInputSetting.cs => SliderSetting.cs} | 22 +++++++++---------- .../Core/UserSettings/UserTextInputSetting.cs | 14 +++++------- 3 files changed, 17 insertions(+), 21 deletions(-) rename EXILED/Exiled.API/Features/Core/UserSettings/{SliderInputSetting.cs => SliderSetting.cs} (79%) diff --git a/EXILED/Exiled.API/Features/Core/UserSettings/SettingBase.cs b/EXILED/Exiled.API/Features/Core/UserSettings/SettingBase.cs index 2bf65451b9..776b80cca3 100644 --- a/EXILED/Exiled.API/Features/Core/UserSettings/SettingBase.cs +++ b/EXILED/Exiled.API/Features/Core/UserSettings/SettingBase.cs @@ -177,7 +177,7 @@ public static bool TryGetSetting(Player player, int id, out T setting) SSKeybindSetting keybindSetting => new KeybindSetting(keybindSetting), SSTwoButtonsSetting twoButtonsSetting => new TwoButtonsSetting(twoButtonsSetting), SSPlaintextSetting plainTextSetting => new UserTextInputSetting(plainTextSetting), - SSSliderSetting sliderSetting => new SliderInputSetting(sliderSetting), + SSSliderSetting sliderSetting => new SliderSetting(sliderSetting), _ => new SettingBase(settingBase) }; diff --git a/EXILED/Exiled.API/Features/Core/UserSettings/SliderInputSetting.cs b/EXILED/Exiled.API/Features/Core/UserSettings/SliderSetting.cs similarity index 79% rename from EXILED/Exiled.API/Features/Core/UserSettings/SliderInputSetting.cs rename to EXILED/Exiled.API/Features/Core/UserSettings/SliderSetting.cs index 5917aba21b..66d88174d9 100644 --- a/EXILED/Exiled.API/Features/Core/UserSettings/SliderInputSetting.cs +++ b/EXILED/Exiled.API/Features/Core/UserSettings/SliderSetting.cs @@ -1,5 +1,5 @@ // ----------------------------------------------------------------------- -// +// // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. // @@ -13,12 +13,12 @@ namespace Exiled.API.Features.Core.UserSettings using global::UserSettings.ServerSpecific; /// - /// Represents a text input setting. + /// Represents a slider setting. /// - public class SliderInputSetting : SettingBase, IWrapper + public class SliderSetting : SettingBase, IWrapper { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// /// @@ -28,18 +28,18 @@ public class SliderInputSetting : SettingBase, IWrapper /// /// /// - /// /// - public SliderInputSetting(int id, string label, float minValue, float maxValue, float defaultValue, bool isInteger = false, string stringFormat = "0.##", string displayFormat = "{0}", string hintDescription = null) + /// + public SliderSetting(int id, string label, float minValue, float maxValue, float defaultValue, bool isInteger = false, string stringFormat = "0.##", string displayFormat = "{0}", string hintDescription = null) : this(new SSSliderSetting(id, label, minValue, maxValue, defaultValue, isInteger, stringFormat, displayFormat, hintDescription)) { Base = (SSSliderSetting)base.Base; } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// A instance. - internal SliderInputSetting(SSSliderSetting settingBase) + /// A instance. + internal SliderSetting(SSSliderSetting settingBase) : base(settingBase) { Base = settingBase; @@ -73,7 +73,7 @@ public float DefaultValue } /// - /// Gets or sets a value indicating whether the slider uses integers. + /// Gets or sets a value indicating whether the slider displays integers. /// public bool IsInteger { @@ -113,7 +113,7 @@ public string DisplayFormat public new SSSliderSetting Base { get; } /// - /// Returns a representation of this . + /// Returns a representation of this . /// /// A string in human-readable format. public override string ToString() diff --git a/EXILED/Exiled.API/Features/Core/UserSettings/UserTextInputSetting.cs b/EXILED/Exiled.API/Features/Core/UserSettings/UserTextInputSetting.cs index 2c4e7d8b97..8944558e03 100644 --- a/EXILED/Exiled.API/Features/Core/UserSettings/UserTextInputSetting.cs +++ b/EXILED/Exiled.API/Features/Core/UserSettings/UserTextInputSetting.cs @@ -14,7 +14,7 @@ namespace Exiled.API.Features.Core.UserSettings using TMPro; /// - /// Represents a text input setting. + /// Represents a user text input setting. /// public class UserTextInputSetting : SettingBase, IWrapper { @@ -36,7 +36,7 @@ public UserTextInputSetting(int id, string label, string placeHolder = "", int c /// /// Initializes a new instance of the class. /// - /// A instance. + /// A instance. internal UserTextInputSetting(SSPlaintextSetting settingBase) : base(settingBase) { @@ -47,13 +47,9 @@ internal UserTextInputSetting(SSPlaintextSetting settingBase) public new SSPlaintextSetting Base { get; } /// - /// Gets or sets the value of the text shown to a client (currently testing). + /// Gets the value of the text entered by a client. /// - public string Text - { - get => Base.SyncInputText; - set => Base.SyncInputText = value; - } + public string Text => Base.SyncInputText; /// /// Gets or sets a value indicating the placeholder shown within the PlainTextSetting. @@ -83,7 +79,7 @@ public int CharacterLimit } /// - /// Returns a representation of this . + /// Returns a representation of this . /// /// A string in human-readable format. public override string ToString()