ORK Framework  2.29.3
API Documentation
ORKFramework.DataObject Class Reference

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

Public Member Functions

 DataObject ()
 Initializes a new instance of a ORKFramework.DataObject. 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...
 
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 Set (string key, Texture value)
 
void Set (string key, AudioClip value)
 
void Set (string key, GameObject value)
 
void Set (string key, GUISkin value)
 
void Set (string key, Material value)
 
void Set (string key, Font value)
 
void Set (string key, UnityEngine.Object value)
 
void Set (string key, ORKEventAsset value)
 
void SetEnum< T > (string key, T value)
 
void SetData< T > (Dictionary< string, T > data, System.Type type)
 Sets a list containing keys and values of a type. More...
 
void Get< T > (string key, ref T value)
 Get the value assigned to a key. More...
 
void Get (string key, ref int value)
 
void Get (string key, ref float value)
 
void Get (string key, ref bool value)
 
void Get (string key, ref string value)
 
void Get (string key, ref DataObject value)
 
void GetEnum< T > (string key, ref T value)
 
void Get (string key, ref Texture value)
 
void Get (string key, ref AudioClip value)
 
void Get (string key, ref GameObject value)
 
void Get (string key, ref GUISkin value)
 
void Get (string key, ref Material value)
 
void Get (string key, ref Font value)
 
void Get (string key, ref UnityEngine.Object value)
 
void Get (string key, ref ORKEventAsset value)
 
Dictionary< string, T > GetData< T > (System.Type type)
 Gets a list containing keys and values of a type. More...
 
void Set< T > (string key, T[] value)
 Assign an array to a key. 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 SetArrayData< T > (Dictionary< string, T[]> data, System.Type type)
 Sets a list containing keys and values of an array type. More...
 
bool Get< T > (string key, out T[] value)
 Get the array assigned to a key. More...
 
bool Get (string key, out int[] value)
 
bool Get (string key, out float[] value)
 
bool Get (string key, out bool[] value)
 
bool Get (string key, out string[] value)
 
bool Get (string key, out DataObject[] value)
 
Dictionary< string, T[]> GetArrayData< T > (System.Type type)
 Gets a list containing keys and values of an array type. More...
 
DataObject GetFile (string key)
 Gets the ORKFramework.DataObject assigned to a key. More...
 
DataObject [] GetFileArray (string key)
 Gets the ORKFramework.DataObject array assigned to a key. More...
 
ORKDataFile GetDataFile (string name, bool encrypt)
 Returns the ORKFramework.DataObject data in a XML formatted string. More...
 
string ToXML (string name)
 

Detailed Description

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

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

Constructor & Destructor Documentation

◆ DataObject()

ORKFramework.DataObject.DataObject ( )

Initializes a new instance of a ORKFramework.DataObject.

Parameters
nameThe node name of the XML file.

Member Function Documentation

◆ Contains< T >()

bool ORKFramework.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, ORKFramework.DataObject.

◆ ContainsArray< T >()

bool ORKFramework.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, ORKFramework.DataObject.

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

void ORKFramework.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, ORKFramework.DataObject.

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

bool ORKFramework.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, ORKFramework.DataObject.

◆ GetArrayData< T >()

Dictionary<string, T[]> ORKFramework.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> ORKFramework.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()

ORKDataFile ORKFramework.DataObject.GetDataFile ( string  name,
bool  encrypt 
)

Returns the ORKFramework.DataObject data in a XML formatted string.

Parameters
nameThe name of the XML root node.
encryptThe XML data will be encrypted.
Returns
An ORKFramework.ORKDataFile that represents the current data of the ORKFramework.DataObject.

◆ GetFile()

DataObject ORKFramework.DataObject.GetFile ( string  key)

Gets the ORKFramework.DataObject assigned to a key.

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

◆ GetFileArray()

DataObject [] ORKFramework.DataObject.GetFileArray ( string  key)

Gets the ORKFramework.DataObject array assigned to a key.

Returns
The ORKFramework.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 ORKFramework.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, ORKFramework.DataObject.

◆ RemoveArray< T >()

bool ORKFramework.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, ORKFramework.DataObject.

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

void ORKFramework.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, ORKFramework.DataObject.

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

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

Assign an array to a key.

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, ORKFramework.DataObject.

◆ SetArrayData< T >()

void ORKFramework.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 ORKFramework.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.