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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148 | /********************************************************************
*
* Created: 1/5/2014 13:01
*
* File: gfCPairsMinigameComponent.h
*
* Author: Mick Waites
*
* Purpose: Pairs mini game component
*
*********************************************************************/
#ifndef gfCPairsMinigameComponenthdr
#define gfCPairsMinigameComponenthdr
#include "gfCPairsMiniGameLogicComponent.h"
#include "../gfIMinigameComponent.h"
#include "../gfIMinigameHintable.h"
class fsITrailComponent;
class fsITransformationComponent;
class fsCBrush;
class gfCPairsMiniGameLogicComponent;
class gfCPairsMinigameComponent : public gfIMinigameComponent, public gfIMinigameHintable
{
friend class fsCComponentFactory;
public:
static const fsCUniqueId mTypeId;
static const fsCUniqueId mPairsFreezeInputMsg;
static const fsCUniqueId mPairsRestoreInputMsg;
static const fsStr mEntityPrefix;
void gameLogicSet(gfCPairsMiniGameLogicComponent* const pParentLogic);
fsBool selected() const;
std::vector<gfCPairsMinigameComponent*> matchingSiblingsGet() const;
fsBool isHintableGet() const override;
fsBool isActiveGet() const override;
fsBool hintDo() override;
protected:
struct sPairsEventMsgParam : public fsIMessageDispatcher::sMessageParameters
{
sPairsEventMsgParam(gfCPairsMinigameComponent* pPairsComp) : mPairsComp(pPairsComp) {}
gfCPairsMinigameComponent* const mPairsComp;
};
void listenersRegisterDo() override;
void listenersDeregisterDo() override;
fsBool messageProcessDo(const fsCUniqueId& pMessageType,
const fsIMessageDispatcher::sMessageParameters& pParam) override;
void onTap(const fsPoint& pTapPos) override;
void serialiseDo() override;
void deserialiseDo() override;
void initialiseDo(const fsCVariableTable& pVars) override;
void skipDo() override;
fsBool acceptingInputGet() const override;
void updateDo(fsS32 pDeltaMs) override;
static fsIComponent* create(fsCEntity* pParent);
gfCPairsMinigameComponent(fsCEntity* pParent);
virtual ~gfCPairsMinigameComponent();<--- Destructor in derived class
private:
enum
{
eSTATE_UNSELECTED = 0,
eSTATE_TRANSITION_OUT,
eSTATE_TRANSITION_IN,
eSTATE_SELECTED,
eSTATE_MISMATCHED,
eSTATE_UNSELECTABLE,
eSTATE_SHUFFLE,
eSTATE_MATCHED
};
typedef fsBool (gfCPairsMinigameComponent::*fsTPairsMinigameMemFnc)() const;
std::vector<gfCPairsMinigameComponent*> activeSiblingsGet() const;
std::vector<gfCPairsMinigameComponent*> siblingsGet(fsTPairsMinigameMemFnc pCondition = nullptr) const;
void sfxPlay();
fsBool tapableGet() const;
fsBool activeGet() const;
fsBool transitioningGet() const;
fsBool selectedGet() const;
void closestShuffelableCandidate(fsCEntity* pPotentialCandidate, fsCEntity*& pCandidate);
fsBool shufflable() const;
gfCPairsMinigameComponent* const shuffleBuddyGet();
void trailComponentAdd(gfCPairsMinigameComponent* pShuffleBuddy);
void reverseAndFaceSideCreate(const fsCVariableTable& pVars);
void guiTurnOver(fsBool pFaceUp);
void turnOver(fsBool pFaceUp);
void missMatchSet();
fsBool missMatchRevealed();
fsBool missMatchRevealing();
fsBool allMyMatchesRevealed();
void allMyMatchesSetAsMatched();
fsS32 revealedCount() const;
void select();
void transitionOut();
void transitionIn();
void shuffle();
void turnFaceDown();
void matchedSet();
void mismatchedSet();
static const fsStr mBackFilename;
static const fsS32 mTransitionTime;
fsS32 mIndex;
fsS32 mState;
fsS32 mCountdownMs;
std::shared_ptr<fsCBrush> mReverseSide;
std::shared_ptr<fsCBrush> mItemSide;
fsITrailComponent* mTrailComponent;
const fsCUniqueId* mTrailType;
fsITransformationComponent* mTransformation;
gfCPairsMiniGameLogicComponent* mGameLogic;
};
#endif
|