88 lines
3.5 KiB
C#
88 lines
3.5 KiB
C#
using Godot;
|
|
using System.Collections.Generic;
|
|
|
|
public partial class TutorialBubble : PanelContainer
|
|
{
|
|
[Export] RichTextLabel speakerLabel;
|
|
[Export] RichTextLabel contentLabel;
|
|
[Export] RichTextLabel progressLabel;
|
|
[Export] Button nextButton;
|
|
[Export] Button skipButton;
|
|
|
|
private List<string> messages = new List<string>();
|
|
private int currentIndex = 0;
|
|
|
|
public override void _Ready()
|
|
{
|
|
UIStyle.Apply(this);
|
|
CreateMessages();
|
|
|
|
nextButton.Pressed += ShowNext;
|
|
skipButton.Pressed += SkipTutorial;
|
|
|
|
if (!GameData.showTutorial)
|
|
{
|
|
Hide();
|
|
return;
|
|
}
|
|
|
|
ShowMessage(0);
|
|
}
|
|
|
|
private void CreateMessages()
|
|
{
|
|
messages = new List<string>
|
|
{
|
|
"Welcome to the ruin. I am B.O.B.",
|
|
"B.O.B. means Building Operation Buddy. I will keep the lamps on while you teach the robots what to do.",
|
|
"The last remaining unit in this ruin saved you from your fall and brought you here. If you want to leave, you have to explore the ruin",
|
|
"You do not walk through the ruin yourself. Your robots explore, harvest, craft and carry progress for you.",
|
|
"The top bar shows survival pressure: energy, water and food. If those run out, the expedition ends.",
|
|
"The necessary resources will be auto-consumed during your time here.",
|
|
"For Energy: Steam, Battery v1 and Battery v2; For Thirst: Water; For Food: Mushrooms",
|
|
"So try to keep a certain stock of those items to avoid dying in this ruin",
|
|
"Open the robot panel (Default: [R]) to inspect your robots. A robot can overheat, lose maintenance and slow down if ignored.",
|
|
"A robot that overheated has to cool down for a certain amount of time and cannot execute scripts",
|
|
"Use the script editor (Clicking 'Jump to' from the robot panel) to give robots commands. Start simple: move, explore, harvest, then craft.",
|
|
"Research unlocks better tools, buildings, robot upgrades and deeper progression. The graph is your technology map (Default: [T]).",
|
|
"The necessary ingredients can be found when hovering over the respective technologies in your technology map",
|
|
"The inventory (Default: [I]) stores everything your robots collect. Gates and research both consume items from it.",
|
|
"Each gate blocks the next layer. When you have the required items, use Open Gate in the top bar.",
|
|
"The necessary ingredients can be found when hovering over the 'Open Gate' button",
|
|
"The map (Default: [M]) shows what your robots have discovered. Exploration matters because resources are hidden in the ruin.",
|
|
"Depper layers contain more advanced resources and unlocking the gate at the lowest point allows you to leave the ruin",
|
|
"Be careful: The resources are not endless from the beginning. Converting a robot to a drill-unit (Using the node 'Sacrifice') makes them endless",
|
|
"Two things to keep in mind: 1)Endless resources have a lower rate of extraction 2)Sacrificing your last robot without backups in your inventory makes you unable to do anything",
|
|
"That is enough briefing. Build a loop, keep the robots alive, and open the lower gates. B.O.B. believes in organized chaos."
|
|
};
|
|
}
|
|
|
|
private void ShowNext()
|
|
{
|
|
currentIndex++;
|
|
if (currentIndex >= messages.Count)
|
|
{
|
|
SkipTutorial();
|
|
return;
|
|
}
|
|
|
|
ShowMessage(currentIndex);
|
|
}
|
|
|
|
private void SkipTutorial()
|
|
{
|
|
GameData.showTutorial = false;
|
|
Hide();
|
|
}
|
|
|
|
private void ShowMessage(int index)
|
|
{
|
|
currentIndex = index;
|
|
speakerLabel.Text = "B.O.B.";
|
|
contentLabel.Text = messages[index];
|
|
progressLabel.Text = $"{index + 1}/{messages.Count}";
|
|
nextButton.Text = index == messages.Count - 1 ? "Done" : "Next";
|
|
Show();
|
|
}
|
|
}
|