The data stored in a dynamically created level with LevelEditor available from LevelBase. More...
Import Statement: | import Felgo 3.0 |
Inherits: |
The LevelData contains the data of a level created with LevelEditor::saveCurrentLevel() or LevelEditor::createNewLevel(). It is accessible either from LevelBase::levelData or LevelEditor::currentLevelData once the level got loaded with LevelEditor::loadSingleLevel().
See also LevelBase and LevelEditor.
customData : variant |
Use this optional property to store any additional data to the level that gets changed during the game.
levelMetaData : variant |
This property holds the metaData of this level like the levelName
, description
, levelBaseName
or levelBaseUrl
. The levelMetaData is available before a level is
actually loaded with LevelEditor::loadSingleLevel(). Thus store any information here you want to display in the LevelSelectionList.
The levelMetaData changes based on the LevelEditor::currentLevelStorageLocation. For example, a level that was published to the game community with
LevelEditor::publishLevel() has more properties like avg_rating
or times_downloaded
, which are not existing for local levels.
This is an example for a levelMetaData from an LevelEditor::authorGeneratedLevels from the Squaby Demo:
{ "levelId":201, "levelName":"Great Level", "creationTime":"Fri, 03 May 2013 14:48:01 GMT", "lastModificationTime":"Fri, 03 May 2013 14:48:01 GMT", "levelBaseName":"DynamicLevel01", "storageLocation":"authorGenerated" }
These are the keys for a LevelEditor::userGeneratedLevels location for a level published for level sharing with LevelEditor::publishLevel():
{ "levelId": 2, "publishedLevelId": 6640, "levelName": "Level Name", "description": "Level description", "average_quality": 0, "average_difficulty": 0, "times_quality_rated": 0, "times_difficulty_rated": 0, "times_favored": 0, "times_downloaded": 0, "times_played": 0, "created_at": "2013-05-13T14:43:57Z", "updated_at": "2013-05-13T14:43:57Z", "rating": { "difficulty": 0, "quality": 1, "favored": false, "times_played": 0 }, "user": { "id": 8, "facebook_id": "asdf2", "profile_picture": null, "name": "Chris", "platform": "Android" }, "storageLocation":"userGenerated" }
The user
block contains information about the user who published the level, i.e. the level creator.
The rating
block contains the rating for the logged in user sent with LevelEditor::rateLevel() before. If the user did not rate the level yet, this block
does not exist.
Use these properties to display the level in the LevelSelectionList::levelItemDelegate. For example to show the level name, set the following as the delegate:
import Felgo 3.0 SimpleButton { height: 20 width: levelSelectionList.width // the levelName is a key of levelMetaData (=modelData) // you can access all the properties here text: modelData.levelName onClicked: { levelSelectionList.levelSelected(modelData) } }// end of SimpleButton
See the Stack With Friends Demo for a full example how to customize a LevelSelectionList::levelItemDelegate.
As part of the free Business evaluation, we offer a free welcome call for companies, to talk about your requirements, and how the Felgo SDK & Services can help you. Just sign up and schedule your call.
Sign up now to start your free Business evaluation: