载入中...
搜索中...
未找到
PixelWorldCatalogPanel.cpp
浏览该文件的文档.
141eve::Result<PixelWorldCatalogPanel> PixelWorldCatalogPanel::create(std::string_view catalogJson) {
220 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "material id is outside the Catalog",
231 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "reaction index is outside the Catalog",
254 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "reaction index is outside the Catalog",
265 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "phase index is outside the Catalog",
287 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "phase index is outside the Catalog",
324 eve::DiagnosticCode::PreconditionViolation, "pixelworld catalog panel requires an active UI ECS world",
409 image("material-preview", 96.0f, 56.0f).withTint(red, green, blue, alpha).withCornerRadius(6.0f),
410 inputText("Name", selected.name, "material-name", [mutateMaterial](const std::string& value) mutable {
460 integerField("Default temperature", "material-default-temperature", selected.defaultTemperature,
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={}, DiagnosticDetails details={}, std::string source={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.h:125
const T & value() const &
Borrow the value from a const lvalue after checking success.
Definition Result.h:308
bool ok() const noexcept
Whether this result represents a non-failure outcome.
Definition Result.h:255
const Status & status() const noexcept
Inspect the structured operation status.
Definition Result.h:269
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
Owning immutable material and reaction table used by one PixelWorld.
Definition PixelMaterial.h:84
const MaterialDefinition & definition(MaterialId id) const noexcept
Resolve a validated id; invalid ids safely project to air.
Definition PixelMaterial.cpp:234
bool canReact(MaterialId id) const noexcept
Whether this material participates in at least one binary reaction.
Definition PixelMaterial.cpp:242
static MaterialCatalog builtIn()
Construct the engine's canonical built-in catalog.
Definition PixelMaterial.cpp:151
std::span< const MaterialReactionRule > reactions() const noexcept
Borrow immutable canonical-priority reaction rules.
Definition PixelMaterial.cpp:240
std::span< const MaterialDefinition > definitions() const noexcept
Borrow immutable definitions until this catalog is destroyed.
Definition PixelMaterial.cpp:239
std::span< const MaterialPhaseRule > phaseRules() const noexcept
Borrow immutable canonical-priority phase rules.
Definition PixelMaterial.cpp:241
static eve::Result< MaterialCatalog > create(std::vector< MaterialDefinition > definitions, std::vector< MaterialReactionRule > reactions={}, std::vector< MaterialPhaseRule > phaseRules={})
Validate and own a complete catalog candidate transactionally.
Definition PixelMaterial.cpp:38
bool canPhaseTransition(MaterialId id) const noexcept
Whether this material owns at least one phase transition rule.
Definition PixelMaterial.cpp:246
Main-thread-affine control surface shared by editor, CLI and MCP adapters.
Definition PixelWorldControl.h:47
eve::Result< PixelCatalogReloadReceipt > reloadMaterialCatalog(std::uint64_t worldId, std::string_view catalogJson, std::uint64_t expectedFingerprint)
Validate JSON and transactionally hot-reload a compatible paused world Catalog.
Definition PixelWorldControl.cpp:128
Dedicated visual material/reaction Catalog editor with transactional draft admission.
Definition PixelWorldCatalogPanel.h:47
eve::ui::WidgetDesc buildWidgetTree()
Build a dedicated material browser, property inspector and rule editor visual tree.
Definition PixelWorldCatalogPanel.cpp:375
eve::Result< CatalogDraftReceipt > addReaction(eve::pixelworld::MaterialReactionRule rule)
Add a binary rule and select its canonical post-validation position.
Definition PixelWorldCatalogPanel.cpp:238
eve::Result< CatalogDraftReceipt > removePhase(std::size_t index)
Remove one phase rule transactionally.
Definition PixelWorldCatalogPanel.cpp:284
eve::Result< CatalogDraftReceipt > removeReaction(std::size_t index)
Remove one binary rule transactionally.
Definition PixelWorldCatalogPanel.cpp:251
static eve::Result< PixelWorldCatalogPanel > create(std::string_view catalogJson)
Decode and validate a versioned Catalog document into a fresh panel draft.
Definition PixelWorldCatalogPanel.cpp:141
eve::Result< CatalogDraftReceipt > replaceReaction(std::size_t index, eve::pixelworld::MaterialReactionRule rule)
Replace one binary rule after validating the entire reconstructed Catalog.
Definition PixelWorldCatalogPanel.cpp:227
PixelWorldCatalogPanel(const PixelWorldCatalogPanel &)=delete
std::vector< MaterialCard > materialCards() const
Project deterministic cards for the material browser.
Definition PixelWorldCatalogPanel.cpp:153
eve::Result< void > selectPhase(std::size_t index)
Select a phase-transition rule by canonical index.
Definition PixelWorldCatalogPanel.cpp:184
eve::Result< void > selectMaterial(std::size_t index)
Select a material by canonical index without mutating the Catalog.
Definition PixelWorldCatalogPanel.cpp:166
eve::Result< CatalogDraftReceipt > loadDocument(std::string_view catalogJson)
Replace the draft from a validated document; failure leaves all panel state intact.
Definition PixelWorldCatalogPanel.cpp:298
eve::Result< void > selectReaction(std::size_t index)
Select a binary reaction rule by canonical index.
Definition PixelWorldCatalogPanel.cpp:175
void close()
Hide the mounted panel without discarding its validated draft.
Definition PixelWorldCatalogPanel.cpp:343
eve::Result< CatalogDraftReceipt > replaceMaterial(eve::pixelworld::MaterialDefinition definition)
Replace one material definition after validating the entire reconstructed Catalog.
Definition PixelWorldCatalogPanel.cpp:215
eve::Result< eve::pixelworld::PixelCatalogReloadReceipt > apply(eve::pixelworld::PixelWorldControlService &control, std::uint64_t worldId, std::uint64_t expectedFingerprint) const
Apply the draft through the canonical paused-world authority path.
Definition PixelWorldCatalogPanel.cpp:307
eve::Result< CatalogDraftReceipt > replacePhase(std::size_t index, eve::pixelworld::MaterialPhaseRule rule)
Replace one phase rule after validating the entire reconstructed Catalog.
Definition PixelWorldCatalogPanel.cpp:261
eve::Result< CatalogDraftReceipt > addPhase(eve::pixelworld::MaterialPhaseRule rule)
Add a phase rule and select its canonical post-validation position.
Definition PixelWorldCatalogPanel.cpp:272
PixelWorldCatalogPanel & operator=(const PixelWorldCatalogPanel &)=delete
bool isOpen() const
True while the panel has a live, visible UI host.
Definition PixelWorldCatalogPanel.cpp:347
eve::ui::UIHostHandle host() const noexcept
Mounted UI host handle, or an empty handle before open().
Definition PixelWorldCatalogPanel.h:121
eve::Result< eve::ui::UIHostHandle > open()
Mount or reveal the panel in the UI ECS world and publish its current tree.
Definition PixelWorldCatalogPanel.cpp:316
static PixelWorldCatalogPanel builtIn()
Create a panel over the canonical built-in Catalog.
Definition PixelWorldCatalogPanel.cpp:149
eve::Result< void > refresh()
Reconcile the mounted host with the latest draft and selection state.
Definition PixelWorldCatalogPanel.cpp:352
eve::Result< std::string > document() const
Encode the current validated draft using the canonical versioned JSON codec.
Definition PixelWorldCatalogPanel.cpp:294
static UIHostHandle createHost(const std::string &name="")
Creates an ECS-owned UI host.
Definition UIHost.cpp:48
static eve::OptionalRef< UIHost > resolve(UIHostHandle handle) noexcept
Resolves a UI host handle with ECS generation checking.
Definition UIHost.cpp:61
Definition PixelWorldGraphics.h:13
eve::Result< MaterialCatalog > decodeMaterialCatalogJson(std::string_view json)
Decode and validate schema eve.pixelworld.material-catalog version 1.
Definition PixelMaterialCatalogCodec.cpp:172
MaterialId
Compact stable material identifier stored in each authoritative cell.
Definition PixelMaterial.h:16
eve::Result< std::string > encodeMaterialCatalogJson(const MaterialCatalog &catalog)
Encode schema eve.pixelworld.material-catalog version 1 canonically.
Definition PixelMaterialCatalogCodec.cpp:131
ControlEdit button(const char *label, float width=0.f, float height=0.f)
Shared immediate renderer for retained and EditorHost buttons.
Definition ControlPrimitives.h:15
ControlEdit combo(const char *label, int &selected, const std::vector< const char * > &items)
Shared immediate renderer for indexed combo boxes.
Definition ControlPrimitives.h:37
ControlEdit inputText(const char *label, std::string &value, bool multiline=false, ImVec2 multilineSize=ImVec2(0.f, 96.f))
UTF-8 owning text editor with automatic buffer growth.
Definition ControlPrimitives.h:63
Definition Component.cpp:5
WidgetDesc collapsingHeader(std::string label, std::vector< WidgetDesc > children, std::string id, bool defaultOpen)
Collapsible header containing child widgets.
Definition Widget.cpp:623
WidgetDesc badge(std::string label, std::string id)
Compact status/category pill. Tint controls its background color.
Definition Widget.cpp:489
WidgetDesc statusBar(std::vector< WidgetDesc > children, std::string id)
Compact horizontal status strip; Spacer children absorb free width.
Definition Widget.cpp:596
WidgetDesc inputText(std::string label, std::string value, std::string id, std::function< void(const std::string &)> onChange)
Editable text field; fires onTextChange.
Definition Widget.cpp:453
WidgetDesc window(std::string title, std::vector< WidgetDesc > children, std::string id)
Top-level window widget with a title bar.
Definition Widget.cpp:292
WidgetDesc spacer(std::string id, float grow)
Flexible empty space; default flexGrow=1 so it absorbs free space in a Flex parent.
Definition Widget.cpp:697
WidgetDesc child(std::string id, std::vector< WidgetDesc > children, float width, float height)
Scrollable child region with an explicit size.
Definition Widget.cpp:635
WidgetDesc toolbar(std::vector< WidgetDesc > children, std::string id)
Horizontal editor command strip; Spacer children absorb free width.
Definition Widget.cpp:563
WidgetDesc searchField(std::string hint, std::string value, std::string id, std::function< void(const std::string &)> onChange)
Compact search field with placeholder text and a bundled search icon.
Definition Widget.cpp:465
WidgetDesc sidebar(std::vector< WidgetDesc > children, std::string id, float width)
Vertical editor side panel. Width defaults to 240 logical pixels.
Definition Widget.cpp:586
WidgetDesc scrollList(std::string id, std::vector< WidgetDesc > children, float height, float itemHeight)
Scroll list.
Definition Widget.cpp:646
WidgetDesc splitPane(FlexDirection direction, WidgetDesc first, WidgetDesc second, float ratio, std::string id, std::function< void(float)> onResize)
Two resizable panes separated by a drag handle.
Definition Widget.cpp:607
WidgetDesc sectionHeader(std::string label, std::string id)
Non-collapsible editor section heading with an accent marker.
Definition Widget.cpp:522
@ InvalidArgument
@ PreconditionViolation
Definition Container.h:602
Immutable validated properties for one catalog material.
Definition PixelMaterial.h:36
std::int16_t ignitionTemperature
Definition PixelMaterial.h:44
std::uint32_t displayRgba
Canonical preview/render color encoded as 0xRRGGBBAA.
Definition PixelMaterial.h:52
std::int16_t boilingTemperature
Definition PixelMaterial.h:46
std::uint16_t heatCapacity
Definition PixelMaterial.h:43
std::vector< std::string > tags
Canonical sorted semantic tags used by authoring and rule queries.
Definition PixelMaterial.h:54
std::int16_t meltingTemperature
Definition PixelMaterial.h:45
std::uint8_t thermalConductivity
Definition PixelMaterial.h:42
std::uint16_t defaultLifetime
Definition PixelMaterial.h:47
std::int16_t defaultTemperature
Definition PixelMaterial.h:49
std::uint16_t blastResistance
Definition PixelMaterial.h:50
Data-driven phase transition evaluated after heat diffusion.
Definition PixelMaterial.h:61
std::int16_t temperatureDelta
Definition PixelMaterial.h:67
TemperatureDirection direction
Definition PixelMaterial.h:65
Deterministically ordered binary material reaction.
Definition PixelMaterial.h:72
MaterialId secondResult
Definition PixelMaterial.h:77
std::int16_t minimumTemperature
Definition PixelMaterial.h:78
MaterialId firstResult
Definition PixelMaterial.h:76
Draft mutation receipt used for UI reconciliation and optimistic publication.
Definition PixelWorldCatalogPanel.h:31
Declarative widget description (build once / on dirty → flatten into UIHost::Tree).
Definition Widget.h:15