Barotrauma Client Doc
|
Public Member Functions | |
void | ResetSizeChanged () |
RectTransform (Vector2 relativeSize, RectTransform parent, Anchor anchor=Anchor.TopLeft, Pivot? pivot=null, Point? minSize=null, Point? maxSize=null, ScaleBasis scaleBasis=ScaleBasis.Normal) | |
RectTransform (Point absoluteSize, RectTransform parent=null, Anchor anchor=Anchor.TopLeft, Pivot? pivot=null, ScaleBasis scaleBasis=ScaleBasis.Normal, bool isFixedSize=false) | |
By default, elements defined with an absolute size (in pixels) will scale with the parent. This can be changed by setting IsFixedSize to true. More... | |
void | SetPosition (Anchor anchor, Pivot? pivot=null) |
void | Resize (Point absoluteSize, bool resizeChildren=true) |
void | Resize (Vector2 relativeSize, bool resizeChildren=true) |
void | ChangeScale (Vector2 newScale) |
void | ResetScale () |
void | RecalculateScale (bool withChildren) |
Currently this needs to be manually called only when the global scale changes. If the local scale changes, the scale is automatically recalculated. More... | |
void | Translate (Point translation) |
Manipulates ScreenSpaceOffset. If you want to manipulate some other offset, access the property setters directly. More... | |
IEnumerable< RectTransform > | GetParents () |
Returns all parent elements in the hierarchy. More... | |
IEnumerable< RectTransform > | GetAllChildren () |
Returns all child elements in the hierarchy. More... | |
int | GetChildIndex (RectTransform rectT) |
RectTransform | GetChild (int index) |
bool | IsParentOf (RectTransform rectT, bool recursive=true) |
bool | IsChildOf (RectTransform rectT, bool recursive=true) |
void | ClearChildren () |
void | SortChildren (Comparison< RectTransform > comparison) |
void | ReverseChildren () |
void | SetAsLastChild () |
void | SetAsFirstChild () |
bool | RepositionChildInHierarchy (int index) |
void | RecalculateChildren (bool resize, bool scale=true) |
void | AddChildrenToGUIUpdateList (bool ignoreChildren=false, int order=0) |
void | MatchPivotToAnchor () |
void | MoveOverTime (Point targetPos, float duration, Action onDoneMoving=null) |
void | ScaleOverTime (Point targetSize, float duration) |
Static Public Member Functions | |
static RectTransform | Load (XElement element, RectTransform parent, Anchor defaultAnchor=Anchor.TopLeft) |
static Pivot | MatchPivotToAnchor (Anchor anchor) |
static Anchor | MatchAnchorToPivot (Pivot pivot) |
static Anchor | MoveAnchorLeft (Anchor anchor) |
Moves the anchor to the left, keeping the vertical position unchanged (e.g. CenterRight -> CenterLeft) More... | |
static Anchor | MoveAnchorRight (Anchor anchor) |
Moves the anchor to the right, keeping the vertical position unchanged (e.g. CenterLeft -> CenterRight) More... | |
static Anchor | MoveAnchorTop (Anchor anchor) |
Moves the anchor to the top, keeping the horizontal position unchanged (e.g. BottomCenter -> TopCenter) More... | |
static Anchor | MoveAnchorBottom (Anchor anchor) |
Moves the anchor to the bottom, keeping the horizontal position unchanged (e.g. TopCenter -> BottomCenter) More... | |
static Point | ConvertOffsetRelativeToAnchor (Point offset, Anchor anchor) |
Converts the offset so that the direction is always away from the anchor point. More... | |
static Point | CalculatePivotOffset (Pivot anchor, Point size) |
static Point | CalculateAnchorPoint (Anchor anchor, Rectangle parent) |
static void | ResetGlobalScale () |
The elements are not automatically resized, if the global scale changes. You have to manually call RecalculateScale() for all elements after changing the global scale. This is because there is currently no easy way to inform all the elements without having a reference to them. Having a reference (static list, or event) is problematic, because deconstructing the elements is not handled manually. This means that the uncleared references would bloat the memory. We could recalculate the scale each time it's needed, but in that case the calculation would need to be very lightweight and garbage free, which it currently is not. More... | |
Static Public Attributes | |
static readonly Point | MaxPoint = new Point(int.MaxValue, int.MaxValue) |
static Vector2 | globalScale = Vector2.One |
Applied to all RectTransforms. The elements are not automatically resized, if the global scale changes. You have to manually call RecalculateScale() for all elements after changing the global scale. This is because there is currently no easy way to inform all the elements without having a reference to them. Having a reference (static list, or event) is problematic, because deconstructing the elements is not handled manually. This means that the uncleared references would bloat the memory. We could recalculate the scale each time it's needed, but in that case the calculation would need to be very lightweight and garbage free, which it currently is not. More... | |
Protected Member Functions | |
void | RecalculateScale () |
void | RecalculatePivotOffset () |
void | RecalculateAnchorPoint () |
void | RecalculateRelativeSize () |
void | RecalculateAbsoluteSize () |
void | RecalculateAll (bool resize, bool scale=true, bool withChildren=true) |
Protected Attributes | |
readonly List< RectTransform > | children = new List<RectTransform>() |
Properties | |
GUIComponent | GUIComponent [get, set] |
Should be assigned only by GUIComponent. Note that RectTransform is created first and the GUIComponent after that. This means the GUIComponent is not set before the GUIComponent is initialized. More... | |
RectTransform?? | Parent [get, set] |
IEnumerable< RectTransform > | Children [get] |
int | CountChildren [get] |
Vector2 | RelativeSize [get, set] |
Relative to the parent rect. More... | |
Point?? | MinSize [get, set] |
Min size in pixels. Does not affect scaling. More... | |
Point?? | MaxSize [get, set] |
Max size in pixels. Does not affect scaling. More... | |
Point | NonScaledSize [get, set] |
Size before scale multiplications. More... | |
Point | ScaledSize [get] |
Size after scale multiplications. More... | |
Vector2? | LocalScale [get, set] |
Vector2 | Scale [get] |
Vector2 | RelativeOffset [get, set] |
Defined as portions of the parent size. Also the direction of the offset is relative, calculated away from the anchor point. More... | |
Point | AbsoluteOffset [get, set] |
Absolute in pixels but relative to the anchor point. Calculated away from the anchor point, like a padding. Use RelativeOffset to set an amount relative to the parent size. More... | |
Point | ScreenSpaceOffset [get, set] |
Screen space offset. From top left corner. In pixels. More... | |
Point | PivotOffset [get] |
Calculated from the selected pivot. In pixels. More... | |
Point | AnchorPoint [get] |
Screen space point in pixels. More... | |
Point | TopLeft [get] |
Point | NonScaledTopLeft [get] |
Rectangle | Rect [get] |
Rectangle | ParentRect [get] |
Rectangle | NonScaledRect [get] |
virtual Rectangle | NonScaledUIRect [get] |
Point | NonScaledParentSize [get] |
Rectangle | NonScaledParentRect [get] |
Rectangle | NonScaledParentUIRect [get] |
Rectangle | UIRect [get] |
Pivot | Pivot [get, set] |
Does not automatically calculate children. Note also that if you change the pivot point with this property, the pivot does not automatically match the anchor. You can use SetPosition to change everything automatcally or MatchPivotToAnchor to match the pivot to anchor. More... | |
Anchor | Anchor [get, set] |
Does not automatically calculate children. Note also that if you change the anchor point with this property, the pivot does not automatically match the anchor. You can use SetPosition to change everything automatically or MatchPivotToAnchor to match the pivot to anchor. More... | |
ScaleBasis | ScaleBasis [get, set] |
bool | IsLastChild [get] |
bool | IsFirstChild [get] |
bool | IsFixedSize [get, set] |
If false, the element will resize if the parent is resized (with the children). If true, the element will resize only when explicitly resized. Note that scaling always affects the elements. More... | |
Point?? | AnimTargetPos [get] |
Events | |
Action< RectTransform > | ParentChanged |
Action< RectTransform > | ChildrenChanged |
The element provided as the argument is the changed child. It may be new in the hierarchy or just repositioned. More... | |
Action | ScaleChanged |
Action | SizeChanged |
Definition at line 31 of file RectTransform.cs.
Barotrauma.RectTransform.RectTransform | ( | Vector2 | relativeSize, |
RectTransform | parent, | ||
Anchor | anchor = Anchor.TopLeft , |
||
Pivot? | pivot = null , |
||
Point? | minSize = null , |
||
Point? | maxSize = null , |
||
ScaleBasis | scaleBasis = ScaleBasis.Normal |
||
) |
Definition at line 353 of file RectTransform.cs.
Barotrauma.RectTransform.RectTransform | ( | Point | absoluteSize, |
RectTransform | parent = null , |
||
Anchor | anchor = Anchor.TopLeft , |
||
Pivot? | pivot = null , |
||
ScaleBasis | scaleBasis = ScaleBasis.Normal , |
||
bool | isFixedSize = false |
||
) |
By default, elements defined with an absolute size (in pixels) will scale with the parent. This can be changed by setting IsFixedSize to true.
Definition at line 371 of file RectTransform.cs.
void Barotrauma.RectTransform.AddChildrenToGUIUpdateList | ( | bool | ignoreChildren = false , |
int | order = 0 |
||
) |
Definition at line 727 of file RectTransform.cs.
|
static |
Definition at line 927 of file RectTransform.cs.
|
static |
Definition at line 898 of file RectTransform.cs.
void Barotrauma.RectTransform.ChangeScale | ( | Vector2 | newScale | ) |
Definition at line 582 of file RectTransform.cs.
void Barotrauma.RectTransform.ClearChildren | ( | ) |
Definition at line 668 of file RectTransform.cs.
|
static |
Converts the offset so that the direction is always away from the anchor point.
Definition at line 881 of file RectTransform.cs.
IEnumerable<RectTransform> Barotrauma.RectTransform.GetAllChildren | ( | ) |
Returns all child elements in the hierarchy.
Definition at line 634 of file RectTransform.cs.
RectTransform Barotrauma.RectTransform.GetChild | ( | int | index | ) |
Definition at line 644 of file RectTransform.cs.
int Barotrauma.RectTransform.GetChildIndex | ( | RectTransform | rectT | ) |
Definition at line 639 of file RectTransform.cs.
IEnumerable<RectTransform> Barotrauma.RectTransform.GetParents | ( | ) |
Returns all parent elements in the hierarchy.
Definition at line 617 of file RectTransform.cs.
bool Barotrauma.RectTransform.IsChildOf | ( | RectTransform | rectT, |
bool | recursive = true |
||
) |
Definition at line 662 of file RectTransform.cs.
bool Barotrauma.RectTransform.IsParentOf | ( | RectTransform | rectT, |
bool | recursive = true |
||
) |
Definition at line 649 of file RectTransform.cs.
|
static |
Definition at line 388 of file RectTransform.cs.
Definition at line 789 of file RectTransform.cs.
void Barotrauma.RectTransform.MatchPivotToAnchor | ( | ) |
Definition at line 785 of file RectTransform.cs.
Moves the anchor to the bottom, keeping the horizontal position unchanged (e.g. TopCenter -> BottomCenter)
Definition at line 860 of file RectTransform.cs.
Moves the anchor to the left, keeping the vertical position unchanged (e.g. CenterRight -> CenterLeft)
Definition at line 797 of file RectTransform.cs.
Moves the anchor to the right, keeping the vertical position unchanged (e.g. CenterLeft -> CenterRight)
Definition at line 818 of file RectTransform.cs.
Moves the anchor to the top, keeping the horizontal position unchanged (e.g. BottomCenter -> TopCenter)
Definition at line 839 of file RectTransform.cs.
void Barotrauma.RectTransform.MoveOverTime | ( | Point | targetPos, |
float | duration, | ||
Action | onDoneMoving = null |
||
) |
Definition at line 744 of file RectTransform.cs.
|
protected |
Definition at line 464 of file RectTransform.cs.
|
protected |
Definition at line 509 of file RectTransform.cs.
|
protected |
Definition at line 451 of file RectTransform.cs.
void Barotrauma.RectTransform.RecalculateChildren | ( | bool | resize, |
bool | scale = true |
||
) |
Definition at line 719 of file RectTransform.cs.
|
protected |
Definition at line 445 of file RectTransform.cs.
|
protected |
Definition at line 457 of file RectTransform.cs.
|
protected |
Definition at line 436 of file RectTransform.cs.
void Barotrauma.RectTransform.RecalculateScale | ( | bool | withChildren | ) |
Currently this needs to be manually called only when the global scale changes. If the local scale changes, the scale is automatically recalculated.
Definition at line 596 of file RectTransform.cs.
bool Barotrauma.RectTransform.RepositionChildInHierarchy | ( | int | index | ) |
Definition at line 702 of file RectTransform.cs.
|
static |
The elements are not automatically resized, if the global scale changes. You have to manually call RecalculateScale() for all elements after changing the global scale. This is because there is currently no easy way to inform all the elements without having a reference to them. Having a reference (static list, or event) is problematic, because deconstructing the elements is not handled manually. This means that the uncleared references would bloat the memory. We could recalculate the scale each time it's needed, but in that case the calculation would need to be very lightweight and garbage free, which it currently is not.
Definition at line 963 of file RectTransform.cs.
void Barotrauma.RectTransform.ResetScale | ( | ) |
Definition at line 587 of file RectTransform.cs.
void Barotrauma.RectTransform.ResetSizeChanged | ( | ) |
Definition at line 346 of file RectTransform.cs.
void Barotrauma.RectTransform.Resize | ( | Point | absoluteSize, |
bool | resizeChildren = true |
||
) |
Definition at line 567 of file RectTransform.cs.
void Barotrauma.RectTransform.Resize | ( | Vector2 | relativeSize, |
bool | resizeChildren = true |
||
) |
Definition at line 575 of file RectTransform.cs.
void Barotrauma.RectTransform.ReverseChildren | ( | ) |
Definition at line 680 of file RectTransform.cs.
void Barotrauma.RectTransform.ScaleOverTime | ( | Point | targetSize, |
float | duration | ||
) |
Definition at line 749 of file RectTransform.cs.
void Barotrauma.RectTransform.SetAsFirstChild | ( | ) |
Definition at line 696 of file RectTransform.cs.
void Barotrauma.RectTransform.SetAsLastChild | ( | ) |
Definition at line 687 of file RectTransform.cs.
Definition at line 558 of file RectTransform.cs.
void Barotrauma.RectTransform.SortChildren | ( | Comparison< RectTransform > | comparison | ) |
Definition at line 673 of file RectTransform.cs.
void Barotrauma.RectTransform.Translate | ( | Point | translation | ) |
Manipulates ScreenSpaceOffset. If you want to manipulate some other offset, access the property setters directly.
Definition at line 609 of file RectTransform.cs.
|
protected |
Definition at line 61 of file RectTransform.cs.
|
static |
Applied to all RectTransforms. The elements are not automatically resized, if the global scale changes. You have to manually call RecalculateScale() for all elements after changing the global scale. This is because there is currently no easy way to inform all the elements without having a reference to them. Having a reference (static list, or event) is problematic, because deconstructing the elements is not handled manually. This means that the uncleared references would bloat the memory. We could recalculate the scale each time it's needed, but in that case the calculation would need to be very lightweight and garbage free, which it currently is not.
Definition at line 147 of file RectTransform.cs.
|
static |
Definition at line 97 of file RectTransform.cs.
|
getset |
Absolute in pixels but relative to the anchor point. Calculated away from the anchor point, like a padding. Use RelativeOffset to set an amount relative to the parent size.
Definition at line 187 of file RectTransform.cs.
|
getset |
Does not automatically calculate children. Note also that if you change the anchor point with this property, the pivot does not automatically match the anchor. You can use SetPosition to change everything automatically or MatchPivotToAnchor to match the pivot to anchor.
Definition at line 290 of file RectTransform.cs.
|
get |
Screen space point in pixels.
Definition at line 219 of file RectTransform.cs.
|
get |
Definition at line 739 of file RectTransform.cs.
|
get |
Definition at line 62 of file RectTransform.cs.
|
get |
Definition at line 64 of file RectTransform.cs.
|
getset |
Should be assigned only by GUIComponent. Note that RectTransform is created first and the GUIComponent after that. This means the GUIComponent is not set before the GUIComponent is initialized.
Definition at line 39 of file RectTransform.cs.
|
get |
Definition at line 325 of file RectTransform.cs.
|
getset |
If false, the element will resize if the parent is resized (with the children). If true, the element will resize only when explicitly resized. Note that scaling always affects the elements.
Definition at line 507 of file RectTransform.cs.
|
get |
Definition at line 314 of file RectTransform.cs.
|
getset |
Definition at line 150 of file RectTransform.cs.
|
getset |
Max size in pixels. Does not affect scaling.
Definition at line 104 of file RectTransform.cs.
|
getset |
Min size in pixels. Does not affect scaling.
Definition at line 86 of file RectTransform.cs.
|
getprotected |
Definition at line 263 of file RectTransform.cs.
|
getprotected |
Definition at line 262 of file RectTransform.cs.
|
getprotected |
Definition at line 264 of file RectTransform.cs.
|
getprotected |
Definition at line 260 of file RectTransform.cs.
|
getset |
Size before scale multiplications.
Definition at line 119 of file RectTransform.cs.
|
getprotected |
Definition at line 232 of file RectTransform.cs.
|
getprotected |
Definition at line 261 of file RectTransform.cs.
|
getset |
Definition at line 42 of file RectTransform.cs.
|
get |
Definition at line 259 of file RectTransform.cs.
|
getset |
Does not automatically calculate children. Note also that if you change the pivot point with this property, the pivot does not automatically match the anchor. You can use SetPosition to change everything automatcally or MatchPivotToAnchor to match the pivot to anchor.
Definition at line 273 of file RectTransform.cs.
|
get |
Calculated from the selected pivot. In pixels.
Definition at line 215 of file RectTransform.cs.
|
get |
Definition at line 247 of file RectTransform.cs.
|
getset |
Defined as portions of the parent size. Also the direction of the offset is relative, calculated away from the anchor point.
Definition at line 171 of file RectTransform.cs.
|
getset |
Relative to the parent rect.
Definition at line 70 of file RectTransform.cs.
|
get |
Definition at line 162 of file RectTransform.cs.
|
getset |
Definition at line 302 of file RectTransform.cs.
|
get |
Size after scale multiplications.
Definition at line 135 of file RectTransform.cs.
|
getset |
Screen space offset. From top left corner. In pixels.
Definition at line 201 of file RectTransform.cs.
|
get |
Definition at line 221 of file RectTransform.cs.
|
getprotected |
Definition at line 265 of file RectTransform.cs.
Action<RectTransform> Barotrauma.RectTransform.ChildrenChanged |
The element provided as the argument is the changed child. It may be new in the hierarchy or just repositioned.
Definition at line 342 of file RectTransform.cs.
Action<RectTransform> Barotrauma.RectTransform.ParentChanged |
Definition at line 338 of file RectTransform.cs.
Action Barotrauma.RectTransform.ScaleChanged |
Definition at line 343 of file RectTransform.cs.
Action Barotrauma.RectTransform.SizeChanged |
Definition at line 344 of file RectTransform.cs.