rj-action-library/Runtime/UI/Nodes/UIText.cs

110 lines
2.4 KiB
C#
Raw Normal View History

2024-08-09 13:52:49 +00:00
using Godot;
using Rokojori;
namespace Rokojori
{
[Tool]
[GlobalClass]
public partial class UIText:Label,UIStylePropertyContainer
{
2024-08-11 17:38:06 +00:00
[Export]
public UIStyle parentStyle;
[Export]
public UINumber fontSize;
2024-08-09 13:52:49 +00:00
[ExportCategory("Size & Margins")]
[Export]
public UINumber width;
[Export]
public UINumber height;
[Export]
public UINumber margin;
[Export]
public UINumber marginLeft;
[Export]
public UINumber marginTop;
[Export]
public UINumber marginRight;
[Export]
public UINumber marginBottom;
[ExportCategory("Position")]
[Export]
public UIPosition position;
[Export]
public UINumber left;
[Export]
public UINumber top;
[Export]
public UINumber right;
[Export]
public UINumber bottom;
[ExportCategory("Rotation & Scale")]
[Export]
public UINumber pivotX;
[Export]
public UINumber pivotY;
[Export]
public UINumber rotation;
[Export]
public UINumber scale;
[Export]
public UINumber scaleX;
[Export]
public UINumber scaleY;
2024-08-11 17:38:06 +00:00
public UIStyle GetUIStyleParent()
{
return parentStyle;
}
public UIPosition GetUIPosition()
{
return position;
}
2024-08-09 13:52:49 +00:00
public UINumber GetUIStyleNumberProperty( UIStyleNumberProperty property )
{
switch ( property )
{
case UIStyleNumberProperty.Width: return width;
case UIStyleNumberProperty.Height: return height;
case UIStyleNumberProperty.Margin: return margin;
case UIStyleNumberProperty.MarginLeft: return marginLeft;
case UIStyleNumberProperty.MarginRight: return marginRight;
case UIStyleNumberProperty.MarginTop: return marginTop;
case UIStyleNumberProperty.MarginBottom: return marginBottom;
case UIStyleNumberProperty.Left: return left;
case UIStyleNumberProperty.Right: return right;
case UIStyleNumberProperty.Top: return top;
case UIStyleNumberProperty.Bottom: return bottom;
case UIStyleNumberProperty.PivotX: return pivotX;
case UIStyleNumberProperty.PivotY: return pivotY;
case UIStyleNumberProperty.Rotation: return rotation;
case UIStyleNumberProperty.Scale: return scale;
case UIStyleNumberProperty.ScaleX: return scaleX;
case UIStyleNumberProperty.ScaleY: return scaleY;
}
return null;
}
}
}