mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-07 07:10:04 +02:00
make hideable
This commit is contained in:
parent
37b5de689a
commit
1daf6dfad1
@ -420,7 +420,7 @@ BattleHero::BattleHero(const BattleInterface & owner, const CGHeroInstance * her
|
||||
}
|
||||
|
||||
QuickSpellPanel::QuickSpellPanel(BattleInterface & owner)
|
||||
: CWindowObject(NEEDS_ANIMATED_BACKGROUND), owner(owner)
|
||||
: CIntObject(0), owner(owner)
|
||||
{
|
||||
OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
|
||||
|
||||
|
@ -167,7 +167,7 @@ public:
|
||||
int spellSlot;
|
||||
};
|
||||
|
||||
class QuickSpellPanel : public CWindowObject
|
||||
class QuickSpellPanel : public CIntObject
|
||||
{
|
||||
private:
|
||||
std::shared_ptr<CFilledTexture> background;
|
||||
|
@ -80,6 +80,7 @@ BattleWindow::BattleWindow(BattleInterface & Owner):
|
||||
owner.castThisSpell(id);
|
||||
}
|
||||
};
|
||||
addShortcut(EShortcut::BATTLE_TOGGLE_QUICKSPELL, [this](){ this->toggleStickyQuickSpellVisibility();});
|
||||
addShortcut(EShortcut::BATTLE_SPELL_SHORTCUT_0, [useSpellIfPossible](){ useSpellIfPossible(0); });
|
||||
addShortcut(EShortcut::BATTLE_SPELL_SHORTCUT_1, [useSpellIfPossible](){ useSpellIfPossible(1); });
|
||||
addShortcut(EShortcut::BATTLE_SPELL_SHORTCUT_2, [useSpellIfPossible](){ useSpellIfPossible(2); });
|
||||
@ -205,9 +206,47 @@ void BattleWindow::createQuickSpellWindow()
|
||||
{
|
||||
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
|
||||
|
||||
std::shared_ptr<QuickSpellPanel> window = std::make_shared<QuickSpellPanel>(owner);
|
||||
window->moveTo(Point(pos.x - 68, pos.y - 14));
|
||||
GH.windows().pushWindow(window);
|
||||
quickSpellWindow = std::make_shared<QuickSpellPanel>(owner);
|
||||
quickSpellWindow->moveTo(Point(pos.x - 68, pos.y - 14));
|
||||
|
||||
if(settings["battle"]["enableQuickSpellPanel"].Bool())
|
||||
showStickyQuickSpellWindow();
|
||||
else
|
||||
hideStickyQuickSpellWindow();
|
||||
}
|
||||
|
||||
void BattleWindow::toggleStickyQuickSpellVisibility()
|
||||
{
|
||||
if(settings["battle"]["enableQuickSpellPanel"].Bool())
|
||||
hideStickyQuickSpellWindow();
|
||||
else
|
||||
showStickyQuickSpellWindow();
|
||||
}
|
||||
|
||||
void BattleWindow::hideStickyQuickSpellWindow()
|
||||
{
|
||||
if(settings["battle"]["enableQuickSpellPanel"].Bool() == false)
|
||||
return;
|
||||
|
||||
Settings showStickyQuickSpellWindow = settings.write["battle"]["enableQuickSpellPanel"];
|
||||
showStickyQuickSpellWindow->Bool() = false;
|
||||
|
||||
quickSpellWindow->disable();
|
||||
|
||||
GH.windows().totalRedraw();
|
||||
}
|
||||
|
||||
void BattleWindow::showStickyQuickSpellWindow()
|
||||
{
|
||||
if(settings["battle"]["enableQuickSpellPanel"].Bool() == true)
|
||||
return;
|
||||
|
||||
Settings showStickyQuickSpellWindow = settings.write["battle"]["enableQuickSpellPanel"];
|
||||
showStickyQuickSpellWindow->Bool() = true;
|
||||
|
||||
quickSpellWindow->enable();
|
||||
|
||||
GH.windows().totalRedraw();
|
||||
}
|
||||
|
||||
void BattleWindow::createTimerInfoWindows()
|
||||
|
@ -76,6 +76,7 @@ class BattleWindow : public InterfaceObjectConfigurable
|
||||
void createQueue();
|
||||
|
||||
void toggleStickyHeroWindowsVisibility();
|
||||
void toggleStickyQuickSpellVisibility();
|
||||
void createStickyHeroInfoWindows();
|
||||
void createQuickSpellWindow();
|
||||
void createTimerInfoWindows();
|
||||
@ -98,6 +99,10 @@ public:
|
||||
void hideStickyHeroWindows();
|
||||
void showStickyHeroWindows();
|
||||
|
||||
/// Toggle permanent quickspell windows visibility
|
||||
void hideStickyQuickSpellWindow();
|
||||
void showStickyQuickSpellWindow();
|
||||
|
||||
/// Event handler for netpack changing hero mana points
|
||||
void heroManaPointsChanged(const CGHeroInstance * hero);
|
||||
|
||||
|
@ -186,6 +186,7 @@ enum class EShortcut
|
||||
BATTLE_TOGGLE_HEROES_STATS,
|
||||
BATTLE_OPEN_ACTIVE_UNIT,
|
||||
BATTLE_OPEN_HOVERED_UNIT,
|
||||
BATTLE_TOGGLE_QUICKSPELL,
|
||||
BATTLE_SPELL_SHORTCUT_0,
|
||||
BATTLE_SPELL_SHORTCUT_1,
|
||||
BATTLE_SPELL_SHORTCUT_2,
|
||||
|
@ -222,6 +222,7 @@ EShortcut ShortcutHandler::findShortcut(const std::string & identifier ) const
|
||||
{"battleTacticsNext", EShortcut::BATTLE_TACTICS_NEXT },
|
||||
{"battleTacticsEnd", EShortcut::BATTLE_TACTICS_END },
|
||||
{"battleSelectAction", EShortcut::BATTLE_SELECT_ACTION },
|
||||
{"battleToggleQuickSpell", EShortcut::BATTLE_TOGGLE_QUICKSPELL },
|
||||
{"battleSpellShortcut0", EShortcut::BATTLE_SPELL_SHORTCUT_0 },
|
||||
{"battleSpellShortcut1", EShortcut::BATTLE_SPELL_SHORTCUT_1 },
|
||||
{"battleSpellShortcut2", EShortcut::BATTLE_SPELL_SHORTCUT_2 },
|
||||
|
@ -372,7 +372,7 @@
|
||||
"type" : "object",
|
||||
"additionalProperties" : false,
|
||||
"default" : {},
|
||||
"required" : [ "speedFactor", "mouseShadow", "cellBorders", "stackRange", "movementHighlightOnHover", "rangeLimitHighlightOnHover", "showQueue", "swipeAttackDistance", "queueSize", "stickyHeroInfoWindows", "enableAutocombatSpells", "endWithAutocombat", "queueSmallSlots", "queueSmallOutside" ],
|
||||
"required" : [ "speedFactor", "mouseShadow", "cellBorders", "stackRange", "movementHighlightOnHover", "rangeLimitHighlightOnHover", "showQueue", "swipeAttackDistance", "queueSize", "stickyHeroInfoWindows", "enableAutocombatSpells", "endWithAutocombat", "queueSmallSlots", "queueSmallOutside", "enableQuickSpellPanel" ],
|
||||
"properties" : {
|
||||
"speedFactor" : {
|
||||
"type" : "number",
|
||||
@ -430,6 +430,10 @@
|
||||
"queueSmallOutside" : {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"enableQuickSpellPanel" : {
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -64,6 +64,7 @@
|
||||
"battleOpenHoveredUnit": "V",
|
||||
"battleRetreat": "R",
|
||||
"battleSelectAction": "S",
|
||||
"battleToggleQuickSpell": "T",
|
||||
"battleSpellShortcut0": "0",
|
||||
"battleSpellShortcut1": "1",
|
||||
"battleSpellShortcut2": "2",
|
||||
|
Loading…
x
Reference in New Issue
Block a user