namespace Uigenx.Actions
{
/// One UI intent travelling from a screen to game code.
public readonly struct UgxAction
{
public readonly string Name;
public readonly UgxActionPayload Payload;
/// Screen key the action came from, null when raised by game code.
public readonly string Screen;
/// Studio node id of the element that raised it, null when raised by game code.
public readonly string NodeId;
public UgxAction(string name, UgxActionPayload payload = default, string screen = null, string nodeId = null)
{
Name = name;
Payload = payload;
Screen = screen;
NodeId = nodeId;
}
public override string ToString()
=> Payload.IsEmpty ? Name : Name + " (" + Payload.Count + " values)";
}
/// Actions the runtime itself raises. Screen code may listen but must not emit them.
public static class UgxSystemActions
{
public const string ModalOpened = "system.modal-opened";
public const string ModalClosed = "system.modal-closed";
public const string ScreenShown = "system.screen-shown";
public const string ScreenHidden = "system.screen-hidden";
/// Payload key carrying the screen key for every system action above.
public const string ScreenKey = "screen";
/// Payload key carrying the layer name for screen and modal actions.
public const string LayerKey = "layer";
}
}