mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-18 22:33:56 -07:00
add a hotkey to toggle tutorial panel + add hotkey parameters to tutorial messages
Discussed with elexis Differential Revision: https://code.wildfiregames.com/D1184 This was SVN commit r20725.
This commit is contained in:
parent
d0fc111e54
commit
4055c564e9
6 changed files with 57 additions and 7 deletions
|
|
@ -311,6 +311,7 @@ rotate.ccw = LeftBracket ; Rotate building placement preview anticlockwise
|
|||
toggle = "Alt+G" ; Toggle visibility of session GUI
|
||||
menu.toggle = "F10" ; Toggle in-game menu
|
||||
barter.toggle = "Ctrl+B" ; Toggle in-game barter/trade page
|
||||
tutorial.toggle = "Ctrl+P" ; Toggle in-game tutorial panel
|
||||
|
||||
[hotkey.session.savedgames]
|
||||
delete = Delete ; Delete the selected saved game asking confirmation
|
||||
|
|
|
|||
|
|
@ -90,6 +90,8 @@ PageUp with units selected: Highlights the units/buildings guarded by the select
|
|||
PageDown with units/buildings selected: Highlights the units guarding the selection.
|
||||
Tab: See all status bars (which would also show the building progress)
|
||||
Ctrl + Tab: Toggle summary window.
|
||||
Ctrl + B: Toggle in-game barter/trade page.
|
||||
Ctrl + P: Toggle in-game tutorial panel.
|
||||
|
||||
[font="sans-bold-14"]Modify mouse action
|
||||
[font="sans-14"]Ctrl + Right Click on building: Garrison
|
||||
|
|
|
|||
|
|
@ -28,6 +28,10 @@
|
|||
<action on="Press">toggleTrade();</action>
|
||||
</object>
|
||||
|
||||
<object hotkey="session.gui.tutorial.toggle">
|
||||
<action on="Press">toggleTutorial();</action>
|
||||
</object>
|
||||
|
||||
<object hotkey="summary">
|
||||
<action on="Press">openGameSummary();</action>
|
||||
</object>
|
||||
|
|
|
|||
|
|
@ -997,6 +997,13 @@ function toggleTrade()
|
|||
openTrade();
|
||||
}
|
||||
|
||||
function toggleTutorial()
|
||||
{
|
||||
let tutorialPanel = Engine.GetGUIObjectByName("tutorialPanel");
|
||||
tutorialPanel.hidden = !tutorialPanel.hidden ||
|
||||
!Engine.GetGUIObjectByName("tutorialText").caption;
|
||||
}
|
||||
|
||||
function updateGameSpeedControl()
|
||||
{
|
||||
let player = g_Players[Engine.GetPlayerID()];
|
||||
|
|
|
|||
|
|
@ -33,6 +33,16 @@ var g_ChatTimers = [];
|
|||
*/
|
||||
var g_LastChatAddressee = "";
|
||||
|
||||
/**
|
||||
* All tutorial messages received so far.
|
||||
*/
|
||||
var g_TutorialMessages = [];
|
||||
|
||||
/**
|
||||
* GUI tags applied to the most recent tutorial message.
|
||||
*/
|
||||
var g_TutorialNewMessageTags = { "color": "yellow" };
|
||||
|
||||
/**
|
||||
* Handle all netmessage types that can occur.
|
||||
*/
|
||||
|
|
@ -548,11 +558,29 @@ function updateTutorial(notification)
|
|||
return;
|
||||
}
|
||||
|
||||
let tutorialText = Engine.GetGUIObjectByName("tutorialText");
|
||||
tutorialText.caption =
|
||||
tutorialText.caption.replace('[color="yellow"]', '').replace('[/color]', '') +
|
||||
(tutorialText.caption ? "\n" : "") +
|
||||
coloredText(notification.instructions.reduce((instructions, item) => instructions + translate(item), ""), "yellow");
|
||||
// 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)),
|
||||
"");
|
||||
|
||||
Engine.GetGUIObjectByName("tutorialText").caption = g_TutorialMessages.concat(setStringTags(notificationText, g_TutorialNewMessageTags)).join("\n");
|
||||
g_TutorialMessages.push(notificationText);
|
||||
|
||||
if (notification.readyButton)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,8 +2,16 @@ Trigger.prototype.tutorialGoals = [
|
|||
{
|
||||
"instructions": [
|
||||
markForTranslation("This tutorial will teach the basics of developing your economy. Typically, you will start with a Civic Center and a couple units in 'Village Phase' and ultimately, your goal will be to develop and expand your empire, often by evolving to 'Town Phase' and 'City Phase' afterward.\n"),
|
||||
markForTranslation("\nBefore starting, you can toggle between fullscreen and windowed mode using Alt+Enter. You can also change the level of zoom using the mouse wheel and the camera view using any of your keyboard's arrow keys.\n"),
|
||||
markForTranslation("Adjust the game window to your preferences.\n")
|
||||
{
|
||||
"text": markForTranslation("\nBefore starting, you can toggle between fullscreen and windowed mode using %(hotkey)s."),
|
||||
"hotkey": ["togglefullscreen"]
|
||||
},
|
||||
markForTranslation("You can change the level of zoom using the mouse wheel and the camera view using any of your keyboard's arrow keys.\n"),
|
||||
markForTranslation("Adjust the game window to your preferences.\n"),
|
||||
{
|
||||
"text": markForTranslation("\nYou may also toggle between showing and hiding this tutorial panel at any moment using %(hotkey)s.\n"),
|
||||
"hotkey": ["session.gui.tutorial.toggle"]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue