Stats
Read more about the Stats system in Hiro here.
Initializing the stats system #
The stats system relies on the Nakama System and an ILogger, both must be passed in as dependencies via the constructor.
| |
Subscribing to changes in the stats system #
You can listen for changes in the stats system so that you can respond appropriately, such as updating the UI, by implementing the IObserver pattern, or use the SystemObserver<T> type which handles it for you.
| |
Refreshing the stats system #
To ensure the stats system has the latest information from Nakama you can refresh it.
| |
Listing public stats #
You can list public stats for the user:
| |
Listing private stats #
You can list private stats for the user:
| |
Updating public stats #
You can update public stats for the user.
| |
Operators
There are 4 operator values that you can use to update stats:
- Set: Set the given value, overwriting any previous one.
- Delta: Increment or decrement the existing value by the given amount. Equivalent to Set if no previous value existed.
- Min: Use the new value if it’s lower than the existing one. Equivalent to Set if no previous value existed.
- Max: Use the new value if it’s higher than the existing one. Equivalent to Set if no previous value existed.
Updating private stats #
You can update private stats for the user.
| |
