Skip to content

Game.UI.Widgets.ListOperations

Assembly: Assembly-CSharp
Namespace: Game.UI.Widgets

Type: enum

Base: System.Enum

Summary:
Flag-style enumeration used by UI list widgets to represent one or more permitted/requested operations on a list (add element, clear, move items, duplicate, delete). Because the enum is marked with [Flags], values are intended to be combined with bitwise operations. Note: in the provided definition Clear and MoveUp share the same underlying value (2), causing an ambiguous overlap; treat that as either an intentional alias or a likely bug and be cautious when testing for those individual operations.


Fields

  • None = 0
    Represents no operation.

  • AddElement = 1
    Bit 0 — request/allow adding a new element to the list.

  • Clear = 2
    Bit 1 — request/allow clearing the list. Shares the same value as MoveUp in this enum definition; tests for this bit will be true for either meaning.

  • MoveUp = 2
    Bit 1 — request/allow moving a selected item up. Has the same value as Clear (ambiguous).

  • MoveDown = 4
    Bit 2 — request/allow moving a selected item down.

  • Duplicate = 8
    Bit 3 — request/allow duplicating a selected item.

  • Delete = 0x10
    Bit 4 (16) — request/allow deleting a selected item.

Properties

  • None (this is a plain enum).

Constructors

  • None (enums have implicit value constructors provided by the runtime).

Methods

  • None defined on this enum type. Standard System.Enum static/instance helper methods (Enum.TryParse, ToString, HasFlag (extension), etc.) apply.

Usage Example

// Combine operations
ListOperations ops = ListOperations.AddElement | ListOperations.Delete;

// Check for a specific operation
if ((ops & ListOperations.Delete) != 0)
{
    // handle delete
}

// Using HasFlag (note: slightly slower than bitwise check)
if (ops.HasFlag(ListOperations.AddElement))
{
    // handle add
}

// Be careful: Clear and MoveUp are both 2 in this enum,
// so checking for one will also be true for the other.
if ((ops & ListOperations.MoveUp) != 0)
{
    // This will be true for either MoveUp or Clear (ambiguous)
}

// Toggle a flag
ops ^= ListOperations.Delete; // toggles the Delete bit

// Parse from string
if (Enum.TryParse<ListOperations>("AddElement,Duplicate", out var parsed))
{
    // parsed == ListOperations.AddElement | ListOperations.Duplicate
}

Notes: - Because of the duplicated value (Clear == MoveUp == 2), code that must distinguish between "clear" and "move up" cannot rely on the bit value alone. Verify whether this duplication is intended in the game version you are targeting; if it's a bug, consider working around it at higher logic level (e.g., use context or separate signals) or report/patch as appropriate.