2023-04-23 15:10:35 +03:00
|
|
|
/*
|
|
|
|
* CArtifactsOfHeroKingdom.cpp, 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
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#include "StdInc.h"
|
|
|
|
#include "CArtifactsOfHeroKingdom.h"
|
|
|
|
|
|
|
|
#include "Buttons.h"
|
|
|
|
|
|
|
|
#include "../CPlayerInterface.h"
|
2023-10-14 22:00:39 +03:00
|
|
|
#include "../../lib/mapObjects/CGHeroInstance.h"
|
2023-04-23 15:10:35 +03:00
|
|
|
|
|
|
|
#include "../../CCallback.h"
|
2023-10-23 16:38:05 +03:00
|
|
|
#include "../../lib/networkPacks/ArtifactLocation.h"
|
2023-04-23 15:10:35 +03:00
|
|
|
|
|
|
|
CArtifactsOfHeroKingdom::CArtifactsOfHeroKingdom(ArtPlaceMap ArtWorn, std::vector<ArtPlacePtr> Backpack,
|
|
|
|
std::shared_ptr<CButton> leftScroll, std::shared_ptr<CButton> rightScroll)
|
|
|
|
{
|
|
|
|
artWorn = ArtWorn;
|
|
|
|
backpack = Backpack;
|
|
|
|
leftBackpackRoll = leftScroll;
|
|
|
|
rightBackpackRoll = rightScroll;
|
|
|
|
|
|
|
|
for(auto artPlace : artWorn)
|
|
|
|
{
|
|
|
|
artPlace.second->slot = artPlace.first;
|
|
|
|
artPlace.second->setArtifact(nullptr);
|
2023-12-17 16:30:19 +02:00
|
|
|
artPlace.second->setClickPressedCallback(std::bind(&CArtifactsOfHeroBase::clickPrassedArtPlace, this, _1, _2));
|
|
|
|
artPlace.second->setShowPopupCallback(std::bind(&CArtifactsOfHeroBase::showPopupArtPlace, this, _1, _2));
|
2023-04-23 15:10:35 +03:00
|
|
|
}
|
2024-05-20 15:31:07 +03:00
|
|
|
enableGesture();
|
2023-04-23 15:10:35 +03:00
|
|
|
for(auto artPlace : backpack)
|
|
|
|
{
|
|
|
|
artPlace->setArtifact(nullptr);
|
2023-12-17 16:30:19 +02:00
|
|
|
artPlace->setClickPressedCallback(std::bind(&CArtifactsOfHeroBase::clickPrassedArtPlace, this, _1, _2));
|
|
|
|
artPlace->setShowPopupCallback(std::bind(&CArtifactsOfHeroBase::showPopupArtPlace, this, _1, _2));
|
2023-04-23 15:10:35 +03:00
|
|
|
}
|
|
|
|
leftBackpackRoll->addCallback(std::bind(&CArtifactsOfHeroBase::scrollBackpack, this, -1));
|
|
|
|
rightBackpackRoll->addCallback(std::bind(&CArtifactsOfHeroBase::scrollBackpack, this, +1));
|
2023-09-03 21:41:00 +03:00
|
|
|
|
|
|
|
setRedrawParent(true);
|
2023-04-23 15:10:35 +03:00
|
|
|
}
|
|
|
|
|
2024-04-11 23:52:37 +03:00
|
|
|
void CArtifactsOfHeroKingdom::deactivate()
|
2023-07-06 22:14:12 +03:00
|
|
|
{
|
|
|
|
putBackPickedArtifact();
|
2024-04-11 23:52:37 +03:00
|
|
|
CArtifactsOfHeroBase::deactivate();
|
2023-07-06 22:14:12 +03:00
|
|
|
}
|