Emergency 20 Dokumentation  4.2.0
HintMessageGeneralObserver.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Promotion Software GmbH
2 
3 
4 //[-------------------------------------------------------]
5 //[ Header guard ]
6 //[-------------------------------------------------------]
7 #pragma once
8 
9 
10 //[-------------------------------------------------------]
11 //[ Includes ]
12 //[-------------------------------------------------------]
14 
16 
17 
18 //[-------------------------------------------------------]
19 //[ Namespace ]
20 //[-------------------------------------------------------]
21 namespace em5
22 {
23 
24 
25  //[-------------------------------------------------------]
26  //[ Classes ]
27  //[-------------------------------------------------------]
43  {
44 
45 
46  //[-------------------------------------------------------]
47  //[ Public definitions ]
48  //[-------------------------------------------------------]
49  public:
50  static const uint32 GAMELOGIC_TYPE_ID; // "em5::HintMessageGeneralObserver" game logic type ID
51 
52  // bool parameter: true = delay message, false = first message
53  typedef boost::function<bool (const qsf::MessageParameters&, bool)> CustomFilterCallback;
54 
55 
56  //[-------------------------------------------------------]
57  //[ Public methods ]
58  //[-------------------------------------------------------]
59  public:
65 
70  void initialize();
71 
79  void initialize(const qsf::MessageConfiguration& messageConfiguration);
80 
94  void initialize(const qsf::MessageConfiguration& messageConfiguration, const qsf::Time& timeFrame, const bool messageCreated);
95 
112  void initialize( const qsf::MessageConfiguration& delayMessageConfiguration, const qsf::MessageConfiguration& messageConfiguration,
113  const qsf::Time& timeFrame, const bool messageCreated);
114 
122  void setCustomMessageFilter(const CustomFilterCallback& customFilterCallback);
123 
124 
125  //[-------------------------------------------------------]
126  //[ Public virtual qsf::GameLogic methods ]
127  //[-------------------------------------------------------]
128  public:
129  virtual bool onStartup() override;
130  virtual void onShutdown() override;
131  virtual void serialize(qsf::BinarySerializer& serializer) override;
132 
133 
134  //[-------------------------------------------------------]
135  //[ Private methods ]
136  //[-------------------------------------------------------]
137  private:
138  void onDelayMessage(const qsf::MessageParameters& parameters);
139  void onMessage(const qsf::MessageParameters& parameters);
140  void onTimer(const qsf::MessageParameters& parameters);
141 
142  void serializeMessageProxy(qsf::BinarySerializer& serializer, qsf::MessageProxy& messageProxy, const qsf::detail::MessageCallbackBinding& function);
143 
144 
145  //[-------------------------------------------------------]
146  //[ Private data ]
147  //[-------------------------------------------------------]
148  private:
149  bool mMessageCreated;
150  bool mMessageFound;
151 
152  qsf::Time mTimeFrame;
153 
154  qsf::MessageProxy mDelayProxy;
155  qsf::MessageProxy mMessageProxy;
156  qsf::MessageProxy mTimerProxy;
157 
158  CustomFilterCallback mCustomMessageFilter;
159 
160 
161  //[-------------------------------------------------------]
162  //[ CAMP reflection system ]
163  //[-------------------------------------------------------]
164  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
165 
166 
167  };
168 
169 
170 //[-------------------------------------------------------]
171 //[ Namespace ]
172 //[-------------------------------------------------------]
173 } // em5
174 
175 
176 //[-------------------------------------------------------]
177 //[ CAMP reflection system ]
178 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
EMERGENCY 5 observer base class.
Definition: Observer.h:41
Message parameters class.
Definition: MessageParameters.h:34
unsigned int uint32
Definition: PlatformTypes.h:181
static const uint32 GAMELOGIC_TYPE_ID
Definition: HintMessageGeneralObserver.h:50
#define EM5_API_EXPORT
Definition: Export.h:28
Message listener proxy class.
Definition: MessageProxy.h:47
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
Message configuration class.
Definition: MessageConfiguration.h:44
EMERGENCY 5 logic hint observer for messages.
Definition: HintMessageGeneralObserver.h:42
boost::function< bool(const qsf::MessageParameters &, bool)> CustomFilterCallback
Definition: HintMessageGeneralObserver.h:53
Binary serializer class.
Definition: BinarySerializer.h:35
boost::function< MessageCallbackSignature > MessageCallbackBinding
Definition: MessageParameters.h:172
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32