88 lines
3.4 KiB
C#
88 lines
3.4 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: coal, steam, battery v1 and battery v2. For thirst: water. For food: mushrooms.",
|
|
"Try to keep a 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.",
|
|
"An overheated robot has to cool down for a while 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 required ingredients can be found by hovering over 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 required ingredients can be found by 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.",
|
|
"Deeper layers contain more advanced resources. Unlocking the gate at the lowest point allows you to leave the ruin.",
|
|
"Be careful: resources are not endless at the beginning. Converting a robot to a drill unit with Sacrifice makes them endless.",
|
|
"Two things to keep in mind: endless resources extract slower, and sacrificing your last robot without a backup in your inventory leaves you stranded.",
|
|
"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();
|
|
}
|
|
}
|