Game.UI.Widgets.Direction
Assembly:
Assembly-CSharp (game core assembly)
Namespace:
Game.UI.Widgets
Type:
public enum Direction
Base:
System.Enum
Summary:
Enum that represents the orientation/direction used by UI widgets and layout containers. Typically used to choose whether child elements are arranged vertically (stacked top-to-bottom) or horizontally (laid out left-to-right). Useful for stack panels, splitters, flow layouts, and any widget that needs an orientation flag.
Fields
-
Vertical
Value = 0. Indicates a vertical orientation — items are arranged on top of one another (top-to-bottom). This is the default enum value. -
Horizontal
Value = 1. Indicates a horizontal orientation — items are arranged side by side (left-to-right).
Properties
- None.
This enum provides named values only; there are no additional properties defined on it.
Constructors
- None (compiler provided).
Enums do not declare instance constructors; the underlying type is int and the named values are initialized by the compiler. The default value is the enum member with numeric value 0 (Vertical).
Methods
- Inherited from System.Enum / System.ValueType / System.Object. Commonly used static and instance methods include:
- ToString() — returns the name of the current enum value ("Vertical" or "Horizontal").
- Enum.Parse / Enum.TryParse — parse a string to a Direction value.
- Enum.GetValues / Enum.GetNames — enumerate available Direction members.
- Equals, GetHashCode, CompareTo — standard value-type / object methods.
Usage Example
// Example: simple widget that lays out children based on Direction
public class SimpleStackWidget : Widget
{
public Direction Orientation { get; set; } = Direction.Vertical;
protected override void Layout()
{
if (Orientation == Direction.Vertical)
{
// arrange children top-to-bottom
}
else // Direction.Horizontal
{
// arrange children left-to-right
}
}
}
// Usage:
var stack = new SimpleStackWidget();
stack.Orientation = Direction.Horizontal; // switch to horizontal layout