浏览代码

Further progress - UI tweaks, new settings etc

Dydzio 2 年之前
父节点
当前提交
fb06aca0bb

二进制
Mods/vcmi/Sprites/buttons/quadwide-normal.png


二进制
Mods/vcmi/Sprites/buttons/quadwide-pressed.png


+ 8 - 0
Mods/vcmi/Sprites/buttons/quadwide.json

@@ -0,0 +1,8 @@
+{
+	"basepath" : "buttons/",
+	"images" :
+	[
+		{ "frame" : 0, "file" : "quadwide-normal.png"},
+		{ "frame" : 1, "file" : "quadwide-pressed.png"}
+	]
+}

二进制
Mods/vcmi/Sprites/buttons/square-normal.png


二进制
Mods/vcmi/Sprites/buttons/square-pressed.png


+ 8 - 0
Mods/vcmi/Sprites/buttons/square.json

@@ -0,0 +1,8 @@
+{
+	"basepath" : "buttons/",
+	"images" :
+	[
+		{ "frame" : 0, "file" : "square-normal.png"},
+		{ "frame" : 1, "file" : "square-pressed.png"}
+	]
+}

+ 8 - 0
Mods/vcmi/Sprites/buttons/squareButton.json

@@ -0,0 +1,8 @@
+{
+	"basepath" : "buttons/",
+	"images" :
+	[
+		{ "frame" : 0, "file" : "square-normal.png"},
+		{ "frame" : 1, "file" : "square-pressed.png"}
+	]
+}

二进制
Mods/vcmi/Sprites/buttons/triplewide-normal.png


二进制
Mods/vcmi/Sprites/buttons/triplewide-pressed.png


+ 8 - 0
Mods/vcmi/Sprites/buttons/triplewide.json

@@ -0,0 +1,8 @@
+{
+	"basepath" : "buttons/",
+	"images" :
+	[
+		{ "frame" : 0, "file" : "triplewide-normal.png"},
+		{ "frame" : 1, "file" : "triplewide-pressed.png"}
+	]
+}

+ 0 - 8
Mods/vcmi/Sprites/buttons/vcmisettings.json

@@ -1,8 +0,0 @@
-{
-	"basepath" : "buttons/",
-	"images" :
-	[
-		{ "frame" : 0, "file" : "vcmisettingsNormal.png"},
-		{ "frame" : 1, "file" : "vcmisettingsPressed.png"}
-	]
-}

二进制
Mods/vcmi/Sprites/buttons/vcmisettingsNormal.png


二进制
Mods/vcmi/Sprites/buttons/vcmisettingsPressed.png


+ 0 - 8
Mods/vcmi/Sprites/buttons/vcmisettingsback.json

@@ -1,8 +0,0 @@
-{
-	"basepath" : "buttons/",
-	"images" :
-	[
-		{ "frame" : 0, "file" : "vcmisettingsbackNormal.png"},
-		{ "frame" : 1, "file" : "vcmisettingsbackPressed.png"}
-	]
-}

二进制
Mods/vcmi/Sprites/buttons/vcmisettingsbackNormal.png


二进制
Mods/vcmi/Sprites/buttons/vcmisettingsbackPressed.png


+ 2 - 0
Mods/vcmi/config/vcmi/english.json

@@ -49,6 +49,8 @@
 	"vcmi.adventureOptions.numericQuantities.help" : "{Numeric creatures quantities}\n\n Shows inaccurate enemy creatures quantities in numeric A-B format",
 	"vcmi.adventureOptions.forceMovementInfo.hover" : "Always show move info in status bar",
 	"vcmi.adventureOptions.forceMovementInfo.help" : "{Always show move info in status bar}\n\n Replaces default status bar info with movement points data without need to hold ALT button",
+	"vcmi.adventureOptions.showGrid.hover" : "Show grid",
+	"vcmi.adventureOptions.showGrid.help" : "{Show grid}\n\n Shows grid overlay, showing borders between adventure map tiles",
 
 	"vcmi.battleOptions.showQueue.hover": "Show queue",
 	"vcmi.battleOptions.showQueue.help": "{Show queue}\n\n Show queue that displays movement order of creature stacks",

+ 1 - 1
client/adventureMap/mapHandler.cpp

@@ -919,7 +919,7 @@ void CMapHandler::CMapBlitter::blit(SDL_Surface * targetSurf, const MapDrawingIn
 	drawOverlayEx(targetSurf);
 
 	// drawDebugGrid()
-	if (settings["session"]["showGrid"].Bool())
+	if (settings["gameTweaks"]["showGrid"].Bool())
 	{
 		for (realPos.x = initPos.x, pos.x = topTile.x; pos.x < topTile.x + tileCount.x; pos.x++, realPos.x += tileSize)
 		{

+ 4 - 0
client/windows/settings/AdventureOptionsTab.cpp

@@ -43,6 +43,7 @@ AdventureOptionsTab::AdventureOptionsTab()
 	//settings that do not belong to base game:
 	addCallback("numericQuantitiesChanged", std::bind(&setBoolSetting, "gameTweaks", "numericCreaturesQuantities", _1));
 	addCallback("forceMovementInfoChanged", std::bind(&setBoolSetting, "gameTweaks", "forceMovementInfo", _1));
+	addCallback("showGridChanged", std::bind(&setBoolSetting, "gameTweaks", "showGrid", _1));
 	build(config);
 
 	std::shared_ptr<CToggleGroup> playerHeroSpeedToggle = widget<CToggleGroup>("heroMovementSpeedPicker");
@@ -65,4 +66,7 @@ AdventureOptionsTab::AdventureOptionsTab()
 
 	std::shared_ptr<CToggleButton> forceMovementInfoCheckbox = widget<CToggleButton>("forceMovementInfoCheckbox");
 	forceMovementInfoCheckbox->setSelected((bool)settings["gameTweaks"]["forceMovementInfo"].Bool());
+
+	std::shared_ptr<CToggleButton> showGridCheckbox = widget<CToggleButton>("showGridCheckbox");
+	showGridCheckbox->setSelected((bool)settings["gameTweaks"]["showGrid"].Bool());
 }

+ 48 - 0
client/windows/settings/BattleOptionsTab.cpp

@@ -28,11 +28,15 @@ BattleOptionsTab::BattleOptionsTab(BattleInterface * owner):
 	addCallback("movementShadowChanged", std::bind(&BattleOptionsTab::movementShadowChangedCallback, this, _1, owner));
 	addCallback("mouseShadowChanged", std::bind(&BattleOptionsTab::mouseShadowChangedCallback, this, _1));
 	addCallback("animationSpeedChanged", std::bind(&BattleOptionsTab::animationSpeedChangedCallback, this, _1));
+	addCallback("showQueueChanged", std::bind(&BattleOptionsTab::showQueueChangedCallback, this, _1));
+	addCallback("queueSizeChanged", std::bind(&BattleOptionsTab::queueSizeChangedCallback, this, _1));
 	build(config);
 
 	std::shared_ptr<CToggleGroup> animationSpeedToggle = widget<CToggleGroup>("animationSpeedPicker");
 	animationSpeedToggle->setSelected(getAnimSpeed());
 
+	std::shared_ptr<CToggleGroup> queueSizeToggle = widget<CToggleGroup>("queueSizePicker");
+	queueSizeToggle->setSelected(getQueueSizeId());
 
 	std::shared_ptr<CToggleButton> viewGridCheckbox = widget<CToggleButton>("viewGridCheckbox");
 	viewGridCheckbox->setSelected((bool)settings["battle"]["cellBorders"].Bool());
@@ -42,6 +46,9 @@ BattleOptionsTab::BattleOptionsTab(BattleInterface * owner):
 
 	std::shared_ptr<CToggleButton> mouseShadowCheckbox = widget<CToggleButton>("mouseShadowCheckbox");
 	mouseShadowCheckbox->setSelected((bool)settings["battle"]["mouseShadow"].Bool());
+
+	std::shared_ptr<CToggleButton> showQueueCheckbox = widget<CToggleButton>("showQueueCheckbox");
+	showQueueCheckbox->setSelected((bool)settings["battle"]["showQueue"].Bool());
 }
 
 int BattleOptionsTab::getAnimSpeed() const
@@ -52,6 +59,34 @@ int BattleOptionsTab::getAnimSpeed() const
 	return static_cast<int>(std::round(settings["battle"]["speedFactor"].Float()));
 }
 
+int BattleOptionsTab::getQueueSizeId() const
+{
+	std::string text = settings["battle"]["queueSize"].String();
+	if(text == "auto")
+		return 0;
+	else if(text == "small")
+		return 1;
+	else if(text == "big")
+		return 2;
+
+	return 0;
+}
+
+std::string BattleOptionsTab::getQueueSizeStringFromId(int value) const
+{
+	switch(value)
+	{
+		case 0:
+			return "auto";
+		case 1:
+			return "small";
+		case 2:
+			return "big";
+		default:
+			return "auto";
+	}
+}
+
 void BattleOptionsTab::viewGridChangedCallback(bool value, BattleInterface * parentBattleInterface)
 {
 	Settings cellBorders = settings.write["battle"]["cellBorders"];
@@ -80,3 +115,16 @@ void BattleOptionsTab::animationSpeedChangedCallback(int value)
 	speed->Float() = float(value);
 }
 
+void BattleOptionsTab::showQueueChangedCallback(bool value)
+{
+	Settings shadow = settings.write["battle"]["showQueue"];
+	shadow->Bool() = value;
+}
+
+void BattleOptionsTab::queueSizeChangedCallback(int value)
+{
+	std::string stringifiedValue = getQueueSizeStringFromId(value);
+	Settings size = settings.write["battle"]["queueSize"];
+	size->String() = stringifiedValue;
+}
+

+ 4 - 0
client/windows/settings/BattleOptionsTab.h

@@ -19,10 +19,14 @@ private:
 	std::vector<std::shared_ptr<CToggleButton>> toggles;
 
 	int getAnimSpeed() const;
+	int getQueueSizeId() const;
+	std::string getQueueSizeStringFromId(int value) const;
 	void viewGridChangedCallback(bool value, BattleInterface * parentBattleInterface = nullptr);
 	void movementShadowChangedCallback(bool value, BattleInterface * parentBattleInterface = nullptr);
 	void mouseShadowChangedCallback(bool value);
 	void animationSpeedChangedCallback(int value);
+	void showQueueChangedCallback(bool value);
+	void queueSizeChangedCallback(int value);
 public:
 	BattleOptionsTab(BattleInterface * owner = nullptr);
 };

+ 40 - 6
config/widgets/settings/adventureOptionsTab.json

@@ -147,16 +147,38 @@
 				{
 					"index": 6,
 					"type": "toggleButton",
-					"image": "sysob11",
-					"help": "core.help.359",
-					"position": {"x": 192, "y": 0}
+					"image": "buttons/square",
+					"help": "TODO",
+					"position": {"x": 192, "y": 0},
+					"items":
+					[
+						{
+							"name": "mapScrollSpeed4",
+							"type": "label",
+							"font": "big",
+							"alignment": "center",
+							"color": "yellow",
+							"text": "4"
+						}
+					]
 				},
 				{
 					"index": 8,
 					"type": "toggleButton",
-					"image": "sysob11",
-					"help": "core.help.359",
-					"position": {"x": 256, "y": 0}
+					"image": "buttons/square",
+					"help": "TODO",
+					"position": {"x": 224, "y": 0},
+					"items":
+					[
+						{
+							"name": "mapScrollSpeed5",
+							"type": "label",
+							"font": "big",
+							"alignment": "center",
+							"color": "yellow",
+							"text": "5"
+						}
+					]
 				}
 			],
 			"callback": "mapScrollSpeedChanged"
@@ -189,6 +211,10 @@
 				{
 					"position": {"x": 64, "y": 402},
 					"text": "vcmi.adventureOptions.forceMovementInfo.hover"
+				},
+				{
+					"position": {"x": 64, "y": 438},
+					"text": "vcmi.adventureOptions.showGrid.hover"
 				}
 			]
 		},
@@ -227,6 +253,14 @@
 			"help": "vcmi.adventureOptions.forceMovementInfo",
 			"position": {"x": 28, "y": 400},
 			"callback": "forceMovementInfoChanged"
+		},
+		{
+			"name": "showGridCheckbox",
+			"type": "toggleButton",
+			"image": "sysopchk.def",
+			"help": "vcmi.adventureOptions.showGrid",
+			"position": {"x": 28, "y": 436},
+			"callback": "showGridChanged"
 		}
 	]
 }

+ 139 - 6
config/widgets/settings/battleOptionsTab.json

@@ -188,19 +188,152 @@
 				{
 					"index": 6,
 					"type": "toggleButton",
-					"image": "sysob11",
-					"help": "core.help.424",
-					"position": {"x": 192, "y": 0}
+					"image": "buttons/square",
+					"help": "TODO",
+					"position": {"x": 192, "y": 0},
+					"items":
+					[
+						{
+							"name": "battleAnimationsSpeed4",
+							"type": "label",
+							"font": "big",
+							"alignment": "center",
+							"color": "yellow",
+							"text": "4"
+						}
+					]
 				},
 				{
 					"index": 12,
 					"type": "toggleButton",
-					"image": "sysob11",
-					"help": "core.help.424",
-					"position": {"x": 256, "y": 0}
+					"image": "buttons/square",
+					"help": "TODO",
+					"position": {"x": 229, "y": 0},
+					"items":
+					[
+						{
+							"name": "battleAnimationsSpeed5",
+							"type": "label",
+							"font": "big",
+							"alignment": "center",
+							"color": "yellow",
+							"text": "5"
+						}
+					]
+				},
+				{
+					"index": 24,
+					"type": "toggleButton",
+					"image": "buttons/square",
+					"help": "TODO",
+					"position": {"x": 266, "y": 0},
+					"items":
+					[
+						{
+							"name": "battleAnimationsSpeed6",
+							"type": "label",
+							"font": "big",
+							"alignment": "center",
+							"color": "yellow",
+							"text": "6"
+						}
+					]
 				}
 			],
 			"callback": "animationSpeedChanged"
+		},
+
+		{
+			"name": "showQueueLabel",
+			"type": "label",
+			"font": "medium",
+			"alignment": "left",
+			"color": "white",
+			"text": "vcmi.battleOptions.showQueue.hover",
+			"position": {"x": 61, "y": 363}
+		},
+
+		{
+			"name": "showQueueCheckbox",
+			"type": "toggleButton",
+			"image": "sysopchk.def",
+			"help": "vcmi.battleOptions.showQueue",
+			"position": {"x": 25, "y": 361},
+			"callback": "showQueueChanged"
+		},
+
+		{
+			"name": "queueSizeLabel",
+			"type": "label",
+			"font": "medium",
+			"alignment": "left",
+			"color": "white",
+			"text": "vcmi.battleOptions.queueSizeLabel.hover",
+			"position": {"x": 60, "y": 399}
+		},
+
+		{
+			"name": "queueSizePicker",
+			"type": "toggleGroup",
+			"position": {"x": 28, "y": 420},
+			"items":
+			[
+				{
+					"index": 0, //auto
+					"type": "toggleButton",
+					"image": "buttons/triplewide",
+					"help": "TODO",
+					"position": {"x": 0, "y": 0},
+					"items":
+					[
+						{
+							"name": "queueSizeAutoText",
+							"type": "label",
+							"font": "big",
+							"alignment": "center",
+							"color": "yellow",
+							"text": "AUTO"
+						}
+					]
+				},
+				{
+					"index": 1, //small
+					"type": "toggleButton",
+					"image": "buttons/triplewide",
+					"help": "TODO",
+					"position": {"x": 113, "y": 0},
+					"items":
+					[
+						{
+							"name": "queueSizeSmallText",
+							"type": "label",
+							"font": "big",
+							"alignment": "center",
+							"color": "yellow",
+							"text": "SMALL"
+						}
+					]
+				},
+				{
+					"index": 2, //large
+					"type": "toggleButton",
+					"image": "buttons/triplewide",
+					"help": "TODO",
+					"position": {"x": 226, "y": 0},
+					"items":
+					[
+						{
+							"name": "queueSizeBigText",
+							"type": "label",
+							"font": "big",
+							"alignment": "center",
+							"color": "yellow",
+							"text": "BIG"
+						}
+					]
+				}
+			],
+			"callback": "queueSizeChanged"
 		}
 	]
 }

+ 7 - 7
config/widgets/settings/settingsMainContainer.json

@@ -12,7 +12,7 @@
 			"name": "activateGeneralOptionsButton",
 			"type": "button",
 			"position": {"x": 0, "y": 0},
-			"image": "buttons/vcmisettings",
+			"image": "buttons/quadwide",
 			"help": "vcmi.settingsMainWindow.systemTab",
 			"callback": "activateGeneralTab",
 			"items":
@@ -31,8 +31,8 @@
 		{
 			"name": "activateAdventureOptionsButton",
 			"type": "button",
-			"position": {"x": 200, "y": 0},
-			"image": "buttons/vcmisettings",
+			"position": {"x": 150, "y": 0},
+			"image": "buttons/quadwide",
 			"help": "vcmi.settingsMainWindow.adventureTab",
 			"callback": "activateAdventureTab",
 			"items":
@@ -51,8 +51,8 @@
 		{
 			"name": "activateBattleOptionsButton",
 			"type": "button",
-			"position": {"x": 400, "y": 0},
-			"image": "buttons/vcmisettings",
+			"position": {"x": 300, "y": 0},
+			"image": "buttons/quadwide",
 			"help": "vcmi.settingsMainWindow.battleTab",
 			"callback": "activateBattleTab",
 			"items":
@@ -71,8 +71,8 @@
 		{
 			"name": "activateVcmiSettingsButton",
 			"type": "button",
-			"position": {"x": 600, "y": 0},
-			"image": "buttons/vcmisettings",
+			"position": {"x": 450, "y": 0},
+			"image": "buttons/quadwide",
 			"help": "vcmi.settingsMainWindow.otherTab",
 			"callback": "activateVcmiSettingsTab",
 			"items":