Adventure Creator  1.68.3
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2018
AC.MenuSavesList Class Reference
Inheritance diagram for AC.MenuSavesList:
AC.MenuElement AC.ITranslatable

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 GameObjects. More...
 
override GameObject GetObjectToSelect (int slotIndex=0)
 Gets the first linked Unity UI GameObject associated with this element. More...
 
override RectTransform GetRectTransform (int _slot)
 Gets the boundary of a slot More...
 
override void SetUIInteractableState (bool state)
 Sets the interactive state of any linked Unity UI gameobjects. More...
 
override void ShowGUI (Menu menu)
 
override int GetVariableReferences (int _varID)
 Gets the number of references the MenuElement makes to a global variable 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 HideAllUISlots ()
 
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 ProcessClick (AC.Menu _menu, int _slot, MouseState _mouseState)
 Performs what should happen when the element is clicked on. More...
 
override void RecalculateSize (MenuSource source)
 Recalculates the element's size. This should be called whenever a Menu's shape is changed. 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...
 
string GetTranslatableString (int index)
 
int GetTranslationID (int index)
 Gets the translation ID of a given text index. More...
 
int GetNumTranslatables ()
 Gets the maximum number of possible translatable texts. More...
 
bool HasExistingTranslation (int index)
 Checks if a given text index has already been assigned a unique translation ID. More...
 
void SetTranslationID (int index, int _lineID)
 Sets the translation ID of a given text index More...
 
string GetOwner ()
 Gets the name of the translatable text's owner. In the case of speech text, it is the name of the character. In the case of menu element text, it is the name of the menu element. More...
 
bool OwnerIsPlayer ()
 Checks if the translatable text's owner is a Player. This is necessary for speech lines, since multiple player prefabs can feasibly share the same line. More...
 
AC_TextType GetTranslationType (int index)
 Gets the translation type of a given text index. More...
 
bool CanTranslate (int index)
 Checks if a given text index can and should be translated. 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 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 string GetHotspotLabelOverride (int _slot, int _language)
 Gets a string that overrides the default 'hotspot label'. 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...
 
virtual void OnMenuTurnOn (Menu menu)
 Called whenever the Menu this is attached to is turned on. More...
 

Public Attributes

UISlot [] uiSlots
 
TextEffects textEffects
 
float outlineSize = 2f
 
TextAnchor anchor
 
AC_SaveListType saveListType
 
int maxSlots = 5
 
ActionListAsset actionListOnSave
 
SaveDisplayType displayType = SaveDisplayType.LabelOnly
 
Texture2D blankSlotTexture
 
string importProductName
 
string importSaveFilename
 
bool checkImportBool
 
int checkImportVar
 
bool allowEmptySlots
 
bool fixedOption
 
int optionToShow
 
int parameterID = -1
 
string newSaveText = "New save"
 
bool showNewSaveOption = true
 
bool hideIfNotValid = false
 
bool autoHandle = true
 
UIHideStyle uiHideStyle = UIHideStyle.DisableObject
 
LinkUIGraphic linkUIGraphic = LinkUIGraphic.ImageComponent
 
- 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
 

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)
 

Additional Inherited Members

- Protected Attributes inherited from AC.MenuElement
bool isVisible = true
 
int offset = 0
 
Menu parentMenu
 
Rect relativeRect
 
Vector2 relativePosition
 
int numSlots
 
- Properties inherited from AC.MenuElement
bool IsVisible [get, set]
 
string IDString [get]
 
Menu ParentMenu [get]
 

Detailed Description

This MenuElement lists any save game files found on by SaveSystem. Clicking on slots can load or save the relevant file, and importing variables from another game is also possible.

Member Function Documentation

◆ CanBeShifted()

override bool AC.MenuSavesList.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.

◆ CanTranslate()

bool AC.MenuSavesList.CanTranslate ( int  index)

Checks if a given text index can and should be translated.

Parameters
indexThe index of the translatable text
Returns
True if the text can and should be translated

Implements AC.ITranslatable.

◆ Declare()

override void AC.MenuSavesList.Declare ( )
virtual

Initialises the element when it is created within MenuManager.

Reimplemented from AC.MenuElement.

◆ Display()

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

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

Reimplemented from AC.MenuElement.

◆ DuplicateSelf()

override MenuElement AC.MenuSavesList.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.MenuSavesList.GetLabel ( int  _slot,
int  languageNumber 
)
virtual

Gets the display text of the element

Parameters
slotThe index number of the slot
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.

◆ GetNumTranslatables()

int AC.MenuSavesList.GetNumTranslatables ( )

Gets the maximum number of possible translatable texts.

Returns
The maximum number of possible translatable texts.

Implements AC.ITranslatable.

◆ GetObjectToSelect()

override GameObject AC.MenuSavesList.GetObjectToSelect ( int  slotIndex = 0)
virtual

Gets the first linked Unity UI GameObject associated with this element.

<param name = "The first Unity UI GameObject associated with the element

Reimplemented from AC.MenuElement.

◆ GetOwner()

string AC.MenuSavesList.GetOwner ( )

Gets the name of the translatable text's owner. In the case of speech text, it is the name of the character. In the case of menu element text, it is the name of the menu element.

Returns
The name of the translatable text's owner.

Implements AC.ITranslatable.

◆ GetRectTransform()

override RectTransform AC.MenuSavesList.GetRectTransform ( int  _slot)
virtual

Gets the boundary of a slot

Parameters
_slotThe index number of the slot to get the boundary of
Returns
The boundary Rect of the slot

Reimplemented from AC.MenuElement.

◆ GetTranslatableString()

string AC.MenuSavesList.GetTranslatableString ( int  index)

ITranslatable implementation

Implements AC.ITranslatable.

◆ GetTranslationID()

int AC.MenuSavesList.GetTranslationID ( int  index)

Gets the translation ID of a given text index.

Parameters
indexThe index of the translatable text
Returns
The translation ID of the text

Implements AC.ITranslatable.

◆ GetTranslationType()

AC_TextType AC.MenuSavesList.GetTranslationType ( int  index)

Gets the translation type of a given text index.

Parameters
indexThe index of the translatable text
Returns
The translation type of a given text index.

Implements AC.ITranslatable.

◆ GetVariableReferences()

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

◆ HasExistingTranslation()

bool AC.MenuSavesList.HasExistingTranslation ( int  index)

Checks if a given text index has already been assigned a unique translation ID.

Parameters
indexThe index of the translatable text
Returns
True if the text has been assigned a unique translation ID

Implements AC.ITranslatable.

◆ HideAllUISlots()

override void AC.MenuSavesList.HideAllUISlots ( )
virtual

Hides all linked Unity UI GameObjects associated with the element.

Reimplemented from AC.MenuElement.

◆ IsSelectedByEventSystem()

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

Initialises the linked Unity UI GameObjects.

Parameters
_menuThe element's parent Menu

Reimplemented from AC.MenuElement.

◆ OwnerIsPlayer()

bool AC.MenuSavesList.OwnerIsPlayer ( )

Checks if the translatable text's owner is a Player. This is necessary for speech lines, since multiple player prefabs can feasibly share the same line.

Returns
True if the translatable text's owner is a Player.

Implements AC.ITranslatable.

◆ PreDisplay()

override void AC.MenuSavesList.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 void AC.MenuSavesList.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 ths slot that was clicked
_mouseStateThe state of the mouse button

Reimplemented from AC.MenuElement.

◆ RecalculateSize()

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

◆ SetTranslationID()

void AC.MenuSavesList.SetTranslationID ( int  index,
int  lineID 
)

Sets the translation ID of a given text index

Parameters
indexThe index of the translatable text
lineIDThe new translation ID to assign the translatable text

Implements AC.ITranslatable.

◆ SetUIInteractableState()

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

◆ actionListOnSave

ActionListAsset AC.MenuSavesList.actionListOnSave

An ActionListAsset that can run once a game is succesfully loaded/saved/imported

◆ allowEmptySlots

bool AC.MenuSavesList.allowEmptySlots

If True, then all slots will be shown even if they are not already assigned a save file.

◆ anchor

TextAnchor AC.MenuSavesList.anchor

The text alignment

◆ autoHandle

bool AC.MenuSavesList.autoHandle = true

If True, then the save file will be loaded/saved once its slot is clicked on

◆ blankSlotTexture

Texture2D AC.MenuSavesList.blankSlotTexture

The default graphic to use if slots display save screenshots

◆ checkImportBool

bool AC.MenuSavesList.checkImportBool

If True, and saveListType = AC_SaveListType.Import, then a specific Boolean global variable must = True for an import file to be listed

◆ checkImportVar

int AC.MenuSavesList.checkImportVar

If checkImportBool = True, the ID number of the Boolean global variable that must = True, for an import file to be listed

◆ displayType

SaveDisplayType AC.MenuSavesList.displayType = SaveDisplayType.LabelOnly

How save files are displayed (LabelOnly, ScreenshotOnly, LabelAndScreenshot)

◆ fixedOption

bool AC.MenuSavesList.fixedOption

If True, then only one save slot will be shown

◆ hideIfNotValid

bool AC.MenuSavesList.hideIfNotValid = false

If True, and saveListType = AC_SaveListType.Load and fixedOption = True, then the element will be hidden if the slot ID it represents is not filled with a valid save

◆ importProductName

string AC.MenuSavesList.importProductName

The name of the project to import files from, if saveListType = AC_SaveListType.Import

◆ importSaveFilename

string AC.MenuSavesList.importSaveFilename

The filename syntax of import files, if saveListType = AC_SaveListType.Import

◆ linkUIGraphic

LinkUIGraphic AC.MenuSavesList.linkUIGraphic = LinkUIGraphic.ImageComponent

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

◆ maxSlots

int AC.MenuSavesList.maxSlots = 5

The maximum number of slots that can be displayed at once

◆ newSaveText

string AC.MenuSavesList.newSaveText = "New save"

The display text when a slot represents a "new save" space

◆ optionToShow

int AC.MenuSavesList.optionToShow

The index number of the save slot to show, if fixedOption = true

◆ outlineSize

float AC.MenuSavesList.outlineSize = 2f

The outline thickness, if textEffects != TextEffects.None

◆ parameterID

int AC.MenuSavesList.parameterID = -1

If >=0, The ID number of the integer ActionParameter in actionListOnSave to set to the index number of the slot clicked

◆ saveListType

AC_SaveListType AC.MenuSavesList.saveListType

How this list behaves (Load, Save, Import)

◆ showNewSaveOption

bool AC.MenuSavesList.showNewSaveOption = true

If True, a slot that represents a "new save" space can be displayed if appropriate

◆ textEffects

TextEffects AC.MenuSavesList.textEffects

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

◆ uiHideStyle

UIHideStyle AC.MenuSavesList.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.MenuSavesList.uiSlots

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