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

Public Member Functions

 InvVar (int[] idArray)
 
 InvVar (int _id, VariableType _type)
 
 InvVar (InvVar assetVar)
 
void TransferValues (InvVar invVar, bool addValues=false)
 Updates the 'value' variables specific to an inventory item based on another InvVar instance. More...
 
string GetDisplayValue (int languageNumber=0, int itemCount=1)
 Gets the property's value as a string. More...
 
void LoadData (string[] data)
 
override string GetTranslatableString (int index)
 Gets the text to be translated, given its index. More...
 
override int GetTranslationID (int index)
 Gets the translation ID of a given text index. More...
 
override AC_TextType GetTranslationType (int index)
 Gets the translation type of a given text index. More...
 
override bool HasExistingTranslation (int index)
 Checks if a given text index has already been assigned a unique translation ID. More...
 
override void SetTranslationID (int index, int _lineID)
 Sets the translation ID of a given text index More...
 
override bool CanTranslate (int index)
 Checks if a given text index can and should be translated. More...
 
void ShowGUI (string apiPrefix, bool allowSceneGameObjects=false)
 
- Public Member Functions inherited from AC.GVar
 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 ()
 
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)
 
override string ToString ()
 
void UpdateTranslatableString (int index, string updatedText)
 
int GetNumTranslatables ()
 Gets the maximum number of possible translatable texts. 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...
 
string[] GenerateEditorPopUpLabels ()
 
void ShowGUI (VariableLocation location, bool canEdit, List< VarPreset > _varPresets=null, string apiPrefix="", Variables _variables=null)
 

Public Attributes

bool limitToCategories = false
 
List< int > categoryIDs = new List<int>()
 
- Public Attributes inherited from AC.GVar
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
 

Additional Inherited Members

- Protected Attributes inherited from AC.GVar
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 inherited from AC.GVar
static string[] boolType = { "False", "True" }
 
- Properties inherited from AC.GVar
int IntegerValue [get, set]
 
string PopUpValue [get]
 
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 inventory properties. Properties are created in the Inventory Manager asset file, and stored in each instance of InvItem class. Inventory items held by the player during gameplay are stored in the localItems List within RuntimeInventory.

Constructor & Destructor Documentation

◆ InvVar() [1/3]

AC.InvVar.InvVar ( int[]  idArray)

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

◆ InvVar() [2/3]

AC.InvVar.InvVar ( int  _id,
VariableType  _type 
)

A blank Constructor.

◆ InvVar() [3/3]

AC.InvVar.InvVar ( InvVar  assetVar)

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

Member Function Documentation

◆ CanTranslate()

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

Reimplemented from AC.GVar.

◆ GetDisplayValue()

string AC.InvVar.GetDisplayValue ( int  languageNumber = 0,
int  itemCount = 1 
)

Gets the property's value as a string.

Parameters
languageNumberThe index number of the game's current language (0 = original)
itemCountIf the variable's type is Float or Integer, the value will by multipled by this
Returns
The property's value as a string

◆ GetTranslatableString()

override string AC.InvVar.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

Reimplemented from AC.GVar.

◆ GetTranslationID()

override int AC.InvVar.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

Reimplemented from AC.GVar.

◆ GetTranslationType()

override AC_TextType AC.InvVar.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.

Reimplemented from AC.GVar.

◆ HasExistingTranslation()

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

Reimplemented from AC.GVar.

◆ SetTranslationID()

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

Reimplemented from AC.GVar.

◆ TransferValues()

void AC.InvVar.TransferValues ( InvVar  invVar,
bool  addValues = false 
)

Updates the 'value' variables specific to an inventory item based on another InvVar instance.

Parameters
invVarThe other InvVar to copy 'value' variables from
addValuesIf True, integer and float values will be added to the property, rather then replaced/param>

Member Data Documentation

◆ categoryIDs

List<int> AC.InvVar.categoryIDs = new List<int>()

A List of category IDs that the property belongs to, if limitToCategories = True. Categories are stored within InventoryManager's bins variable

◆ limitToCategories

bool AC.InvVar.limitToCategories = false

If True, then the property will be limited to inventory items within certain categories