Class RewardPopupView
Component that manages displaying a Reward's popup, including schedule of rewards with a button to claim a Reward Item.
Inherited Members
Namespace: UnityEngine.GameFoundation.Components
Syntax
[AddComponentMenu("Game Foundation/Reward Popup View", 6)]
[ExecuteInEditMode]
public class RewardPopupView : MonoBehaviour
Fields
onPopupClosed
Callback that will get triggered when the Reward Popup is closed.
Declaration
public RewardPopupView.PopupClosedEvent onPopupClosed
Field Value
Type | Description |
---|---|
RewardPopupView.PopupClosedEvent |
onPopupOpened
Callback that will get triggered when the Reward Popup is opened.
Declaration
[Space]
public RewardPopupView.PopupOpenedEvent onPopupOpened
Field Value
Type | Description |
---|---|
RewardPopupView.PopupOpenedEvent |
onRewardClaimed
Callback that will get triggered when a Reward Item is claimed.
Declaration
public RewardPopupView.RewardClaimedEvent onRewardClaimed
Field Value
Type | Description |
---|---|
RewardPopupView.RewardClaimedEvent |
onRewardStateChanged
Callback that will get triggered when the state of the Reward changes.
Declaration
public RewardPopupView.RewardStateChangedEvent onRewardStateChanged
Field Value
Type | Description |
---|---|
RewardPopupView.RewardStateChangedEvent |
Properties
autoHideCloseButton
Specifies whether the close button is invisible when there is claimable Reward Item.
Declaration
public bool autoHideCloseButton { get; }
Property Value
Type | Description |
---|---|
Boolean |
autoPopulatedRewardItemContainer
The Transform in which to auto populate Reward Items.
Declaration
public Transform autoPopulatedRewardItemContainer { get; }
Property Value
Type | Description |
---|---|
Transform |
claimableRewardItemPrefab
The RewardItemView prefab to use when displaying the claimable Reward Items.
Declaration
public RewardItemView claimableRewardItemPrefab { get; }
Property Value
Type | Description |
---|---|
RewardItemView |
claimButton
The RewardClaimButton that will be used to initiate claims, if any.
Declaration
public RewardClaimButton claimButton { get; }
Property Value
Type | Description |
---|---|
RewardClaimButton |
claimedRewardItemPrefab
The RewardItemView prefab to use when displaying the previously claimed Reward Items.
Declaration
public RewardItemView claimedRewardItemPrefab { get; }
Property Value
Type | Description |
---|---|
RewardItemView |
closeButton
The GameObject for close button.
Declaration
public Transform closeButton { get; }
Property Value
Type | Description |
---|---|
Transform |
countdownCooldownDescription
The string description to display on the countdown, if any, during a cooldown period when no Reward Items are claimable. Unless null or empty, it will overwrite any description specified on the countdown prefab.
Declaration
public string countdownCooldownDescription { get; }
Property Value
Type | Description |
---|---|
String |
countdownDisplayFormat
The format to display the countdown in. Look at https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-timespan-format-strings and https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-timespan-format-strings for lists of valid formats.
Declaration
public string countdownDisplayFormat { get; }
Property Value
Type | Description |
---|---|
String |
countdownExpirationDescription
The string description to display on the countdown, if any, during an expiration period when a Reward Item is claimable for a certain amount of time. Unless null or empty, it will overwrite any description specified on the countdown prefab.
Declaration
public string countdownExpirationDescription { get; }
Property Value
Type | Description |
---|---|
String |
countdownTextField
The TextMeshProUGUI field to display the countdown time in. If null no countdown will be displayed.
Declaration
public TextMeshProUGUI countdownTextField { get; }
Property Value
Type | Description |
---|---|
TMPro.TextMeshProUGUI |
descriptionPropertyKey
The Static Property key string that should be used for getting description text. If there is no Static Property with that key on the Reward, no description will be displayed.
Declaration
public string descriptionPropertyKey { get; }
Property Value
Type | Description |
---|---|
String |
descriptionTextField
The TextMeshProUGUI field to assign the description to.
Declaration
public TextMeshProUGUI descriptionTextField { get; }
Property Value
Type | Description |
---|---|
TMPro.TextMeshProUGUI |
lockedRewardItemPrefab
The RewardItemView prefab to use to display rewards that are currently locked but will be claimable in the future. It will also be used as the default prefab in the case that any of the special case prefabs are not provided.
Declaration
public RewardItemView lockedRewardItemPrefab { get; }
Property Value
Type | Description |
---|---|
RewardItemView |
missedRewardItemPrefab
The RewardItemView prefab to use when displaying any previously available Reward Items that were not claimed. This state is only possible when a Reward has an expiration time, has multiple Reward Items in the list, and has resetIfExpired set to false.
Declaration
public RewardItemView missedRewardItemPrefab { get; }
Property Value
Type | Description |
---|---|
RewardItemView |
payoutItemIconSpritePropertyKey
The Static Property key string that should be used for getting the image of each item in the Payout of a Reward Item for displaying in the RewardItemPrefabs. The key must exist on each inventory item or currency added as a payout.
Declaration
public string payoutItemIconSpritePropertyKey { get; }
Property Value
Type | Description |
---|---|
String |
reward
Returns the runtime instance of the Reward being displayed by the popup.
Declaration
public Reward reward { get; }
Property Value
Type | Description |
---|---|
Reward |
rewardItemTitlePropertyKey
The Static Property key that should be used to get the title to display for each Reward Item. If there is no Static Property with that key on the Reward, no item titles will be displayed. Suggested format for the string value the key maps to would be something like "Day {0}" where {0} will be replaced with the count + 1 of the item in the Reward's list.
Declaration
public string rewardItemTitlePropertyKey { get; }
Property Value
Type | Description |
---|---|
String |
rewardKey
The key of the Reward being displayed.
Declaration
public string rewardKey { get; }
Property Value
Type | Description |
---|---|
String |
titleTextField
The TextMeshProUGUI field to assign the Reward's displayName to.
Declaration
public TextMeshProUGUI titleTextField { get; }
Property Value
Type | Description |
---|---|
TMPro.TextMeshProUGUI |
Methods
Close()
Hides the Reward Popup. Will trigger a PopupClosedEvent (RewardPopupView.PopupClosedEvent).
Declaration
public void Close()
Open()
Displays the Reward Popup. Will trigger a PopupOpenedEvent (RewardPopupView.PopupOpenedEvent).
Declaration
public void Open()
Open(Reward)
Displays the Reward Popup. Will trigger a PopupOpenedEvent (RewardPopupView.PopupOpenedEvent).
Declaration
public void Open(Reward reward)
Parameters
Type | Name | Description |
---|---|---|
Reward | reward | The Reward being displayed. |
SetAutoHideCloseButton(Boolean)
Specifies whether the close button is invisible when there is claimable Reward Item.
Declaration
public void SetAutoHideCloseButton(bool autoHide)
Parameters
Type | Name | Description |
---|---|---|
Boolean | autoHide | Used to determine if the close button should be hidden when there is a claimable Reward Item. |
SetAutoPopulatedRewardItemContainer(Transform)
Sets the container in which to auto populate Reward Items.
Declaration
public void SetAutoPopulatedRewardItemContainer(Transform container)
Parameters
Type | Name | Description |
---|---|---|
Transform | container | The transform to use as a container to populate Reward Items. |
SetClaimableRewardItemPrefab(RewardItemView)
Sets the prefab to use when displaying the currently claimable Reward Item.
Declaration
public void SetClaimableRewardItemPrefab(RewardItemView claimableItemPrefab)
Parameters
Type | Name | Description |
---|---|---|
RewardItemView | claimableItemPrefab | The prefab to use when displaying the currently claimable Reward Item. If null, Locked Reward Item Prefab will be displayed. |
SetClaimButton(RewardClaimButton)
Sets the RewardClaimButton that will be used for initiating claims. RewardPopupView will update the claim button whenever the claimable RewardItem changes.
Declaration
public void SetClaimButton(RewardClaimButton claimButton)
Parameters
Type | Name | Description |
---|---|---|
RewardClaimButton | claimButton | The RewardClaimButton that will be used for initiating claims. Handles null values gracefully, and claiming Reward Items will have to be done a different way. |
SetClaimedRewardItemPrefab(RewardItemView)
Sets the prefab to use when displaying the Reward Items that have already been successfully claimed.
Declaration
public void SetClaimedRewardItemPrefab(RewardItemView claimedItemPrefab)
Parameters
Type | Name | Description |
---|---|---|
RewardItemView | claimedItemPrefab | The prefab to use when displaying already claimed Reward Items. If null, Locked Reward Item Prefab will be displayed. |
SetCloseButton(Transform)
Sets the RewardClaimButton that will be used for initiating claims. RewardPopupView will update the claim button whenever the claimable RewardItem changes.
Declaration
public void SetCloseButton(Transform closeButton)
Parameters
Type | Name | Description |
---|---|---|
Transform | closeButton | The RewardClaimButton that will be used for initiating claims. Handles null values gracefully, and claiming Reward Items will have to be done a different way. |
SetCountdownCooldownDescription(String)
Sets the string description to display on the countdown during a cooldown period when no Reward Items are claimable. Will not change visible description until the next cooldown period.
Declaration
public void SetCountdownCooldownDescription(string description)
Parameters
Type | Name | Description |
---|---|---|
String | description | The string to display in the countdown description during a cooldown period when no Reward Items are claimable. Will overwrite any description specified on the countdown prefab, unless null or empty. |
SetCountdownDisplayFormat(String)
Sets the string that designates the format in which to display the countdown timer.
Declaration
public void SetCountdownDisplayFormat(string countdownFormat)
Parameters
Type | Name | Description |
---|---|---|
String | countdownFormat | The string format for display. See https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-timespan-format-strings and https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-timespan-format-strings for lists of valid formats. |
SetCountdownExpirationDescription(String)
Sets the string description to display on the countdown during an expiration period when a Reward Item is claimable for a certain amount of time. Will not change visible description until the next expiration period.
Declaration
public void SetCountdownExpirationDescription(string description)
Parameters
Type | Name | Description |
---|---|---|
String | description | The string to display in the countdown description during an expiration period when a Reward Item is claimable for a certain amount of time. Will overwrite any description specified on the countdown prefab, unless null or empty. |
SetCountdownTimerField(TextMeshProUGUI)
Sets the TextMeshProUGUI field to use when displaying the countdown time.
Declaration
public void SetCountdownTimerField(TextMeshProUGUI countdownField)
Parameters
Type | Name | Description |
---|---|---|
TMPro.TextMeshProUGUI | countdownField | The TextMeshProUGUI field to use when displaying the countdown time. If null, no countdown will be displayed. |
SetDescriptionPropertyKey(String)
Sets the key to use when getting a Reward's description from its Static Properties.
Declaration
public void SetDescriptionPropertyKey(string propertyKey)
Parameters
Type | Name | Description |
---|---|---|
String | propertyKey | The Static Property key to look up description by. If the key is not found in the Reward's Static Properties no description will be displayed. |
SetDescriptionTextField(TextMeshProUGUI)
Sets the TextMeshProUGUI field in which to display the Reward's description.
Declaration
public void SetDescriptionTextField(TextMeshProUGUI descriptionField)
Parameters
Type | Name | Description |
---|---|---|
TMPro.TextMeshProUGUI | descriptionField | The TextMeshProUGUI field in which to display the Reward's description. If null, no description will be displayed. |
SetLockedRewardItemPrefab(RewardItemView)
Sets the prefab to use when displaying a Reward's future claimable items. It is also used as the fallback for any of the other Reward Item prefab fields, if they are null.
Declaration
public void SetLockedRewardItemPrefab(RewardItemView lockedItemPrefab)
Parameters
Type | Name | Description |
---|---|---|
RewardItemView | lockedItemPrefab | The prefab to use when displaying future claimable Reward Items and any other Reward Items that don't have their own prefab specified. If null, future Reward Items and any others defaulting to use this prefab will not be displayed. |
SetMissedRewardItemPrefab(RewardItemView)
Sets the prefab to use when displaying the previously available Reward Items that were not successfully claimed.
Declaration
public void SetMissedRewardItemPrefab(RewardItemView missedItemPrefab)
Parameters
Type | Name | Description |
---|---|---|
RewardItemView | missedItemPrefab | The prefab to use when displaying the missed Reward Items. If null, Locked Reward Item Prefab will be displayed. |
SetPayoutItemIconSpritePropertyKey(String)
Sets the key to use when getting the images of the Inventory and Currency items that are paid out in this Reward. Each item should have this key in its Static Properties.
Declaration
public void SetPayoutItemIconSpritePropertyKey(string propertyKey)
Parameters
Type | Name | Description |
---|---|---|
String | propertyKey | The Static Property key to look up image by. Any Inventory or Currency Items that don't have this key in their Static Properties will not display an image. |
SetReward(Reward)
Sets the Reward displayed in this Reward Popup
Declaration
public void SetReward(Reward reward)
Parameters
Type | Name | Description |
---|---|---|
Reward | reward | The Reward to be displayed. |
SetRewardItemTitlePropertyKey(String)
Sets the key to use when getting the title to display for each Reward Item from the Reward's Static Properties. Suggested format for the string value the key maps to would be something like "Day {0}" where {0} will be replaced with the count + 1 of the item in the Reward's list.
Declaration
public void SetRewardItemTitlePropertyKey(string propertyKey)
Parameters
Type | Name | Description |
---|---|---|
String | propertyKey | The Static Property key to look up Reward Item title by. If the key is not found in the Reward's Static Properties no title will be displayed. |
SetTitleTextField(TextMeshProUGUI)
Sets the TextMeshProUGUI field in which to display the Reward's displayName.
Declaration
public void SetTitleTextField(TextMeshProUGUI nameField)
Parameters
Type | Name | Description |
---|---|---|
TMPro.TextMeshProUGUI | nameField | The TextMeshProUGUI field in which to display the Reward's displayName. If null, no title will be displayed. |