2026-01-24 15:43:53 +08:00
|
|
|
@tool
|
|
|
|
|
extends PanelContainer
|
|
|
|
|
class_name TipBox
|
|
|
|
|
|
|
|
|
|
@export var text: String = "nothing"
|
|
|
|
|
|
2026-01-24 20:07:06 +08:00
|
|
|
@onready var label: RichTextLabel = $%label
|
2026-01-24 15:43:53 +08:00
|
|
|
@onready var animator: AnimationPlayer = $%animator
|
|
|
|
|
|
|
|
|
|
func _ready():
|
2026-01-24 15:54:42 +08:00
|
|
|
label.text = text
|
|
|
|
|
animator.play("show")
|
2026-01-24 15:43:53 +08:00
|
|
|
func _process(_delta):
|
2026-01-24 15:54:42 +08:00
|
|
|
label.text = text
|
2026-01-24 15:43:53 +08:00
|
|
|
|
|
|
|
|
func destroy():
|
2026-01-24 15:54:42 +08:00
|
|
|
animator.play("hide")
|
|
|
|
|
await animator.animation_finished
|
|
|
|
|
queue_free()
|
2026-01-24 15:43:53 +08:00
|
|
|
|
|
|
|
|
static func create(applyText: String) -> TipBox:
|
2026-01-24 15:54:42 +08:00
|
|
|
var box = ComponentManager.getUIComponent("TipBox").instantiate()
|
|
|
|
|
box.text = applyText
|
|
|
|
|
return box
|