2026-02-28 02:55:51 -06:00
|
|
|
extends Node
|
|
|
|
|
|
|
|
|
|
var ol: OverlayWindow
|
|
|
|
|
|
2026-03-02 02:06:01 -06:00
|
|
|
var _queue: Array[Alert] = []
|
2026-02-28 02:55:51 -06:00
|
|
|
|
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
|
|
|
func _ready() -> void:
|
2026-03-02 02:06:01 -06:00
|
|
|
if get_tree().root.has_node("MainWin"):
|
|
|
|
|
ol = get_tree().root.get_node("MainWin")
|
2026-02-28 02:55:51 -06:00
|
|
|
|
2026-03-02 02:06:01 -06:00
|
|
|
func add_alert(alert: Alert) -> void:
|
|
|
|
|
if get_children().any(func(x): return x is Alert):
|
|
|
|
|
_queue.append(alert)
|
|
|
|
|
else:
|
|
|
|
|
add_child(alert)
|
|
|
|
|
|
|
|
|
|
func _process(_d: float) -> void:
|
|
|
|
|
if _queue.is_empty(): return
|
|
|
|
|
if get_children().any(func(x): return x is Alert):
|
|
|
|
|
return
|
|
|
|
|
var alert: Alert = _queue.pop_front()
|
|
|
|
|
add_child(alert)
|
2026-02-28 02:55:51 -06:00
|
|
|
|
|
|
|
|
func test_notification(msg: String) -> void:
|
|
|
|
|
var lbl = Label.new()
|
|
|
|
|
lbl.label_settings = LabelSettings.new()
|
|
|
|
|
lbl.label_settings.font_size = 75
|
|
|
|
|
lbl.label_settings.font_color = Color.DODGER_BLUE
|
|
|
|
|
lbl.text = msg
|
|
|
|
|
lbl.modulate.a = 0
|
|
|
|
|
lbl.ready.connect(func() -> void:
|
|
|
|
|
var half: Vector2 = lbl.size / 2
|
|
|
|
|
lbl.position = Vector2(get_tree().root.size / 2) - half
|
|
|
|
|
var tw := create_tween()
|
|
|
|
|
tw.tween_property(lbl, "modulate:a", 1.0, 0.5)
|
|
|
|
|
tw.tween_interval(2.5)
|
|
|
|
|
tw.parallel().tween_property(lbl, "position:y", get_tree().root.size.y + 10, 3.0)
|
|
|
|
|
tw.parallel().tween_property(lbl, "modulate:a", 0, 3.0)
|
|
|
|
|
await tw.finished
|
|
|
|
|
lbl.queue_free()
|
|
|
|
|
)
|
|
|
|
|
add_child(lbl)
|