RhythmGame 1.4.3
Loading...
Searching...
No Matches
BmsGaugeHistory.h
Go to the documentation of this file.
1//
2// Created by bobini on 30.09.23.
3//
4
5#ifndef RHYTHMGAME_BMSGAUGEHISTORY_H
6#define RHYTHMGAME_BMSGAUGEHISTORY_H
7
8#include "db/SqliteCppDb.h"
9#include "rules/BmsGauge.h"
10#include <QJsonArray>
11namespace gameplay_logic {
12
17{
18 Q_GADGET
22 Q_PROPERTY(double maxGauge MEMBER maxGauge CONSTANT)
28 Q_PROPERTY(double threshold MEMBER threshold CONSTANT)
32 Q_PROPERTY(QString name MEMBER name CONSTANT)
39 Q_PROPERTY(bool courseGauge MEMBER courseGauge CONSTANT)
45 Q_PROPERTY(
46 QList<rules::GaugeHistoryEntry> gaugeHistory MEMBER gaugeHistory CONSTANT)
47
48 public:
49 double maxGauge;
50 double threshold;
51 QString name;
52 bool courseGauge;
53 QList<rules::GaugeHistoryEntry> gaugeHistory;
54
55 friend auto operator<<(QDataStream& stream,
56 const BmsGaugeInfo& gaugeHistory) -> QDataStream&;
57 friend auto operator>>(QDataStream& stream, BmsGaugeInfo& gaugeHistory)
58 -> QDataStream&;
59};
60
66class BmsGaugeHistory final : public QObject
67{
68 Q_OBJECT
69
73 Q_PROPERTY(QList<BmsGaugeInfo> gaugeInfo READ getGaugeInfo CONSTANT)
77 Q_PROPERTY(QString guid READ getGuid CONSTANT)
78 QList<BmsGaugeInfo> gaugeInfo;
79 QString guid;
80
81 public:
88 explicit BmsGaugeHistory(QList<BmsGaugeInfo> gaugeInfo,
89 QString guid,
90 QObject* parent = nullptr);
91
92 auto getGaugeInfo() const -> QList<BmsGaugeInfo>;
93
94 auto getGuid() const -> QString;
95
96 void save(db::SqliteCppDb& db) const;
97 auto serialize() const -> QByteArray;
98 void save(db::SqliteCppDb& db, const QByteArray& serialized) const;
99
100 struct DTO
101 {
102 int64_t id;
103 std::string scoreGuid;
104 std::string gaugeInfo;
105 };
106 static auto load(const DTO& dto) -> std::unique_ptr<BmsGaugeHistory>;
107 auto toJsonArray() const -> QJsonArray;
108 static auto fromJsonArray(const QJsonArray& array) -> QList<BmsGaugeInfo>;
109};
110} // namespace gameplay_logic
111
112#endif // RHYTHMGAME_BMSGAUGEHISTORY_H
The history of all gauges used in a BMS score.
Definition BmsGaugeHistory.h:67
Metadata and history of a single gauge used in BMS scoring.
Definition BmsGaugeHistory.h:17
double maxGauge
The maximum possible value of the gauge.
Definition BmsGaugeHistory.h:22
QString name
The name of the gauge.
Definition BmsGaugeHistory.h:32
QList< rules::GaugeHistoryEntry > gaugeHistory
The history of the gauge during gameplay.
Definition BmsGaugeHistory.h:46
double threshold
The threshold value of the gauge.
Definition BmsGaugeHistory.h:28
bool courseGauge
Whether the gauge is a course gauge.
Definition BmsGaugeHistory.h:39
Namespace for database related classes and functions.
Definition QtArenaRoundLoader.h:15
Classes and functions mostly related to gameplay.
Definition ArenaGameplaySource.h:10
Definition BmsGaugeHistory.h:101
std::string gaugeInfo
Definition BmsGaugeHistory.h:104
int64_t id
Definition BmsGaugeHistory.h:102
std::string scoreGuid
Definition BmsGaugeHistory.h:103