Interface IRewardManager
Manages Rewards at runtime.
Namespace: UnityEngine.GameFoundation
Syntax
public interface IRewardManager
Methods
Claim(RewardDefinition, String)
Claim a reward item's payout.
Declaration
Deferred<Payout> Claim(RewardDefinition rewardDefinition, string rewardItemKey)
Parameters
Type | Name | Description |
---|---|---|
RewardDefinition | rewardDefinition | The reward definition that contains the reward item you wish to claim. |
String | rewardItemKey | The key of the reward item you wish to claim. |
Returns
Type | Description |
---|---|
Deferred<Payout> | Returns a Deferred<TResult> for tracking the asynchronous UnityEngine.Promise.Promise`1. |
FindReward(String)
Find a reward instance based on the reward definition key.
Declaration
Reward FindReward(string rewardKey)
Parameters
Type | Name | Description |
---|---|---|
String | rewardKey | The reward definition key to search for. |
Returns
Type | Description |
---|---|
Reward | An instance of a Reward. |
GetLastClaimableRewardItemKey(RewardDefinition)
Get the key of the reward item that is currently claimable. If multiple items are claimable, then this returns the one with the highest position (index) in the reward item collection.
Declaration
string GetLastClaimableRewardItemKey(RewardDefinition rewardDefinition)
Parameters
Type | Name | Description |
---|---|---|
RewardDefinition | rewardDefinition | The reward to search for a claimable item. |
Returns
Type | Description |
---|---|
String | Returns the key of a claimable reward item, or an empty string if none are claimable. |
Exceptions
Type | Condition |
---|---|
KeyNotFoundException | Thrown if the reward key does not match any known RewardDefinition in the catalog. |
GetRewards(ICollection<Reward>, Boolean)
Get all Reward instances.
Declaration
int GetRewards(ICollection<Reward> target = null, bool clearTarget = true)
Parameters
Type | Name | Description |
---|---|---|
ICollection<Reward> | target | A List to clear and populate with the reward instances. |
Boolean | clearTarget | If |
Returns
Type | Description |
---|---|
Int32 | The number of Reward instances found. |
Update()
Checks each reward to see if it's time for a state change. If yes, then recalculate the state of that reward.
Declaration
void Update()
Events
rewardItemClaimFailed
Invoked after a reward item claim fails. Parameters: reward key, reward item key, exception
Declaration
event Action<string, string, Exception> rewardItemClaimFailed
Event Type
Type | Description |
---|---|
Action<String, String, Exception> |
rewardItemClaimInitiated
Invoked as soon as a valid reward item claim is initiated. Parameters: reward key, reward item key
Declaration
event Action<string, string> rewardItemClaimInitiated
Event Type
Type | Description |
---|---|
Action<String, String> |
rewardItemClaimProgressed
Invoked when the progress is incremented on a reward item's Deferred<TResult>. Parameters: Reward, reward item key, current step (zero-based), total steps
Declaration
event Action<Reward, string, int, int> rewardItemClaimProgressed
Event Type
Type | Description |
---|---|
Action<Reward, String, Int32, Int32> |
rewardItemClaimSucceeded
Invoked after a reward item claim has succeeded at all levels. Parameters: Reward, reward item key, currencies and items paid out
Declaration
event Action<Reward, string, Payout> rewardItemClaimSucceeded
Event Type
Type | Description |
---|---|
Action<Reward, String, Payout> |