mirror of
https://github.com/QuasarApp/Hanoi-Towers.git
synced 2025-04-28 10:44:32 +00:00
reward
This commit is contained in:
parent
b272942672
commit
d632b240b3
@ -283,3 +283,14 @@ void BackEnd::setProfile(QString profile) {
|
||||
_profile = profile;
|
||||
emit profileChanged(_profile);
|
||||
}
|
||||
|
||||
void BackEnd::setReward(int revard) {
|
||||
auto profile = _profileList.value(_profile, nullptr);
|
||||
if (!profile) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (profile->record() < revard) {
|
||||
profile->setRecord(revard);
|
||||
}
|
||||
}
|
||||
|
@ -109,6 +109,8 @@ public slots:
|
||||
|
||||
void setProfile(QString profile);
|
||||
|
||||
void setReward(int);
|
||||
|
||||
signals:
|
||||
void firstChanged();
|
||||
void animationChanged();
|
||||
|
@ -207,8 +207,9 @@ Rectangle {
|
||||
if ( tower3.items.length === all) {
|
||||
if (all === tumbler.spin.maximumValue) {
|
||||
backEnd.gameState.unlockNextLvl();
|
||||
popUp.text = qsTr("You have passed the level in %0 steps and unlocked level %1" +
|
||||
"\n Minimum steps for this lvl: %2").
|
||||
popUp.text = qsTr("You have passed the level in %0 steps and unlocked level %1") +
|
||||
qsTr("\n Minimum steps for this lvl: %2") +
|
||||
qsTr("\n you reward = %3").
|
||||
arg(step.ste).arg(all + 1).arg(backEnd.getMinSteps(all));
|
||||
|
||||
popUp.open()
|
||||
|
@ -10,6 +10,14 @@ void ProfileData::setOnline(bool onlineProfile) {
|
||||
}
|
||||
}
|
||||
|
||||
void ProfileData::setRecord(int rec) {
|
||||
if (record() == rec)
|
||||
return;
|
||||
|
||||
_userData.extraData()["points"] = rec;
|
||||
emit recordChanged(rec);
|
||||
}
|
||||
|
||||
void ProfileData::handleServerResponce(const NetworkProtocol::UserData& data) {
|
||||
if (_userData.token() != data.token()) {
|
||||
_userData = data;
|
||||
|
@ -10,7 +10,7 @@ class ProfileData : public QObject, public NetworkProtocol::StreamBase
|
||||
|
||||
Q_PROPERTY(QObject* gameState READ gameState NOTIFY gameStateChanged)
|
||||
Q_PROPERTY(QString name READ name)
|
||||
Q_PROPERTY(int record READ record)
|
||||
Q_PROPERTY(int record READ record WRITE setRecord NOTIFY recordChanged)
|
||||
Q_PROPERTY(bool onlineUser READ isOnline WRITE setOnline NOTIFY onlineChanged)
|
||||
|
||||
private:
|
||||
@ -36,10 +36,13 @@ public:
|
||||
|
||||
public slots:
|
||||
void setOnline(bool onlineUser);
|
||||
void setRecord(int record);
|
||||
|
||||
signals:
|
||||
void gameStateChanged(QObject* gameState);
|
||||
void onlineChanged(bool onlineUser);
|
||||
void onlineRequest();
|
||||
void recordChanged(int record);
|
||||
};
|
||||
|
||||
#endif // PROFILEDATA_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user