Skip to content

🎒 Inventory — Teaching Panels

The Teaching folder contains a set of lightweight IMGUI panels used for learning, debugging, and hands-on testing of the Inventory System directly inside your scenes.

These panels demonstrate stacking, equipment rules, searching, sorting, and snapshot persistence using the public runtime APIs of the Inventory system.

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 and testing scenes only. Not for shipping.

Define Guard: REV_INVENTORY_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
InventoryQuickstartPanel Core flow Give items, inspect container, remove, clear, snapshot save/load
InventoryItemsAndStacksPanel Stack operations Merge/swap, split, quick split, max-stack rules
InventorySlotsAndRestrictionsPanel Equipment rules Slot filters, acceptance checks, equip/unequip
InventorySearchAndSortPanel Discovery tools Service-backed search and stable sorting
InventorySnapshotsPanel Persistence Capture, restore, delete snapshots and missing-item policy

Each panel is self-contained and demonstrates one clear concept.

All panels inherit from TeachablePanelBase, use IMGUI, anchor to the top-left corner, and toggle with the Backquote (`) key.


🎯 Learning Goals

Across all panels you’ll learn to:

  • Bind and resolve CharacterInventory, CharacterEquipment, and SceneInventoryService
  • Perform safe inventory mutations (GiveExact, RemoveFromSlot, SplitResult)
  • Understand merge-then-swap and stack semantics
  • Apply and test equipment filters and slot restrictions
  • Execute service-backed search and stable sorting
  • Capture and restore inventory snapshots
  • Interpret operation results and rejection reasons
  • Use public runtime APIs without accessing internal containers

💡 Example: Giving Items Safely

Teaching panels demonstrate the same call patterns your production UI will use:

var stack = new ItemStack { def = itemDef, quantity = 5 };
var result = sceneInventory.GiveExact(owner, stack, containerId);

if (!result.Success)
{
    Debug.Log(result.ToUserMessage("Give"));
}

No mock logic. No demo-only shortcuts. These are the real inventory calls used at runtime.


🧰 Integration Tips

  • Teaching panels are IMGUI-based and intended for Editor and development scenes.
  • 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 container logic into your own UI.
  • Ignore IMGUI/layout code — it’s scaffolding only.

Important notes:

  • Inventory mutations via SceneInventoryService respect IInventoryAuthority
  • Panels interact with inventory using public APIs and supported runtime types
  • Panels do not access internal container implementations
  • Snapshot restore requires a valid ItemDatabase

Panels will surface clear warnings when required dependencies are missing.


🧱 Teaching Folder Layout

Inventory/
 └─ Teaching/
     ├─ HostileConsumer/
     │   ├─ InventoryQuickstartPanel.cs
     │   ├─ InventoryItemsAndStacksPanel.cs
     │   ├─ InventorySlotsAndRestrictionsPanel.cs
     │   ├─ InventorySearchAndSortPanel.cs
     │   └─ InventorySnapshotsPanel.cs
     │
     ├─ Support/
     │   (shared helpers used by teaching panels)
     │
     └─ Demo/
         (optional scenario demos or experimental teaching panels)

Panels inside HostileConsumer compile against the public API only, verifying that the Inventory system can be consumed externally.


🧠 Quick Review

Attribute Summary
Audience Developers integrating or exploring the Inventory system
Goal Teach container behaviour, stacking, equipment, search/sort, and persistence
Style Code-first, readable, dependency-light
Location Assets/RevFramework/Runtime/Systems/Inventory/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 Inventory system.

Use it to explore:

  • stacking behaviour
  • equipment restrictions
  • search and sorting
  • snapshot persistence

Then copy the service calls and runtime patterns into your own gameplay UI.