Skip to content

Game.Input.DisplayNameOverride

Assembly:
Assembly-CSharp

Namespace: Game.Input

Type: class

Base: System.IDisposable

Summary: Represents a per-source override for the display name (and related display settings) of a UI input action represented by ProxyAction. Instances can supply an alternate display name, a priority (used to pick which override is shown), and a transform. Overrides are tracked by the associated ProxyAction while the instance exists; when activated or modified they tell the ProxyAction to refresh its displayed text. Dispose removes the override from the action's tracking list.


Fields

  • private readonly ProxyAction m_Action Holds the ProxyAction instance this override applies to. The override registers itself on this action's m_DisplayOverrides list in the constructor and removes itself on Dispose.

  • private readonly string m_Source Identifies the source/name of this override (the provider identifier).

  • private bool m_Disposed Tracks whether Dispose() has been called. When true the instance is no longer active in the ProxyAction.

  • private int m_Priority Numeric priority for this override. Standard constants: kDisabledPriority (-1) and kToolTipPriority (0). Higher priority overrides will be preferred when ProxyAction selects which override to show.

  • private UIBaseInputAction.Transform m_Transform Optional transform (e.g., capitalization/formatting) to apply to the display string.

  • private string m_DisplayName The override text to display for the action. May be null to indicate no explicit override text.

  • private bool m_Active Whether this override is currently active. An override only affects display when active is true and priority != kDisabledPriority.

Properties

  • public string source => m_Source Read-only. Returns the source identifier supplied in the constructor.

  • public bool isDisposed => m_Disposed Read-only. True after Dispose() has been called.

  • public bool active Get/set. When read, returns true only if m_Active is true and priority is not kDisabledPriority (-1). Setting toggles the active flag; when changed the ProxyAction is notified (m_Action.UpdateDisplay()) so the displayed name can be recalculated.

  • public string displayName Get/set. The override text. When set to a different value, if the override is active the ProxyAction is notified to update the display.

  • public int priority Get/set. The override priority. When changed, if the override is active the ProxyAction is notified to update the display. Use kDisabledPriority (-1) to effectively disable the override.

  • public UIBaseInputAction.Transform transform Get/set. The transform applied to the display text. When changed, if the override is active the ProxyAction is notified to update the display.

Constructors

  • public DisplayNameOverride(string overrideSource, ProxyAction action, string displayName = null, int priority = -1, UIBaseInputAction.Transform transform = UIBaseInputAction.Transform.None) Creates a new override for the given ProxyAction. Parameters:
  • overrideSource: identifier of the override source.
  • action: the ProxyAction to attach to (required; ArgumentNullException if null).
  • displayName: optional override string (default null).
  • priority: override priority (default -1, i.e., disabled).
  • transform: display transform to apply (default None). The constructor registers the new instance in action.m_DisplayOverrides so the action can consider it when determining what to show.

Methods

  • public bool Equals(DisplayNameOverride other) Compares this override to another by value. The implementation considers priority and displayName; if either differs the overrides are considered not equal. Note: equality does not consider source, action reference, transform, active flag, or disposed state.

  • public void Dispose() Implements IDisposable. Marks the object as disposed and removes it from the associated ProxyAction's m_DisplayOverrides list so it no longer contributes to the action's display selection.

Usage Example

// Example usage of DisplayNameOverride with a ProxyAction instance.
ProxyAction action = /* obtain proxy action */;
var nameOverride = new DisplayNameOverride(
    overrideSource: "MyMod.Tooltip",
    action: action,
    displayName: "My Mod Tool",
    priority: DisplayNameOverride.kToolTipPriority,
    transform: UIBaseInputAction.Transform.None);

// Activate override so it participates in display selection:
nameOverride.active = true;

// Later, update the displayed text:
nameOverride.displayName = "My Mod Tool (v2)";

// If you want to temporarily disable without disposing:
nameOverride.priority = DisplayNameOverride.kDisabledPriority;

// When finished with the override (e.g., on mod unload), dispose it:
nameOverride.Dispose();