Skip to content

Game.UI.Widgets.Breadcrumbs

Assembly:
(inferred) Game UI assembly — exact assembly name not provided in source file

Namespace: Game.UI.Widgets

Type: public class Breadcrumbs : Widget, IEnumerable

Base: Widget (implements IEnumerable

Summary:
Breadcrumbs is a lightweight container widget that holds an ordered list of breadcrumb label widgets. It stores child widgets as a List, exposes the count and child collections, provides fluent Add/Remove helpers (WithLabel / WithOutLabel), and implements IEnumerable


Fields

  • private List<IWidget> m_Labels = new List<IWidget>()
    Internal storage for child breadcrumb widgets. This list contains IWidget instances (typically Label objects). The list is returned directly by the children and visibleChildren properties, so callers should treat it as the live backing collection.

Properties

  • public int labelCount => m_Labels.Count
    Number of labels currently in the breadcrumbs (convenience getter).

  • public IList<IWidget> children => m_Labels
    Exposes the internal list of children as an IList. Because this returns the backing list, modifying this collection (Add/Remove/Clear) will directly change the Breadcrumbs contents.

  • public override IList<IWidget> visibleChildren => m_Labels
    Overrides the visibleChildren property from the Widget base class to return the same backing list. Visibility, layout and rendering behavior depend on the Label widgets themselves and any layout logic in the parent/widget system.

Constructors

  • public Breadcrumbs()
    No explicit constructor is declared in the source; the default parameterless constructor initializes the instance and the field m_Labels is initialized inline to an empty List. Use the fluent WithLabel method to populate the breadcrumbs.

Methods

  • public Breadcrumbs WithLabel(Label label)
    Adds the provided Label to the internal list and returns the same Breadcrumbs instance (fluent API). Useful for chaining calls when constructing UI.

  • public Breadcrumbs WithOutLabel(Label label)
    Removes the provided Label from the internal list (if present) and returns the same Breadcrumbs instance. Removing a label that's not present has no effect.

  • public IEnumerator<Label> GetEnumerator()
    Returns a typed enumerator over the current children that are of type Label. Internally uses LINQ's OfType

  • IEnumerator IEnumerable.GetEnumerator()
    Non-generic IEnumerable implementation that delegates to the generic GetEnumerator().

Notes: - The GetEnumerator implementation filters by Label type; if the backing list contains non-Label IWidget instances, they will be skipped during typed enumeration. - The class does not perform defensive copies when exposing the backing list. Consumers should avoid modifying the children list concurrently from multiple threads (no built-in thread-safety).

Usage Example

// Build a breadcrumbs widget fluently and iterate over labels
var breadcrumbs = new Breadcrumbs()
    .WithLabel(new Label("Home"))
    .WithLabel(new Label("Map"))
    .WithLabel(new Label("Districts"));

// Iterate typed labels
foreach (var label in breadcrumbs)
{
    label.TextColor = Color.white;
}

// Remove a label
breadcrumbs.WithOutLabel(someLabel);

// Access children directly (live backing list)
var children = breadcrumbs.children;
children.Add(new Label("New"));