From 7e77065c56f5bfe5893862497f8affdc4e81443f Mon Sep 17 00:00:00 2001 From: Vantha Date: Mon, 9 Mar 2026 18:42:43 +0100 Subject: [PATCH] Add an info panel to the tutorial This patch adds a new tutorial step type and corresponding tutorial panel labelled "info". It is intended to display steps whose purpose it is to explain something to the player and give tips -- rather than just giving instructions and telling the player what to do, like the instruction panel does. Also, it can show several related steps at once. To do that, the first step has to set the 'appendable' flag to true and can also define a title; then the succeeding steps can then set the 'appendToPrevious' flag to true in order to do exactly that. Note: 'info'-type tutorial steps are still supposed to be able to define triggers, switch to the next step on their own and hide the continue button on the info panel, to teach the topic interactively, e.g. "Select a unit by left-clicking on it." In order to prevent code duplication between `InfoPanel` and `InstructionPanel` a generic superclass `TutorialPanel` is introduced, which manages the text, hint, and button objects. --- .../ui/session/light-gray-seperator.png | 3 + .../data/mods/public/gui/session/session.xml | 1 + .../data/mods/public/gui/session/styles.xml | 20 ++ .../gui/session/tutorial/InstructionPanel.js | 75 ----- .../public/gui/session/tutorial/Tutorial.xml | 2 +- .../gui/session/tutorial/TutorialManager.js | 4 +- .../gui/session/tutorial/TutorialPanel.js | 77 +++++ .../gui/session/tutorial/panels/InfoPanel.js | 66 ++++ .../gui/session/tutorial/panels/InfoPanel.xml | 10 + .../tutorial/panels/InstructionPanel.js | 23 ++ .../{ => panels}/InstructionPanel.xml | 4 +- .../data/mods/public/maps/scripts/Tutorial.js | 3 +- .../tutorials/starting_economy_walkthrough.js | 288 +++++++++++++----- 13 files changed, 427 insertions(+), 149 deletions(-) create mode 100644 binaries/data/mods/public/art/textures/ui/session/light-gray-seperator.png delete mode 100644 binaries/data/mods/public/gui/session/tutorial/InstructionPanel.js create mode 100644 binaries/data/mods/public/gui/session/tutorial/TutorialPanel.js create mode 100644 binaries/data/mods/public/gui/session/tutorial/panels/InfoPanel.js create mode 100644 binaries/data/mods/public/gui/session/tutorial/panels/InfoPanel.xml create mode 100644 binaries/data/mods/public/gui/session/tutorial/panels/InstructionPanel.js rename binaries/data/mods/public/gui/session/tutorial/{ => panels}/InstructionPanel.xml (64%) diff --git a/binaries/data/mods/public/art/textures/ui/session/light-gray-seperator.png b/binaries/data/mods/public/art/textures/ui/session/light-gray-seperator.png new file mode 100644 index 0000000000..5decc3f2ef --- /dev/null +++ b/binaries/data/mods/public/art/textures/ui/session/light-gray-seperator.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e961312d0b9cc321af9737fef9042e5c775d22bfd006ffa3697478df0425c0e7 +size 1305 diff --git a/binaries/data/mods/public/gui/session/session.xml b/binaries/data/mods/public/gui/session/session.xml index 8687b30664..302c661ef8 100644 --- a/binaries/data/mods/public/gui/session/session.xml +++ b/binaries/data/mods/public/gui/session/session.xml @@ -21,6 +21,7 @@