summaryrefslogtreecommitdiff
path: root/scripts/GUI/MainMenu.cs
diff options
context:
space:
mode:
authorMatheus <matheus.guedes.mg.m@gmail.com>2025-11-10 12:56:00 -0300
committerMatheus <matheus.guedes.mg.m@gmail.com>2025-11-10 12:56:00 -0300
commit0f3c49b7743f7c7fabf41fdf4cb3ffe1a4ac3bf4 (patch)
treedf940efb7502899441295acd5039311b9e6e4927 /scripts/GUI/MainMenu.cs
parentc4f5404211ef654944d5615e9055c714441f8234 (diff)
Placar.
Diffstat (limited to 'scripts/GUI/MainMenu.cs')
-rw-r--r--scripts/GUI/MainMenu.cs12
1 files changed, 12 insertions, 0 deletions
diff --git a/scripts/GUI/MainMenu.cs b/scripts/GUI/MainMenu.cs
index fc46cd2..0d6c8c6 100644
--- a/scripts/GUI/MainMenu.cs
+++ b/scripts/GUI/MainMenu.cs
@@ -7,9 +7,12 @@ public partial class MainMenu : Control
private Button newGameButton;
private Button loadGameButton;
private Button quitButton;
+ private Button leaderboardButton;
[Signal]
public delegate void GameRequestEventHandler(bool load);
+ [Signal]
+ public delegate void LeaderboardRequestEventHandler();
public override void _Ready()
{
@@ -18,14 +21,18 @@ public partial class MainMenu : Control
newGameButton = GetNode<Button>("VBoxContainer/CenterContainer/VBoxContainer/neogame");
loadGameButton = GetNode<Button>("VBoxContainer/CenterContainer/VBoxContainer/continue");
quitButton = GetNode<Button>("VBoxContainer/CenterContainer/VBoxContainer/quit");
+ leaderboardButton = GetNode<Button>("VBoxContainer/CenterContainer/VBoxContainer/leaderboard");
newGameButton.Pressed += OnNewGameButtonPressed;
loadGameButton.Pressed += OnLoadGameButtonPressed;
quitButton.Pressed += OnQuitButtonPressed;
+ leaderboardButton.Pressed += OnLeaderBoardRequest;
newGameButton.GrabFocus();
bool hasSaveFile = FileAccess.FileExists("user://save_game.json");
+ bool hasLeaderboard = FileAccess.FileExists("user://placar.json");
loadGameButton.Disabled = !hasSaveFile;
+ leaderboardButton.Disabled = !hasLeaderboard;
}
private void OnNewGameButtonPressed()
@@ -38,6 +45,11 @@ public partial class MainMenu : Control
EmitSignal(SignalName.GameRequest, true);
}
+ private void OnLeaderBoardRequest()
+ {
+ EmitSignal(SignalName.LeaderboardRequest);
+ }
+
private void OnQuitButtonPressed()
{
GetTree().Quit();