mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-07 08:35:54 +00:00
Intro logo skip
This commit is contained in:
parent
48c572131d
commit
cf708c58f4
7 changed files with 141 additions and 1 deletions
38
Scripts/UI/IntroLogos.cs
Normal file
38
Scripts/UI/IntroLogos.cs
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
using System.Threading.Tasks;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.UI;
|
||||
|
||||
public partial class IntroLogos : CanvasLayer
|
||||
{
|
||||
[Export]
|
||||
public float TransitionTime = 4f;
|
||||
|
||||
[Export]
|
||||
public StringName IntroScenePath;
|
||||
|
||||
private bool _isTransitioning = false;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_ = AutoTransition();
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
if (_isTransitioning) return;
|
||||
if (Input.IsAnythingPressed())
|
||||
{
|
||||
_isTransitioning = true;
|
||||
GlobalState.Instance.GotoScene(IntroScenePath);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task AutoTransition()
|
||||
{
|
||||
await Task.Delay((int)(TransitionTime * 1000));
|
||||
if (_isTransitioning) return;
|
||||
_isTransitioning = true;
|
||||
GlobalState.Instance.GotoScene(IntroScenePath);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue