Popcorning Guinea Pig
Search Results for

    Show / Hide Table of Contents

    Class UIElementBase

    Abstract base class for UI elements with hierarchical support

    Inheritance
    object
    UIElementBase
    Container
    GridContainer
    Image
    InteractiveUIElement
    Label
    Panel
    Implements
    IUIElement
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: PopcorningGuineaPig.Engine.UI
    Assembly: PopcorningGuineaPig.Engine.dll
    Syntax
    public abstract class UIElementBase : IUIElement

    Fields

    | Edit this page View Source

    _children

    Declaration
    protected readonly List<IUIElement> _children
    Field Value
    Type Description
    List<IUIElement>

    Properties

    | Edit this page View Source

    Children

    Declaration
    public IReadOnlyList<IUIElement> Children { get; }
    Property Value
    Type Description
    IReadOnlyList<IUIElement>
    | Edit this page View Source

    Id

    Declaration
    public string Id { get; set; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    Opacity

    Declaration
    public float Opacity { get; set; }
    Property Value
    Type Description
    float
    | Edit this page View Source

    Parent

    Declaration
    public IUIElement? Parent { get; set; }
    Property Value
    Type Description
    IUIElement
    | Edit this page View Source

    Position

    Declaration
    public Vector2 Position { get; set; }
    Property Value
    Type Description
    Vector2
    | Edit this page View Source

    Size

    Declaration
    public Vector2 Size { get; set; }
    Property Value
    Type Description
    Vector2
    | Edit this page View Source

    Tooltip

    Declaration
    protected string Tooltip { get; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    TooltipFallbackText

    Declaration
    protected string TooltipFallbackText { get; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    TooltipLocalizationKey

    Declaration
    protected string? TooltipLocalizationKey { get; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    Visible

    Declaration
    public bool Visible { get; set; }
    Property Value
    Type Description
    bool

    Methods

    | Edit this page View Source

    AddChild(IUIElement)

    Declaration
    public virtual void AddChild(IUIElement child)
    Parameters
    Type Name Description
    IUIElement child
    | Edit this page View Source

    Draw()

    Draws this element and all children

    Declaration
    public virtual void Draw()
    | Edit this page View Source

    DrawSelf()

    Override to implement element-specific drawing logic

    Declaration
    protected abstract void DrawSelf()
    | Edit this page View Source

    GetLocalPosition()

    Gets the local position relative to the parent

    Declaration
    public virtual Vector2 GetLocalPosition()
    Returns
    Type Description
    Vector2
    | Edit this page View Source

    GetWorldPosition()

    Gets the world position by combining this element's position with all parent positions

    Declaration
    public virtual Vector2 GetWorldPosition()
    Returns
    Type Description
    Vector2
    | Edit this page View Source

    IsMouseOver()

    Checks if the mouse is currently over this UI element

    Declaration
    public virtual bool IsMouseOver()
    Returns
    Type Description
    bool

    True if mouse is over this element

    | Edit this page View Source

    RemoveChild(IUIElement)

    Declaration
    public virtual void RemoveChild(IUIElement child)
    Parameters
    Type Name Description
    IUIElement child
    | Edit this page View Source

    RemoveFromParent()

    Declaration
    public virtual void RemoveFromParent()
    | Edit this page View Source

    SetLocalizationService(ILocalizationService?)

    Sets the localization service to use for automatic font management. Override this method in derived classes that display text to implement localization support. Default implementation does nothing (for non-text UI elements).

    Declaration
    public virtual void SetLocalizationService(ILocalizationService? localizationService)
    Parameters
    Type Name Description
    ILocalizationService localizationService

    The localization service to use, or null to disable

    | Edit this page View Source

    SetTooltip(string)

    Sets the tooltip text for this UI element

    Declaration
    public virtual void SetTooltip(string tooltipText)
    Parameters
    Type Name Description
    string tooltipText

    The tooltip text to display on hover

    | Edit this page View Source

    SetTooltipLocalizationKey(string, string?)

    Sets the tooltip using a localization key for automatic updates when language changes.

    Declaration
    public virtual void SetTooltipLocalizationKey(string localizationKey, string? fallbackText = null)
    Parameters
    Type Name Description
    string localizationKey

    The localization key (e.g., "COMPLETE_TUTORIAL")

    string fallbackText

    Text to use if translation fails

    | Edit this page View Source

    SetTooltipText(string)

    Protected method for derived classes to update the tooltip text.

    Declaration
    protected void SetTooltipText(string tooltipText)
    Parameters
    Type Name Description
    string tooltipText

    The new tooltip text

    | Edit this page View Source

    Update()

    Updates this element and all children

    Declaration
    public virtual void Update()
    | Edit this page View Source

    UpdateSelf()

    Override to implement element-specific update logic

    Declaration
    protected virtual void UpdateSelf()
    | Edit this page View Source

    UpdateTooltipFromLocalization()

    Updates the tooltip text from the localization service using the stored localization key. This method should be called by derived classes when they receive localization service updates.

    Declaration
    protected virtual void UpdateTooltipFromLocalization()

    Implements

    IUIElement
    • Edit this page
    • View Source
    In this article
    Back to top © 2024 Popcorning Guinea Pig Game Engine. A custom C# game engine for indie developers.