diff --git a/ComponentSelectorAdditions/ComponentResult.cs b/ComponentSelectorAdditions/ComponentResult.cs index f038a66..57ced2a 100644 --- a/ComponentSelectorAdditions/ComponentResult.cs +++ b/ComponentSelectorAdditions/ComponentResult.cs @@ -42,6 +42,11 @@ public sealed class ComponentResult [MemberNotNullWhen(true, nameof(Group), nameof(GroupName))] public bool HasGroup => Group is not null; + /// + /// Gets whether this Type is a concrete generic. + /// + public bool IsConcreteGeneric => Type.IsGenericType && !IsGeneric; + /// /// Gets whether this Type is a generic type definition. /// diff --git a/ComponentSelectorAdditions/DefaultConfig.cs b/ComponentSelectorAdditions/DefaultConfig.cs index 0d1dd20..b6e7e4d 100644 --- a/ComponentSelectorAdditions/DefaultConfig.cs +++ b/ComponentSelectorAdditions/DefaultConfig.cs @@ -1,5 +1,7 @@ -using MonkeyLoader.Configuration; +using Elements.Core; +using MonkeyLoader.Configuration; using System; +using System.Diagnostics.CodeAnalysis; namespace ComponentSelectorAdditions { @@ -18,6 +20,8 @@ public sealed class DefaultConfig : ConfigSection new ConfigKeyRange(32, 64) }; + private static readonly DefiningConfigKey _separateConcreteGenericColor = new("separateConcreteGenericColor", "The color to use for concrete generic buttons, if defined. Defaults to a blend between the generic component buttons' green and the non-generic component buttons' cyan.", () => colorX.FromHexCode("#255447")); + /// /// Gets this config's instance. /// @@ -41,6 +45,17 @@ public sealed class DefaultConfig : ConfigSection /// The height in canvas units. public float IndirectButtonHeight => _indirectButtonHeight; + /// + /// Gets the color to use for concrete generic buttons, if defined. + /// + public colorX? SeparateConcreteGenericColor => _separateConcreteGenericColor; + + /// + /// Gets whether the SeparateConcreteGenericColor is defined. + /// + [MemberNotNullWhen(true, nameof(SeparateConcreteGenericColor))] + public bool UseSeparateConcreteGenericColor => _separateConcreteGenericColor.GetValue().HasValue; + /// public override Version Version { get; } = new Version(1, 0, 0); diff --git a/ComponentSelectorAdditions/DefaultHandler.cs b/ComponentSelectorAdditions/DefaultHandler.cs index 7d6f68d..80a653e 100644 --- a/ComponentSelectorAdditions/DefaultHandler.cs +++ b/ComponentSelectorAdditions/DefaultHandler.cs @@ -12,6 +12,7 @@ using System.Text; using System.Threading.Tasks; using System.IO; +using MonkeyLoader.Resonite.UI; namespace ComponentSelectorAdditions { @@ -62,6 +63,7 @@ public static TextField MakeGenericArgumentInput(UIBuilder ui, Type component, T { var textField = ui.TextField(parseRTF: false); textField.Text.NullContent.AssignLocaleString(Mod.GetLocaleString("EnterType")); + textField.Slot.GetComponent