Additive UI vertical slice on baseline 28e8247. Owned scope only: page
shells, PrimaryCTADock, UiTheme helpers, U1 probe/capture runner and
evidence. No battle, numeric, save or locale files touched.
48 real-render shots: 360/390/430 x zh/en x normal/reduced, plus
scrolled/locked/defeat states. Real InputEventScreenTouch fires the CTA
and changes world node selection; >=48px tap targets, fixed CTA position
across scroll, no missing text keys, no SCRIPT ERROR.
185 lines
5.6 KiB
GDScript
185 lines
5.6 KiB
GDScript
extends SceneTree
|
|
|
|
## Focused U1 probe: import + real ScreenTouch on the fixed primary CTA.
|
|
## Deliberately small so a broken theme/script is caught before the full matrix.
|
|
|
|
var _fired: bool = false
|
|
|
|
|
|
func _init() -> void:
|
|
_run.call_deferred()
|
|
|
|
|
|
func _on_cta() -> void:
|
|
_fired = true
|
|
|
|
|
|
func _tap(pos: Vector2) -> void:
|
|
var down := InputEventScreenTouch.new()
|
|
down.index = 2
|
|
down.position = pos
|
|
down.pressed = true
|
|
Input.parse_input_event(down)
|
|
await process_frame
|
|
var up := InputEventScreenTouch.new()
|
|
up.index = 2
|
|
up.position = pos
|
|
up.pressed = false
|
|
Input.parse_input_event(up)
|
|
await process_frame
|
|
|
|
|
|
func _drag(from: Vector2, delta: Vector2, steps: int) -> void:
|
|
var down := InputEventScreenTouch.new()
|
|
down.index = 3
|
|
down.position = from
|
|
down.pressed = true
|
|
Input.parse_input_event(down)
|
|
await process_frame
|
|
for i in range(steps):
|
|
var drag := InputEventScreenDrag.new()
|
|
drag.index = 3
|
|
drag.position = from + delta * float(i + 1) / float(steps)
|
|
drag.relative = delta / float(steps)
|
|
Input.parse_input_event(drag)
|
|
await process_frame
|
|
var up := InputEventScreenTouch.new()
|
|
up.index = 3
|
|
up.position = from + delta
|
|
up.pressed = false
|
|
Input.parse_input_event(up)
|
|
await process_frame
|
|
|
|
|
|
func _mouse_drag(from: Vector2, delta: Vector2, steps: int) -> void:
|
|
var down := InputEventMouseButton.new()
|
|
down.button_index = MOUSE_BUTTON_LEFT
|
|
down.pressed = true
|
|
down.position = from
|
|
Input.parse_input_event(down)
|
|
await process_frame
|
|
for i in range(steps):
|
|
var motion := InputEventMouseMotion.new()
|
|
motion.position = from + delta * float(i + 1) / float(steps)
|
|
motion.relative = delta / float(steps)
|
|
motion.button_mask = MOUSE_BUTTON_MASK_LEFT
|
|
Input.parse_input_event(motion)
|
|
await process_frame
|
|
var up := InputEventMouseButton.new()
|
|
up.button_index = MOUSE_BUTTON_LEFT
|
|
up.pressed = false
|
|
up.position = from + delta
|
|
Input.parse_input_event(up)
|
|
await process_frame
|
|
|
|
|
|
func _pan(from: Vector2, delta: Vector2, steps: int) -> void:
|
|
for _i in range(steps):
|
|
var pan := InputEventPanGesture.new()
|
|
pan.position = from
|
|
pan.delta = delta
|
|
Input.parse_input_event(pan)
|
|
await process_frame
|
|
|
|
|
|
func _wait_frames(count: int) -> void:
|
|
for _index in range(count):
|
|
await process_frame
|
|
await RenderingServer.frame_post_draw
|
|
|
|
|
|
func _run() -> void:
|
|
await process_frame
|
|
var size := Vector2i(390, 844)
|
|
root.content_scale_mode = Window.CONTENT_SCALE_MODE_CANVAS_ITEMS
|
|
root.content_scale_size = size
|
|
root.size = size
|
|
await process_frame
|
|
await process_frame
|
|
|
|
var shell = load("res://scripts/ui_slice_shell.gd").new()
|
|
root.add_child(shell)
|
|
await process_frame
|
|
shell.set_locale("zh_CN")
|
|
shell.set_reduced_motion(false)
|
|
shell.set_safe_area(24, 34)
|
|
shell.show_page("skyport", "normal")
|
|
await process_frame
|
|
await process_frame
|
|
|
|
shell.cta_pressed.connect(_on_cta)
|
|
var cta_rect: Rect2 = shell.dock_rect()
|
|
print("UI_SLICE_PROBE cta_rect=", cta_rect)
|
|
|
|
var down := InputEventScreenTouch.new()
|
|
down.index = 1
|
|
down.position = cta_rect.position + cta_rect.size * 0.5
|
|
down.pressed = true
|
|
Input.parse_input_event(down)
|
|
await process_frame
|
|
var up := InputEventScreenTouch.new()
|
|
up.index = 1
|
|
up.position = down.position
|
|
up.pressed = false
|
|
Input.parse_input_event(up)
|
|
await process_frame
|
|
|
|
var tiny: Array = []
|
|
var targets: Dictionary = shell.tap_targets()
|
|
for key in targets.keys():
|
|
var control := targets[key] as Control
|
|
var rect: Rect2 = control.get_global_rect()
|
|
if rect.size.x < 48.0 or rect.size.y < 48.0:
|
|
tiny.append("%s(%dx%d)" % [key, rect.size.x, rect.size.y])
|
|
print("UI_SLICE_PROBE fired=", _fired)
|
|
print("UI_SLICE_PROBE tiny_targets=", tiny)
|
|
print("UI_SLICE_PROBE missing_keys=", UiText.missing_keys())
|
|
|
|
# World token: real ScreenTouch must change the selected node.
|
|
shell.show_page("world", "normal")
|
|
await _wait_frames(3)
|
|
var wp: Control = shell.get("_pages")["world"] as Control
|
|
print("UI_SLICE_PROBE world_page_rect=", wp.get_global_rect())
|
|
for child in wp.get_children():
|
|
if child is Control:
|
|
print("UI_SLICE_PROBE world_child ", child.get_class(), " ", child.get_global_rect())
|
|
var world_targets: Dictionary = shell.tap_targets()
|
|
for k in ["world_region_R1","world_region_R4","world_region_R5"]:
|
|
print("UI_SLICE_PROBE ", k, " ", (world_targets[k] as Control).get_global_rect())
|
|
var token: Control = world_targets["world_node_R1-C01-N03"] as Control
|
|
var token_rect: Rect2 = token.get_global_rect()
|
|
var node_before: String = shell.selected_node()
|
|
await _tap(token_rect.position + token_rect.size * 0.5)
|
|
var node_after: String = shell.selected_node()
|
|
print("UI_SLICE_PROBE token_rect=", token_rect, " node=", node_before, "->", node_after)
|
|
|
|
# Skyport scroll: real ScreenDrag must move the ScrollContainer.
|
|
shell.show_page("skyport", "normal")
|
|
await _wait_frames(3)
|
|
var sc: ScrollContainer = shell.scroll_container()
|
|
var scroll_before := sc.scroll_vertical
|
|
print("UI_SLICE_PROBE sc_rect=", sc.get_global_rect(),
|
|
" vbar_max=", sc.get_v_scroll_bar().max_value,
|
|
" filter=", sc.mouse_filter)
|
|
await _drag(Vector2(195, 520), Vector2(0, -220), 10)
|
|
await _wait_frames(4)
|
|
print("UI_SLICE_PROBE scroll=", scroll_before, "->", sc.scroll_vertical)
|
|
sc.scroll_vertical = 0
|
|
await _mouse_drag(Vector2(195, 520), Vector2(0, -220), 10)
|
|
await _wait_frames(4)
|
|
print("UI_SLICE_PROBE mouse_scroll=", sc.scroll_vertical)
|
|
sc.scroll_vertical = 0
|
|
await _pan(Vector2(195, 520), Vector2(0, 12), 4)
|
|
await _wait_frames(4)
|
|
print("UI_SLICE_PROBE pan_scroll=", sc.scroll_vertical)
|
|
|
|
var ok: bool = (_fired and tiny.is_empty() and cta_rect.size.y >= 56.0
|
|
and node_after != node_before and sc.scroll_vertical > scroll_before)
|
|
root.remove_child(shell)
|
|
shell.free()
|
|
if ok:
|
|
print("UI_SLICE_PROBE_PASS")
|
|
else:
|
|
print("UI_SLICE_PROBE_FAIL")
|
|
quit(0 if ok else 1)
|