From 862b399fa37e6ca692d38177a22ee34860d2251e Mon Sep 17 00:00:00 2001 From: Matheus Date: Mon, 15 Sep 2025 20:00:47 -0300 Subject: Menu principal --- scripts/Game.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'scripts/Game.cs') diff --git a/scripts/Game.cs b/scripts/Game.cs index 5c1b634..3bb1b83 100644 --- a/scripts/Game.cs +++ b/scripts/Game.cs @@ -33,10 +33,18 @@ public partial class Game : Node private Hud hud; + [Signal] + public delegate void MainMenuRequestedEventHandler(); + + private SignalBus.EscapeRequestedEventHandler escapeLambda; + public override void _Ready() { base._Ready(); + escapeLambda = () => EmitSignal(SignalName.MainMenuRequested); + SignalBus.Instance.EscapeRequested += escapeLambda; + Map = GetNode("Map"); InputHandler = GetNode("InputHandler"); @@ -61,6 +69,19 @@ public partial class Game : Node MessageLogData.Instance.AddMessage("Boa sorte!"); } + public override void _Notification(int what) + { + if (what == NotificationPredelete) + { + if (escapeLambda != null) + { + SignalBus.Instance.EscapeRequested -= escapeLambda; + } + } + base._Notification(what); + } + + /// /// Método executa aproximadamente 60 vezes por segundo. /// -- cgit v1.2.3