Remove workaround from 4055c564e9 / D1184 and display hotkey strings too if the hotkey is unassigned.

Differential Revision: https://code.wildfiregames.com/D1200
Reviewed By: mimo
This was SVN commit r20777.
This commit is contained in:
elexis
2018-01-06 16:20:59 +00:00
parent f352d20e17
commit 0350bee2e6
2 changed files with 3 additions and 17 deletions
@@ -146,7 +146,9 @@ function colorizeHotkey(text, hotkey)
let key = Engine.ConfigDB_GetValue("user", "hotkey." + hotkey);
if (!key || key.toLowerCase() == "unused")
return "";
key = sprintf(translate("Unassigned hotkey: %(hotkeyName)s"), {
"hotkeyName": hotkey
});
return sprintf(text, {
"hotkey": coloredText("\\[" + key + "]", g_HotkeyColor)
@@ -568,22 +568,6 @@ function updateTutorial(notification)
return;
}
// TODO temporary should be removed once D1180 is done
for (let i = 0; i < notification.instructions.length; ++i)
{
let item = notification.instructions[i];
if (typeof item == "string")
continue;
if (item.hotkey.length == 1)
{
let key = Engine.ConfigDB_GetValue("user", "hotkey." + item.hotkey[0]);
if (!key || key.toLowerCase() == "unused")
notification.instructions[i]= item.text.replace("%(hotkey)s", "{hotkey " + item.hotkey[0] + " undefined}");
}
else
error("Several hotkeys per instruction item is not yet supported, needs D1180.");
}
// end of temporary
let notificationText =
notification.instructions.reduce((instructions, item) =>
instructions + (typeof item == "string" ? translate(item) : colorizeHotkey(translate(item.text), item.hotkey)),