diff options
| author | Gustavoeklund01 <eklundgu@gmail.com> | 2025-11-10 17:25:59 -0300 |
|---|---|---|
| committer | Gustavoeklund01 <eklundgu@gmail.com> | 2025-11-10 17:25:59 -0300 |
| commit | 1a042d7303081e8bc72e9e3c341db3e528c8d998 (patch) | |
| tree | cb56eafbd73ab8c7f8ba231fd512ae246b4dd64b /scripts/GUI/MainMenu.cs | |
| parent | de99779d19b77d174c561cb3795538412f53bcbc (diff) | |
| parent | f46d058571d453ccf7ddf884ccb5d8694f970d7c (diff) | |
Diffstat (limited to 'scripts/GUI/MainMenu.cs')
| -rw-r--r-- | scripts/GUI/MainMenu.cs | 12 |
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(); |
