VoltAir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups Pages
UiInternal.h
1 /*
2  * Copyright (C) 2014 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef UIINTERNAL_H
18 #define UIINTERNAL_H
19 
20 #include <QQuickItem>
21 
22 class LevelProgression;
24 
34 class UiInternal : public QQuickItem {
35  Q_OBJECT
36 
40  Q_PROPERTY(bool signedIntoCloud READ isSignedIntoCloud WRITE setSignedIntoCloud
45  Q_PROPERTY(bool bgmMuted READ isBGMMuted WRITE setBGMMuted NOTIFY bgmMutedChanged)
67 
68 public:
72  bool isSignedIntoCloud() const { return mSignedIntoCloud; }
77  void setSignedIntoCloud(bool value);
81  bool isBGMMuted() const { return mBGMMuted; }
86  void setBGMMuted(bool value);
90  LevelProgressionList* getLevelProgressionList() const { return mLevelProgressionList; }
99  LevelProgression* getCurrentProgression() const { return mCurrentProgression; }
108  LevelProgression* getPreviousProgression() const { return mPreviousProgression; }
112  const QString& getMenuBGMTrack() const { return mMenuBGMTrack; }
117  void setMenuBGMTrack(const QString& value);
118 
124  void tryStart();
125 
126 public slots:
134  void onLevelChanged(const QString& levelName, int completionThreshold, int activationThreshold);
145  void onLevelCompleted(bool gameCompleted, int oneStarThreshold, int twoStarThreshold,
146  int threeStarThreshold, int fourStarThreshold, int playerScore);
153  void onPlayerActivationChanged(int player, bool active);
160  void onPlayerScoreChanged(int player, int score);
165  void onPlayerDataChanged();
166 
167 signals:
171  void signedIntoCloudChanged();
175  void bgmMutedChanged();
191  void menuBGMTrackChanged();
192 
193  // TODO: Refactor to not need this signal (or at least, use a more generic signal).
201  void pauseRequested();
205  void resumeRequested();
209  void quitRequested();
215  void playLevelRequested(LevelProgression* levelProgression, const QString& levelName);
224  void changeLevelRequested();
237  void activeChanged(bool isActive);
241  void playNextLevelRequested();
245  void signIntoCloudRequested();
249  void muteBGMRequested();
253  void unmuteBGMRequested();
254 
255 private:
256  bool mSignedIntoCloud = false;
257  bool mBGMMuted = false;
258  LevelProgressionList* mLevelProgressionList = nullptr;
259  LevelProgression* mCurrentProgression = nullptr;
260  LevelProgression* mPreviousProgression = nullptr;
261  QString mMenuBGMTrack;
262 };
263 Q_DECLARE_METATYPE(UiInternal*)
264 
265 #endif // UIINTERNAL_H
void onPlayerDataChanged()
Notifies the Ui when the player data profile has been updated with new data.
void onPlayerScoreChanged(int player, int score)
Notifies the Ui when a player's score changes.
bool isSignedIntoCloud() const
Returns signedIntoCloud.
Definition: UiInternal.h:72
void onLevelCompleted(bool gameCompleted, int oneStarThreshold, int twoStarThreshold, int threeStarThreshold, int fourStarThreshold, int playerScore)
Notifies the UI when the level is completed.
void playLevelRequested(LevelProgression *levelProgression, const QString &levelName)
Emitted when the player uses the UI to select a level to play.
void setBGMMuted(bool value)
Sets bgmMuted.
void bgmMutedChanged()
Emitted when bgmMuted changes.
void changeLevelRequested()
Emitted when the player uses the UI to change the current level but while staying in the same LevelPr...
void menuBGMTrackChanged()
Emitted when menuBGMTrack changes.
LevelProgression * getCurrentProgression() const
Returns currentProgression.
Definition: UiInternal.h:99
void signedIntoCloudChanged()
Emitted when signedIntoCloud changes.
void levelProgressionsChanged()
Emitted when levelProgressions changes.
Internal backing C++ class for the Ui QML item.
Definition: UiInternal.h:34
void quitRequested()
Emitted when the player uses the UI to quit the game.
void setCurrentProgression(LevelProgression *value)
Sets currentProgression.
LevelProgression previousProgression
LevelProgression previously played.
Definition: UiInternal.h:60
QString menuBGMTrack
Name of sound asset file to be played in a loop as background music while the menu is showing...
Definition: UiInternal.h:66
void unmuteBGMRequested()
Emitted when the player uses the UI to try to unmute the background music.
bool isBGMMuted() const
Returns bgmMuted.
Definition: UiInternal.h:81
bool bgmMuted
Whether or not the background music is currently muted.
Definition: UiInternal.h:45
LevelProgression * getPreviousProgression() const
Returns previousProgression.
Definition: UiInternal.h:108
Grouping of related Environments together into a logical, ordered list.
Definition: LevelProgression.h:34
void changeLevelProgressionRequested()
Emitted when the player uses the UI to change the current LevelProgression.
void activeChanged(bool isActive)
Emitted when UI changes its foregrounded state.
bool signedIntoCloud
Whether or not the player is currently signed into Google Play Games Services.
Definition: UiInternal.h:41
void muteBGMRequested()
Emitted when the player uses the UI to try to mute the background music.
const QString & getMenuBGMTrack() const
Returns menuBGMTrack.
Definition: UiInternal.h:112
Collection of LevelProgressions.
Definition: LevelProgressionList.h:31
void setMenuBGMTrack(const QString &value)
Sets menuBGMTrack.
void currentProgressionChanged()
Emitted when currentProgression changes.
void resumeRequested()
Emitted when the UI requests the Game to be resumed.
void setSignedIntoCloud(bool value)
Sets signedIntoCloud.
void signIntoCloudRequested()
Emitted when the player uses the UI to try to sign into Google Play Games Services.
void setLevelProgressionList(LevelProgressionList *value)
Sets levelProgressions.
void onPlayerActivationChanged(int player, bool active)
Notifies the UI when a player's activation changes.
void tryStart()
Called by Game when attempting to start the UI.
void onLevelChanged(const QString &levelName, int completionThreshold, int activationThreshold)
Passes information about the current level to the UI.
void openingCinematicCompleted()
Emitted when the opening cinematic movie is done showing.
LevelProgressionList * getLevelProgressionList() const
Returns levelProgressions.
Definition: UiInternal.h:90
LevelProgressionList levelProgressions
Unique LevelProgressionList for the game.
Definition: UiInternal.h:50
void playNextLevelRequested()
Emitted when the player uses the UI to play the next level in the LevelProgression.
void pauseRequested()
Emitted when the UI requests the Game to be paused.
void previousProgressionChanged()
Emitted when previousProgression changes.
LevelProgression currentProgression
LevelProgression currently being played.
Definition: UiInternal.h:55
void showAchievementsRequested()
Emitted when the player uses the UI to show their Google Play Games Services achievements.