61 lines
1.3 KiB
GDScript
61 lines
1.3 KiB
GDScript
extends SceneTree
|
|
|
|
var failures: Array[String] = []
|
|
|
|
|
|
func _init() -> void:
|
|
_run.call_deferred()
|
|
|
|
|
|
func _run() -> void:
|
|
var scene: PackedScene = load("res://scenes/ui/main_ui.tscn")
|
|
if scene == null:
|
|
push_error("Could not load main_ui.tscn")
|
|
quit(1)
|
|
return
|
|
|
|
var ui := scene.instantiate()
|
|
root.add_child(ui)
|
|
await process_frame
|
|
|
|
for node_path: String in [
|
|
"RhythmTrack",
|
|
"RhythmTrack/JudgementLabel",
|
|
"RhythmTrack/ChartMarkerContainer",
|
|
"ComboWindow",
|
|
"StatusBars/HealthBar",
|
|
"StatusBars/EnergyBar",
|
|
"StatusBars/ChargeBar",
|
|
]:
|
|
if not ui.has_node(node_path):
|
|
failures.append("Missing rhythm UI node: %s" % node_path)
|
|
|
|
var bus := _event_bus()
|
|
bus.emit_signal("action_judged", &"skill_a", {"label": "perfect", "diff": 0.0})
|
|
await process_frame
|
|
var label := ui.get_node("RhythmTrack/JudgementLabel") as Label
|
|
if not label.text.contains("SKILL_A"):
|
|
failures.append("RhythmTrack should render EventBus judgement text")
|
|
|
|
ui.free()
|
|
_finish()
|
|
|
|
|
|
func _event_bus() -> Node:
|
|
var bus := root.get_node_or_null("EventBus")
|
|
if bus == null:
|
|
bus = load("res://autoload/event_bus.gd").new()
|
|
bus.name = "EventBus"
|
|
root.add_child(bus)
|
|
return bus
|
|
|
|
|
|
func _finish() -> void:
|
|
if failures.is_empty():
|
|
print("PASS rhythm ui")
|
|
quit(0)
|
|
else:
|
|
for failure: String in failures:
|
|
push_error(failure)
|
|
quit(1)
|