From d312f5a470c9f3cde27ed44492c13ae7d6bd2fe5 Mon Sep 17 00:00:00 2001 From: Matheus Date: Tue, 4 Nov 2025 18:14:43 -0300 Subject: Definir nome de jogador --- scripts/GameManager.cs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'scripts/GameManager.cs') diff --git a/scripts/GameManager.cs b/scripts/GameManager.cs index a17ae79..5898744 100644 --- a/scripts/GameManager.cs +++ b/scripts/GameManager.cs @@ -1,6 +1,5 @@ +using System.Diagnostics; using Godot; -using GodotPlugins.Game; -using System; using TheLegendOfGustav.GUI; using TheLegendOfGustav.Utils; @@ -10,6 +9,7 @@ public partial class GameManager : Node { private PackedScene mainMenuScene = GD.Load("res://scenes/GUI/main_menu.tscn"); private PackedScene gameScene = GD.Load("res://scenes/Game.tscn"); + private PackedScene nameScene = GD.Load("res://scenes/name_thyself.tscn"); private Node currentScene; @@ -56,19 +56,30 @@ public partial class GameManager : Node } } - private void NewGame() + private void NewGame(string name) { MessageLogData.Instance.ClearMessages(); Game game = (Game)SwitchToScene(gameScene); - game.NewGame(); + game.NewGame(name); game.MainMenuRequested += LoadMainMenu; } + private void SelectName() + { + PlayerName namesc = (PlayerName)SwitchToScene(nameScene); + namesc.NewGameRequest += OnNameSelect; + } + + private void OnNameSelect(string name) + { + NewGame(name); + } + private void OnGameRequest(bool load) { if (!load) { - NewGame(); + SelectName(); } else { -- cgit v1.2.3