summaryrefslogtreecommitdiff
path: root/scripts/GUI/Message.cs
diff options
context:
space:
mode:
authorMatheus <matheus.guedes.mg.m@gmail.com>2025-09-01 17:50:25 -0300
committerMatheus <matheus.guedes.mg.m@gmail.com>2025-09-01 17:50:25 -0300
commit0456e7cd82b232a38fd9b6e008be7d49b2f9e90f (patch)
treeea2285eaca0d68c269d07212bc6a1e3688b9aef8 /scripts/GUI/Message.cs
parentd7d2454d5ccc1e0acb47cb679c7550e74c4e1916 (diff)
Logs
Diffstat (limited to 'scripts/GUI/Message.cs')
-rw-r--r--scripts/GUI/Message.cs32
1 files changed, 32 insertions, 0 deletions
diff --git a/scripts/GUI/Message.cs b/scripts/GUI/Message.cs
new file mode 100644
index 0000000..b0472ee
--- /dev/null
+++ b/scripts/GUI/Message.cs
@@ -0,0 +1,32 @@
+using Godot;
+
+public partial class Message : Label
+{
+ private static LabelSettings baseSettings = GD.Load<LabelSettings>("res://assets/definitions/message_label_settings.tres");
+ private string plainText;
+ public string PlainText { get => plainText; }
+ private int count = 1;
+ public int Count {
+ get => count;
+ set {
+ count = value;
+ Text = FullText;
+ }
+ }
+
+ public string FullText {
+ get {
+ if (count > 1) {
+ return $"{plainText} ({count})";
+ }
+ return plainText;
+ }
+ }
+
+ public Message(string text) {
+ plainText = text;
+ Text = text;
+ LabelSettings = (LabelSettings) baseSettings.Duplicate();
+ AutowrapMode = TextServer.AutowrapMode.WordSmart;
+ }
+}