2014-05-11 07:57:06 -04:00
|
|
|
|
|
|
|
// StatSerializer.h
|
|
|
|
|
|
|
|
// Declares the cStatSerializer class that is used for saving stats into JSON
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "json/json.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// fwd:
|
|
|
|
class cStatManager;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class cStatSerializer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2014-05-13 07:53:15 -04:00
|
|
|
cStatSerializer(const AString & a_WorldName, const AString & a_PlayerName, cStatManager * a_Manager);
|
2014-05-11 07:57:06 -04:00
|
|
|
|
2014-05-13 07:53:15 -04:00
|
|
|
/* Try to load the player statistics. Returns whether the operation was successful or not. */
|
2014-05-11 07:57:06 -04:00
|
|
|
bool Load(void);
|
|
|
|
|
2014-05-13 07:53:15 -04:00
|
|
|
/* Try to save the player statistics. Returns whether the operation was successful or not. */
|
2014-05-11 07:57:06 -04:00
|
|
|
bool Save(void);
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
void SaveStatToJSON(Json::Value & a_Out);
|
|
|
|
|
|
|
|
bool LoadStatFromJSON(const Json::Value & a_In);
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
cStatManager* m_Manager;
|
|
|
|
|
|
|
|
AString m_Path;
|
|
|
|
|
|
|
|
|
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|