Skip to content

MenuBook

Namespace Nfty.Ticket in assembly Nfty.Ticket.

public record MenuBook

A CookBook flattened for runtime: every weight, rule and colorization, plus where the art is, and not one decoded pixel.

Remarks

MenuBook.MenuSchemaVersion is named — and therefore written and read — as menuSchemaVersion rather than the plain schemaVersion a member called SchemaVersion would camelCase to. A Menu's schema line is separate from Schema, the CookBook manifest line, and a shared key name between two independently evolving formats is how one gets bumped and silently changes what the other means. Named this way deliberately rather than overridden with a System.Text.Json.Serialization.JsonPropertyName attribute — no manifest record in this project carries a JSON attribute; the wire policy is supplied centrally (Nfty.Core.Formats.Json.Options on the write side, MenuArchive.WireOptions on the read side), and a property whose own name already produces the right key needs no exception to that rule.

Constructors

MenuBook(int, string?, Dimensions, string, string, IReadOnlyList<MenuRecipe>, MenuArt, bool)

public MenuBook(int MenuSchemaVersion, string? SourceCookBookSha256, Dimensions Canvas, string CollectionName, string CollectionSymbol, IReadOnlyList<MenuRecipe> Recipes, MenuArt Art, bool PartialAlpha = false);

Parameters

  • MenuSchemaVersion (int) - The Menu schema this was written against.
  • SourceCookBookSha256 (string?) - The hash of the .cbk this came from, or null when it was built from a book that never came from a file. Null means "cannot tell", never "differs".
  • Canvas (Dimensions) - The canvas every variant shares.
  • CollectionName (string) - What assets are published as — "{name} #{n}".
  • CollectionSymbol (string) - The collection's symbol.
  • Recipes (IReadOnlyList<MenuRecipe>) - Its recipes.
  • Art (MenuArt) - Where the art is.
  • PartialAlpha (bool) - Whether any variant image anywhere in the book carries partial alpha — the same definition Nfty.Core.Imaging.Opacity stamps onto every archive manifest, projected here so a runtime host can tell 2D-only art (safe to lift with depth maps alone) from art with a transparency gradient Rise cannot resolve, with no .cbk present. Defaults to false — schema 1 Menus are refused outright, so this default now matters only for a hand-written schema 2 manifest that omits the field; every Menu this build actually writes carries a real, stamped value.

Remarks

MenuBook.MenuSchemaVersion is named — and therefore written and read — as menuSchemaVersion rather than the plain schemaVersion a member called SchemaVersion would camelCase to. A Menu's schema line is separate from Schema, the CookBook manifest line, and a shared key name between two independently evolving formats is how one gets bumped and silently changes what the other means. Named this way deliberately rather than overridden with a System.Text.Json.Serialization.JsonPropertyName attribute — no manifest record in this project carries a JSON attribute; the wire policy is supplied centrally (Nfty.Core.Formats.Json.Options on the write side, MenuArchive.WireOptions on the read side), and a property whose own name already produces the right key needs no exception to that rule.

Properties

Art

public MenuArt Art { get; init; }

Where the art is.

Canvas

public Dimensions Canvas { get; init; }

The canvas every variant shares.

CollectionName

public string CollectionName { get; init; }

What assets are published as — "{name} #{n}".

CollectionSymbol

public string CollectionSymbol { get; init; }

The collection's symbol.

MenuSchemaVersion

public int MenuSchemaVersion { get; init; }

The Menu schema this was written against.

PartialAlpha

public bool PartialAlpha { get; init; }

Whether any variant image anywhere in the book carries partial alpha — the same definition Nfty.Core.Imaging.Opacity stamps onto every archive manifest, projected here so a runtime host can tell 2D-only art (safe to lift with depth maps alone) from art with a transparency gradient Rise cannot resolve, with no .cbk present. Defaults to false — schema 1 Menus are refused outright, so this default now matters only for a hand-written schema 2 manifest that omits the field; every Menu this build actually writes carries a real, stamped value.

Recipes

public IReadOnlyList<MenuRecipe> Recipes { get; init; }

Its recipes.

SourceCookBookSha256

public string? SourceCookBookSha256 { get; init; }

The hash of the .cbk this came from, or null when it was built from a book that never came from a file. Null means "cannot tell", never "differs".

Methods

CellKey(string, string, string)

public static string CellKey(string recipeId, string ingredientId, string variantId);

The key one variant's art is stored under.

Parameters

  • recipeId (string) - The recipe the layer belongs to.
  • ingredientId (string) - The layer.
  • variantId (string) - The variant.

Returns. The cell key.

Remarks

Scoped by RECIPE, and that is not redundancy. A .cbk nests a separate .igt inside each .rcp, so two recipes may each carry an ingredient with the id bg holding completely different variants. A shallower key collides without a word and one recipe silently draws another's art.