Interface ICustomMenuRegistrar
- Namespace
- SkyrimForge
- Assembly
- SkyrimForge.dll
Registers a menu of the plugin's own, which the game then constructs, shows, and drives as it does its own.
public interface ICustomMenuRegistrar
Remarks
menus.Register("SkyrimForge Menu", message => message switch
{
UI_MESSAGE_TYPE.kShow => UI_MESSAGE_RESULTS.kHandled,
_ => UI_MESSAGE_RESULTS.kPassOn
});
queue.AddMessage("SkyrimForge Menu", UI_MESSAGE_TYPE.kShow);
A named movie is loaded through the game's own Scaleform manager,
and its contents are then reachable through UiMovie and ScaleformValue.
An exception from a handler is written to the log of the plugin that registered it.
Methods
Register(string, Func<UI_MESSAGE_TYPE, UI_MESSAGE_RESULTS>, string?, UI_MENU_FLAGS, sbyte, INPUT_CONTEXT_ID)
Registers a menu under name.
void Register(string name, Func<UI_MESSAGE_TYPE, UI_MESSAGE_RESULTS> handler, string? movieFile = null, UI_MENU_FLAGS flags = UI_MENU_FLAGS.kNone, sbyte depth = 3, UserEvents.INPUT_CONTEXT_IDS.INPUT_CONTEXT_ID context = INPUT_CONTEXT_ID.kMenuMode)
Parameters
namestringThe name that opens and closes the menu.
handlerFunc<UI_MESSAGE_TYPE, UI_MESSAGE_RESULTS>The handler for each message the game sends the menu. It runs where the game drives its interface, with the game stopped for it, so it may call the game.
Of the three results, only kIgnore changes what the game does: it stops whatever the message would have done, leaving a show unopened and a hide unclosed. kHandled and kPassOn both let a show open the menu and a hide close it.
The game sends a message it was answered kIgnore once and never again, so a handler that stops its own hide leaves the menu open until it queues another one itself. Waiting for a second registration leaves the menu on the stack for the rest of the session.
movieFilestringThe name of a Flash movie under Data/Interface without its extension, so that MyMenu loads Interface/MyMenu.swf. Null, or a name that loads no movie, gives a menu that draws nothing, which still goes on the stack and applies its input context.
flagsUI_MENU_FLAGSThe effects the menu has on the game while it is open (e.g., pauses, captures the cursor, etc.).
depthsbyteThe menu's rank against the others, higher being nearer the front. The game's HUD is 2, its console 12, and its cursor 13.
contextUserEvents.INPUT_CONTEXT_IDS.INPUT_CONTEXT_IDWhich control mapping is in force while the menu is open.
Exceptions
- ArgumentNullException
nameorhandlerisnull.- ArgumentException
nameis empty, or the game already registers a menu under it. A built-in menu cannot be replaced this way. Replace its virtual method table entries through ReplaceVirtualTableEntry(string, int, nint) instead.- InvalidOperationException
The game has no interface yet, or all 32 of the shim's menu registrations are in use.