]> Untitled Git - wolf-seeking-sheep.git/blob - assets/phone/dating_app_message.gd
Squashed commit of the following:
[wolf-seeking-sheep.git] / assets / phone / dating_app_message.gd
1 @tool
2 extends MarginContainer
3 class_name DatingAppMessage
4
5 @onready var label: RichTextLabel = $MarginContainer/RichTextLabel
6 @onready var background: ColorRect = $ColorRect
7
8 @export_multiline var text: String:
9         set(s):
10                 text = s
11                 _set_text_properties()
12
13 # text message colors
14 @export var sender_color: Color = Color.CORNFLOWER_BLUE
15 @export var receiver_color: Color = Color.LIGHT_CORAL
16
17 @export var is_sender: bool = true:
18         set(b):
19                 is_sender = b
20                 _set_text_properties()
21
22 func _ready() -> void:
23         _set_text_properties()
24
25 func _set_text_properties():
26         if background:
27                 background.color = sender_color if is_sender else receiver_color
28         
29         if label:
30                 label.text = text
31                 label.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT if is_sender else HORIZONTAL_ALIGNMENT_LEFT