2023-04-19 16:53:24 +00:00
|
|
|
@tool
|
|
|
|
|
|
|
|
|
|
extends Control
|
|
|
|
|
class_name PostIt
|
2023-05-28 13:21:19 +00:00
|
|
|
var sibling
|
2023-04-19 16:53:24 +00:00
|
|
|
|
|
|
|
|
@export var text: String = "" :
|
|
|
|
|
set (value):
|
|
|
|
|
if is_inside_tree() or Engine.is_editor_hint():
|
|
|
|
|
$Label.text = value
|
2023-05-18 07:27:59 +00:00
|
|
|
$BackgroundSprite.frame = text.hash() % $BackgroundSprite.sprite_frames.get_frame_count($BackgroundSprite.animation)
|
2023-04-19 16:53:24 +00:00
|
|
|
text = value
|
|
|
|
|
@export var voice_line: AudioStream = null
|
|
|
|
|
|
|
|
|
|
func _ready() -> void:
|
|
|
|
|
$Label.text = self.text
|
2023-05-18 07:27:59 +00:00
|
|
|
$BackgroundSprite.frame = text.hash() % $BackgroundSprite.sprite_frames.get_frame_count($BackgroundSprite.animation)
|
2023-04-19 16:53:24 +00:00
|
|
|
|
2023-05-28 13:21:19 +00:00
|
|
|
func replace_with(postit: PostIt):
|
|
|
|
|
self.text = postit.text
|
|
|
|
|
self.voice_line = postit.voice_line
|
|
|
|
|
self.sibling = postit.sibling
|
|
|
|
|
|
2023-04-19 16:53:24 +00:00
|
|
|
func _process(delta: float) -> void:
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
func _on_focus_entered():
|
|
|
|
|
print(self, "is focused")
|
|
|
|
|
|
|
|
|
|
func _on_focus_exited():
|
|
|
|
|
print(self, "is not focused")
|