feat(ui): 40250 item tooltip parity (thinboard, palette, sockets, stats)
This commit is contained in:
@@ -451,3 +451,29 @@ func _on_handle_input(win: Control, ev: InputEvent) -> void:
|
||||
_drag_win = null
|
||||
elif ev is InputEventMouseMotion and _drag_win == win:
|
||||
win.position = win.get_global_mouse_position() - _drag_from
|
||||
|
||||
# --- 40250 ItemToolTip 统一悬浮窗 ---
|
||||
var _item_tooltip_view: Control = null
|
||||
|
||||
func get_item_tooltip_view(assets_root := "", proto: Node = null, ilist: RefCounted = null) -> Control:
|
||||
if _item_tooltip_view == null or not is_instance_valid(_item_tooltip_view):
|
||||
var view_cls = load("res://ui/item_tooltip_view.gd")
|
||||
_item_tooltip_view = view_cls.new()
|
||||
_item_tooltip_view.z_index = 200
|
||||
_item_tooltip_view.visible = false
|
||||
_ensure_root()
|
||||
_root.add_child(_item_tooltip_view)
|
||||
if not assets_root.is_empty():
|
||||
_item_tooltip_view.setup(assets_root, proto, ilist)
|
||||
return _item_tooltip_view
|
||||
|
||||
func show_item_tooltip(vnum: int, count: int, proto_data: Dictionary, instance_data: Dictionary = {},
|
||||
player_ctx: Dictionary = {}, assets_root := "", proto: Node = null, ilist: RefCounted = null) -> void:
|
||||
var view = get_item_tooltip_view(assets_root, proto, ilist)
|
||||
if view:
|
||||
view.show_item(vnum, count, proto_data, instance_data, player_ctx)
|
||||
|
||||
func hide_item_tooltip() -> void:
|
||||
if _item_tooltip_view and is_instance_valid(_item_tooltip_view):
|
||||
_item_tooltip_view.hide_tooltip()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user