Adventure Creator  1.66.1
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2018
AC.MenuInteraction Class Reference
Inheritance diagram for AC.MenuInteraction:
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 LoadUnityUI (AC.Menu _menu, Canvas canvas)
 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 More...
 
override void SetUIInteractableState (bool state)
 Sets the interactive state of any linked Unity UI gameobjects. More...
 
override void ShowGUI (Menu menu)
 
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...
 
void MatchInteractions (InvItem item)
 Recalculates display for a particular inventory item. More...
 
void MatchInteractions (List< AC.Button > buttons)
 Recalculates display for a particular set of Hotspot Buttons. More...
 
void MatchUseInteraction (AC.Button button)
 Recalculates display for an "Use" Hotspot Button. More...
 
void MatchLookInteraction (int lookIconID)
 Recalculates display for an "Examine" Hotspot Button. More...
 
override string GetLabel (int slot, int languageNumber)
 Gets the display text of the element More...
 
override bool IsSelectedByEventSystem (int slotIndex)
 Checks if the element is selected by Unity UI's EventSystem. 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 ProcessClick (AC.Menu _menu, int _slot, MouseState _mouseState)
 Performs what should happen when the element is clicked on. 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 void 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 SetHotspot (Hotspot _hotspot, InvItem _invItem)
 Assigns the element to a specific Hotspot.
 
virtual void ClearSpeech ()
 
void UpdateID (int[] idArray)
 Updates the ID number to something unique. More...
 
void ShowGUIStart (Menu menu)
 
virtual bool CheckConvertGlobalVariableToLocal (int oldGlobalID, int newLocalID)
 Checks if the Elements makesreferences 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 void HideAllUISlots ()
 
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...
 
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 ()
 
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...
 

Public Attributes

UnityEngine.UI.Button uiButton
 
UIPointerState uiPointerState = UIPointerState.PointerClick
 
AC_DisplayType displayType = AC_DisplayType.IconOnly
 
TextAnchor anchor
 
TextEffects textEffects
 
float outlineSize = 2f
 
int iconID
 
UISelectableHideStyle uiSelectableHideStyle = UISelectableHideStyle.DisableObject
 
bool overrideTexture
 
Texture activeTexture
 
- Public Attributes inherited from AC.MenuElement
int ID
 
bool isEditing = false
 
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
 

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 ProcessClickUI (AC.Menu _menu, int _slot, MouseState _mouseState)
 
string TranslateLabel (string label, 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)
 
Rect ZoomRect (Rect rect, float zoom)
 
void LimitOffset (int maxValue)
 
void Shift (AC_ShiftInventory shiftType, int maxSlots, int arraySize, int amount)
 
void SetAbsoluteSize (Vector2 _size)
 
void AutoSize (GUIContent content)
 
LinkUIElement< T > (Canvas canvas)
 
void UpdateUISelectable< T > (T field, UISelectableHideStyle uiSelectableHideStyle)
 
void UpdateUIElement< T > (T field)
 
void ClearSpriteCache (UISlot[] uiSlots)
 
void SetUISlotsInteractableState (UISlot[] uiSlots, bool state)
 

Properties

bool IsDefaultIcon [get]
 
- Properties inherited from AC.MenuElement
bool IsVisible [get, set]
 
string IDString [get]
 

Additional Inherited Members

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

Detailed Description

A MenuElement that displays available interactions inside a Menu. It is used to allow the player to run Hotspot interactions from within a UI.

Member Function Documentation

◆ Declare()

override void AC.MenuInteraction.Declare ( )
virtual

Initialises the element when it is created within MenuManager.

Reimplemented from AC.MenuElement.

◆ Display()

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

Draws the element using OnGUI

Parameters
_styleThe GUIStyle to draw with
_slotIgnored by this subclass
zoomThe zoom factor

<param name = "isActive If True, then the element will be drawn as though highlighted

Reimplemented from AC.MenuElement.

◆ DuplicateSelf()

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

◆ GetLabel()

override string AC.MenuInteraction.GetLabel ( int  slot,
int  languageNumber 
)
virtual

Gets the display text of the element

Parameters
slotIgnored by this subclass
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.MenuInteraction.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.MenuInteraction.GetRectTransform ( int  _slot)
virtual

Gets the boundary of the element

Parameters
_slotIgnored by this subclass
Returns
The boundary Rect of the element

Reimplemented from AC.MenuElement.

◆ IsSelectedByEventSystem()

override bool AC.MenuInteraction.IsSelectedByEventSystem ( int  slotIndex)
virtual

Checks if the element is selected by Unity UI's EventSystem.

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.MenuInteraction.LoadUnityUI ( AC.Menu  _menu,
Canvas  canvas 
)
virtual

Initialises the linked Unity UI GameObject.

Parameters
_menuThe element's parent Menu<param>

Reimplemented from AC.MenuElement.

◆ MatchInteractions() [1/2]

void AC.MenuInteraction.MatchInteractions ( InvItem  item)

Recalculates display for a particular inventory item.

Parameters
parentMenuThe Menu that the element is a part of
itemThe InvItem to recalculate the Menus's display for

◆ MatchInteractions() [2/2]

void AC.MenuInteraction.MatchInteractions ( List< AC.Button buttons)

Recalculates display for a particular set of Hotspot Buttons.

Parameters
parentMenuThe Menu that the element is a part of
buttonsA List of Button classes to recalculate the Menus's display for

◆ MatchLookInteraction()

void AC.MenuInteraction.MatchLookInteraction ( int  lookIconID)

Recalculates display for an "Examine" Hotspot Button.

Parameters
parentMenuThe Menu that the element is a part of
lookIconIDThe ID number of the CursorIcon in CursorManager that is reserved for Examine interactions

◆ MatchUseInteraction()

void AC.MenuInteraction.MatchUseInteraction ( AC.Button  button)

Recalculates display for an "Use" Hotspot Button.

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

◆ PreDisplay()

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

Performs all calculations necessary to display the element.

Parameters
_slotIgnored by this subclass
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 void AC.MenuInteraction.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
_slotIgnored by this subclass
_mouseStateThe state of the mouse button

Reimplemented from AC.MenuElement.

◆ RecalculateSize()

override void AC.MenuInteraction.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.

◆ SetUIInteractableState()

override void AC.MenuInteraction.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.

Member Data Documentation

◆ activeTexture

Texture AC.MenuInteraction.activeTexture

The element's texture (OnGUI only)

◆ anchor

TextAnchor AC.MenuInteraction.anchor

The text alignment

◆ displayType

AC_DisplayType AC.MenuInteraction.displayType = AC_DisplayType.IconOnly

How interactions are displayed (IconOnly, TextOnly, IconAndText)

◆ iconID

int AC.MenuInteraction.iconID

The ID number of the interaction's associated CursorIcon

◆ outlineSize

float AC.MenuInteraction.outlineSize = 2f

The outline thickness, if textEffects != TextEffects.None

◆ overrideTexture

bool AC.MenuInteraction.overrideTexture

If True, the element's texture can be set independently of the associated interaction icon set within the Cursor Manager (OnGUI only)

◆ textEffects

TextEffects AC.MenuInteraction.textEffects

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

◆ uiButton

UnityEngine.UI.Button AC.MenuInteraction.uiButton

The Unity UI Button this is linked to (Unity UI Menus only)

◆ uiPointerState

UIPointerState AC.MenuInteraction.uiPointerState = UIPointerState.PointerClick

What pointer state registers as a 'click' for Unity UI Menus (PointerClick, PointerDown, PointerEnter)

◆ uiSelectableHideStyle

UISelectableHideStyle AC.MenuInteraction.uiSelectableHideStyle = UISelectableHideStyle.DisableObject

The method by which this element is hidden from view when made invisible (DisableObject, DisableInteractability)

Property Documentation

◆ IsDefaultIcon

bool AC.MenuInteraction.IsDefaultIcon
get

If using Choose Interaction Then Hotspot mode, and default interactions are enabled, then this is True if the active Hotspot's first-enabled Use interaction uses this icon