- item_tooltip_view.gd: 新增 avoid_rect 属性,tooltip 与装备窗口重叠时自动推到左侧 - inventory_ui.gd: 悬停装备时传入窗口矩形作为避让区域 - 包含其他累积的功能开发和测试文件
45 lines
1.4 KiB
GDScript
45 lines
1.4 KiB
GDScript
# net_world_motion_event_test —— every real remote actor exposes the native
|
|
# MotionEvent detailed signal through NetWorld, without creating client shots.
|
|
extends SceneTree
|
|
|
|
const NetWorld = preload("res://net_world.gd")
|
|
|
|
class Anim extends Node:
|
|
signal motion_event_detailed(event: Dictionary)
|
|
|
|
class Actor extends Node3D:
|
|
var anim := Anim.new()
|
|
func _init() -> void:
|
|
add_child(anim)
|
|
|
|
var failures := 0
|
|
|
|
func check(ok: bool, label: String) -> void:
|
|
if not ok:
|
|
failures += 1
|
|
printerr("FAIL: " + label)
|
|
|
|
func _init() -> void:
|
|
call_deferred("run")
|
|
|
|
func run() -> void:
|
|
var world := NetWorld.new()
|
|
var actor := Actor.new()
|
|
get_root().add_child(world)
|
|
get_root().add_child(actor)
|
|
var seen: Array = []
|
|
world.actor_motion_event.connect(func(vid: int, event: Dictionary): seen.append([vid, event]))
|
|
world._connect_actor_motion_events(actor, 42)
|
|
actor.anim.motion_event_detailed.emit({"type": 1, "effect": "remote.mse"})
|
|
check(seen.size() == 1 and seen[0][0] == 42 and seen[0][1].effect == "remote.mse",
|
|
"remote actor detailed motion event reaches NetWorld")
|
|
world._connect_actor_motion_events(actor, 42)
|
|
actor.anim.motion_event_detailed.emit({"type": 8})
|
|
check(seen.size() == 2, "remote animator is connected only once")
|
|
world.free()
|
|
actor.free()
|
|
await process_frame
|
|
if failures == 0:
|
|
print("PASS: net_world_motion_event_test")
|
|
quit(1 if failures else 0)
|