diff options
author | tpart <tpart120@proton.me> | 2024-08-29 15:17:33 +0200 |
---|---|---|
committer | tpart <tpart120@proton.me> | 2024-08-29 15:17:33 +0200 |
commit | 890e7eafa7cb8ce8ad5022013f7f71c74b51e3b4 (patch) | |
tree | 6293da08a2e05f2a5142dfbb57a133ae8efafd0a | |
parent | 6c74fe5c8a74031a4bfcbfc73a7fcd008af7554c (diff) | |
download | hurrycurry-890e7eafa7cb8ce8ad5022013f7f71c74b51e3b4.tar hurrycurry-890e7eafa7cb8ce8ad5022013f7f71c74b51e3b4.tar.bz2 hurrycurry-890e7eafa7cb8ce8ad5022013f7f71c74b51e3b4.tar.zst |
Refactor chat message code
-rw-r--r-- | client/menu/chat/chat_message.gd | 10 | ||||
-rw-r--r-- | client/menu/chat/chat_message.tscn | 17 |
2 files changed, 12 insertions, 15 deletions
diff --git a/client/menu/chat/chat_message.gd b/client/menu/chat/chat_message.gd index 99a4a520..1cc57102 100644 --- a/client/menu/chat/chat_message.gd +++ b/client/menu/chat/chat_message.gd @@ -13,14 +13,16 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. # -extends PanelContainer +extends HBoxContainer class_name ChatMessage -@onready var fade_away_timer = $FadeAway +@onready var fade_away_timer: Timer = $FadeAway +@onready var sender_label: Label = $Sender +@onready var message_label: Label = $Message func set_message(username: String, message: String, fade_away: bool = false, fade_time: float = 5.): - $VBox/Sender.text = username - $VBox/Message.text = message + sender_label.text = username + message_label.text = message if fade_away: fade_away_timer.start(fade_time) diff --git a/client/menu/chat/chat_message.tscn b/client/menu/chat/chat_message.tscn index 84ccb402..c72deb7b 100644 --- a/client/menu/chat/chat_message.tscn +++ b/client/menu/chat/chat_message.tscn @@ -1,32 +1,27 @@ -[gd_scene load_steps=5 format=3 uid="uid://bpc2qgsvcafhe"] +[gd_scene load_steps=4 format=3 uid="uid://bpc2qgsvcafhe"] [ext_resource type="Script" path="res://menu/chat/chat_message.gd" id="1_ey0qp"] [ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://menu/theme/theme.tres" id="1_rx6vg"] -[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ocjra"] - [sub_resource type="FontVariation" id="FontVariation_jfhbh"] variation_embolden = 1.3 -[node name="ChatMessage" type="PanelContainer"] +[node name="ChatMessage" type="HBoxContainer"] offset_right = 72.0 offset_bottom = 165.0 -theme_override_styles/panel = SubResource("StyleBoxEmpty_ocjra") -script = ExtResource("1_ey0qp") - -[node name="VBox" type="HBoxContainer" parent="."] -layout_mode = 2 theme = ExtResource("1_rx6vg") +script = ExtResource("1_ey0qp") -[node name="Sender" type="Label" parent="VBox"] +[node name="Sender" type="Label" parent="."] layout_mode = 2 theme_override_fonts/font = SubResource("FontVariation_jfhbh") text = "<Name>" -[node name="Message" type="Label" parent="VBox"] +[node name="Message" type="Label" parent="."] layout_mode = 2 size_flags_horizontal = 3 text = "Message" +vertical_alignment = 1 autowrap_mode = 3 [node name="FadeAway" type="Timer" parent="."] |