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/GameManager.cs | |
| parent | de99779d19b77d174c561cb3795538412f53bcbc (diff) | |
| parent | f46d058571d453ccf7ddf884ccb5d8694f970d7c (diff) | |
Diffstat (limited to 'scripts/GameManager.cs')
| -rw-r--r-- | scripts/GameManager.cs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/scripts/GameManager.cs b/scripts/GameManager.cs index 5898744..4215475 100644 --- a/scripts/GameManager.cs +++ b/scripts/GameManager.cs @@ -10,6 +10,7 @@ public partial class GameManager : Node private PackedScene mainMenuScene = GD.Load<PackedScene>("res://scenes/GUI/main_menu.tscn"); private PackedScene gameScene = GD.Load<PackedScene>("res://scenes/Game.tscn"); private PackedScene nameScene = GD.Load<PackedScene>("res://scenes/name_thyself.tscn"); + private PackedScene leaderboardScene = GD.Load<PackedScene>("res://scenes/GUI/Leaderboard.tscn"); private Node currentScene; @@ -42,7 +43,9 @@ public partial class GameManager : Node private void LoadMainMenu() { MainMenu menu = (MainMenu)SwitchToScene(mainMenuScene); + Stats.Instance.Clear(); menu.GameRequest += OnGameRequest; + menu.LeaderboardRequest += OnLeaderboardRequest; } private void LoadGame() @@ -72,6 +75,7 @@ public partial class GameManager : Node private void OnNameSelect(string name) { + Stats.Instance.PlayerName = name; NewGame(name); } @@ -86,4 +90,10 @@ public partial class GameManager : Node LoadGame(); } } + + private void OnLeaderboardRequest() + { + Leaderboard scene = (Leaderboard)SwitchToScene(leaderboardScene); + scene.MenuRequested += LoadMainMenu; + } } |
