Use provider-native runtime access in menus
This commit is contained in:
parent
7a298cf95d
commit
3d48c762de
6 changed files with 98 additions and 52 deletions
|
|
@ -89,9 +89,7 @@ public class ActionGameManager : MonoBehaviour
|
|||
() => _viewDirection,
|
||||
() => CurrentEntity);
|
||||
private AetheriaUnityObservedTargetQuery ObservedTargetQuery =>
|
||||
_observedTargetQuery ??= new AetheriaUnityObservedTargetQuery(
|
||||
() => ResolveDaemonObserver()?.Client,
|
||||
_observedEntityIndex);
|
||||
_observedTargetQuery ??= new AetheriaUnityObservedTargetQuery(_observedEntityIndex);
|
||||
private AetheriaUnityObservedFrameApplier ObservedFrameApplier =>
|
||||
_observedFrameApplier ??= new AetheriaUnityObservedFrameApplier(
|
||||
ResolveDaemonObserver,
|
||||
|
|
|
|||
|
|
@ -9,15 +9,11 @@ using GameCult.Mesh;
|
|||
|
||||
public sealed class AetheriaUnityObservedTargetQuery : IDisposable
|
||||
{
|
||||
private readonly Func<AetheriaClient> _resolveClient;
|
||||
private readonly AetheriaUnityObservedEntityIndex _entityIndex;
|
||||
private CultMeshReactiveDocument<AetheriaRuntimeZoneContactsDocument> _zoneContacts;
|
||||
|
||||
public AetheriaUnityObservedTargetQuery(
|
||||
Func<AetheriaClient> resolveClient,
|
||||
AetheriaUnityObservedEntityIndex entityIndex)
|
||||
public AetheriaUnityObservedTargetQuery(AetheriaUnityObservedEntityIndex entityIndex)
|
||||
{
|
||||
_resolveClient = resolveClient ?? (() => null);
|
||||
_entityIndex = entityIndex ?? throw new ArgumentNullException(nameof(entityIndex));
|
||||
}
|
||||
|
||||
|
|
@ -98,8 +94,8 @@ public sealed class AetheriaUnityObservedTargetQuery : IDisposable
|
|||
|
||||
try
|
||||
{
|
||||
_zoneContacts = _resolveClient()
|
||||
?.State.Reactive<AetheriaRuntimeZoneContactsDocument>();
|
||||
_zoneContacts = AetheriaUnityRuntimeClientProvider
|
||||
.Reactive<AetheriaRuntimeZoneContactsDocument>("unity-observed-target-query");
|
||||
return _zoneContacts?.Current;
|
||||
}
|
||||
catch
|
||||
|
|
|
|||
|
|
@ -62,22 +62,51 @@ public static class AetheriaUnityRuntimeClientProvider
|
|||
return ResolveClient(AetheriaUnityRuntimePaths.RuntimeStateFilePath, runtimeId);
|
||||
}
|
||||
|
||||
public static AetheriaClient RuntimeClient(
|
||||
AetheriaRuntimeStateBootReport stateBoot,
|
||||
string runtimeId = "")
|
||||
{
|
||||
return ResolveClient(stateBoot, runtimeId);
|
||||
}
|
||||
|
||||
public static AetheriaClientState RuntimeState(string runtimeId = "")
|
||||
{
|
||||
return RuntimeClient(runtimeId).State;
|
||||
}
|
||||
|
||||
public static AetheriaClientState RuntimeState(
|
||||
AetheriaRuntimeStateBootReport stateBoot,
|
||||
string runtimeId = "")
|
||||
{
|
||||
return RuntimeClient(stateBoot, runtimeId).State;
|
||||
}
|
||||
|
||||
public static AetheriaControl Control(string runtimeId = "")
|
||||
{
|
||||
return RuntimeClient(runtimeId).Control;
|
||||
}
|
||||
|
||||
public static AetheriaControl Control(
|
||||
AetheriaRuntimeStateBootReport stateBoot,
|
||||
string runtimeId = "")
|
||||
{
|
||||
return RuntimeClient(stateBoot, runtimeId).Control;
|
||||
}
|
||||
|
||||
public static CultMeshReactiveDocument<TDocument> Reactive<TDocument>(string runtimeId = "")
|
||||
where TDocument : class
|
||||
{
|
||||
return RuntimeState(runtimeId).Reactive<TDocument>();
|
||||
}
|
||||
|
||||
public static CultMeshReactiveDocument<TDocument> Reactive<TDocument>(
|
||||
AetheriaRuntimeStateBootReport stateBoot,
|
||||
string runtimeId = "")
|
||||
where TDocument : class
|
||||
{
|
||||
return RuntimeState(stateBoot, runtimeId).Reactive<TDocument>();
|
||||
}
|
||||
|
||||
public static CultMeshReactiveDocument<TDocument> Reactive<TDocument>(
|
||||
AetheriaRuntimeRtsViewportBounds viewport,
|
||||
string runtimeId = "")
|
||||
|
|
@ -86,6 +115,15 @@ public static class AetheriaUnityRuntimeClientProvider
|
|||
return RuntimeState(runtimeId).Reactive<TDocument>(viewport);
|
||||
}
|
||||
|
||||
public static CultMeshReactiveDocument<TDocument> Reactive<TDocument>(
|
||||
AetheriaRuntimeStateBootReport stateBoot,
|
||||
AetheriaRuntimeRtsViewportBounds viewport,
|
||||
string runtimeId = "")
|
||||
where TDocument : class
|
||||
{
|
||||
return RuntimeState(stateBoot, runtimeId).Reactive<TDocument>(viewport);
|
||||
}
|
||||
|
||||
public static CultMeshReactiveDocument<TDocument> Reactive<TDocument>(
|
||||
int index,
|
||||
string runtimeId = "")
|
||||
|
|
@ -94,6 +132,15 @@ public static class AetheriaUnityRuntimeClientProvider
|
|||
return RuntimeState(runtimeId).Reactive<TDocument>(index);
|
||||
}
|
||||
|
||||
public static CultMeshReactiveDocument<TDocument> Reactive<TDocument>(
|
||||
AetheriaRuntimeStateBootReport stateBoot,
|
||||
int index,
|
||||
string runtimeId = "")
|
||||
where TDocument : class
|
||||
{
|
||||
return RuntimeState(stateBoot, runtimeId).Reactive<TDocument>(index);
|
||||
}
|
||||
|
||||
public static AetheriaClient CurrentClientForStateFile(string stateFilePath)
|
||||
{
|
||||
foreach (var pair in RuntimeClients)
|
||||
|
|
|
|||
Loading…
Reference in a new issue