chore: commit leftover skin text keys + reenter-battle regression

Settings-page skin labels and the earlier palette-based skin generator were
left uncommitted from the parchment skin work. Also strengthens battle_exit_test
to assert re-entering battle restores a visible HUD layer (hiding must not be
permanent). 107 gates pass.
This commit is contained in:
2026-11-20 12:17:18 +08:00
parent 58fc81f95b
commit 5049ebec64
6 changed files with 108 additions and 4 deletions
+4 -1
View File
@@ -930,7 +930,10 @@
"shell.endless.step": "Advance Zone",
"shell.endless.run": "Auto Advance",
"shell.endless.upgrade": "Upgrade Heroes (+5 levels)",
"shell.endless.log": "Recent Zone Log"
"shell.endless.log": "Recent Zone Log",
"shell.settings.skin": "UI Skin",
"shell.settings.skin_name.default": "Default",
"shell.settings.skin_name.parchment": "Parchment"
},
"shell.interact.board_kill": "Purge: battle wins {prog}/{step}, pays 5 crystal ({avail} ready)",
"shell.interact.board_clear": "Advance: nodes cleared {prog}/{step}, pays 5 crystal ({avail} ready)",
+4 -1
View File
@@ -930,7 +930,10 @@
"shell.endless.step": "推进一区",
"shell.endless.run": "连续推进",
"shell.endless.upgrade": "升级英雄(+5级)",
"shell.endless.log": "最近区域记录"
"shell.endless.log": "最近区域记录",
"shell.settings.skin": "界面皮肤",
"shell.settings.skin_name.default": "默认",
"shell.settings.skin_name.parchment": "羊皮纸"
},
"shell.interact.board_kill": "清剿委托:战斗胜利 {prog}/{step},奖励 5 风晶({avail} 待领)",
"shell.interact.board_clear": "推进委托:通关节点 {prog}/{step},奖励 5 风晶({avail} 待领)",
+4 -1
View File
@@ -930,7 +930,10 @@
"shell.endless.step": "Advance Zone",
"shell.endless.run": "Auto Advance",
"shell.endless.upgrade": "Upgrade Heroes (+5 levels)",
"shell.endless.log": "Recent Zone Log"
"shell.endless.log": "Recent Zone Log",
"shell.settings.skin": "UI Skin",
"shell.settings.skin_name.default": "Default",
"shell.settings.skin_name.parchment": "Parchment"
},
"shell.interact.board_kill": "Purge: battle wins {prog}/{step}, pays 5 crystal ({avail} ready)",
"shell.interact.board_clear": "Advance: nodes cleared {prog}/{step}, pays 5 crystal ({avail} ready)",
+4 -1
View File
@@ -930,7 +930,10 @@
"shell.endless.step": "推进一区",
"shell.endless.run": "连续推进",
"shell.endless.upgrade": "升级英雄(+5级)",
"shell.endless.log": "最近区域记录"
"shell.endless.log": "最近区域记录",
"shell.settings.skin": "界面皮肤",
"shell.settings.skin_name.default": "默认",
"shell.settings.skin_name.parchment": "羊皮纸"
},
"shell.interact.board_kill": "清剿委托:战斗胜利 {prog}/{step},奖励 5 风晶({avail} 待领)",
"shell.interact.board_clear": "推进委托:通关节点 {prog}/{step},奖励 5 风晶({avail} 待领)",
@@ -64,6 +64,17 @@ func _run() -> void:
if _battle_hud_layer_visible(shell, battle):
_problems.append("tab %s: battle HUD layer still visible after exit" % page)
# Re-entering battle must build a FRESH visible HUD (hiding must not be
# permanent): otherwise the player could never see a fight again.
shell.start_node("R1-C01-N01")
await process_frame
await process_frame
var fresh := shell.get_battle()
var fresh_hud_visible := _battle_hud_layer_visible(shell, fresh)
_records.append({"stage": "reenter", "hud_layer_visible": fresh_hud_visible})
if not fresh_hud_visible:
_problems.append("re-entered battle HUD must be visible again")
var payload := {"records": _records, "problems": _problems}
var dir := ProjectSettings.globalize_path("res://artifacts")
DirAccess.make_dir_recursive_absolute(dir)
+81
View File
@@ -0,0 +1,81 @@
#!/usr/bin/env python3
"""Generate clean 48x48 nine-slice UI frames from a skin palette.
AI-generated frame art is beautiful but not a valid nine-slice (complex corner
ornaments smear when stretched). This builds STRUCTURALLY CORRECT 48x48 frames
using the same cut-corner geometry as the shipped frame, with colors sampled
from each AI skin. Output: panel/button/button_pressed/tab PNGs, 6px margin.
Usage: python3 gen_ui_skin.py <skin-name> <bg-r,g,b> <edge-r,g,b> <accent-r,g,b> <out-dir>
"""
import sys
from pathlib import Path
from PIL import Image
MARGIN = 6
SIZE = 48
def build_frame(bg, edge, accent, *, pressed=False, tab=False) -> Image.Image:
img = Image.new("RGBA", (SIZE, SIZE), (0, 0, 0, 0))
px = img.load()
# cut corners: transparent triangle in each 6x6 corner (same geometry as shipped)
def solid(x, y):
# corner cut: skip cells where x+y < MARGIN (top-left), etc.
if x < MARGIN and y < MARGIN and (x + y) < MARGIN - 1:
return False
if x >= SIZE - MARGIN and y < MARGIN and ((SIZE - 1 - x) + y) < MARGIN - 1:
return False
if x < MARGIN and y >= SIZE - MARGIN and (x + (SIZE - 1 - y)) < MARGIN - 1:
return False
if x >= SIZE - MARGIN and y >= SIZE - MARGIN and ((SIZE - 1 - x) + (SIZE - 1 - y)) < MARGIN - 1:
return False
return True
for y in range(SIZE):
for x in range(SIZE):
if not solid(x, y):
continue
in_border = x < MARGIN or x >= SIZE - MARGIN or y < MARGIN or y >= SIZE - MARGIN
if in_border:
# accent rivets at the 4 corner blocks
corner = ((x < MARGIN and y < MARGIN) or
(x >= SIZE - MARGIN and y < MARGIN) or
(x < MARGIN and y >= SIZE - MARGIN) or
(x >= SIZE - MARGIN and y >= SIZE - MARGIN))
c = accent if corner else edge
if pressed:
c = tuple(int(v * 0.8) for v in c)
px[x, y] = c + (255,)
else:
px[x, y] = bg + (255,)
# inner hairline (1px accent just inside border) for depth
for i in range(MARGIN, SIZE - MARGIN):
for p in ((i, MARGIN), (i, SIZE - MARGIN - 1), (MARGIN, i), (SIZE - MARGIN - 1, i)):
if solid(*p):
px[p] = accent + (255,)
return img
def main():
name = sys.argv[1]
bg = tuple(map(int, sys.argv[2].split(",")))
edge = tuple(map(int, sys.argv[3].split(",")))
accent = tuple(map(int, sys.argv[4].split(",")))
out = Path(sys.argv[5])
out.mkdir(parents=True, exist_ok=True)
specs = [
("ui_frame_panel.png", dict()),
("ui_frame_button.png", dict()),
("ui_frame_button_pressed.png", dict(pressed=True)),
("ui_frame_tab.png", dict(tab=True)),
]
for fn, kw in specs:
build_frame(bg, edge, accent, **kw).save(out / fn)
# contact sheet preview: panel scaled 4x
prev = build_frame(bg, edge, accent).resize((SIZE * 6, SIZE * 6), Image.NEAREST)
prev.save(out / "preview.png")
print(f"wrote {len(specs)} frames + preview to {out}")
if __name__ == "__main__":
main()