mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
Intro with new animator
This commit is contained in:
parent
d07fe420dd
commit
cd43b3361d
16 changed files with 788 additions and 19 deletions
|
|
@ -9,6 +9,8 @@ namespace Cirno.Scripts.UI;
|
|||
|
||||
public partial class IntroScenePlayer : CanvasLayer
|
||||
{
|
||||
[Export] public bool StartRunning { get; private set; }
|
||||
|
||||
[Export]
|
||||
public Control PanelsHolder { get; private set; }
|
||||
|
||||
|
|
@ -21,6 +23,9 @@ public partial class IntroScenePlayer : CanvasLayer
|
|||
[Export]
|
||||
public string NextSceneName { get; set; }
|
||||
|
||||
[Export]
|
||||
public AnimationPlayer AnimationPlayer { get; private set; }
|
||||
|
||||
private int _currentPanelIndex;
|
||||
|
||||
private List<TextureRect> _panels = new ();
|
||||
|
|
@ -30,12 +35,20 @@ public partial class IntroScenePlayer : CanvasLayer
|
|||
private double _timer = 0f;
|
||||
|
||||
private bool _running = false;
|
||||
|
||||
private void DeferredStartAnimation()
|
||||
{
|
||||
AnimationPlayer.Play("intro");
|
||||
}
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_timer = 0;
|
||||
_running = true;
|
||||
_running = StartRunning;
|
||||
|
||||
DeferredStartAnimation();
|
||||
|
||||
return;
|
||||
foreach (var image in Images)
|
||||
{
|
||||
var panel = new TextureRect();
|
||||
|
|
@ -49,11 +62,19 @@ public partial class IntroScenePlayer : CanvasLayer
|
|||
|
||||
_panels.Add(panel);
|
||||
}
|
||||
|
||||
if (StartRunning)
|
||||
{
|
||||
Run();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Run()
|
||||
{
|
||||
var first = _panels.First();
|
||||
first.Visible = true;
|
||||
first.SetModulate(new Color(first.Modulate.R, first.Modulate.G, first.Modulate.B, 1f));
|
||||
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
|
|
@ -70,21 +91,26 @@ public partial class IntroScenePlayer : CanvasLayer
|
|||
if (_timer >= TransitionTime)
|
||||
{
|
||||
_timer = 0;
|
||||
_currentPanelIndex++;
|
||||
|
||||
if (_currentPanelIndex >= _panels.Count)
|
||||
{
|
||||
_running = false;
|
||||
Finished();
|
||||
return;
|
||||
}
|
||||
|
||||
_running = false;
|
||||
|
||||
_ = Transition();
|
||||
NextPanel();
|
||||
}
|
||||
}
|
||||
|
||||
public void NextPanel()
|
||||
{
|
||||
_currentPanelIndex++;
|
||||
|
||||
if (_currentPanelIndex >= _panels.Count)
|
||||
{
|
||||
_running = false;
|
||||
Finished();
|
||||
return;
|
||||
}
|
||||
|
||||
_running = false;
|
||||
|
||||
_ = Transition();
|
||||
}
|
||||
|
||||
private void Finished()
|
||||
{
|
||||
GlobalState.Instance.GotoScene(NextSceneName);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue