Table of Contents

Class PrismaView

Namespace
SkyrimForge.PrismaUi
Assembly
SkyrimForge.PrismaUi.dll

A Prisma UI view: a page drawn over the game.

public sealed class PrismaView
Inheritance
PrismaView
Inherited Members

Remarks

After Destroy(), members have no effect.

Properties

HasFocus

Whether this view has input focus.

public bool HasFocus { get; }

Property Value

bool

IsHidden

Whether this view is hidden.

public bool IsHidden { get; }

Property Value

bool

IsInspectorVisible

Whether the inspector is visible. Call CreateInspectorView() first.

public bool IsInspectorVisible { get; set; }

Property Value

bool

IsValid

Whether Prisma UI still has this view.

public bool IsValid { get; }

Property Value

bool

OnConsoleMessage

Raised for each message the page writes to the console. Warnings and errors are logged regardless.

public IGameEvent<ConsoleMessageEventArgs> OnConsoleMessage { get; }

Property Value

IGameEvent<ConsoleMessageEventArgs>

OnDomReady

Raised once the page's DOM is built. A later subscriber receives nothing.

public IGameEvent<DomReadyEventArgs> OnDomReady { get; }

Property Value

IGameEvent<DomReadyEventArgs>

Order

This view's place in the draw order. Higher draws over lower.

public int Order { get; set; }

Property Value

int

ScrollingPixelSize

Pixels scrolled per wheel notch.

public int ScrollingPixelSize { get; set; }

Property Value

int

Methods

CreateInspectorView()

Creates the inspector, which requires the Ultralight SDK's inspector folder at Data\PrismaUI\inspector.

public void CreateInspectorView()

Destroy()

Destroys the view, blocking until Prisma UI has released it. A view otherwise survives a save load.

public void Destroy()

Focus(bool, bool)

Gives this view input focus.

public bool Focus(bool pauseGame = false, bool disableFocusMenu = false)

Parameters

pauseGame bool
disableFocusMenu bool

Returns

bool

false if the view is gone. The work is queued, so HasFocus can still be false on return.

Remarks

A hidden view cannot take focus. Outside Skyrim VR, this disables the player's controls until Unfocus(), and pauseGame pauses the game. disableFocusMenu omits Prisma UI's focus menu, which draws the cursor. Outside Skyrim VR, typing into a page requires the Media Keys Fix mod.

Hide()

Stops drawing this view without destroying it.

public void Hide()

InteropCall(string, string)

Calls a function the page declares, passing one string.

public void InteropCall(string functionName, string argument)

Parameters

functionName string
argument string

Invoke(string)

Evaluates JavaScript and returns the result as text, or an empty string if the script throws or does not parse.

public Task<string> Invoke(string script)

Parameters

script string

Returns

Task<string>

Remarks

Await this. Blocking on it on the game's thread or in queued work can deadlock, because the result arrives as queued work.

RegisterJSListener(string, Action<string>)

Registers a global function the page can call. Registering a name again replaces its handler.

public ISubscription? RegisterJSListener(string functionName, Action<string> handler)

Parameters

functionName string
handler Action<string>

Returns

ISubscription

A subscription that stops the handler, or null if the view is gone or no slot is free.

Remarks

Prisma UI binds the name after the page finishes loading, which can follow OnDomReady.

SetInspectorBounds(float, float, uint, uint)

Positions and sizes the inspector in screen pixels.

public void SetInspectorBounds(float topLeftX, float topLeftY, uint width, uint height)

Parameters

topLeftX float
topLeftY float
width uint
height uint

Show()

Draws this view again.

public void Show()

Unfocus()

Removes input focus and restores the player's controls.

public void Unfocus()