| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 | 
							- /*
 
-  * CInfoBar.h, part of VCMI engine
 
-  *
 
-  * Authors: listed in file AUTHORS in main folder
 
-  *
 
-  * License: GNU General Public License v2.0 or later
 
-  * Full text of license available in license.txt file, in main folder
 
-  *
 
-  */
 
- #pragma once
 
- #include "../gui/CIntObject.h"
 
- VCMI_LIB_NAMESPACE_BEGIN
 
- class CGHeroInstance;
 
- class CGTownInstance;
 
- struct Component;
 
- class PlayerColor;
 
- VCMI_LIB_NAMESPACE_END
 
- class CAnimImage;
 
- class CShowableAnim;
 
- class CComponent;
 
- class CHeroTooltip;
 
- class CTownTooltip;
 
- class CLabel;
 
- class CTextBox;
 
- /// Info box which shows next week/day information, hold the current date
 
- class CInfoBar : public CIntObject
 
- {
 
- 	//all visible information located in one object - for ease of replacing
 
- 	class CVisibleInfo : public CIntObject
 
- 	{
 
- 	public:
 
- 		void show(SDL_Surface * to) override;
 
- 	protected:
 
- 		std::shared_ptr<CPicture> background;
 
- 		std::list<std::shared_ptr<CIntObject>> forceRefresh;
 
- 		CVisibleInfo();
 
- 	};
 
- 	class EmptyVisibleInfo : public CVisibleInfo
 
- 	{
 
- 	public:
 
- 		EmptyVisibleInfo();
 
- 	};
 
- 	class VisibleHeroInfo : public CVisibleInfo
 
- 	{
 
- 		std::shared_ptr<CHeroTooltip> heroTooltip;
 
- 	public:
 
- 		VisibleHeroInfo(const CGHeroInstance * hero);
 
- 	};
 
- 	class VisibleTownInfo : public CVisibleInfo
 
- 	{
 
- 		std::shared_ptr<CTownTooltip> townTooltip;
 
- 	public:
 
- 		VisibleTownInfo(const CGTownInstance * town);
 
- 	};
 
- 	class VisibleDateInfo : public CVisibleInfo
 
- 	{
 
- 		std::shared_ptr<CShowableAnim> animation;
 
- 		std::shared_ptr<CLabel> label;
 
- 		std::string getNewDayName();
 
- 	public:
 
- 		VisibleDateInfo();
 
- 	};
 
- 	class VisibleEnemyTurnInfo : public CVisibleInfo
 
- 	{
 
- 		std::shared_ptr<CAnimImage> banner;
 
- 		std::shared_ptr<CShowableAnim> glass;
 
- 		std::shared_ptr<CShowableAnim> sand;
 
- 	public:
 
- 		VisibleEnemyTurnInfo(PlayerColor player);
 
- 	};
 
- 	class VisibleGameStatusInfo : public CVisibleInfo
 
- 	{
 
- 		std::shared_ptr<CLabel> allyLabel;
 
- 		std::shared_ptr<CLabel> enemyLabel;
 
- 		std::vector<std::shared_ptr<CAnimImage>> flags;
 
- 		std::vector<std::shared_ptr<CAnimImage>> hallIcons;
 
- 		std::vector<std::shared_ptr<CLabel>> hallLabels;
 
- 	public:
 
- 		VisibleGameStatusInfo();
 
- 	};
 
- 	class VisibleComponentInfo : public CVisibleInfo
 
- 	{
 
- 		std::shared_ptr<CComponent> comp;
 
- 		std::shared_ptr<CTextBox> text;
 
- 	public:
 
- 		VisibleComponentInfo(const Component & compToDisplay, std::string message);
 
- 	};
 
- 	enum EState
 
- 	{
 
- 		EMPTY, HERO, TOWN, DATE, GAME, AITURN, COMPONENT
 
- 	};
 
- 	std::shared_ptr<CVisibleInfo> visibleInfo;
 
- 	EState state;
 
- 	//removes all information about current state, deactivates timer (if any)
 
- 	void reset();
 
- 	void tick() override;
 
- 	void clickLeft(tribool down, bool previousState) override;
 
- 	void clickRight(tribool down, bool previousState) override;
 
- 	void hover(bool on) override;
 
- 	void playNewDaySound();
 
- public:
 
- 	CInfoBar(const Rect & pos);
 
- 	/// show new day/week animation
 
- 	void showDate();
 
- 	/// show component for 3 seconds. Used to display picked up resources
 
- 	void showComponent(const Component & comp, std::string message);
 
- 	/// print enemy turn progress
 
- 	void startEnemyTurn(PlayerColor color);
 
- 	/// reset to default view - selected object
 
- 	void showSelection();
 
- 	/// show hero\town information
 
- 	void showHeroSelection(const CGHeroInstance * hero);
 
- 	void showTownSelection(const CGTownInstance * town);
 
- 	/// for 3 seconds shows amount of town halls and players status
 
- 	void showGameStatus();
 
- };
 
 
  |