fix(ui): suppress native Godot tooltips to eliminate duplicate attribute panels
This commit is contained in:
@@ -29,6 +29,7 @@ const UiAssets = preload("res://ui/ui_assets.gd")
|
|||||||
const EquipRules = preload("res://equip_rules.gd")
|
const EquipRules = preload("res://equip_rules.gd")
|
||||||
const ItemTooltip = preload("res://ui/item_tooltip.gd")
|
const ItemTooltip = preload("res://ui/item_tooltip.gd")
|
||||||
const ItemTooltipView = preload("res://ui/item_tooltip_view.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 ChestSystem = preload("res://chest_system.gd")
|
||||||
const ItemAttrSystem = preload("res://item_attr_system.gd")
|
const ItemAttrSystem = preload("res://item_attr_system.gd")
|
||||||
const MetinSocketSystem = preload("res://metin_socket_system.gd")
|
const MetinSocketSystem = preload("res://metin_socket_system.gd")
|
||||||
@@ -260,6 +261,7 @@ func _index_cells(root: Node) -> void:
|
|||||||
func _wire_cells() -> void:
|
func _wire_cells() -> void:
|
||||||
for idx in _cells:
|
for idx in _cells:
|
||||||
var cell: Panel = _cells[idx]
|
var cell: Panel = _cells[idx]
|
||||||
|
cell.set_script(QuietPanel)
|
||||||
var cell_idx: int = int(idx)
|
var cell_idx: int = int(idx)
|
||||||
cell.gui_input.connect(func(e: InputEvent): _on_cell_input(cell_idx, e))
|
cell.gui_input.connect(func(e: InputEvent): _on_cell_input(cell_idx, e))
|
||||||
cell.mouse_entered.connect(func(): _on_cell_mouse_entered(cell_idx))
|
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
|
return
|
||||||
var vnum := int(cell.get_meta("vnum", 0))
|
var vnum := int(cell.get_meta("vnum", 0))
|
||||||
if vnum <= 0:
|
if vnum <= 0:
|
||||||
|
_hide_tooltip()
|
||||||
return
|
return
|
||||||
var count := int(cell.get_meta("count", 1))
|
var count := int(cell.get_meta("count", 1))
|
||||||
var instance_data: Dictionary = cell.get_meta("item_data", {})
|
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])
|
item_context.emit(w[0], w[1])
|
||||||
if context_consumer.is_valid() and bool(context_consumer.call(w[0], w[1])):
|
if context_consumer.is_valid() and bool(context_consumer.call(w[0], w[1])):
|
||||||
return
|
return
|
||||||
|
_hide_tooltip()
|
||||||
use(ui_idx)
|
use(ui_idx)
|
||||||
elif e.button_index == MOUSE_BUTTON_LEFT:
|
elif e.button_index == MOUSE_BUTTON_LEFT:
|
||||||
if e.pressed and vnum != 0:
|
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),
|
if item_mouse.attach_item(wire[0], wire[1], vnum, _item_count(ui_idx),
|
||||||
_icon(vnum), "inventory", metadata):
|
_icon(vnum), "inventory", metadata):
|
||||||
_drag_from = -1
|
_drag_from = -1
|
||||||
|
_hide_tooltip()
|
||||||
return
|
return
|
||||||
_drag_from = ui_idx
|
_drag_from = ui_idx
|
||||||
elif not e.pressed and _drag_from != -1:
|
elif not e.pressed and _drag_from != -1:
|
||||||
|
|||||||
@@ -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 ""
|
||||||
@@ -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 ""
|
||||||
@@ -15,6 +15,7 @@ extends Node
|
|||||||
const CursorManager = preload("res://ui/cursor_manager.gd")
|
const CursorManager = preload("res://ui/cursor_manager.gd")
|
||||||
const ItemTooltip = preload("res://ui/item_tooltip.gd")
|
const ItemTooltip = preload("res://ui/item_tooltip.gd")
|
||||||
const ItemTooltipView = preload("res://ui/item_tooltip_view.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 UiAssets = preload("res://ui/ui_assets.gd")
|
||||||
const UiKit = preload("res://ui_kit.gd")
|
const UiKit = preload("res://ui_kit.gd")
|
||||||
const UiBuild = preload("res://ui/ui_build.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 底图,图标居中,右下角堆叠数量
|
# 40250 ItemSlot 单元格:32×32,带 Slot_Base.sub 底图,图标居中,右下角堆叠数量
|
||||||
func _slot(it: Dictionary, pos: int) -> Button:
|
func _slot(it: Dictionary, pos: int) -> Button:
|
||||||
var slot := Button.new()
|
var slot := QuietButton.new()
|
||||||
slot.custom_minimum_size = Vector2(32, 32)
|
slot.custom_minimum_size = Vector2(32, 32)
|
||||||
slot.size = Vector2(32, 32)
|
slot.size = Vector2(32, 32)
|
||||||
slot.clip_text = true
|
slot.clip_text = true
|
||||||
|
|||||||
Reference in New Issue
Block a user