From 862b399fa37e6ca692d38177a22ee34860d2251e Mon Sep 17 00:00:00 2001 From: Matheus Date: Mon, 15 Sep 2025 20:00:47 -0300 Subject: Menu principal --- scripts/GUI/MessageLog.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'scripts/GUI/MessageLog.cs') diff --git a/scripts/GUI/MessageLog.cs b/scripts/GUI/MessageLog.cs index 1fc59b6..c83879a 100644 --- a/scripts/GUI/MessageLog.cs +++ b/scripts/GUI/MessageLog.cs @@ -8,6 +8,7 @@ public partial class MessageLog : ScrollContainer { private VBoxContainer MessageList { get; set; } + private MessageLogData.messageSentEventHandler joinSignal; public override void _Ready() { base._Ready(); @@ -18,7 +19,21 @@ public partial class MessageLog : ScrollContainer _ = AddMessageAsync(msg); } - MessageLogData.Instance.messageSent += async (Message msg) => await AddMessageAsync(msg); + joinSignal = async (Message msg) => await AddMessageAsync(msg); + + MessageLogData.Instance.messageSent += joinSignal; + } + + public override void _Notification(int what) + { + if (what == NotificationPredelete) + { + if (joinSignal != null) + { + MessageLogData.Instance.messageSent -= joinSignal; + } + } + base._Notification(what); } private async Task AddMessageAsync(Message message) -- cgit v1.2.3