Files
windroost/p2_godot_sample/scripts/endless_page_ui_test.gd
T
wushenghua 2765468525 feat: standalone endless expedition page (replaces modal)
The endless mode UI was a transient modal -- poor for an idle game the player
watches. Now a persistent PAGE_ENDLESS (like growth/map):
- number_display.py/.gd: readable BigValue text (1.23K/1.50M/2.15e190),
  NUMDISP_PARITY_PASS 5 cases -- big numbers no longer raw encoded strings.
- game_root: skyport "Endless Expedition" opens PAGE_ENDLESS with live status
  (zone/level/essence/rebuild), gold/dps, advance/auto/upgrade actions, and a
  recent-zone log showing clear times + boss flags. Offline report shown inline;
  modal path kept for actions but page is the primary surface.
- endless_page_ui_test PASS: page renders, entry works, advance drives engine.
- P2_CHECKS_PASS 105 gates, identity preserved (story mode untouched).

Endless idle now has a proper home surface. Owner gates (human/device/release)
open. prototype/ untracked.
2026-11-19 22:29:06 +08:00

56 lines
1.8 KiB
GDScript

extends SceneTree
## Verifies the standalone endless PAGE renders and its actions drive the engine.
const OUTPUT_PATH := "res://artifacts/endless_page_ui_test.json"
var _problems: Array = []
var _records: Array = []
func _init() -> void:
_run.call_deferred()
func _run() -> void:
var shell := load("res://scenes/game_root.tscn").instantiate() as GameRoot
root.add_child(shell)
await process_frame
await process_frame
# Enter the endless page through the real UI entry point.
shell._on_endless()
shell.show_page_for_test("endless")
await process_frame
await process_frame
var st := shell.endless_state_for_test()
_records.append({"stage": "page", "zone": int(st.get("zone", 0)),
"page": shell.current_page})
if shell.current_page != "endless":
_problems.append("endless button must open endless page")
# Drive the page's advance action via the real state hook.
var before := int(shell.endless_state_for_test().get("zone", 1))
shell.endless_advance_for_test(10)
var after := int(shell.endless_state_for_test().get("zone", 1))
_records.append({"stage": "advance", "before": before, "after": after})
if after != before + 10:
_problems.append("advance must move 10 zones: %d -> %d" % [before, after])
var payload := {"records": _records, "problems": _problems}
var dir := ProjectSettings.globalize_path("res://artifacts")
DirAccess.make_dir_recursive_absolute(dir)
var f := FileAccess.open(OUTPUT_PATH, FileAccess.WRITE)
if f != null:
f.store_string(JSON.stringify(payload, "\t", true))
f.close()
for r in _records:
print("ENDLESS_PAGE %s %s" % [r["stage"], JSON.stringify(r)])
if _problems.is_empty():
print("ENDLESS_PAGE_PASS standalone endless page renders and works")
else:
print("ENDLESS_PAGE_FAIL %d problem(s)" % _problems.size())
for p in _problems:
print(" " + p)
quit(0 if _problems.is_empty() else 1)