ソースを参照

hotkey number from config

Laserlicht 1 年間 前
コミット
5562402646

+ 5 - 1
client/battle/BattleInterfaceClasses.cpp

@@ -57,6 +57,8 @@
 #include "../../lib/mapObjects/CGTownInstance.h"
 #include "../../lib/networkPacks/PacksForClientBattle.h"
 #include "../../lib/TextOperations.h"
+#include "../../lib/json/JsonUtils.h"
+
 
 void BattleConsole::showAll(Canvas & to)
 {
@@ -437,6 +439,8 @@ void QuickSpellPanel::create()
 {
 	OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
 
+	const JsonNode config = JsonUtils::assembleFromFiles("config/shortcutsConfig");
+
 	labels.clear();
 	buttons.clear();
 	buttonsDisabled.clear();
@@ -476,7 +480,7 @@ void QuickSpellPanel::create()
 		{
 			buttonsDisabled.push_back(std::make_shared<TransparentFilledRectangle>(Rect(2, 5 + 37 * i, 48, 36), ColorRGBA(0, 0, 0, 172)));
 		}
-		labels.push_back(std::make_shared<CLabel>(7, 8 + 37 * i, EFonts::FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, std::to_string(i)));
+		labels.push_back(std::make_shared<CLabel>(7, 8 + 37 * i, EFonts::FONT_TINY, ETextAlignment::TOPLEFT, Colors::WHITE, config["keyboard"]["battleSpellShortcut" + std::to_string(i)].String()));
 
 		buttons.push_back(button);
 	}

+ 1 - 1
client/battle/BattleWindow.cpp

@@ -204,7 +204,7 @@ void BattleWindow::createQuickSpellWindow()
 	OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
 
 	quickSpellWindow = std::make_shared<QuickSpellPanel>(owner);
-	quickSpellWindow->moveTo(Point(pos.x - 67, pos.y - 1));
+	quickSpellWindow->moveTo(Point(pos.x - 67, pos.y));
 
 	if(settings["battle"]["enableQuickSpellPanel"].Bool())
 		showStickyQuickSpellWindow();

+ 16 - 16
config/shortcutsConfig.json

@@ -65,22 +65,22 @@
 		"battleRetreat":            "R",
 		"battleSelectAction":       "S",
 		"battleToggleQuickSpell":   "T",
-		"battleSpellShortcut0":     "0",
-		"battleSpellShortcut1":     "1",
-		"battleSpellShortcut2":     "2",
-		"battleSpellShortcut3":     "3",
-		"battleSpellShortcut4":     "4",
-		"battleSpellShortcut5":     "5",
-		"battleSpellShortcut6":     "6",
-		"battleSpellShortcut7":     "7",
-		"battleSpellShortcut8":     "8",
-		"battleSpellShortcut9":     "9",
-		"battleSpellShortcut10":    "Shift+0",
-		"battleSpellShortcut11":    "Shift+1",
-		"battleSpellShortcut12":    "Shift+2",
-		"battleSpellShortcut13":    "Shift+3",
-		"battleSpellShortcut14":    "Shift+4",
-		"battleSpellShortcut15":    "Shift+5",
+		"battleSpellShortcut0":     "1",
+		"battleSpellShortcut1":     "2",
+		"battleSpellShortcut2":     "3",
+		"battleSpellShortcut3":     "4",
+		"battleSpellShortcut4":     "5",
+		"battleSpellShortcut5":     "6",
+		"battleSpellShortcut6":     "7",
+		"battleSpellShortcut7":     "8",
+		"battleSpellShortcut8":     "Shift+1",
+		"battleSpellShortcut9":     "Shift+2",
+		"battleSpellShortcut10":    "Shift+3",
+		"battleSpellShortcut11":    "Shift+4",
+		"battleSpellShortcut12":    "Shift+5",
+		"battleSpellShortcut13":    "Shift+6",
+		"battleSpellShortcut14":    "Shift+7",
+		"battleSpellShortcut15":    "Shift+8",
 		"battleSurrender":          "S",
 		"battleTacticsEnd":         [ "Return", "Keypad Enter"],
 		"battleTacticsNext":        "Space",