59 lines
2.6 KiB
GDScript
59 lines
2.6 KiB
GDScript
# VERTICAL SLICE - NOT FOR PRODUCTION
|
||
# Date: 2026-09-13(四区布局诊断探针——"内容未满幅/棋盘底裁切"回归定位:打印窗口/视口/四区实际矩形
|
||
# 与最小尺寸、展开旗标,对照 battle.md §Layout 1280×800 基座规格)
|
||
# 运行:Godot_console.exe --headless --path . res://smoke/ui_layout_probe.tscn
|
||
extends Node
|
||
|
||
|
||
func _ready() -> void:
|
||
await get_tree().process_frame # autoload 就绪
|
||
var main = load("res://presentation/main.tscn").instantiate()
|
||
add_child(main)
|
||
await get_tree().process_frame
|
||
# 存档隔离(迭代 8 卡①②——停点断点写盘随 main.save_manager;探针禁碰真实档,同族探针隔离纪律)
|
||
for p0 in ["user://smoke_layout_probe_save.json", "user://smoke_layout_probe_save.json.tmp"]:
|
||
if FileAccess.file_exists(p0):
|
||
DirAccess.remove_absolute(p0) # 段首清场——上次运行的残留断点会触发互斥确认早退
|
||
var iso = load("res://core/save_manager.gd").new("user://smoke_layout_probe_save.json")
|
||
iso.load_from_disk()
|
||
iso.mark_first_adventure_done()
|
||
main.save_manager = iso
|
||
main.meta = load("res://core/meta_progression.gd").new(main.db, iso)
|
||
main._refresh_resume_button()
|
||
main._start_adventure_from_menu()
|
||
for i in range(3):
|
||
await get_tree().process_frame
|
||
var win := get_window()
|
||
print("window.size=%s pos=%s mode=%s" % [win.size, win.position, win.mode])
|
||
print("viewport.visible_rect=%s" % get_viewport().get_visible_rect())
|
||
print("main.size=%s" % main.size)
|
||
for c in main.get_children():
|
||
if c is Control:
|
||
_dump_ctrl(c, 0)
|
||
var zones := {
|
||
"board_zone": main.board_zone, "board_view": main.board_view,
|
||
"info_panel": main.info_panel,
|
||
"stage": main.stage,
|
||
}
|
||
for k in zones:
|
||
var ctl: Control = zones[k]
|
||
if ctl == null:
|
||
print("%s = null" % k)
|
||
continue
|
||
print("%-16s pos=%s size=%s min=%s hflag=%d vflag=%d" % [k, ctl.position, ctl.size,
|
||
ctl.custom_minimum_size, ctl.size_flags_horizontal, ctl.size_flags_vertical])
|
||
var root_box: Control = main.get_child(0)
|
||
print("four-zone root: anchors=(%s,%s)-(%s,%s) offsets=(%s,%s,%s,%s) size=%s" % [
|
||
root_box.anchor_left, root_box.anchor_top, root_box.anchor_right, root_box.anchor_bottom,
|
||
root_box.offset_left, root_box.offset_top, root_box.offset_right, root_box.offset_bottom, root_box.size])
|
||
print("board_view cell_size=%s board=%s" % [main.board_view.get("cell_size"), main.board_view.board()])
|
||
get_tree().quit(0)
|
||
|
||
|
||
func _dump_ctrl(c: Control, depth: int) -> void:
|
||
var ind := " ".repeat(depth)
|
||
print("%s%s pos=%s size=%s min=%s" % [ind, c.name, c.position, c.size, c.custom_minimum_size])
|
||
for ch in c.get_children():
|
||
if ch is Control:
|
||
_dump_ctrl(ch, depth + 1)
|