Adventure Creator  1.56g
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2017
AC.PlayerMenus Class Reference
Inheritance diagram for AC.PlayerMenus:

Public Member Functions

void OnStart ()
 
void RebuildMenus (MenuManager menuManager=null)
 Rebuilds the game's Menus, either from the existing MenuManager asset, or from a new one. More...
 
void AfterLoad ()
 
void AfterSceneAdd ()
 
void ClearParents ()
 
void DrawLoadingMenus ()
 
void DrawMenus ()
 
void UpdateMenuPosition (AC.Menu menu, Vector2 invertedMouse)
 Updates a Menu's position. More...
 
bool IsEventSystemSelectingObject (GameObject _gameObject)
 Checks if the Unity UI EventSystem currently has a given GameObject selected. More...
 
bool IsEventSystemSelectingObject ()
 Checks if the Unity UI EventSystem currently has any GameObject selected. More...
 
void DeselectEventSystemMenu (Menu _menu)
 De-selects the Unity UI EventSystem's selected gameobject if it is associated with a given Menu. More...
 
void RefreshDialogueOptions ()
 
void UpdateLoadingMenus ()
 
void CheckForInput ()
 
void UpdateAllMenus ()
 
void CheckCrossfade (AC.Menu _menu)
 Begins fading in the second Menu in a crossfade if the first Menu matches the supplied parameter. More...
 
void SelectInputBox (MenuInput input)
 Selects a MenuInput element, allowing the player to enter text into it. More...
 
void RemoveSpeechFromMenu (Speech speech)
 Unassigns a Speech line from any temporarily-duplicated Menus. This will signal such Menus that they can be removed. More...
 
void AssignSpeechToMenu (Speech speech)
 Duplicates any Menu set to display a single speech line. More...
 
void AssignHotspotToMenu (Hotspot hotspot, InvItem invItem)
 Duplicates any Menu set to display a single speech line. More...
 
void CrossFade (AC.Menu _menuTo)
 Crossfades to a Menu. Any other Menus will be turned off. More...
 
void CloseInteractionMenus ()
 Closes all "Interaction" Menus.
 
void EnableInteractionMenus (Hotspot hotspotFor)
 Shows any Menus with appearType = AppearType.OnInteraction, and connected to a given Hotspot. More...
 
void EnableInteractionMenus (InvItem itemFor)
 Shows any Menus with appearType = AppearType.OnInteraction, and connected to a given Inventory item to. More...
 
void DisableHotspotMenus ()
 
string GetHotspotLabel ()
 Gets the complete Hotspot label to be displayed in a MenuLabel element with labelType = AC_LabelType.Hotspot. More...
 
bool ArePauseMenusOn (Menu excludingMenu=null)
 Checks if any Menus that pause the game are currently turned on. More...
 
void ForceOffSubtitles (SpeechMenuLimit speechMenuLimit=SpeechMenuLimit.All)
 Instantly turns off all Menus that have appearType = AppearType.WhenSpeechPlays. More...
 
void RecalculateAll ()
 
void HideSaveMenus ()
 
void FindFirstSelectedElement ()
 
int GetElementOverCursorID ()
 Gets the ID number of the CursorIcon, defined in CursorManager, to switch to based on what MenuElement the cursor is currently over More...
 
void SetManualSaveLock (bool state)
 Sets the state of the manual save lock. More...
 
bool IsMouseOverMenu ()
 Checks if the cursor is hovering over a Menu. More...
 
bool IsMouseOverInteractionMenu ()
 Checks if the cursor is hovering over a Menu with appearType = AppearType.OnInteraction. More...
 
bool IsInteractionMenuOn ()
 Checks if any Menu with appearType = AppearType.OnInteraction is on. More...
 
bool IsCyclingInteractionMenu ()
 Checks if the player is currently manipulating an Interaction Menu by cycling the Interaction elements inside it. More...
 
bool IsPausingInteractionMenuOn ()
 Checks if the last-opened Menu with appearType = AppearType.OnInteraction is both open and set to pause the game. More...
 
void MakeUIInteractive ()
 
void MakeUINonInteractive ()
 
MainData SaveMainData (MainData mainData)
 Updates a MainData class with its own variables that need saving. More...
 
void LoadMainData (MainData mainData)
 Updates its own variables from a MainData class. More...
 

Static Public Member Functions

static List< MenuGetMenus ()
 Gets a List of all defined Menus. More...
 
static Menu GetMenuWithName (string menuName)
 Gets a Menu with a specific name. More...
 
static MenuElement GetElementWithName (string menuName, string menuElementName)
 Gets a MenuElement with a specific name. More...
 
static bool IsSavingLocked (Action _actionToIgnore=null)
 Checks if saving cannot be performed at this time. More...
 
static void ResetInventoryBoxes ()
 
static void CreateRecipe ()
 
static void ForceOffAllMenus (bool onlyPausing=false)
 Instantly turns off all Menus. More...
 
static void SimulateClick (string menuName, string menuElementName, int slot=1)
 Simulates the clicking of a MenuElement. More...
 
static void SimulateClick (string menuName, MenuElement _element, int _slot=1)
 Simulates the clicking of a MenuElement. More...
 

Detailed Description

This script handles the initialisation, position and display of all Menus defined in MenuManager. Menus are transferred from MenuManager to a local List within this script when the game begins. It must be placed on the PersistentEngine prefab.

Member Function Documentation

void AC.PlayerMenus.AfterLoad ( )

Initialises the menu system after a scene change. This is called manually by SaveSystem so that the order is correct.

bool AC.PlayerMenus.ArePauseMenusOn ( Menu  excludingMenu = null)

Checks if any Menus that pause the game are currently turned on.

Parameters
excludingMenuIf assigned, this Menu will be excluded from the check
Returns
True if any Menus that pause the game are currently turned on
void AC.PlayerMenus.AssignHotspotToMenu ( Hotspot  hotspot,
InvItem  invItem 
)

Duplicates any Menu set to display a single speech line.

Parameters
speechThe Speech line to assign to any duplicated Menu
void AC.PlayerMenus.AssignSpeechToMenu ( Speech  speech)

Duplicates any Menu set to display a single speech line.

Parameters
speechThe Speech line to assign to any duplicated Menu
void AC.PlayerMenus.CheckCrossfade ( AC.Menu  _menu)

Begins fading in the second Menu in a crossfade if the first Menu matches the supplied parameter.

Parameters
_menuThe Menu to check for. If this menu is crossfading out, then it will be turned off, and the second Menu will fade in
void AC.PlayerMenus.CheckForInput ( )

Checks for inputs made to all Menus. This is called every frame by StateHandler.

void AC.PlayerMenus.ClearParents ( )

Clears the parents of any Unity UI-based Menu Canvases. This makes them able to survive a scene change.

static void AC.PlayerMenus.CreateRecipe ( )
static

Takes the ingredients supplied to a MenuCrafting element and sets the appropriate outcome of another MenuCrafting element with craftingType = CraftingElementType.Output.

void AC.PlayerMenus.CrossFade ( AC.Menu  _menuTo)

Crossfades to a Menu. Any other Menus will be turned off.

Parameters
_menuToThe Menu to crossfade to
void AC.PlayerMenus.DeselectEventSystemMenu ( Menu  _menu)

De-selects the Unity UI EventSystem's selected gameobject if it is associated with a given Menu.

Parameters
_menuThe Menu to deselect
void AC.PlayerMenus.DisableHotspotMenus ( )

Turns off any Menus with appearType = AppearType.OnHotspot.

void AC.PlayerMenus.DrawLoadingMenus ( )

Draws any OnGUI-based Menus set to appear while the game is loading.

void AC.PlayerMenus.DrawMenus ( )

Draws all OnGUI-based Menus.

void AC.PlayerMenus.EnableInteractionMenus ( Hotspot  hotspotFor)

Shows any Menus with appearType = AppearType.OnInteraction, and connected to a given Hotspot.

Parameters
_hotspotForThe Hotspot to connect the Menus to.
void AC.PlayerMenus.EnableInteractionMenus ( InvItem  itemFor)

Shows any Menus with appearType = AppearType.OnInteraction, and connected to a given Inventory item to.

Parameters
_itemForThe Inventory item to connect the Menus to.
void AC.PlayerMenus.FindFirstSelectedElement ( )

Selects the first element GameObject in a Unity UI-based Menu.

static void AC.PlayerMenus.ForceOffAllMenus ( bool  onlyPausing = false)
static

Instantly turns off all Menus.

Parameters
onlyPausingIf True, then only Menus with pauseWhenEnabled = True will be turned off
void AC.PlayerMenus.ForceOffSubtitles ( SpeechMenuLimit  speechMenuLimit = SpeechMenuLimit.All)

Instantly turns off all Menus that have appearType = AppearType.WhenSpeechPlays.

Parameters
speechMenuLimitThe type of speech to kill (All, BlockingOnly, BackgroundOnly)
int AC.PlayerMenus.GetElementOverCursorID ( )

Gets the ID number of the CursorIcon, defined in CursorManager, to switch to based on what MenuElement the cursor is currently over

Returns
The ID number of the CursorIcon, defined in CursorManager, to switch to based on what MenuElement the cursor is currently over
static MenuElement AC.PlayerMenus.GetElementWithName ( string  menuName,
string  menuElementName 
)
static

Gets a MenuElement with a specific name.

Parameters
menuNameThe name (title) of the Menu to find
menuElementNameThe name (title) of the MenuElement with the Menu to find
Returns
The MenuElement with the specific name
string AC.PlayerMenus.GetHotspotLabel ( )

Gets the complete Hotspot label to be displayed in a MenuLabel element with labelType = AC_LabelType.Hotspot.

Returns
The complete Hotspot label to be displayed in a MenuLabel element with labelType = AC_LabelType.Hotspot
static List<Menu> AC.PlayerMenus.GetMenus ( )
static

Gets a List of all defined Menus.

Returns
A List of all defined Menus
static Menu AC.PlayerMenus.GetMenuWithName ( string  menuName)
static

Gets a Menu with a specific name.

Parameters
menuNameThe name (title) of the Menu to find
Returns
The Menu with the specific name
void AC.PlayerMenus.HideSaveMenus ( )

Instantly turns off all Menus that contain a MenuSaveList with savesListType = AC_SavesListType.Save.

bool AC.PlayerMenus.IsCyclingInteractionMenu ( )

Checks if the player is currently manipulating an Interaction Menu by cycling the Interaction elements inside it.

Returns
True if the player is currently manipulating an Interaction Menu by cycling the Interaction elements inside it.
bool AC.PlayerMenus.IsEventSystemSelectingObject ( GameObject  _gameObject)

Checks if the Unity UI EventSystem currently has a given GameObject selected.

Parameters
_gameObjectThe GameObject to check
Returns
True if the Unity UI EventSystem currently has a given GameObject selected
bool AC.PlayerMenus.IsEventSystemSelectingObject ( )

Checks if the Unity UI EventSystem currently has any GameObject selected.

Returns
True if the Unity UI EventSystem currently has any GameObject selected
bool AC.PlayerMenus.IsInteractionMenuOn ( )

Checks if any Menu with appearType = AppearType.OnInteraction is on.

Returns
True if any Menu with appearType = AppearType.OnInteraction is on.
bool AC.PlayerMenus.IsMouseOverInteractionMenu ( )

Checks if the cursor is hovering over a Menu with appearType = AppearType.OnInteraction.

Returns
True if the cursor is hovering over a Menu with appearType = AppearType.OnInteraction.
bool AC.PlayerMenus.IsMouseOverMenu ( )

Checks if the cursor is hovering over a Menu.

Returns
True if the cursor is hovering over a Menu
bool AC.PlayerMenus.IsPausingInteractionMenuOn ( )

Checks if the last-opened Menu with appearType = AppearType.OnInteraction is both open and set to pause the game.

Returns
True if the last-opened Menu with appearType = AppearType.OnInteraction is both open and set to pause the game.
static bool AC.PlayerMenus.IsSavingLocked ( Action  _actionToIgnore = null)
static

Checks if saving cannot be performed at this time.

Any gameplay-blocking ActionList that contains this Action will be excluded from the check

Returns
True if saving cannot be performed at this time
void AC.PlayerMenus.LoadMainData ( MainData  mainData)

Updates its own variables from a MainData class.

Parameters
mainDataThe MainData class to load from
void AC.PlayerMenus.MakeUIInteractive ( )

Makes all Menus linked to Unity UI interactive.

void AC.PlayerMenus.MakeUINonInteractive ( )

Makes all Menus linked to Unity UI non-interactive.

void AC.PlayerMenus.RebuildMenus ( MenuManager  menuManager = null)

Rebuilds the game's Menus, either from the existing MenuManager asset, or from a new one.

Parameters
menuManagerThe Menu Manager to use for Menu generation. If left empty, the default Menu Manager will be used.
void AC.PlayerMenus.RecalculateAll ( )

Recalculates the position, size and display of all Menus. This is an intensive process, and should not be called every fame.

void AC.PlayerMenus.RefreshDialogueOptions ( )

Refreshes any active MenuDialogList elements, after changing the state of dialogue options.

void AC.PlayerMenus.RemoveSpeechFromMenu ( Speech  speech)

Unassigns a Speech line from any temporarily-duplicated Menus. This will signal such Menus that they can be removed.

Parameters
speechThe Speech line to unassign
static void AC.PlayerMenus.ResetInventoryBoxes ( )
static

Calls RecalculateSize() on all MenuInventoryBox elements.

MainData AC.PlayerMenus.SaveMainData ( MainData  mainData)

Updates a MainData class with its own variables that need saving.

Parameters
mainDataThe original MainData class
Returns
The updated MainData class
void AC.PlayerMenus.SelectInputBox ( MenuInput  input)

Selects a MenuInput element, allowing the player to enter text into it.

Parameters
inputThe input box to select
void AC.PlayerMenus.SetManualSaveLock ( bool  state)

Sets the state of the manual save lock.

Parameters
stateIf True, then saving will be manually disabled
static void AC.PlayerMenus.SimulateClick ( string  menuName,
string  menuElementName,
int  slot = 1 
)
static

Simulates the clicking of a MenuElement.

Parameters
menuNameThe name (title) of the Menu that contains the MenuElement
menuElementNameThe name (title) of the MenuElement
slotThe index number of the slot, if the MenuElement has multiple slots
static void AC.PlayerMenus.SimulateClick ( string  menuName,
MenuElement  _element,
int  _slot = 1 
)
static

Simulates the clicking of a MenuElement.

Parameters
menuNameThe name (title) of the Menu that contains the MenuElement
_elementThe MenuElement
slotThe index number of the slot, if the MenuElement has multiple slots
void AC.PlayerMenus.UpdateAllMenus ( )

Updates the state of all Menus. This is called every frame by StateHandler.

void AC.PlayerMenus.UpdateLoadingMenus ( )

Updates the state of all Menus set to appear while the game is loading.

void AC.PlayerMenus.UpdateMenuPosition ( AC.Menu  menu,
Vector2  invertedMouse 
)

Updates a Menu's position.

Parameters
menuThe Menu to reposition
invertedMouseThe y-inverted mouse position