fix: 装备属性面板避让逻辑 + 多项功能更新

- item_tooltip_view.gd: 新增 avoid_rect 属性,tooltip 与装备窗口重叠时自动推到左侧
- inventory_ui.gd: 悬停装备时传入窗口矩形作为避让区域
- 包含其他累积的功能开发和测试文件
This commit is contained in:
shen
2026-09-21 16:38:59 -07:00
parent 1522a8a1a1
commit c93894313a
5498 changed files with 4558004 additions and 1442 deletions
+29 -1
View File
@@ -48,6 +48,7 @@ class MockClient extends Node:
var quickslot_adds := []
var quickslot_dels := []
var quickslot_swaps := []
var auto_confirm_quickslots := true
var chat_messages := []
func _init() -> void:
@@ -89,7 +90,7 @@ class MockClient extends Node:
used_skills.append({"skill_id": skill_id, "target_vid": target_vid})
return true
func cast_skill(motion_idx: int, rot_deg: float, x: int, y: int) -> bool:
func cast_skill(motion_idx: int, rot_deg: float, x: int, y: int, _arg: int = 0) -> bool:
cast_skills.append({"motion_idx": motion_idx, "rot_deg": rot_deg, "x": x, "y": y})
return true
@@ -103,19 +104,32 @@ class MockClient extends Node:
func quickslot_add(pos: int, type: int, ref: int) -> bool:
quickslot_adds.append({"pos": pos, "type": type, "ref": ref})
if not auto_confirm_quickslots:
return true
quickslots[pos] = {"pos": pos, "type": type, "ref": ref}
# Simulate GC_QUICKSLOT_ADD rather than making Quickbar trust the request
# return value as local authority.
quickslots_changed.emit()
return true
func quickslot_del(pos: int) -> bool:
quickslot_dels.append(pos)
if not auto_confirm_quickslots:
return true
quickslots[pos] = {"pos": pos, "type": 0, "ref": 0}
quickslots_changed.emit()
return true
func quickslot_swap(pos: int, pos_to: int) -> bool:
quickslot_swaps.append({"from": pos, "to": pos_to})
if not auto_confirm_quickslots:
return true
var tmp: Dictionary = quickslots[pos]
quickslots[pos] = quickslots[pos_to]
quickslots[pos_to] = tmp
quickslots[pos]["pos"] = pos
quickslots[pos_to]["pos"] = pos_to
quickslots_changed.emit()
return true
func say(_type: int, text: String) -> bool:
@@ -509,5 +523,19 @@ func _test_quickbar_persistence() -> void:
_check(qb._state[2].kind == "emote" and qb._state[2].id == 1, "Restored slot 2 is Emote 1")
_check(qb._state[3].kind == "", "Restored slot 3 is empty")
# Request/GC ordering: an accepted request is not local authority until the
# corresponding GC_QUICKSLOT_* update arrives.
client.auto_confirm_quickslots = false
var before_kind := String(qb._state[0].kind)
var before_id := int(qb._state[0].id)
_check(qb.assign(0, "item", 12), "Delayed quickslot add request is accepted")
_check(qb._state[0].kind == before_kind and int(qb._state[0].id) == before_id,
"Delayed add does not change local slot before GC_QUICKSLOT_ADD")
client.quickslots[0] = {"pos": 0, "type": 1, "ref": 12}
client.quickslots_changed.emit()
_check(qb._state[0].kind == "item" and int(qb._state[0].id) == 12,
"GC_QUICKSLOT_ADD refreshes the local slot")
client.auto_confirm_quickslots = true
qb.queue_free()
client.queue_free()