🛠️ Crafting Samples — Scripts & Demo Hooks¶
The Crafting Samples folders contain demo-only components and helpers for exploring and testing the Crafting system.
They are intended for learning, debugging, and prototyping — not for shipping in production builds.
These folders compile only when REV_SAMPLES and REV_CRAFTING_PRESENT are enabled.
API Boundary:
Nothing inSamples/orDemoHooks/is part of the supported Crafting Public API.
These scripts may change or be removed without notice.
📂 Folder Layout¶
Samples/
Crafting/
Scripts/ // Sample adapters, demo panels, persistence scaffolding
DemoHooks/ // Simple demo behaviours that hook into the service
🧩 Scripts/¶
FakeCurrencyAdapter¶
- Minimal in‑memory currency adapter.
- Stores balances per
(owner, currencyId). - Implements
GetBalance,TryDebit, andCredit. - Used to demonstrate currency‑gated crafting without a real economy.
- Demonstrates the adapter shape, not a production backend.
FakeInventoryAdapter¶
- Minimal in‑memory inventory adapter.
- Flat capacity per owner (or per container, depending on mode).
- Implements count, space check, consume, and add operations.
- Used to demo crafting without a full inventory system.
- Demonstrates the adapter shape, not a production backend.
FakeInventoryCurrencyTeachablePanel¶
- Sample IMGUI panel for testing FakeInventoryAdapter and FakeCurrencyAdapter together.
- Lets you add/remove items and adjust capacity or balance at runtime.
- Toggle visibility via a hotkey (default:
0). - Displays live results via
OpResultandPanelResultUI. - Sample-only UI scaffolding; not a supported Teaching panel or production UI.
CooldownPersistenceSample¶
- Demonstrates persistence of craft cooldowns using PlayerPrefs.
- Subscribes to
CraftingServiceCore.OnJobAcceptedto record cooldown start times. - Restores cooldown state on load and seeds the
CooldownValidatorusing sample-only scaffolding (PlayerPrefs, reflection, Editor-only helpers). - For production, replace this with your own save/load system and runtime-safe resolvers.
KnownItemsGenerator (Editor‑only)¶
- Generates a static C# class of GUID constants from a
KnownItemsListasset. - Helps eliminate string typos when referencing items by GUID.
- Accessed via: RevFramework → Generate → KnownItems Constants.
KnownItemsList¶
- Sample
ScriptableObjectlisting item GUIDs and constant names. - Used by
KnownItemsGeneratorto produce compile‑time safe constants. - Demonstrates one workflow for strongly typed item identifiers.
🔧 DemoHooks/¶
CraftingHUDController¶
- Lightweight MonoBehaviour that interacts directly with
CraftingServiceCore. - Exposes context menu actions for quick testing (Craft N, Cancel All).
- Demonstrates basic event‑driven UI hook patterns.
- Sample-only wiring example; not a production HUD.
SimpleCraftXpSink¶
- Logs awarded XP to the Console via
CraftingServiceCore.OnCraftXp. - Placeholder for connecting a real progression or levelling system.
- Sample-only event sink.
MinLevelValidator¶
- Demonstrates how to implement a custom crafting validator.
- Requires an attached
ICraftingLevelProvider. - Blocks crafting when
Level < minLevel. - Example pattern only; replace with your own game logic.
SimpleLevelProvider¶
- Minimal sample implementation of
ICraftingLevelProvider. - Adjustable level via Inspector with context menu actions.
- Used for demoing level‑gated crafting recipes.
- Not a reference progression system.
❗ Scope Reminder
RevFramework does not implement networking, replication, prediction, rollback, or reconciliation.
These samples demonstrate authority gating patterns only — all networking behaviour is your responsibility.
🧠 Notes¶
- All scripts in
/Samples/and/DemoHooks/are for demonstration only. - They provide working references for adapters, validators, providers, and basic UI wiring.
- Replace them with your own production systems for real gameplay.
- None of these components are required for the core Crafting system to function.
These samples exist purely to demonstrate patterns and provide inspiration —
copy ideas, extend them, or replace them entirely in your own game or editor tools.