35 lines
736 B
C#
35 lines
736 B
C#
using Chickensoft.AutoInject;
|
|
using Chickensoft.Introspection;
|
|
using Godot;
|
|
|
|
[Meta(typeof(IAutoNode))]
|
|
public partial class LoadingScreen : Control
|
|
{
|
|
public override void _Notification(int what) => this.Notify(what);
|
|
|
|
[Node] public ProgressBar ProgressBar { get; set; } = default!;
|
|
|
|
[Node] public AnimationPlayer AnimationPlayer { get; set; } = default!;
|
|
|
|
public void OnResolved()
|
|
{
|
|
AnimationPlayer.AnimationFinished += AnimationPlayer_AnimationFinished;
|
|
}
|
|
|
|
private void AnimationPlayer_AnimationFinished(StringName animName)
|
|
{
|
|
if (animName == "fade_out")
|
|
Hide();
|
|
}
|
|
|
|
public void ShowLoadingScreen()
|
|
{
|
|
Show();
|
|
}
|
|
|
|
public void HideLoadingScreen()
|
|
{
|
|
AnimationPlayer.Play("fade_out");
|
|
}
|
|
}
|