Remove receipt-driven snapshot reconciliation
This commit is contained in:
parent
6253649349
commit
b6f001b300
2 changed files with 4 additions and 17 deletions
|
|
@ -11,7 +11,6 @@ namespace GameCult.Eve.UnityScene
|
|||
private readonly EveUnitySceneProviderConnection _connection;
|
||||
private readonly EveUnityPlayableWorldPresenter _presenter;
|
||||
private readonly IEveUnitySceneCommandReceiptSource? _receiptSource;
|
||||
private readonly bool _refreshOnTerminalReceipt;
|
||||
private readonly EveUnityFeedbackPresenter _feedback = new EveUnityFeedbackPresenter();
|
||||
private readonly EveUnityShotReceiptPresenter _shots = new EveUnityShotReceiptPresenter();
|
||||
private readonly List<EveUnitySceneCommandReceipt> _pendingReceipts =
|
||||
|
|
@ -22,13 +21,11 @@ namespace GameCult.Eve.UnityScene
|
|||
public EveUnityPlayableWorldLiveClient(
|
||||
EveUnitySceneProviderConnection connection,
|
||||
EveUnityPlayableWorldPresenter presenter,
|
||||
IEveUnitySceneCommandReceiptSource? receiptSource = null,
|
||||
bool refreshOnTerminalReceipt = true)
|
||||
IEveUnitySceneCommandReceiptSource? receiptSource = null)
|
||||
{
|
||||
_connection = connection ?? throw new ArgumentNullException(nameof(connection));
|
||||
_presenter = presenter ?? throw new ArgumentNullException(nameof(presenter));
|
||||
_receiptSource = receiptSource;
|
||||
_refreshOnTerminalReceipt = refreshOnTerminalReceipt;
|
||||
}
|
||||
|
||||
public EveUnitySceneProjection? ActiveProjection => _connection.ActiveProjection;
|
||||
|
|
@ -173,17 +170,9 @@ namespace GameCult.Eve.UnityScene
|
|||
if (receipt.SourceVersion > ActiveVersion)
|
||||
{
|
||||
_pendingReceipts.Add(receipt);
|
||||
if (_refreshOnTerminalReceipt && receipt.ShouldRefreshProviderSurface)
|
||||
{
|
||||
Refresh();
|
||||
PublishReceiptsWhoseStateIsVisible();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (_refreshOnTerminalReceipt && receipt.ShouldRefreshProviderSurface)
|
||||
Refresh();
|
||||
|
||||
PublishReceipt(receipt);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -491,7 +491,7 @@ namespace GameCult.Eve.UnityScene.Tests
|
|||
|
||||
Assert.That(runtime.LastReceipt, Is.Not.Null);
|
||||
Assert.That(runtime.LastReceipt!.IsProviderOwned, Is.True);
|
||||
Assert.That(transport.RefreshCount, Is.EqualTo(1));
|
||||
Assert.That(transport.RefreshCount, Is.EqualTo(0));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -886,7 +886,7 @@ namespace GameCult.Eve.UnityScene.Tests
|
|||
}
|
||||
|
||||
[Test]
|
||||
public void LivePlayableWorldClientRefreshesFromProviderSnapshotAfterReceiptWithoutOwningMovement()
|
||||
public void LivePlayableWorldClientWaitsForProviderSurfaceUpdateAfterReceipt()
|
||||
{
|
||||
var source = new FakeProviderSurfaceSource(
|
||||
"aetheria",
|
||||
|
|
@ -943,13 +943,11 @@ namespace GameCult.Eve.UnityScene.Tests
|
|||
Assert.That(client.LastReceipt.State, Is.EqualTo("pending"));
|
||||
Assert.That(client.ActiveVersion, Is.EqualTo(1));
|
||||
|
||||
source.Stage(new EveUnitySceneProviderSurfaceSnapshot(
|
||||
source.Publish(new EveUnitySceneProviderSurfaceSnapshot(
|
||||
PlayableArpgDocument(includeRaider: false, playerPosition: "30,0,30"),
|
||||
Advertisement("aetheria.daemon.game"),
|
||||
"cultmesh://aetheria/eve/surfaces/aetheria.daemon.game",
|
||||
2));
|
||||
client.Refresh();
|
||||
|
||||
Assert.That(client.LastReceipt.State, Is.EqualTo("reconciled"));
|
||||
Assert.That(client.ActiveVersion, Is.EqualTo(2));
|
||||
Assert.That(client.LastPresentation, Is.Not.Null);
|
||||
|
|
|
|||
Reference in a new issue