rj-action-library/Runtime/UI/Styling/UIStyleProperty.cs

136 lines
2.6 KiB
C#
Raw Permalink Normal View History

2024-08-09 13:52:49 +00:00
using Godot;
using Rokojori;
namespace Rokojori
{
public enum UIStyleNumberProperty
{
Left,
Right,
Bottom,
Top,
Width,
Height,
2024-08-11 17:38:06 +00:00
ElementSpacing,
LineSpacing,
2024-09-14 06:41:52 +00:00
HorizontalAlignment,
VerticalAlignment,
VerticalPlacement,
2024-08-11 17:38:06 +00:00
2024-08-09 13:52:49 +00:00
Margin,
MarginLeft,
MarginRight,
MarginTop,
MarginBottom,
PivotX,
PivotY,
Rotation,
Scale,
ScaleX,
2024-08-11 17:38:06 +00:00
ScaleY,
FontSize,
FontOutlineSize,
2024-09-14 06:41:52 +00:00
FontShadowSize,
FontShadowOffsetX,
2025-06-19 17:22:25 +00:00
FontShadowOffsetY,
FloatShaderProperty
}
public class UIStyleNumberPropertyAndName
{
public UIStyleNumberProperty styleProperty;
public string shaderPropertyName;
public static UIStyleNumberPropertyAndName Create( UIStyleNumberProperty property, string shaderPropertyName )
{
var pn = new UIStyleNumberPropertyAndName();
pn.styleProperty = property;
pn.shaderPropertyName = shaderPropertyName;
return pn;
}
public override string ToString()
{
if ( UIStyleNumberProperty.FloatShaderProperty == styleProperty )
{
return styleProperty + ": " + shaderPropertyName;
}
return styleProperty + "";
}
public bool Matches( UIStyleNumberProperty styleProperty, string shaderPropertyName )
{
if ( this.styleProperty != styleProperty )
{
return false;
}
if ( UIStyleNumberProperty.FloatShaderProperty != styleProperty )
{
return true;
}
return shaderPropertyName == this.shaderPropertyName;
}
2024-08-11 17:38:06 +00:00
}
public enum UIStyleColorProperty
{
FontColor,
FontOutlineColor,
2025-06-19 17:22:25 +00:00
FontShadowColor,
ColorShaderProperty
2024-08-09 13:52:49 +00:00
}
2025-06-19 17:22:25 +00:00
public class UIStyleColorPropertyAndName
{
public UIStyleColorProperty styleProperty;
public string shaderPropertyName;
public static UIStyleColorPropertyAndName Create( UIStyleColorProperty property, string shaderPropertyName )
{
var pn = new UIStyleColorPropertyAndName();
pn.styleProperty = property;
pn.shaderPropertyName = shaderPropertyName;
return pn;
}
public override string ToString()
{
if ( UIStyleColorProperty.ColorShaderProperty == styleProperty )
{
return styleProperty + ": " + shaderPropertyName;
}
return styleProperty + "";
}
public bool Matches( UIStyleColorProperty styleProperty, string shaderPropertyName )
{
if ( this.styleProperty != styleProperty )
{
return false;
}
if ( UIStyleColorProperty.ColorShaderProperty != styleProperty )
{
return true;
}
return shaderPropertyName == this.shaderPropertyName;
}
}
2024-08-09 13:52:49 +00:00
}