Adventure Creator  1.74.2
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2019
AC.GVar Class Reference
Inheritance diagram for AC.GVar:
AC.ITranslatable AC.InvVar

Public Member Functions

 GVar (int[] idArray)
 
 GVar (GVar assetVar)
 
int AssignUniqueID (int[] idArray)
 Sets the internal ID to a unique number based on an array of previously-used values More...
 
void Download (VariableLocation _location=VariableLocation.Global, Variables _variables=null)
 Sets its value to that of its linked variable (if appropriate). More...
 
void Upload (VariableLocation _location=VariableLocation.Global, Variables _variables=null)
 Sets the value of its linked variable to its value (if appropriate). More...
 
void BackupValue ()
 
void RestoreBackupValue ()
 
void SetStringValue (string newValue, int newLineID=-1)
 Sets the value if its type is String. More...
 
void CreateRuntimeTranslations ()
 Transfers translation data from RuntimeLanguages to the variable itself. This allows it to be transferred to other variables with the 'Variable: Copy' Action. More...
 
string[] GetTranslations ()
 Gets the variable's translations, if they exist. More...
 
void CopyFromVariable (GVar oldVar, VariableLocation oldLocation)
 Copies the value of another variable onto itself. More...
 
string GetValue (int languageNumber=0)
 Returns the variable's value. More...
 
string GetPopUpsString ()
 Gets all possible PopUp values as a single string, where the values are separated by a ']' character. More...
 
bool HasTranslations ()
 Checks if the Variable is translatable. More...
 
bool IsGlobalVariable ()
 Checks if this Variable is defined under the Variable Manager's list of Global Variables More...
 
int GetNumPopUpValues ()
 Gets the number of possible values, if of the type PopUp More...
 
string GetPopUpForIndex (int index, int language=0)
 Gets the PopUp value of a given index and language, if of type PopUp More...
 
void AssignPreset (PresetValue presetValue)
 
virtual string GetTranslatableString (int index)
 Gets the text to be translated, given its index. More...
 
virtual int GetTranslationID (int index)
 Gets the translation ID of a given text index. More...
 
virtual AC_TextType GetTranslationType (int index)
 Gets the translation type of a given text index. More...
 
void UpdateTranslatableString (int index, string updatedText)
 
int GetNumTranslatables ()
 Gets the maximum number of possible translatable texts. More...
 
virtual bool HasExistingTranslation (int index)
 Checks if a given text index has already been assigned a unique translation ID. More...
 
virtual 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...
 
virtual bool CanTranslate (int index)
 Checks if a given text index can and should be translated. More...
 
string[] GenerateEditorPopUpLabels ()
 
void ShowGUI (VariableLocation location, bool canEdit, List< VarPreset > _varPresets=null, string apiPrefix="", Variables _variables=null)
 

Public Attributes

string label
 
int id
 
VariableType type
 
string[] popUps
 
VarLink link = VarLink.None
 
string pmVar
 
bool updateLinkOnStart = false
 
bool canTranslate = true
 
int popUpID = 0
 
int textValLineID = -1
 
int popUpsLineID = -1
 
string description = ""
 
bool showInFilter
 

Protected Attributes

int val = 0
 
float floatVal = 0f
 
string textVal = ""
 
GameObject gameObjectVal
 
GameObjectParameterReferences gameObjectSaveReferences = GameObjectParameterReferences.ReferenceSceneInstance
 
Object objectVal
 
Vector3 vector3Val = new Vector3 (0f, 0f, 0f)
 
string[] runtimeTranslations
 

Static Protected Attributes

static string[] boolType = { "False", "True" }
 

Properties

int IntegerValue [get, set]
 
bool? BooleanValue [get, set]
 
float FloatValue [get, set]
 
string TextValue [get, set]
 
Vector3 Vector3Value [get, set]
 
GameObject? GameObjectValue [get, set]
 
bool SavePrefabReference [get]
 
Object? UnityObjectValue [get, set]
 

Detailed Description

A data class for global and local variables. Variables are created in the Variables Manager asset file, and copied to the RuntimeVariables component when the game begins.

Constructor & Destructor Documentation

◆ GVar() [1/2]

AC.GVar.GVar ( int[]  idArray)

The main Constructor. An array of ID numbers is required, to ensure its own ID is unique.

◆ GVar() [2/2]

AC.GVar.GVar ( GVar  assetVar)

A Constructor that copies all values from another variable. This way ensures that no connection remains to the asset file.

Member Function Documentation

◆ AssignUniqueID()

int AC.GVar.AssignUniqueID ( int[]  idArray)

Sets the internal ID to a unique number based on an array of previously-used values

Parameters
idArrayAn array of previously-used ID values
Returns
The new ID number

>

◆ BackupValue()

void AC.GVar.BackupValue ( )

Backs up its value. Necessary when skipping ActionLists that involve checking variable values.

◆ CanTranslate()

virtual bool AC.GVar.CanTranslate ( int  index)
virtual

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.

Reimplemented in AC.InvVar.

◆ CopyFromVariable()

void AC.GVar.CopyFromVariable ( GVar  oldVar,
VariableLocation  oldLocation 
)

Copies the value of another variable onto itself.

Parameters
oldVarThe variable to copy from
oldLocationThe location of the variable to copy (Global, Local)

◆ CreateRuntimeTranslations()

void AC.GVar.CreateRuntimeTranslations ( )

Transfers translation data from RuntimeLanguages to the variable itself. This allows it to be transferred to other variables with the 'Variable: Copy' Action.

◆ Download()

void AC.GVar.Download ( VariableLocation  _location = VariableLocation.Global,
Variables  _variables = null 
)

Sets its value to that of its linked variable (if appropriate).

Parameters
_locationThe variable's location
_variablesThe variable's Variables component, if location = VariableLocation.Component

◆ GetNumPopUpValues()

int AC.GVar.GetNumPopUpValues ( )

Gets the number of possible values, if of the type PopUp

Returns
The number of possible values, if of the type PopUp

◆ GetNumTranslatables()

int AC.GVar.GetNumTranslatables ( )

Gets the maximum number of possible translatable texts.

Returns
The maximum number of possible translatable texts.

Implements AC.ITranslatable.

◆ GetOwner()

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

◆ GetPopUpForIndex()

string AC.GVar.GetPopUpForIndex ( int  index,
int  language = 0 
)

Gets the PopUp value of a given index and language, if of type PopUp

Parameters
indexThe index of the PopUp labels
languageThe language index

<returs>The PopUp value of a given index and language

◆ GetPopUpsString()

string AC.GVar.GetPopUpsString ( )

Gets all possible PopUp values as a single string, where the values are separated by a ']' character.

Returns
All possible PopUp values as a single string, where the values are separated by a ']' character.

◆ GetTranslatableString()

virtual string AC.GVar.GetTranslatableString ( int  index)
virtual

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.

Reimplemented in AC.InvVar.

◆ GetTranslationID()

virtual int AC.GVar.GetTranslationID ( int  index)
virtual

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.

Reimplemented in AC.InvVar.

◆ GetTranslations()

string [] AC.GVar.GetTranslations ( )

Gets the variable's translations, if they exist.

Returns
The variable's translations, if they exist, as an array.

◆ GetTranslationType()

virtual AC_TextType AC.GVar.GetTranslationType ( int  index)
virtual

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.

Reimplemented in AC.InvVar.

◆ GetValue()

string AC.GVar.GetValue ( int  languageNumber = 0)

Returns the variable's value.

Returns
The value, as a formatted string.

◆ HasExistingTranslation()

virtual bool AC.GVar.HasExistingTranslation ( int  index)
virtual

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.

Reimplemented in AC.InvVar.

◆ HasTranslations()

bool AC.GVar.HasTranslations ( )

Checks if the Variable is translatable.

Returns
True if the Variable is translatable

◆ IsGlobalVariable()

bool AC.GVar.IsGlobalVariable ( )

Checks if this Variable is defined under the Variable Manager's list of Global Variables

Returns
True if the variable is Global

◆ OwnerIsPlayer()

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

◆ RestoreBackupValue()

void AC.GVar.RestoreBackupValue ( )

Restores its value from backup. Necessary when skipping ActionLists that involve checking variable values.

◆ SetStringValue()

void AC.GVar.SetStringValue ( string  newValue,
int  newLineID = -1 
)

Sets the value if its type is String.

Parameters
newValueThe new value of the string
newLineIDIf >=0, the translation ID used by SpeechManager / RuntimeLanguages will be updated to this value

◆ SetTranslationID()

virtual void AC.GVar.SetTranslationID ( int  index,
int  lineID 
)
virtual

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.

Reimplemented in AC.InvVar.

◆ Upload()

void AC.GVar.Upload ( VariableLocation  _location = VariableLocation.Global,
Variables  _variables = null 
)

Sets the value of its linked variable to its value (if appropriate).

Parameters
_locationThe variable's location
_variablesThe variable's Variables component, if location = VariableLocation.Component

Member Data Documentation

◆ canTranslate

bool AC.GVar.canTranslate = true

If True, the variable's value can be translated (if PopUp or String)

◆ id

int AC.GVar.id

Its internal ID number.

◆ label

string AC.GVar.label

Its editor name.

◆ link

VarLink AC.GVar.link = VarLink.None

What it links to, if a Global or Compnent Variable. A Variable can link to Options Data, or a Playmaker Variable.

◆ pmVar

string AC.GVar.pmVar

If linked to a Playmaker Variable, the name of the PM variable.

◆ popUpID

int AC.GVar.popUpID = 0

The ID number of the shared popup labels, if more than zero

◆ popUps

string [] AC.GVar.popUps

An array of labels, if a popup.

◆ popUpsLineID

int AC.GVar.popUpsLineID = -1

The translation ID number of the variables's PopUp values (if type == VariableType.PopUp), as generated by SpeechManager

◆ textValLineID

int AC.GVar.textValLineID = -1

The translation ID number of the variable's string value (if type == VariableType.String), as generated by SpeechManager

◆ type

VariableType AC.GVar.type

Its variable type.

◆ updateLinkOnStart

bool AC.GVar.updateLinkOnStart = false

If True and linked to a PlayMaker Global Variable, then PM will be referred to for the initial value.

◆ vector3Val

Vector3 AC.GVar.vector3Val = new Vector3 (0f, 0f, 0f)
protected

Its value, if a Vector3

Property Documentation

◆ BooleanValue

bool? AC.GVar.BooleanValue
getset

Its value, if a boolean.

◆ FloatValue

float AC.GVar.FloatValue
getset

Its value, if a float.

◆ GameObjectValue

GameObject? AC.GVar.GameObjectValue
getset

Its value, if a GameObject.

◆ IntegerValue

int AC.GVar.IntegerValue
getset

Its value, if an integer.

◆ TextValue

string AC.GVar.TextValue
getset

Its value, if a string.

◆ UnityObjectValue

Object? AC.GVar.UnityObjectValue
getset

Its value, if a Unity Object.

◆ Vector3Value

Vector3 AC.GVar.Vector3Value
getset

Its value, if a Vector3.