Skip to content

Commit c397b79

Browse files
committed
Added: TickFrequencyDouble to SliderControlParamsAttribute
Previously, TickFrequency was limited to whole numbers (int), so you couldn't place a tick every 0.5 units. Now you can use TickFrequencyDouble instead. - Added TickFrequencyDouble property (double) which takes precedence when > 0 - Marked existing TickFrequency as obsolete (binary/source backwards compatible) - New parameter added at end of constructor for binary compatibility - Uses 0 as sentinel value (TickFrequencyDouble > 0 means use it) - Added test case in TestModControlParams
1 parent 4277a82 commit c397b79

5 files changed

Lines changed: 52 additions & 66 deletions

File tree

changelog-template.hbs

Lines changed: 14 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,25 @@
11
[Read and Discuss in a Browser](https://github.com/Reloaded-Project/Reloaded-II/discussions/473).
2-
[Previous Changelog](https://github.com/Reloaded-Project/Reloaded-II/releases/tag/1.29.3).
2+
[Previous Changelog](https://github.com/Reloaded-Project/Reloaded-II/releases/tag/1.29.5).
33

4-
Just a few community PRs and miscellany. As usual, Reloaded-II is on life support while I spend
5-
the next years building the next best thing - if you want features, please contribute!
4+
# 1.30.0: SliderControlParams TickFrequencyDouble
65

7-
# 1.29.5: Add missing `ModConfig.json` to include files
6+
## Added `TickFrequencyDouble` to `SliderControlParamsAttribute`
87

9-
There was a small regression in `1.29.3`, where the default includes did not
10-
include `ModConfig.json`, that's now been fixed.
8+
The `TickFrequency` property on `SliderControlParamsAttribute` was previously an `int`, which prevented
9+
using non-integer tick frequencies for sliders (e.g., `0.5`).
1110

12-
In addition I added a missing 'include files' label before the second table.
11+
A new `TickFrequencyDouble` property has been added. When set, it takes precedence over the old `TickFrequency` property.
1312

14-
# 1.29.4: Misc Linux Installer Improvements
13+
```csharp
14+
// Old way (integer only, now obsolete)
15+
[SliderControlParams(minimum: 0, maximum: 1, tickFrequency: 1)]
1516

16-
Small improvements to install on Linux:
17+
// New way (supports non-integer values)
18+
[SliderControlParams(minimum: 0, maximum: 1, TickFrequencyDouble = 0.1)]
19+
```
1720

18-
- [Ensure 'Applications' directory exists so creating shortcut doesn't fail during install on some systems.](https://github.com/Reloaded-Project/Reloaded-II/issues/717)
19-
- Create `Software\Wine` key in registry if doesn't exist. May fix odd cases where people's 'show dot files' settings don't enable by default.
20-
21-
And also:
22-
- Updated 🇫🇷 French Localization by @dysfunctionalriot
23-
24-
# 1.29.3: More Miscellaneous Improvements
25-
26-
## Allow .NET 9 Versions >= 9.0.8 for loader.
27-
28-
No update to .NET 10 as of current; but am allowing 9.0.8 or greater for loader now.
29-
30-
According to 3rd party reports I got thus far, `Proton` needs updating to receive some upstream fixes from `Wine` for .NET 10, which may take a while to reach downstream.
31-
We wait for Proton 11, I suppose.
32-
33-
## Added Progress Bar for Mod Installation
34-
35-
![Image](https://github.com/user-attachments/assets/9f09ccad-f036-4856-806c-3c75f281307a)
36-
37-
If a mod takes longer than 3 seconds to install via Drag & Drop, a simple progress bar will display on the screen now.
38-
In practice you should only see this if you install large mods (think >500MB); on a typical CPU.
39-
40-
## Save Mod Config on Publish, Including `IncludeFiles` and `ExcludeFiles` by @TheBestAstroNOT , @Sewer56
41-
42-
When you `Publish` a mod you have an option to exclude certain files from the released project via `File Inclusions & Exclusions`.
43-
By default, that is all `.json` files except `.deps.json` and `.runtimeconfig.json` ones.
44-
45-
Previously, changes on this menu didn't save; as barely anyone ever changed the defaults.
46-
Now they do.
47-
48-
## Reorder ASI Loader DLL Detection Order by @dreamsyntax
49-
50-
The order of which DLL name gets selected for Ultimate ASI Loader was changed.
51-
Now matches using order defined in our code, rather than the order in `PE Header`.
52-
53-
With that in mind, items were rearranged to be as least intrusive as possible.
54-
For instance, ASI Loader as `dinput8.dll` has caused issues in the past in limited scenarios; e.g. when using C# library with SharpDX to read inputs via dinput.
55-
56-
## Disabled CET
57-
58-
[.NET 9 added a security feature (on by default)](https://learn.microsoft.com/en-us/dotnet/core/compatibility/interop/9.0/cet-support) which is incompatible with older unsupported versions of Windows.
59-
Namely Windows 10 22H2 and older.
60-
61-
Given that Reloaded-II is already unsafe by design (injects arbitrary code), and it's usually not used for multiplayer, there is no good reason for CET to be enforced.
62-
Rather, it should be the game's responsibility to opt in. Generally, if possible, if the base game runs on the PC, the modded game should too, out of the box.
63-
64-
## Misc
65-
66-
- Update Dependencies (@dreamsyntax)
21+
The old `TickFrequency` property has been marked as `[Obsolete]` but remains functional for backwards compatibility.
22+
Both binary and source compatibility with existing mods is preserved.
6723

6824
------------------------------------
6925

source/Reloaded.Mod.Interfaces/Reloaded.Mod.Interfaces.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFramework>netcoreapp3.1</TargetFramework>
@@ -13,7 +13,7 @@
1313
<RepositoryUrl>https://github.com/Reloaded-Project/Reloaded-II</RepositoryUrl>
1414
<RepositoryType>git</RepositoryType>
1515
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
16-
<Version>2.4.1</Version>
16+
<Version>2.5.0</Version>
1717
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1818
<Platforms>AnyCPU</Platforms>
1919
<NoWarn>1701;1702;1591</NoWarn>

source/Reloaded.Mod.Interfaces/Structs/ControlAttribute.cs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace Reloaded.Mod.Interfaces.Structs;
1+
namespace Reloaded.Mod.Interfaces.Structs;
22

33
/// <summary>
44
/// Change the position that the ticks appear for the Slider Control
@@ -35,9 +35,22 @@ public class SliderControlParamsAttribute : Attribute, ICustomControlAttribute
3535
/// </summary>
3636
public double LargeChange { get; }
3737
/// <summary>
38-
/// Places a tick every N values
38+
/// Places a tick every N values.
3939
/// </summary>
40+
/// <remarks>
41+
/// This property is obsolete. Use <see cref="TickFrequencyDouble"/> instead, which supports non-integer tick frequencies.
42+
/// This property remains for binary backwards compatibility.
43+
/// </remarks>
44+
[Obsolete("Use TickFrequencyDouble instead. This property remains for binary backwards compatibility.")]
4045
public int TickFrequency { get; }
46+
47+
/// <summary>
48+
/// Places a tick every N values. If set to a value greater than 0, this takes precedence over <see cref="TickFrequency"/>.
49+
/// </summary>
50+
/// <remarks>
51+
/// Default value is 0, which means the old <see cref="TickFrequency"/> property is used instead.
52+
/// </remarks>
53+
public double TickFrequencyDouble { get; set; }
4154
/// <summary>
4255
/// If enabled, the slider will snap to the tick values.
4356
/// </summary>
@@ -78,7 +91,7 @@ public SliderControlParamsAttribute(
7891
bool showTextField,
7992
bool isTextFieldEditable,
8093
string textValidationRegex
81-
) : this(minimum, maximum, smallChange, largeChange, tickFrequency, isSnapToTickEnabled, tickPlacement, showTextField, isTextFieldEditable, textValidationRegex, textFieldFormat: "")
94+
) : this(minimum, maximum, smallChange, largeChange, tickFrequency, isSnapToTickEnabled, tickPlacement, showTextField, isTextFieldEditable, textValidationRegex, textFieldFormat: "", tickFrequencyDouble: 0)
8295
{}
8396

8497
public SliderControlParamsAttribute(
@@ -92,13 +105,15 @@ public SliderControlParamsAttribute(
92105
bool showTextField = false,
93106
bool isTextFieldEditable = true,
94107
string textValidationRegex = ".*",
95-
string textFieldFormat = ""
108+
string textFieldFormat = "",
109+
double tickFrequencyDouble = 0
96110
) {
97111
Minimum = minimum;
98112
Maximum = maximum;
99113
SmallChange = smallChange;
100114
LargeChange = largeChange;
101115
TickFrequency = tickFrequency;
116+
TickFrequencyDouble = tickFrequencyDouble;
102117
IsSnapToTickEnabled = isSnapToTickEnabled;
103118
TickPlacement = tickPlacement;
104119
ShowTextField = showTextField;

source/Reloaded.Mod.Launcher/Controls/PropertyGridEx.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ public override FrameworkElement CreateElement(PropertyItem propertyItem)
476476
Maximum = SliderControlParams.Maximum,
477477
SmallChange = SliderControlParams.SmallChange,
478478
LargeChange = SliderControlParams.LargeChange,
479-
TickFrequency = SliderControlParams.TickFrequency,
479+
TickFrequency = SliderControlParams.TickFrequencyDouble > 0 ? SliderControlParams.TickFrequencyDouble : SliderControlParams.TickFrequency,
480480
IsSnapToTickEnabled = SliderControlParams.IsSnapToTickEnabled,
481481
TickPlacement = SliderTickPlacementEnumConvert.ToTickPlacement(SliderControlParams.TickPlacement)
482482
};

source/Testing/Mods/TestModControlParams/Config.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.ComponentModel;
1+
using System.ComponentModel;
22
using TestModControlParams.Template.Configuration;
33
using Reloaded.Mod.Interfaces.Structs;
44

@@ -28,6 +28,21 @@ public class Config : Configurable<Config>
2828
[SliderControlParams(minimum: 0.0, maximum: 1.0, showTextField: true, textFieldFormat: "{0:#,0.000}")]
2929
public double DoubleSlider { get; set; } = 0.5;
3030

31+
[DisplayName("Double Slider (TickFrequencyDouble)")]
32+
[Description("This slider uses the new TickFrequencyDouble property for 0.01 tick increments.")]
33+
[DefaultValue(0.5)]
34+
[SliderControlParams(
35+
minimum: 0.0,
36+
maximum: 1.0,
37+
smallChange: 0.01,
38+
largeChange: 0.1,
39+
isSnapToTickEnabled: true,
40+
tickPlacement: SliderControlTickPlacement.BottomRight,
41+
showTextField: true,
42+
textFieldFormat: "{0:0.00}",
43+
TickFrequencyDouble = 0.01)]
44+
public double DoubleSliderWithTickFrequencyDouble { get; set; } = 0.5;
45+
3146
[DisplayName("File Picker")]
3247
[Description("This is a sample file picker.")]
3348
[DefaultValue("")]

0 commit comments

Comments
 (0)