Files
cneicy 88ba3cdc48
Validate ShrinkSDK Workspace / unity (push) Failing after 3m18s
feat: add Godot C# compatibility and shared codegen weaving
2026-09-05 02:37:43 +08:00

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);
}
}