gameDataService

AngularJS Service for loading and storing game data and locale information.

Requires

Members

(private, inner, nullable) gameData :Object

Source:
Type:
  • Object

Methods

(static) get() → (nullable) {Object}

Returns the game data from module:gameDataService~gameData

Source:
Returns:
Type:
Object

(static) getCopy() → (nullable) {Object}

Returns a deep copy of the game data from module:gameDataService~gameData

Source:
Returns:
Type:
Object

(static) load(params)

Load game data.

Source:
Parameters:
Name Type Description
params Object
Name Type Attributes Description
game_id number
language_id number
callback function <optional>

(static) getLeaderboardFields()

Return the leaderboard fields that will be in used in the game

Source:

(static) setLocale(code, callbackopt)

Set locale by code (aka en_us) and load game data.

Source:
Parameters:
Name Type Attributes Description
code string
callback function <optional>

(static) findLanguageBy(search_value, search_key, use_fallback_data) → (nullable) {Object}

Search the available translations by a specific key/value.

Source:
Parameters:
Name Type Description
search_value string | number

The value to search for in the provided key.

search_key string

The name of the key to search.

use_fallback_data string

Use data array stored in wrapper as fallback

Returns:
Type:
Object

The language description object, if found.

Example

Both return the "English (US)" language description, if it exists:

findLanguageBy(0, 'language_id'); // searches by numeric ID.
findLanguageBy('en_us', 'code'); // searches by locale code.

(private, inner) loaded(game, callbackopt)

Callback used by module:gameDataService.load to handle a successful response from module:APIService.getGame.

Source:
Parameters:
Name Type Attributes Description
game Object
callback function <optional>