From b8d872aa6049d3e887bd7251b6de43b9d13059c9 Mon Sep 17 00:00:00 2001 From: Laserlicht <13953785+Laserlicht@users.noreply.github.com> Date: Wed, 17 Jul 2024 04:24:27 +0200 Subject: [PATCH] mobile adjustments --- client/battle/BattleInterfaceClasses.cpp | 14 ++++++------- client/battle/BattleInterfaceClasses.h | 2 +- client/battle/BattleWindow.cpp | 25 +++++++++++------------- client/gui/Shortcut.h | 3 --- client/gui/ShortcutHandler.cpp | 3 --- config/shortcutsConfig.json | 3 --- 6 files changed, 19 insertions(+), 31 deletions(-) diff --git a/client/battle/BattleInterfaceClasses.cpp b/client/battle/BattleInterfaceClasses.cpp index 0bde51b3d..1ae1acd44 100644 --- a/client/battle/BattleInterfaceClasses.cpp +++ b/client/battle/BattleInterfaceClasses.cpp @@ -426,7 +426,7 @@ QuickSpellPanel::QuickSpellPanel(BattleInterface & owner) addUsedEvents(LCLICK | SHOW_POPUP | MOVE); - pos = Rect(0, 0, 52, 713); + pos = Rect(0, 0, 52, 600); background = std::make_shared(ImagePath::builtin("DIBOXBCK"), pos); rect = std::make_shared(Rect(0, 0, pos.w + 1, pos.h + 1), ColorRGBA(0, 0, 0, 0), ColorRGBA(241, 216, 120, 255)); @@ -445,7 +445,7 @@ void QuickSpellPanel::create() if(!hero) return; - for(int i = 0; i < 19; i++) { + for(int i = 0; i < 16; i++) { std::string spellIdentifier = persistentStorage["quickSpell"][std::to_string(i)].String(); SpellID id; @@ -458,7 +458,7 @@ void QuickSpellPanel::create() id = SpellID::NONE; } - auto button = std::make_shared(Point(2, 6 + 37 * i), AnimationPath::builtin("spellint"), CButton::tooltip(), [this, id, hero](){ + auto button = std::make_shared(Point(2, 5 + 37 * i), AnimationPath::builtin("spellint"), CButton::tooltip(), [this, id, hero](){ if(id.hasValue() && id.toSpell()->canBeCast(owner.getBattle().get(), spells::Mode::HERO, hero)) { owner.castThisSpell(id); @@ -468,15 +468,15 @@ void QuickSpellPanel::create() button->addPopupCallback([this, i](){ auto panelSelect = std::make_shared(this); panelSelect->spellSlot = i; - panelSelect->moveTo(Point(pos.x + 54, pos.y + 5)); + panelSelect->moveTo(Point(pos.x + 54, pos.y + 4)); GH.windows().pushWindow(panelSelect); }); if(!id.hasValue() || !id.toSpell()->canBeCast(owner.getBattle().get(), spells::Mode::HERO, hero)) { - buttonsDisabled.push_back(std::make_shared(Rect(2, 6 + 37 * i, 48, 36), ColorRGBA(0, 0, 0, 172))); + buttonsDisabled.push_back(std::make_shared(Rect(2, 5 + 37 * i, 48, 36), ColorRGBA(0, 0, 0, 172))); } - labels.push_back(std::make_shared(7, 9 + 37 * i, EFonts::FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, std::to_string(i))); + labels.push_back(std::make_shared(7, 8 + 37 * i, EFonts::FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, std::to_string(i))); buttons.push_back(button); } @@ -529,7 +529,7 @@ QuickSpellPanelSelect::QuickSpellPanelSelect(QuickSpellPanel * Parent) void QuickSpellPanelSelect::clickReleased(const Point & cursorPosition) { - if(!pos.isInside(cursorPosition)) + if(!pos.isInside(cursorPosition) && !parent->pos.isInside(cursorPosition)) close(); } diff --git a/client/battle/BattleInterfaceClasses.h b/client/battle/BattleInterfaceClasses.h index 149b24390..5fe9049eb 100644 --- a/client/battle/BattleInterfaceClasses.h +++ b/client/battle/BattleInterfaceClasses.h @@ -152,7 +152,7 @@ public: class QuickSpellPanelSelect : public CWindowObject { private: - const int NUM_PER_COLUMN = 19; + const int NUM_PER_COLUMN = 16; std::shared_ptr background; std::shared_ptr rect; diff --git a/client/battle/BattleWindow.cpp b/client/battle/BattleWindow.cpp index e9fe93486..f641a516a 100644 --- a/client/battle/BattleWindow.cpp +++ b/client/battle/BattleWindow.cpp @@ -81,25 +81,22 @@ BattleWindow::BattleWindow(BattleInterface & Owner): } }; 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); }); - addShortcut(EShortcut::BATTLE_SPELL_SHORTCUT_3, [useSpellIfPossible](){ useSpellIfPossible(3); }); - addShortcut(EShortcut::BATTLE_SPELL_SHORTCUT_4, [useSpellIfPossible](){ useSpellIfPossible(4); }); - addShortcut(EShortcut::BATTLE_SPELL_SHORTCUT_5, [useSpellIfPossible](){ useSpellIfPossible(5); }); - addShortcut(EShortcut::BATTLE_SPELL_SHORTCUT_6, [useSpellIfPossible](){ useSpellIfPossible(6); }); - addShortcut(EShortcut::BATTLE_SPELL_SHORTCUT_7, [useSpellIfPossible](){ useSpellIfPossible(7); }); - addShortcut(EShortcut::BATTLE_SPELL_SHORTCUT_8, [useSpellIfPossible](){ useSpellIfPossible(8); }); - addShortcut(EShortcut::BATTLE_SPELL_SHORTCUT_9, [useSpellIfPossible](){ useSpellIfPossible(9); }); + 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); }); + addShortcut(EShortcut::BATTLE_SPELL_SHORTCUT_3, [useSpellIfPossible](){ useSpellIfPossible(3); }); + addShortcut(EShortcut::BATTLE_SPELL_SHORTCUT_4, [useSpellIfPossible](){ useSpellIfPossible(4); }); + addShortcut(EShortcut::BATTLE_SPELL_SHORTCUT_5, [useSpellIfPossible](){ useSpellIfPossible(5); }); + addShortcut(EShortcut::BATTLE_SPELL_SHORTCUT_6, [useSpellIfPossible](){ useSpellIfPossible(6); }); + addShortcut(EShortcut::BATTLE_SPELL_SHORTCUT_7, [useSpellIfPossible](){ useSpellIfPossible(7); }); + addShortcut(EShortcut::BATTLE_SPELL_SHORTCUT_8, [useSpellIfPossible](){ useSpellIfPossible(8); }); + addShortcut(EShortcut::BATTLE_SPELL_SHORTCUT_9, [useSpellIfPossible](){ useSpellIfPossible(9); }); addShortcut(EShortcut::BATTLE_SPELL_SHORTCUT_10, [useSpellIfPossible](){ useSpellIfPossible(10); }); addShortcut(EShortcut::BATTLE_SPELL_SHORTCUT_11, [useSpellIfPossible](){ useSpellIfPossible(11); }); addShortcut(EShortcut::BATTLE_SPELL_SHORTCUT_12, [useSpellIfPossible](){ useSpellIfPossible(12); }); addShortcut(EShortcut::BATTLE_SPELL_SHORTCUT_13, [useSpellIfPossible](){ useSpellIfPossible(13); }); addShortcut(EShortcut::BATTLE_SPELL_SHORTCUT_14, [useSpellIfPossible](){ useSpellIfPossible(14); }); addShortcut(EShortcut::BATTLE_SPELL_SHORTCUT_15, [useSpellIfPossible](){ useSpellIfPossible(15); }); - addShortcut(EShortcut::BATTLE_SPELL_SHORTCUT_16, [useSpellIfPossible](){ useSpellIfPossible(16); }); - addShortcut(EShortcut::BATTLE_SPELL_SHORTCUT_17, [useSpellIfPossible](){ useSpellIfPossible(17); }); - addShortcut(EShortcut::BATTLE_SPELL_SHORTCUT_18, [useSpellIfPossible](){ useSpellIfPossible(18); }); addShortcut(EShortcut::GLOBAL_OPTIONS, std::bind(&BattleWindow::bOptionsf, this)); addShortcut(EShortcut::BATTLE_SURRENDER, std::bind(&BattleWindow::bSurrenderf, this)); @@ -207,7 +204,7 @@ void BattleWindow::createQuickSpellWindow() OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE; quickSpellWindow = std::make_shared(owner); - quickSpellWindow->moveTo(Point(pos.x - 68, pos.y - 14)); + quickSpellWindow->moveTo(Point(pos.x - 67, pos.y - 1)); if(settings["battle"]["enableQuickSpellPanel"].Bool()) showStickyQuickSpellWindow(); diff --git a/client/gui/Shortcut.h b/client/gui/Shortcut.h index 5193cd91e..57027fa44 100644 --- a/client/gui/Shortcut.h +++ b/client/gui/Shortcut.h @@ -203,9 +203,6 @@ enum class EShortcut BATTLE_SPELL_SHORTCUT_13, BATTLE_SPELL_SHORTCUT_14, BATTLE_SPELL_SHORTCUT_15, - BATTLE_SPELL_SHORTCUT_16, - BATTLE_SPELL_SHORTCUT_17, - BATTLE_SPELL_SHORTCUT_18, MARKET_DEAL, MARKET_MAX_AMOUNT, diff --git a/client/gui/ShortcutHandler.cpp b/client/gui/ShortcutHandler.cpp index aaf480a6a..9e6ce0e96 100644 --- a/client/gui/ShortcutHandler.cpp +++ b/client/gui/ShortcutHandler.cpp @@ -239,9 +239,6 @@ EShortcut ShortcutHandler::findShortcut(const std::string & identifier ) const {"battleSpellShortcut13", EShortcut::BATTLE_SPELL_SHORTCUT_13 }, {"battleSpellShortcut14", EShortcut::BATTLE_SPELL_SHORTCUT_14 }, {"battleSpellShortcut15", EShortcut::BATTLE_SPELL_SHORTCUT_15 }, - {"battleSpellShortcut16", EShortcut::BATTLE_SPELL_SHORTCUT_16 }, - {"battleSpellShortcut17", EShortcut::BATTLE_SPELL_SHORTCUT_17 }, - {"battleSpellShortcut18", EShortcut::BATTLE_SPELL_SHORTCUT_18 }, {"spectateTrackHero", EShortcut::SPECTATE_TRACK_HERO }, {"spectateSkipBattle", EShortcut::SPECTATE_SKIP_BATTLE }, {"spectateSkipBattleResult", EShortcut::SPECTATE_SKIP_BATTLE_RESULT }, diff --git a/config/shortcutsConfig.json b/config/shortcutsConfig.json index 744b110ac..f637e6b52 100644 --- a/config/shortcutsConfig.json +++ b/config/shortcutsConfig.json @@ -81,9 +81,6 @@ "battleSpellShortcut13": "Shift+3", "battleSpellShortcut14": "Shift+4", "battleSpellShortcut15": "Shift+5", - "battleSpellShortcut16": "Shift+6", - "battleSpellShortcut17": "Shift+7", - "battleSpellShortcut18": "Shift+8", "battleSurrender": "S", "battleTacticsEnd": [ "Return", "Keypad Enter"], "battleTacticsNext": "Space",