- item_tooltip_view.gd: 新增 avoid_rect 属性,tooltip 与装备窗口重叠时自动推到左侧 - inventory_ui.gd: 悬停装备时传入窗口矩形作为避让区域 - 包含其他累积的功能开发和测试文件
58 lines
2.3 KiB
GDScript
58 lines
2.3 KiB
GDScript
# item_action_sound_parity_test —— 40250 item use/move 音效事件基线。
|
|
extends SceneTree
|
|
|
|
var _fail := 0
|
|
|
|
class FakeProto extends RefCounted:
|
|
func item_count() -> int:
|
|
return 8
|
|
|
|
func item(vnum: int) -> Dictionary:
|
|
match vnum:
|
|
1: return {"type": 1, "sub_type": 0} # sword
|
|
2: return {"type": 1, "sub_type": 2} # bow
|
|
3: return {"type": 1, "sub_type": 6} # arrow
|
|
4: return {"type": 2, "sub_type": 0} # body armor
|
|
5: return {"type": 2, "sub_type": 5} # necklace
|
|
6: return {"type": 3, "sub_type": 7} # ability-up potion
|
|
7: return {"type": 3, "sub_type": 0} # regular potion: no use sound
|
|
8: return {"type": 3, "sub_type": 1} # talisman
|
|
return {}
|
|
|
|
func _ck(condition: bool, message: String) -> void:
|
|
if not condition:
|
|
_fail += 1
|
|
printerr("FAIL: " + message)
|
|
|
|
func _init() -> void:
|
|
var client := M2Client.new()
|
|
var proto := FakeProto.new()
|
|
client.set_item_proto(proto)
|
|
_ck(client.has_signal("item_action_sound"),
|
|
"native item sender exposes the item_action_sound event")
|
|
_ck(client.has_method("item_action_sound_for_item"),
|
|
"native item sender exposes the item_proto sound classifier")
|
|
_ck(client.item_action_sound_for_item(1, false) == "equip_metal_weapon.wav",
|
|
"weapon use selects equip_metal_weapon.wav")
|
|
_ck(client.item_action_sound_for_item(2, false) == "equip_bow.wav" and
|
|
client.item_action_sound_for_item(2, true) == "equip_bow.wav",
|
|
"bow use/drop selects equip_bow.wav")
|
|
_ck(client.item_action_sound_for_item(3, false) == "drop.wav",
|
|
"arrow use selects the default drop.wav")
|
|
_ck(client.item_action_sound_for_item(4, false) == "equip_metal_armor.wav" and
|
|
client.item_action_sound_for_item(5, true) == "equip_ring_amulet.wav",
|
|
"body/accessory armor selects the reference sounds")
|
|
_ck(client.item_action_sound_for_item(6, false) == "eat_potion.wav" and
|
|
client.item_action_sound_for_item(8, false) == "potal_scroll.wav",
|
|
"ability-up/talisman selects potion/portal sounds")
|
|
_ck(client.item_action_sound_for_item(7, false).is_empty(),
|
|
"regular USE_POTION has no CPythonItem use sound")
|
|
_ck(client.item_action_sound_for_item(999, false).is_empty(),
|
|
"unknown vnum does not emit an item sound")
|
|
if _fail == 0:
|
|
print("PASS: item_action_sound_parity_test")
|
|
quit(0)
|
|
else:
|
|
printerr("%d check(s) failed" % _fail)
|
|
quit(1)
|