15#include "toymaker/sim_system.hpp"
39 UrRecords(): SimObjectAspect<UrRecords>{0} {}
40 inline static std::string getSimObjectAspectTypeName() {
return "UrRecords"; }
41 static std::shared_ptr<BaseSimObjectAspect> create(
const nlohmann::json& jsonAspectProperties);
42 std::shared_ptr<BaseSimObjectAspect>
clone()
const override;
44 void submitRecord(
const GameRecord& gameRecord);
46 inline GameRecord getLatestRecord()
const {
return mLoadedRecords.back(); }
47 inline std::vector<GameRecord> getAllRecords()
const {
return mLoadedRecords; }
50 static void ApplyInvariants(
const GameRecord& gameRecord);
54 std::vector<GameRecord> mLoadedRecords {};
55 std::string mRecordsPath {};
58void from_json(
const nlohmann::json& json,
GameRecord& gameRecord);
59void to_json(nlohmann::json& json,
const GameRecord& gameRecord);
The class containing the interface to the data model for the whole game (Game of Ur).
An object containing closely related methods and data, and exposing object lifecycle and application ...
Definition sim_system.hpp:956
void onActivated() override
Callback for when the aspect is activated (after it is attached to an active SimObject,...
Definition ur_records.cpp:66
void onDeactivated() override
Callback for when the aspect is deactivated (just prior to being detached, or when its SimObject has ...
Definition ur_records.cpp:85
std::shared_ptr< BaseSimObjectAspect > clone() const override
A method which must be overridden to specify how a new aspect should be constructed as a copy of this...
Definition ur_records.cpp:13
Contains methods to convert data from its-in game representation to its JSON representation,...
The details of a single completed game.
Definition ur_records.hpp:26
Data returned by GameOfUrModel when queried for scores.
Definition model.hpp:151
Data returned by GameOfUrModel when queried about a player.
Definition model.hpp:229