-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgamecontroller.h
More file actions
33 lines (28 loc) · 1.3 KB
/
Copy pathgamecontroller.h
File metadata and controls
33 lines (28 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef GAMECONTROLLER_H
#define GAMECONTROLLER_H
#include <QObject>
#include <QString>
#include "gridmodel.h"
#include <QSettings>
class GameController : public QObject {
Q_OBJECT
Q_PROPERTY(GridModel* gridModel READ gridModel CONSTANT)
public:
explicit GameController(QObject *parent = nullptr);
GridModel* gridModel();
Q_INVOKABLE void generateChallenge(int difficulty);
Q_INVOKABLE void processWord(const QString &word, int playerMaskId);
Q_INVOKABLE bool checkAnswer(const QString &playerAnswer);
Q_INVOKABLE void saveWin(int difficulty, int score, int time); // Збереження складності, часу, очки
Q_INVOKABLE int getGamesWon(int difficulty); // Кількість перемог
Q_INVOKABLE int getTotalScore(int difficulty); // Загальні очки
Q_INVOKABLE int getBestTime(int difficulty); // Рекорд-час
Q_INVOKABLE int getBestScore(int difficulty); // Рекорд-рахунок
Q_INVOKABLE void resetStats(); // Скинути статистику
private:
QString loadRandomWord(int difficulty);
GridModel m_gridModel;
QString m_secretWord; //Загадене слов
int m_challengeMask = -1; // Згенерована маска
};
#endif // GAMECONTROLLER_H