Add typed verse settings shell and command bridge
This commit is contained in:
parent
cff88b79e4
commit
fea05967f8
14 changed files with 765 additions and 5 deletions
|
|
@ -11,6 +11,7 @@
|
|||
<Compile Include="..\Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimeStateCommitDocument.cs" Link="AetheriaRuntimeStateCommitDocument.cs" />
|
||||
<Compile Include="..\Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimeEveCommandDocument.cs" Link="AetheriaRuntimeEveCommandDocument.cs" />
|
||||
<Compile Include="..\Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimePendingCultCacheStore.cs" Link="AetheriaRuntimePendingCultCacheStore.cs" />
|
||||
<Compile Include="..\Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimeVerseHostCommands.cs" Link="AetheriaRuntimeVerseHostCommands.cs" />
|
||||
<Compile Include="..\Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimePlayerSettingsSurfaceBuilder.cs" Link="AetheriaRuntimePlayerSettingsSurfaceBuilder.cs" />
|
||||
<Compile Include="..\Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimePlayerSettingsCommands.cs" Link="AetheriaRuntimePlayerSettingsCommands.cs" />
|
||||
<ProjectReference Include="..\..\CultLib\src\GameCult.Caching\GameCult.Caching.csproj" />
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ public sealed class AetheriaEveCommandApplyReport
|
|||
public int AppliedCatalogRefreshes { get; set; }
|
||||
public int AppliedOperationsRefreshes { get; set; }
|
||||
public int AppliedPlayerSettingsCommands { get; set; }
|
||||
public int AppliedVerseHostCommands { get; set; }
|
||||
public int RejectedCommands { get; set; }
|
||||
public string[] AcceptedPaths { get; set; } = [];
|
||||
public string[] RejectedPaths { get; set; } = [];
|
||||
|
|
@ -85,6 +86,11 @@ public static class AetheriaEveCommandBridge
|
|||
await ApplyPlayerSettingsCommandAsync(node, command).ConfigureAwait(false);
|
||||
report.AppliedPlayerSettingsCommands++;
|
||||
break;
|
||||
case GameCult.Aetheria.State.Unity.AetheriaRuntimeVerseHostCommands.Refresh:
|
||||
case GameCult.Aetheria.State.Unity.AetheriaRuntimeVerseHostCommands.CycleVisibility:
|
||||
await ApplyVerseHostCommandAsync(node, command).ConfigureAwait(false);
|
||||
report.AppliedVerseHostCommands++;
|
||||
break;
|
||||
}
|
||||
|
||||
accepted.Add(path);
|
||||
|
|
@ -122,7 +128,9 @@ public static class AetheriaEveCommandBridge
|
|||
(string.Equals(surfaceId, AetheriaOperationsSurfaceProjector.SurfaceId, StringComparison.Ordinal) &&
|
||||
string.Equals(command, "aetheria.operations.refresh", StringComparison.Ordinal)) ||
|
||||
(string.Equals(surfaceId, AetheriaPlayerSettingsSurfaceProjector.SurfaceId, StringComparison.Ordinal) &&
|
||||
GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.IsKnown(command));
|
||||
GameCult.Aetheria.State.Unity.AetheriaRuntimePlayerSettingsCommands.IsKnown(command)) ||
|
||||
(string.Equals(surfaceId, GameCult.Aetheria.State.Unity.AetheriaRuntimeVerseHostCommands.SurfaceId, StringComparison.Ordinal) &&
|
||||
GameCult.Aetheria.State.Unity.AetheriaRuntimeVerseHostCommands.IsKnown(command));
|
||||
}
|
||||
|
||||
private static async Task ApplyPlayerSettingsCommandAsync(
|
||||
|
|
@ -185,6 +193,46 @@ public static class AetheriaEveCommandBridge
|
|||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private static async Task ApplyVerseHostCommandAsync(
|
||||
AetheriaStateNode node,
|
||||
AetheriaRuntimeEveCommandDocument command)
|
||||
{
|
||||
var settings = await node.GetVerseHostSettingsAsync().ConfigureAwait(false) ?? new AetheriaVerseHostSettings();
|
||||
var normalized = AetheriaVerseHostSettingsNormalizer.Normalize(settings);
|
||||
var persistSettings = false;
|
||||
|
||||
switch (command.Command)
|
||||
{
|
||||
case GameCult.Aetheria.State.Unity.AetheriaRuntimeVerseHostCommands.CycleVisibility:
|
||||
normalized.Visibility = Cycle(normalized.Visibility, "private", "public");
|
||||
persistSettings = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (persistSettings)
|
||||
{
|
||||
normalized.LastUpdatedAtUtc = command.IssuedAtUtc;
|
||||
await node.PutVerseHostSettingsAsync(normalized).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
var commitStatus = await node.GetRuntimeCommitDrainStatusAsync().ConfigureAwait(false) ??
|
||||
EmptyCommitDrainStatus(node.StatePath, command.IssuedAtUtc);
|
||||
var eveStatus = await node.GetEveCommandDrainStatusAsync().ConfigureAwait(false) ??
|
||||
EmptyEveCommandDrainStatus(node.StatePath, command.IssuedAtUtc);
|
||||
var runtimeSession = string.IsNullOrWhiteSpace(commitStatus.RuntimeId)
|
||||
? null
|
||||
: await node.GetRuntimeSessionAsync(commitStatus.RuntimeId).ConfigureAwait(false);
|
||||
|
||||
await node.PutOperationsSurfaceAsync(
|
||||
AetheriaOperationsSurfaceProjector.Build(
|
||||
commitStatus,
|
||||
eveStatus,
|
||||
normalized,
|
||||
runtimeSession)).ConfigureAwait(false);
|
||||
await node.PutProviderAdvertisementAsync(
|
||||
AetheriaProviderAdvertisementProjector.Build(normalized, node.StatePath, command.IssuedAtUtc)).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private static string Cycle(string current, params string[] values)
|
||||
{
|
||||
if (values.Length == 0)
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ public static class AetheriaOperationsSurfaceProjector
|
|||
Metric("eveCommandDrain.catalogRefreshes", "Catalog Refreshes", (eveCommandStatus?.AppliedCatalogRefreshes ?? 0).ToString()),
|
||||
Metric("eveCommandDrain.operationsRefreshes", "Operations Refreshes", (eveCommandStatus?.AppliedOperationsRefreshes ?? 0).ToString()),
|
||||
Metric("eveCommandDrain.playerSettings", "Player Settings Commands", (eveCommandStatus?.AppliedPlayerSettingsCommands ?? 0).ToString()),
|
||||
Metric("eveCommandDrain.verseHost", "Verse Host Commands", (eveCommandStatus?.AppliedVerseHostCommands ?? 0).ToString()),
|
||||
Metric("eveCommandDrain.failures", "Consecutive Failures", (eveCommandStatus?.ConsecutiveFailures ?? 0).ToString()),
|
||||
Row(
|
||||
"eveCommandDrain.last",
|
||||
|
|
|
|||
|
|
@ -57,4 +57,7 @@ public sealed class AetheriaEveCommandDrainStatus
|
|||
|
||||
[Key(15)]
|
||||
public int AppliedPlayerSettingsCommands { get; set; }
|
||||
|
||||
[Key(16)]
|
||||
public int AppliedVerseHostCommands { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,8 +56,9 @@ Unity Eve surfaces also emit typed `gamecult.eve.command.v1` documents under
|
|||
provider-owned acceptance organ for those commands: it validates the provider,
|
||||
surface, and command template before running the narrow refresh handlers for
|
||||
the catalog and operations surfaces plus the typed player-settings mutation
|
||||
handlers for gameplay/graphics Eve controls. Renderer callbacks do not accept
|
||||
commands or mutate game state locally.
|
||||
handlers for gameplay/graphics Eve controls and typed Verse-host visibility
|
||||
commands. Renderer callbacks do not accept commands or mutate game state
|
||||
locally.
|
||||
`AetheriaEveRuntimeBootstrap` mounts the `aetheria.operations` surface through a
|
||||
runtime-created `UIDocument` after scene load, with environment and command-line
|
||||
switches for diagnostics. UI Toolkit is now a live runtime lowering path, not
|
||||
|
|
@ -316,6 +317,10 @@ can read typed player settings for Unity boot, and can read the published Eve
|
|||
catalog surface. It does not deserialize legacy runtime projection objects and
|
||||
does not write daemon-owned Verse state. Unity can use this as the first
|
||||
package boundary once CultLib/Eve runtime packaging is available.
|
||||
Unity `MainMenu` now lowers a typed Verse settings shell over that split:
|
||||
client-target edits persist locally in `aetheria-client.cc`, while Verse-host
|
||||
visibility changes queue provider-owned Eve commands against the selected local
|
||||
Verse state file.
|
||||
`Galaxy` now consumes this package-owned runtime catalog for faction selection
|
||||
and name generation, so generated sectors use typed corporation v2 and
|
||||
`aetheria.name_file.v2` records instead of legacy `Faction`/`NameFile`
|
||||
|
|
|
|||
Loading…
Reference in a new issue