Page MenuHomeWildfire Games

Immediately update gui visibility when pressing the hotkey to toggle it
ClosedPublic

Authored by elexis on Apr 22 2018, 4:58 PM.

Details

Summary

If the game is paused, finished or if a 500ms turnlength mp match was started, the hotkey to toggle the GUI visibility (mostly used for promotional screenshots)
is not updated (or only updated after a very noticeable delay in the latter case).

Test Plan

Press the hotkey while the game is paused and optionally find a better function structure.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

elexis created this revision.Apr 22 2018, 4:58 PM
Vulcan added a subscriber: Vulcan.Apr 22 2018, 5:55 PM

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Default...
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 6 tabs but found 5.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
| 407| 407| 				// Players see colors depending on diplomacy
| 408| 408| 				g_DisplayedPlayerColors[i] =
| 409| 409| 					g_ViewedPlayer == i ? getDiplomacyColor("self") :
| 410|    |-					g_Players[g_ViewedPlayer].isAlly[i] ? getDiplomacyColor("ally") :
|    | 410|+						g_Players[g_ViewedPlayer].isAlly[i] ? getDiplomacyColor("ally") :
| 411| 411| 					g_Players[g_ViewedPlayer].isNeutral[i] ? getDiplomacyColor("neutral") :
| 412| 412| 					getDiplomacyColor("enemy");
| 413| 413| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 7 tabs but found 5.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
| 408| 408| 				g_DisplayedPlayerColors[i] =
| 409| 409| 					g_ViewedPlayer == i ? getDiplomacyColor("self") :
| 410| 410| 					g_Players[g_ViewedPlayer].isAlly[i] ? getDiplomacyColor("ally") :
| 411|    |-					g_Players[g_ViewedPlayer].isNeutral[i] ? getDiplomacyColor("neutral") :
|    | 411|+							g_Players[g_ViewedPlayer].isNeutral[i] ? getDiplomacyColor("neutral") :
| 412| 412| 					getDiplomacyColor("enemy");
| 413| 413| 
| 414| 414| 		g_DisplayedPlayerColors[0] = g_Players[0].color;
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 8 tabs but found 5.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
| 409| 409| 					g_ViewedPlayer == i ? getDiplomacyColor("self") :
| 410| 410| 					g_Players[g_ViewedPlayer].isAlly[i] ? getDiplomacyColor("ally") :
| 411| 411| 					g_Players[g_ViewedPlayer].isNeutral[i] ? getDiplomacyColor("neutral") :
| 412|    |-					getDiplomacyColor("enemy");
|    | 412|+								getDiplomacyColor("enemy");
| 413| 413| 
| 414| 414| 		g_DisplayedPlayerColors[0] = g_Players[0].color;
| 415| 415| 	}
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 4 tabs but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
| 665| 665| 					"civ": setStringTags(g_CivData[g_Players[g_ViewedPlayer].civ].Name, { "font": "sans-bold-stroke-14" }),
| 666| 666| 					"hotkey_civinfo": colorizeHotkey("%(hotkey)s", "civinfo"),
| 667| 667| 					"hotkey_structree": colorizeHotkey("%(hotkey)s", "structree")
| 668|    |-			});
|    | 668|+				});
| 669| 669| 	}
| 670| 670| 
| 671| 671| 	// Following gaia can be interesting on scripted maps
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|1261|1261| 
|1262|1262| 	let orderHotkeyTooltip = Object.keys(viewablePlayerStates).length <= 1 ? "" :
|1263|1263| 		"\n" + sprintf(translate("%(order)s: %(hotkey)s to change order."), {
|1264|    |-		"hotkey": setStringTags("\\[Click]", g_HotkeyTags),
|    |1264|+			"hotkey": setStringTags("\\[Click]", g_HotkeyTags),
|1265|1265| 		"order": tooltipSort == 0 ? translate("Unordered") : tooltipSort == 1 ? translate("Descending") : translate("Ascending")
|1266|1266| 	});
|1267|1267| 
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 3 tabs but found 2.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|1262|1262| 	let orderHotkeyTooltip = Object.keys(viewablePlayerStates).length <= 1 ? "" :
|1263|1263| 		"\n" + sprintf(translate("%(order)s: %(hotkey)s to change order."), {
|1264|1264| 		"hotkey": setStringTags("\\[Click]", g_HotkeyTags),
|1265|    |-		"order": tooltipSort == 0 ? translate("Unordered") : tooltipSort == 1 ? translate("Descending") : translate("Ascending")
|    |1265|+			"order": tooltipSort == 0 ? translate("Unordered") : tooltipSort == 1 ? translate("Descending") : translate("Ascending")
|1266|1266| 	});
|1267|1267| 
|1268|1268| 	let resCodes = g_ResourceData.GetCodes();
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 2 tabs but found 1.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|1263|1263| 		"\n" + sprintf(translate("%(order)s: %(hotkey)s to change order."), {
|1264|1264| 		"hotkey": setStringTags("\\[Click]", g_HotkeyTags),
|1265|1265| 		"order": tooltipSort == 0 ? translate("Unordered") : tooltipSort == 1 ? translate("Descending") : translate("Ascending")
|1266|    |-	});
|    |1266|+		});
|1267|1267| 
|1268|1268| 	let resCodes = g_ResourceData.GetCodes();
|1269|1269| 	for (let r = 0; r < resCodes.length; ++r)
|    | [NORMAL] ESLintBear (indent):
|    | Expected indentation of 1 tab but found 3.
|----|    | /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|    |++++| /mnt/data/jenkins-phabricator/workspace/differential/binaries/data/mods/public/gui/session/session.js
|1761|1761| 	for (let rct of resourcesCounterTypes)
|1762|1762| 		for (let rt of resourcesTypes)
|1763|1763| 			reportObject[rt + rct.substr(9)] = playerStatistics[rct][rt];
|1764|    |-			// eg. rt = food rct.substr = Gathered rct = resourcesGathered
|    |1764|+	// eg. rt = food rct.substr = Gathered rct = resourcesGathered
|1765|1765| 
|1766|1766| 	reportObject.vegetarianFoodGathered = playerStatistics.resourcesGathered.vegetarianFood;
|1767|1767| 	for (let type of unitsClasses)

binaries/data/mods/public/gui/session/session.js
|1089| »   let·getPanelEntNameTooltip·=·panelEntState·=>·"[font=\"sans-bold-16\"]"·+·template.name.specific·+·"[/font]";
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'panelEntState' is already declared in the upper scope.

binaries/data/mods/public/gui/session/session.js
|1164| »   »   button.onpress·=·(function(i)·{·return·function()·{·performGroup((Engine.HotkeyIsPressed("selection.add")·?·"add"·:·"select"),·i);·};·})(i);
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'i' is already declared in the upper scope.

binaries/data/mods/public/gui/session/session.js
|1165| »   »   button.ondoublepress·=·(function(i)·{·return·function()·{·performGroup("snap",·i);·};·})(i);
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'i' is already declared in the upper scope.

binaries/data/mods/public/gui/session/session.js
|1166| »   »   button.onpressright·=·(function(i)·{·return·function()·{·performGroup("breakUp",·i);·};·})(i);
|    | [NORMAL] ESLintBear (no-shadow):
|    | 'i' is already declared in the upper scope.

Link to build: https://jenkins.wildfiregames.com/job/differential/426/display/redirect

bb accepted this revision.Apr 22 2018, 7:07 PM
bb added a subscriber: bb.

Don't see an answer to the bonus question

binaries/data/mods/public/gui/session/session.xml
8 ↗(On Diff #6452)

ack

This revision is now accepted and ready to land.Apr 22 2018, 7:07 PM
This revision was automatically updated to reflect the committed changes.
Owners added a subscriber: Restricted Owners Package.Apr 23 2018, 11:33 AM