CBonusSelection.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * CBonusSelection.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include "../windows/CWindowObject.h"
  12. #include "../lib/campaign/CampaignConstants.h"
  13. #include "../lib/filesystem/ResourcePath.h"
  14. VCMI_LIB_NAMESPACE_BEGIN
  15. class CampaignState;
  16. class CampaignRegions;
  17. VCMI_LIB_NAMESPACE_END
  18. class CButton;
  19. class CTextBox;
  20. class CToggleGroup;
  21. class CAnimImage;
  22. class CLabel;
  23. class CFlagBox;
  24. class ISelectionScreenInfo;
  25. class ExtraOptionsTab;
  26. class VideoWidgetOnce;
  27. class CBonusSelection;
  28. class LRClickableArea;
  29. /// Campaign screen where you can choose one out of three starting bonuses
  30. class CBonusSelection : public CWindowObject
  31. {
  32. public:
  33. std::shared_ptr<CampaignState> getCampaign();
  34. CBonusSelection();
  35. class CRegion
  36. : public CIntObject
  37. {
  38. std::shared_ptr<CPicture> graphicsNotSelected;
  39. std::shared_ptr<CPicture> graphicsSelected;
  40. std::shared_ptr<CPicture> graphicsStriped;
  41. CampaignScenarioID idOfMapAndRegion;
  42. bool accessible; // false if region should be striped
  43. bool selectable; // true if region should be selectable
  44. bool labelOnly;
  45. std::shared_ptr<CLabel> label;
  46. struct BlinkAnim
  47. {
  48. uint32_t msPassed;
  49. uint32_t count;
  50. bool state;
  51. } blinkAnim;
  52. public:
  53. CRegion(CampaignScenarioID id, bool accessible, bool selectable, bool labelOnly, const CampaignRegions & campDsc);
  54. void updateState(bool disableAll = false);
  55. void tick(uint32_t msPassed) override;
  56. void clickReleased(const Point & cursorPosition) override;
  57. void showPopupWindow(const Point & cursorPosition) override;
  58. };
  59. void createBonusesIcons();
  60. void updateAfterStateChange();
  61. // Event handlers
  62. void goBack();
  63. void startMap();
  64. void restartMap();
  65. void increaseDifficulty();
  66. void decreaseDifficulty();
  67. std::shared_ptr<CPicture> panelBackground;
  68. std::shared_ptr<CButton> buttonStart;
  69. std::shared_ptr<CButton> buttonRestart;
  70. std::shared_ptr<CButton> buttonBack;
  71. std::shared_ptr<CButton> buttonVideo;
  72. std::shared_ptr<CLabel> campaignName;
  73. std::shared_ptr<CLabel> labelCampaignDescription;
  74. std::shared_ptr<CTextBox> campaignDescription;
  75. std::shared_ptr<CLabel> mapName;
  76. std::shared_ptr<CLabel> labelMapDescription;
  77. std::shared_ptr<CTextBox> mapDescription;
  78. std::vector<std::shared_ptr<CRegion>> regions;
  79. std::shared_ptr<CFlagBox> flagbox;
  80. std::shared_ptr<CLabel> labelChooseBonus;
  81. std::shared_ptr<CToggleGroup> groupBonuses;
  82. std::shared_ptr<CLabel> labelDifficulty;
  83. std::array<std::shared_ptr<CAnimImage>, 5> difficultyIcons;
  84. std::array<std::shared_ptr<LRClickableArea>, 5> difficultyIconAreas;
  85. std::shared_ptr<CButton> buttonDifficultyLeft;
  86. std::shared_ptr<CButton> buttonDifficultyRight;
  87. std::shared_ptr<CAnimImage> iconsMapSizes;
  88. std::shared_ptr<ExtraOptionsTab> tabExtraOptions;
  89. std::shared_ptr<CButton> buttonExtraOptions;
  90. };