This class holds global variables and methods for managing PowerUI. The most important ones are: UI.Start UI.Update UI.document
Static Public Member Functions | |
static string | LoadHTML (string resource) |
Gets the content of the given file from resources. More... | |
static void | CameraGotCreated (Camera camera) |
Used internally to fire the OnCameraCreated event. More... | |
static void | Start () |
Startup the UI. Now called internally, but can be called at the start of any scene using PowerUI. More... | |
static void | Start (bool nitroAot) |
Used internally - don't call this one. Startup the UI for use in the Editor with AOT Nitro. More... | |
static void | HideFromCamera (Camera camera) |
Used to hide the UI from the given camera if it's generated entirely at runtime. More... | |
static void | SetDepthResolution (float gaps) |
Sets how many world units are used between elements at different depths. Default is 0.05. More... | |
static Renderman | GetRenderer () |
Gets the renderer which renders this UI. More... | |
static void | OnLogMessage (string message) |
Called by wrench when it logs a message. More... | |
static void | SetGroupResolver (GroupResolve resolver) |
Sets the group resolver to use when resolving a group name from a variable that isn't found in the languages groups. E.g. &cdn.text; can be handled in custom ways here. More... | |
static void | SetCameraDistance (float distance) |
Sets the distance of the camera, essentially defining the amount of z-index available. More... | |
static float | GetCameraDistance () |
Gets the distance of the main UI camera. Essentially defines how much z-index space it has. More... | |
static void | SetFieldOfView (float fov) |
Sets the field of view of the UI camera. More... | |
static float | GetFieldOfView () |
Gets the field of view of the UI camera. More... | |
static void | ClearAll () |
Clears all content from the UI and all WorldUI's. Please note that it is safer to set innerHTML to a blank string for a particular UI than calling this. More... | |
static void | Destroy () |
Clears and entirely destroys the UI and WorldUI's. Calling this is not a requirement and can only be reversed by calling Start again. More... | |
static void | OnLanguageChange (string code) |
Called by Wrench when the language of the UI changes. This changes the language of all on screen . UI.Language. More... | |
static void | AddTextGroup (string text, string groupName) |
Adds a group of variables from the given xml string. Used to stream in languages at runtime. A group is used with &groupName.varName; More... | |
static void | OnVariableChange (string code) |
static LanguageSet[] | GetAllLanguages () |
Gets a list of all available languages for use with the UI. More... | |
static void | RequestLayout () |
Asks the renderer for a layout (Used internally). More... | |
static void | SetRate (int fps) |
Sets the update rate of the UI. More... | |
static bool | MouseOver (float x, float y) |
Returns true if the given x/y coordinate is over the UI. More... | |
static bool | HandleInput () |
Handles mouse and keyboard input. Call this from OnGUI. More... | |
static bool | InternalHandleInput () |
Handles mouse and keyboard input. Called from OnGUI internally. See HandleInput. More... | |
static void | RedrawNextUpdate () |
Prompts the UI to redraw on the next Update. You don't need to call this, however it can be useful in rare situations where you require the UI to bypass it's usual redraw rate (see SetRate) and refresh immediately. More... | |
static void | RedrawNow () |
In general you should never call this. It forces a full Update to occur right now; this can only be called from the main Unity thread. More... | |
static void | RequestFullLayout () |
Requests all UI's to update. This occurs when an atlas has been optimised. More... | |
static void | InternalUpdate () |
Updates the UI. Don't call this - PowerUI knows when it's needed; This is done from Start and WorldUI constructors. More... | |
Public Attributes | |
const int | DefaultRate =40 |
The default max update rate in fps. Note that input is decoupled from this. More... | |
Static Public Attributes | |
static int | Layer |
The PowerUI layer's index. Used to make sure the UI is not visible with other cameras. More... | |
static Element | content |
A custom content element. You can set this to whatever element you want for easy access. More... | |
static float | RedrawRate |
The time in seconds between redraws. UI.SetRate. More... | |
static Camera | GUICamera |
The unity camera that will render all UI elements. More... | |
static Document | document |
The main UI document. This is what you should use to add content to the UI. More... | |
static bool | HandledInput |
True if the UI consumed the current frames input event. More... | |
static GameObject | GUINode |
The gameobject which all UI elements are parented to. More... | |
static float | CameraDistance |
How much space should be given for elements. This distance essentially defines how much z-index is allowed. More... | |
static GameObject | CameraNode |
The gameobject that our UI.GUICamera is parented to. More... | |
static Transform | CameraTransform |
The transform of the UI.GUICamera. More... | |
static FullVariableSet | Variables |
This variable set is used when parsing the HTML. can be used to replace text with custom values; e.g. in localization or . More... | |
static WorldUI | LastWorldUI |
All world UI's are kept in a linked list for updates. This is the tail of the list. More... | |
static WorldUI | FirstWorldUI |
All world UI's are kept in a linked list for updates. This is the head of the list. More... | |
static int | CameraDepth =100 |
The default depth of the main camera. More... | |
static CameraPool | MainCameraPool |
A set of cameras available for use with the main UI. This is only ever used with inline cameras. More... | |
static Type | BaseCodeType =typeof(UICode) |
The type that all code derives from. Must be UICode or something that inherits UICode. More... | |
static GetSecurityDomain | OnGetSecurityDomain |
Called when a document wants the default security domain. Set with a custom method to provide your own. More... | |
static int | AtlasSize |
Properties | |
static ResolutionInfo | Resolution [get, set] |
The current UI resolution, used for pixel perfect clarity if you target both high and low resolution screens. Note that this should only be changed before you apply any HTML to your UI's. More... | |
static CameraMode | CameraMode [get, set] |
What sort of camera should PowerUI use to render the main UI? Perspective is the default. More... | |
static RenderMode | RenderMode [get, set] |
How the main UI renders images; either on an atlas or with them 'as is'. Default is Atlas. More... | |
static InputMode | InputMode [get, set] |
The mode PowerUI uses for recieving input. Physics mode is more intensive than Screen mode, however using physics mode means transformed elements receive input correctly. More... | |
static InputMode | WorldInputMode [get, set] |
The mode PowerUI uses for recieving input for WorldUI's. Physics mode is more intensive than Screen mode, however using physics mode means transformed elements receive input correctly. None by default. More... | |
static FilterMode | FilterMode [get, set] |
The image filter mode. More... | |
static FilterMode | TextFilterMode [get, set] |
Sets the text filter mode. Note: shared fonts will be affected in all other UI's. More... | |
static string | Language [get, set] |
Gets or sets the language code (e.g. "en") of the UI. This will internally update any onscreen variables for localization so you won't need to restart the game. Please refer to our guides on localization on the website for further help with this. More... | |
static string | Gender [get, set] |
Gets or sets the gender (boy, girl, either). This is used for localization where some text is better off being specific depending on what gender the player is - e.g. when using she/ he. More... | |
static NitroDomainManager | DefaultSecurityDomain [get] |
Gets the default security domain for Nitro scripts. More... | |
static bool | Log [get, set] |
Gets/sets if the UI should log messages to the console. Default is true. More... | |
static string | Html [get, set] |
Shortcut for calling UI.Start then using UI.document.innerHTML. Applies the given HTML to the whole main UI. More... | |
static string | innerHTML [get, set] |
Shortcut for calling UI.Start then using UI.document.innerHTML. Applies the given HTML to the whole main UI. More... | |
Events | |
static CameraCreated | OnCameraCreated |
This event is fired when PowerUI generates a new camera. This is the best way to apply custom rendering to the main UI. More... | |
Static Private Member Functions | |
static Wrench.UnityLanguageLoader | GetLanguageLoader () |
Gets a loader which tells the wrench framework where to look for language specific UI text ( content). This is set to Resources/Languages/UI. More... | |
static void | UpdateTextDirection () |
Makes sure the default text direction matches the one given by the language (e.g. Arabic may tell PowerUI it goes leftwards). Applies to the main UI and all in-world UI's. More... | |
static void | UpdateTextDirection (bool goesLeftwards, Document htmlDocument) |
Makes sure the default text direction is as given for the given html document. More... | |
static void | ResolveVariable (Document htmlDocument, string code) |
Resolves all as used by the given document their new values. Used when e.g. the language changes. More... | |
static void | ResolveAllVariables () |
Resolves all as used by PowerUI to their new values. Used when e.g. the language changes. More... | |
static void | ResolveAllVariables (Document htmlDocument) |
Resolves all as used by the given document their new values. Used when e.g. the language changes. More... | |
Static Private Attributes | |
static bool | Started |
True if Start has been called. More... | |
static float | FieldOfView |
The field of view of the perspective UI camera. More... | |
static float | RedrawTimer |
How much time, in seconds, has passed since our last redraw. More... | |
static Renderman | Renderer |
The renderer which renders the main UI. More... | |
static StandardUpdater | GlobalUpdater |
Updates the UI globally. Note that this is setup automatically for you. More... | |
static UnityLanguageLoader | LanguageLoader |
A loader which pulls languages from the Resources/Languages/UI folder. More... | |
static CameraMode | CurrentCameraMode =CameraMode.Perspective |
The current camera mode PowerUI is using. The default is Perspective. See UI.CameraMode to change this. More... | |
|
inlinestatic |
Adds a group of variables from the given xml string. Used to stream in languages at runtime. A group is used with &groupName.varName;
|
inlinestatic |
Used internally to fire the OnCameraCreated event.
|
inlinestatic |
|
inlinestatic |
Clears and entirely destroys the UI and WorldUI's. Calling this is not a requirement and can only be reversed by calling Start again.
|
inlinestatic |
|
inlinestatic |
Gets the distance of the main UI camera. Essentially defines how much z-index space it has.
|
inlinestatic |
Gets the field of view of the UI camera.
|
inlinestaticprivate |
Gets a loader which tells the wrench framework where to look for language specific UI text ( content). This is set to Resources/Languages/UI.
|
inlinestatic |
Handles mouse and keyboard input. Call this from OnGUI.
|
inlinestatic |
Used to hide the UI from the given camera if it's generated entirely at runtime.
|
inlinestatic |
Handles mouse and keyboard input. Called from OnGUI internally. See HandleInput.
|
inlinestatic |
|
inlinestatic |
Gets the content of the given file from resources.
resource | The path to the file in Resources. |
|
inlinestatic |
Returns true if the given x/y coordinate is over the UI.
x | The on screen x coordinate as measured from the left. |
y | The on screen y coordinate as measured from the top. |
|
inlinestatic |
Called by Wrench when the language of the UI changes. This changes the language of all on screen . UI.Language.
code | The language code/id (e.g. en). |
|
inlinestatic |
Called by wrench when it logs a message.
message | The message to log. |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
In general you should never call this. It forces a full Update to occur right now; this can only be called from the main Unity thread.
|
inlinestatic |
Requests all UI's to update. This occurs when an atlas has been optimised.
|
inlinestatic |
Asks the renderer for a layout (Used internally).
|
inlinestaticprivate |
Resolves all as used by PowerUI to their new values. Used when e.g. the language changes.
|
inlinestaticprivate |
Resolves all as used by the given document their new values. Used when e.g. the language changes.
htmlDocument | The document to update the variables for. |
|
inlinestaticprivate |
Resolves all as used by the given document their new values. Used when e.g. the language changes.
htmlDocument | The document to update the variables for. |
|
inlinestatic |
Sets the distance of the camera, essentially defining the amount of z-index available.
distance | The distance of the camera from the origin along the z axis in world units. |
|
inlinestatic |
Sets how many world units are used between elements at different depths. Default is 0.05.
gaps | The distance between elements to use. |
|
inlinestatic |
Sets the field of view of the UI camera.
fov | The field of view, in degrees. |
|
inlinestatic |
Sets the group resolver to use when resolving a group name from a variable that isn't found in the languages groups. E.g. &cdn.text; can be handled in custom ways here.
resolver | The resolver to use. |
|
inlinestatic |
Sets the update rate of the UI.
fps | The rate in frames per second. Default is UI.DefaultRate. |
|
inlinestatic |
|
inlinestatic |
|
inlinestaticprivate |
|
inlinestaticprivate |
Makes sure the default text direction is as given for the given html document.
goesLeftwards | True if the default text direction is leftwards. |
htmlDocument | The document to apply the setting to. |
|
static |
|
static |
The type that all code derives from. Must be UICode or something that inherits UICode.
|
static |
The default depth of the main camera.
|
static |
How much space should be given for elements. This distance essentially defines how much z-index is allowed.
|
static |
The gameobject that our UI.GUICamera is parented to.
|
static |
The transform of the UI.GUICamera.
|
static |
A custom content element. You can set this to whatever element you want for easy access.
|
staticprivate |
The current camera mode PowerUI is using. The default is Perspective. See UI.CameraMode to change this.
const int UI.DefaultRate =40 |
The default max update rate in fps. Note that input is decoupled from this.
|
static |
|
staticprivate |
The field of view of the perspective UI camera.
|
static |
All world UI's are kept in a linked list for updates. This is the head of the list.
|
staticprivate |
Updates the UI globally. Note that this is setup automatically for you.
|
static |
The unity camera that will render all UI elements.
|
static |
The gameobject which all UI elements are parented to.
|
static |
True if the UI consumed the current frames input event.
|
staticprivate |
A loader which pulls languages from the Resources/Languages/UI folder.
|
static |
All world UI's are kept in a linked list for updates. This is the tail of the list.
|
static |
|
static |
A set of cameras available for use with the main UI. This is only ever used with inline cameras.
|
static |
Called when a document wants the default security domain. Set with a custom method to provide your own.
|
static |
The time in seconds between redraws. UI.SetRate.
|
staticprivate |
How much time, in seconds, has passed since our last redraw.
|
staticprivate |
True if Start has been called.
|
static |
This variable set is used when parsing the HTML. can be used to replace text with custom values; e.g. in localization or .
|
staticgetset |
|
staticget |
Gets the default security domain for Nitro scripts.
|
staticgetset |
The image filter mode.
|
staticgetset |
Gets or sets the gender (boy, girl, either). This is used for localization where some text is better off being specific depending on what gender the player is - e.g. when using she/ he.
|
staticgetset |
|
staticgetset |
|
staticgetset |
The mode PowerUI uses for recieving input. Physics mode is more intensive than Screen mode, however using physics mode means transformed elements receive input correctly.
|
staticgetset |
Gets or sets the language code (e.g. "en") of the UI. This will internally update any onscreen variables for localization so you won't need to restart the game. Please refer to our guides on localization on the website for further help with this.
|
staticgetset |
Gets/sets if the UI should log messages to the console. Default is true.
|
staticgetset |
How the main UI renders images; either on an atlas or with them 'as is'. Default is Atlas.
|
staticgetset |
|
staticgetset |
Sets the text filter mode. Note: shared fonts will be affected in all other UI's.
|
staticgetset |
The mode PowerUI uses for recieving input for WorldUI's. Physics mode is more intensive than Screen mode, however using physics mode means transformed elements receive input correctly. None by default.