Build ship settings surfaces directly
This commit is contained in:
parent
09a5b019af
commit
cf09a33731
3 changed files with 34 additions and 14 deletions
|
|
@ -5032,8 +5032,9 @@ static void RequireInventoryShipSettingsUseEveSurface(string root)
|
|||
"HandleCurrentShipSettingsSurfaceCommand(",
|
||||
"AetheriaEveUnitySurfaceHost.RenderRuntime(",
|
||||
"AetheriaEveUnitySurfaceHost.Hide(_shipSettingsSurfaceDocument)",
|
||||
"AetheriaRuntimeShipSettingsSurfaceBuilder.Build(ComposeCurrentShipSettingsSurface(",
|
||||
"AetheriaRuntimeShipSettingsSurfaceBuilder.Compose(",
|
||||
"AetheriaRuntimeShipSettingsSurfaceBuilder.Build(",
|
||||
"currentEntity?.Entity?.DisplayName",
|
||||
"(float)(currentEntity?.ShutdownPerformance ?? 0)",
|
||||
"AetheriaRuntimeShipSettingsSurfaceCommands.TryRead(request, out var command)",
|
||||
"AetheriaRuntimeShipSettingsCommandKind.DecrementShutdownThreshold",
|
||||
"AetheriaRuntimeShipSettingsCommandKind.IncrementShutdownThreshold",
|
||||
|
|
@ -5094,7 +5095,9 @@ static void RequireInventoryShipSettingsUseEveSurface(string root)
|
|||
"entity == null || !IsCurrentEntity(entity)",
|
||||
"entity.Settings.ShutdownPerformance",
|
||||
"new AetheriaRuntimeShipSettingsSurfaceState(",
|
||||
"ComposeCurrentShipSettingsSurface(",
|
||||
"ProjectCurrentShipSettingsSurface(",
|
||||
"AetheriaRuntimeShipSettingsSurfaceBuilder.Compose(",
|
||||
"AetheriaRuntimeShipSettingsSurfaceBuilder.Project("
|
||||
};
|
||||
|
||||
|
|
@ -5122,8 +5125,8 @@ static void RequireInventoryShipSettingsUseEveSurface(string root)
|
|||
"public static class AetheriaRuntimeShipSettingsSurfaceCommands",
|
||||
"public static bool TryRead(",
|
||||
"AetheriaRuntimeShipSettingsSurfaceState",
|
||||
"public static AetheriaRuntimeShipSettingsSurfaceState Compose(",
|
||||
"public static AetheriaRuntimeSurfaceDocument Build(",
|
||||
"private static AetheriaRuntimeShipSettingsSurfaceState ComposeState(",
|
||||
"public static float ResolveShutdownPerformance(",
|
||||
"public static float ClampShutdownPerformance("
|
||||
};
|
||||
|
|
@ -5136,6 +5139,13 @@ static void RequireInventoryShipSettingsUseEveSurface(string root)
|
|||
"Shared runtime ship settings surface builder no longer owns the ship-settings shell contract: " +
|
||||
string.Join(", ", missingBuilderSymbols));
|
||||
}
|
||||
|
||||
if (shipSettingsSurfaceBuilder.Contains("public static AetheriaRuntimeShipSettingsSurfaceState Compose(", StringComparison.Ordinal) ||
|
||||
shipSettingsSurfaceBuilder.Contains("public static AetheriaRuntimeShipSettingsSurfaceState Project(", StringComparison.Ordinal))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Runtime ship settings composition must stay behind Build(...); do not re-expose Compose/Project as the public ship settings surface path.");
|
||||
}
|
||||
}
|
||||
|
||||
static void RequireInventoryCargoItemDetailsUseEveSurface(string root)
|
||||
|
|
|
|||
|
|
@ -214,7 +214,10 @@ public class InventoryMenu : MonoBehaviour
|
|||
transform,
|
||||
_shipSettingsSurfaceDocument,
|
||||
"Aetheria Inventory Ship Settings Surface",
|
||||
AetheriaRuntimeShipSettingsSurfaceBuilder.Build(ComposeCurrentShipSettingsSurface(currentEntity)),
|
||||
AetheriaRuntimeShipSettingsSurfaceBuilder.Build(
|
||||
currentEntity?.Entity?.DisplayName ?? "",
|
||||
(float)(currentEntity?.ShutdownPerformance ?? 0),
|
||||
FormatValue),
|
||||
HandleCurrentShipSettingsSurfaceCommand,
|
||||
_shipSettingsSurfaceChrome);
|
||||
}
|
||||
|
|
@ -269,15 +272,6 @@ public class InventoryMenu : MonoBehaviour
|
|||
AetheriaEveUnitySurfaceHost.Hide(_shipSettingsSurfaceDocument);
|
||||
}
|
||||
|
||||
private AetheriaRuntimeShipSettingsSurfaceState ComposeCurrentShipSettingsSurface(
|
||||
AetheriaRuntimeCurrentEntityDocument currentEntity)
|
||||
{
|
||||
return AetheriaRuntimeShipSettingsSurfaceBuilder.Compose(
|
||||
currentEntity?.Entity?.DisplayName ?? "",
|
||||
(float)(currentEntity?.ShutdownPerformance ?? 0),
|
||||
FormatValue);
|
||||
}
|
||||
|
||||
private void RenderCargoItemDetailsSurface(ItemInstance item)
|
||||
{
|
||||
var typedItem = FindTypedInventoryItem(item);
|
||||
|
|
|
|||
|
|
@ -31,7 +31,23 @@ namespace GameCult.Aetheria.State.Verse
|
|||
public const string ResetShutdownThreshold = "aetheria.inventory.current_ship_settings.shutdown.reset";
|
||||
public const string Close = "aetheria.inventory.current_ship_settings.close";
|
||||
|
||||
public static AetheriaRuntimeShipSettingsSurfaceState Compose(
|
||||
public static AetheriaRuntimeSurfaceDocument Build(
|
||||
string shipName,
|
||||
float shutdownPerformance,
|
||||
Func<float, string> formatShutdownPerformance,
|
||||
DateTime updatedAtUtc = default(DateTime),
|
||||
long version = 1)
|
||||
{
|
||||
return Build(
|
||||
ComposeState(
|
||||
shipName,
|
||||
shutdownPerformance,
|
||||
formatShutdownPerformance,
|
||||
updatedAtUtc),
|
||||
version);
|
||||
}
|
||||
|
||||
private static AetheriaRuntimeShipSettingsSurfaceState ComposeState(
|
||||
string shipName,
|
||||
float shutdownPerformance,
|
||||
Func<float, string> formatShutdownPerformance,
|
||||
|
|
|
|||
Loading…
Reference in a new issue