- 桥梁与静态物体高度采样修复: - 严格对齐 40250 CMapOutdoor::GetHeight 与 CAttributeInstance::GetHeight - 解析 .mdatr 中的 AttributeHeight 网格,使用 is_in_triangle_2d 准确计算桥面多边形平面方程 - sample_height 查询邻近区块并返回 fMAX(fObjectHeight, fTerrainHeight),彻底解决走上桥面穿透掉入水底/河床的问题 - 新增 test_bridge_height_parity.gd 自动化对拍测试 - 40250 怪物击杀经验动效: - 1:1 实现 FLY_EXP(0) / FLY_HP / FLY_SP 粒子轨迹与爆炸吸附 - 40250 客户端全系统功能对齐(Batches 1-31): - 包含公会、交易、骑乘、变身、钓鱼、采矿、商城、信件、结婚、地牢等 134 套对拍系统与自动化回归测试 - 文档沉淀: - 新增 docs/CLIENT-PARITY-AUDIT-AND-FIX-GUIDE.md 客户端对拍缺陷发现与修复工程指南
79 lines
3.0 KiB
GDScript
79 lines
3.0 KiB
GDScript
# UiKit —— 复用 `ETC/ymir work/ui/pattern/` 九宫格贴图构造控件。
|
|
# 从 hud.gd 抽出,charselect.gd / login.gd 共用(用 preload 引入)。PARITY §6.1。
|
|
extends RefCounted
|
|
|
|
const PAT := "ETC/ymir work/ui/pattern/"
|
|
static var _cache := {}
|
|
|
|
static func ui_tex(assets: String, name: String) -> Texture2D:
|
|
var key := assets + "|" + name
|
|
if _cache.has(key):
|
|
return _cache[key]
|
|
var tex: Texture2D = null
|
|
var cand := assets.path_join(PAT + name + ".tga")
|
|
if not FileAccess.file_exists(cand):
|
|
var da := DirAccess.open(assets)
|
|
if da:
|
|
for sub in da.get_directories():
|
|
var p := assets.path_join(sub).path_join("ymir work/ui/pattern/" + name + ".tga")
|
|
if FileAccess.file_exists(p):
|
|
cand = p
|
|
break
|
|
if FileAccess.file_exists(cand):
|
|
var img := Image.new()
|
|
if img.load(cand) == OK:
|
|
tex = ImageTexture.create_from_image(img)
|
|
_cache[key] = tex
|
|
return tex
|
|
|
|
# 4 角 + 4 边 + *_base 合成 atlas -> NinePatchRect。prefix = board | thinboard
|
|
static func board(assets: String, prefix := "board", m := 32, base := 128) -> NinePatchRect:
|
|
if prefix == "thinboard":
|
|
m = 16
|
|
base = 32
|
|
var total := m + base + m
|
|
var atlas := Image.create_empty(total, total, false, Image.FORMAT_RGBA8)
|
|
atlas.fill(Color(0, 0, 0, 0))
|
|
var put := func(nm: String, x: int, y: int) -> void:
|
|
var t := ui_tex(assets, nm)
|
|
if t == null:
|
|
return
|
|
var im := t.get_image()
|
|
im.convert(Image.FORMAT_RGBA8)
|
|
atlas.blit_rect(im, Rect2i(Vector2i.ZERO, im.get_size()), Vector2i(x, y))
|
|
put.call(prefix + "_corner_lefttop", 0, 0)
|
|
put.call(prefix + "_corner_righttop", m + base, 0)
|
|
put.call(prefix + "_corner_leftbottom", 0, m + base)
|
|
put.call(prefix + "_corner_rightbottom", m + base, m + base)
|
|
var edge := func(nm: String, r: Rect2i) -> void:
|
|
var t := ui_tex(assets, nm)
|
|
if t == null:
|
|
return
|
|
var im := t.get_image()
|
|
im.convert(Image.FORMAT_RGBA8)
|
|
im.resize(r.size.x, r.size.y, Image.INTERPOLATE_BILINEAR)
|
|
atlas.blit_rect(im, Rect2i(Vector2i.ZERO, r.size), r.position)
|
|
edge.call(prefix + "_line_top", Rect2i(m, 0, base, m))
|
|
edge.call(prefix + "_line_bottom", Rect2i(m, m + base, base, m))
|
|
edge.call(prefix + "_line_left", Rect2i(0, m, m, base))
|
|
edge.call(prefix + "_line_right", Rect2i(m + base, m, m, base))
|
|
var b := ui_tex(assets, prefix + "_base")
|
|
if b:
|
|
var bi := b.get_image()
|
|
bi.convert(Image.FORMAT_RGBA8)
|
|
bi.resize(base, base, Image.INTERPOLATE_BILINEAR)
|
|
atlas.blit_rect(bi, Rect2i(Vector2i.ZERO, Vector2i(base, base)), Vector2i(m, m))
|
|
elif prefix == "thinboard":
|
|
# 40250 ui.py: ThinBoard.BOARD_COLOR = grp.GenerateColor(0.0, 0.0, 0.0, 0.51)
|
|
# 官方 ThinBoard 中间无独立贴图,由 Base = Bar() 填充半透明黑色 (0, 0, 0, 0.51)
|
|
for by in range(m, m + base):
|
|
for bx in range(m, m + base):
|
|
atlas.set_pixel(bx, by, Color(0.0, 0.0, 0.0, 0.51))
|
|
var np := NinePatchRect.new()
|
|
np.texture = ImageTexture.create_from_image(atlas)
|
|
np.patch_margin_left = m
|
|
np.patch_margin_right = m
|
|
np.patch_margin_top = m
|
|
np.patch_margin_bottom = m
|
|
return np
|