50 lines
1.4 KiB
C#
50 lines
1.4 KiB
C#
#nullable enable
|
|
|
|
using Godot;
|
|
using ShrinkTutorial;
|
|
using ShrinkTutorial.Godot;
|
|
|
|
public partial class TutorialDemo : Control
|
|
{
|
|
public override void _Ready()
|
|
{
|
|
var target = new Button
|
|
{
|
|
Text = "Tutorial Target",
|
|
Position = new Vector2(480, 260),
|
|
CustomMinimumSize = new Vector2(220, 72)
|
|
};
|
|
target.AddToGroup("shrink_tutorial_primary");
|
|
AddChild(target);
|
|
|
|
var overlay = new ShrinkGodotTutorialOverlay();
|
|
AddChild(overlay);
|
|
var runner = new ShrinkTutorialRunner(new MemoryTutorialStorage());
|
|
runner.Start(new ShrinkTutorialData
|
|
{
|
|
TutorialId = "visual-smoke",
|
|
Steps =
|
|
{
|
|
new ShrinkTutorialStep
|
|
{
|
|
StepId = "target",
|
|
Title = "Godot Tutorial",
|
|
Body = "Target hole, dialog and input blocker smoke test",
|
|
TargetMode = ShrinkTutorialTargetMode.AnchorId,
|
|
Target = "primary",
|
|
CompleteCondition = ShrinkTutorialCompleteCondition.ClickTarget
|
|
}
|
|
}
|
|
});
|
|
overlay.Bind(runner);
|
|
GetTree().CreateTimer(2).Timeout += QuitCleanly;
|
|
}
|
|
|
|
private void QuitCleanly()
|
|
{
|
|
var tree = GetTree();
|
|
tree.UnloadCurrentScene();
|
|
tree.CreateTimer(0.1).Timeout += () => tree.Quit(0);
|
|
}
|
|
}
|