Skip to Content

View

GnosisUIElementView is a display element (elementId = "View") used as a logical view root/container.

Runtime parameters

In addition to built-in element parameters, GnosisUIElementView supports:

  • viewId (string)
  • defaultInTransitionId (string)
  • defaultOutTransitionId (string)
  • defaultInDuration (float)
  • defaultOutDuration (float)
  • defaultInDelay (float)
  • defaultOutDelay (float)

Example — create a view container

GameUI.CreateView.Example.cs
private GnosisFunctionResult CreateInventoryViewRoot() { if (Context?.Store == null || Context.CallService == null) return GnosisFunctionResult.Fail("No context"); var payload = GnosisNode.CreateObject(Context.Store); payload.Set("elementId", "View"); payload.Set("parentId", "ui"); var parameters = GnosisNode.CreateObject(Context.Store); parameters.Set("name", "InventoryView"); parameters.Set("viewId", "game.panel.inventory"); parameters.Set("defaultInTransitionId", "scalefade"); parameters.Set("defaultOutTransitionId", "scalefade"); parameters.Set("defaultInDuration", 0.2f); parameters.Set("defaultOutDuration", 0.2f); parameters.Set("defaultInDelay", 0f); parameters.Set("defaultOutDelay", 0f); payload.Set("parameters", parameters); return CallService("GameUI", "CreateElement", payload); }

Example — JSON payload shape

{ "service": "GameUI", "function": "CreateElement", "parameters": { "elementId": "View", "parentId": "ui", "parameters": { "name": "InventoryView", "viewId": "game.panel.inventory", "defaultInTransitionId": "scalefade", "defaultOutTransitionId": "scalefade", "defaultInDuration": 0.2, "defaultOutDuration": 0.2, "defaultInDelay": 0.0, "defaultOutDelay": 0.0, "anchorMin": { "x": 0.0, "y": 0.0 }, "anchorMax": { "x": 1.0, "y": 1.0 }, "sizeDelta": { "x": 0.0, "y": 0.0 }, "anchoredPosition": { "x": 0.0, "y": 0.0 } } } }

This is the same runtime payload concept as the C# example, represented as JSON-like data for tooling/mod pipelines.

Example — inspect schema via DescribeUIElement

GameUI.DescribeView.Example.cs
private GnosisFunctionResult DescribeViewElement() { if (Context?.Store == null || Context.CallService == null) return GnosisFunctionResult.Fail("No context"); var payload = GnosisNode.CreateObject(Context.Store); payload.Set("elementId", "View"); return CallService("GameUI", "DescribeUIElement", payload); }
Last updated on