GameDB  1.6.0
GameDB Pro is a plugin that provides an easy to use and powerful game and meta data editor
GameDBCodegenExample.GameDB Class Reference

Each GameDB will output a generated GameDB class that will allow access to the Tables within the GameDB. Because this is scoped to a custom namespace there are no conflicts between multiple GameDBs in the same project. More...

Inheritance diagram for GameDBCodegenExample.GameDB:
GameDBLibrary.GameDBBase

Classes

class  UnityLogger
 (Unity only)
By default logging by the GameDB is logged via a GameDBLibrary.Logger. This allows the used logger to be replace if logging needs to be redirected. This class redirects logging to the Unity console via Debug.Log etc To replace the Logger set GameDBBase.Logger More...
 

Public Member Functions

 GameDB (string name)
 Initializes a new instance of the GameDB class. Multiple instances of the GameDB can be loaded at run-time. The GameDB can then be identified in the GameDB Editor window by a unique name associated when the instance is created. This allows run-time balancing/modification of the DB to be scoped to a particular instance of the GameDB if for example, you don't want one characters data to change when balancing another. More...
 
Exception Load (string path, bool notify=true)
 (Free Version only) (Unity only)
This method will load a GameDB from the specified path. This should only be used on GameDBs stored in Unity Resources folders as it uses UnityEngine.Resources.Load If loading GameDBs from non Resources folders GameDBBase.Import(string,bool) (or other overloads) should be used instead. More...
 
Exception Load (string path, bool notify=true, bool binary=false, string key=null, string salt=null)
 (Pro Version only) (Unity only)
This method will load a GameDB from the specified path. The GameDB supports being compressed (via LZF) and encrypted (via AES) using the GameDBLibrary.BinaryGameDB utilities. This method will load both a binary or text based GameDB. This should only be used on GameDBs stored in Unity Resources folders as it uses UnityEngine.Resources.Load If loading GameDBs from non Resources folders GameDBBase.Import(string,bool) (or other overloads) should be used instead. More...
 
Exception Load (string path, string language, bool notify=true, bool binary=false, string key=null, string salt=null)
 (Pro Version only) (Unity only) (Localization DB only)
This method will load a GameDB from the specified path. This method is provided when a GameDB is marked as a LocalizationDB. It allows only a certain field (representing a language) across all tables to be loaded, saving on memory and simplyfying access to the required language. The GameDB supports being compressed (via LZF) and encrypted (via AES) using the GameDBLibrary.BinaryGameDB utilities. This method will load both a binary or text based GameDB. This should only be used on GameDBs stored in Unity Resources folders as it uses UnityEngine.Resources.Load If loading GameDBs from non Resources folders GameDBBase.Import(string,bool) (or other overloads) should be used instead. More...
 
Exception Import (string json, string language, bool notify=true)
 (Pro Version only) (Unity only) (Localization DB only)
Imports JSON representing the GameDB. This method is provided when a GameDB is marked as a LocalizationDB. It allows only a certain field (representing a language) across all tables to be imported, saving on memory and simplyfying access to the required language. More...
 
- Public Member Functions inherited from GameDBLibrary.GameDBBase
Exception Import (string jsonData, bool notify=true)
 Imports JSON representing the GameDB. More...
 
Exception Import (string jsonData, string[] columImportList, bool notify=true)
 Imports JSON representing the GameDB. Allows specifying only certain fields to be imported. Useful for limiting the memory used of the loaded GameDB. More...
 
RequestUpdater ImportFromServer (string serverHost, string downloadHost, string userID, string tag, string originalJSON, string cachePath, bool binary, string key, string salt, string[] columImportList=null, Action< Exception > onImport=null)
 (Pro Version only)
Imports the GameDB from a server. Can be used in conjuction with the Golang server provided in the (Pro version) This allows over the air updating of GameDBs so new data can be pushed to clients without the need of releasing new versions of the clients. Downloaded GameDBs will be cached locally to avoid downloading again if they haven't changed. If they have change, only the diff between the original built-in GameDB and the uploaded GameDB will be downloaded. More...
 

Properties

ExampleTable ExampleTable [get]
 A getter will be generated for each table within the GameDB. This will give access to the loaded instance of a table, allowing each row and its fields to be easily access. The getter will be generated with names matching the table name. For Example: {TableName}Table ie. MyTestTable for a table name "MyTest" More...
 
- Properties inherited from GameDBLibrary.GameDBBase
string ScopeName = string.Empty [get]
 Gets the ScopeName of the GameDB set when creating it in the GameDB Editor. More...
 
Logger Logger [get, set]
 Gets or sets the logger used for internal logs. More...
 

Additional Inherited Members

- Public Attributes inherited from GameDBLibrary.GameDBBase
Action OnDBLoaded = null
 OnDBLoaded allows callbacks to be added that are triggered if notify = true when importing or loading data. This allows code to deal with data potentially beind asynchronously loaded (when imported from a server) or hot reloaded via an Import or Reload from the GameDB Editor during run-time in editor. More...
 
string Name => m_internal.Name
 Gets the name of the GameDB set when instantiating. More...
 

Detailed Description

Each GameDB will output a generated GameDB class that will allow access to the Tables within the GameDB. Because this is scoped to a custom namespace there are no conflicts between multiple GameDBs in the same project.

See also
GameDBLibrary.GameDBBase

Constructor & Destructor Documentation

◆ GameDB()

GameDBCodegenExample.GameDB.GameDB ( string  name)

Initializes a new instance of the GameDB class. Multiple instances of the GameDB can be loaded at run-time. The GameDB can then be identified in the GameDB Editor window by a unique name associated when the instance is created. This allows run-time balancing/modification of the DB to be scoped to a particular instance of the GameDB if for example, you don't want one characters data to change when balancing another.

Parameters
nameThe run-time name of the GameDB shown in the GameDB editor.

Member Function Documentation

◆ Import()

Exception GameDBCodegenExample.GameDB.Import ( string  json,
string  language,
bool  notify = true 
)

(Pro Version only) (Unity only) (Localization DB only)
Imports JSON representing the GameDB. This method is provided when a GameDB is marked as a LocalizationDB. It allows only a certain field (representing a language) across all tables to be imported, saving on memory and simplyfying access to the required language.

Parameters
jsonA string representing the JSON format of the GameDB to import
languageThe name of the language field to load.
notifyif set to true the GameDBBase.OnDBLoaded callback will be triggered for the GameDB (defaults to true).
Returns
An exception is returned if the GameDB fails to imprt

◆ Load() [1/3]

Exception GameDBCodegenExample.GameDB.Load ( string  path,
bool  notify = true 
)

(Free Version only) (Unity only)
This method will load a GameDB from the specified path. This should only be used on GameDBs stored in Unity Resources folders as it uses UnityEngine.Resources.Load If loading GameDBs from non Resources folders GameDBBase.Import(string,bool) (or other overloads) should be used instead.

Parameters
pathThe path is relative to Application.dataPath (ie. Assets/) and does not include a file extension. For example to load Assets/Resources/GameDBs/gameDB.json use the path "GameDBs/gameDB"
notifyif set to true the GameDBBase.OnDBLoaded callback will be triggered for the GameDB (defaults to true).
Returns

◆ Load() [2/3]

Exception GameDBCodegenExample.GameDB.Load ( string  path,
bool  notify = true,
bool  binary = false,
string  key = null,
string  salt = null 
)

(Pro Version only) (Unity only)
This method will load a GameDB from the specified path. The GameDB supports being compressed (via LZF) and encrypted (via AES) using the GameDBLibrary.BinaryGameDB utilities. This method will load both a binary or text based GameDB. This should only be used on GameDBs stored in Unity Resources folders as it uses UnityEngine.Resources.Load If loading GameDBs from non Resources folders GameDBBase.Import(string,bool) (or other overloads) should be used instead.

Parameters
pathThe path is relative to Application.dataPath (ie. Assets/) and does not include a file extension. For example to load Assets/Resources/GameDBs/gameDB.json use the path "GameDBs/gameDB"
notifyif set to true the GameDBBase.OnDBLoaded callback will be triggered for the GameDB (defaults to true).
binaryif set to true the GameDB will be loaded as a binary source (defaults to false) (key and salt required if loading binary)
keythe key used to encrypt the database via the GameDBLibrary.BinaryGameDB utilities. Required if using binary = true
saltthe salt used to encrypt the database via the GameDBLibrary.BinaryGameDB utilities. Required if using binary = true
Returns
An exception is returned if the GameDB fails to load

◆ Load() [3/3]

Exception GameDBCodegenExample.GameDB.Load ( string  path,
string  language,
bool  notify = true,
bool  binary = false,
string  key = null,
string  salt = null 
)

(Pro Version only) (Unity only) (Localization DB only)
This method will load a GameDB from the specified path. This method is provided when a GameDB is marked as a LocalizationDB. It allows only a certain field (representing a language) across all tables to be loaded, saving on memory and simplyfying access to the required language. The GameDB supports being compressed (via LZF) and encrypted (via AES) using the GameDBLibrary.BinaryGameDB utilities. This method will load both a binary or text based GameDB. This should only be used on GameDBs stored in Unity Resources folders as it uses UnityEngine.Resources.Load If loading GameDBs from non Resources folders GameDBBase.Import(string,bool) (or other overloads) should be used instead.

Parameters
pathThe path is relative to Application.dataPath (ie. Assets/) and does not include a file extension. For example to load Assets/Resources/GameDBs/gameDB.json use the path "GameDBs/gameDB"
languageThe name of the language field to load.
notifyif set to true the GameDBBase.OnDBLoaded callback will be triggered for the GameDB (defaults to true).
binaryif set to true the GameDB will be loaded as a binary source (defaults to false) (key and salt required if loading binary)
keythe key used to encrypt the database via the GameDBLibrary.BinaryGameDB utilities. Required if using binary = true
saltthe salt used to encrypt the database via the GameDBLibrary.BinaryGameDB utilities. Required if using binary = true
Returns
An exception is returned if the GameDB fails to load

Property Documentation

◆ ExampleTable

ExampleTable GameDBCodegenExample.GameDB.ExampleTable
get

A getter will be generated for each table within the GameDB. This will give access to the loaded instance of a table, allowing each row and its fields to be easily access. The getter will be generated with names matching the table name. For Example: {TableName}Table ie. MyTestTable for a table name "MyTest"

The loaded instance of the associated table.

See also
GameDBCodegenExample.ExampleTable