summaryrefslogtreecommitdiff
path: root/scripts/GUI/MessageLog.cs
diff options
context:
space:
mode:
authorMatheus <matheus.guedes.mg.m@gmail.com>2025-09-15 20:00:47 -0300
committerMatheus <matheus.guedes.mg.m@gmail.com>2025-09-15 20:00:47 -0300
commit862b399fa37e6ca692d38177a22ee34860d2251e (patch)
tree3c0c80efbe0096c8e8d606ee464b54b55eaa209c /scripts/GUI/MessageLog.cs
parentbefb39054656e3242e9408f2afe8c902df471ffa (diff)
Menu principal
Diffstat (limited to 'scripts/GUI/MessageLog.cs')
-rw-r--r--scripts/GUI/MessageLog.cs17
1 files changed, 16 insertions, 1 deletions
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)