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
+19 -5
View File
@@ -179,6 +179,14 @@ func quest_start_index() -> int:
func visible_quest_indices() -> Array[int]:
return _visible_quest_indices.duplicate()
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 scroll_ratio() -> float:
if _quest_scrollbar == null or _quest_scrollbar.max_value <= 0.0:
return 0.0
@@ -233,7 +241,7 @@ func _render_quests() -> void:
var quest_index := int(q.get("index", -1))
var clock_name := String(q.get("clock_name", ""))
if quest_index >= 0 and clock_name != "":
_clock_remaining[quest_index] = maxi(0, int(q.get("clock_value", 0)))
_clock_remaining[quest_index] = _quest_remaining(q)
var box := VBoxContainer.new()
box.add_theme_constant_override("separation", 1)
box.mouse_filter = Control.MOUSE_FILTER_STOP
@@ -290,16 +298,22 @@ func _process(delta: float) -> void:
if shown != _party_shown:
_party_shown = shown
_refresh_quest_buttons()
if not is_open() or _clock_remaining.is_empty():
if _clock_remaining.is_empty():
return
_clock_accumulator += delta
if _clock_accumulator < 1.0:
return
var elapsed := int(_clock_accumulator)
_clock_accumulator -= float(elapsed)
for quest_index in _clock_remaining.keys():
_clock_remaining[quest_index] = maxi(0, int(_clock_remaining[quest_index]) - elapsed)
if _clock_labels.has(quest_index):
for q in _quests:
var quest_index := int(q.get("index", -1))
if quest_index < 0 or not _clock_remaining.has(quest_index):
continue
# CPythonQuest::GetQuestLastTime derives this from iStartTime on every
# update. Recompute from the captured start instead of decrementing a
# window-local copy, so closing and reopening the window cannot reset time.
_clock_remaining[quest_index] = _quest_remaining(q)
if is_open() and _clock_labels.has(quest_index):
_update_clock_label(quest_index, _clock_labels[quest_index], "")
func _update_clock_label(quest_index: int, label: Label, name: String) -> void: