From 1f0ad8381c746ed5243fe597a82f3d45fcb4b92a Mon Sep 17 00:00:00 2001 From: Arne Kiesewetter Date: Sun, 24 Aug 2025 14:02:48 +0200 Subject: [PATCH 1/3] Update for .net 9 --- .github/workflows/build.yml | 4 ++-- .github/workflows/publish.yml | 2 +- .../ComponentSelectorAdditions.csproj | 10 +++++----- Directory.Build.props | 3 +-- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1e0e9bb..c0386f5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,7 +43,7 @@ jobs: - name: Setup Dotnet uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.x + dotnet-version: 9.x source-url: https://nuget.pkg.github.com/ResoniteModdingGroup/index.json - name: Add MonkeyLoader NuGet Source @@ -98,7 +98,7 @@ jobs: - name: Setup Dotnet uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.x + dotnet-version: 9.x source-url: https://nuget.pkg.github.com/ResoniteModdingGroup/index.json - name: Add MonkeyLoader NuGet Source diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 059338c..3fe7a28 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -68,7 +68,7 @@ jobs: - name: Setup Dotnet uses: actions/setup-dotnet@v4 with: - dotnet-version: 8.x + dotnet-version: 9.x source-url: https://nuget.pkg.github.com/ResoniteModdingGroup/index.json - name: Add MonkeyLoader NuGet Source diff --git a/ComponentSelectorAdditions/ComponentSelectorAdditions.csproj b/ComponentSelectorAdditions/ComponentSelectorAdditions.csproj index 0bb020d..2aafa2a 100644 --- a/ComponentSelectorAdditions/ComponentSelectorAdditions.csproj +++ b/ComponentSelectorAdditions/ComponentSelectorAdditions.csproj @@ -1,6 +1,5 @@  - netstandard2.0 ComponentSelectorAdditions $(AssemblyTitle).dll ComponentSelectorAdditions @@ -16,6 +15,7 @@ README.md LGPL-3.0-or-later https://github.com/ResoniteModdingGroup/ComponentSelectorAdditions + $(PackageProjectUrl).git mod; mods; monkeyloader; resonite; component; attacher; selector; protoflux; node; picker; search; favorites @@ -30,18 +30,18 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - + diff --git a/Directory.Build.props b/Directory.Build.props index 2738185..ac602c6 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ Library - net462 + net9.0 $(AssemblyTitle).dll 11.0 enable @@ -20,7 +20,6 @@ README.md - $(PackageProjectUrl).git git False True From 0e9c807c9ad3db6a4bda5e6aa4a1968a1dbd3bf7 Mon Sep 17 00:00:00 2001 From: Arne Kiesewetter Date: Mon, 25 Aug 2025 22:49:13 +0200 Subject: [PATCH 2/3] Make concrete generics (and typed nodes) show up as direct search results instead of being hidden in groups Implements #12 --- ComponentSelectorAdditions/Injector.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ComponentSelectorAdditions/Injector.cs b/ComponentSelectorAdditions/Injector.cs index 2165854..6f66c00 100644 --- a/ComponentSelectorAdditions/Injector.cs +++ b/ComponentSelectorAdditions/Injector.cs @@ -137,7 +137,7 @@ private static void BuildCategoryUI(ComponentSelector selector, UIBuilder ui, Se groupCounter = new KeyCounter(); groupNames = new HashSet(); - foreach (var component in enumerateComponentsData.Items.Where(component => component.HasGroup)) + foreach (var component in enumerateComponentsData.Items.Where(component => component.HasGroup && !component.IsConcreteGeneric)) groupCounter.Increment(component.Group!); } @@ -146,7 +146,8 @@ private static void BuildCategoryUI(ComponentSelector selector, UIBuilder ui, Se if (path.HasGroup && component.Group != path.Group) continue; - if (!path.HasGroup && component.HasGroup && groupCounter![component.Group] > 1) + if (!path.HasGroup && component.HasGroup && groupCounter![component.Group] > 1 + && !component.IsConcreteGeneric && !(path.HasSearchGeneric && component.Type.Name.EndsWith(path.SearchGeneric, StringComparison.OrdinalIgnoreCase))) { if (groupNames!.Add(component.Group)) OnBuildGroupButton(selector, ui, rootCategory, component); @@ -164,21 +165,21 @@ private static void BuildGenericTypeUI(ComponentSelector selector, UIBuilder ui, backButton = null; var type = Type.GetType(path.PathSegments[^1]); - selector._genericType.Value = type; + selector._genericType.Value = type!; if (!doNotGenerateBack) backButton = ui.Button("ComponentSelector.Back".AsLocaleKey(), RadiantUI_Constants.BUTTON_COLOR, selector.OnOpenCategoryPressed, path.OpenParentCategoryPath, 0.35f); ui.Text("ComponentSelector.CustomGenericArguments".AsLocaleKey()); - var customGenericBuilderData = OnBuildCustomGenericBuilder(selector, ui, type); + var customGenericBuilderData = OnBuildCustomGenericBuilder(selector, ui, type!); customGenericButton = customGenericBuilderData.CreateCustomTypeButton!; otherAddedButtons = customGenericBuilderData.OtherAddedButtonsSet; ui.Panel(); ui.NestOut(); - var concreteGenericsEventData = OnEnumerateConcreteGenerics(selector, type); + var concreteGenericsEventData = OnEnumerateConcreteGenerics(selector, type!); if (concreteGenericsEventData.Items.Any()) { From 8439d517be43c9bba55d732d4114278decb96f71 Mon Sep 17 00:00:00 2001 From: Arne Kiesewetter Date: Mon, 25 Aug 2025 23:22:14 +0200 Subject: [PATCH 3/3] Add documentation to all events and fix analyzer warnings --- ComponentSelectorAdditions/ComponentResult.cs | 2 +- .../ComponentSelectorAdditions.csproj | 2 +- .../Events/BuildButtonEvent.cs | 36 ++++++++++++++ .../Events/BuildCategoryButtonEvent.cs | 7 +++ .../Events/BuildComponentButtonEvent.cs | 13 +++++ .../Events/BuildCustomGenericBuilder.cs | 40 +++++++++++++++ .../Events/BuildGroupButtonEvent.cs | 13 +++++ .../Events/BuildSelectorEvent.cs | 31 ++++++++++++ .../Events/BuildSelectorFooterEvent.cs | 13 ++++- .../Events/BuildSelectorHeaderEvent.cs | 6 +++ .../Events/EnumerateCategoriesEvent.cs | 13 ++++- .../Events/EnumerateComponentsEvent.cs | 16 +++++- .../Events/EnumerateConcreteGenericsEvent.cs | 16 +++++- .../Events/IEnumerateSelectorResultEvent.cs | 15 ++++++ .../Events/PostProcessButtonsEvent.cs | 49 +++++++++++++++++++ .../FavoritesCategories.cs | 8 +-- ComponentSelectorAdditions/SearchConfig.cs | 5 +- ComponentSelectorAdditions/SelectorPath.cs | 2 +- 18 files changed, 271 insertions(+), 16 deletions(-) diff --git a/ComponentSelectorAdditions/ComponentResult.cs b/ComponentSelectorAdditions/ComponentResult.cs index 57ced2a..aac0201 100644 --- a/ComponentSelectorAdditions/ComponentResult.cs +++ b/ComponentSelectorAdditions/ComponentResult.cs @@ -86,7 +86,7 @@ public ComponentResult(CategoryNode? category, Type type, string? group) } /// - public override bool Equals(object obj) + public override bool Equals(object? obj) => obj is ComponentResult otherResult && otherResult.Type == Type; /// diff --git a/ComponentSelectorAdditions/ComponentSelectorAdditions.csproj b/ComponentSelectorAdditions/ComponentSelectorAdditions.csproj index 2aafa2a..cdee5bf 100644 --- a/ComponentSelectorAdditions/ComponentSelectorAdditions.csproj +++ b/ComponentSelectorAdditions/ComponentSelectorAdditions.csproj @@ -10,7 +10,7 @@ ComponentSelectorAdditions Component Selector Additions Banane9 - 0.9.0-beta + 0.10.0-beta This MonkeyLoader mod for Resonite overhauls the Component Selector / Protoflux Node Selector to have a search, as well as favorites and recents categories. README.md LGPL-3.0-or-later diff --git a/ComponentSelectorAdditions/Events/BuildButtonEvent.cs b/ComponentSelectorAdditions/Events/BuildButtonEvent.cs index 8ab6778..9ea6e70 100644 --- a/ComponentSelectorAdditions/Events/BuildButtonEvent.cs +++ b/ComponentSelectorAdditions/Events/BuildButtonEvent.cs @@ -9,13 +9,49 @@ namespace ComponentSelectorAdditions.Events { + /// + /// Abstract base class for button generation events. + /// public abstract class BuildButtonEvent : CancelableBuildUIEvent { + /// + /// Gets whether the target of the button being generated is + /// a direct element + /// of the current root category. + /// public bool IsDirectItem { get; } + + /// + /// Gets the category that the target of the button belongs to, if available. + /// public CategoryNode? ItemCategory { get; } + + /// + /// Gets the current root category of the selector + /// that the button is being generated for, if available. + /// public CategoryNode? RootCategory { get; } + + /// + /// Gets the selector that the button is being generated for. + /// public ComponentSelector Selector { get; } + /// + /// Creates a new button generation event with the given data. + /// + /// The selector that the button is being generated for. + /// The to use while generating extra UI elements. + /// + /// The current root category of the selector + /// that the button is being generated for, if available. + /// + /// The category that the target of the button belongs to, if available. + /// + /// Whether the target of the button being generated is + /// a direct element + /// of the current root category. + /// protected BuildButtonEvent(ComponentSelector selector, UIBuilder ui, CategoryNode? rootCategory, CategoryNode? itemCategory, bool isDirectItem) : base(ui) { Selector = selector; diff --git a/ComponentSelectorAdditions/Events/BuildCategoryButtonEvent.cs b/ComponentSelectorAdditions/Events/BuildCategoryButtonEvent.cs index ad1f4f2..a54444d 100644 --- a/ComponentSelectorAdditions/Events/BuildCategoryButtonEvent.cs +++ b/ComponentSelectorAdditions/Events/BuildCategoryButtonEvent.cs @@ -8,6 +8,13 @@ namespace ComponentSelectorAdditions.Events { + /// + /// Represents the event data for the Build Category Button Event. + /// + /// + /// This is used to generate the button for opening a nested + /// category in a selector. + /// public sealed class BuildCategoryButtonEvent : BuildButtonEvent { /// diff --git a/ComponentSelectorAdditions/Events/BuildComponentButtonEvent.cs b/ComponentSelectorAdditions/Events/BuildComponentButtonEvent.cs index 5e044a4..48ae7b2 100644 --- a/ComponentSelectorAdditions/Events/BuildComponentButtonEvent.cs +++ b/ComponentSelectorAdditions/Events/BuildComponentButtonEvent.cs @@ -8,10 +8,23 @@ namespace ComponentSelectorAdditions.Events { + /// + /// Represents the event data for the Build Component Button Event. + /// + /// + /// This is used to generate the button to attach a concrete component, + /// or to open the custom generic selection page for open generics. + /// public sealed class BuildComponentButtonEvent : BuildButtonEvent { + /// + /// Gets the component result that the button targets. + /// public ComponentResult Component { get; } + /// + /// Gets the current selector path. + /// public SelectorPath Path { get; } /// diff --git a/ComponentSelectorAdditions/Events/BuildCustomGenericBuilder.cs b/ComponentSelectorAdditions/Events/BuildCustomGenericBuilder.cs index f1b273f..c38198a 100644 --- a/ComponentSelectorAdditions/Events/BuildCustomGenericBuilder.cs +++ b/ComponentSelectorAdditions/Events/BuildCustomGenericBuilder.cs @@ -11,13 +11,27 @@ namespace ComponentSelectorAdditions.Events { + /// + /// Represents the event data for the Build Custom Generic Builder Event. + /// + /// + /// This is used to generate the UI for picking custom generic arguments for generic components. + /// public sealed class BuildCustomGenericBuilder : BuildUIEvent { internal readonly HashSet