Adventure Creator  1.79.1
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2022
AC.MenuElement Class Reference
Inheritance diagram for AC.MenuElement:
AC.MenuButton AC.MenuCrafting AC.MenuCycle AC.MenuDialogList AC.MenuDrag AC.MenuGraphic AC.MenuInput AC.MenuInteraction AC.MenuInventoryBox AC.MenuJournal AC.MenuLabel AC.MenuProfilesList AC.MenuSavesList AC.MenuSlider AC.MenuTimer AC.MenuToggle

Public Member Functions

virtual void Declare ()
 
virtual MenuElement DuplicateSelf (bool fromEditor, bool ignoreUnityUI)
 Creates and returns a new MenuElement that has the same values as itself. More...
 
virtual void Copy (MenuElement _element)
 Copies the values of another MenuElement onto itself. More...
 
virtual void Initialise (AC.Menu _menu)
 Performs any initialisation that can only be done once the element has been instantiated at runtime. More...
 
virtual void LoadUnityUI (AC.Menu _menu, Canvas canvas, bool addEventListeners=true)
 Initialises the linked Unity UI GameObject. More...
 
virtual bool ProcessClick (AC.Menu _menu, int _slot, MouseState _mouseState)
 Performs what should happen when the element is clicked on. More...
 
virtual bool ProcessContinuousClick (AC.Menu _menu, MouseState _mouseState)
 Performs what should happen when the element is clicked on continuously. More...
 
virtual GameObject GetObjectToSelect (int slotIndex=0)
 Gets the linked Unity UI GameObject associated with this element. More...
 
virtual RectTransform GetRectTransform (int _slot)
 Gets the boundary of the element, or a slot within it. More...
 
virtual void SetSpeech (Speech _speech)
 Assigns the element to a specific Speech line. More...
 
virtual void ClearSpeech ()
 
void UpdateID (int[] idArray)
 Updates the ID number to something unique. More...
 
virtual void OverrideLabel (string newLabel, int _lineID=-1)
 
void UpdateLabel (int languageNumber)
 
virtual string GetLabel (int slot, int languageNumber)
 Gets the display text of the element, or a slot within it. More...
 
virtual bool IsSelectedByEventSystem (int slotIndex)
 Checks if the element is selected by Unity UI's EventSystem (if the Menu is Unity UI-based). More...
 
virtual bool IsSelectableInteractable (int slotIndex)
 Checks if the element's linked Selectable is currently Interactable (if the Menu is Unity UI-based). More...
 
void ShowGUIStart (Menu menu)
 
virtual void ShowGUI (Menu menu)
 
virtual bool CheckConvertGlobalVariableToLocal (int oldGlobalID, int newLocalID)
 Checks if the Element makes references from a given global variable to a given local variable More...
 
virtual int GetVariableReferences (int varID)
 Gets the number of references the MenuElement makes to a global variable More...
 
virtual int UpdateVariableReferences (int oldVarID, int newVarID)
 Updates references the MenuElement makes to a global variable More...
 
virtual bool ReferencesAsset (ActionListAsset actionListAsset)
 Checks if the Menu makes reference to a particular ActionList asset More...
 
virtual bool ReferencesObjectOrID (GameObject gameObject, int id)
 Checks if the Element makes reference to a particular GameObject More...
 
virtual int GetSlotIndex (GameObject gameObject)
 Gets the slot index that reference a particular GameObject More...
 
virtual void HideAllUISlots ()
 
virtual string GetHotspotLabelOverride (int _slot, int _language)
 Gets a string that overrides the default 'hotspot label'. More...
 
virtual void PreDisplay (int _slot, int languageNumber, bool isActive)
 Performs all calculations necessary to display the element. More...
 
virtual void Display (GUIStyle _style, int _slot, float zoom, bool isActive)
 Draws the element using OnGUI. More...
 
virtual void DrawOutline (bool isSelected, AC.Menu _menu)
 Draws an outline around the element. More...
 
Vector2[] GetSlotCentres (AC.Menu _menu)
 Gets the element's slot centres, as an array of Vector2s. This is used when keyboard-navigating menus More...
 
virtual void Shift (AC_ShiftInventory shiftType, int amount)
 Shifts which slots are on display, if the number of slots the element has exceeds the number of slots it can show at once. More...
 
virtual bool CanBeShifted (AC_ShiftInventory shiftType)
 Checks if the element's slots can be shifted in a particular direction. More...
 
Vector2 GetSize ()
 Gets the size of the whole element. More...
 
Vector2 GetSizeFromCorner ()
 Gets the Vector2 from the top-left corner of the parent Menu to the bottom-right corner of the element. More...
 
void SetSize (Vector2 _size)
 Sets the size of an individual slot. More...
 
int GetNumSlots ()
 Gets the number of display slots the element has. This is not the maximum number of slots that can be shown by shifting - it is the number of slots that are shown at any one time. More...
 
Rect GetSlotRectRelative (int _slot)
 Gets the boundary of a slot, as a proportion of the screen size. More...
 
virtual void RecalculateSize (MenuSource source)
 Recalculates the element's size. This should be called whenever a Menu's shape is changed. More...
 
int GetFontSize ()
 Gets the size of the font. More...
 
void SetPosition (Vector2 _position)
 Sets the element's position. More...
 
void SetRelativePosition (Vector2 _size)
 
void ResetDragOffset ()
 
void SetDragOffset (Vector2 pos, Rect dragRect)
 Offsets an OnGUI MenuElement's position when dragged by a MenuDrag element. More...
 
Vector2 GetDragStart ()
 Gets the drag offset. More...
 
void AutoSetVisibility ()
 
virtual void SetUIInteractableState (bool state)
 Sets the interactive state of any linked Unity UI gameobjects. More...
 
virtual AudioClip GetHoverSound (int slot)
 Gets the hover sound for the element slot. More...
 
int GetOffset ()
 Gets the amount by which the slots have been offset, if the number that can be shown exceeds the number that can be display at once. More...
 
void SetOffset (int value)
 Sets the amount by which the slots have been offset, if the number that can be shown exceeds the number that can be display at once. More...
 
virtual void OnMenuTurnOn (Menu menu)
 Called whenever the Menu this is attached to is turned on. More...
 
string GetVisibilitySaveData ()
 
override string ToString ()
 

Public Attributes

int ID
 
string title = "Element"
 
Vector2 slotSize
 
AC_SizeType sizeType
 
AC_PositionType2 positionType
 
float slotSpacing = 0f
 
int lineID = -1
 
string alternativeInputButton = ""
 
Font font
 
float fontScaleFactor = 60f
 
Color fontColor = Color.white
 
Color fontHighlightColor = Color.white
 
bool isClickable
 
ElementOrientation orientation = ElementOrientation.Vertical
 
int gridWidth = 3
 
Texture2D backgroundTexture
 
bool singleSlotBackgrounds = false
 
Texture2D highlightTexture
 
AudioClip hoverSound
 
AudioClip clickSound
 
bool changeCursor = false
 
int cursorID = 0
 
int linkedUiID
 
float maxAutoWidthFactor = 0.5f
 

Protected Member Functions

void CreateUIEvent (UnityEngine.UI.Button uiButton, AC.Menu _menu, UIPointerState uiPointerState=UIPointerState.PointerClick, int _slotIndex=0, bool liveState=true)
 
void CreateHoverSoundHandler (Selectable selectable, AC.Menu _menu, int _slotIndex=0)
 
virtual void ProcessClickUI (AC.Menu _menu, int _slot, MouseState _mouseState)
 
virtual string GetLabelToTranslate ()
 
void ClearCache ()
 
string TranslateLabel (int languageNumber)
 
virtual void ShowTextGUI (string apiPrefix)
 
virtual void ShowTextureGUI (string apiPrefix)
 
void EndGUI (string apiPrefix)
 
void ShowClipHelp ()
 
LinkedUiGUI< T > (T field, string label, MenuSource source, string tooltip="")
 
UISlot[] ResizeUISlots (UISlot[] uiSlots, int maxSlots)
 
void ChangeCursorGUI (Menu menu)
 
void LimitUISlotVisibility (UISlot[] uiSlots, int _numSlots, UIHideStyle uiHideStyle, Texture emptyTexture=null)
 
void LimitUISlotVisibility (UISlot[] uiSlots, int _numSlots, UISelectableHideStyle uiHideStyle)
 
Rect ZoomRect (Rect rect, float zoom)
 
void LimitOffset ()
 
void Shift (AC_ShiftInventory shiftType, int maxSlots, int arraySize, int amount)
 
void SetAbsoluteSize (Vector2 _size)
 
void AutoSize (GUIContent content)
 
virtual void AutoSize ()
 
void LinkUIElement< T > (Canvas canvas, ref T existingField)
 
void UpdateUISelectable< T > (T field, UISelectableHideStyle uiSelectableHideStyle)
 
void UpdateUIElement< T > (T field)
 
void ClearSpriteCache (UISlot[] uiSlots)
 
void SetUISlotsInteractableState (UISlot[] uiSlots, bool state)
 

Protected Attributes

bool isVisible = true
 
int offset = 0
 
Menu parentMenu
 
Rect relativeRect
 
Vector2 relativePosition
 
int numSlots
 

Properties

virtual bool IsVisible [get, set]
 
virtual int MaxSlotsForOffset [get]
 
Menu ParentMenu [get]
 

Detailed Description

The base class for all elements that sit inside a Menu. It should never be added itself to a menu, as it is only a container of shared data. Like Menus, MenuElements can be drawn either through OnGUI calls, or with Unity's UI system. Elements can consist multiple "slots" that are arranged together. If an element has only one slot, then the slot and element are interchangeable so far as display goes.

Member Function Documentation

◆ AutoSetVisibility()

void AC.MenuElement.AutoSetVisibility ( )

Hides any elements that have zero slots.

◆ CanBeShifted()

virtual bool AC.MenuElement.CanBeShifted ( AC_ShiftInventory  shiftType)
virtual

Checks if the element's slots can be shifted in a particular direction.

Parameters
shiftTypeThe direction to shift slots in (Left, Right)
Returns
True if the element's slots can be shifted in the particular direction

Reimplemented in AC.MenuInventoryBox, AC.MenuSavesList, AC.MenuJournal, AC.MenuDialogList, AC.MenuInteraction, and AC.MenuProfilesList.

◆ CheckConvertGlobalVariableToLocal()

virtual bool AC.MenuElement.CheckConvertGlobalVariableToLocal ( int  oldGlobalID,
int  newLocalID 
)
virtual

Checks if the Element makes references from a given global variable to a given local variable

Parameters
oldGlobalIDThe ID number of the old global variable
newLocalIDThe ID number of the new local variable
Returns
True if the Element was affected

Reimplemented in AC.MenuCycle, AC.MenuJournal, AC.MenuButton, AC.MenuSlider, AC.MenuLabel, and AC.MenuToggle.

◆ ClearSpeech()

virtual void AC.MenuElement.ClearSpeech ( )
virtual

Clears any speech text on display.

Reimplemented in AC.MenuLabel, and AC.MenuGraphic.

◆ Copy()

virtual void AC.MenuElement.Copy ( MenuElement  _element)
virtual

Copies the values of another MenuElement onto itself.

Parameters
_elementThe MenuElement to copy values from

◆ Declare()

◆ Display()

virtual void AC.MenuElement.Display ( GUIStyle  _style,
int  _slot,
float  zoom,
bool  isActive 
)
virtual

Draws the element using OnGUI.

Parameters
_styleThe GUIStyle to draw with
_slotThe index number of the slot to display
zoomThe zoom factor
isActiveIf True, then the element will be drawn as though highlighted

Reimplemented in AC.MenuInventoryBox, AC.MenuSavesList, AC.MenuLabel, AC.MenuCycle, AC.MenuJournal, AC.MenuDialogList, AC.MenuButton, AC.MenuInteraction, AC.MenuCrafting, AC.MenuProfilesList, AC.MenuSlider, AC.MenuToggle, AC.MenuGraphic, AC.MenuTimer, AC.MenuInput, and AC.MenuDrag.

◆ DrawOutline()

virtual void AC.MenuElement.DrawOutline ( bool  isSelected,
AC.Menu  _menu 
)
virtual

Draws an outline around the element.

Parameters
isSelectedIf True, a different-coloured outline will be used to differentiate it from others
_menuThe element's parent Menu

Reimplemented in AC.MenuDrag.

◆ DuplicateSelf()

virtual MenuElement AC.MenuElement.DuplicateSelf ( bool  fromEditor,
bool  ignoreUnityUI 
)
virtual

Creates and returns a new MenuElement that has the same values as itself.

Parameters
fromEditorIf True, the duplication was done within the Menu Manager and not as part of the gameplay initialisation.
ignoreUnityUIIf True, variables associated with Unity UI will not be transferred
Returns
A new MenuElement with the same values as itself

Reimplemented in AC.MenuInventoryBox, AC.MenuButton, AC.MenuSavesList, AC.MenuCycle, AC.MenuLabel, AC.MenuToggle, AC.MenuDialogList, AC.MenuSlider, AC.MenuInteraction, AC.MenuJournal, AC.MenuCrafting, AC.MenuInput, AC.MenuProfilesList, AC.MenuGraphic, AC.MenuTimer, and AC.MenuDrag.

◆ GetDragStart()

Vector2 AC.MenuElement.GetDragStart ( )

Gets the drag offset.

Returns
The drag offset

◆ GetFontSize()

int AC.MenuElement.GetFontSize ( )

Gets the size of the font.

Returns
The size of the font

◆ GetHotspotLabelOverride()

virtual string AC.MenuElement.GetHotspotLabelOverride ( int  _slot,
int  _language 
)
virtual

Gets a string that overrides the default 'hotspot label'.

Parameters
_slotThe index number of the slot to get an override label for
_languageThe index number of the language to display text in
Returns
A string that overrides the default 'hotspot label'. If empty, the default will not be overridden.

Reimplemented in AC.MenuInteraction, AC.MenuInventoryBox, AC.MenuButton, AC.MenuCrafting, and AC.MenuDialogList.

◆ GetHoverSound()

virtual AudioClip AC.MenuElement.GetHoverSound ( int  slot)
virtual

Gets the hover sound for the element slot.

Parameters
slotThe slots index number
Returns
Tover sound for the element slot.

Reimplemented in AC.MenuInventoryBox.

◆ GetLabel()

virtual string AC.MenuElement.GetLabel ( int  slot,
int  languageNumber 
)
virtual

Gets the display text of the element, or a slot within it.

Parameters
slotThe index number of the slot to get text for
languageNumberThe index number of the language number to get the text in
Returns
The display text of the element's slot, or the whole element if it only has one slot

Reimplemented in AC.MenuDialogList, AC.MenuLabel, AC.MenuCycle, AC.MenuInteraction, AC.MenuJournal, AC.MenuSlider, AC.MenuButton, AC.MenuToggle, AC.MenuProfilesList, AC.MenuInput, AC.MenuDrag, AC.MenuInventoryBox, AC.MenuCrafting, and AC.MenuSavesList.

◆ GetNumSlots()

int AC.MenuElement.GetNumSlots ( )

Gets the number of display slots the element has. This is not the maximum number of slots that can be shown by shifting - it is the number of slots that are shown at any one time.

Returns
The number of display slots the element has

◆ GetObjectToSelect()

virtual GameObject AC.MenuElement.GetObjectToSelect ( int  slotIndex = 0)
virtual

Gets the linked Unity UI GameObject associated with this element.

Parameters
slotIndexThe slot index, if the element has multiple slots
Returns
The Unity UI GameObject associated with the element

Reimplemented in AC.MenuInventoryBox, AC.MenuCycle, AC.MenuButton, AC.MenuSavesList, AC.MenuDialogList, AC.MenuInteraction, AC.MenuToggle, AC.MenuSlider, AC.MenuCrafting, AC.MenuInput, and AC.MenuProfilesList.

◆ GetOffset()

int AC.MenuElement.GetOffset ( )

Gets the amount by which the slots have been offset, if the number that can be shown exceeds the number that can be display at once.

Returns
The amount by which the slots have been offset

◆ GetRectTransform()

virtual RectTransform AC.MenuElement.GetRectTransform ( int  _slot)
virtual

Gets the boundary of the element, or a slot within it.

Parameters
_slotThe index number of the slot to get the boundary of
Returns
The boundary Rect of the slot. If the element doesn't have multiple slots, the boundary of the whole element will be returned.

Reimplemented in AC.MenuInventoryBox, AC.MenuCycle, AC.MenuButton, AC.MenuInteraction, AC.MenuSavesList, AC.MenuDialogList, AC.MenuToggle, AC.MenuSlider, AC.MenuCrafting, AC.MenuJournal, AC.MenuProfilesList, AC.MenuLabel, AC.MenuInput, AC.MenuGraphic, and AC.MenuTimer.

◆ GetSize()

Vector2 AC.MenuElement.GetSize ( )

Gets the size of the whole element.

Returns
The size of the whole element

◆ GetSizeFromCorner()

Vector2 AC.MenuElement.GetSizeFromCorner ( )

Gets the Vector2 from the top-left corner of the parent Menu to the bottom-right corner of the element.

Returns
The Vector2 from the top-left corner of the parent Menu to the bottom-right corner of the element.

◆ GetSlotCentres()

Vector2 [] AC.MenuElement.GetSlotCentres ( AC.Menu  _menu)

Gets the element's slot centres, as an array of Vector2s. This is used when keyboard-navigating menus

Parameters
_menuThe parent Menu
Returns
The element's slot centres, as an array of Vector2s.

◆ GetSlotIndex()

virtual int AC.MenuElement.GetSlotIndex ( GameObject  gameObject)
virtual

Gets the slot index that reference a particular GameObject

Parameters
gameObjectThe GameObject to check for
Returns
The slot index that references the GameObject

Reimplemented in AC.MenuInventoryBox, AC.MenuSavesList, AC.MenuCycle, AC.MenuJournal, AC.MenuButton, AC.MenuInteraction, AC.MenuSlider, AC.MenuLabel, AC.MenuDialogList, AC.MenuCrafting, AC.MenuToggle, AC.MenuProfilesList, AC.MenuInput, AC.MenuTimer, and AC.MenuGraphic.

◆ GetSlotRectRelative()

Rect AC.MenuElement.GetSlotRectRelative ( int  _slot)

Gets the boundary of a slot, as a proportion of the screen size.

Parameters
_slotThe slot to get the boundary for
Returns
The boundary of a slot, as a proportion of the screen size.

◆ GetVariableReferences()

virtual int AC.MenuElement.GetVariableReferences ( int  varID)
virtual

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

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

Reimplemented in AC.MenuButton, AC.MenuSavesList, AC.MenuCycle, AC.MenuJournal, AC.MenuSlider, AC.MenuLabel, and AC.MenuToggle.

◆ GetVisibilitySaveData()

string AC.MenuElement.GetVisibilitySaveData ( )

Gets the data related to the element's visiblity as a serialized string

◆ HideAllUISlots()

virtual void AC.MenuElement.HideAllUISlots ( )
virtual

Hides all linked Unity UI GameObjects associated with the element.

Reimplemented in AC.MenuSavesList, AC.MenuInventoryBox, AC.MenuCrafting, AC.MenuDialogList, and AC.MenuProfilesList.

◆ Initialise()

virtual void AC.MenuElement.Initialise ( AC.Menu  _menu)
virtual

Performs any initialisation that can only be done once the element has been instantiated at runtime.

Parameters
_menuThe Menu that the elemnt is a part of.

Reimplemented in AC.MenuButton, and AC.MenuJournal.

◆ IsSelectableInteractable()

virtual bool AC.MenuElement.IsSelectableInteractable ( int  slotIndex)
virtual

Checks if the element's linked Selectable is currently Interactable (if the Menu is Unity UI-based).

Parameters
slotIndexThe element's slot index, if it has multiple slots
Returns
True if the element's linked Selectable is currently Interactable

Reimplemented in AC.MenuInventoryBox, AC.MenuCrafting, AC.MenuDialogList, AC.MenuCycle, AC.MenuInteraction, AC.MenuSavesList, AC.MenuSlider, AC.MenuButton, AC.MenuToggle, AC.MenuProfilesList, and AC.MenuInput.

◆ IsSelectedByEventSystem()

virtual bool AC.MenuElement.IsSelectedByEventSystem ( int  slotIndex)
virtual

Checks if the element is selected by Unity UI's EventSystem (if the Menu is Unity UI-based).

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

Reimplemented in AC.MenuInventoryBox, AC.MenuCrafting, AC.MenuDialogList, AC.MenuCycle, AC.MenuInteraction, AC.MenuSavesList, AC.MenuSlider, AC.MenuButton, AC.MenuToggle, AC.MenuProfilesList, and AC.MenuInput.

◆ LoadUnityUI()

virtual void AC.MenuElement.LoadUnityUI ( AC.Menu  _menu,
Canvas  canvas,
bool  addEventListeners = true 
)
virtual

Initialises the linked Unity UI GameObject.

Parameters
_menuThe element's parent Menu
canvasThe runtime Canvas associated with the Menu
addEventListenersIf True, then event listeners should be added to the UI's Interactive component(s)

Reimplemented in AC.MenuInventoryBox, AC.MenuButton, AC.MenuSavesList, AC.MenuDialogList, AC.MenuCycle, AC.MenuJournal, AC.MenuLabel, AC.MenuInteraction, AC.MenuToggle, AC.MenuCrafting, AC.MenuSlider, AC.MenuProfilesList, AC.MenuInput, AC.MenuGraphic, and AC.MenuTimer.

◆ OnMenuTurnOn()

virtual void AC.MenuElement.OnMenuTurnOn ( Menu  menu)
virtual

Called whenever the Menu this is attached to is turned on.

Parameters
menuThe Menu this is attached to

Reimplemented in AC.MenuInventoryBox, AC.MenuCycle, AC.MenuDialogList, AC.MenuInteraction, AC.MenuJournal, AC.MenuLabel, AC.MenuGraphic, and AC.MenuTimer.

◆ PreDisplay()

virtual void AC.MenuElement.PreDisplay ( int  _slot,
int  languageNumber,
bool  isActive 
)
virtual

Performs all calculations necessary to display the element.

Parameters
_slotThe index number of the slot to display
languageNumberThe index number of the language to display text in
isActiveIf True, then the element will be drawn as though highlighted

Reimplemented in AC.MenuInventoryBox, AC.MenuSavesList, AC.MenuCycle, AC.MenuJournal, AC.MenuButton, AC.MenuInteraction, AC.MenuProfilesList, AC.MenuLabel, AC.MenuSlider, AC.MenuCrafting, AC.MenuDialogList, AC.MenuToggle, AC.MenuInput, AC.MenuGraphic, AC.MenuTimer, and AC.MenuDrag.

◆ ProcessClick()

virtual bool AC.MenuElement.ProcessClick ( AC.Menu  _menu,
int  _slot,
MouseState  _mouseState 
)
virtual

Performs what should happen when the element is clicked on.

Parameters
_menuThe element's parent Menu
_slotThe index number of the slot that was clicked on
_mouseStateThe state of the mouse button
Returns
True if the click had an effect, and so should be consumed

Reimplemented in AC.MenuInventoryBox, AC.MenuCrafting, AC.MenuSavesList, AC.MenuInteraction, AC.MenuDialogList, AC.MenuCycle, AC.MenuSlider, AC.MenuButton, AC.MenuToggle, AC.MenuInput, AC.MenuProfilesList, and AC.MenuDrag.

◆ ProcessContinuousClick()

virtual bool AC.MenuElement.ProcessContinuousClick ( AC.Menu  _menu,
MouseState  _mouseState 
)
virtual

Performs what should happen when the element is clicked on continuously.

Parameters
_menuThe element's parent Menu
_mouseStateThe state of the mouse button
Returns
True if the click has an effect

Reimplemented in AC.MenuSlider, and AC.MenuButton.

◆ RecalculateSize()

virtual void AC.MenuElement.RecalculateSize ( MenuSource  source)
virtual

Recalculates the element's size. This should be called whenever a Menu's shape is changed.

Parameters
sourceHow the parent Menu is displayed (AdventureCreator, UnityUiPrefab, UnityUiInScene)

Reimplemented in AC.MenuInventoryBox, AC.MenuSavesList, AC.MenuCycle, AC.MenuInteraction, AC.MenuCrafting, AC.MenuDialogList, AC.MenuButton, AC.MenuProfilesList, AC.MenuInput, and AC.MenuGraphic.

◆ ReferencesAsset()

virtual bool AC.MenuElement.ReferencesAsset ( ActionListAsset  actionListAsset)
virtual

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

Reimplemented in AC.MenuInventoryBox, AC.MenuSavesList, AC.MenuCycle, AC.MenuJournal, AC.MenuButton, AC.MenuSlider, AC.MenuToggle, AC.MenuCrafting, and AC.MenuProfilesList.

◆ ReferencesObjectOrID()

virtual bool AC.MenuElement.ReferencesObjectOrID ( GameObject  gameObject,
int  id 
)
virtual

Checks if the Element makes reference to a particular GameObject

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

Reimplemented in AC.MenuInventoryBox, AC.MenuSavesList, AC.MenuCycle, AC.MenuJournal, AC.MenuButton, AC.MenuSlider, AC.MenuLabel, AC.MenuInteraction, AC.MenuDialogList, AC.MenuCrafting, AC.MenuToggle, AC.MenuProfilesList, AC.MenuInput, AC.MenuTimer, and AC.MenuGraphic.

◆ ResetDragOffset()

void AC.MenuElement.ResetDragOffset ( )

Resets the offset by which an element has been moved by dragging.

◆ SetDragOffset()

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

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

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

◆ SetOffset()

void AC.MenuElement.SetOffset ( int  value)

Sets the amount by which the slots have been offset, if the number that can be shown exceeds the number that can be display at once.

Parameters
valueThe amount by which the slots have been offset

◆ SetPosition()

void AC.MenuElement.SetPosition ( Vector2  _position)

Sets the element's position.

Parameters
_positionThe new position

◆ SetRelativePosition()

void AC.MenuElement.SetRelativePosition ( Vector2  _size)

Sets the element's position, if positionType = AC_PositionType2.RelativeToMenuSize.

Parameters
_sizeThe size of the parent Menu

◆ SetSize()

void AC.MenuElement.SetSize ( Vector2  _size)

Sets the size of an individual slot.

Parameters
_sizeThe new size of an individual slot

◆ SetSpeech()

virtual void AC.MenuElement.SetSpeech ( Speech  _speech)
virtual

Assigns the element to a specific Speech line.

Parameters
_speechThe Speech line to assign the element to

Reimplemented in AC.MenuLabel, and AC.MenuGraphic.

◆ SetUIInteractableState()

virtual void AC.MenuElement.SetUIInteractableState ( bool  state)
virtual

Sets the interactive state of any linked Unity UI gameobjects.

Parameters
stateIf True, linked UI gameobjects will be made interactive. If False, they will be made non-interactive

Reimplemented in AC.MenuInventoryBox, AC.MenuCycle, AC.MenuButton, AC.MenuInteraction, AC.MenuSavesList, AC.MenuDialogList, AC.MenuToggle, AC.MenuSlider, AC.MenuCrafting, AC.MenuProfilesList, and AC.MenuInput.

◆ Shift()

virtual void AC.MenuElement.Shift ( AC_ShiftInventory  shiftType,
int  amount 
)
virtual

Shifts which slots are on display, if the number of slots the element has exceeds the number of slots it can show at once.

Parameters
shiftTypeThe direction to shift slots in (Left, Right)
amountThe amount to shift slots by

Reimplemented in AC.MenuInventoryBox, AC.MenuSavesList, AC.MenuDialogList, AC.MenuInteraction, and AC.MenuProfilesList.

◆ UpdateID()

void AC.MenuElement.UpdateID ( int[]  idArray)

Updates the ID number to something unique.

Parameters
idArrayAn array of existing ID numbers, used to determine a new unique one

◆ UpdateVariableReferences()

virtual int AC.MenuElement.UpdateVariableReferences ( int  oldVarID,
int  newVarID 
)
virtual

Updates references the MenuElement makes to a global variable

Parameters
varIDThe global variable's original ID number
varIDThe global variable's new ID number
Returns
The number of references the MenuElement makes to the variable

Reimplemented in AC.MenuSavesList, AC.MenuCycle, AC.MenuJournal, AC.MenuButton, AC.MenuSlider, AC.MenuLabel, and AC.MenuToggle.

Member Data Documentation

◆ alternativeInputButton

string AC.MenuElement.alternativeInputButton = ""

The name of the input button that triggers the element when pressed

◆ backgroundTexture

Texture2D AC.MenuElement.backgroundTexture

A texture to display underneath the element text

◆ changeCursor

bool AC.MenuElement.changeCursor = false

If True, then the mouse cursor will change when it hovers over the element

◆ clickSound

AudioClip AC.MenuElement.clickSound

The sound to play when the element is clicked on

◆ cursorID

int AC.MenuElement.cursorID = 0

The ID number of the cursor (in CursorManager's cursorIcons) to display when the mouse hovers of the element, if changeCursor = True

◆ font

Font AC.MenuElement.font

The text font (OnGUI only)

◆ fontColor

Color AC.MenuElement.fontColor = Color.white

The font colour (OnGUI only)

◆ fontHighlightColor

Color AC.MenuElement.fontHighlightColor = Color.white

The font colour when the element is highlighted (OnGUI only)

◆ fontScaleFactor

float AC.MenuElement.fontScaleFactor = 60f

The font size (OnGUI only)

◆ gridWidth

int AC.MenuElement.gridWidth = 3

The number of columns in a grid, if orientation = ElementOrientation.Grid

◆ highlightTexture

Texture2D AC.MenuElement.highlightTexture

The texture to overlay when the element is highlighted (OnGUI only)

◆ hoverSound

AudioClip AC.MenuElement.hoverSound

The sound to play when the mouse cursor hovers over the element

◆ ID

int AC.MenuElement.ID

A unique identifier

◆ isClickable

bool AC.MenuElement.isClickable

If True, then the element is interactive

◆ isVisible

bool AC.MenuElement.isVisible = true
protected

If True, the element is enabled and visible

◆ lineID

int AC.MenuElement.lineID = -1

The translation ID, as set within SpeechManager

◆ linkedUiID

int AC.MenuElement.linkedUiID

The ConstantID number of its GameObject counterpart (Unity UI only)

◆ maxAutoWidthFactor

float AC.MenuElement.maxAutoWidthFactor = 0.5f

If an AC element and set to scale automatically, how much of the width of the screen it can cover

◆ orientation

ElementOrientation AC.MenuElement.orientation = ElementOrientation.Vertical

How slots are arranged, if there are multiple (Horizontal, Vertical, Grid)

◆ positionType

AC_PositionType2 AC.MenuElement.positionType

How an OnGUI element is positioned (AbsolutePixels, Aligned, RelativeToMenuSize)

◆ singleSlotBackgrounds

bool AC.MenuElement.singleSlotBackgrounds = false

If True, and the element has more than one slot, then each slot will have its own background texture - as opposed to a single background texture that spans the whole element

◆ sizeType

AC_SizeType AC.MenuElement.sizeType

How an OnGUI element is scaled (AbsolutePixels, Automatic, Manual)

◆ slotSize

Vector2 AC.MenuElement.slotSize

The size of a single OnGUI slot

◆ slotSpacing

float AC.MenuElement.slotSpacing = 0f

The spacing between slots (OnGUI only)

◆ title

string AC.MenuElement.title = "Element"

A text identifier, used by PlayerMenus

Property Documentation

◆ IsVisible

virtual bool AC.MenuElement.IsVisible
getset

If True, then the element is visible