fix(ui): suppress native Godot tooltips to eliminate duplicate attribute panels

This commit is contained in:
shen
2026-09-19 20:01:57 -07:00
parent 0dafa9f5ff
commit 3eb001a1fd
4 changed files with 25 additions and 1 deletions
+5
View File
@@ -29,6 +29,7 @@ const UiAssets = preload("res://ui/ui_assets.gd")
const EquipRules = preload("res://equip_rules.gd")
const ItemTooltip = preload("res://ui/item_tooltip.gd")
const ItemTooltipView = preload("res://ui/item_tooltip_view.gd")
const QuietPanel = preload("res://ui/quiet_panel.gd")
const ChestSystem = preload("res://chest_system.gd")
const ItemAttrSystem = preload("res://item_attr_system.gd")
const MetinSocketSystem = preload("res://metin_socket_system.gd")
@@ -260,6 +261,7 @@ func _index_cells(root: Node) -> void:
func _wire_cells() -> void:
for idx in _cells:
var cell: Panel = _cells[idx]
cell.set_script(QuietPanel)
var cell_idx: int = int(idx)
cell.gui_input.connect(func(e: InputEvent): _on_cell_input(cell_idx, e))
cell.mouse_entered.connect(func(): _on_cell_mouse_entered(cell_idx))
@@ -287,6 +289,7 @@ func _on_cell_mouse_entered(cell_idx: int) -> void:
return
var vnum := int(cell.get_meta("vnum", 0))
if vnum <= 0:
_hide_tooltip()
return
var count := int(cell.get_meta("count", 1))
var instance_data: Dictionary = cell.get_meta("item_data", {})
@@ -445,6 +448,7 @@ func _on_cell_input(ui_idx: int, e: InputEvent) -> void:
item_context.emit(w[0], w[1])
if context_consumer.is_valid() and bool(context_consumer.call(w[0], w[1])):
return
_hide_tooltip()
use(ui_idx)
elif e.button_index == MOUSE_BUTTON_LEFT:
if e.pressed and vnum != 0:
@@ -466,6 +470,7 @@ func _on_cell_input(ui_idx: int, e: InputEvent) -> void:
if item_mouse.attach_item(wire[0], wire[1], vnum, _item_count(ui_idx),
_icon(vnum), "inventory", metadata):
_drag_from = -1
_hide_tooltip()
return
_drag_from = ui_idx
elif not e.pressed and _drag_from != -1:
+9
View File
@@ -0,0 +1,9 @@
# QuietButton —— 拦截 Godot 4 引擎内置 Tooltip 弹窗。
#
# 防止引擎在商店槽位悬停或点击时自动弹出原生简陋的灰色 TooltipPanel
# 确保所有商品装备与道具均由 40250 官方规范的 ItemTooltipView (ThinBoard) 独占呈现。
# 同时完整保留 BaseButton.tooltip_text 字符串供测试校验复用。
extends Button
func _get_tooltip(_at_position: Vector2) -> String:
return ""
+9
View File
@@ -0,0 +1,9 @@
# QuietPanel —— 拦截 Godot 4 引擎内置 Tooltip 弹窗。
#
# 防止引擎在悬停或点击时自动弹出原生简陋的灰色 TooltipPanel
# 确保所有装备与道具均由 40250 官方规范的 ItemTooltipView (ThinBoard) 独占呈现。
# 同时完整保留 Control.tooltip_text 字符串供测试校验及移动端详情模态窗复用。
extends Panel
func _get_tooltip(_at_position: Vector2) -> String:
return ""
+2 -1
View File
@@ -15,6 +15,7 @@ extends Node
const CursorManager = preload("res://ui/cursor_manager.gd")
const ItemTooltip = preload("res://ui/item_tooltip.gd")
const ItemTooltipView = preload("res://ui/item_tooltip_view.gd")
const QuietButton = preload("res://ui/quiet_button.gd")
const UiAssets = preload("res://ui/ui_assets.gd")
const UiKit = preload("res://ui_kit.gd")
const UiBuild = preload("res://ui/ui_build.gd")
@@ -377,7 +378,7 @@ func _refresh_mobile_sell() -> void:
# 40250 ItemSlot 单元格:32×32,带 Slot_Base.sub 底图,图标居中,右下角堆叠数量
func _slot(it: Dictionary, pos: int) -> Button:
var slot := Button.new()
var slot := QuietButton.new()
slot.custom_minimum_size = Vector2(32, 32)
slot.size = Vector2(32, 32)
slot.clip_text = true