完善客户端功能并同步差距文档

This commit is contained in:
shenlei
2026-09-03 18:40:01 +09:00
parent f93a172296
commit 13ccb8d02d
135 changed files with 21881 additions and 1259 deletions
+7
View File
@@ -3,11 +3,13 @@
extends Node
const WEAR_NAMES := ["身体", "头部", "鞋子", "护腕", "武器", "项链", "耳环", "盾牌", "饰品 1", "饰品 2", "箭矢"]
const ItemTooltip = preload("res://ui/item_tooltip.gd")
var client: Node
var ui: CanvasLayer
var proto: Node
var item_list: RefCounted
var _tooltip_builder: RefCounted
var _window: Control
func setup(m2client: Node, manager: CanvasLayer, proto_node: Node = null, il: RefCounted = null) -> void:
@@ -15,6 +17,8 @@ func setup(m2client: Node, manager: CanvasLayer, proto_node: Node = null, il: Re
ui = manager
proto = proto_node
item_list = il
_tooltip_builder = ItemTooltip.new()
_tooltip_builder.setup(AssetRoot.path() if ClassDB.class_exists("AssetRoot") else "", "en", proto)
if client.has_signal("view_equipment"):
client.view_equipment.connect(show_for)
@@ -94,6 +98,9 @@ func _item_name(vnum: int, count: int) -> String:
return "%s x%d" % [name, count] if count > 1 else name
func _item_tooltip(d: Dictionary) -> String:
var vnum := int(d.get("vnum", 0))
if _tooltip_builder and proto and proto.has_method("item"):
return _tooltip_builder.format(vnum, int(d.get("count", 1)), proto.item(vnum), d)
var attrs: Array = d.get("attrs", [])
if attrs.is_empty():
return ""