refactor(runtime): own teleport destination correlation
This commit is contained in:
parent
38b3773cb9
commit
6a063a27d4
23 changed files with 1209 additions and 487 deletions
|
|
@ -77,7 +77,7 @@ internal sealed class WorldRevealCoordinator
|
|||
_transit.Snapshot.PortalMaterializationCount;
|
||||
public bool WaitCueShown => _transit.Snapshot.WaitCueShown;
|
||||
|
||||
public long Begin(RuntimePortalKind kind, uint destinationCell)
|
||||
public long BeginLogin(uint destinationCell)
|
||||
{
|
||||
if (destinationCell == 0u)
|
||||
throw new ArgumentOutOfRangeException(nameof(destinationCell));
|
||||
|
|
@ -85,7 +85,45 @@ internal sealed class WorldRevealCoordinator
|
|||
WorldGenerationQuiescenceEdge quiescenceEdge =
|
||||
_quiescence?.CaptureBegin() ?? default;
|
||||
_readiness.Begin();
|
||||
long generation = _transit.BeginReveal(kind, destinationCell);
|
||||
long generation = _transit.BeginLoginReveal(destinationCell);
|
||||
BeginHostLifetime(
|
||||
generation,
|
||||
destinationCell,
|
||||
quiescenceEdge);
|
||||
return generation;
|
||||
}
|
||||
|
||||
public bool TryBeginPortal(
|
||||
ushort teleportSequence,
|
||||
uint destinationCell,
|
||||
out long generation)
|
||||
{
|
||||
if (destinationCell == 0u)
|
||||
throw new ArgumentOutOfRangeException(nameof(destinationCell));
|
||||
|
||||
WorldGenerationQuiescenceEdge quiescenceEdge =
|
||||
_quiescence?.CaptureBegin() ?? default;
|
||||
if (!_transit.TryBeginPortalReveal(
|
||||
teleportSequence,
|
||||
destinationCell,
|
||||
out generation))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
_readiness.Begin();
|
||||
BeginHostLifetime(
|
||||
generation,
|
||||
destinationCell,
|
||||
quiescenceEdge);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void BeginHostLifetime(
|
||||
long generation,
|
||||
uint destinationCell,
|
||||
in WorldGenerationQuiescenceEdge quiescenceEdge)
|
||||
{
|
||||
_quiescence?.CommitBegin(quiescenceEdge);
|
||||
_reservationGeneration = generation;
|
||||
_worldViewportReleased = false;
|
||||
|
|
@ -94,7 +132,6 @@ internal sealed class WorldRevealCoordinator
|
|||
destinationCell,
|
||||
WorldRevealReadinessBarrier.RequiredRenderRadius(destinationCell));
|
||||
_renderResources?.BeginDestinationReveal(generation);
|
||||
return generation;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -138,17 +175,27 @@ internal sealed class WorldRevealCoordinator
|
|||
/// <c>TAS_TUNNEL_CONTINUE</c>. The normal world viewport is not restored
|
||||
/// until the later <c>TUNNEL_FADE_OUT -> WORLD_FADE_IN</c> edge.
|
||||
/// </remarks>
|
||||
public void ObserveMaterialized()
|
||||
{
|
||||
RuntimePortalSnapshot snapshot = _transit.Snapshot;
|
||||
if (snapshot.Generation == 0)
|
||||
return;
|
||||
public bool CanPlacePortalDestination(
|
||||
long generation,
|
||||
ushort teleportSequence,
|
||||
uint destinationCell) =>
|
||||
_transit.CanPlacePortalDestination(
|
||||
generation,
|
||||
teleportSequence,
|
||||
destinationCell);
|
||||
|
||||
public bool ObserveMaterialized(
|
||||
long generation,
|
||||
ushort teleportSequence,
|
||||
uint destinationCell)
|
||||
{
|
||||
bool wasAvailable = _transit.IsWorldSimulationAvailable;
|
||||
_transit.AcknowledgeMaterialized(
|
||||
snapshot.Generation,
|
||||
snapshot.DestinationCell);
|
||||
bool acknowledged = _transit.AcknowledgePortalMaterialized(
|
||||
generation,
|
||||
teleportSequence,
|
||||
destinationCell);
|
||||
ObserveSimulationRelease(wasAvailable);
|
||||
return acknowledged;
|
||||
}
|
||||
|
||||
public void ObserveWorldViewportVisible()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue