Skip to content

Game.UI.Widgets.INamed

Assembly:
Game (or Assembly-CSharp — check your build/assembly names)

Namespace:
Game.UI.Widgets

Type:
Interface

Base:
None (interface)

Summary:
Interface for UI widgets that exposes a localized display name and a localized description. Implement this interface on any widget or UI component that needs to present a human-readable, localizable name and description to the player (for tooltips, lists, inspectors, etc.). The properties use the LocalizedString type from Game.UI.Localization so values should be provided as localization keys/objects rather than hard-coded text where possible.


Fields

  • None declared in this interface.
    The interface only defines properties; implementations may have backing fields as needed. {{ Implementers should store LocalizedString values in private fields or auto-properties depending on usage. }}

Properties

  • LocalizedString displayName { get; set; }
    Localized display name for the widget. Intended to be shown in UI lists, headers, tooltips, or any place where a short name is required. Provide a LocalizedString referencing your localization key or resource.

  • LocalizedString description { get; set; }
    Localized description for the widget. Intended for tooltips, detail panels, or any place where a longer explanatory text is required. Provide a LocalizedString referencing your localization key or resource.

Constructors

  • None (interfaces cannot declare constructors).
    Implementing types will provide constructors or initialization logic to populate the displayName and description properties.

Methods

  • None declared on the interface.
    Implementers may expose additional methods as needed, for example to refresh localization when language changes or to format the strings dynamically.

Usage Example

using Game.UI.Localization;
using Game.UI.Widgets;

public class MyWidget : INamed
{
    // Backing auto-properties satisfy the interface
    public LocalizedString displayName { get; set; }
    public LocalizedString description { get; set; }

    public MyWidget()
    {
        // Assume LocalizedString can be constructed with a localization key.
        // Replace with actual LocalizedString API as appropriate.
        displayName = new LocalizedString("widgets.mywidget.name");
        description = new LocalizedString("widgets.mywidget.description");
    }

    // Optionally refresh or update localized values when language changes
    public void RefreshLocalization()
    {
        // e.g. displayName = Localizer.Get("widgets.mywidget.name");
        // Implementation depends on the project's localization API.
    }
}

Notes and tips: - Ensure the localization keys used (e.g. "widgets.mywidget.name") are present in the game's/mod's localization files so the LocalizedString resolves correctly. - LocalizedString API details (constructors, factory methods, formatting) are defined in Game.UI.Localization — consult that type for available ways to create/format localized entries. - Use this interface to standardize how UI elements expose name/description metadata for tooling, inspectors, or runtime UI code.