🧭 Economy — Teaching Panels¶
The Teaching folder contains a set of lightweight IMGUI panels used for learning, debugging, and hands-on testing of the Economy System directly inside your scenes.
These panels demonstrate how Currency, Inventory, and Item Store abstractions combine into unified buy / sell / craft / reward flows.
Each panel is intentionally minimal and code-first — ideal for understanding behaviour, copying patterns, and wiring your own production UI later.
Status: Sample / Teaching UI — intended for development/testing scenes only. Not for shipping.
Define Guard:
REV_ECONOMY_PRESENT⚠️ If a Teaching panel is present on a GameObject in a shipped scene, it will be visible and interactive at runtime.
Shipping with Teaching panels attached is a developer error, not a framework bug.
🧩 Panel Overview¶
| Panel | Focus | Notes |
|---|---|---|
| EconomyQuickstartPanel | Currency-only economy | Buy, Craft, Reward using CurrencyValueLedger |
| EconomyWithInventoryPanel | Full economy stack | Buy, Sell, Craft, Reward with inventory rollback safety |
Each panel is self-contained and demonstrates one clear concept.
All panels inherit from TeachablePanelBase, use pure IMGUI, anchor top-left, and toggle with the Backquote (`) key.
Panels build services exclusively via EconomyBootstrap and never instantiate concrete implementations directly.
🎯 Learning Goals¶
Across all panels you’ll learn to:
- Resolve and bootstrap an economy via
EconomyBootstrap(facade-based construction) Concrete economy services are internal; panels consume interfaces only. - Execute Buy, Sell, Craft, and Reward operations safely
- Combine currency and inventory into a single transaction flow
- Use rollback-safe transactions to avoid partial state changes
- Inspect operation results and failure reasons
- Preview policy effects before applying mutations
- Understand ledger-backed value flows in the Economy layer
💡 Example: Basic Economy Operation¶
Teaching panels demonstrate the same call patterns your production UI will use:
var result = economy.Buy(owner, offerId);
if (!result.Success)
{
Debug.Log(result.ToUserMessage("Buy"));
}
No mock logic.
No demo-only shortcuts.
These are the real economy calls your game code will make.
🧰 Integration Tips¶
- Teaching panels are IMGUI-based and intended for Editor use only.
- They are excluded from player builds unless explicitly enabled and left in a scene.
- Safe to keep in dev scenes — they won’t affect runtime systems.
- Copy service calls, result handling, and policy checks into your own UI.
- Ignore IMGUI/layout code — it’s scaffolding only.
For full-stack panels, ensure:
- A valid
ICurrencyServiceis present - Inventory services are registered when required
- Item store / offer definitions are configured
- Economy is bootstrapped before use
Panels will clearly warn if dependencies are missing.
🧱 Teaching Folder Layout¶
Economy/
├─ Teaching/
│ ├─ EconomyQuickstartPanel.cs
│ └─ EconomyWithInventoryPanel.cs
└─ Samples/
└─ Matching demo scenes
🧠 Quick Review¶
| Attribute | Summary |
|---|---|
| Audience | Developers integrating or exploring the Economy system |
| Goal | Teach clear economy flows and transaction safety |
| Style | Code-first, readable, and dependency-light |
| Location | Assets/RevFramework/Runtime/Systems/Economy/Teaching/ |
| Safety | Editor-focused; must not be shipped with scenes |
| Theme | IMGUI — consistent with all RevFramework teaching panels |
TL;DR¶
The Teaching folder is your in-engine classroom for the Economy layer.
Use it to explore currency-only and full inventory-backed flows, then copy the patterns into your own UI.