You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.4 KiB
56 lines
1.4 KiB
extends PanelContainer
|
|
class_name HelpBoxContainer
|
|
|
|
@onready var textLabel: Label = $MarginContainer/Label
|
|
var animationTween:Tween
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready() -> void:
|
|
HelpBox.registerContainer(self)
|
|
await get_tree().process_frame
|
|
hideHelpInstant()
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta: float) -> void:
|
|
pass
|
|
|
|
func showHelp(text: String) -> void:
|
|
textLabel.text = text
|
|
if animationTween:
|
|
animationTween.kill()
|
|
|
|
visible = false
|
|
visible = true
|
|
|
|
var offset = get_rect().size.x + 40
|
|
|
|
animationTween = get_tree().create_tween()
|
|
animationTween.set_ease(Tween.EASE_OUT)
|
|
animationTween.set_trans(Tween.TRANS_QUAD)
|
|
animationTween.tween_property(self, "position:x", 0, .5).from(offset)
|
|
|
|
|
|
func hideHelp() -> void:
|
|
|
|
if animationTween:
|
|
animationTween.kill()
|
|
|
|
var offset = get_rect().size.x + 40
|
|
|
|
animationTween = get_tree().create_tween()
|
|
animationTween.set_ease(Tween.EASE_IN)
|
|
animationTween.set_trans(Tween.TRANS_QUAD)
|
|
animationTween.tween_property(self, "position:x", offset, .5)
|
|
|
|
func hideHelpInstant() -> void:
|
|
if animationTween:
|
|
animationTween.kill()
|
|
|
|
var offset = get_rect().size.x + 40
|
|
|
|
animationTween = get_tree().create_tween()
|
|
animationTween.set_ease(Tween.EASE_IN)
|
|
animationTween.set_trans(Tween.TRANS_QUAD)
|
|
animationTween.tween_property(self, "position:x", offset, 0)
|
|
|