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 real runtime systems.

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_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, equip/unequip
InventorySearchAndSortPanel Discovery tools Service-backed search and stable sorting
InventorySnapshotsPanel Persistence Capture, restore, delete, missing-item policy

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.


🎯 Learning Goals

Across all panels you’ll learn to:

  • Bind and resolve CharacterInventory and SceneInventoryService
  • Perform safe item mutations (GiveExact, RemoveExact, SplitResult)
  • Understand merge-then-swap and slot acceptance semantics
  • Apply and test equipment filters and restrictions
  • Execute service-backed search and sorting
  • Capture and restore inventory snapshots
  • Interpret operation results and rejection reasons
  • Distinguish local container operations from service/authority paths

💡 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 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 container logic into your own UI.
  • Ignore IMGUI/layout code — it’s scaffolding only.

Important notes:

  • Operations via SceneInventoryService respect IInventoryAuthority
  • Some panels demonstrate direct container calls (merge/swap/clear) — these are explicitly local-only
  • Snapshot restore requires a valid ItemDatabase

Panels will surface clear warnings when requirements are missing.


🧱 Teaching Folder Layout

Inventory/
 ├─ Teaching/
 │   ├─ InventoryQuickstartPanel.cs
 │   ├─ InventoryItemsAndStacksPanel.cs
 │   ├─ InventorySlotsAndRestrictionsPanel.cs
 │   ├─ InventorySearchAndSortPanel.cs
 │   └─ InventorySnapshotsPanel.cs
 └─ Samples/
     └─ Matching demo scenes

🧠 Quick Review

Attribute Summary
Audience Developers integrating or exploring the Inventory system
Goal Teach container, stack, equipment, and persistence behaviour
Style Code-first, readable, and 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, equipment, search, sorting, and snapshots — then copy the patterns into your own UI.