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

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
+48 -5
View File
@@ -31,6 +31,11 @@ var _target_name: Label
var _target_fill: ColorRect
# 状态图标条(P4
var _affect_row: HBoxContainer
# GC_DUNGEON destination compass (ClientVS22: AlarmHaveToGo).
var _dungeon_panel: Control
var _dungeon_label: Label
var _dungeon_arrow: Label
var _dungeon_destination := Vector3.ZERO
func setup(world: Node, player: Node3D) -> void:
_world = world
@@ -43,6 +48,7 @@ func setup(world: Node, player: Node3D) -> void:
_build_status()
_build_hotbar()
_build_inventory()
_build_dungeon_compass()
func reload_world(new_world: Node) -> void:
_world = new_world
@@ -312,6 +318,36 @@ func clear_target() -> void:
if _target_panel:
_target_panel.visible = false
func set_dungeon_destination(active: bool, world_pos: Vector3) -> void:
_dungeon_destination = world_pos
if _dungeon_panel:
_dungeon_panel.visible = active
if not active:
_dungeon_label.text = ""
func _build_dungeon_compass() -> void:
_dungeon_panel = Control.new()
_dungeon_panel.name = "DungeonCompass"
_dungeon_panel.set_anchors_preset(Control.PRESET_CENTER_TOP)
_dungeon_panel.position = Vector2(-110, 18)
_dungeon_panel.size = Vector2(220, 42)
_dungeon_panel.visible = false
add_child(_dungeon_panel)
var bg := ColorRect.new()
bg.color = Color(0.04, 0.05, 0.08, 0.78)
bg.size = _dungeon_panel.size
bg.mouse_filter = Control.MOUSE_FILTER_IGNORE
_dungeon_panel.add_child(bg)
_dungeon_label = Label.new()
_dungeon_label.position = Vector2(30, 5)
_dungeon_label.add_theme_font_size_override("font_size", 12)
_dungeon_panel.add_child(_dungeon_label)
_dungeon_arrow = Label.new()
_dungeon_arrow.text = ""
_dungeon_arrow.position = Vector2(8, 9)
_dungeon_arrow.add_theme_font_size_override("font_size", 18)
_dungeon_panel.add_child(_dungeon_arrow)
func _build_target_panel() -> void:
_target_panel = Control.new()
_target_panel.set_anchors_preset(Control.PRESET_CENTER_TOP)
@@ -365,8 +401,15 @@ func _input(ev: InputEvent) -> void:
_inv.visible = not _inv.visible
func _process(_dt: float) -> void:
if _player == null or _minimap_rect == null:
return
var u := clampf(_player.position.x / _map_w_m, 0.0, 1.0)
var v := clampf(_player.position.z / _map_h_m, 0.0, 1.0)
_dot.position = Vector2(u * _minimap_rect.size.x - 3, v * _minimap_rect.size.y - 3)
if _player:
if _dungeon_panel and _dungeon_panel.visible:
var d := _dungeon_destination - _player.global_position
var distance := Vector2(d.x, d.z).length()
_dungeon_label.text = "副本目标 %.0fm" % distance
# Player forward is +Z in this scene; rotate the north-facing arrow
# relative to the current player yaw, keeping the target prompt local.
_dungeon_arrow.rotation = atan2(d.x, d.z) - _player.rotation.y
if _minimap_rect:
var u := clampf(_player.position.x / _map_w_m, 0.0, 1.0)
var v := clampf(_player.position.z / _map_h_m, 0.0, 1.0)
_dot.position = Vector2(u * _minimap_rect.size.x - 3, v * _minimap_rect.size.y - 3)