Fission FSN
Loading...
Searching...
No Matches
gfCAchievementManager.h
Go to the documentation of this file.
1/********************************************************************
2*
3* File: gfCAchievementManager.h
4*
5* Purpose: Central store for all achievements
6*
7*********************************************************************/
8
9#ifndef gfCAchievementManagerhdr
10#define gfCAchievementManagerhdr
11
12#include <memory>
13#include <vector>
14
15#include <fsCore/fsBaseTypes.h>
16#include <fsCore/fsStr.h>
17
18class gfCAchievement;
19
22struct fsPoint;
23
25{
26public:
27
28 typedef void (*TAchievementCallback)(const fsStr& pAchievment, const fsPoint& pPos);
29
30 gfCAchievement* achievementFind(const fsStr& pName) const;
31
32 fsStr savedMultipleAchievementGet(const fsStr& pSetKey, const fsStr& pName);
33 fsS32 savedMultipleAchievementCountGet(const fsStr& pSetKey, const fsStr& pName);
34
35 fsBool achievementCriteriaMet(const fsStr& pName) const;
36
37 void achievementRegister(gfCAchievement* pAchievement);
38 fsBool achievementUnlocked(const fsStr& pName, const fsStr& pSaveKey) const;
39 fsStr achievementKeyDecode(const fsStr& pKey) const;
40 fsBool allAchievementsUnlocked(fsStr const&pAchievementKey, fsStr const& pExceptFor) const;
41
42 void achievementDictionaryRegister(const fsStr& pFilename);
43#if defined(fsPlatformAchievements)
44 void externalAchievementDictionaryRegister(const fsStr& pFilename);
45#endif
46
48
49 void achievementUnlock(const fsStr& pSetKey, const fsStr& pName, const fsPoint& pPos, fsBool pGrouping = false);
50
51 static void create();
52 static void destroy();
54
57
58protected:
59
60private:
61
62 struct FncMatch
63 {
64 FncMatch(const fsStr& pMatch) : mMatch(pMatch)
65 {
66 }
67
68 fsBool operator()(const gfCAchievement& pAchievement) const;
69 fsStr mMatch;
70 };
71
72 fsStr savedAchievementGet(const fsStr& pSetKey, const fsStr& pName) const;
73 void externalAchievementUnlock(const fsStr& pName);
74
75 TAchievementCallback mCallback;
76 static gfCAchievementManager* mInstance;
77
78 fsCVariableTable* mDictionary;
79#if defined(fsPlatformAchievements)
80 fsCVariableTable* mExternalDictionary;
81 std::unique_ptr<fsAchievementService> mAchievementService;
82#endif
83
84 std::vector<gfCAchievement*> mAchievements;
85};
86
87#endif
Definition fsAchievementService.h:9
Definition fsCVariableTable.h:27
Definition fsStr.h:23
Definition gfCAchievement.h:17
static void create()
Definition gfCAchievementManager.cpp:241
gfCAchievement * achievementFind(const fsStr &pName) const
Definition gfCAchievementManager.cpp:29
void achievementUnlock(const fsStr &pSetKey, const fsStr &pName, const fsPoint &pPos, fsBool pGrouping=false)
Definition gfCAchievementManager.cpp:185
void achievementCallbackRegister(TAchievementCallback pCallback)
Definition gfCAchievementManager.cpp:94
void(* TAchievementCallback)(const fsStr &pAchievment, const fsPoint &pPos)
Definition gfCAchievementManager.h:28
fsBool achievementUnlocked(const fsStr &pName, const fsStr &pSaveKey) const
Definition gfCAchievementManager.cpp:57
~gfCAchievementManager()
Definition gfCAchievementManager.cpp:269
fsStr achievementKeyDecode(const fsStr &pKey) const
Definition gfCAchievementManager.cpp:73
static gfCAchievementManager * instanceGet()
Definition gfCAchievementManager.cpp:250
fsStr savedMultipleAchievementGet(const fsStr &pSetKey, const fsStr &pName)
Definition gfCAchievementManager.cpp:116
void achievementDictionaryRegister(const fsStr &pFilename)
Definition gfCAchievementManager.cpp:78
gfCAchievementManager()
Definition gfCAchievementManager.cpp:255
fsBool achievementCriteriaMet(const fsStr &pName) const
Definition gfCAchievementManager.cpp:44
static void destroy()
Definition gfCAchievementManager.cpp:235
fsS32 savedMultipleAchievementCountGet(const fsStr &pSetKey, const fsStr &pName)
Definition gfCAchievementManager.cpp:146
fsBool allAchievementsUnlocked(fsStr const &pAchievementKey, fsStr const &pExceptFor) const
Definition gfCAchievementManager.cpp:18
void achievementRegister(gfCAchievement *pAchievement)
Definition gfCAchievementManager.cpp:68
bool fsBool
Definition fsBaseTypes.h:26
int fsS32
Definition fsBaseTypes.h:20
Definition fsPoint.h:17