mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-27 22:49:25 +02:00
simple resource show on right click
This commit is contained in:
@@ -18,15 +18,21 @@
|
|||||||
#include "../GameInstance.h"
|
#include "../GameInstance.h"
|
||||||
#include "../gui/TextAlignment.h"
|
#include "../gui/TextAlignment.h"
|
||||||
#include "../widgets/Images.h"
|
#include "../widgets/Images.h"
|
||||||
|
#include "../widgets/CComponent.h"
|
||||||
|
#include "../windows/InfoWindows.h"
|
||||||
|
|
||||||
#include "../../lib/CConfigHandler.h"
|
#include "../../lib/CConfigHandler.h"
|
||||||
#include "../../lib/callback/CCallback.h"
|
#include "../../lib/callback/CCallback.h"
|
||||||
#include "../../lib/texts/CGeneralTextHandler.h"
|
#include "../../lib/texts/CGeneralTextHandler.h"
|
||||||
#include "../../lib/ResourceSet.h"
|
#include "../../lib/ResourceSet.h"
|
||||||
#include "../../lib/GameLibrary.h"
|
#include "../../lib/GameLibrary.h"
|
||||||
|
#include "../../lib/entities/ResourceTypeHandler.h"
|
||||||
|
#include "../../lib/networkPacks/Component.h"
|
||||||
|
|
||||||
CResDataBar::CResDataBar(const ImagePath & imageName, const Point & position)
|
CResDataBar::CResDataBar(const ImagePath & imageName, const Point & position)
|
||||||
{
|
{
|
||||||
|
addUsedEvents(SHOW_POPUP);
|
||||||
|
|
||||||
pos.x += position.x;
|
pos.x += position.x;
|
||||||
pos.y += position.y;
|
pos.y += position.y;
|
||||||
|
|
||||||
@@ -89,3 +95,12 @@ void CResDataBar::setPlayerColor(PlayerColor player)
|
|||||||
{
|
{
|
||||||
background->setPlayerColor(player);
|
background->setPlayerColor(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CResDataBar::showPopupWindow(const Point & cursorPosition)
|
||||||
|
{
|
||||||
|
std::vector<std::shared_ptr<CComponent>> comp;
|
||||||
|
for (auto & i : LIBRARY->resourceTypeHandler->getAllObjects())
|
||||||
|
comp.push_back(std::make_shared<CComponent>(ComponentType::RESOURCE, i, GAME->interface()->cb->getResourceAmount(i)));
|
||||||
|
|
||||||
|
CRClickPopup::createAndPush(LIBRARY->generaltexth->translate("core.genrltxt.270"), comp);
|
||||||
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ public:
|
|||||||
void setResourcePosition(const GameResID & resource, const Point & position);
|
void setResourcePosition(const GameResID & resource, const Point & position);
|
||||||
|
|
||||||
void setPlayerColor(PlayerColor player);
|
void setPlayerColor(PlayerColor player);
|
||||||
|
void showPopupWindow(const Point & cursorPosition) override;
|
||||||
void showAll(Canvas & to) override;
|
void showAll(Canvas & to) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user