1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-04-23 12:08:45 +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

@ -299,14 +299,13 @@ void CBonusSelection::createBonusesIcons()
break; 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) 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) if(CSH->campaignBonus == i)
bonusButton->setBorderColor(Colors::BRIGHT_YELLOW); bonusButton->setBorderColor(Colors::BRIGHT_YELLOW);
groupBonuses->addToggle(i, bonusButton); groupBonuses->addToggle(i, bonusButton);

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

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

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

@ -1355,7 +1355,7 @@ CHillFortWindow::CHillFortWindow(const CGHeroInstance * visitor, const CGObjectI
for(int i = 0; i < slotsCount; i++) 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}) 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)); 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); garr = std::make_shared<CGarrisonInt>(Point(108, 60), 18, Point(), hero, nullptr);

@ -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" : []
},
}