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

Public Member Functions

override void Declare ()
 
override MenuElement DuplicateSelf (bool fromEditor, bool ignoreUnityUI)
 Creates and returns a new MenuElement that has the same values as itself. More...
 
override void HideAllUISlots ()
 
override void LoadUnityUI (AC.Menu _menu, Canvas canvas, bool addEventListeners=true)
 Initialises the linked Unity UI GameObject. More...
 
override GameObject GetObjectToSelect (int slotIndex=0)
 Gets the linked Unity UI GameObject associated with this element. More...
 
override RectTransform GetRectTransform (int _slot)
 Gets the boundary of the element, or a slot within it. More...
 
override void SetUIInteractableState (bool state)
 Sets the interactive state of any linked Unity UI gameobjects. More...
 
override void ShowGUI (Menu menu)
 
override bool ReferencesObjectOrID (GameObject gameObject, int id)
 Checks if the Element makes reference to a particular GameObject More...
 
override int GetSlotIndex (GameObject gameObject)
 Gets the slot index that reference a particular GameObject More...
 
override string GetHotspotLabelOverride (int _slot, int _language)
 Gets a string that overrides the default 'hotspot label'. More...
 
override void PreDisplay (int _slot, int languageNumber, bool isActive)
 Performs all calculations necessary to display the element. More...
 
override void Display (GUIStyle _style, int _slot, float zoom, bool isActive)
 Draws the element using OnGUI. More...
 
override void RecalculateSize (MenuSource source)
 Recalculates the element's size. This should be called whenever a Menu's shape is changed. More...
 
override 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...
 
override bool CanBeShifted (AC_ShiftInventory shiftType)
 Checks if the element's slots can be shifted in a particular direction. More...
 
override void OnMenuTurnOn (Menu menu)
 Called whenever the Menu this is attached to is turned on. More...
 
override string GetLabel (int slot, int languageNumber)
 Gets the display text of the element, or a slot within it. More...
 
override bool IsSelectedByEventSystem (int slotIndex)
 Checks if the element is selected by Unity UI's EventSystem (if the Menu is Unity UI-based). More...
 
override bool IsSelectableInteractable (int slotIndex)
 Checks if the element's linked Selectable is currently Interactable (if the Menu is Unity UI-based). More...
 
override bool ProcessClick (AC.Menu _menu, int _slot, MouseState _mouseState)
 Performs what should happen when the element is clicked on. More...
 
ButtonDialog GetDialogueOption (int slotIndex)
 Gets a ButtonDialog data-container class for a dialogue option within the active Conversation More...
 
- Public Member Functions inherited from AC.MenuElement
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 bool ProcessContinuousClick (AC.Menu _menu, MouseState _mouseState)
 Performs what should happen when the element is clicked on continuously. 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)
 
void ShowGUIStart (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 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...
 
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...
 
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 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...
 
string GetVisibilitySaveData ()
 
override string ToString ()
 

Public Attributes

UISlot[] uiSlots
 
TextEffects textEffects
 
float outlineSize = 2f
 
Color effectColour = Color.black
 
ConversationDisplayType displayType = ConversationDisplayType.TextOnly
 
Texture2D testIcon = null
 
TextAnchor anchor
 
bool fixedOption
 
int optionToShow
 
int maxSlots = 10
 
bool markAlreadyChosen = false
 
Color alreadyChosenFontColour = Color.white
 
Color alreadyChosenFontHighlightedColour = Color.white
 
bool showIndexNumbers = false
 
IndexPrefixDisplay indexPrefixDisplay = IndexPrefixDisplay.None
 
UIHideStyle uiHideStyle = UIHideStyle.DisableObject
 
LinkUIGraphic linkUIGraphic = LinkUIGraphic.ImageComponent
 
bool resetOffsetWhenRestart = true
 
bool limitMaxScroll = true
 
ElementSlotMapping elementSlotMapping = ElementSlotMapping.List
 
- Public Attributes inherited from AC.MenuElement
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

override void ShowTextGUI (string apiPrefix)
 
override void ShowTextureGUI (string apiPrefix)
 
override void AutoSize ()
 
- Protected Member Functions inherited from AC.MenuElement
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)
 
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)
 
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)
 

Properties

override int MaxSlotsForOffset [get]
 
Conversation OverrideConversation [set]
 
- Properties inherited from AC.MenuElement
virtual bool IsVisible [get, set]
 
virtual int MaxSlotsForOffset [get]
 
Menu ParentMenu [get]
 

Additional Inherited Members

- Protected Attributes inherited from AC.MenuElement
bool isVisible = true
 
int offset = 0
 
Menu parentMenu
 
Rect relativeRect
 
Vector2 relativePosition
 
int numSlots
 

Detailed Description

A MenuElement that lists the available options in the active Conversation, and runs their interactions when clicked on.

Member Function Documentation

◆ CanBeShifted()

override bool AC.MenuDialogList.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 from AC.MenuElement.

◆ Declare()

override void AC.MenuDialogList.Declare ( )
virtual

Initialises the MenuElement when it is created within MenuManager.

Reimplemented from AC.MenuElement.

◆ Display()

override void AC.MenuDialogList.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 from AC.MenuElement.

◆ DuplicateSelf()

override MenuElement AC.MenuDialogList.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 from AC.MenuElement.

◆ GetDialogueOption()

ButtonDialog AC.MenuDialogList.GetDialogueOption ( int  slotIndex)

Gets a ButtonDialog data-container class for a dialogue option within the active Conversation

Parameters
slotIndexThe element's slot index number associated with the dialogue option
Returns
The ButtonDialog data-container class for a dialogue option within the active Conversation

◆ GetHotspotLabelOverride()

override string AC.MenuDialogList.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 from AC.MenuElement.

◆ GetLabel()

override string AC.MenuDialogList.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 from AC.MenuElement.

◆ GetObjectToSelect()

override GameObject AC.MenuDialogList.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 from AC.MenuElement.

◆ GetRectTransform()

override RectTransform AC.MenuDialogList.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 from AC.MenuElement.

◆ GetSlotIndex()

override int AC.MenuDialogList.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 from AC.MenuElement.

◆ HideAllUISlots()

override void AC.MenuDialogList.HideAllUISlots ( )
virtual

Hides all linked Unity UI GameObjects associated with the element.

Reimplemented from AC.MenuElement.

◆ IsSelectableInteractable()

override bool AC.MenuDialogList.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 from AC.MenuElement.

◆ IsSelectedByEventSystem()

override bool AC.MenuDialogList.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 from AC.MenuElement.

◆ LoadUnityUI()

override void AC.MenuDialogList.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 from AC.MenuElement.

◆ OnMenuTurnOn()

override void AC.MenuDialogList.OnMenuTurnOn ( Menu  menu)
virtual

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

Parameters
menuThe Menu this is attached to

Reimplemented from AC.MenuElement.

◆ PreDisplay()

override void AC.MenuDialogList.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 from AC.MenuElement.

◆ ProcessClick()

override bool AC.MenuDialogList.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 from AC.MenuElement.

◆ RecalculateSize()

override void AC.MenuDialogList.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 from AC.MenuElement.

◆ ReferencesObjectOrID()

override bool AC.MenuDialogList.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 from AC.MenuElement.

◆ SetUIInteractableState()

override void AC.MenuDialogList.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 from AC.MenuElement.

◆ Shift()

override void AC.MenuDialogList.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 from AC.MenuElement.

Member Data Documentation

◆ alreadyChosenFontColour

Color AC.MenuDialogList.alreadyChosenFontColour = Color.white

The font colour for options already chosen (If markAlreadyChosen = True, OnGUI only)

◆ alreadyChosenFontHighlightedColour

Color AC.MenuDialogList.alreadyChosenFontHighlightedColour = Color.white

The font colour when the option is highlighted but has already been chosen (OnGUI only)

◆ anchor

TextAnchor AC.MenuDialogList.anchor

The text alignment

◆ displayType

ConversationDisplayType AC.MenuDialogList.displayType = ConversationDisplayType.TextOnly

How the Conversation's dialogue options are displayed (IconOnly, TextOnly, IconAndText)

◆ effectColour

Color AC.MenuDialogList.effectColour = Color.black

The outline colour

◆ elementSlotMapping

ElementSlotMapping AC.MenuDialogList.elementSlotMapping = ElementSlotMapping.List

How to map this element to a Conversation's dialogue options

◆ fixedOption

bool AC.MenuDialogList.fixedOption

Deprecated

◆ indexPrefixDisplay

IndexPrefixDisplay AC.MenuDialogList.indexPrefixDisplay = IndexPrefixDisplay.None

If displayType = ConversationDisplayType.TextOnly, how each option's index number is prefixed to the label

◆ limitMaxScroll

bool AC.MenuDialogList.limitMaxScroll = true

If True, and the element is scrolled by an offset larger than the number of new options to show, then the offset amount will be reduced to only show those new options.

◆ linkUIGraphic

LinkUIGraphic AC.MenuDialogList.linkUIGraphic = LinkUIGraphic.ImageComponent

What Image component the Element's Graphics should be linked to (ImageComponent, ButtonTargetGraphic)

◆ markAlreadyChosen

bool AC.MenuDialogList.markAlreadyChosen = false

If True, then options that have already been clicked can be displayed in a different colour

◆ maxSlots

int AC.MenuDialogList.maxSlots = 10

The maximum number of dialogue options that can be shown at once

◆ optionToShow

int AC.MenuDialogList.optionToShow

The slot index or ID of the dialogue option to show, if elementSlotMapping = FixedSlotIndex or FixedOptionID

◆ outlineSize

float AC.MenuDialogList.outlineSize = 2f

The outline thickness, if textEffects != TextEffects.None

◆ resetOffsetWhenRestart

bool AC.MenuDialogList.resetOffsetWhenRestart = true

If True, then the offset value will be reset when the parent menu is turned on for the same Conversation that it last displayed

◆ showIndexNumbers

bool AC.MenuDialogList.showIndexNumbers = false

(Deprecated)

◆ testIcon

Texture2D AC.MenuDialogList.testIcon = null

A temporary dialogue option icon, used for test purposes when the game is not running

◆ textEffects

TextEffects AC.MenuDialogList.textEffects

The special FX applied to the text (None, Outline, Shadow, OutlineAndShadow)

◆ uiHideStyle

UIHideStyle AC.MenuDialogList.uiHideStyle = UIHideStyle.DisableObject

The method by which this element (or slots within it) are hidden from view when made invisible (DisableObject, ClearContent)

◆ uiSlots

UISlot [] AC.MenuDialogList.uiSlots

A List of UISlot classes that reference the linked Unity UI GameObjects (Unity UI Menus only)

Property Documentation

◆ OverrideConversation

Conversation AC.MenuDialogList.OverrideConversation
set

If set, then this Conversation will be used instead of the global 'active' one. This must be set either before the Menu is turned on, or within the OnMenuTurnOn custom event. Note that its Menu's 'Appear type' should not be set to 'During Conversation', and that the Conversation's dialogue options should not be overridden with the 'Dialogue: Start conversation' Action.