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

95 lines
2.2 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 UIImage:TextureRect, UIStylePropertyContainer
{
[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;
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;
}
}
}