refactor(update): cut over the frame orchestrator
Reduce GameWindow.OnUpdate to one typed orchestration call and remove transitive window callbacks from teardown, liveness, teleport placement, live presentation, auto-entry, and entity packet routing. Preserve the frozen retail object/network order while making the production owner graph explicit and testable.
This commit is contained in:
parent
947c61d2d7
commit
e91f310279
18 changed files with 864 additions and 348 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using System.Numerics;
|
||||
using AcDream.App.Input;
|
||||
using AcDream.App.Rendering;
|
||||
using AcDream.App.Streaming;
|
||||
using AcDream.App.World;
|
||||
|
|
@ -1594,9 +1595,14 @@ public sealed class LiveEntityHydrationControllerTests
|
|||
public readonly RecordingOrigin Origin;
|
||||
public readonly RecordingNetworkSink Network = new();
|
||||
public readonly RecordingTeardownCoordinator Teardown = new();
|
||||
public readonly RecordingTimestampPublisher Timestamps;
|
||||
public readonly LiveEntityHydrationController Controller;
|
||||
|
||||
public Action<uint, AcceptedPhysicsTimestamps>? PublishTimestampsAction { get; set; }
|
||||
public Action<uint, AcceptedPhysicsTimestamps>? PublishTimestampsAction
|
||||
{
|
||||
get => Timestamps.PublishAction;
|
||||
set => Timestamps.PublishAction = value;
|
||||
}
|
||||
|
||||
public Fixture(
|
||||
bool originKnown,
|
||||
|
|
@ -1617,6 +1623,7 @@ public sealed class LiveEntityHydrationControllerTests
|
|||
Relationships = new RecordingRelationships(Operations);
|
||||
Ready = new RecordingReadyPublisher(Operations);
|
||||
Origin = new RecordingOrigin(originKnown);
|
||||
Timestamps = new RecordingTimestampPublisher(Operations);
|
||||
Network.ApplyAction = events =>
|
||||
{
|
||||
if (events.Position is not { } position)
|
||||
|
|
@ -1631,6 +1638,15 @@ public sealed class LiveEntityHydrationControllerTests
|
|||
out _,
|
||||
out _);
|
||||
};
|
||||
var identity = new LocalPlayerIdentityState
|
||||
{
|
||||
ServerGuid = playerGuid,
|
||||
};
|
||||
var deletion = new LiveEntityDeletionController(
|
||||
Runtime,
|
||||
Objects,
|
||||
Teardown,
|
||||
identity);
|
||||
Controller = new LiveEntityHydrationController(
|
||||
Runtime,
|
||||
Objects,
|
||||
|
|
@ -1640,13 +1656,9 @@ public sealed class LiveEntityHydrationControllerTests
|
|||
Ready,
|
||||
Origin,
|
||||
Network,
|
||||
Teardown,
|
||||
(guid, timestamps) =>
|
||||
{
|
||||
Operations.Add($"timestamps:{timestamps.Instance}");
|
||||
PublishTimestampsAction?.Invoke(guid, timestamps);
|
||||
},
|
||||
() => playerGuid);
|
||||
Timestamps,
|
||||
identity,
|
||||
deletion);
|
||||
}
|
||||
|
||||
public LiveEntityRecord Record
|
||||
|
|
@ -1671,6 +1683,23 @@ public sealed class LiveEntityHydrationControllerTests
|
|||
}
|
||||
}
|
||||
|
||||
private sealed class RecordingTimestampPublisher
|
||||
: IAcceptedLocalPhysicsTimestampPublisher
|
||||
{
|
||||
private readonly List<string> _operations;
|
||||
|
||||
public RecordingTimestampPublisher(List<string> operations) =>
|
||||
_operations = operations;
|
||||
|
||||
public Action<uint, AcceptedPhysicsTimestamps>? PublishAction { get; set; }
|
||||
|
||||
public void Publish(uint serverGuid, AcceptedPhysicsTimestamps timestamps)
|
||||
{
|
||||
_operations.Add($"timestamps:{timestamps.Instance}");
|
||||
PublishAction?.Invoke(serverGuid, timestamps);
|
||||
}
|
||||
}
|
||||
|
||||
private class RecordingResources : ILiveEntityResourceLifecycle
|
||||
{
|
||||
public int RegisterCount { get; protected set; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue