This page has been translated automatically.
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Migration
Migrating to UNIGINE 2.0
C++ API Migration
Migrating from UNIGINE 2.0 to UNIGINE 2.1
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

GameData Class

Provides an access to the game data.

The GameData class implementation can be found in the data/framework/game/game_data.h file.

GameData Class

Members


GameData ()

Constructor. Creates a new GameData class instance.

void loadData (Xml xml)

Reads game data from the Xml class instance.

Arguments

  • Xml xml - Game data.

void saveData (Xml xml)

Writes game data to the Xml class instance.

Arguments

  • Xml xml - Instance of the Xml class to write game data.

void load (string file_name)

Loads game data from the file.

Arguments

  • string file_name - Path to the game file.

void save ()

Saves game data to the *.game file.

string getGameFile (int is_absolute = false)

Returns a path to the game file relative to data_path.

Arguments

  • int is_absolute - Flag indicating if an absolute file path is returned. 1 to return an absolute file path; otherwise 0.

Return value

Path to the *.game file.

void setGameFile (string path)

Sets a path to the game file.

Arguments

  • string path - Relative path to the *.game file.

string getGamePath (int is_absolute = false)

Returns a path to the game file folder relative to data_path.

Arguments

  • int is_absolute - Flag indicating if an absolute file path is returned. 1 to return an absolute file path; otherwise 0.

Return value

Path to the game file folder.

int getNumEntities ()

Returns the number of game entities.

Return value

Number of game entities.

EntityData getEntity (variable index)

Returns an entity by the index.

Arguments

  • variable index - Entity number if index is an integer; entity name if index is a string.

Return value

Entity data.

void removeEntity (variable index)

Removes an entity by index.

Arguments

  • variable index - Entity number if index is an integer; entity name if index is a string.

EntityData addEntity (string name)

Creates a new entity and adds it to the entities list.

Arguments

  • string name - Name of the new entity.

Return value

New entity.

string getEntityPropertyFile (int is_absolute = false)

Returns a path to the property file of the basic entity.

Arguments

  • int is_absolute - Flag indicating if an absolute file path is returned. 1 to return an absolute file path; otherwise 0.

Return value

Path to the property file.

void setEntityPropertyFile (string file)

Sets a path to the property file of the basic entity.

Arguments

  • string file - Path to the property file.

int getNumLevels ()

Returns the number of game levels.

Return value

Number of game levels.

LevelData getLevel (variable index)

Returns LevelData by index.

Arguments

  • variable index - Level number if index is an integer; level name if index is a string.

Return value

LevelData.

void removeLevel (variable index)

Removes a level by index.

Arguments

  • variable index - Level number if index is an integer; level name if index is a string.

LevelData addLevel (string name)

Adds a new level to the game.

Arguments

  • string name - Name of the new level.

Return value

New level.

string getName ()

Returns a game name.

Return value

Game name.

void setName (string name)

Sets a game name.

Arguments

  • string name - Game name.

string getDeveloper ()

Returns an information about the game developer.

Return value

Information about the game developer.

void setDeveloper (string developer)

Adds an information about the game developer.

Arguments

  • string developer - Information about the game developer

string getCopyright ()

Returns a copyright information.

Return value

Copyright information.

void setCopyright (string copyright)

Adds a copyright information.

Arguments

  • string copyright - Copyright information.

string getVersion ()

Returns a game version.

Return value

Game version.

void setVersion (string version)

Adds an information about the game version.

Arguments

  • string version - Information about the game version

string getDescription ()

Returns a game description.

Return value

Game description.

void setDescription (string description)

Adds a game description.

Arguments

  • string description - Game description.

string getWindowTitle ()

Returns a title of the game window.

Return value

Game window title.

void setWindowTitle (string window_title)

Sets a title of the game window.

Arguments

  • string window_title - Game window title.

string getPropertiesListFile (int is_absolute = false)

Returns a path to the file of the game properties.

Arguments

  • int is_absolute - Flag indicating if an absolute file path is returned. 1 to return an absolute file path; otherwise 0.

Return value

Path to the game properties file.

void setPropertiesListFile (string path)

Sets a path to the file of the game properties.

Arguments

  • string path - Path to the game properties file.
Last update: 2017-07-03
Build: ()