Skip to content

Currency / Reason Text

Purpose

ReasonText.Currency provides human-readable messages for currency operation results.

It converts:

  • CurOpCode → readable string
  • CurOpResult → readable reason (preferring Message when available)

This utility is used by UI, logging, diagnostics, and teaching panels to present consistent wording.


Important Notes

  • This helper is for presentation only
  • Messages are developer-facing by default
  • Player-facing UI should provide its own copy or localisation
  • Behaviour does not affect currency logic

What Lives Here

ReasonText.Currency

Maps currency operation results to readable strings.

Supported inputs:

  • CurOpCode
  • CurOpResult

Usage Guidance

Behaviour

  • Returns result.Message when available
  • Otherwise returns a mapped string for CurOpCode
  • Returns an empty string for success (Ok)

Example

var r = svc.Debit(player, gold, 500);
Debug.Log(ReasonText.Currency(r));

Diagnostics

  • Unexpected messages may indicate custom Message values are provided
  • Missing mappings may require extending the helper when new codes are introduced

Internal Use Only

This helper is part of the public UX surface.

Do not:

  • Depend on specific wording for gameplay logic
  • Use messages as control flow

Safe to Remove

This folder may be removed if standardised messaging is not required.

Currency logic is not affected.


  • Abstractions — CurOpCode, CurOpResult
  • UI — components displaying currency state
  • Teaching — panels displaying currency feedback