Skip to content

RevFramework – Sample Scene: 04_Currency_UIBars

Sample Scripts Namespace: RevGaming.RevFramework.Samples.Currency


🎯 Purpose

Demonstrate that RevFramework’s Currency system is UI-agnostic — it works seamlessly with UGUI, TextMeshPro, and UI Toolkit (UITK), without any adapters, bridges, or pipeline dependencies.

This scene exists to prove that wallet updates propagate identically across multiple UI systems, using only the built-in OnWalletChanged event from the ICurrencyService.


🧩 What This Scene Demonstrates

  • How both UGUI and UITK bars can display the same wallet data live.
  • How all bar components auto-update through ICurrencyService.OnWalletChanged.
  • That the Currency system is not tied to any UI package or render pipeline.
  • How to test wallet changes in real time using the CurrencyUIBarsPanel.
  • How to freely mix multiple UI layers in one scene — all stay perfectly synchronized.

🧪 Sample Scripts (Demo-Only)

This scene includes a small Scripts folder containing demo-only helpers under:

RevGaming.RevFramework.Samples.Currency

These scripts exist only to support the sample scene layout and presentation
(e.g. spacing, visual tweaks, demo glue).

They are not required by the Currency system and can be safely deleted along with this scene without affecting runtime behaviour.

No framework logic depends on these scripts.


🕹️ How to Use

  1. Enter Play Mode.
  2. Open the CurrencyUIBarsPanel (F8).
  3. Use the panel to:
  4. Credit / Debit with the + and buttons.
  5. Set a specific balance directly.
  6. Apply small nudges (+1, +10, −1, −10, etc.) for live feedback.
  7. Observe both Canvas (UGUI) and UITK bars updating instantly.
  8. Duplicate or spawn additional bars — they will all remain synced automatically.

🔐 Authority (Important)

This sample scene includes a CurrencyAuthorityBinder configured for single-player use:

  • CurrencyAuthorityBinder
  • alwaysTrue = true

This allows all currency mutations so the demo works out of the box.

Why this exists

RevFramework currency mutations are authority-gated by default.

  • If no authority is present, all mutations are blocked.
  • This is intentional and required for multiplayer safety.

Multiplayer note

For multiplayer or server-authoritative games:

  • Do not use CurrencyAuthorityBinder
  • Implement your own ICurrencyAuthority
  • Validate all currency mutations on the server/host

This scene uses the permissive binder only to demonstrate behaviour in a local, single-player context.


💡 Key Takeaways

  • All bar types (UGUI, TMP, UITK) listen to the same OnWalletChanged event — no polling, no extra code.
  • RevFramework’s currency logic is completely decoupled from UI technology.
  • The system doesn’t care whether you’re using World-Space, Canvas, or UITK interfaces.
  • CurrencyBarUITK uses a local UXML + PanelSettings file unique to this demo scene.
  • The TextMeshPro variant is omitted intentionally to avoid dependency bloat in the sample project.
  • A perfect example for integrating wallet data into HUDs, inventory screens, or shop interfaces.
  • UI Toolkit assets (UXML / USS / PanelSettings) are scoped to this scene only. They exist purely for demonstration and can be safely removed with the scene without affecting the Currency system.

⚙️ Stack Composition

Bootstrap: CurrencyServiceBootstrap
Service Stack:
SceneCurrencyService → AuditedCurrencyService → AuthorityCurrencyService

(Authority provided by CurrencyAuthorityBinder for single-player demos.) Teaching Panel: CurrencyUIBarsPanel
UI Components:
- CurrencyBar (UGUI)
- CurrencyBarUITK (UI Toolkit)
- Optional CurrencyBarTMP (TextMeshPro variant)

Scene Path:

Assets/RevFramework/Runtime/Systems/Currency/Samples/Scenes/04_Currency_UIBars/


⚠️ Gotchas

  • If bars don’t update, check that they are bound to the correct Owner + CurrencyDefinition.
  • UITK variants require a valid PanelSettings asset — ensure one exists in the scene.
  • The TextMeshPro variant (CurrencyBarTMP) is disabled by default to avoid package requirements.
  • Multiple UI systems can coexist safely, but excessive UI event traffic can impact editor performance.
  • CurrencyBar components can also be spawned dynamically via script; they subscribe automatically.
  • If this scene is running the bootstrapped service stack, removing CurrencyAuthorityBinder will cause all currency mutations to fail with Unauthorized.

  • 00_Currency_Basics — Fundamentals of wallet updates.
  • 03_Currency_Persistence — Saving and restoring wallet data.
  • CoreSceneCurrencyService and OnWalletChanged event hooks.
  • UI — Implementation details for all bar components.
  • Decorators — Audit and BatchEvent layers that drive UI updates.

Summary
This scene isn’t about flashy visuals — it’s about architectural proof.
One service. Two UI systems. Zero coupling.
RevFramework stays modular from logic to presentation.