swiftlys2/docs/api/ai/
API Reference › Menu

MenuKeys

Class
Namespace: SwiftlyS2.Shared.Menu · Assembly: SwiftlyS2.CS2.dll
public static class MenuKeys
Inherits object

Parsing and formatting helpers for MenuKey.

View source

Properties

Names

All key names accepted by MenuKey%40).

public static IReadOnlyCollection<string> Names { get; }

Methods

Describe(MenuKey)

Produces a human readable label for a key set, suitable for a menu footer.

public static string Describe(MenuKey key)
Parameters
Returns
An upper case label such as "E" or "SHIFT/F" .

FromKeyKind(KeyKind)

Converts an engine key event value into its MenuKey equivalent.

public static MenuKey FromKeyKind(KeyKind keyKind)
Parameters
  • keyKindKeyKindThe engine key value.
Returns
The matching key, or None when the value has no menu equivalent.

ParseAll(IEnumerable<string?>)

Parses a sequence of key names into a single combined MenuKey.

public static MenuKey ParseAll(IEnumerable<string?> names)
Parameters
Returns
The combined key set, or None when nothing was recognised.

TryParse(string?, out MenuKey)

Attempts to parse a single key name, such as "e" or "mouse1" .

public static bool TryParse(string? name, out MenuKey key)
Parameters
  • namestring?The key name. Case insensitive.
  • keyMenuKeyThe parsed key, or None when parsing fails.
Returns
true when the name was recognised.