Adventure Creator  1.79.1
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2022
AC.ActionMenuState Class Reference
Inheritance diagram for AC.ActionMenuState:
AC.Action AC.ITranslatable AC.IMenuReferencer AC.iActionListAssetReferencer AC.IVariableReferencerAction

Public Types

enum  MenuChangeType {
  TurnOnMenu, TurnOffMenu, HideMenuElement, ShowMenuElement,
  LockMenu, UnlockMenu, AddJournalPage, RemoveJournalPage
}
 
enum  RemoveJournalPageMethod { RemoveSinglePage, RemoveAllPages }
 

Public Member Functions

override void AssignParentList (ActionList actionList)
 Passes the ActionList that the Action is a part of to the Action class. This is run before the Action is called or displayed in an Editor. More...
 
override void AssignValues (List< ActionParameter > parameters)
 Overwrites any appropriate variables with values set using parameters, or from ConstantID numbers. More...
 
override float Run ()
 Runs the Action. More...
 
override void Skip ()
 
override void ClearIDs ()
 
override void ShowGUI (List< ActionParameter > parameters)
 Shows the Action's GUI when its parent ActionList / ActionListAsset uses parameters. More...
 
override string SetLabel ()
 Gets a string that is shown after the Action's title in the Editor to help the user understand what it does. More...
 
override bool ConvertLocalVariableToGlobal (int oldLocalID, int newGlobalID)
 Converts the Action's references from a given local variable to a given global variable More...
 
override bool ConvertGlobalVariableToLocal (int oldGlobalID, int newLocalID, bool isCorrectScene)
 Converts the Action's references from a given global variable to a given local variable More...
 
override int GetNumVariableReferences (VariableLocation location, int varID, List< ActionParameter > parameters, Variables _variables=null, int _variablesConstantID=0)
 Gets the number of references the Action makes to a variable More...
 
override int UpdateVariableReferences (VariableLocation location, int oldVarID, int newVarID, List< ActionParameter > parameters, Variables _variables=null, int _variablesConstantID=0)
 Updated references the Action makes to a variable More...
 
int GetNumMenuReferences (string menuName, string elementName="")
 
string GetTranslatableString (int index)
 Gets the text to be translated, given its index. More...
 
int GetTranslationID (int index)
 Gets the translation ID of a given text index. More...
 
void UpdateTranslatableString (int index, string updatedText)
 
int GetNumTranslatables ()
 Gets the maximum number of possible translatable texts. More...
 
bool CanTranslate (int index)
 Checks if a given text index can and should be translated. 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 (int index)
 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 (int index)
 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...
 
- Public Member Functions inherited from AC.Action
 Action ()
 
virtual void Upgrade ()
 
virtual int GetNextOutputIndex ()
 Gets the index of the output socket to use after the Action has run. More...
 
void PrintComment (ActionList actionList, ActionListAsset actionListAsset=null)
 Prints the Action's comment, if applicable, to the Console. More...
 
void SetOutputs (ActionEnd[] actionEnds)
 Update the Action's output sockets More...
 
void ResetSearchData ()
 
virtual void ShowGUI ()
 
void SkipActionGUI (List< Action > actions, bool showGUI)
 
virtual void AssignConstantIDs (bool saveScriptsToo=false, bool fromAssetFile=false)
 Called when an ActionList has been converted from a scene-based object to an asset file. Within it, AssignConstantID should be called for each of the Action's Constant ID numbers, which will assign a new number if one does not already exist, based on the referenced scene object. More...
 
void DrawOutWires (List< Action > actions, int i, int offset, Vector2 scrollPosition)
 
int FieldToID< T > (T field, int _constantID, bool alwaysAssign=false)
 
int FieldToID (Collider field, int _constantID)
 
void AddSaveScript< T > (Behaviour field)
 
void AddSaveScript< T > (GameObject _gameObject)
 
IDToField< T > (T field, int _constantID, bool moreInfo)
 
Collider IDToField (Collider field, int _constantID, bool moreInfo)
 
int FieldToID (Transform field, int _constantID, bool alwaysAssign=false)
 
Transform IDToField (Transform field, int _constantID, bool moreInfo)
 
int FieldToID (GameObject field, int _constantID)
 
int FieldToID (GameObject field, int _constantID, bool alwaysAssign)
 
GameObject IDToField (GameObject field, int _constantID, bool moreInfo)
 
GameObject IDToField (GameObject field, int _constantID, bool moreInfo, bool alwaysShow)
 
virtual bool ReferencesObjectOrID (GameObject gameObject, int id)
 Checks if the Action makes reference to a particular GameObject More...
 
virtual bool ReferencesAsset (ActionListAsset actionListAsset)
 
virtual List< ActionListAssetGetReferencedActionListAssets ()
 
virtual bool ReferencesPlayer (int playerID=-1)
 Checks if the Action makes reference to a particular ActionList asset More...
 
virtual void AssignValues ()
 
virtual void Reset (ActionList actionList)
 Resets any runtime values that are necessary to run the Action succesfully More...
 
BoolValue AssignBoolean (List< ActionParameter > parameters, int _parameterID, BoolValue field)
 Replaces a boolean based on an ActionParameter, if appropriate. More...
 
int AssignInteger (List< ActionParameter > parameters, int _parameterID, int field)
 Replaces an integer based on an ActionParameter, if appropriate. More...
 
float AssignFloat (List< ActionParameter > parameters, int _parameterID, float field)
 Replaces a float based on an ActionParameter, if appropriate. More...
 
Transform AssignFile (List< ActionParameter > parameters, int _parameterID, int _constantID, Transform field)
 Replaces a Transform based on an ActionParameter or ConstantID instance, if appropriate. More...
 
Collider AssignFile (List< ActionParameter > parameters, int _parameterID, int _constantID, Collider field)
 Replaces a Collider based on an ActionParameter or ConstantID instance, if appropriate. More...
 
Object AssignObject< T > (List< ActionParameter > parameters, int _parameterID, Object field)
 Replaces a GameObject based on an ActionParameter or ConstantID instance, if appropriate. More...
 
AssignFile< T > (List< ActionParameter > parameters, int _parameterID, int _constantID, T field, bool doLog=true)
 Replaces a generic Behaviour based on an ActionParameter or ConstantID instance, if appropriate. More...
 
AssignFile< T > (int _constantID, T field)
 Replaces a generic Behaviour based on a ConstantID, if appropriate. More...
 
Transform AssignFile (int _constantID, Transform field)
 Replaces a Transform based on a ConstantID, if appropriate. More...
 
void FixLinkAfterDeleting (Action actionToDelete, Action targetAction, List< Action > actionList)
 
virtual void SetLastResult (int _lastRunOutput)
 Updates which output was followed when the Action was last run More...
 
void ResetLastResult ()
 
virtual void ResetAssetValues ()
 
void SetOutput (ActionEnd actionEnd)
 Update the Action's output socket More...
 

Static Public Member Functions

static ActionMenuState CreateNew_TurnOnMenu (string menuToTurnOn, bool unlockMenu=true, bool doTransition=true, bool waitUntilFinish=false)
 Creates a new instance of the 'Menu: Change state' Action, set to turn a menu on More...
 
static ActionMenuState CreateNew_TurnOffMenu (string menuToTurnOff, bool lockMenu=false, bool doTransition=true, bool waitUntilFinish=false)
 Creates a new instance of the 'Menu: Change state' Action, set to turn a menu off More...
 
static ActionMenuState CreateNew_SetElementVisibility (string menuName, string elementToAffect, bool makeVisible)
 Creates a new instance of the 'Menu: Change state' Action, set to alter a menu element's visibility More...
 
static ActionMenuState CreateNew_AddJournalPage (string menuName, string journalElementName, string newPageText, int newPageTranslationID=-1, int pageIndexToInsertInto=-1, bool avoidDuplicates=true)
 Creates a new instance of the 'Menu: Change state' Action, set to add a new page to a journal elemnt More...
 
static ActionMenuState CreateNew_RemoveJournalPage (string menuName, string journalElementName, RemoveJournalPageMethod removeJournalPageMethod=RemoveJournalPageMethod.RemoveSinglePage, int pageIndexToRemove=-1)
 
- Static Public Member Functions inherited from AC.Action
static int ChooseParameterGUI (string label, List< ActionParameter > _parameters, int _parameterID, ParameterType _expectedType, int excludeParameterID=-1, string tooltip="", bool alwaysShow=false)
 
static int ChooseParameterGUI (string label, List< ActionParameter > _parameters, int _parameterID, ParameterType[] _expectedTypes, int excludeParameterID=-1, string tooltip="")
 
static int ChooseParameterGUI (List< ActionParameter > _parameters, int _parameterID)
 
static int FieldToID (GameObject field, int _constantID, bool alwaysAssign, bool _isAssetFile)
 
static GameObject IDToField (GameObject field, int _constantID, bool moreInfo, bool alwaysShow, bool _isAssetFile)
 
static ActionEnd GenerateStopActionEnd ()
 
static T CreateNew< T > ()
 
static Action CreateNew (string className)
 
static void EditSource (Action _action)
 

Public Attributes

MenuChangeType changeType = MenuChangeType.TurnOnMenu
 
string menuToChange = ""
 
int menuToChangeParameterID = -1
 
string elementToChange = ""
 
int elementToChangeParameterID = -1
 
string journalText = ""
 
bool onlyAddNewJournal = false
 
bool doFade = false
 
int lineID = -1
 
int journalPageIndex = -1
 
int journalPageIndexParameterID = -1
 
bool preprocessTextTokens = false
 
- Public Attributes inherited from AC.Action
int id
 
bool isDisplayed
 
bool showComment
 
string comment
 
bool willWait
 
bool isRunning
 
List< ActionEndendings = new List<ActionEnd> ()
 
bool isEnabled = true
 
bool isAssetFile = false
 
bool isMarked = false
 
bool isBreakPoint = false
 
Color overrideColor = Color.white
 
bool showOutputSockets = true
 
ActionList parentActionListInEditor = null
 

Protected Member Functions

void RunInstant (AC.Menu _menu)
 
- Protected Member Functions inherited from AC.Action
void AddSearchTerm (string term)
 
string TextArea (string text)
 
string TextField (string label, string text)
 
string DelayedTextField (string label, string text)
 
void AfterRunningOption ()
 
void SkipActionGUI (ActionEnd ending, List< Action > actions, bool showGUI)
 
void AssignConstantID< T > (T field, int _constantID, int _parameterID)
 
void AssignConstantID (Collider field, int _constantID, int _parameterID)
 
void AssignConstantID (Transform field, int _constantID, int _parameterID)
 
void AssignConstantID (GameObject field, int _constantID, int _parameterID)
 
int ChoosePlayerGUI (int _playerID, bool includeActiveOption=false)
 
void TryAssignConstantID (Component component, ref int _constantID)
 
void TryAssignConstantID (GameObject gameObject, ref int _constantID)
 
Player AssignPlayer (int _playerID, List< ActionParameter > parameters, int _playerParameterID)
 
void Log (string message, Object context=null)
 
void LogWarning (string message, Object context=null)
 
void LogError (string message, Object context=null)
 
ActionParameter GetParameterWithID (List< ActionParameter > parameters, int _id)
 
string AssignString (List< ActionParameter > parameters, int _parameterID, string field)
 
Vector3 AssignVector3 (List< ActionParameter > parameters, int _parameterID, Vector3 field)
 
int AssignVariableID (List< ActionParameter > parameters, int _parameterID, int field)
 
GVar AssignVariable (List< ActionParameter > parameters, int _parameterID, GVar field)
 
Variables AssignVariablesComponent (List< ActionParameter > parameters, int _parameterID, Variables field)
 
int AssignInvItemID (List< ActionParameter > parameters, int _parameterID, int field)
 
int AssignDocumentID (List< ActionParameter > parameters, int _parameterID, int field)
 
GameObject AssignFile (List< ActionParameter > parameters, int _parameterID, int _constantID, GameObject field)
 Replaces a GameObject based on an ActionParameter or ConstantID instance, if appropriate. More...
 
GameObject AssignFile (int _constantID, GameObject field)
 Replaces a GameObject based on a ConstantID, if appropriate. More...
 
virtual string GetSocketLabel (int i)
 
ActionEnd GenerateActionEnd (ResultAction _resultAction, ActionListAsset _linkedAsset, Cutscene _linkedCutscene, int _skipAction, Action _skipActionActual, List< Action > _actions)
 

Protected Attributes

RemoveJournalPageMethod removeJournalPageMethod = RemoveJournalPageMethod.RemoveSinglePage
 
LocalVariables localVariables
 
string runtimeMenuToChange
 
- Protected Attributes inherited from AC.Action
ActionCategory category = ActionCategory.Custom
 
string title = "Untitled"
 
string description
 

Properties

override ActionCategory Category [get]
 
override string Title [get]
 
override string Description [get]
 
- Properties inherited from AC.Action
string searchData [get, protected set]
 
virtual ActionCategory Category [get]
 
virtual string Title [get]
 
virtual string Description [get]
 
virtual int NumSockets [get]
 
virtual bool RunNormallyWhenSkip [get]
 
virtual bool RunAllOutputs [get]
 
float defaultPauseTime [get]
 
int LastRunOutput [get]
 
Rect NodeRect [get, set]
 

Additional Inherited Members

- Static Public Attributes inherited from AC.Action
const int skipSocketSeparation = 48
 
const int socketSeparation = 28
 

Member Function Documentation

◆ AssignParentList()

override void AC.ActionMenuState.AssignParentList ( ActionList  actionList)
virtual

Passes the ActionList that the Action is a part of to the Action class. This is run before the Action is called or displayed in an Editor.

Parameters
actionListThe ActionList that the Action is contained in

Reimplemented from AC.Action.

◆ AssignValues()

override void AC.ActionMenuState.AssignValues ( List< ActionParameter parameters)
virtual

Overwrites any appropriate variables with values set using parameters, or from ConstantID numbers.

Parameters
parametersA List of parameters that overwrite variable values

Reimplemented from AC.Action.

◆ CanTranslate()

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

◆ ConvertGlobalVariableToLocal()

override bool AC.ActionMenuState.ConvertGlobalVariableToLocal ( int  oldGlobalID,
int  newLocalID,
bool  isCorrectScene 
)
virtual

Converts the Action's references 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
isCorrectSceneIf True, the local variable is in the same scene as this ActionList. Otherwise, no change will made, but the return value will be the same
Returns
True if the Action is affected

Reimplemented from AC.Action.

◆ ConvertLocalVariableToGlobal()

override bool AC.ActionMenuState.ConvertLocalVariableToGlobal ( int  oldLocalID,
int  newGlobalID 
)
virtual

Converts the Action's references from a given local variable to a given global variable

Parameters
oldLocalIDThe ID number of the old local variable
newGlobalIDThe ID number of the new global variable
Returns
True if the Action was amended

Reimplemented from AC.Action.

◆ CreateNew_AddJournalPage()

static ActionMenuState AC.ActionMenuState.CreateNew_AddJournalPage ( string  menuName,
string  journalElementName,
string  newPageText,
int  newPageTranslationID = -1,
int  pageIndexToInsertInto = -1,
bool  avoidDuplicates = true 
)
static

Creates a new instance of the 'Menu: Change state' Action, set to add a new page to a journal elemnt

Parameters
menuNameThe name of the menu with the journal
journalElementNameThe name of the journal element to update
newPageTextThe text of the new page to add
newPageranslationIDThe new page's translation ID number, as generated by the Speech Manager
pageIndexToInsertIntoThe index number of the journal's existing pages to insert the new page into. If negative, it will be inserted at the end
avoidDuplicatedIf True, the page will only be added if not already present in the journal
Returns
The generated Action

◆ CreateNew_SetElementVisibility()

static ActionMenuState AC.ActionMenuState.CreateNew_SetElementVisibility ( string  menuName,
string  elementToAffect,
bool  makeVisible 
)
static

Creates a new instance of the 'Menu: Change state' Action, set to alter a menu element's visibility

Parameters
menuNameThe name of the menu with the element
elementToAffectThe name of the element to affect
makeVisibleIf True, the element will be made visible. Otherwise, it will be made invisible
Returns
The generated Action

◆ CreateNew_TurnOffMenu()

static ActionMenuState AC.ActionMenuState.CreateNew_TurnOffMenu ( string  menuToTurnOff,
bool  lockMenu = false,
bool  doTransition = true,
bool  waitUntilFinish = false 
)
static

Creates a new instance of the 'Menu: Change state' Action, set to turn a menu off

Parameters
menuToTurnOffThe name of the menu to turn off
lockMenuIf True, the menu will be locked as well
doTransitionIf True, the menu will transition off - as opposed to turning off instantly
waitUntilFinishIf True, the Action will wait until the transition has completed
Returns
The generated Action

◆ CreateNew_TurnOnMenu()

static ActionMenuState AC.ActionMenuState.CreateNew_TurnOnMenu ( string  menuToTurnOn,
bool  unlockMenu = true,
bool  doTransition = true,
bool  waitUntilFinish = false 
)
static

Creates a new instance of the 'Menu: Change state' Action, set to turn a menu on

Parameters
menuToTurnOnThe name of the menu to turn on
unlockMenuIf True, the menu will be unlocked as well
doTransitionIf True, the menu will transition on - as opposed to turning on instantly
waitUntilFinishIf True, the Action will wait until the transition has completed
Returns
The generated Action

◆ GetNumTranslatables()

int AC.ActionMenuState.GetNumTranslatables ( )

Gets the maximum number of possible translatable texts.

Returns
The maximum number of possible translatable texts.

Implements AC.ITranslatable.

◆ GetNumVariableReferences()

override int AC.ActionMenuState.GetNumVariableReferences ( VariableLocation  location,
int  varID,
List< ActionParameter parameters,
Variables  variables = null,
int  variablesConstantID = 0 
)
virtual

Gets the number of references the Action makes to a variable

Parameters
locationThe variable's location (Global, Local)
varIDThe variable's ID number
parametersThe List of ActionParameters associated with the ActionList that contains the Action
variablesThe Variables component, if location = VariableLocation.Component
Returns
The number of references the Action makes to the variable

Reimplemented from AC.Action.

◆ GetOwner()

string AC.ActionMenuState.GetOwner ( int  index)

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.

Parameters
indexThe index of the translatable text
Returns
The name of the translatable text's owner.

Implements AC.ITranslatable.

◆ GetTranslatableString()

string AC.ActionMenuState.GetTranslatableString ( int  index)

Gets the text to be translated, given its index.

Parameters
indexThe index of the translatable text
Returns
The text to be translated

Implements AC.ITranslatable.

◆ GetTranslationID()

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

◆ HasExistingTranslation()

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

◆ OwnerIsPlayer()

bool AC.ActionMenuState.OwnerIsPlayer ( int  index)

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.

Parameters
indexThe index of the translatable text
Returns
True if the translatable text's owner is a Player.

Implements AC.ITranslatable.

◆ Run()

override float AC.ActionMenuState.Run ( )
virtual

Runs the Action.

Returns
The time, in seconds, to wait before ActionList calls this function again. If 0, then the Action will not be re-run. If >0, and isRunning = True, then the Action will be re-run isRunning = False

Reimplemented from AC.Action.

◆ SetLabel()

override string AC.ActionMenuState.SetLabel ( )
virtual

Gets a string that is shown after the Action's title in the Editor to help the user understand what it does.

Returns
A string that is shown after the Action's title in the Editor to help the user understand what it does.

Reimplemented from AC.Action.

◆ SetTranslationID()

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

◆ ShowGUI()

override void AC.ActionMenuState.ShowGUI ( List< ActionParameter parameters)
virtual

Shows the Action's GUI when its parent ActionList / ActionListAsset uses parameters.

Parameters
parametersA List of parameters available in the parent ActionList / ActionListAsset

Reimplemented from AC.Action.

◆ Skip()

override void AC.ActionMenuState.Skip ( )
virtual

Runs the Action instantaneously.

Reimplemented from AC.Action.

◆ UpdateVariableReferences()

override int AC.ActionMenuState.UpdateVariableReferences ( VariableLocation  location,
int  oldVarID,
int  newVarID,
List< ActionParameter parameters,
Variables  variables = null,
int  variablesConstantID = 0 
)
virtual

Updated references the Action makes to a variable

Parameters
locationThe variable's location (Global, Local)
oldVarIDThe variable's original ID number
newVarIDThe variable's new ID number
parametersThe List of ActionParameters associated with the ActionList that contains the Action
variablesThe Variables component, if location = VariableLocation.Component
Returns
The number of references the Action makes to the variable

Reimplemented from AC.Action.