Class UIHierarchyNode
Hierarchical wrapper that can contain existing UI elements and provide
parent-child relationships for the PGPSCN system.
Inheritance
UIHierarchyNode
Assembly: PopcorningGuineaPig.Engine.dll
Syntax
public class UIHierarchyNode
Properties
|
Edit this page
View Source
Children
Declaration
public List<UIHierarchyNode> Children { get; }
Property Value
|
Edit this page
View Source
Id
Declaration
public string Id { get; set; }
Property Value
|
Edit this page
View Source
IsEffectivelyVisible
Gets the effective visibility (this element and all parents must be visible)
Declaration
public bool IsEffectivelyVisible { get; }
Property Value
|
Edit this page
View Source
LocalPosition
Declaration
public Vector2 LocalPosition { get; set; }
Property Value
|
Edit this page
View Source
Parent
Declaration
public UIHierarchyNode? Parent { get; set; }
Property Value
|
Edit this page
View Source
Size
Declaration
public Vector2 Size { get; set; }
Property Value
|
Edit this page
View Source
UIElement
Declaration
public object? UIElement { get; set; }
Property Value
|
Edit this page
View Source
Visible
Declaration
public bool Visible { get; set; }
Property Value
|
Edit this page
View Source
WorldBounds
Gets the world bounds rectangle for this element
Declaration
public Rectangle WorldBounds { get; }
Property Value
| Type |
Description |
| Rectangle |
|
|
Edit this page
View Source
WorldPosition
Gets the world position by combining this element's local position with all parent positions
Declaration
public Vector2 WorldPosition { get; }
Property Value
|
Edit this page
View Source
ZIndex
Declaration
public int ZIndex { get; set; }
Property Value
Methods
|
Edit this page
View Source
AddChild(UIHierarchyNode)
Adds a child element to this element
Declaration
public virtual void AddChild(UIHierarchyNode child)
Parameters
|
Edit this page
View Source
ContainsPoint(Vector2)
Checks if a world point is within this element's bounds
Declaration
public bool ContainsPoint(Vector2 worldPoint)
Parameters
| Type |
Name |
Description |
| Vector2 |
worldPoint |
|
Returns
|
Edit this page
View Source
Draw()
Renders this element and all children
Declaration
public virtual void Draw()
|
Edit this page
View Source
FindElementAt(Vector2)
Finds the deepest child element that contains the given world point
Declaration
public UIHierarchyNode? FindElementAt(Vector2 worldPoint)
Parameters
| Type |
Name |
Description |
| Vector2 |
worldPoint |
|
Returns
|
Edit this page
View Source
GetAllChildren()
Gets all child elements recursively, sorted by Z-index
Declaration
public IEnumerable<UIHierarchyNode> GetAllChildren()
Returns
|
Edit this page
View Source
GetPathToRoot()
Gets the path from this element to the root parent
Declaration
public List<UIHierarchyNode> GetPathToRoot()
Returns
|
Edit this page
View Source
LocalToWorld(Vector2)
Converts a local coordinate to world coordinate
Declaration
public Vector2 LocalToWorld(Vector2 localPoint)
Parameters
| Type |
Name |
Description |
| Vector2 |
localPoint |
|
Returns
|
Edit this page
View Source
OnParentChanged()
Called when this element's parent changes
Declaration
protected virtual void OnParentChanged()
|
Edit this page
View Source
RemoveChild(UIHierarchyNode)
Removes a child element from this element
Declaration
public virtual void RemoveChild(UIHierarchyNode child)
Parameters
|
Edit this page
View Source
SetLocalPosition(Vector2)
Sets the local position of this element and updates the underlying UI element
Declaration
public virtual void SetLocalPosition(Vector2 position)
Parameters
| Type |
Name |
Description |
| Vector2 |
position |
|
|
Edit this page
View Source
SetSize(Vector2)
Sets the size of this element
Declaration
public virtual void SetSize(Vector2 size)
Parameters
|
Edit this page
View Source
SetVisible(bool, bool)
Sets the visibility of this element and optionally all children
Declaration
public virtual void SetVisible(bool visible, bool recursive = false)
Parameters
| Type |
Name |
Description |
| bool |
visible |
|
| bool |
recursive |
|
|
Edit this page
View Source
Update(double)
Updates this element and all children
Declaration
public virtual void Update(double deltaTime)
Parameters
| Type |
Name |
Description |
| double |
deltaTime |
|
|
Edit this page
View Source
UpdateUIElementPosition()
Updates the position of the underlying UI element to match the world position
Declaration
public void UpdateUIElementPosition()
|
Edit this page
View Source
WorldToLocal(Vector2)
Converts a world coordinate to local coordinate relative to this element
Declaration
public Vector2 WorldToLocal(Vector2 worldPoint)
Parameters
| Type |
Name |
Description |
| Vector2 |
worldPoint |
|
Returns