fix: 装备属性面板避让逻辑 + 多项功能更新
- item_tooltip_view.gd: 新增 avoid_rect 属性,tooltip 与装备窗口重叠时自动推到左侧 - inventory_ui.gd: 悬停装备时传入窗口矩形作为避让区域 - 包含其他累积的功能开发和测试文件
This commit is contained in:
@@ -47,7 +47,8 @@ func _check_motion_resolution() -> void:
|
||||
_ck(mv.get_motion_path("dead") == "", "缺死亡动作时不能解析成 WAIT")
|
||||
mv._motions = {"WAIT": "wait.msa", "WALK": "walk.msa"}
|
||||
var alias: Dictionary = mv.resolve_motion("run")
|
||||
_ck(alias.get("path") == "walk.msa" and alias.get("fallback_reason") == "client_alias:WALK", "run -> WALK 标注别名回退")
|
||||
_ck(alias.get("path") == "" and alias.get("fallback_reason") == "reference_keep_current_motion",
|
||||
"缺 RUN 时不能把 WALK 当作 RUN")
|
||||
mv._motions = {"WAIT": "wait.msa"}
|
||||
var anim := FakeAnim.new()
|
||||
mv.anim = anim
|
||||
@@ -99,9 +100,66 @@ func _check_move_speed() -> void:
|
||||
DirAccess.remove_absolute(ProjectSettings.globalize_path(run_p))
|
||||
_move_speed_done = true
|
||||
|
||||
func _check_motlist_registry() -> void:
|
||||
var root := ProjectSettings.globalize_path("user://mob_motion_registry_test")
|
||||
DirAccess.make_dir_recursive_absolute(root)
|
||||
var body := "GENERAL WAIT wait.msa 60\n" + \
|
||||
"GENERAL WAIT1 wait1.msa 20\n" + \
|
||||
"GENERAL WAIT3 wait3.msa 20\n" + \
|
||||
"GENERAL WALK walk.msa 100\n" + \
|
||||
"GENERAL COMBO_ATTACK combo1.msa 100\n" + \
|
||||
"GENERAL COMBO_ATTACK1 combo2.msa 100\n" + \
|
||||
"GENERAL NORMAL_ATTACK normal.msa 100\n" + \
|
||||
"GENERAL FRONT_DAMAGE front.msa 40\n" + \
|
||||
"GENERAL DAMAGE unknown.msa 100\n" + \
|
||||
"GENERAL FRONT_DAMAGE2 front2.msa 37\n"
|
||||
for file in ["wait.msa", "wait1.msa", "wait3.msa", "walk.msa", "combo1.msa",
|
||||
"combo2.msa", "normal.msa", "front.msa", "unknown.msa", "front2.msa"]:
|
||||
var f := FileAccess.open(root.path_join(file), FileAccess.WRITE)
|
||||
f.store_string("")
|
||||
f.close()
|
||||
var motlist := root.path_join("motlist_range.txt")
|
||||
var mf := FileAccess.open(motlist, FileAccess.WRITE)
|
||||
mf.store_string(body)
|
||||
mf.close()
|
||||
var msm := FileAccess.open(root.path_join("range.msm"), FileAccess.WRITE)
|
||||
msm.store_string("MotionListFileName \"motlist_range.txt\"\n")
|
||||
msm.close()
|
||||
|
||||
var mv: Node3D = MobView.new()
|
||||
mv._dir = root
|
||||
var selected_list: String = mv._motion_list_for_dir(root, "range")
|
||||
_ck(selected_list == motlist, "MSM MotionListFileName 优先于固定 motlist.txt")
|
||||
mv._load_motlist(selected_list)
|
||||
_ck(mv._motlist_loaded and mv._motion_variants.has(1), "加载 NPC motlist 注册表")
|
||||
var waits: Array = mv._motion_variants[1]
|
||||
_ck(waits.size() == 3 and int(waits[0].weight) == 60 and int(waits[1].weight) == 20 and
|
||||
int(waits[2].weight) == 20, "WAIT/WAIT1/WAIT3 归并到同一索引并保留权重")
|
||||
_ck(not mv._motion_variants.has(33), "未注册 SPECIAL 不凭空生成技能动作")
|
||||
_ck(not mv._motion_variants.has(0) and not mv._motions.has("DAMAGE"),
|
||||
"未知 DAMAGE 不注册到动作表")
|
||||
_ck(mv._motion_variants.has(14) and mv._motion_variants[14].size() == 1 and
|
||||
mv._motion_variants.has(15) and mv._motion_variants[15].size() == 1,
|
||||
"COMBO_ATTACK 与 COMBO_ATTACK1 使用不同动作索引")
|
||||
var wait: Dictionary = mv.resolve_motion("wait")
|
||||
_ck(String(wait.path) in [root.path_join("wait.msa"), root.path_join("wait1.msa"), root.path_join("wait3.msa")],
|
||||
"WAIT 从注册 vector 中按权重选择")
|
||||
var run: Dictionary = mv.resolve_motion("run")
|
||||
_ck(run.path == "" and run.fallback_reason == "reference_keep_current_motion",
|
||||
"缺 RUN 注册时保持当前动作")
|
||||
_ck(mv._motion_variants.has(25) and mv._motion_variants[25][0].path == root.path_join("front2.msa") and
|
||||
int(mv._motion_variants[25][0].weight) == 37,
|
||||
"缺 SPAWN 时复用最后一条 DAMAGE 资源及解析出的权重")
|
||||
mv.free()
|
||||
for file in ["range.msm", "motlist_range.txt", "wait.msa", "wait1.msa", "wait3.msa", "walk.msa",
|
||||
"combo1.msa", "combo2.msa", "normal.msa", "front.msa", "unknown.msa", "front2.msa"]:
|
||||
DirAccess.remove_absolute(root.path_join(file))
|
||||
DirAccess.remove_absolute(root)
|
||||
|
||||
func _run() -> void:
|
||||
_check_motion_resolution()
|
||||
_check_move_speed()
|
||||
_check_motlist_registry()
|
||||
_ck(_move_speed_done, "移动速度断言全部执行")
|
||||
# 脚本运行时错误只会中止函数、不计失败;用哨兵保证整段断言都执行过。
|
||||
_ck(_resolution_done, "动作解析断言全部执行")
|
||||
|
||||
Reference in New Issue
Block a user