Adventure Creator  1.66.8
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2018
AC.MenuJournal Class Reference
Inheritance diagram for AC.MenuJournal:
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 Initialise (AC.Menu _menu)
 Performs any initialisation that can only be done once the element has been instantiated at runtime. More...
 
override void LoadUnityUI (AC.Menu _menu, Canvas canvas)
 Initialises the linked Unity UI GameObject. More...
 
override RectTransform GetRectTransform (int _slot)
 Gets the boundary of the element More...
 
int GetCurrentPageNumber ()
 Gets the currently-viewed page number. More...
 
int GetTotalNumberOfPages ()
 Gets the total number of pages. More...
 
override void ShowGUI (Menu menu)
 
override bool CheckConvertGlobalVariableToLocal (int oldGlobalID, int newLocalID)
 Checks if the Elements makesreferences from a given global variable to a given local variable More...
 
override int GetVariableReferences (int _varID)
 Gets the number of references the MenuElement makes to a global variable More...
 
override void OnMenuTurnOn (Menu menu)
 Called whenever the Menu this is attached to is turned on. 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 string GetLabel (int slot, int languageNumber)
 Gets the display text of the current page More...
 
void Shift (AC_ShiftInventory shiftType, bool doLoop, 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...
 
void AddPage (JournalPage newPage, bool onlyAddNew, int index=-1)
 Adds a page to the journal. More...
 
void RemovePage (int index=-1)
 Removes a page from the journal. More...
 
void RemoveAllPages ()
 Removes all page from the journal.
 
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 ProcessClick (AC.Menu _menu, int _slot, MouseState _mouseState)
 Performs what should happen when the element is clicked on. More...
 
virtual void 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 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...
 
virtual bool IsSelectedByEventSystem (int slotIndex)
 Checks if the element is selected by Unity UI's EventSystem. More...
 
void ShowGUIStart (Menu menu)
 
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...
 
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...
 
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...
 

Public Attributes

Text uiText
 
List< JournalPagepages = new List<JournalPage>()
 
int numPages = 1
 
int showPage = 1
 
bool startFromPage = false
 
TextAnchor anchor
 
TextEffects textEffects
 
float outlineSize = 2f
 
ActionListAsset actionListOnAddPage
 
JournalType journalType = JournalType.NewJournal
 
int pageOffset
 
string otherJournalTitle
 
- 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 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)
 
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)
 
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
 
Rect relativeRect
 
Vector2 relativePosition
 
int numSlots
 
- Properties inherited from AC.MenuElement
bool IsVisible [get, set]
 
string IDString [get]
 

Detailed Description

A MenuElement that provides an array of labels, each one representing a page, that collectively form a bork. "Pages" can be added to the journal mid-game, and changes made to it will be saved in save games.

Member Function Documentation

◆ AddPage()

void AC.MenuJournal.AddPage ( JournalPage  newPage,
bool  onlyAddNew,
int  index = -1 
)

Adds a page to the journal.

Parameters
newPageThe page to add
onlyAddNewIf True, then the page will not be added if its lineID number matches that of any page already in the journal
indexThe index number to insert the page into. A value of -1 will cause it to be added at the end.

◆ CanBeShifted()

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

◆ CheckConvertGlobalVariableToLocal()

override bool AC.MenuJournal.CheckConvertGlobalVariableToLocal ( int  oldGlobalID,
int  newLocalID 
)
virtual

Checks if the Elements makesreferences 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 from AC.MenuElement.

◆ Declare()

override void AC.MenuJournal.Declare ( )
virtual

Initialises the element when it is created within MenuManager.

Reimplemented from AC.MenuElement.

◆ Display()

override void AC.MenuJournal.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
isActiveIf True, then the element will be drawn as though highlighted

Reimplemented from AC.MenuElement.

◆ DuplicateSelf()

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

◆ GetCurrentPageNumber()

int AC.MenuJournal.GetCurrentPageNumber ( )

Gets the currently-viewed page number.

Returns
The currently-viewed page number</returms>

◆ GetLabel()

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

Gets the display text of the current page

Parameters
slotIgnored by this subclass
languageNumberThe index number of the language number to get the text in
Returns
The display text of the current page

Reimplemented from AC.MenuElement.

◆ GetNumTranslatables()

int AC.MenuJournal.GetNumTranslatables ( )

Gets the maximum number of possible translatable texts.

Returns
The maximum number of possible translatable texts.

Implements AC.ITranslatable.

◆ GetOwner()

string AC.MenuJournal.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.MenuJournal.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.

◆ GetTotalNumberOfPages()

int AC.MenuJournal.GetTotalNumberOfPages ( )

Gets the total number of pages.

Returns
The total number of pages

◆ GetTranslatableString()

string AC.MenuJournal.GetTranslatableString ( int  index)

ITranslatable implementation

Implements AC.ITranslatable.

◆ GetTranslationID()

int AC.MenuJournal.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.MenuJournal.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.MenuJournal.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.MenuJournal.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.

◆ Initialise()

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

◆ LoadUnityUI()

override void AC.MenuJournal.LoadUnityUI ( AC.Menu  _menu,
Canvas  canvas 
)
virtual

Initialises the linked Unity UI GameObject.

Parameters
_menuThe element's parent Menu

Reimplemented from AC.MenuElement.

◆ OnMenuTurnOn()

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

◆ OwnerIsPlayer()

bool AC.MenuJournal.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.MenuJournal.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.

◆ RemovePage()

void AC.MenuJournal.RemovePage ( int  index = -1)

Removes a page from the journal.

Parameters
indexThe page number to remove. A value of -1 will cause the last page to be removed.

◆ SetTranslationID()

void AC.MenuJournal.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.

◆ Shift()

void AC.MenuJournal.Shift ( AC_ShiftInventory  shiftType,
bool  doLoop,
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.

Parameters
shiftTypeThe direction to shift pages in (Left, Right)
doLoopIf True, then shifting right beyond the last page will display the first page, and vice-versa
amountThe amount to shift pages by

Member Data Documentation

◆ actionListOnAddPage

ActionListAsset AC.MenuJournal.actionListOnAddPage

An ActionList to run whenever a new page is added

◆ anchor

TextAnchor AC.MenuJournal.anchor

The text alignment

◆ journalType

JournalType AC.MenuJournal.journalType = JournalType.NewJournal

What type of journal this is (NewJournal, DisplayExistingJournal)

◆ numPages

int AC.MenuJournal.numPages = 1

The initial number of pages when the game begins

◆ otherJournalTitle

string AC.MenuJournal.otherJournalTitle

The name of the Journal element within the same Menu that is used as reference, if journalType = JournalType.DisplayExistingJournal)

◆ outlineSize

float AC.MenuJournal.outlineSize = 2f

The outline thickness, if textEffects != TextEffects.None

◆ pageOffset

int AC.MenuJournal.pageOffset

The page offset, if journalType = JournalType.DisplayExistingJournal)

◆ pages

List<JournalPage> AC.MenuJournal.pages = new List<JournalPage>()

A List of JournalPage instances that make up the pages within

◆ showPage

int AC.MenuJournal.showPage = 1

The index number of the current page being shown

◆ startFromPage

bool AC.MenuJournal.startFromPage = false

If True, then the "Preview page" set in the Editor will be the first page open when the game begins

◆ textEffects

TextEffects AC.MenuJournal.textEffects

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

◆ uiText

Text AC.MenuJournal.uiText

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