Fission FSN
Loading...
Searching...
No Matches
fsCProfileManager.h
Go to the documentation of this file.
1/********************************************************************
2*
3* Created: 27/3/2014 14:28
4*
5* File: fsCProfileManager.h
6*
7* Author: Mick Waites
8*
9* Purpose: To manage all saved data.
10*
11*********************************************************************/
12
13#ifndef fsCProfileManagerhdr
14#define fsCProfileManagerhdr
15
16#include <memory>
17
20
21class fsStr;
26
28{
29 friend class fsCInputSession;
30
31public:
32
36
38 const static fsStr mDevTesterName;
39
41 static void destroy();
42
45
46
47#if defined fsInAppPurchaseProcess
48 void freeLevelCountSet( fsS32 pLevelCount );
49 fsBool progressBlockedByPaywallGet();
50 void fullGamePurchasedHandle();
51 void fullGamePurchaseRevokeHandle();
52 fsBool fullGamePurchasedGet();
53 fsBool fullGamePurchasedPersistedGet();
54#endif
55
57 void chapterSet(const fsStr& pChapter);
58
61 fsStr chapterProfileNameGet(fsS32 pProfileIndex) const;
62 fsS32 chapterProfileGameModeGet(fsS32 pProfileIndex) const;
63
64 void newProfileCreate(const fsStr& pPlayerName);
65 void profileDelete(fsS32 pProfileIndex);
66 void chapterProfileDelete(fsS32 pProfileIndex);
67 void profileLoad(fsS32 pProfileIndex);
68 void chapterProfileLoad(fsS32 pProfileIndex);
69 void currentProfileLoad();
70
71 void allDataSave(fsBool pIsAutoSave) const;
72
73 fsBool isValidNameGet(const fsStr& pPotentialName);
74 void initialise();
75
76 // Not owned; must outlive the profile manager or be cleared first.
78
79 // Creates a profile named pPlayerName holding pData (a saved profile file), keeping the
80 // previously current profile current if there was one.
81 void profileRestore(const fsStr& pPlayerName, const fsStr& pData);
82
83 static void create(std::unique_ptr<fsCGlobalSavedData> pGlobalSavedData,
84 std::unique_ptr<fsCUserSavedData> pUserSavedData);
85
86protected:
87
89 virtual ~fsCProfileManager();
90
92
93private:
94
95
96 void settingsCache();
97
98 void initalUserSettingsApply() const;
99 void cheatModeActivate(const fsStr& pPlayerName);
100
101 void userDataSave() const;
102 void globalDataSave() const;
103
104 fsBool profileMatchesCurrentChapterGet(fsS32 pProfileIndex) const;
105 fsS32 chapterProfileIndexToGlobalIndex(fsS32 pProfileIndex) const;
106
107 fsStr newUserFileNameGenerate();
108
109 void settingsApply();
110
111 const fsCResourceName mGlobalDataFileName;
112
113#if defined fsInAppPurchaseProcess
114 void currPlayerFreeLevelCountSet(const fsStr& pPlayerName);
115 fsS32 mNumFreeScenes;
116 fsS32 mCurrPlayerNumFreeScenes;
117#endif
118 fsF32 mMusicVol;
119 fsF32 mEffectsVol;
120 fsBool mMute;
121 fsBool mCustomCursor;
122 fsBool mFullScreen;
123 fsStr mChapter;
124
125 std::unique_ptr<fsCGlobalSavedData> mSavedData;
126 std::unique_ptr<fsCUserSavedData> mUserSavedData;
127
128 fsIProfileSaveListener* mSaveListener;
129};
130
131#endif
Definition fsCGlobalSavedData.h:25
fsS32 currentChapterProfileIndexGet() const
Definition fsCProfileManager.cpp:204
static const fsStr mReleaseTesterName
Definition fsCProfileManager.h:37
static void create(std::unique_ptr< fsCGlobalSavedData > pGlobalSavedData, std::unique_ptr< fsCUserSavedData > pUserSavedData)
Definition fsCProfileManager.cpp:547
void profileLoad(fsS32 pProfileIndex)
Definition fsCProfileManager.cpp:376
fsStr chapterGet()
Definition fsCProfileManager.cpp:107
static const fsCUniqueId mProfilesHaveChangedMsg
Definition fsCProfileManager.h:33
void chapterSet(const fsStr &pChapter)
Definition fsCProfileManager.cpp:112
void profileRestore(const fsStr &pPlayerName, const fsStr &pData)
Definition fsCProfileManager.cpp:526
fsStr chapterProfileNameGet(fsS32 pProfileIndex) const
Definition fsCProfileManager.cpp:233
fsBool isValidNameGet(const fsStr &pPotentialName)
Definition fsCProfileManager.cpp:434
void currentProfileLoad()
Definition fsCProfileManager.cpp:371
void profileDelete(fsS32 pProfileIndex)
Definition fsCProfileManager.cpp:322
friend class fsCInputSession
Definition fsCProfileManager.h:29
void saveListenerSet(fsIProfileSaveListener *pListener)
Definition fsCProfileManager.cpp:521
static fsCProfileManager * instanceGet()
Definition fsCProfileManager.cpp:567
virtual ~fsCProfileManager()
Definition fsCProfileManager.cpp:596
fsS32 chapterProfileCountGet() const
Definition fsCProfileManager.cpp:162
void initialise()
Definition fsCProfileManager.cpp:496
static const fsCUniqueId mProfileCreationCompleteMsg
Definition fsCProfileManager.h:34
static fsCProfileManager * mInstance
Definition fsCProfileManager.h:91
static void destroy()
Definition fsCProfileManager.cpp:572
fsCProfileManager()
Definition fsCProfileManager.cpp:580
fsCUserSavedData * userSavedDataGet() const
Definition fsCProfileManager.cpp:142
fsCGlobalSavedData * savedDataGet() const
Definition fsCProfileManager.cpp:147
static const fsStr mDevTesterName
Definition fsCProfileManager.h:38
fsS32 chapterProfileGameModeGet(fsS32 pProfileIndex) const
Definition fsCProfileManager.cpp:238
void chapterProfileDelete(fsS32 pProfileIndex)
Definition fsCProfileManager.cpp:366
static const fsCUniqueId mPayWallBreachedMsg
Definition fsCProfileManager.h:35
void allDataSave(fsBool pIsAutoSave) const
Definition fsCProfileManager.cpp:243
void chapterProfileLoad(fsS32 pProfileIndex)
Definition fsCProfileManager.cpp:407
void newProfileCreate(const fsStr &pPlayerName)
Definition fsCProfileManager.cpp:290
Definition fsCResourceName.h:32
Definition fsCUniqueId.h:21
Definition fsCUserSavedData.h:25
Definition fsIProfileSaveListener.h:17
Definition fsStr.h:23
Definition gfCHogUserSavedData.h:16
bool fsBool
Definition fsBaseTypes.h:26
int fsS32
Definition fsBaseTypes.h:20
float fsF32
Definition fsBaseTypes.h:28