1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

Restore previously disabled functionality

This commit is contained in:
Ivan Savenko 2024-02-29 15:52:11 +02:00
parent ddb2acb9c2
commit 22f23ba6f8
6 changed files with 39 additions and 14 deletions

View File

@ -299,14 +299,13 @@ void CBonusSelection::createBonusesIcons()
break;
}
std::shared_ptr<CToggleButton> bonusButton = std::make_shared<CToggleButton>(Point(475 + i * 68, 455), AnimationPath(), CButton::tooltip(desc.toString(), desc.toString()));
std::shared_ptr<CToggleButton> bonusButton = std::make_shared<CToggleButton>(Point(475 + i * 68, 455), AnimationPath::builtin("campaignBonusSelection"), CButton::tooltip(desc.toString(), desc.toString()));
if(picNumber != -1)
picName += ":" + std::to_string(picNumber);
bonusButton->setOverlay(std::make_shared<CAnimImage>(AnimationPath::builtin(picName), picNumber));
else
bonusButton->setOverlay(std::make_shared<CPicture>(ImagePath::builtin(picName)));
auto anim = GH.renderHandler().createAnimation();
anim->setCustom(picName, 0);
//TODO: bonusButton->setImage(anim);
if(CSH->campaignBonus == i)
bonusButton->setBorderColor(Colors::BRIGHT_YELLOW);
groupBonuses->addToggle(i, bonusButton);

View File

@ -147,6 +147,11 @@ void ButtonBase::setImageOrder(int state1, int state2, int state3, int state4)
update();
}
std::shared_ptr<CIntObject> ButtonBase::getOverlay()
{
return overlay;
}
void ButtonBase::setStateImpl(EButtonState newState)
{
state = newState;
@ -335,8 +340,8 @@ CButton::CButton(Point position, const AnimationPath &defName, const std::pair<s
ButtonBase(position, defName, key, playerColoredButton),
callback(Callback),
helpBox(help.second),
hoverable(false),
actOnDown(false),
hoverable(false),
soundDisabled(false)
{
defActions = 255-DISPOSE;

View File

@ -48,6 +48,7 @@ protected:
ButtonBase(Point position, const AnimationPath & defName, EShortcut key, bool playerColoredButton);
~ButtonBase();
std::shared_ptr<CIntObject> getOverlay();
void setStateImpl(EButtonState state);
EButtonState getState() const;

View File

@ -168,11 +168,9 @@ ComboBox::ComboBox(Point position, const AnimationPath & defName, const std::pai
void ComboBox::setItem(const void * item)
{
// TODO:
//auto w = std::dynamic_pointer_cast<CLabel>(overlay);
//if( w && getItemText)
// setTextOverlay(getItemText(0, item), w->font, w->color);
auto w = std::dynamic_pointer_cast<CLabel>(getOverlay());
if( w && getItemText)
setTextOverlay(getItemText(0, item), w->font, w->color);
if(onSetItem)
onSetItem(item);

View File

@ -1355,7 +1355,7 @@ CHillFortWindow::CHillFortWindow(const CGHeroInstance * visitor, const CGObjectI
for(int i = 0; i < slotsCount; i++)
{
upgrade[i] = std::make_shared<CButton>(Point(107 + i * 76, 171), AnimationPath::builtin("APHLF1R"), CButton::tooltip(getTextForSlot(SlotID(i))), [=](){ makeDeal(SlotID(i)); }, vstd::next(EShortcut::SELECT_INDEX_1, i));
upgrade[i] = std::make_shared<CButton>(Point(107 + i * 76, 171), AnimationPath::builtin("APHLF1R"), CButton::tooltip(getTextForSlot(SlotID(i))), [this, i](){ makeDeal(SlotID(i)); }, vstd::next(EShortcut::SELECT_INDEX_1, i));
for(int j : {0,1})
{
@ -1364,9 +1364,9 @@ CHillFortWindow::CHillFortWindow(const CGHeroInstance * visitor, const CGObjectI
}
}
upgradeAll = std::make_shared<CButton>(Point(30, 231), AnimationPath::builtin("APHLF4R"), CButton::tooltip(CGI->generaltexth->allTexts[432]), [&](){ makeDeal(SlotID(slotsCount));}, EShortcut::RECRUITMENT_UPGRADE_ALL);
upgradeAll = std::make_shared<CButton>(Point(30, 231), AnimationPath::builtin("APHLF4R"), CButton::tooltip(CGI->generaltexth->allTexts[432]), [this](){ makeDeal(SlotID(slotsCount));}, EShortcut::RECRUITMENT_UPGRADE_ALL);
quit = std::make_shared<CButton>(Point(294, 275), AnimationPath::builtin("IOKAY.DEF"), CButton::tooltip(), std::bind(&CHillFortWindow::close, this), EShortcut::GLOBAL_ACCEPT);
quit = std::make_shared<CButton>(Point(294, 275), AnimationPath::builtin("IOKAY.DEF"), CButton::tooltip(), [this](){close();}, EShortcut::GLOBAL_ACCEPT);
statusbar = CGStatusBar::create(std::make_shared<CPicture>(background->getSurface(), Rect(8, pos.h - 26, pos.w - 16, 19), 8, pos.h - 26));
garr = std::make_shared<CGarrisonInt>(Point(108, 60), 18, Point(), hero, nullptr);

View File

@ -0,0 +1,22 @@
{
"normal" : {
"width": 58,
"height": 64,
"items" : []
},
"pressed" : {
"width": 58,
"height": 64,
"items" : []
},
"blocked" : {
"width": 58,
"height": 64,
"items" : []
},
"highlighted" : {
"width": 58,
"height": 64,
"items" : []
},
}