231 lines
5.7 KiB
C#
231 lines
5.7 KiB
C#
|
|
using Godot;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Rokojori
|
|
{
|
|
[Tool]
|
|
[GlobalClass]
|
|
public partial class UIRegion : Control, UIStylePropertyContainer
|
|
{
|
|
[Export]
|
|
public UIStyle parentStyle;
|
|
|
|
[ExportGroup( "Layout" )]
|
|
[Export]
|
|
public UILayout layout;
|
|
|
|
[Export]
|
|
public UINumber horizontalAlignment;
|
|
[Export]
|
|
public UINumber verticalAlignment;
|
|
[Export]
|
|
public UINumber verticalPlacement;
|
|
|
|
[Export]
|
|
public UINumber elementSpacing;
|
|
[Export]
|
|
public UINumber lineSpacing;
|
|
|
|
|
|
[ExportGroup( "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;
|
|
|
|
|
|
[ExportGroup( "Position" )]
|
|
[Export]
|
|
public UIPosition position;
|
|
[Export]
|
|
public UILineWrap lineWrap;
|
|
[Export]
|
|
public UINumber left;
|
|
[Export]
|
|
public UINumber top;
|
|
[Export]
|
|
public UINumber right;
|
|
[Export]
|
|
public UINumber bottom;
|
|
|
|
[ExportGroup( "Font" )]
|
|
[Export]
|
|
public Font font;
|
|
[Export]
|
|
public UINumber fontSize;
|
|
[Export]
|
|
public UIColor fontColor;
|
|
|
|
[Export]
|
|
public UINumber outlineSize;
|
|
[Export]
|
|
public UIColor outlineColor;
|
|
|
|
[Export]
|
|
public UINumber shadowSize;
|
|
[Export]
|
|
public UIColor shadowColor;
|
|
|
|
[Export]
|
|
public UINumber shadowOffsetX;
|
|
[Export]
|
|
public UINumber shadowOffsetY;
|
|
|
|
public List<ActiveStyleTransition<UIColor,ColorPropertyName>> GetActiveShaderUIColorTransitions()
|
|
{
|
|
return null;
|
|
}
|
|
|
|
public List<ActiveStyleTransition<UINumber,FloatPropertyName>> GetActiveShaderUINumberTransitions()
|
|
{
|
|
return null;
|
|
}
|
|
|
|
|
|
[ExportGroup("Transitions")]
|
|
[Export]
|
|
public TransitionSettingsAll transitionSettings;
|
|
public TransitionSettingsAll GetTransitionSettingsAll()
|
|
{
|
|
return transitionSettings;
|
|
}
|
|
|
|
[Export]
|
|
public UINumberTransition[] numberTransitions;
|
|
public UINumberTransition[] GetNumberTransitions()
|
|
{
|
|
return numberTransitions;
|
|
}
|
|
|
|
public List<ActiveStyleTransition<UINumber,UIStyleNumberProperty>> activeNumberTransitions = new List<ActiveStyleTransition<UINumber,UIStyleNumberProperty>>();
|
|
public List<ActiveStyleTransition<UINumber,UIStyleNumberProperty>> GetActiveUINumberTransitions()
|
|
{
|
|
return activeNumberTransitions;
|
|
}
|
|
|
|
[Export]
|
|
public UIColorTransition[] colorTransitions;
|
|
public UIColorTransition[] GetColorTransitions()
|
|
{
|
|
return colorTransitions;
|
|
}
|
|
|
|
public List<ActiveStyleTransition<UIColor,UIStyleColorProperty>> activeColorTransitions = new List<ActiveStyleTransition<UIColor,UIStyleColorProperty>>();
|
|
public List<ActiveStyleTransition<UIColor,UIStyleColorProperty>> GetActiveUIColorTransitions()
|
|
{
|
|
return activeColorTransitions;
|
|
}
|
|
|
|
public UIStyle GetUIStyleParent()
|
|
{
|
|
return parentStyle;
|
|
}
|
|
|
|
public UIPosition GetUIPosition()
|
|
{
|
|
return position;
|
|
}
|
|
|
|
public UILineWrap GetUILineWrap()
|
|
{
|
|
return lineWrap;
|
|
}
|
|
|
|
public UILayout GetUILayout()
|
|
{
|
|
return layout;
|
|
}
|
|
|
|
public ShaderUIColor[] GetShaderUIColors()
|
|
{
|
|
return null;
|
|
}
|
|
|
|
public ShaderUINumber[] GetShaderUINumbers()
|
|
{
|
|
return null;
|
|
}
|
|
|
|
public UINumber GetUIStyleNumberProperty( UIStyleNumberProperty property )
|
|
{
|
|
switch ( property )
|
|
{
|
|
case UIStyleNumberProperty.Left: return left;
|
|
case UIStyleNumberProperty.Right: return right;
|
|
case UIStyleNumberProperty.Top: return top;
|
|
case UIStyleNumberProperty.Bottom: return bottom;
|
|
|
|
case UIStyleNumberProperty.Width: return width;
|
|
case UIStyleNumberProperty.Height: return height;
|
|
|
|
case UIStyleNumberProperty.HorizontalAlignment: return horizontalAlignment;
|
|
case UIStyleNumberProperty.VerticalAlignment: return verticalAlignment;
|
|
case UIStyleNumberProperty.VerticalPlacement: return verticalPlacement;
|
|
case UIStyleNumberProperty.ElementSpacing: return elementSpacing;
|
|
case UIStyleNumberProperty.LineSpacing: return lineSpacing;
|
|
|
|
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.FontSize: return fontSize;
|
|
case UIStyleNumberProperty.FontOutlineSize: return outlineSize;
|
|
case UIStyleNumberProperty.FontShadowSize: return shadowSize;
|
|
case UIStyleNumberProperty.FontShadowOffsetX: return shadowOffsetX;
|
|
case UIStyleNumberProperty.FontShadowOffsetY: return shadowOffsetY;
|
|
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
public UIColor GetUIStyleColorProperty( UIStyleColorProperty property )
|
|
{
|
|
switch ( property )
|
|
{
|
|
case UIStyleColorProperty.FontColor: return fontColor;
|
|
case UIStyleColorProperty.FontOutlineColor: return outlineColor;
|
|
case UIStyleColorProperty.FontShadowColor: return shadowColor;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
public void Layout()
|
|
{
|
|
var layout = UIStyle.Layout( this );
|
|
|
|
switch ( layout )
|
|
{
|
|
case UILayout.___:
|
|
case UILayout.Flow_Left_Top:
|
|
{
|
|
UIFlowLayout.Apply( this );
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
public Vector2 contentSize = Vector2.Zero;
|
|
public Vector2 contentOffset = Vector2.Zero;
|
|
|
|
|
|
}
|
|
} |