Advertise stat recipes from daemon editor surface
This commit is contained in:
parent
afcaadeff5
commit
458f40fddb
5 changed files with 63 additions and 7 deletions
|
|
@ -69,16 +69,15 @@ namespace GameCult.Aetheria.State.Verse
|
|||
surfaces.Add(ReadEveSurface(record.Payload));
|
||||
}
|
||||
|
||||
surfaces.Add(ProjectStatRecipeSurface(stateFilePath));
|
||||
surfaces.Add(AetheriaRuntimeEveSurfaceAdapter.ToEveSurfaceDocument(
|
||||
ProjectStatRecipeSurfaceDocument(stateFilePath)));
|
||||
return surfaces;
|
||||
}
|
||||
|
||||
private static EveSurfaceDocument ProjectStatRecipeSurface(string stateFilePath)
|
||||
public static AetheriaRuntimeSurfaceDocument ProjectStatRecipeSurfaceDocument(string stateFilePath)
|
||||
{
|
||||
var state = ProjectStatRecipeSurfaceState(stateFilePath);
|
||||
var document = AetheriaRuntimeStatRecipeSurfaceBuilder.Build(
|
||||
state);
|
||||
return AetheriaRuntimeEveSurfaceAdapter.ToEveSurfaceDocument(document);
|
||||
return AetheriaRuntimeStatRecipeSurfaceBuilder.Build(state);
|
||||
}
|
||||
|
||||
private static AetheriaRuntimeStatRecipeSurfaceState ProjectStatRecipeSurfaceState(string stateFilePath)
|
||||
|
|
|
|||
|
|
@ -15,11 +15,13 @@ namespace GameCult.Aetheria.State.Verse
|
|||
public static AetheriaRuntimeSurfaceDocument Build(
|
||||
AetheriaRuntimeDaemonProviderAdvertisementDocument provider,
|
||||
AetheriaRuntimeDaemonHealthDocument health,
|
||||
AetheriaRuntimeDaemonCommandBoundaryDocument commandBoundary)
|
||||
AetheriaRuntimeDaemonCommandBoundaryDocument commandBoundary,
|
||||
IReadOnlyList<AetheriaRuntimeSurfaceDocument>? designerSurfaces = null)
|
||||
{
|
||||
provider ??= new AetheriaRuntimeDaemonProviderAdvertisementDocument();
|
||||
health ??= new AetheriaRuntimeDaemonHealthDocument();
|
||||
commandBoundary ??= AetheriaRuntimeDaemonCommandBoundaryDocument.Create(provider.DaemonId);
|
||||
designerSurfaces ??= Array.Empty<AetheriaRuntimeSurfaceDocument>();
|
||||
|
||||
return new AetheriaRuntimeSurfaceDocument(
|
||||
providerId: "aetheria.daemon",
|
||||
|
|
@ -94,6 +96,16 @@ namespace GameCult.Aetheria.State.Verse
|
|||
commandBoundary.Commands
|
||||
.Take(16)
|
||||
.Select((entry, index) => CommandRow(index, entry))
|
||||
.ToArray())),
|
||||
Node(
|
||||
"aetheria.daemon.editor.designer_surfaces",
|
||||
"card",
|
||||
new[] { ("title", "Designer Surfaces") },
|
||||
Row(
|
||||
"aetheria.daemon.editor.designer_surfaces.rows",
|
||||
designerSurfaces
|
||||
.Where(surface => surface != null)
|
||||
.Select((surface, index) => DesignerSurfaceRow(index, surface))
|
||||
.ToArray()))),
|
||||
Array.Empty<AetheriaRuntimeSurfaceStyleToken>()),
|
||||
commands: commandBoundary.Commands
|
||||
|
|
@ -104,6 +116,23 @@ namespace GameCult.Aetheria.State.Verse
|
|||
.ToArray());
|
||||
}
|
||||
|
||||
private static AetheriaRuntimeSurfaceComponent DesignerSurfaceRow(
|
||||
int index,
|
||||
AetheriaRuntimeSurfaceDocument surface)
|
||||
{
|
||||
return Node(
|
||||
$"aetheria.daemon.editor.designer_surfaces.{index}",
|
||||
"inspector.kv",
|
||||
new[]
|
||||
{
|
||||
("title", surface.Title),
|
||||
("surfaceId", surface.Surface.Id),
|
||||
("provider", surface.ProviderId),
|
||||
("kind", surface.ProviderKind),
|
||||
("commands", surface.Commands.Count.ToString(CultureInfo.InvariantCulture))
|
||||
});
|
||||
}
|
||||
|
||||
private static AetheriaRuntimeSurfaceComponent CommandRow(
|
||||
int index,
|
||||
AetheriaRuntimeDaemonCommandBoundaryEntry entry)
|
||||
|
|
|
|||
|
|
@ -165,10 +165,15 @@ namespace GameCult.Aetheria.State.Verse
|
|||
var gameTuiSurfacePath = AetheriaRuntimeDaemonPublicationStore.PublishGameTuiSurface(
|
||||
stateFilePath,
|
||||
gameSurface);
|
||||
var designerSurfaces = new[]
|
||||
{
|
||||
AetheriaRuntimeCatalogStore.ProjectStatRecipeSurfaceDocument(stateFilePath)
|
||||
};
|
||||
var editorSurface = AetheriaRuntimeDaemonEditorSurfaceBuilder.Build(
|
||||
providerAdvertisement,
|
||||
health,
|
||||
commandBoundary);
|
||||
commandBoundary,
|
||||
designerSurfaces);
|
||||
var editorSurfacePath = AetheriaRuntimeDaemonPublicationStore.PublishEditorSurface(
|
||||
stateFilePath,
|
||||
editorSurface);
|
||||
|
|
|
|||
Loading…
Reference in a new issue