summaryrefslogtreecommitdiff
path: root/scripts/GameManager.cs
diff options
context:
space:
mode:
authorGustavoeklund01 <eklundgu@gmail.com>2025-11-10 17:25:59 -0300
committerGustavoeklund01 <eklundgu@gmail.com>2025-11-10 17:25:59 -0300
commit1a042d7303081e8bc72e9e3c341db3e528c8d998 (patch)
treecb56eafbd73ab8c7f8ba231fd512ae246b4dd64b /scripts/GameManager.cs
parentde99779d19b77d174c561cb3795538412f53bcbc (diff)
parentf46d058571d453ccf7ddf884ccb5d8694f970d7c (diff)
Merge branch 'master' of https://github.com/Simplesmente-O-Grupo/projeto-fantasiaHEADmaster
Diffstat (limited to 'scripts/GameManager.cs')
-rw-r--r--scripts/GameManager.cs10
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;
+ }
}