mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
Briefing scene
This commit is contained in:
parent
39183aa83f
commit
d141bffde6
6 changed files with 86 additions and 25 deletions
52
Scripts/Misc/DialogueAutoStarter.cs
Normal file
52
Scripts/Misc/DialogueAutoStarter.cs
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Misc;
|
||||
|
||||
public partial class DialogueAutoStarter : Node2D
|
||||
{
|
||||
[Export] private StringName _trackName = "timeline";
|
||||
[Export] private StringName _finishedScenePath;
|
||||
|
||||
private Node _dialogic;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
base._Ready();
|
||||
|
||||
_dialogic = GetNode("/root/Dialogic");
|
||||
_dialogic.ProcessMode = ProcessModeEnum.Always;
|
||||
|
||||
CallDeferred(MethodName.Activate);
|
||||
}
|
||||
|
||||
private void OnTimelineEnded()
|
||||
{
|
||||
if (_dialogic.IsConnected("timeline_ended", Callable.From(OnTimelineEnded)))
|
||||
{
|
||||
_dialogic.Disconnect("timeline_ended", Callable.From(OnTimelineEnded));
|
||||
}
|
||||
|
||||
DialogueEndAction();
|
||||
}
|
||||
|
||||
public bool Activate()
|
||||
{
|
||||
if (GlobalState.Instance.SessionSettings.SkipDialogues)
|
||||
{
|
||||
DialogueEndAction();
|
||||
return true;
|
||||
}
|
||||
_dialogic.Connect("timeline_ended", Callable.From(OnTimelineEnded));
|
||||
|
||||
var dialogicNode = _dialogic.Call("start", _trackName.ToString());
|
||||
((Node)dialogicNode).ProcessMode = ProcessModeEnum.Always;
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
private void DialogueEndAction()
|
||||
{
|
||||
GlobalState.Instance.GotoScene(_finishedScenePath);
|
||||
}
|
||||
}
|
||||
1
Scripts/Misc/DialogueAutoStarter.cs.uid
Normal file
1
Scripts/Misc/DialogueAutoStarter.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bf0tnhnwttrim
|
||||
Loading…
Add table
Add a link
Reference in a new issue