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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/********************************************************************
*
*	Created:	28/3/2014   10:20
*
*	File:		fsCGlobalSavedData.h
*
*	Author:		Mick Waites
*	
*	Purpose:	Centralised player profile information and global
*				settings.
*
*********************************************************************/

#ifndef fsCGlobalSavedDatahdr
#define fsCGlobalSavedDatahdr

#include <memory>

#include <fsCore/src/fsCResourceName.h>

#include "../fsISavedData.h"


class fsCGlobalSavedData : public fsISavedData
{
	friend class fsCProfileManager;
	friend class fsCAppCoreMain;

public:

	static const fsS32 mNoProfileLoaded = -1;
	static const fsStr mCurrentLocale;

	fsStr uniqueIDGet() const;

	fsStr currentLocaleGet() const;
	void currentLocaleSet(fsStr const& pLocale);

	void appRunningtTimeSet(fsS32 pAppRunningTime);
	fsS32 appRunningtTimeGet() const;

	fsS32 numProfilesGet() const;
	fsS32 currentProfileIndexGet() const;
	fsStr profileNameGet(fsS32 pProfileIndex) const;
	fsCResourceName profileFileNameGet(fsS32 pProfileIndex) const;
	fsStr profileChapterGet(fsS32 pProfileIndex) const;
	fsS32 profileGameModeGet(fsS32 pProfileIndex) const;

	virtual ~fsCGlobalSavedData();<--- Destructor in derived class

	static std::unique_ptr<fsCGlobalSavedData> create();

protected:

	void uniqueIDSet(const fsStr& pID);

	void currentProfileIndexSet(fsS32 pProfileIndex);
	void numProfilesSet(fsS32 pNumProfiles);

	void resetToDefaultsDo() override;

	fsCGlobalSavedData();

private:

#if defined fsInAppPurchaseProcess
	static const fsStr mPurchasedPayWallKey;
#endif

	static const fsStr mNumProfilesKey;
	static const fsStr mCurrentProfileIndexKey;
	static const fsStr mProfileNameKey;
	static const fsStr mProfileFileNameKey;
	static const fsStr mProfileChapterKey;
	static const fsStr mProfileGameModeKey;
	static const fsStr mUniqueIDKey;
	static const fsStr mAppRunningTime;
};

#endif