2011-12-14 00:23:17 +03:00
|
|
|
#pragma once
|
|
|
|
|
2014-07-13 20:53:37 +03:00
|
|
|
#include "../../lib/HeroBonus.h"
|
2014-07-14 17:44:15 +03:00
|
|
|
#include "../widgets/MiscWidgets.h"
|
2014-07-15 10:14:49 +03:00
|
|
|
#include "CWindowObject.h"
|
2011-03-03 20:25:48 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* CCreatureWindow.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
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2016-09-08 18:42:59 +02:00
|
|
|
struct StackWindowInfo;
|
2012-05-16 20:29:05 +03:00
|
|
|
class CCommanderInstance;
|
2014-06-27 18:33:30 +03:00
|
|
|
class CStackInstance;
|
2011-03-03 20:25:48 +02:00
|
|
|
class CStack;
|
2011-12-22 16:05:19 +03:00
|
|
|
struct UpgradeInfo;
|
2014-07-15 10:14:49 +03:00
|
|
|
class CTabbedInt;
|
2014-08-03 14:16:19 +03:00
|
|
|
class CButton;
|
2011-03-03 20:25:48 +02:00
|
|
|
|
2017-05-26 21:58:33 +02:00
|
|
|
class CCommanderSkillIcon : public LRClickableAreaWText //TODO: maybe bring commander skill button initialization logic inside?
|
2011-03-03 20:25:48 +02:00
|
|
|
{
|
2014-06-27 18:33:30 +03:00
|
|
|
CIntObject * object; // passive object that will be used to determine clickable area
|
2011-03-03 20:25:48 +02:00
|
|
|
public:
|
2017-05-26 21:58:33 +02:00
|
|
|
CCommanderSkillIcon(CIntObject * object, std::function<void()> callback);
|
2011-03-03 20:25:48 +02:00
|
|
|
|
2017-05-26 21:58:33 +02:00
|
|
|
std::function<void()> callback;
|
2011-04-09 22:34:48 +03:00
|
|
|
|
2014-07-03 21:09:17 +03:00
|
|
|
void clickLeft(tribool down, bool previousState) override;
|
2017-05-26 21:58:33 +02:00
|
|
|
void clickRight(tribool down, bool previousState) override;
|
2011-04-09 22:34:48 +03:00
|
|
|
|
2014-06-27 18:33:30 +03:00
|
|
|
void setObject(CIntObject * object);
|
2011-05-28 01:34:58 +03:00
|
|
|
};
|
2011-12-22 16:05:19 +03:00
|
|
|
|
2014-06-26 22:07:33 +03:00
|
|
|
class CStackWindow : public CWindowObject
|
2012-07-03 11:07:34 +03:00
|
|
|
{
|
2014-06-26 22:07:33 +03:00
|
|
|
struct BonusInfo
|
|
|
|
{
|
|
|
|
std::string name;
|
|
|
|
std::string description;
|
|
|
|
std::string imagePath;
|
|
|
|
};
|
2012-07-03 11:07:34 +03:00
|
|
|
|
2014-06-26 22:07:33 +03:00
|
|
|
class CWindowSection : public CIntObject
|
|
|
|
{
|
2016-10-30 17:32:28 +02:00
|
|
|
CStackWindow *parent;
|
2012-07-03 11:07:34 +03:00
|
|
|
|
2014-06-26 22:07:33 +03:00
|
|
|
void createBackground(std::string path);
|
|
|
|
void createBonusItem(size_t index, Point position);
|
2011-12-22 16:05:19 +03:00
|
|
|
|
2014-06-26 22:07:33 +03:00
|
|
|
void printStatString(int index, std::string name, std::string value);
|
|
|
|
void printStatRange(int index, std::string name, int min, int max);
|
|
|
|
void printStatBase(int index, std::string name, int base, int current);
|
|
|
|
void printStat(int index, std::string name, int value);
|
|
|
|
public:
|
|
|
|
void createStackInfo(bool showExp, bool showArt);
|
|
|
|
void createActiveSpells();
|
|
|
|
void createCommanderSection();
|
|
|
|
void createCommander();
|
|
|
|
void createCommanderAbilities();
|
|
|
|
void createBonuses(boost::optional<size_t> size = boost::optional<size_t>());
|
|
|
|
void createBonusEntry(size_t index);
|
|
|
|
void createButtonPanel();
|
2011-12-22 16:05:19 +03:00
|
|
|
|
2014-06-26 22:07:33 +03:00
|
|
|
CWindowSection(CStackWindow * parent);
|
|
|
|
};
|
2011-12-22 16:05:19 +03:00
|
|
|
|
2016-10-30 17:32:28 +02:00
|
|
|
std::unique_ptr<CAnimImage> stackArtifactIcon;
|
|
|
|
std::unique_ptr<LRClickableAreaWTextComp> stackArtifactHelp;
|
|
|
|
std::unique_ptr<CButton> stackArtifactButton;
|
2016-10-30 23:21:26 +02:00
|
|
|
CAnimImage *expRankIcon;
|
|
|
|
LRClickableAreaWText *expArea;
|
|
|
|
CLabel *expLabel;
|
2011-12-22 16:05:19 +03:00
|
|
|
|
2014-06-27 18:33:30 +03:00
|
|
|
std::unique_ptr<StackWindowInfo> info;
|
2014-06-26 22:07:33 +03:00
|
|
|
std::vector<BonusInfo> activeBonuses;
|
|
|
|
size_t activeTab;
|
2016-10-30 17:32:28 +02:00
|
|
|
CTabbedInt *commanderTab;
|
2011-12-22 16:05:19 +03:00
|
|
|
|
2014-08-03 14:16:19 +03:00
|
|
|
std::map<int, CButton *> switchButtons;
|
2014-06-27 18:33:30 +03:00
|
|
|
|
2017-05-26 21:58:33 +02:00
|
|
|
void setSelection(si32 newSkill, CCommanderSkillIcon * newIcon);
|
|
|
|
CCommanderSkillIcon * selectedIcon;
|
2014-06-26 22:07:33 +03:00
|
|
|
si32 selectedSkill;
|
2011-12-22 16:05:19 +03:00
|
|
|
|
2014-06-26 22:07:33 +03:00
|
|
|
CIntObject * createBonusEntry(size_t index);
|
|
|
|
CIntObject * switchTab(size_t index);
|
|
|
|
|
2014-07-05 11:48:03 +03:00
|
|
|
void removeStackArtifact(ArtifactPosition pos);
|
|
|
|
|
2014-06-26 22:07:33 +03:00
|
|
|
void initSections();
|
|
|
|
void initBonusesList();
|
|
|
|
|
|
|
|
void init();
|
2012-07-03 11:07:34 +03:00
|
|
|
|
2014-07-04 12:48:09 +03:00
|
|
|
std::string generateStackExpDescription();
|
|
|
|
|
2014-07-04 20:58:18 +03:00
|
|
|
CIntObject * createSkillEntry(int index);
|
|
|
|
|
2011-12-22 16:05:19 +03:00
|
|
|
public:
|
2014-06-26 22:07:33 +03:00
|
|
|
// for battles
|
|
|
|
CStackWindow(const CStack * stack, bool popup);
|
2011-12-22 16:05:19 +03:00
|
|
|
|
2014-06-26 22:07:33 +03:00
|
|
|
// for non-existing stacks, e.g. recruit screen
|
|
|
|
CStackWindow(const CCreature * creature, bool popup);
|
2011-12-22 16:05:19 +03:00
|
|
|
|
2014-06-26 22:07:33 +03:00
|
|
|
// for normal stacks in armies
|
|
|
|
CStackWindow(const CStackInstance * stack, bool popup);
|
|
|
|
CStackWindow(const CStackInstance * stack, std::function<void()> dismiss, const UpgradeInfo & info, std::function<void(CreatureID)> callback);
|
2011-12-22 16:05:19 +03:00
|
|
|
|
2014-06-26 22:07:33 +03:00
|
|
|
// for commanders & commander level-up dialog
|
|
|
|
CStackWindow(const CCommanderInstance * commander, bool popup);
|
|
|
|
CStackWindow(const CCommanderInstance * commander, std::vector<ui32> &skills, std::function<void(ui32)> callback);
|
2014-06-27 18:33:30 +03:00
|
|
|
|
|
|
|
~CStackWindow();
|
2011-12-22 16:05:19 +03:00
|
|
|
};
|