Emergency 20 Dokumentation  4.2.0
ObjectiveWindow.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 //[-------------------------------------------------------]
15 
16 #include <qsf/gui/GuiDocument.h>
18 #include <qsf/audio/AudioProxy.h>
19 
20 
21 //[-------------------------------------------------------]
22 //[ Namespace ]
23 //[-------------------------------------------------------]
24 namespace em5
25 {
26 
27 
28  //[-------------------------------------------------------]
29  //[ Classes ]
30  //[-------------------------------------------------------]
36  {
37 
38 
39  //[-------------------------------------------------------]
40  //[ Public methods ]
41  //[-------------------------------------------------------]
42  public:
43  explicit ObjectiveWindow(qsf::GuiContext& guiContext);
44  virtual ~ObjectiveWindow();
45 
53  void enableButton(bool state);
54 
62  void blinkButton(bool blink);
63 
68  void clear();
69 
77  const DefaultObjectiveWindowDataSource& getDefaultObjectiveWindowDataSource() const;
78 
86  void setObjectiveWindowDataSource(ObjectiveWindowDataSource* objectiveWindowDataSource);
87 
92  void triggerRefresh();
93 
94 
95  //[-------------------------------------------------------]
96  //[ Public virtual qsf::GuiDocument methods ]
97  //[-------------------------------------------------------]
98  public:
99  virtual void processEvent(const std::string& eventKey, Rocket::Core::Event& event) override;
100 
101 
102  //[-------------------------------------------------------]
103  //[ Private virtual qsf::GuiDocument methods ]
104  //[-------------------------------------------------------]
105  private:
106  virtual bool onPreShow() override;
107 
108 
109  //[-------------------------------------------------------]
110  //[ Private methods ]
111  //[-------------------------------------------------------]
112  private:
113  // Message listener callbacks
114  void onUpdateEvents(const qsf::MessageParameters& parameters);
115  void onNewEvent(const qsf::MessageParameters& parameters);
116  void onEventFinish(const qsf::MessageParameters& parameters);
117  void onEventFinishFailed(const qsf::MessageParameters& parameters);
118  void onObjectiveGivePoints(const qsf::MessageParameters& parameters);
119  void onEventFinishPoints(const qsf::MessageParameters& parameters);
120 
121  // Job updates
122  void onBlink(const qsf::JobArguments& jobArguments);
123  void onSignalPointAdded(const qsf::JobArguments& jobArguments);
124  void onSignalObjectivePointAdded(const qsf::JobArguments& jobArguments);
125 
126  void refreshObjectiveView();
127  void showPointSignal(bool show);
128  bool updatePointsAnimation(Rocket::Core::Element& points, Rocket::Core::Element& background, float& animationTime, float secondsElapsed);
129 
130 
131  //[-------------------------------------------------------]
132  //[ Private definitions ]
133  //[-------------------------------------------------------]
134  private:
135  struct ClosedEventData
136  {
137  Rocket::Core::Element* element;
138  float animationTime;
139  bool eventSuccess;
140  };
141  struct ObjectivePointContainer
142  {
143  Rocket::Core::Element* element;
144  bool occupied;
145  float animationTime;
146  };
147 
148 
149  //[-------------------------------------------------------]
150  //[ Private data ]
151  //[-------------------------------------------------------]
152  private:
153  // Message proxies
154  qsf::MessageProxy mMessageProxy;
155  qsf::MessageProxy mMessageProxyNewEvent;
156  qsf::MessageProxy mMessageProxyEventSucceeded;
157  qsf::MessageProxy mMessageProxyEventFailed;
158  qsf::MessageProxy mMessageProxyObjectivGivePoints;
159  qsf::MessageProxy mMessageProxyEventPoints;
160 
161  // Job proxies
162  qsf::JobProxy mAnimationJobProxy;
163  qsf::JobProxy mAnimationSignalPointsProxy;
164  qsf::JobProxy mAnimationSignalObjectivePointsProxy;
165  qsf::JobProxy mDelayedUpdateJobProxy;
166 
167  // Other
168  DefaultObjectiveWindowDataSource mDefaultObjectiveWindowDataSource;
169  const ObjectiveWindowDataSource* mObjectiveWindowDataSource;
170  std::vector<ObjectivePointContainer> mObjectivePointsContainer;
171  BlinkButton mBlinkButton;
172  std::vector<ClosedEventData> mClosedEventList;
173  std::vector<uint32> mAddedObjectivePoints;
174  std::vector<uint32> mAddedEventPoints;
175  float mAddedPointAnimationTime;
176  bool mEventSuccess;
177  qsf::AudioProxy mAudioProxy;
178  bool mDontRemoveObjective;
179  bool mIsMainEvent;
180 
181 
182  };
183 
184 
185 //[-------------------------------------------------------]
186 //[ Namespace ]
187 //[-------------------------------------------------------]
188 } // em5
Definition: ActionPriority.h:13
Job proxy class.
Definition: JobProxy.h:51
Message parameters class.
Definition: MessageParameters.h:34
Graphical User Interface (GUI) document base class.
Definition: GuiDocument.h:51
#define EM5_API_EXPORT
Definition: Export.h:28
EMERGENCY 5 objective window data source default implementation which holds and manages the live stat...
Definition: DefaultObjectiveWindowDataSource.h:30
Message listener proxy class.
Definition: MessageProxy.h:47
Job arguments class: holds data to be passed to the called job method by the job manager.
Definition: JobArguments.h:40
The audio proxy resembles the playback of an audio asset.
Definition: AudioProxy.h:71
Ingame Graphical User Interface (GUI) context class.
Definition: GuiContext.h:62
Abstract objective window data source interface.
Definition: ObjectiveWindowDataSource.h:30
Objective window.
Definition: ObjectiveWindow.h:35