diff options
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; + } } |
