Economy #

Read more about the Economy system in Hiro here.

Initializing the economy system #

The economy system relies on the Nakama System which must be passed in as dependencies via the constructor. You must also specify which StoreType you wish to work with.

1
2
var economySystem = new EconomySystem(_nakamaSystem, EconomyNakamaSystem.StoreType.AppleAppStore);
systems.Add(economySystem);

Subscribing to changes in the economy system #

You can listen for changes in the economy system so that you can respond appropriately, such as updating the UI, by implementing the appropriate interface.

1
2
3
4
5
var disposer = SystemObserver<EconomySystem>.Create(leaderboardsSystem, system => {
  Instance.Logger.Info($"System updated.");

  // Update UI elements etc as necessary here...
});

Refreshing the economy system #

To ensure the economy system has the latest information from Nakama you can refresh it.

1
await economySystem.RefreshAsync();