Makinom  2.21.0
API Documentation
GamingIsLove.Makinom.DataObject Class Reference

Used to handle data from IBaseData objects for data serialization. Supported types: More...

Public Member Functions

 DataObject ()
 Initializes a new instance of a GamingIsLove.Makinom.DataObject. More...
 
 DataObject (byte[] byteData, bool decrypt, DataFile file)
 Initializes a new instance of a GamingIsLove.Makinom.DataObject, loading byte array data from a GamingIsLove.Makinom.DataFile. More...
 
bool Contains< T > (string key)
 Determines if the data object contains the specified key for a data type. More...
 
bool ContainsArray< T > (string key)
 Determines if the data object contains the specified key for an array of a a data type. More...
 
object Get (string key)
 
bool Remove< T > (string key)
 Removes content of a specified key for a data type. More...
 
bool RemoveArray< T > (string key)
 Removes content of a specified key for an array of a a data type. More...
 
void Set< T > (string key, T value)
 Assign a value to a key. Enum types are converted to integers. More...
 
void Set (string key, int value)
 
void Set (string key, float value)
 
void Set (string key, bool value)
 
void Set (string key, string value)
 
void Set (string key, DataObject value)
 
void SetAsset (string key, UnityEngine.Object value)
 
void SetEnum< T > (string key, T value)
 
void Set (string key, Vector2 value)
 
void Set (string key, Vector3 value)
 
void Set (string key, Vector4 value)
 
void Set (string key, Rect value)
 
void Set (string key, Color value)
 
void Set (string key, AnimationCurve value)
 
bool Get< T > (string key, ref T value)
 Get the value assigned to a key. More...
 
bool Get (string key, ref int value)
 
void LoadInt (FieldInfo field, object instance)
 
bool Get (string key, ref float value)
 
void LoadFloat (FieldInfo field, object instance)
 
bool Get (string key, ref bool value)
 
void LoadBool (FieldInfo field, object instance)
 
bool Get (string key, ref string value)
 
void LoadString (FieldInfo field, object instance)
 
bool Get (string key, ref DataObject value)
 
bool GetAsset (string key, ref UnityEngine.Object value)
 
void LoadAsset (FieldInfo field, object instance)
 
bool GetEnum< T > (string key, ref T value)
 
bool Get (string key, ref Vector2 value)
 
void LoadVector2 (FieldInfo field, object instance)
 
bool Get (string key, ref Vector3 value)
 
void LoadVector3 (FieldInfo field, object instance)
 
bool Get (string key, ref Vector4 value)
 
void LoadVector4 (FieldInfo field, object instance)
 
bool Get (string key, ref Rect value)
 
void LoadRect (FieldInfo field, object instance)
 
bool Get (string key, ref Color value)
 
void LoadColor (FieldInfo field, object instance)
 
bool Get (string key, ref AnimationCurve value)
 
void LoadAnimationCurve (FieldInfo field, object instance)
 
Dictionary< string, T > GetData< T > (System.Type type)
 Gets a list containing keys and values of a type. More...
 
void SetData< T > (Dictionary< string, T > data, System.Type type)
 Sets a list containing keys and values of a type. More...
 
void Set< T > (string key, T[] value)
 Assign an array to a key. Enum arrays are used as integer arrays. More...
 
void Set (string key, int[] value)
 
void Set (string key, float[] value)
 
void Set (string key, bool[] value)
 
void Set (string key, string[] value)
 
void Set (string key, DataObject[] value)
 
void Set (string key, Vector2[] value)
 
void Set (string key, Vector3[] value)
 
void Set (string key, Vector4[] value)
 
void Set (string key, Rect[] value)
 
void Set (string key, Color[] value)
 
bool Get< T > (string key, out T[] value)
 Get the array assigned to a key. More...
 
bool Get (string key, out int[] value)
 
void LoadIntArray (FieldInfo field, object instance)
 
void LoadEnumArray (FieldInfo field, object instance)
 
bool Get (string key, out float[] value)
 
void LoadFloatArray (FieldInfo field, object instance)
 
bool Get (string key, out bool[] value)
 
void LoadBoolArray (FieldInfo field, object instance)
 
bool Get (string key, out string[] value)
 
void LoadStringArray (FieldInfo field, object instance)
 
bool Get (string key, out DataObject[] value)
 
bool Get (string key, out Vector2[] value)
 
void LoadVector2Array (FieldInfo field, object instance)
 
bool Get (string key, out Vector3[] value)
 
void LoadVector3Array (FieldInfo field, object instance)
 
bool Get (string key, out Vector4[] value)
 
void LoadVector4Array (FieldInfo field, object instance)
 
bool Get (string key, out Rect[] value)
 
void LoadRectArray (FieldInfo field, object instance)
 
bool Get (string key, out Color[] value)
 
void LoadColorArray (FieldInfo field, object instance)
 
Dictionary< string, T[]> GetArrayData< T > (System.Type type)
 Gets a list containing keys and values of an array type. More...
 
void SetArrayData< T > (Dictionary< string, T[]> data, System.Type type)
 Sets a list containing keys and values of an array type. More...
 
DataObject GetFile (string key)
 Gets the GamingIsLove.Makinom.DataObject assigned to a key. More...
 
DataObject [] GetFileArray (string key)
 Gets the GamingIsLove.Makinom.DataObject array assigned to a key. More...
 
string ToXML (string name)
 
string ToXML (string name, DataFile file)
 
DataFile GetDataFile (string name, bool encrypt, DataFile.SaveFormatType format)
 Converts the data into a GamingIsLove.Makinom.DataFile, writing the data as a byte array. More...
 
ComponentDataFile GetComponentDataFile (string name, bool encrypt)
 

Detailed Description

Used to handle data from IBaseData objects for data serialization. Supported types:

  • int, float, bool, string
  • int[], float[], bool[], string[]
  • enum is used as int
  • enum[] is used as int[]
  • Vector2, Vector2[], Vector3, Vector3[], Vector4, Vector4[], Rect, Rect[] are used as float[].

Constructor & Destructor Documentation

◆ DataObject() [1/2]

GamingIsLove.Makinom.DataObject.DataObject ( )

Initializes a new instance of a GamingIsLove.Makinom.DataObject.

◆ DataObject() [2/2]

GamingIsLove.Makinom.DataObject.DataObject ( byte []  byteData,
bool  decrypt,
DataFile  file 
)

Initializes a new instance of a GamingIsLove.Makinom.DataObject, loading byte array data from a GamingIsLove.Makinom.DataFile.

Parameters
byteDataThe byte array data
decrypttrue if the data is encrypted
fileThe data file the data is coming from (used for loading asset references).

Member Function Documentation

◆ Contains< T >()

bool GamingIsLove.Makinom.DataObject.Contains< T > ( string  key)

Determines if the data object contains the specified key for a data type.

Returns
true if the data object contains the key; otherwise false.
Parameters
keyThe key.
Template Parameters
TThe data type used. Supported types: int, float, bool, string, GamingIsLove.Makinom.DataObject.

◆ ContainsArray< T >()

bool GamingIsLove.Makinom.DataObject.ContainsArray< T > ( string  key)

Determines if the data object contains the specified key for an array of a a data type.

Returns
true if the data object contains the key; otherwise false.
Parameters
keyThe key.
Template Parameters
TThe data type used. Supported types: int, float, bool, string, GamingIsLove.Makinom.DataObject.

◆ Get< T >() [1/2]

bool GamingIsLove.Makinom.DataObject.Get< T > ( string  key,
ref T  value 
)

Get the value assigned to a key.

Parameters
keyThe key to look for.
valueThe reference to the variable holding the value. If the key is found the value is stored in this variable.
Template Parameters
TThe data type used. Supported types: int, float, bool, string, GamingIsLove.Makinom.DataObject.

◆ Get< T >() [2/2]

bool GamingIsLove.Makinom.DataObject.Get< T > ( string  key,
out T []  value 
)

Get the array assigned to a key.

Parameters
keyThe key to look for.
valueThe reference to the array holding the value. If the key is found the array is copied into this variable. Else an array with length 0 will be assigned.
Template Parameters
TThe data type used. Supported types: int, float, bool, string, GamingIsLove.Makinom.DataObject.

◆ GetArrayData< T >()

Dictionary<string, T[]> GamingIsLove.Makinom.DataObject.GetArrayData< T > ( System.Type  type)

Gets a list containing keys and values of an array type.

Returns
A Dictionary<string, T[]> containing keys (string) and array values (T[]).
Parameters
typeThe data type (System.Type).
Template Parameters
TThe generic data type.

◆ GetData< T >()

Dictionary<string, T> GamingIsLove.Makinom.DataObject.GetData< T > ( System.Type  type)

Gets a list containing keys and values of a type.

Returns
A Dictionary<string, T> containing keys (string) and values (T).
Parameters
typeThe data type (System.Type).
Template Parameters
TThe generic data type.

◆ GetDataFile()

DataFile GamingIsLove.Makinom.DataObject.GetDataFile ( string  name,
bool  encrypt,
DataFile.SaveFormatType  format 
)

Converts the data into a GamingIsLove.Makinom.DataFile, writing the data as a byte array.

Parameters
nameThe name of the data file.
encryptThe byte array data will be encrypted.
Returns
A GamingIsLove.Makinom.DataFile that represents the current data of the GamingIsLove.Makinom.DataObject.

◆ GetFile()

DataObject GamingIsLove.Makinom.DataObject.GetFile ( string  key)

Gets the GamingIsLove.Makinom.DataObject assigned to a key.

Returns
The GamingIsLove.Makinom.DataObject if the key is found. Returns null if the key isn't found.
Parameters
keyThe key to look for.

◆ GetFileArray()

DataObject [] GamingIsLove.Makinom.DataObject.GetFileArray ( string  key)

Gets the GamingIsLove.Makinom.DataObject array assigned to a key.

Returns
The GamingIsLove.Makinom.DataObject array if the key is found. Returns an array with length 0 if the key isn't found.
Parameters
keyThe key to look for.

◆ Remove< T >()

bool GamingIsLove.Makinom.DataObject.Remove< T > ( string  key)

Removes content of a specified key for a data type.

Returns
true if the content was removed; otherwise false.
Parameters
keyThe key.
Template Parameters
TThe data type used. Supported types: int, float, bool, string, GamingIsLove.Makinom.DataObject.

◆ RemoveArray< T >()

bool GamingIsLove.Makinom.DataObject.RemoveArray< T > ( string  key)

Removes content of a specified key for an array of a a data type.

Returns
true if the content was removed; otherwise false.
Parameters
keyThe key.
Template Parameters
TThe data type used. Supported types: int, float, bool, string, GamingIsLove.Makinom.DataObject.

◆ Set< T >() [1/2]

void GamingIsLove.Makinom.DataObject.Set< T > ( string  key,
value 
)

Assign a value to a key. Enum types are converted to integers.

Parameters
keyThe key the value will be assigned to.
valueThe value that will be assigned.
Template Parameters
TThe data type used. Supported types: int, float, bool, string, GamingIsLove.Makinom.DataObject.

◆ Set< T >() [2/2]

void GamingIsLove.Makinom.DataObject.Set< T > ( string  key,
T []  value 
)

Assign an array to a key. Enum arrays are used as integer arrays.

Parameters
keyThe key the array will be assigned to.
valueThe array that will be assigned.
Template Parameters
TThe data type used. Supported types: int, float, bool, string, GamingIsLove.Makinom.DataObject.

◆ SetArrayData< T >()

void GamingIsLove.Makinom.DataObject.SetArrayData< T > ( Dictionary< string, T[]>  data,
System.Type  type 
)

Sets a list containing keys and values of an array type.

Parameters
dataA Dictionary<string, T[]> containing keys (string) and array values (T[]).
typeThe data type (System.Type).
Template Parameters
TThe generic data type.

◆ SetData< T >()

void GamingIsLove.Makinom.DataObject.SetData< T > ( Dictionary< string, T >  data,
System.Type  type 
)

Sets a list containing keys and values of a type.

Parameters
dataA Dictionary<string, T> containing keys (string) and values (T).
typeThe data type (System.Type).
Template Parameters
TThe generic data type.