feat(ux): T2 节点图标组接线——五键量化过复用闸四道+load_tex 守卫接线+字形退役(缺位回退)
This commit is contained in:
1 parent
9a79927b05
commit
4ece929315
5 files changed
+91
-12
No files matched your search
@@ -73,7 +73,7 @@ COLD_PASSAGE = (112, 120, 128) # S3 换层通道冷调(underdark 方向——
|
||||
NODE_KEYS = ["battle", "reward", "rest", "boss", "shop"]
|
||||
NODE_ICONS = {"battle": "bow.png", "reward": "award.png", "rest": "campfire.png",
|
||||
"boss": "crown_b.png", "shop": "pouch.png"} # T1 挑选(语义近似;闸④全 CC0)
|
||||
ICON_PX = 22 # 节点图标边长(52×36 方块内 22px 图标+右下 10px 编号)
|
||||
ICON_PX = 20 # 节点图标边长(52×36 方块内 20px 图标+右上编号——冻结值,与 quantize 烘焙同值)
|
||||
NODE_HALF = (26, 18) # 节点方块半宽高(与 level_map_screen.gd 同源解析对表)
|
||||
CANVAS_MIN = (620, 240) # 画布下限(同源)
|
||||
W_PASS, W_LIT, W_HOVER = 2, 3, 4 # 通道折线宽(未lit/lit/悬停——冻结值)
|
||||
@@ -202,8 +202,14 @@ def fit_content(nodes):
|
||||
return size, layer, slot
|
||||
|
||||
|
||||
# ══ 图标装载(kenney CC0 64px → WARM 单色重着色 → NEAREST 缩放) ══
|
||||
# ══ 图标装载(优先烘焙终稿 game/assets/art/ui/node_*.png(quantize 产出,20px 1:1);
|
||||
# 缺位回退 kenney 64px 现场量化——同 WARM 单色+NEAREST,与烘焙产物逐像素同构) ══
|
||||
def load_icon(kind):
|
||||
for base in (ROOT, MAIN_ROOT):
|
||||
p = os.path.join(base, "game", "assets", "art", "ui", "node_%s.png" % kind)
|
||||
if os.path.exists(p):
|
||||
im = Image.open(p).convert("RGBA")
|
||||
return im if im.size == (ICON_PX, ICON_PX) else im.resize((ICON_PX, ICON_PX), Image.NEAREST)
|
||||
im = Image.open(asset_root(*(ICON_DIR + (NODE_ICONS[kind],)))).convert("RGBA")
|
||||
px = im.load()
|
||||
for y in range(im.size[1]):
|
||||
@@ -329,8 +335,8 @@ def draw_screen(nodes, title, level_name, gp, visited, current, cands, hover=-1,
|
||||
img.alpha_composite(icon, (ic_x, ic_y))
|
||||
num = str(nid)
|
||||
nb = d.textbbox((0, 0), num, font=F_NODE_NUM)
|
||||
nx = x1 - 4 - (nb[2] - nb[0])
|
||||
ny = y1 - 3 - (nb[3] - nb[1])
|
||||
nx = x1 - 4 - (nb[2] - nb[0]) # 右对齐至方块右内缘 -4(与引擎 HORIZONTAL_ALIGNMENT_RIGHT 同位)
|
||||
ny = y0 + 1 # 右上角——与图标占位区零重叠(L7)
|
||||
d.text((nx - nb[0], ny - nb[1]), num, font=F_NODE_NUM, fill=ink)
|
||||
records["nodes"][nid] = {
|
||||
"state": state, "type": n["type"], "block": (x0, y0, x1, y1),
|
||||
|
||||
Reference in new issue
Block a user