![]() |
Adventure Creator
1.76.2
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2022
|
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, bool addEventListeners=true) |
Initialises the linked Unity UI GameObject. More... | |
UnityEngine.UI.Button | GetUIButtonWithItem (int itemID) |
Gets the UI Button associated with an inventory item, provided that the Menus' Source is UnityUiPrefab or UnityUiInScene. 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 | ShowGUI (Menu menu) |
override bool | ReferencesAsset (ActionListAsset actionListAsset) |
Checks if the Menu makes reference to a particular ActionList asset More... | |
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 void | HideAllUISlots () |
override void | SetUIInteractableState (bool state) |
Sets the interactive state of any linked Unity UI gameobjects. 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... | |
bool | HandleDefaultClick (MouseState _mouseState, int _slot) |
Performs what should happen when the element is clicked on, if inventoryBoxType = AC_InventoryBoxType.Default. 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 | OnMenuTurnOn (Menu menu) |
Called whenever the Menu this is attached to is turned on. More... | |
override bool | CanBeShifted (AC_ShiftInventory shiftType) |
Checks if the element's slots can be shifted in a particular direction. 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 string | GetLabel (int i, 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 AudioClip | GetHoverSound (int slot) |
Gets the hover sound for the element slot. More... | |
InvItem | GetItem (int i) |
Gets the inventory item shown in a specific slot More... | |
InvInstance | GetInstance (int i) |
Gets the inventory item instance shown in a specific slot More... | |
void | ResetOffset () |
bool | ClickContainer (MouseState _mouseState, int _slot) |
Performs what should happen when the element is clicked on, if inventoryBoxType = AC_InventoryBoxType.Container. More... | |
override bool | ProcessClick (AC.Menu _menu, int _slot, MouseState _mouseState) |
Performs what should happen when the element is clicked on. More... | |
Document | GetDocument (int slotIndex) |
Gets the Document associated with a given slot More... | |
ObjectiveInstance | GetObjective (int slotIndex) |
Gets the Document associated with a given slot More... | |
int | GetItemSlot (int itemID) |
Gets the slot index number that a given InvItem (inventory item) appears in. More... | |
int | GetItemSlot (InvInstance invInstance) |
Gets the slot index number that a given InvItem (inventory item) appears in. 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 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... | |
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 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 () |
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 |
UIPointerState | uiPointerState = UIPointerState.PointerClick |
TextEffects | textEffects |
TextAnchor | anchor = TextAnchor.MiddleCenter |
float | outlineSize = 2f |
Color | effectColour = Color.black |
AC_InventoryBoxType | inventoryBoxType |
ActionListAsset | actionListOnClick = null |
int | maxSlots |
bool | limitToCategory |
bool | limitToDefinedInteractions = true |
int | categoryID |
List< int > | categoryIDs = new List<int>() |
LinkUIGraphic | linkUIGraphic = LinkUIGraphic.ImageComponent |
bool | preventInteractions = false |
bool | preventSelection = false |
bool | limitMaxScroll = true |
bool | highlightEmptySlots = false |
bool | updateHotspotLabelWhenHover = false |
bool | hoverSoundOverEmptySlots = true |
ContainerSelectMode | containerSelectMode = ContainerSelectMode.MoveToInventoryAndSelect |
ConversationDisplayType | displayType = ConversationDisplayType.IconOnly |
UIHideStyle | uiHideStyle = UIHideStyle.DisableObject |
bool | autoOpenDocument = true |
Texture2D | emptySlotTexture = null |
InventoryItemCountDisplay | inventoryItemCountDisplay = InventoryItemCountDisplay.OnlyIfMultiple |
ObjectiveDisplayType | objectiveDisplayType = ObjectiveDisplayType.All |
![]() | |
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 | ProcessClickUI (AC.Menu _menu, int _slot, MouseState _mouseState) |
override void | ShowTextureGUI (string apiPrefix) |
override void | ShowTextGUI (string apiPrefix) |
void | ClickInvItemToInteract (InvInstance invInstance) |
override void | AutoSize () |
![]() | |
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 string | GetLabelToTranslate () |
void | ClearCache () |
string | TranslateLabel (int languageNumber) |
void | EndGUI (string apiPrefix) |
void | ShowClipHelp () |
T | 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] |
Container | OverrideContainer [get, set] |
List< InvInstance > | InvInstances [get] |
![]() | |
virtual bool | IsVisible [get, set] |
virtual int | MaxSlotsForOffset [get] |
Menu | ParentMenu [get] |
Additional Inherited Members | |
![]() | |
bool | isVisible = true |
int | offset = 0 |
Menu | parentMenu |
Rect | relativeRect |
Vector2 | relativePosition |
int | numSlots |
A MenuElement that lists inventory items (see: InvItem). It can be used to display all inventory items held by the player, those that are stored within a Container, or as part of an Interaction Menu.
|
virtual |
Checks if the element's slots can be shifted in a particular direction.
shiftType | The direction to shift slots in (Left, Right) |
Reimplemented from AC.MenuElement.
bool AC.MenuInventoryBox.ClickContainer | ( | MouseState | _mouseState, |
int | _slot | ||
) |
Performs what should happen when the element is clicked on, if inventoryBoxType = AC_InventoryBoxType.Container.
_mouseState | The state of the mouse button |
_slot | The index number of the slot that was clicked on |
|
virtual |
Initialises the MenuElement when it is created within MenuManager.
Reimplemented from AC.MenuElement.
|
virtual |
Draws the element using OnGUI
_style | The GUIStyle to draw with |
_slot | The index number of the slot to display |
zoom | The zoom factor |
<param name = "isActive If True, then the element will be drawn as though highlighted
Reimplemented from AC.MenuElement.
|
virtual |
Creates and returns a new MenuElement that has the same values as itself.
fromEditor | If True, the duplication was done within the Menu Manager and not as part of the gameplay initialisation. |
ignoreUnityUI | If True, variables associated with Unity UI will not be transferred |
Reimplemented from AC.MenuElement.
Document AC.MenuInventoryBox.GetDocument | ( | int | slotIndex | ) |
|
virtual |
Gets a string that overrides the default 'hotspot label'.
_slot | The index number of the slot to get an override label for |
_language | The index number of the language to display text in |
Reimplemented from AC.MenuElement.
|
virtual |
Gets the hover sound for the element slot.
slot | The slots index number |
Reimplemented from AC.MenuElement.
InvInstance AC.MenuInventoryBox.GetInstance | ( | int | i | ) |
Gets the inventory item instance shown in a specific slot
i | The index number of the slot |
InvItem AC.MenuInventoryBox.GetItem | ( | int | i | ) |
Gets the inventory item shown in a specific slot
i | The index number of the slot |
int AC.MenuInventoryBox.GetItemSlot | ( | int | itemID | ) |
int AC.MenuInventoryBox.GetItemSlot | ( | InvInstance | invInstance | ) |
|
virtual |
Gets the display text of the element, or a slot within it.
slot | The index number of the slot to get text for |
languageNumber | The index number of the language number to get the text in |
Reimplemented from AC.MenuElement.
ObjectiveInstance AC.MenuInventoryBox.GetObjective | ( | int | slotIndex | ) |
|
virtual |
Gets the linked Unity UI GameObject associated with this element.
slotIndex | The slot index, if the element has multiple slots |
Reimplemented from AC.MenuElement.
|
virtual |
Gets the boundary of the element, or a slot within it.
_slot | The index number of the slot to get the boundary of |
Reimplemented from AC.MenuElement.
|
virtual |
Gets the slot index that reference a particular GameObject
gameObject | The GameObject to check for |
Reimplemented from AC.MenuElement.
UnityEngine.UI.Button AC.MenuInventoryBox.GetUIButtonWithItem | ( | int | itemID | ) |
bool AC.MenuInventoryBox.HandleDefaultClick | ( | MouseState | _mouseState, |
int | _slot | ||
) |
Performs what should happen when the element is clicked on, if inventoryBoxType = AC_InventoryBoxType.Default.
_mouseState | The state of the mouse button |
_slot | The index number of the slot that was clicked on |
|
virtual |
Hides all linked Unity UI GameObjects associated with the element.
Reimplemented from AC.MenuElement.
|
virtual |
Checks if the element's linked Selectable is currently Interactable (if the Menu is Unity UI-based).
slotIndex | The element's slot index, if it has multiple slots |
Reimplemented from AC.MenuElement.
|
virtual |
Checks if the element is selected by Unity UI's EventSystem (if the Menu is Unity UI-based).
slotIndex | The element's slot index, if it has multiple slots |
Reimplemented from AC.MenuElement.
|
virtual |
Initialises the linked Unity UI GameObject.
_menu | The element's parent Menu |
canvas | The runtime Canvas associated with the Menu |
addEventListeners | If True, then event listeners should be added to the UI's Interactive component(s) |
Reimplemented from AC.MenuElement.
|
virtual |
Called whenever the Menu this is attached to is turned on.
menu | The Menu this is attached to |
Reimplemented from AC.MenuElement.
|
virtual |
Performs all calculations necessary to display the element.
_slot | The index number of the slot to display |
languageNumber | The index number of the language to display text in |
isActive | If True, then the element will be drawn as though highlighted |
Reimplemented from AC.MenuElement.
|
virtual |
Performs what should happen when the element is clicked on.
_menu | The element's parent Menu |
_slot | The index number of the slot that was clicked on |
_mouseState | The state of the mouse button |
Reimplemented from AC.MenuElement.
|
virtual |
Recalculates the element's size. This should be called whenever a Menu's shape is changed.
source | How the parent Menu is displayed (AdventureCreator, UnityUiPrefab, UnityUiInScene) |
Reimplemented from AC.MenuElement.
|
virtual |
Checks if the Menu makes reference to a particular ActionList asset
actionListAsset | The ActionList to check for |
Reimplemented from AC.MenuElement.
|
virtual |
Checks if the Element makes reference to a particular GameObject
gameObject | The GameObject to check for |
id | The GameObject's associated ConstantID value |
Reimplemented from AC.MenuElement.
void AC.MenuInventoryBox.ResetOffset | ( | ) |
|
virtual |
Sets the interactive state of any linked Unity UI gameobjects.
state | If True, linked UI gameobjects will be made interactive. If False, they will be made non-interactive |
Reimplemented from AC.MenuElement.
|
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.
shiftType | The direction to shift slots in (Left, Right) |
amount | The amount to shift slots by |
Reimplemented from AC.MenuElement.
ActionListAsset AC.MenuInventoryBox.actionListOnClick = null |
An ActionList to run when a slot is clicked (if inventoryBoxType = CollectedDocuments or Objectives)
TextAnchor AC.MenuInventoryBox.anchor = TextAnchor.MiddleCenter |
The text alignement, if displayType = ConversationDisplayType.TextOnly
bool AC.MenuInventoryBox.autoOpenDocument = true |
If True, and inventoryBoxType = AC_InventoryBoxType.CollectedDocuments, then clicking an element slot will open the chosen Document
int AC.MenuInventoryBox.categoryID |
The category ID to limit the display of inventory items by, if limitToCategory = True (Deprecated)
List<int> AC.MenuInventoryBox.categoryIDs = new List<int>() |
The category IDs to limit the display of inventory items by, if limitToCategory = True
ContainerSelectMode AC.MenuInventoryBox.containerSelectMode = ContainerSelectMode.MoveToInventoryAndSelect |
If inventoryBoxType = AC_InventoryBoxType.Container, what happens to items when they are removed from the container
ConversationDisplayType AC.MenuInventoryBox.displayType = ConversationDisplayType.IconOnly |
How items are displayed (IconOnly, TextOnly, IconAndText)
Color AC.MenuInventoryBox.effectColour = Color.black |
The outline colour
Texture2D AC.MenuInventoryBox.emptySlotTexture = null |
The texture to display when a slot is empty
bool AC.MenuInventoryBox.highlightEmptySlots = false |
If True, then slots with no item in them will have highlighting effects applied as well
bool AC.MenuInventoryBox.hoverSoundOverEmptySlots = true |
If True, then the hover sound will play even when over an empty slot
AC_InventoryBoxType AC.MenuInventoryBox.inventoryBoxType |
How the items to display are chosen (Default, HotspotBased, CustomScript, DisplaySelected, DisplayLastSelected, Container, CollectedDocuments, Objectives)
InventoryItemCountDisplay AC.MenuInventoryBox.inventoryItemCountDisplay = InventoryItemCountDisplay.OnlyIfMultiple |
How the item count is displayed
bool AC.MenuInventoryBox.limitMaxScroll = true |
If True, and the element is scrolled by an offset larger than the number of new items to show, then the offset amount will be reduced to only show those new items.
bool AC.MenuInventoryBox.limitToCategory |
If True, only inventory items (InvItem) with a specific category will be displayed
bool AC.MenuInventoryBox.limitToDefinedInteractions = true |
LinkUIGraphic AC.MenuInventoryBox.linkUIGraphic = LinkUIGraphic.ImageComponent |
What Image component the Element's Graphics should be linked to (ImageComponent, ButtonTargetGraphic)
int AC.MenuInventoryBox.maxSlots |
The maximum number of inventory items that can be shown at once
ObjectiveDisplayType AC.MenuInventoryBox.objectiveDisplayType = ObjectiveDisplayType.All |
What Objectives to display, if inventoryBoxType = AC_InventoryBoxType.Objectives
float AC.MenuInventoryBox.outlineSize = 2f |
The outline thickness, if textEffects != TextEffects.None
bool AC.MenuInventoryBox.preventInteractions = false |
If True, then no interactions will work
bool AC.MenuInventoryBox.preventSelection = false |
If True, then items cannot be selected
TextEffects AC.MenuInventoryBox.textEffects |
The special FX applied to the text (None, Outline, Shadow, OutlineAndShadow)
UIHideStyle AC.MenuInventoryBox.uiHideStyle = UIHideStyle.DisableObject |
The method by which this element (or slots within it) are hidden from view when made invisible (DisableObject, ClearContent)
UIPointerState AC.MenuInventoryBox.uiPointerState = UIPointerState.PointerClick |
What pointer state registers as a 'click' for Unity UI Menus (PointerClick, PointerDown, PointerEnter)
UISlot [] AC.MenuInventoryBox.uiSlots |
A List of UISlot classes that reference the linked Unity UI GameObjects (Unity UI Menus only)
bool AC.MenuInventoryBox.updateHotspotLabelWhenHover = false |
DisplayType != ConversationDisplayType.IconOnly, Hotspot labels will only update when hovering over items if this is True
|
get |
The items listed in the element