Emergency 20 Dokumentation  4.2.0
BuyUpgradeDataSource.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/game/player/Player.h"
14 
15 #include <Rocket/Controls/DataSource.h>
16 
17 
18 //[-------------------------------------------------------]
19 //[ Namespace ]
20 //[-------------------------------------------------------]
21 namespace em5
22 {
23 
24 
25  //[-------------------------------------------------------]
26  //[ Classes ]
27  //[-------------------------------------------------------]
32  class BuyUpgradeDataSource : public Rocket::Controls::DataSource
33  {
34 
35 
36  //[-------------------------------------------------------]
37  //[ Public methods ]
38  //[-------------------------------------------------------]
39  public:
41 
46  void addBuyableUpgrades(const Player::BuyOption& buyOptions, uint32 upgradeID);
47 
52  void clear();
53 
54 
55  //[-------------------------------------------------------]
56  //[ Public virtual Rocket::Controls::DataSource methods ]
57  //[-------------------------------------------------------]
58  public:
67  virtual void GetRow(Rocket::Core::StringList& row, const Rocket::Core::String& table, int rowIndex, const Rocket::Core::StringList& columns) override;
68  virtual int GetNumRows(const Rocket::Core::String& table) override;
69 
70 
71  //[-------------------------------------------------------]
72  //[ Private definitions ]
73  //[-------------------------------------------------------]
74  private:
75  struct BuyableUpgradeTableData
76  {
77  Rocket::Core::String mTitle;
79  Rocket::Core::String mInfoText;
80  uint32 mCost;
81  uint32 mUpgradeId;
82 
83  BuyableUpgradeTableData(const Rocket::Core::String& title, const Rocket::Core::String& icon, const Rocket::Core::String& infoText, uint32 cost, uint32 upgradeId) :
84  mTitle(title),
85  mIcon(icon),
86  mInfoText(infoText),
87  mCost(cost),
88  mUpgradeId(upgradeId)
89  {
90  // Nothing
91  }
92  };
93  typedef std::vector<BuyableUpgradeTableData> BuyableUpgradeTableDataArray;
94 
95 
96  //[-------------------------------------------------------]
97  //[ Private data ]
98  //[-------------------------------------------------------]
99  private:
100  BuyableUpgradeTableDataArray mTableData;
101 
102 
103  };
104 
105 
106 //[-------------------------------------------------------]
107 //[ Namespace ]
108 //[-------------------------------------------------------]
109 } // em5
Definition: ActionPriority.h:13
unsigned int uint32
Definition: PlatformTypes.h:181
void clear()
Clears the datagrid; this seems to be necessary in order to shut libRocket down properly.
Definition: Player.h:75
void addBuyableUpgrades(const Player::BuyOption &buyOptions, uint32 upgradeID)
Add a new buyable upgrade to table.
Data grid used to display the current buyable upgrades.
Definition: BuyUpgradeDataSource.h:32
virtual void GetRow(Rocket::Core::StringList &row, const Rocket::Core::String &table, int rowIndex, const Rocket::Core::StringList &columns) override
Includes the "columns" StringList "title" you going to get the title. Includes the "columns" StringLi...
Definition: MiniMapWindow.h:43
virtual int GetNumRows(const Rocket::Core::String &table) override