Emergency 20 Dokumentation  4.2.0
UnitOverviewWindow.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 //[-------------------------------------------------------]
13 #include "em5/Export.h"
15 
16 #include <qsf/math/Color4.h>
17 #include <qsf/job/JobProxy.h>
18 #include <qsf/gui/GuiDocument.h>
19 
20 #include <vector>
21 
22 
23 //[-------------------------------------------------------]
24 //[ Forward declarations ]
25 //[-------------------------------------------------------]
26 namespace qsf
27 {
28  class Entity;
29  class JobArguments;
30 }
31 namespace em5
32 {
33  class Player;
34 }
35 namespace Rocket
36 {
37  namespace Core
38  {
39  class Element;
40  }
41 }
42 
43 
44 //[-------------------------------------------------------]
45 //[ Namespace ]
46 //[-------------------------------------------------------]
47 namespace em5
48 {
49 
50 
51  //[-------------------------------------------------------]
52  //[ Classes ]
53  //[-------------------------------------------------------]
59  {
60 
61 
62  //[-------------------------------------------------------]
63  //[ Public methods ]
64  //[-------------------------------------------------------]
65  public:
66  explicit UnitOverviewWindow(qsf::GuiContext& guiContext);
67  virtual ~UnitOverviewWindow();
68 
73  uint32 getPlayerId() const;
74 
79  void setPlayerId(uint32 playerId);
80 
81 
82  //[-------------------------------------------------------]
83  //[ Public virtual qsf::GuiDocument methods ]
84  //[-------------------------------------------------------]
85  public:
86  virtual void processEvent(const std::string& eventKey, Rocket::Core::Event& event) override;
87 
88 
89  //[-------------------------------------------------------]
90  //[ Private virtual qsf::GuiDocument methods ]
91  //[-------------------------------------------------------]
92  private:
93  virtual bool onPreShow() override;
94  virtual void onPreHide() override;
95 
96 
97  //[-------------------------------------------------------]
98  //[ Private definitions ]
99  //[-------------------------------------------------------]
100  private:
101  struct UnitEntry
102  {
103  uint64 entityId;
104  Rocket::Core::Element* unitListEntryElement;
105  qsf::Color4 borderColor;
106  qsf::Color4 actionPriorityColor;
107  std::string localizedEquipmentId;
108  UnitEntry(uint64 _entityId, Rocket::Core::Element& _unitListEntryElement, const qsf::Color4& _actionPriorityColor, const std::string& _localizedEquipmentId) :
109  entityId(_entityId),
110  unitListEntryElement(&_unitListEntryElement),
111  borderColor(_actionPriorityColor),
112  actionPriorityColor(_actionPriorityColor),
113  localizedEquipmentId(_localizedEquipmentId)
114  { }
115  };
116  typedef std::vector<uint64> EntityIds;
117  typedef std::vector<UnitEntry> UnitEntries;
118 
119 
120  //[-------------------------------------------------------]
121  //[ Private methods ]
122  //[-------------------------------------------------------]
123  private:
124  void setupGui();
125  void onReloadGui();
126  Player* getPlayer() const;
127  void selectUnitsDepartment(units::Department unitsDepartment);
128  void updateRelevantEntityIds();
129  void fillUnitsList();
130  void addUnitEntry(uint64 entityId);
131  void update(const qsf::JobArguments& jobArguments);
132  void setMouseoverHighlighting(uint64 entityId);
133  void setMouseoverHighlightingInternal(uint64 entityId, bool enabled);
134  void setUnitEntryTooltip(const UnitEntry& unitEntry);
135  bool isEntityPerson(uint64 entityId) const;
136  const std::string& getLocalizedEquipmentIdByEntity(qsf::Entity& entity) const;
137 
138 
139  //[-------------------------------------------------------]
140  //[ Private data ]
141  //[-------------------------------------------------------]
142  private:
143  uint32 mPlayerId;
144  units::Department mUnitsDepartment;
145  EntityIds mRelevantEntityIds;
146  UnitEntries mUnitEntries;
147  qsf::JobProxy mUpdateJobProxy;
148  uint64 mMouseoverHighlightedEntityId;
149  Rocket::Core::Element* mVehicleListElement;
150  Rocket::Core::Element* mPersonListElement;
151 
152 
153  };
154 
155 
156 //[-------------------------------------------------------]
157 //[ Namespace ]
158 //[-------------------------------------------------------]
159 } // em5
Definition: ActionPriority.h:13
Job proxy class.
Definition: JobProxy.h:51
Entity class.
Definition: Entity.h:46
Color class with red, green, blue and alpha component.
Definition: Color4.h:39
unsigned int uint32
Definition: PlatformTypes.h:181
Department
Definition: Department.h:19
Graphical User Interface (GUI) document base class.
Definition: GuiDocument.h:51
#define EM5_API_EXPORT
Definition: Export.h:28
Definition: OverlayComponent.h:29
uint64_t uint64
Definition: PlatformTypes.h:184
EMERGENCY 5 player class.
Definition: Player.h:57
Job arguments class: holds data to be passed to the called job method by the job manager.
Definition: JobArguments.h:40
Definition: PickupPersonByParamedicAction.h:21
Ingame Graphical User Interface (GUI) context class.
Definition: GuiContext.h:62
Unit overview window.
Definition: UnitOverviewWindow.h:58