VoltAir
|
The top-level Game object for VoltAir. More...
Public Slots | |
void | onLevelCompleted () |
Respond to a level being completed. More... | |
void | onSignedIntoCloudChanged (bool signedIntoCloud) |
Respond to a change to the state of GPGS cloud sign-in. More... | |
void | onCloudDataLoaded (int statusCode, const QString &data) |
Respond to the GPGS cloud data being loaded. More... | |
QString | onCloudDataConflict (const QString &localData, const QString &serverData) |
Respond to a conflict in the loading of GPGS cloud data. More... | |
Signals | |
void | levelCompleted (bool gameIsOver, int oneStarThreshold, int twoStarThreshold, int threeStarThreshold, int fourStarThreshold, int playerScore) |
Emitted on level completed. More... | |
void | playerScoreChanged (int playerId, int score) |
Emitted when a player's score changes. More... | |
Public Member Functions | |
void | init () |
Initialize the game. More... | |
bool | isUiActive () const |
Returns if any of the UI screens are active. More... | |
LevelProgressionList * | getLevelProgressionList () const |
Returns the unique LevelProgressionList for the game. More... | |
void | tryLoadLevel () |
Informs the engine to load the current level. More... | |
DebugMetricsMonitor * | getDebugMetricsMonitor () const |
Returns the unique DebugMetricsMonitor for the game. More... | |
void | updatePlayerScore (int playerId, int amountChanged) |
Updates score and completes level if appropriate. More... | |
Q_INVOKABLE UiInternal * | getUi () const |
Returns the main UI element. More... | |
Q_INVOKABLE LevelProgression * | getCurrentLevelProgression () const |
Returns the current LevelProgression selected by the player. More... | |
Q_INVOKABLE LevelInfo * | getCurrentLevelInfo () const |
Returns the current LevelInfo selected by the player. More... | |
Q_INVOKABLE bool | isEnvironmentUnlocked (const QString &progressionName, const QString &environmentName) const |
Returns whether or not the specified environment is unlocked in the specified progression. More... | |
Q_INVOKABLE bool | isLevelUnlocked (const QString &progressionName, const QString &levelName) const |
Returns whether or not the specified level is unlocked in the specified progression. More... | |
Q_INVOKABLE int | getNumStars (const QString &progressionName, const QString &levelName) const |
Returns the highest number of stars achieved on a level, as logged in the PlayerProfile. More... | |
Q_INVOKABLE int | getLastPlayedEnvironmentIndex (const QString &progressionName) const |
Returns the index of the environment last played in the specified progression. More... | |
Q_INVOKABLE int | getLastPlayedLevelIndexInEnvironment (const QString &progressionName, const QString &environmentName) const |
Returns the index of the last played level in a given environment. More... | |
Q_INVOKABLE void | unlockAchievement (const QString &name, bool immediately=true) |
Unlocks a Google Play Games Services achievement. More... | |
Q_INVOKABLE void | incrementAchievement (const QString &name, int numSteps, bool immediately=false) |
Increments a Google Play Games Services incremental achievement. More... | |
Q_INVOKABLE void | setAchievementSteps (const QString &name, int minSteps, bool immediately=false) |
Sets a Google Play Games Services incremental achievement to have a minimum number of steps. More... | |
Q_INVOKABLE void | revealAchievement (const QString &name, bool immediately=true) |
Reveals a Google Play Games Services achievement. More... | |
Public Member Functions inherited from QObject | |
QObject (QObject *parent) | |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
virtual const QMetaObject * | metaObject () const |
QString | objectName () const |
void | setObjectName (const QString &name) |
bool | isWidgetType () const |
bool | isWindowType () const |
bool | signalsBlocked () const |
bool | blockSignals (bool block) |
QThread * | thread () const |
void | moveToThread (QThread *targetThread) |
int | startTimer (int interval, Qt::TimerType timerType) |
void | killTimer (int id) |
T | findChild (const QString &name, QFlags< Qt::FindChildOption > options) const |
QList< T > | findChildren (const QString &name, QFlags< Qt::FindChildOption > options) const |
QList< T > | findChildren (const QRegExp ®Exp, QFlags< Qt::FindChildOption > options) const |
QList< T > | findChildren (const QRegularExpression &re, QFlags< Qt::FindChildOption > options) const |
const QObjectList & | children () const |
void | setParent (QObject *parent) |
void | installEventFilter (QObject *filterObj) |
void | removeEventFilter (QObject *obj) |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) const |
bool | disconnect (const QObject *receiver, const char *method) const |
void | dumpObjectTree () |
void | dumpObjectInfo () |
bool | setProperty (const char *name, const QVariant &value) |
QVariant | property (const char *name) const |
QList< QByteArray > | dynamicPropertyNames () const |
void | destroyed (QObject *obj) |
void | objectNameChanged (const QString &objectName) |
QObject * | parent () const |
bool | inherits (const char *className) const |
void | deleteLater () |
Static Public Member Functions | |
static Game * | getInstance () |
Gets the singleton Game. More... | |
Static Public Member Functions inherited from QObject | |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, Functor functor) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
bool | disconnect (const QMetaObject::Connection &connection) |
bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) |
Additional Inherited Members | |
Protected Member Functions inherited from QObject | |
QObject * | sender () const |
int | senderSignalIndex () const |
int | receivers (const char *signal) const |
bool | isSignalConnected (const QMetaMethod &signal) const |
virtual void | timerEvent (QTimerEvent *event) |
virtual void | childEvent (QChildEvent *event) |
virtual void | customEvent (QEvent *event) |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
Properties inherited from QObject | |
objectName | |
The top-level Game object for VoltAir.
This singleton class is effectively the mainline of the game as well as the parent object for all game-related objects (e.g. PlayerProfile, LevelProgression).
Q_INVOKABLE LevelInfo* Game::getCurrentLevelInfo | ( | ) | const |
Returns the current LevelInfo selected by the player.
null
if getCurrentLevelProgression is non-null
. That is, selections of LevelInfo can be implicit based on the previous level played in a LevelProgression.
|
inline |
Returns the current LevelProgression selected by the player.
null
even if Engine::getLevel() is null
.
|
inline |
Returns the unique DebugMetricsMonitor for the game.
Q_INVOKABLE int Game::getLastPlayedEnvironmentIndex | ( | const QString & | progressionName | ) | const |
Returns the index of the environment last played in the specified progression.
progressionName | Name of LevelProgression to query |
Q_INVOKABLE int Game::getLastPlayedLevelIndexInEnvironment | ( | const QString & | progressionName, |
const QString & | environmentName | ||
) | const |
Returns the index of the last played level in a given environment.
progressionName | Name of LevelProgression in which environmentName resides |
environmentName | Name of Environment to query |
|
inline |
Returns the unique LevelProgressionList for the game.
Q_INVOKABLE int Game::getNumStars | ( | const QString & | progressionName, |
const QString & | levelName | ||
) | const |
Returns the highest number of stars achieved on a level, as logged in the PlayerProfile.
progressionName
is a multiplayer LevelProgression, this function will always return a invalid (i.e. negative) star score. progressionName | Name of single player LevelProgression in which levelName resides |
levelName | Name of the LevelInfo whose number of stars is being queried |
|
inline |
Returns the main UI element.
Q_INVOKABLE void Game::incrementAchievement | ( | const QString & | name, |
int | numSteps, | ||
bool | immediately = false |
||
) |
Increments a Google Play Games Services incremental achievement.
name | Android resource name used to locate the achievement id |
numSteps | Number of steps to increment the achievement |
immediately | Whether or not to sync the achievement change with Google Play Games Services now |
void Game::init | ( | ) |
Initialize the game.
This includes instantiating the UI, reading in the level progressions, player profiles and making signal/slot connections to the various submodules.
Q_INVOKABLE bool Game::isEnvironmentUnlocked | ( | const QString & | progressionName, |
const QString & | environmentName | ||
) | const |
Returns whether or not the specified environment is unlocked in the specified progression.
progressionName | Name of LevelProgression in which environmentName resides |
environmentName | Name of Environment whose lock status to check |
Q_INVOKABLE bool Game::isLevelUnlocked | ( | const QString & | progressionName, |
const QString & | levelName | ||
) | const |
Returns whether or not the specified level is unlocked in the specified progression.
progressionName | Name of LevelProgression in which levelName resides |
levelName | Name of LevelInfo whose lock status to check |
|
inline |
Returns if any of the UI screens are active.
|
signal |
Emitted on level completed.
This is emitted upon completion of the call to onLevelCompleted().
gameIsOver | Whether this level completion resulted in the game being over |
oneStarThreshold | Threshold for a single star on the completed level |
twoStarThreshold | Threshold for a two stars on the completed level |
threeStarThreshold | Threshold for a three stars on the completed level |
fourStarThreshold | Threshold for a four stars on the completed level |
playerScore | Player's score on the completed level |
Respond to a conflict in the loading of GPGS cloud data.
localData | String encoded local save game data that is in conflict |
serverData | String encoded cloud save game data that is in conflict |
|
slot |
Respond to the GPGS cloud data being loaded.
statusCode | Status of load, zero implying success, non-zero is error |
data | String encoded loaded save game data or a null string if loading error occurred |
|
slot |
Respond to a level being completed.
|
slot |
Respond to a change to the state of GPGS cloud sign-in.
signedIntoCloud | true if notifying of sign-in success |
|
signal |
Emitted when a player's score changes.
playerId | Unique ID of the player (0-3) |
score | Player's new score |
Q_INVOKABLE void Game::revealAchievement | ( | const QString & | name, |
bool | immediately = true |
||
) |
Reveals a Google Play Games Services achievement.
name | Android resource name used to locate the achievement id |
immediately | Whether or not to sync the achievement change with Google Play Games Services now |
Q_INVOKABLE void Game::setAchievementSteps | ( | const QString & | name, |
int | minSteps, | ||
bool | immediately = false |
||
) |
Sets a Google Play Games Services incremental achievement to have a minimum number of steps.
name | Android resource name used to locate the achievement id |
minSteps | Lower bound for incremental progress |
immediately | Whether or not to sync the achievement change with Google Play Games Services now |
void Game::tryLoadLevel | ( | ) |
Informs the engine to load the current level.
The call to the engine is only made if the PlayerProfile is loaded and it has a LevelProgression from which it can get the current level to load.
Q_INVOKABLE void Game::unlockAchievement | ( | const QString & | name, |
bool | immediately = true |
||
) |
Unlocks a Google Play Games Services achievement.
name | Android resource name used to locate the achievement id |
immediately | Whether or not to sync the achievement change with Google Play Games Services now |
void Game::updatePlayerScore | ( | int | playerId, |
int | amountChanged | ||
) |
Updates score and completes level if appropriate.
playerId | Unique ID [0, 3] of the player |
amountChanged | Delta of the score change |