Sample ZoneRenderer catalog through current state
This commit is contained in:
parent
c400959be0
commit
2a03386ddd
2 changed files with 14 additions and 21 deletions
|
|
@ -8046,6 +8046,8 @@ static void RequireUnitySharedDocumentAccessorErgonomics(string root)
|
|||
"ZoneRenderer.cs"));
|
||||
var requiredZoneRendererSharedDocumentSymbols = new[]
|
||||
{
|
||||
".RuntimeState(\"unity-zone-renderer\")",
|
||||
".CurrentCatalog()",
|
||||
"CultMeshReactiveDocument<AetheriaRuntimeZoneContactsDocument> _zoneContacts",
|
||||
".ReactiveZoneContacts(\"unity-zone-renderer\")",
|
||||
"_zoneContacts?.Dispose()",
|
||||
|
|
@ -8058,7 +8060,7 @@ static void RequireUnitySharedDocumentAccessorErgonomics(string root)
|
|||
if (missingZoneRendererSharedDocumentSymbols.Length > 0)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"ZoneRenderer should bind catalog and contact state through managed reactive Aetheria documents with renderer lifetime disposal: " +
|
||||
"ZoneRenderer should sample catalog through current typed state while keeping contact state on managed reactive Aetheria documents: " +
|
||||
string.Join(", ", missingZoneRendererSharedDocumentSymbols));
|
||||
}
|
||||
|
||||
|
|
@ -8070,19 +8072,15 @@ static void RequireUnitySharedDocumentAccessorErgonomics(string root)
|
|||
".ReactiveZoneContacts(\"unity-zone-renderer\")",
|
||||
"AetheriaRuntimeZoneContactsSession",
|
||||
"ResolveClient().State.ObserveZoneContacts()");
|
||||
RequireReactiveTypedDocumentAccess(
|
||||
zoneRenderer,
|
||||
"ZoneRenderer",
|
||||
"AetheriaRuntimeCatalogSnapshot",
|
||||
"_catalog",
|
||||
".ReactiveCatalogSnapshot(\"unity-zone-renderer\")",
|
||||
"AetheriaRuntimeCatalogSession",
|
||||
"ResolveClient().State.ObserveCatalog()");
|
||||
|
||||
var forbiddenZoneRendererSharedDocumentSymbols = new[]
|
||||
{
|
||||
"AetheriaRuntimeZoneContactsSession _zoneContacts",
|
||||
"ResolveClient().State.ObserveZoneContacts()"
|
||||
"ResolveClient().State.ObserveZoneContacts()",
|
||||
"CultMeshReactiveDocument<AetheriaRuntimeCatalogSnapshot>",
|
||||
".ReactiveCatalogSnapshot(\"unity-zone-renderer\")",
|
||||
"AetheriaRuntimeCatalogSession _catalog",
|
||||
"ResolveClient().State.ObserveCatalog()",
|
||||
"_catalog?.Dispose()"
|
||||
};
|
||||
var zoneRendererRawDocumentHits = forbiddenZoneRendererSharedDocumentSymbols
|
||||
.Where(symbol => zoneRenderer.Contains(symbol, StringComparison.Ordinal))
|
||||
|
|
|
|||
|
|
@ -119,7 +119,6 @@ public class ZoneRenderer : MonoBehaviour
|
|||
Array.Empty<AetheriaRuntimeZoneRenderAsteroidBeltPose>();
|
||||
private IReadOnlyList<AetheriaRuntimeBodySnapshotCommit> _zoneRenderBodies =
|
||||
Array.Empty<AetheriaRuntimeBodySnapshotCommit>();
|
||||
private CultMeshReactiveDocument<AetheriaRuntimeCatalogSnapshot> _catalog;
|
||||
private CultMeshReactiveDocument<AetheriaRuntimeZoneContactsDocument> _zoneContacts;
|
||||
private AetheriaRuntimeRtsViewportBounds _objectsViewportBounds;
|
||||
private CultMeshReactiveDocument<AetheriaRuntimeObjectsViewportDocument> _objectsViewport;
|
||||
|
|
@ -1202,20 +1201,18 @@ public class ZoneRenderer : MonoBehaviour
|
|||
|
||||
private AetheriaRuntimeCatalogSnapshot ResolveCatalog()
|
||||
{
|
||||
if (_catalog != null)
|
||||
return _catalog.Current;
|
||||
|
||||
try
|
||||
{
|
||||
_catalog = AetheriaUnityRuntimeClientProvider
|
||||
.ReactiveCatalogSnapshot("unity-zone-renderer");
|
||||
return AetheriaUnityRuntimeClientProvider
|
||||
.RuntimeState("unity-zone-renderer")
|
||||
.CurrentCatalog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogWarning($"Failed to bind Aetheria runtime catalog for zone renderer: {ex.Message}");
|
||||
Debug.LogWarning($"Failed to read Aetheria runtime catalog for zone renderer: {ex.Message}");
|
||||
}
|
||||
|
||||
return _catalog?.Current;
|
||||
return null;
|
||||
}
|
||||
|
||||
private AetheriaRuntimeZoneContactsDocument ResolveZoneContacts()
|
||||
|
|
@ -1262,10 +1259,8 @@ public class ZoneRenderer : MonoBehaviour
|
|||
|
||||
private void ClearClientCaches()
|
||||
{
|
||||
_catalog?.Dispose();
|
||||
_zoneContacts?.Dispose();
|
||||
_objectsViewport?.Dispose();
|
||||
_catalog = null;
|
||||
_zoneContacts = null;
|
||||
_objectsViewport = null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue