Beeg checkin
This commit is contained in:
56
UI/MainMenu.cs
Normal file
56
UI/MainMenu.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using Godot;
|
||||
|
||||
public partial class MainMenu : Node2D
|
||||
{
|
||||
private AnimationPlayer _animationPlayer;
|
||||
|
||||
[Signal]
|
||||
public delegate void IntroAnimationsCompletedEventHandler();
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
GetParent().GetNode<TextureRect>("MainMenu/UIAnimations/LoreSplash").Show();
|
||||
_animationPlayer = GetTree().Root.GetNode<AnimationPlayer>("/root/Main/MainMenu/UIAnimations/AnimationPlayer");
|
||||
_animationPlayer.Queue("IntroLore");
|
||||
var bgmPlayer = GetTree().Root.GetNode<BGMPlayer>("BgmPlayer");
|
||||
bgmPlayer.SetBGMFromFilepath("Audio/BGM/TitleTheme.wav");
|
||||
bgmPlayer.PlayBGM();
|
||||
}
|
||||
|
||||
private void OnSinglePlayerPressed()
|
||||
{
|
||||
_animationPlayer.Play("FirstLevel");
|
||||
Hide();
|
||||
_animationPlayer.AnimationFinished += OnAnimationFinishedCallSinglePlayerStart;
|
||||
}
|
||||
|
||||
private void OnAnimationFinishedCallSinglePlayerStart(StringName animationName)
|
||||
{
|
||||
if (animationName == "FirstLevel")
|
||||
{
|
||||
var main = GetTree().Root.GetNode<Main>("/root/Main");
|
||||
main.LoadLevel(0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTwoPlayerPressed()
|
||||
{
|
||||
_animationPlayer.Play("FirstLevel");
|
||||
Hide();
|
||||
_animationPlayer.AnimationFinished += OnAnimationFinishedCallTwoPlayerStart;
|
||||
}
|
||||
|
||||
private void OnQuitButtonPressed()
|
||||
{
|
||||
GetTree().Quit();
|
||||
}
|
||||
|
||||
private void OnAnimationFinishedCallTwoPlayerStart(StringName animationName)
|
||||
{
|
||||
if (animationName == "FirstLevel")
|
||||
{
|
||||
var main = GetTree().Root.GetNode<Main>("/root/Main");
|
||||
main.LoadLevel(0, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user