PowerQuest 0.19.2
Loading...
Searching...
No Matches
IGui Interface Reference

Detailed Description

IGui: Contains functions for and data manipluating Gui objects.

    G.Inventory.Show();
    G.HoverText.Hide();
    G.Prompt.Script.Show("Are you sure you want to quit?","Yes","No", ()=>Application.Quit());

Properties

string ScriptName [get]
 The name used in scripts.
 
MonoBehaviour Instance [get]
 Access to the actual game object component in the scene.
 
bool Visible [get, set]
 Gets or sets whether the object is visible.
 
bool Clickable [get, set]
 Gets or Sets whether clicking on the object triggers an event. Can be set false to have a gui visible but not clickable.
 
bool HasFocus [get]
 Returns true if this gui has focus in the game (ie: the current gui the player's looking at/clicking on)
 
bool VisibleInCutscenes [get, set]
 Gets or Sets whether this gui is visible during blocking sequences.
 
bool Modal [get, set]
 Gets or Sets whether this gui blocks clicks behind it.
 
bool PauseGame [get, set]
 Whether gameplay is paused while the gui is visible.
 
Vector2 Position [get, set]
 The location of the gui. Note that if gui is aligned to screen, changing this won't have an effect.
 
float Baseline [get, set]
 Gets or sets the baseline used for sorting. Just like with hotspots/charcters, LOWER is in-front (eg: -4 is in-front of 6)
 
string Cursor [get, set]
 Sets a cursor to show when hovering over the gui's hotspot (or anywhere if its a modal gui). Can be overriden by specific controls.
 
Gui Data [get]
 PowerQuest internal function: Access to the base class with extra functionality.
 

Public Member Functions

void Show ()
 Sets a gui visible and clickable.
 
void Hide ()
 Sets a gui non-visible, and non-clickable.
 
void ShowAtFront ()
 Shows the gui, in front of all others.
 
void ShowAtBack ()
 Shows the gui, behind all others.
 
void ShowBehind (IGui gui)
 Shows the gui, behind a specific other gui.
 
void ShowInfront (IGui gui)
 Shows the gui, in front of a specific other gui.
 
bool GetKeyPressed (eGuiNav key)
 Returns true if gui navigation key is pressed which hasn't been consumed by a control (consumes this keypress)
 
bool Navigate (eGuiNav button)
 Tells the gui to handle a keyboard or controller input. eg. Left/Right/Up/Down inputs will navigate between controls, or slide sliders, and 'Ok' will press buttons.

 
void NavigateToControl (IGuiControl control)
 Call this to specify which control should be navigated to. When using keyboard/controller for menues.
 
void ResetNavigation ()
 Resets any control that's been focused by keyboard navigation.
 
GuiControl GetControl (string name)
 Retreives a specific IGuiControl from the gui.
 
bool HasControl (string name)
 Returns true if the control exists.
 
GetScript< T > ()
 PowerQuest internal function: Access to the specific quest script for the room. Use the specific room script as the templated parameter so you can access specific members of the script. Eg: GetScript<GuiPrompt>().Show("Blah");

 

Property Documentation

◆ ScriptName

string ScriptName
get

The name used in scripts.

◆ Instance

MonoBehaviour Instance
get

Access to the actual game object component in the scene.

◆ Visible

bool Visible
getset

Gets or sets whether the object is visible.

◆ Clickable

bool Clickable
getset

Gets or Sets whether clicking on the object triggers an event. Can be set false to have a gui visible but not clickable.

◆ HasFocus

bool HasFocus
get

Returns true if this gui has focus in the game (ie: the current gui the player's looking at/clicking on)

◆ VisibleInCutscenes

bool VisibleInCutscenes
getset

Gets or Sets whether this gui is visible during blocking sequences.

◆ Modal

bool Modal
getset

Gets or Sets whether this gui blocks clicks behind it.

◆ PauseGame

bool PauseGame
getset

Whether gameplay is paused while the gui is visible.

◆ Position

Vector2 Position
getset

The location of the gui. Note that if gui is aligned to screen, changing this won't have an effect.

◆ Baseline

float Baseline
getset

Gets or sets the baseline used for sorting. Just like with hotspots/charcters, LOWER is in-front (eg: -4 is in-front of 6)

◆ Cursor

string Cursor
getset

Sets a cursor to show when hovering over the gui's hotspot (or anywhere if its a modal gui). Can be overriden by specific controls.

◆ Data

Gui Data
get

PowerQuest internal function: Access to the base class with extra functionality.

Member Function Documentation

◆ Show()

void Show ( )

Sets a gui visible and clickable.

◆ Hide()

void Hide ( )

Sets a gui non-visible, and non-clickable.

◆ ShowAtFront()

void ShowAtFront ( )

Shows the gui, in front of all others.

◆ ShowAtBack()

void ShowAtBack ( )

Shows the gui, behind all others.

◆ ShowBehind()

void ShowBehind ( IGui gui)

Shows the gui, behind a specific other gui.

◆ ShowInfront()

void ShowInfront ( IGui gui)

Shows the gui, in front of a specific other gui.

◆ GetKeyPressed()

bool GetKeyPressed ( eGuiNav key)

Returns true if gui navigation key is pressed which hasn't been consumed by a control (consumes this keypress)

◆ Navigate()

bool Navigate ( eGuiNav button)

Tells the gui to handle a keyboard or controller input. eg. Left/Right/Up/Down inputs will navigate between controls, or slide sliders, and 'Ok' will press buttons.

Call this from your gui script or global script if the gui is focused. Returns true if button did something eg:

if ( Input.GetKeyDown(KeyCode.Esc) && Navigate(eGuiNav.Cancel) == false )
Gui.Hide();
bool Navigate(eGuiNav button)
Tells the gui to handle a keyboard or controller input. eg. Left/Right/Up/Down inputs will navigate b...
See also
NavigateToControl
ResetNavigation

◆ NavigateToControl()

void NavigateToControl ( IGuiControl control)

Call this to specify which control should be navigated to. When using keyboard/controller for menues.

See also
Navigate
ResetNavigation

◆ ResetNavigation()

void ResetNavigation ( )

Resets any control that's been focused by keyboard navigation.

See also
Navigate
NavigateToControl

◆ GetControl()

GuiControl GetControl ( string name)

Retreives a specific IGuiControl from the gui.

Retreives a specific IGuiControl from the gui.

Controls can be cast to Buttons, Labels, etc. Eg:

IButton button = (IButton)G.Keypad.GetControl("AcceptButton");
button.Color = Color.Red;

NB: The gui must be instantiated for this to work. It might not work in scene loading scripts.

◆ HasControl()

bool HasControl ( string name)

Returns true if the control exists.

◆ GetScript< T >()

T GetScript< T > ( )

PowerQuest internal function: Access to the specific quest script for the room. Use the specific room script as the templated parameter so you can access specific members of the script. Eg: GetScript<GuiPrompt>().Show("Blah");

Type Constraints
T :GuiScript<T>