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
+38 -7
View File
@@ -119,6 +119,7 @@ var _quest_showing_start_index := 0
func setup(ui_manager: CanvasLayer, m2client: Node, assets := "", st_table: RefCounted = null, imouse: Node = null) -> void:
ui = ui_manager
client = m2client
set_process(true)
assets_root = assets
if imouse != null:
item_mouse = imouse
@@ -1083,7 +1084,7 @@ func _refresh_quests() -> void:
var counter_name := String(q.get("counter_name", ""))
var counter_val := int(q.get("counter_value", 0))
var clock_name := String(q.get("clock_name", ""))
var clock_val := int(q.get("clock_value", 0))
var clock_val := _quest_remaining(q)
if nm_node:
nm_node.visible = true
@@ -1106,12 +1107,7 @@ func _refresh_quests() -> void:
if time_node:
time_node.visible = true
if clock_name != "" and clock_val > 0:
var m := clock_val / 60
var s := clock_val % 60
time_node.text = "%s %02d:%02d" % [clock_name, m, s]
else:
time_node.text = ""
time_node.text = _format_quest_clock(clock_name, clock_val)
if cell:
cell.mouse_filter = Control.MOUSE_FILTER_PASS
@@ -1136,6 +1132,41 @@ func _refresh_quests() -> void:
for conn in cell.gui_input.get_connections():
cell.gui_input.disconnect(conn["callable"])
func _process(_delta: float) -> void:
if is_open() and _state == "QUEST":
_update_quest_clocks()
func _quest_remaining(q: Dictionary) -> int:
var value := maxi(0, int(q.get("clock_value", 0)))
if not q.has("clock_start_ms"):
return value
var start_ms := int(q.get("clock_start_ms", 0))
var elapsed_ms := maxi(0, Time.get_ticks_msec() - start_ms)
return maxi(0, value - int(elapsed_ms / 1000))
func _format_quest_clock(clock_name: String, clock_value: int) -> String:
if clock_name == "" or clock_value <= 0:
return ""
var minutes := clock_value / 60
var seconds := clock_value % 60
return "%s %02d:%02d" % [clock_name, minutes, seconds]
func _update_quest_clocks() -> void:
if client == null:
return
var quests: Array = []
if client.has_method("get_quests"):
for q in client.get_quests():
if String(q.get("title", q.get("name", ""))).strip_edges() != "":
quests.append(q)
for i in range(5):
var data_idx := _quest_showing_start_index + i
var time_node := _node("Quest_LastTime_0%d" % i)
if time_node == null or data_idx < 0 or data_idx >= quests.size():
continue
var q: Dictionary = quests[data_idx]
time_node.text = _format_quest_clock(String(q.get("clock_name", "")), _quest_remaining(q))
func _select_quest(quest_idx: int) -> void:
if client and client.has_method("script_button"):
# 40250 uicharacter.py:655 event.QuestButtonClick(-2147483648 + questIndex)