Owner feedback: too few visible animations, button rows feel list-like, battle actions unclear, and tapping a bottom tab silently left the fight. - Battle manual actions now have icons and three distinct weights: sword = repeated hit (brass primary), bolt = storm (quiet), fireball = ultimate (purple special). A "tight" icon-button mode keeps all three plus dynamic cooldown/energy text inside the 358px row (verified by geometry probe). - Added an always-visible flagged "退出战斗" button in the battle header; the stage hint now reads "tap enemy to retarget / buttons below to act". - Leaving battle via any tab shows a shell-level toast "已离开战斗 · 前往 X" so the player knows the fight ended and where they landed. - Game feel: idle sprites have a 6fps floor (authored 4-frame/3fps idle read as frozen), damage numbers get a short overshoot-and-settle pop, and manual-hit shake trauma doubled (still small tier). All respect reduced motion/low power. - New regression assertions: labeled exit button + exit toast; 108 gates pass. Normal-render capture inspected at 390x844 zh_CN. agent_visual_reviewed only; owner must confirm on device whether the motion level now feels right.
134 lines
5.6 KiB
GDScript
134 lines
5.6 KiB
GDScript
extends SceneTree
|
|
|
|
## Regression: list scrolling + safe area + button layout on device.
|
|
## - buttons/panels PASS so drags bubble to ScrollContainer
|
|
## - safe area clamps so the header isn't pushed a quarter screen down
|
|
## - growth talents use a 2-col grid (wide buttons, no text overflow)
|
|
|
|
const OUTPUT_PATH := "res://artifacts/ui_scroll_layout_test.json"
|
|
const UiTheme = preload("res://scripts/ui_theme.gd")
|
|
|
|
var _problems: 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
|
|
|
|
# Buttons and panels must PASS so scroll drags aren't swallowed.
|
|
var btn := UiTheme.make_button("x", 12)
|
|
if btn.mouse_filter != Control.MOUSE_FILTER_PASS:
|
|
_problems.append("button mouse_filter must be PASS for list scroll")
|
|
var panel := UiTheme.make_panel()
|
|
if panel.mouse_filter != Control.MOUSE_FILTER_PASS:
|
|
_problems.append("panel mouse_filter must be PASS for list scroll")
|
|
var glass := UiTheme.glass_panel()
|
|
if glass.mouse_filter != Control.MOUSE_FILTER_PASS:
|
|
_problems.append("glass_panel mouse_filter must be PASS")
|
|
|
|
# Global button/panel styles must be flat dark, never the old gold nine-slice.
|
|
var theme := UiTheme.build_theme()
|
|
var btn_sb = theme.get_stylebox("normal", "Button")
|
|
if btn_sb == null or not (btn_sb is StyleBoxFlat):
|
|
_problems.append("global Button style must be flat, not a gold frame")
|
|
if not (panel.get_theme_stylebox("panel") is StyleBoxFlat):
|
|
_problems.append("make_panel style must be flat, not a gold frame")
|
|
|
|
# growth page grid: built in _ready; inspect one hero card's talent container.
|
|
var grid_ok := false
|
|
var rows := shell.get_growth_rows_for_test()
|
|
for k in rows.keys():
|
|
if k == "__frag" or not rows[k] is Dictionary:
|
|
continue
|
|
var row: Dictionary = rows[k]
|
|
var talents: Array = row.get("talents", [])
|
|
if talents.size() >= 2:
|
|
var parent := (talents[0] as Node).get_parent()
|
|
if parent != null and parent is GridContainer and (parent as GridContainer).columns == 2:
|
|
grid_ok = true
|
|
break
|
|
if not grid_ok:
|
|
_problems.append("growth talents must be a 2-column GridContainer")
|
|
|
|
# Shell bottom nav must actually sit ON screen. PRESET_BOTTOM_WIDE left
|
|
# offset_top=0, so it used to render entirely below the viewport.
|
|
var nav: Control = shell.get("_nav_box")
|
|
var vp: Vector2 = shell.get_viewport_rect().size
|
|
if nav == null or not nav.visible:
|
|
_problems.append("shell bottom nav must exist and be visible")
|
|
else:
|
|
if nav.position.y <= 0.0 or nav.position.y + nav.size.y > vp.y + 1.0:
|
|
_problems.append("shell bottom nav is off-screen: pos=%s size=%s" % [str(nav.position), str(nav.size)])
|
|
for c in nav.get_children():
|
|
if c is MarginContainer:
|
|
for b in (c as MarginContainer).get_children():
|
|
if b is Button and str((b as Button).text).begins_with("["):
|
|
_problems.append("nav button has missing text key: %s" % (b as Button).text)
|
|
|
|
# Battle top-right must carry real context text (owner: "top-right has no
|
|
# text, don't know what it is"). The info label is always populated; the
|
|
# timer label must have text too when a boss timer is active.
|
|
shell.reset_profile_for_test()
|
|
shell.start_node("R1-C01-N01")
|
|
await process_frame
|
|
await process_frame
|
|
var battle := shell.get_battle()
|
|
var info_txt := ""
|
|
var timer_txt := ""
|
|
if battle != null and battle.hud != null:
|
|
var info_lbl: Label = battle.hud.get("_stage_info_label") as Label
|
|
var timer_lbl: Label = battle.hud.get("_stage_timer_label") as Label
|
|
if info_lbl != null:
|
|
info_txt = info_lbl.text
|
|
if timer_lbl != null:
|
|
timer_txt = timer_lbl.text
|
|
if info_txt.is_empty():
|
|
_problems.append("battle top-right info label must not be empty")
|
|
|
|
# The platform injects safe-area insets into the battle HUD; without this
|
|
# chain the top bar renders under the Dynamic Island on a notched iPhone.
|
|
if battle != null:
|
|
battle.set_safe_area(59.0, 34.0)
|
|
var sa: Control = battle.hud.get("_safe_area") as Control
|
|
if sa == null or absf(sa.position.y - 59.0) > 0.5:
|
|
_problems.append("battle safe area top must follow injected inset")
|
|
var rects: Dictionary = battle.hud.get("_layout_rects")
|
|
var res_rect: Rect2 = rects.get("resource_bar", Rect2())
|
|
# Region rects are relative to the SafeArea control; its global top is
|
|
# the inset, so the bar's global y is inset + relative y.
|
|
var global_y := sa.position.y + res_rect.position.y
|
|
if absf(global_y - 59.0) > 0.5:
|
|
_problems.append("battle resource bar global top must equal safe inset")
|
|
battle.set_safe_area(0.0, 0.0)
|
|
|
|
# Leaving battle must explain itself (owner: "did it exit or what?").
|
|
var exit_btn: Button = battle.hud.get("_exit_button") as Button
|
|
if exit_btn == null or exit_btn.text.is_empty():
|
|
_problems.append("battle must expose a labeled exit button")
|
|
shell._on_battle_exit_requested("expedition")
|
|
await process_frame
|
|
var toast: Label = shell.get("_toast_label") as Label
|
|
if toast == null or not toast.text.contains(UiText.t("hud.exit.notice", shell.locale)):
|
|
_problems.append("leaving battle must show an explanatory toast")
|
|
|
|
var payload := {"problems": _problems, "button_filter": btn.mouse_filter,
|
|
"battle_info_text": info_txt, "battle_timer_text": timer_txt,
|
|
"panel_filter": panel.mouse_filter, "grid_ok": grid_ok}
|
|
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()
|
|
print("UI_SCROLL_LAYOUT %s" % JSON.stringify(payload))
|
|
if _problems.is_empty():
|
|
print("UI_SCROLL_LAYOUT_PASS")
|
|
else:
|
|
print("UI_SCROLL_LAYOUT_FAIL")
|
|
quit(0 if _problems.is_empty() else 1)
|