CCampaignScreen.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * CCampaignScreen.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 <vector>
  13. #include <memory>
  14. VCMI_LIB_NAMESPACE_BEGIN
  15. class JsonNode;
  16. VCMI_LIB_NAMESPACE_END
  17. class CLabel;
  18. class CPicture;
  19. class CButton;
  20. class VideoWidget;
  21. class CCampaignScreen : public CWindowObject
  22. {
  23. public:
  24. enum CampaignStatus { DEFAULT = 0, ENABLED, DISABLED, COMPLETED };
  25. private:
  26. class CCampaignButton : public CIntObject
  27. {
  28. private:
  29. std::shared_ptr<CLabel> hoverLabel;
  30. std::shared_ptr<CPicture> graphicsImage;
  31. std::shared_ptr<CPicture> graphicsCompleted;
  32. std::shared_ptr<VideoWidget> videoPlayer;
  33. CampaignStatus status;
  34. VideoPath videoPath;
  35. std::string campFile;
  36. std::string hoverText;
  37. std::string campaignSet;
  38. void clickReleased(const Point& cursorPosition) override;
  39. void hover(bool on) override;
  40. public:
  41. CCampaignButton(const JsonNode& config, const JsonNode& parentConfig, std::string campaignSet);
  42. };
  43. std::string campaignSet;
  44. std::vector<std::shared_ptr<CCampaignButton>> campButtons;
  45. std::vector<std::shared_ptr<CPicture>> images;
  46. std::shared_ptr<CButton> buttonBack;
  47. std::shared_ptr<CButton> buttonNext;
  48. std::shared_ptr<CButton> buttonPrev;
  49. std::shared_ptr<CButton> createExitButton(const JsonNode& button);
  50. int campaignsPerPage = 8;
  51. int currentPage = 0;
  52. int maxPages = 0;
  53. void switchPage(int delta, const std::string& campaignSet);
  54. void updateCampaignButtons(const JsonNode& parentConfig, const std::string& campaignSet);
  55. public:
  56. CCampaignScreen(const JsonNode& config, std::string campaignSet);
  57. void activate() override;
  58. };