Scripting API
Scripting API
GameUi
Class in Abyss.Core, from Abyss.Core.
A game's interface as it plays: the documents its UI Documents show, made from their files, each given the class the build made of it, and what their elements do, heard; see World.Ui.
public sealed class GameUiRemarks
Shown as the game plays. Each frame of the game, between frames, every UI Document in the world is looked at: a document it names that is not shown yet is loaded as a prefab is and shown apart from the scene, drawn by the camera the engine names; one shown for a UI Document that names another, or that is gone, goes. What the elements did since the frame before is heard then too, in the order it happened: each document's class's handlers are called, and UiElement.WasClicked says so to whatever asks.
Gone as the game stops, every document's class told it is hidden; the editor puts the world back as it was before Play, documents and all.
A template placed in a document as its file has it is given its own class too, made before the document's, which finds it by the element it is (UiView's Template): what its elements do is heard by it, the identities its own file gave them apart from those of every other instance of it. One whose document has no class is the document's elements as they are.
Properties
World
public World World { get; }The world it is the interface of.
ShownCount
public int ShownCount { get; }How many documents are shown.
Touch
public bool Touch { get; set; }Whether the game is on a touch screen — a phone, a tablet, a browser on one: every document's top has the class touch while it is, so a sheet can make what a finger presses bigger, .touch .button { padding: 16px; }, and a dropdown set to open as the screen suits opens its list in the middle of the screen. The platform's at first; set, it is the game's say.
Pointer
public Vector2? Pointer { get; }Where the pointer is over the game's picture, in its documents' units — the reference resolution's — so an element moved there (UiElement.MoveTo) is under it; null while the mouse is not the game's or is off its picture.
Engaged
public ulong Engaged { get; }The panel in the world keys and a gamepad are in, as its entity; zero for none. See GameUi.Engage.
PanelInFront
public ulong PanelInFront { get; }The panel in the world in front of the player, as its entity, zero for none: the one the middle of the screen looks at, or else the one seen whose middle is drawn nearest it, facing the camera and not hidden. The one Submit engages, and one a game can say it can be used.
Methods
Mirror
public void Mirror(ulong entity, bool mirrored = true)Mirrors interface the game built in code — a node it spawned and everything under it — while the game is shown right to left, as a document is: laid out right to left, its left and right position, margins and paddings changing places, its text aligned left aligned right; its borders and rounded corners stay as drawn. As the language reads left to right again each is given back, but what the game's code set on it since, which stays as it set it. A document is mirrored as it is, and needs none.
Parameters
entity: A node of the interface the game spawned.mirrored: Whether to mirror it; false to stop.
Exceptions
AbyssException: The entity is gone, or is no node of an interface.
Register
public void Register(AssetGuid document, Func<UiView> make)Says which class to make for the document of identity document as it is shown: what the build writes into a game for each of its documents.
Parameters
documentmake
Register<T>
public void Register<T>(AssetGuid document, Func<T> make) where T : UiViewSays which class to make for the document of identity document as it is shown, or as an instance of it is made under an element (UiElement.Add), by its type: what the build writes into a game for each of its documents. The document is loaded then, so an instance of it made as the game plays is shown at once.
Type parameters
T
Parameters
documentmake
ElementOf
public UiElement ElementOf(ulong entity)The element entity is, to be read and changed as a document's class reads and changes its own: one of a document's, found by a query or kept from before.
Parameters
entity
HasClassFor
public bool HasClassFor(AssetGuid document)Whether a class is made for the document of identity document as it is shown; see Register.
Parameters
document
Find<T>
public T? Find<T>() where T : UiViewThe class shown for the document T, where one is: the first, where several are.
Type parameters
T
Find<T>
public T? Find<T>(ulong owner) where T : UiViewThe class shown for the document T by the UI Document of the entity owner, or the document opened as owner; null where it shows another document, or none yet.
Type parameters
T
Parameters
owner
Open
public ulong Open(AssetGuid document, bool modal = false, int sortOrder = 0)Shows the document of identity document as the game plays, on an entity of its own, as a UI Document in a scene shows one: drawn by the game's last camera, above the documents of a lower sortOrder, and where modal, holding the game while it is shown — its input maps off but the UI map, focus kept in it, and Cancel its class's OnCancel. An inventory opened with a key, a pause menu. Shown from the next frame, its class's OnShown then; GameUi.Close takes it away.
Parameters
documentmodalsortOrder
Returns The entity that shows it.
Exceptions
AbyssException:AbyssStatus.InvalidUiRequestforAssetGuid.None.
Open<T>
public ulong Open<T>(bool modal = false, int sortOrder = 0) where T : UiViewShows the document whose class is T; see GameUi.Open.
Type parameters
T
Parameters
modalsortOrder
Exceptions
InvalidOperationException: No document's class isT: the build registers each document's.
Close
public void Close(ulong owner)Takes away a document GameUi.Open showed, by the entity it gave: the entity goes, and with it the document, its class hearing OnHidden. Nothing for an entity that is gone already.
Parameters
owner
Engage
public bool Engage(ulong panel)Engages the panel in the world panel, as Submit with nothing focused engages the one in front: its document's first element given focus — the one ticked Focus First, or else its first that can have it — the UI map on and the game's others off, and keys and a gamepad kept in it until Cancel or GameUi.Release lets go of it. What a game does as its player uses what they walked up to, by an action of its own.
Parameters
panel
Returns Whether it is engaged: not where it is no panel showing a document with an element that can have focus, nor while a modal document is shown.
Release
public bool Release()Lets go of the panel engaged, as Cancel does but for its document hearing it: focus given back to what had it before, and the game's maps as they were. Whether one was engaged.
ShowAgain
public void ShowAgain()Shows every document afresh, from its file as it is now: each taken away, its class told it is hidden, and built again in the next frame. What the editor does as a document's file is written while the game is not playing, so its preview is what was saved.
ShowAgain
public void ShowAgain(AssetGuid document)Shows every document of identity document afresh, from its file as it is now, the others as they are: each taken away, its class told it is hidden, and built again in the next frame — its class made again and told it is shown, as the game plays. What the editor does as a document's file is written, while the game plays or not; what was typed into it, or its class kept, is gone.
Parameters
document
