Adventure Creator  1.79.1
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2022
AC.Menu Class Reference
Inheritance diagram for AC.Menu:

Public Member Functions

void Declare (int[] idArray)
 Initialises a Menu when it is created within MenuManager. More...
 
void CreateDuplicate (AC.Menu menuToCopy)
 Copies the values of another Menu, and initialises it for display. More...
 
void Copy (AC.Menu _menu, bool fromEditor, bool forceUIFields=false)
 Copies the variables of another Menu onto itself. More...
 
void LoadUnityUI (bool addEventListeners=true)
 Instantiates and initialises a linked Unity UI Canvas, if Unity UI is used for display. More...
 
bool GetsDuplicated ()
 Checks if the Menu gets duplicated for either each subtitle line or Hotspot. More...
 
void DuplicateInGame (Menu otherMenu)
 
void ClearParent ()
 
void Initalise ()
 
void EnableOnStart ()
 
void EnableUI ()
 
void DisableUI ()
 
void UpdateInteractability ()
 
void ShowGUI ()
 
int GetVariableReferences (int varID)
 Gets the number of references the Menu makes to a global variable More...
 
int UpdateVariableReferences (int oldVarID, int newVarID)
 Updates references the Menu makes to a global variable More...
 
bool ReferencesObjectOrID (GameObject gameObject, int id)
 Checks if the Menu makes reference to a particular GameObject More...
 
bool ReferencesAsset (ActionListAsset actionListAsset)
 Checks if the Menu makes reference to a particular ActionList asset More...
 
bool IsUnityUI ()
 Checks if Unity UI is used for the Menu's display, rather than OnGUI. More...
 
void DrawOutline (MenuElement _selectedElement)
 
void StartDisplay ()
 
void EndDisplay ()
 
void SetCentre3D (Vector3 _position)
 Sets the centre-point of a 3D Menu. More...
 
void SetCentre (Vector2 _position, bool useAspectRatio=false)
 Sets the centre-point of a 2D Menu. More...
 
void Align (TextAnchor _anchor)
 Aligns an OnGUI Menu to an area of the screen. More...
 
bool IsPointInside (Vector2 _point)
 Checks if a point in Screen Space lies within the Menu's boundary. More...
 
Rect GetRect ()
 Gets a Rect that describes an OnGUI Menu's boundary. More...
 
bool IsPointerOverSlot (MenuElement _element, int slot, Vector2 _point)
 Checks if a point in Screen Space within a specific slot of a specific MenuElement. More...
 
Rect GetElementRect (MenuElement _element, int slot)
 Gets a Rect describing the boundary (in screen-space) of an element in the Menu More...
 
Rect GetRectAbsolute (Rect _rectRelative)
 Converts a Rect that's relative to an OnGUI Menu's boundary to Screen Space. More...
 
void ResetVisibleElements ()
 
void RefreshDialogueOptions ()
 
void Recalculate ()
 
void AutoResize (MenuElement elementToSkip=null)
 
void Centre ()
 
bool IsEnabled ()
 Checks if the Menu is currently enabled. More...
 
bool IsVisible ()
 Checks if the Menu is fully visible or not. More...
 
bool IsOn ()
 Checks if the Menu is fully on or not. More...
 
bool IsOff ()
 Checks if the Menu is fully off or not. More...
 
bool HasTransition ()
 Checks if the Menu transitions over time when being enabled or disabled. More...
 
GameState GetGameStateWhenTurnedOn ()
 Gets the value of StateHandler's gameState variable at the point that the Menu was last turned on. More...
 
bool IsElementSelectedByEventSystem (int elementIndex, int slotIndex)
 Checks if an element inside the Menu is selected by Unity UI's EventSystem (Unity UI menus only). More...
 
bool IsElementSelectableInteractable (int elementIndex, int slotIndex)
 Checks if an element inside the Menu is currently Interactable (Unity UI menus only). More...
 
bool TurnOn (bool doFade=true)
 Turns the Menu on. More...
 
bool TurnOff (bool doFade=true)
 Turns the Menu off. More...
 
void ForceOff (bool ignoreActionList=false)
 Forces the Menu off instantly. More...
 
bool IsFadingIn ()
 Checks if the Menu is transitioning in. More...
 
bool IsFadingOut ()
 Checks if the Menu is transitioning out. More...
 
bool IsFading ()
 Checks if the Menu is transitioning in or out. More...
 
float GetFadeProgress ()
 Gets the progression through the Menu's transition animation (0 = fully on, 1 = fully off) More...
 
void HandleTransition ()
 
void AfterSceneChange ()
 
bool CanPause ()
 Checks if the Menu's appearType is such that the pauseWhenEnabled option is valid. More...
 
bool IsClickable ()
 If True, the Menu is currently clickable. More...
 
bool CanClickInCutscenes ()
 If True, the Menu is clickable during Cutscenes. More...
 
bool IsBlocking ()
 Checks if the Menu will pause gameplay when enabled. More...
 
bool IsManualControlled ()
 Checks if the Menu's enabled state is controlled by either the player or by Actions. More...
 
void MatchInteractions (Hotspot hotspot, bool includeInventory)
 Recalculates a Menu's display for a particular Hotspot. More...
 
void MatchInteractions (InvInstance invInstance, bool includeInventory)
 Recalculates a Menu's display for a particular inventory item. More...
 
void MatchLookInteraction ()
 Recalculates a Menu's display for an "Examine" Hotspot Button. More...
 
void MatchUseInteraction (Button button)
 Recalculates a Menu's display for an "Use" Hotspot Button. More...
 
void HideInteractions ()
 
void SetDragOffset (Vector2 pos, Rect dragRect)
 Offsets an OnGUI Menu's position when dragged by a MenuDrag element. More...
 
Vector2 GetDragStart ()
 Gets the drag offset. More...
 
float GetZoom ()
 
bool CanCurrentlyKeyboardControl (GameState gameState)
 Checks if the Menu can be controlled with the keyboard or controller at this time. More...
 
void Select (string elementName, int slotIndex=0)
 Selects a given element (and optionally, a slot inside it) for direct-controlled menu navigation. More...
 
void Select (MenuElement elementToSelect, int slotIndex=0)
 Selects a given element (and optionally, a slot inside it) for direct-controlled menu navigation. More...
 
void AutoSelect ()
 
bool GetNextSlot (Vector2 inputDirection, bool scrollingLocked)
 Attempts to select a new element or slot in a given direction. This is used for direct-controlled menu navigation More...
 
MenuElement GetElementWithName (string menuElementName)
 Gets a MenuElement subclass within the Menu's list of elements. More...
 
MenuElement GetElementWithGameObject (GameObject gameObject)
 Gets a MenuElement subclass within the Menu's list of elements, provided it is linked to Unity UI. More...
 
Vector2 GetSlotCentre (MenuElement _element, int slot)
 Gets the centre-point of a MenuElement slot, in Screen Space. More...
 
void SetHotspot (Hotspot _hotspot, InvInstance _invInstance)
 
void SetSpeech (Speech _speech)
 Assigns the Menu, and all MenuElement classes within it, to a Speech line. More...
 
MenuElement GetFirstVisibleElement ()
 Gets the first visibla element from the Menu's list of elements, in the order defined in the Menu Manager More...
 
GameObject GetObjectToSelect ()
 Gets the GameObject of the first-selected MenuElement, for a Unity UI-based Menu. More...
 
void PreScreenshotBackup ()
 
void PostScreenshotBackup ()
 
override string ToString ()
 
bool ShouldTurnOffWhenLoading ()
 Checks if the Menu should be automatically turned off when loading a save game, instead of loaded. This is only True if the Menu is manually-controlled and contains a SavesList element. More...
 

Static Public Member Functions

static int FieldToID< T > (T field, int _constantID)
 
static T IDToField< T > (T field, int _constantID, MenuSource source)
 

Public Attributes

MenuSource menuSource = MenuSource.AdventureCreator
 
string canvasAssetKey
 
int canvasID = 0
 
RectTransform rectTransform
 
int rectTransformID = 0
 
UITransition uiTransitionType = UITransition.None
 
UIPositionType uiPositionType = UIPositionType.Manual
 
int id
 
string title
 
Vector2 manualSize = Vector2.zero
 
AC_PositionType positionType = AC_PositionType.Centred
 
Vector2 manualPosition = Vector2.zero
 
bool positionSmoothing = false
 
TextAnchor alignment = TextAnchor.MiddleCenter
 
string toggleKey = ""
 
bool ignoreMouseClicks = false
 
bool pauseWhenEnabled = false
 
bool showWhenPaused = false
 
bool canClickInCutscene = false
 
bool enabledOnStart = false
 
ActionListAsset actionListOnTurnOn = null
 
ActionListAsset actionListOnTurnOff = null
 
bool updateWhenFadeOut = true
 
bool hideDuringSaveScreenshots = true
 
bool fitWithinScreen = true
 
Texture2D backgroundTexture
 
List< MenuElementvisibleElements = new List<MenuElement>()
 
float transitionProgress = 0f
 
AppearType appearType
 
SpeechMenuType speechMenuType = SpeechMenuType.All
 
SpeechMenuLimit speechMenuLimit = SpeechMenuLimit.All
 
string limitToCharacters = ""
 
bool forceSubtitles = false
 
bool moveWithCharacter = true
 
MenuElement selected_element
 
int selected_slot = 0
 
bool autoSelectFirstVisibleElement = false
 
string firstSelectedElement
 
List< MenuElementelements = new List<MenuElement>()
 
float spacing
 
AC_SizeType sizeType
 
bool autoSizeEveryFrame = false
 
MenuOrientation orientation
 
MenuTransition transitionType = MenuTransition.None
 
PanDirection panDirection = PanDirection.Up
 
PanMovement panMovement = PanMovement.Linear
 
AnimationCurve timeCurve = new AnimationCurve (new Keyframe(0, 0), new Keyframe(1, 1))
 
float panDistance = 0.5f
 
float fadeSpeed = 0f
 
TextAnchor zoomAnchor = TextAnchor.MiddleCenter
 
bool zoomElements = false
 
bool oneMenuPerSpeech = false
 
SpeechProximityLimit speechProximityLimit = SpeechProximityLimit.NoLimit
 
float speechProximityDistance = 10f
 
bool deleteUIWhenTurnOff = false
 
Speech speech
 
bool showInFilter
 

Properties

InvInstance TargetInvInstance [get]
 
Hotspot TargetHotspot [get]
 
int ID [get, set]
 
bool HasMoved [get]
 
int NumElements [get]
 
Canvas RuntimeCanvas [get]
 
Canvas PrefabCanvas [get, set]
 
bool isLocked [get, set]
 
float OnAmount [get]
 
bool IsDuplicate [get]
 
Vector2 PositionOffset [set]
 
HotspotLabelData HotspotLabelData [get]
 

Detailed Description

A Menu is an in-game GUI. It is made by grouping together MenuElement subclasses, and displaying them in a particular way. Menus can either be created using OnGUI (aka "Adventure Creator") calls, or by referencing Canvas objects and Unity UI components.

Member Function Documentation

◆ AfterSceneChange()

void AC.Menu.AfterSceneChange ( )

Pauses the game if appropriate after a scene-change.

◆ Align()

void AC.Menu.Align ( TextAnchor  _anchor)

Aligns an OnGUI Menu to an area of the screen.

Parameters
_anchorThe alignement to make

◆ AutoResize()

void AC.Menu.AutoResize ( MenuElement  elementToSkip = null)

Resizes a Menu that's size is dependent on the elements within it.

◆ AutoSelect()

void AC.Menu.AutoSelect ( )

Makes sure an element or slots is selected, ready for direct-controlled menu navigation. If the Menu has just been turned on, then the first visible element will be selected If an element was selected, but made invisible, then the slot or element closest to it will be selected.

◆ CanClickInCutscenes()

bool AC.Menu.CanClickInCutscenes ( )

If True, the Menu is clickable during Cutscenes.

Returns
True if the Menu is clickable during Cutscenes.

◆ CanCurrentlyKeyboardControl()

bool AC.Menu.CanCurrentlyKeyboardControl ( GameState  gameState)

Checks if the Menu can be controlled with the keyboard or controller at this time.

Returns
True if the Menu can be controlled with the keyboard or controller at this time.

◆ CanPause()

bool AC.Menu.CanPause ( )

Checks if the Menu's appearType is such that the pauseWhenEnabled option is valid.

Returns
True if the Menu's appearType is such that the pauseWhenEnabled option is valid.

◆ Centre()

void AC.Menu.Centre ( )

Positions an OnGUI Menu in the centre of the screen.

◆ ClearParent()

void AC.Menu.ClearParent ( )

Removes the linked Canvas from the "_UI" hierarchy folder, if Unity UI is used for display. This is necessary for prefabs that must survive scene changes.

◆ Copy()

void AC.Menu.Copy ( AC.Menu  _menu,
bool  fromEditor,
bool  forceUIFields = false 
)

Copies the variables of another Menu onto itself.

Parameters
fromEditorIf True, the duplication was done within the Menu Manager and not as part of the gameplay initialisation.
_menuThe Menu to copy from
forceUIFieldsIf True, the variables related to Unity UI-sourced Menus will also be copied, regardless of the Menu's menuSource value

◆ CreateDuplicate()

void AC.Menu.CreateDuplicate ( AC.Menu  menuToCopy)

Copies the values of another Menu, and initialises it for display.

Parameters
menuToCopyThe other Menu to copy from

◆ Declare()

void AC.Menu.Declare ( int[]  idArray)

Initialises a Menu when it is created within MenuManager.

Parameters
idArrayAn array of previously-used ID numbers

◆ DisableUI()

void AC.Menu.DisableUI ( )

Disables the associated Unity UI canvas, if source != MenuSource.AdventureCreator

◆ DrawOutline()

void AC.Menu.DrawOutline ( MenuElement  _selectedElement)

Draws an outline around the Menu and the MenuElement subclasses it houses.

◆ EnableUI()

void AC.Menu.EnableUI ( )

Enables the associated Unity UI canvas, if source != MenuSource.AdventureCreator

◆ EndDisplay()

void AC.Menu.EndDisplay ( )

Ends the display of an OnGUI-based Menu.

◆ ForceOff()

void AC.Menu.ForceOff ( bool  ignoreActionList = false)

Forces the Menu off instantly.

Parameters
ignoreActionListIf True, and actionListOnTurnOff is assigned, then it will not be run

◆ GetDragStart()

Vector2 AC.Menu.GetDragStart ( )

Gets the drag offset.

Returns
The drag offset

◆ GetElementRect()

Rect AC.Menu.GetElementRect ( MenuElement  _element,
int  slot 
)

Gets a Rect describing the boundary (in screen-space) of an element in the Menu

Parameters
_elementThe Element to get the boundary of
slotThe Element's slot, if it supports multiple slots
Returns
A Rect describing the Element's boundary in screen-space

◆ GetElementWithGameObject()

MenuElement AC.Menu.GetElementWithGameObject ( GameObject  gameObject)

Gets a MenuElement subclass within the Menu's list of elements, provided it is linked to Unity UI.

Parameters
gameObjectThe Unity UI GameObject associated with the MenuElement to get
Returns
The MenuElement subclass

◆ GetElementWithName()

MenuElement AC.Menu.GetElementWithName ( string  menuElementName)

Gets a MenuElement subclass within the Menu's list of elements.

Parameters
menuElementNameThe title of the MenuElement to get
Returns
The MenuElement subclass

◆ GetFadeProgress()

float AC.Menu.GetFadeProgress ( )

Gets the progression through the Menu's transition animation (0 = fully on, 1 = fully off)

Returns
The progression through the Menu's transition animation

◆ GetFirstVisibleElement()

MenuElement AC.Menu.GetFirstVisibleElement ( )

Gets the first visibla element from the Menu's list of elements, in the order defined in the Menu Manager

Returns
The first visibla element from the Menu's list of elements

◆ GetGameStateWhenTurnedOn()

GameState AC.Menu.GetGameStateWhenTurnedOn ( )

Gets the value of StateHandler's gameState variable at the point that the Menu was last turned on.

Returns
The value of StateHandler's gameState variable at the point that the Menu was last turned on

◆ GetNextSlot()

bool AC.Menu.GetNextSlot ( Vector2  inputDirection,
bool  scrollingLocked 
)

Attempts to select a new element or slot in a given direction. This is used for direct-controlled menu navigation

Parameters
inputDirectionThe direction to move the selection in
scrollingLockedIf True, don't change the selection (but still call this in case changing e.g. MenuSlider values)
Returns
True if a new element or slot was changed

◆ GetObjectToSelect()

GameObject AC.Menu.GetObjectToSelect ( )

Gets the GameObject of the first-selected MenuElement, for a Unity UI-based Menu.

Returns
The GameObject of the first-selected MenuElement

◆ GetRect()

Rect AC.Menu.GetRect ( )

Gets a Rect that describes an OnGUI Menu's boundary.

Returns
A Rect that describes an OnGUI Menu's boundary.

◆ GetRectAbsolute()

Rect AC.Menu.GetRectAbsolute ( Rect  _rectRelative)

Converts a Rect that's relative to an OnGUI Menu's boundary to Screen Space.

Parameters
_rectRelativeThe relative Rect to convert
Returns
The Rect converted to Screen Space co-ordinates

◆ GetsDuplicated()

bool AC.Menu.GetsDuplicated ( )

Checks if the Menu gets duplicated for either each subtitle line or Hotspot.

Returns
True if the Menu gets duplicated for either each subtitle line or Hotspot.

◆ GetSlotCentre()

Vector2 AC.Menu.GetSlotCentre ( MenuElement  _element,
int  slot 
)

Gets the centre-point of a MenuElement slot, in Screen Space.

Parameters
_elementThe MenuElement that the slot is in
slotThe slot to reference, by index number
Returns
The centre-point of the MenuElement slot

◆ GetVariableReferences()

int AC.Menu.GetVariableReferences ( int  varID)

Gets the number of references the Menu makes to a global variable

Parameters
varIDThe global variable's ID number
Returns
The number of references the Menu makes to the variable

◆ GetZoom()

float AC.Menu.GetZoom ( )

Gets the zoom factor of MenuElements when a Menu is zooming

◆ HandleTransition()

void AC.Menu.HandleTransition ( )

Updates the transition animation. This is called every frame by PlayerMenus.

◆ HasTransition()

bool AC.Menu.HasTransition ( )

Checks if the Menu transitions over time when being enabled or disabled.

Returns
True if the Menu transitions over time

◆ HideInteractions()

void AC.Menu.HideInteractions ( )

Hides all MenuInteraction elements within the Menu.

◆ Initalise()

void AC.Menu.Initalise ( )

Initialises the Menu when the game begins.

◆ IsBlocking()

bool AC.Menu.IsBlocking ( )

Checks if the Menu will pause gameplay when enabled.

Returns
True if the Menu will pause gameplay when enabled.

◆ IsClickable()

bool AC.Menu.IsClickable ( )

If True, the Menu is currently clickable.

Returns
True if the Menu is currently clickable

◆ IsElementSelectableInteractable()

bool AC.Menu.IsElementSelectableInteractable ( int  elementIndex,
int  slotIndex 
)

Checks if an element inside the Menu is currently Interactable (Unity UI menus only).

Parameters
elementIndexThe element's index in elements
slotIndexThe element's slot index, if it has multiple slots
Returns
True if an element inside the Menu is currently Interactable

◆ IsElementSelectedByEventSystem()

bool AC.Menu.IsElementSelectedByEventSystem ( int  elementIndex,
int  slotIndex 
)

Checks if an element inside the Menu is selected by Unity UI's EventSystem (Unity UI menus only).

Parameters
elementIndexThe element's index in elements
slotIndexThe element's slot index, if it has multiple slots
Returns
True if the element is selected by Unity UI's EventSystem.

◆ IsEnabled()

bool AC.Menu.IsEnabled ( )

Checks if the Menu is currently enabled.

Returns
True if the Menu is currently enabled.</return>

◆ IsFading()

bool AC.Menu.IsFading ( )

Checks if the Menu is transitioning in or out.

Returns
True if the Menu is transitioning in or out

◆ IsFadingIn()

bool AC.Menu.IsFadingIn ( )

Checks if the Menu is transitioning in.

Returns
True if the Menu is transitioning in

◆ IsFadingOut()

bool AC.Menu.IsFadingOut ( )

Checks if the Menu is transitioning out.

Returns
True if the Menu is transitioning out

◆ IsManualControlled()

bool AC.Menu.IsManualControlled ( )

Checks if the Menu's enabled state is controlled by either the player or by Actions.

Returns
True if the Menu's enabled state is controlled by either the player or by Actions.

◆ IsOff()

bool AC.Menu.IsOff ( )

Checks if the Menu is fully off or not.

Returns
True if the Menu is fully off.

◆ IsOn()

bool AC.Menu.IsOn ( )

Checks if the Menu is fully on or not.

Returns
True if the Menu is fully on.

◆ IsPointerOverSlot()

bool AC.Menu.IsPointerOverSlot ( MenuElement  _element,
int  slot,
Vector2  _point 
)

Checks if a point in Screen Space within a specific slot of a specific MenuElement.

Parameters
_elementThe MenuElement to check for
slotThe slot to check for
_pointThe point to check is within the MenuElement slot.
Returns
True if the point is within the boundary of the MenuElement slot

◆ IsPointInside()

bool AC.Menu.IsPointInside ( Vector2  _point)

Checks if a point in Screen Space lies within the Menu's boundary.

Parameters
_pointThe point to check for
Returns
True if the point is within the Menu's boundary.

◆ IsUnityUI()

bool AC.Menu.IsUnityUI ( )

Checks if Unity UI is used for the Menu's display, rather than OnGUI.

Returns
True if Unity UI is used for the Menu's display

◆ IsVisible()

bool AC.Menu.IsVisible ( )

Checks if the Menu is fully visible or not.

Returns
True if the Menu is fully visible; False will be returned while midway through a transition.

◆ LoadUnityUI()

void AC.Menu.LoadUnityUI ( bool  addEventListeners = true)

Instantiates and initialises a linked Unity UI Canvas, if Unity UI is used for display.

Parameters
addEventListenersIf True, then event listeners will be added to interactive UI components

◆ MatchInteractions() [1/2]

void AC.Menu.MatchInteractions ( Hotspot  hotspot,
bool  includeInventory 
)

Recalculates a Menu's display for a particular Hotspot.

Parameters
hotspotThe Hotspot to recalculate the Menu's display for
includeInventoryIf True, then InventoryBox elements will also be displayed when appropriate

◆ MatchInteractions() [2/2]

void AC.Menu.MatchInteractions ( InvInstance  invInstance,
bool  includeInventory 
)

Recalculates a Menu's display for a particular inventory item.

Parameters
buttonsThe InvItem to recalculate the Menus's display for
includeInventoryIf True, then InventoryBox elements will also be displayed when appropriate

◆ MatchLookInteraction()

void AC.Menu.MatchLookInteraction ( )

Recalculates a Menu's display for an "Examine" Hotspot Button.

◆ MatchUseInteraction()

void AC.Menu.MatchUseInteraction ( Button  button)

Recalculates a Menu's display for an "Use" Hotspot Button.

Parameters
buttonA Button class to recalculate the Menus's display for

◆ PostScreenshotBackup()

void AC.Menu.PostScreenshotBackup ( )

Re-enables the Menu's canvas if it was disabled to take a screenshot.

◆ PreScreenshotBackup()

void AC.Menu.PreScreenshotBackup ( )

Prepares the Menu for a screenshot by disabling the canvas if it has one.

◆ Recalculate()

void AC.Menu.Recalculate ( )

Recalculates all position, size and display variables - accounting for hidden and re-sized elements. This should be called whenever a Menu's shape is changed.

◆ ReferencesAsset()

bool AC.Menu.ReferencesAsset ( ActionListAsset  actionListAsset)

Checks if the Menu makes reference to a particular ActionList asset

Parameters
actionListAssetThe ActionList to check for
Returns
True if the Menu references the ActionList

◆ ReferencesObjectOrID()

bool AC.Menu.ReferencesObjectOrID ( GameObject  gameObject,
int  id 
)

Checks if the Menu makes reference to a particular GameObject

Parameters
gameObjectThe GameObject to check for
idThe GameObject's associated ConstantID value
Returns
True if the Menu references the GameObject

◆ RefreshDialogueOptions()

void AC.Menu.RefreshDialogueOptions ( )

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

◆ ResetVisibleElements()

void AC.Menu.ResetVisibleElements ( )

Re-populates the visibleElements List with MenuElement subclasses that are visible

◆ Select() [1/2]

void AC.Menu.Select ( MenuElement  elementToSelect,
int  slotIndex = 0 
)

Selects a given element (and optionally, a slot inside it) for direct-controlled menu navigation.

Parameters
elementToSelectThe MenuElement to select
slotIndexThe index number of the slot to select, if the MenuElement has multiple slots

◆ Select() [2/2]

void AC.Menu.Select ( string  elementName,
int  slotIndex = 0 
)

Selects a given element (and optionally, a slot inside it) for direct-controlled menu navigation.

Parameters
elementNameThe name of the MenuElement to select
slotIndexThe index number of the slot to select, if the MenuElement has multiple slots

◆ SetCentre()

void AC.Menu.SetCentre ( Vector2  _position,
bool  useAspectRatio = false 
)

Sets the centre-point of a 2D Menu.

Parameters
_positionThe position in Screen Space to place the Menu's centre.
useAspectRatioIf True, the position co-ordinates are assumed to be relative to the aspect-ratio-corrected screen, as opposed to the entire game window

◆ SetCentre3D()

void AC.Menu.SetCentre3D ( Vector3  _position)

Sets the centre-point of a 3D Menu.

Parameters
_positionThe position in 3D space to place the Menu's centre.

◆ SetDragOffset()

void AC.Menu.SetDragOffset ( Vector2  pos,
Rect  dragRect 
)

Offsets an OnGUI Menu's position when dragged by a MenuDrag element.

Parameters
posThe amoung to offset the position by
dragRectThe boundary limit to keep the Menu within

◆ SetHotspot()

void AC.Menu.SetHotspot ( Hotspot  _hotspot,
InvInstance  _invInstance 
)

Assigns the Menu, and all MenuElement classes within it, to a Hotspot or inventory item.

◆ SetSpeech()

void AC.Menu.SetSpeech ( Speech  _speech)

Assigns the Menu, and all MenuElement classes within it, to a Speech line.

Parameters
_speechThe Speech line to assign to

◆ ShouldTurnOffWhenLoading()

bool AC.Menu.ShouldTurnOffWhenLoading ( )

Checks if the Menu should be automatically turned off when loading a save game, instead of loaded. This is only True if the Menu is manually-controlled and contains a SavesList element.

Returns
True if the Menu should be automatically turned off when loading a save game, instead of loaded.

◆ StartDisplay()

void AC.Menu.StartDisplay ( )

Begins the display of an OnGUI-based Menu.

◆ TurnOff()

bool AC.Menu.TurnOff ( bool  doFade = true)

Turns the Menu off.

Parameters
doFadeIf True, the Menu will play its transition animation; otherwise, it will turn off instantly.
Returns
True if the Menu was turned off. False if the Menu was already off.

◆ TurnOn()

bool AC.Menu.TurnOn ( bool  doFade = true)

Turns the Menu on.

Parameters
doFadeIf True, the Menu will play its transition animation; otherwise, it will turn on instantly.
Returns
True if the Menu was turned on. False if the Menu was already on.

◆ UpdateInteractability()

void AC.Menu.UpdateInteractability ( )

Updates the interactablity state of the UI elements, if the Menu is drawn with Unity UI.

◆ UpdateVariableReferences()

int AC.Menu.UpdateVariableReferences ( int  oldVarID,
int  newVarID 
)

Updates references the Menu makes to a global variable

Parameters
oldVarIDThe global variable's original ID number
newVarIDThe global variable's new ID number
Returns
The number of references the Menu makes to the variable

Member Data Documentation

◆ actionListOnTurnOff

ActionListAsset AC.Menu.actionListOnTurnOff = null

The ActionListAsset to run whenever the Menu is disabled

◆ actionListOnTurnOn

ActionListAsset AC.Menu.actionListOnTurnOn = null

The ActionListAsset to run whenever the Menu is enabled

◆ alignment

TextAnchor AC.Menu.alignment = TextAnchor.MiddleCenter

An OnGUI Menu's alignment type, if positionType = AC_PositionType.Aligned

◆ appearType

AppearType AC.Menu.appearType

The 'rule' that dictates when a Menu is displayed (Manual, MouseOver, DuringConversation, OnInputKey, OnInteraction, OnHotspot, WhenSpeechPlays, DuringGameplay, OnContainer)

◆ autoSelectFirstVisibleElement

bool AC.Menu.autoSelectFirstVisibleElement = false

If True, the first visible Unity UI MenuElement will be automatically selected when the Menu is turned on

◆ autoSizeEveryFrame

bool AC.Menu.autoSizeEveryFrame = false

If True, and sizeType = AC_SizeType.Automatic, then the dimensions of the Menu will be recalculated every frame

◆ backgroundTexture

Texture2D AC.Menu.backgroundTexture

The texture to display in the background

◆ canClickInCutscene

bool AC.Menu.canClickInCutscene = false

If True, then the Menu will be clickable during gameplay-blocking cutscenes

◆ canvasAssetKey

string AC.Menu.canvasAssetKey

The Addressable key for the UI Prefab, if the Addressable system is used

◆ canvasID

int AC.Menu.canvasID = 0

The ConstantID number of the canvas

◆ elements

List<MenuElement> AC.Menu.elements = new List<MenuElement>()

A List of MenuElement subclasses that are drawn within the Menu

◆ enabledOnStart

bool AC.Menu.enabledOnStart = false

If True, and appearType = AppearType.Manual, then the Menu will be enabled when the game begins

◆ fadeSpeed

float AC.Menu.fadeSpeed = 0f

The transition duration, in seconds

◆ firstSelectedElement

string AC.Menu.firstSelectedElement

The name of the Unity UI MenuElement to automatically select when the Menu is turned on

◆ fitWithinScreen

bool AC.Menu.fitWithinScreen = true

If True, the Menu will be positioned such that it is always completely within the screen boundary

◆ forceSubtitles

bool AC.Menu.forceSubtitles = false

If appearType = AppearType.WhenSpeechPlays, the Menu will show regardless of the 'Subtitles' setting in Options

◆ hideDuringSaveScreenshots

bool AC.Menu.hideDuringSaveScreenshots = true

If True, and save-game screenshots are enabled in the SettingsManager, then the Menu will be hidden from view if enabled while a save-game screenshot is being taken

◆ id

int AC.Menu.id

A unique identifier

◆ ignoreMouseClicks

bool AC.Menu.ignoreMouseClicks = false

If True, then mouse clicks will be ineffective

◆ limitToCharacters

string AC.Menu.limitToCharacters = ""

A list of character names that this Menu will show for, if appearType = AppearType.WhenSpeechPlays and speechMenuType = SpeechMenuType.SpecificCharactersOnly

◆ manualPosition

Vector2 AC.Menu.manualPosition = Vector2.zero

An OnGUI Menu's centre point, if positionType = AC_PositionType.Manual

◆ manualSize

Vector2 AC.Menu.manualSize = Vector2.zero

An OnGUI Menu's total size, if sizeType = AC_SizeType.Manual

◆ menuSource

MenuSource AC.Menu.menuSource = MenuSource.AdventureCreator

The source of the Menu's display information (AdventureCreator, UnityUiPrefab, UnityUiInScene)

◆ moveWithCharacter

bool AC.Menu.moveWithCharacter = true

If True, and positionType = PositionType.AboveSpeakingCharacter, and oneMenuPerSpeech = True, then the Menu will update its position every frame

◆ oneMenuPerSpeech

bool AC.Menu.oneMenuPerSpeech = false

If True, then a new instance of the Menu will be created for each speech line, if appearType = AppearType.WhenSpeechPlays

◆ orientation

MenuOrientation AC.Menu.orientation

How OnGUI MenuElements are arranged together (Horizontal, Vertical)

◆ panDirection

PanDirection AC.Menu.panDirection = PanDirection.Up

The pan direction of an OnGUI Menu, if the Menu pans when transitioning

◆ panDistance

float AC.Menu.panDistance = 0.5f

The pan distance of an OnGUI Menu, if the Menu pans when transitioning

◆ panMovement

PanMovement AC.Menu.panMovement = PanMovement.Linear

The pan animation style of an OnGUI Menu, if the Menu pans when transitioning

◆ pauseWhenEnabled

bool AC.Menu.pauseWhenEnabled = false

If True, then the game will be paused whenever the Menu is enabled

◆ positionSmoothing

bool AC.Menu.positionSmoothing = false

If True, and the position is changed during the game, a smoothing effect will be applied

◆ positionType

AC_PositionType AC.Menu.positionType = AC_PositionType.Centred

How an OnGUI Menu is positioned (Centred, Aligned, Manual, FollowCursor, AppearAtCursorAndFreeze, OnHotspot, AboveSpeakingCharacter, AbovePlayer)

◆ rectTransform

RectTransform AC.Menu.rectTransform

A RectTransform that describes the Menu's screen space

◆ rectTransformID

int AC.Menu.rectTransformID = 0

The ConstantID number of the rectTransform

◆ selected_element

MenuElement AC.Menu.selected_element

Which OnGUI MenuElement is currently active, when it is keyboard-controlled

◆ selected_slot

int AC.Menu.selected_slot = 0

Which slot within an OnGUI MenuElement is currently active, when it is keyboard-controlled

◆ showWhenPaused

bool AC.Menu.showWhenPaused = false

If True, and appearType = AppearType.WhenSpeechPlays, the Menu will not be removed when the game is paused

◆ sizeType

AC_SizeType AC.Menu.sizeType

How the size of the OnGUI Menu is determined (AbsolutePixels, Automatic, Manual)

◆ spacing

float AC.Menu.spacing

The spacing between OnGUI MenuElement subclasses, when sizeType = AC_SizeType.Automatic

◆ speech

Speech AC.Menu.speech

The Speech instance tied to the Menu, if a duplicate was made specifically for it

◆ speechMenuLimit

SpeechMenuLimit AC.Menu.speechMenuLimit = SpeechMenuLimit.All

What kind of speech has to play for this Menu to enable, if appearType = AppearType.WhenSpeechPlays (All, BlockingOnly, BackgroundOnly)

◆ speechMenuType

SpeechMenuType AC.Menu.speechMenuType = SpeechMenuType.All

What kind of speaker has to be speaking for this Menu to enable, if appearType = AppearType.WhenSpeechPlays (All, CharactersOnly, NarrationOnly, SpecificCharactersOnly)

◆ speechProximityDistance

float AC.Menu.speechProximityDistance = 10f

The maximum distance to display speech for, if speechProximityLimit != SpeechProximityLimit.NoLimit

◆ speechProximityLimit

SpeechProximityLimit AC.Menu.speechProximityLimit = SpeechProximityLimit.NoLimit

If oneMenuPerSpeech = True, and appearType = AppearType.WhenSpeechPlays, then this determines how the menu is affected by proximity to the speaking character

◆ timeCurve

AnimationCurve AC.Menu.timeCurve = new AnimationCurve (new Keyframe(0, 0), new Keyframe(1, 1))

An AnimationCurve that describes the transition progress over time

◆ title

string AC.Menu.title

A name for the Menu, used in PlayerMenus to identify it

◆ toggleKey

string AC.Menu.toggleKey = ""

The Input axis that toggle the Menu on and off, it appearType = AppearType.OnInputKey

◆ transitionProgress

float AC.Menu.transitionProgress = 0f

The progress made along an in/out transition (0 = off, 1 = on)

◆ transitionType

MenuTransition AC.Menu.transitionType = MenuTransition.None

How an OnGUI Menu transitions in and out (Fade, FadeAndPan, None, Pan, Zoom)

◆ uiPositionType

UIPositionType AC.Menu.uiPositionType = UIPositionType.Manual

The position method for Unity UI-based menus (AbovePlayer, AboveSpeakingCharacter, AppearAtCursorAndFreeze, FollowCursor, Manual, OnHotspot)

◆ uiTransitionType

UITransition AC.Menu.uiTransitionType = UITransition.None

The transition method for Unity UI-based menus (None, CanvasGroupFade, CustomAnimation)

◆ updateWhenFadeOut

bool AC.Menu.updateWhenFadeOut = true

If True, the Menu will update while fading out

◆ visibleElements

List<MenuElement> AC.Menu.visibleElements = new List<MenuElement>()

A List of MenuElement subclasses that are currently visible

◆ zoomAnchor

TextAnchor AC.Menu.zoomAnchor = TextAnchor.MiddleCenter

The zoom alignment, if transitionType = MenuTransitio.Zoom

◆ zoomElements

bool AC.Menu.zoomElements = false

If True, then MenuElement subclasses will also re-size during zoom transitions

Property Documentation

◆ HasMoved

bool AC.Menu.HasMoved
get

True if the Menu has been repositioned

◆ HotspotLabelData

HotspotLabelData AC.Menu.HotspotLabelData
get

Data related to the Menu's current Hotspot label

◆ ID

int AC.Menu.ID
getset

The Menu's id number, which is a unique identifier.

◆ isLocked

bool AC.Menu.isLocked
getset

Gets/Sets the Menu's lock state. If a Menu is locked, it will not be shown when its 'Appear type' condition is met. If this is set to True, the Menu will be automatically turned off

◆ NumElements

int AC.Menu.NumElements
get

The number of elements in the Menu.

◆ OnAmount

float AC.Menu.OnAmount
get

The progression through the Menu's transition animation (0 = fully off, 1 = fully on)

◆ PositionOffset

Vector2 AC.Menu.PositionOffset
set

An offset to apply to all reposition calls

◆ PrefabCanvas

Canvas AC.Menu.PrefabCanvas
getset

If a Menu links to Unity UI, the linked Canvas prefab

◆ RuntimeCanvas

Canvas AC.Menu.RuntimeCanvas
get

The in-scene instance of the linked Canvas at runtime

◆ TargetHotspot

Hotspot AC.Menu.TargetHotspot
get

The Hotspot that an interaction Menu was recalculated for.

◆ TargetInvInstance

InvInstance AC.Menu.TargetInvInstance
get

The inventory item instance that an interaction Menu was recalculated for.