2024-04-24 02:55:31 +00:00
|
|
|
extends PanelContainer
|
2024-04-24 02:56:44 +00:00
|
|
|
class_name GoldDisplay
|
2024-04-24 02:55:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
@onready var label: Label = %"Label"
|
|
|
|
@onready var animator: AnimationPlayer = %"Animator"
|
|
|
|
|
|
|
|
|
|
|
|
func set_text(value: int) -> void:
|
|
|
|
label.text = "%d €" % value
|
|
|
|
|
2024-04-26 00:15:39 +00:00
|
|
|
func increase(value: int):
|
|
|
|
set_text(value)
|
|
|
|
animator.stop()
|
|
|
|
animator.play(&"increase")
|
2024-04-24 02:55:31 +00:00
|
|
|
|
2024-04-26 00:15:39 +00:00
|
|
|
func decrease(value: int):
|
2024-04-24 02:55:31 +00:00
|
|
|
set_text(value)
|
|
|
|
animator.stop()
|
2024-04-26 00:15:39 +00:00
|
|
|
animator.play(&"decrease")
|
|
|
|
|
|
|
|
func change(new: int, old: int):
|
|
|
|
if new > old:
|
|
|
|
increase(new)
|
|
|
|
elif old > new:
|
|
|
|
decrease(new)
|