Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Silksong.ModMenu/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
It should follow the format major.minor.patch (semantic versioning). If you publish your mod
as a library to NuGet, this version will also be used as the package version.
-->
<Version>0.7.2</Version>
<Version>0.7.3</Version>
</PropertyGroup>
</Project>
12 changes: 12 additions & 0 deletions Silksong.ModMenuAnalyzers/MenuProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ out var menuRangeAttr
&& !InitBoolType()
&& !InitKeyCodeType()
&& !InitEnumType()
&& !InitColorType()
&& !InitTextType()
)
{
Expand Down Expand Up @@ -355,6 +356,17 @@ private bool InitEnumType()
return true;
}

private bool InitColorType()
{
if (DataType.ToDisplayString() != "UnityEngine.Color")
return false;

DefaultInitializer.Add(
$@"{Name} = new Silksong.ModMenu.Elements.ColorInput({DisplayName.MakeLiteral()}, {Description.MakeLiteral()});"
);
return true;
}

private bool InitTextType()
{
if (DataType.SpecialType != SpecialType.System_String)
Expand Down
3 changes: 3 additions & 0 deletions Silksong.ModMenuTesting/Tests/GeneratorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Silksong.ModMenu.Generator;
using Silksong.ModMenu.Models;
using Silksong.ModMenu.Screens;
using UnityEngine;

namespace Silksong.ModMenuTesting.Tests;

Expand Down Expand Up @@ -49,6 +50,8 @@ public class GeneratedData
public float FloatValue = 9;
public double DoubleValue = 10;

public Color ColorValue = Color.red;

[ModMenuName("Custom Bool Name")]
public bool BoolValue;

Expand Down