💰 Currency / UI¶
🎯 Purpose¶
The UI layer provides components for displaying wallet balances across Unity UI systems.
These components are presentational only.
⚠️ Important Notes¶
- UI does not modify currency state
- UI does not own wallet logic
- Updates are driven by
ICurrencyService.OnWalletChanged - Behaviour depends on service resolution and composition
🧩 What Lives Here¶
CurrencyBar (UGUI)¶
- Uses
UnityEngine.UI.Textand optionalImage - Displays balance for a bound owner and currency
CurrencyBarTMP¶
- TextMeshPro variant
- Optional auto-rebind behaviour
CurrencyBarUITK¶
- UI Toolkit variant
- Uses
UIDocumentand query-based binding
🧠 Usage Guidance¶
Shared behaviour¶
All components:
- Bind to an owner and
CurrencyDefinition - Resolve the service via
CurrencyResolve - Subscribe to wallet change events
- Update when relevant changes occur
- Display
0when unavailable - Rebind when service changes
Usage¶
- Create
CurrencyDefinitionassets - Add a UI component
- Assign owner and currency
- Configure UI references
Refresh API¶
bar.RefreshNow();
bar.SetOwner(newOwner);
🧪 Diagnostics¶
- No updates may indicate missing service or binding
- Incorrect values may indicate mismatched owner or currency
🚫 Not for Production Use¶
These components are reference UI implementations and may be replaced by project-specific UI.
🧹 Safe to Remove¶
This folder may be removed if custom UI is used.
Currency runtime logic does not depend on UI.
🔗 Related Documentation¶
- Core — service resolution and events
- Decorators — batch and audit events
- Persistence — restore flows
- Samples — UI examples