Class PromotionPopupView
Component that manages displaying a Transaction Item's promotion popup, including promotion image, display name and PurchaseButton. When attached to a game object, it will display an image featuring the contents of the Transaction Item's payouts (or a specified image), the Transaction Item's displayName and create and display a PurchaseButton to complete purchase transactions for it.
Inherited Members
Namespace: UnityEngine.GameFoundation.Components
Syntax
[AddComponentMenu("Game Foundation/Promotion Popup View", 2)]
[ExecuteInEditMode]
public class PromotionPopupView : MonoBehaviour
Fields
onPopupClosed
Callback that will get triggered when the Promotion Popup is closed.
Declaration
public PromotionPopupView.PopupClosedEvent onPopupClosed
Field Value
Type | Description |
---|---|
PromotionPopupView.PopupClosedEvent |
onPopupOpened
Callback that will get triggered when the Promotion Popup is opened.
Declaration
public PromotionPopupView.PopupOpenedEvent onPopupOpened
Field Value
Type | Description |
---|---|
PromotionPopupView.PopupOpenedEvent |
onTransactionFailed
A callback that will get triggered if a purchase for any item in the store fails.
Declaration
public PromotionPopupView.TransactionFailureEvent onTransactionFailed
Field Value
Type | Description |
---|---|
PromotionPopupView.TransactionFailureEvent |
onTransactionSucceeded
A callback that will get triggered if a purchase for any item in the store completes successfully.
Declaration
public PromotionPopupView.TransactionSuccessEvent onTransactionSucceeded
Field Value
Type | Description |
---|---|
PromotionPopupView.TransactionSuccessEvent |
Properties
autoGeneratedImageContainer
The Transform in which to auto generate promotion image. Used only when Auto Generate Promo Image is enabled.
Declaration
public PayoutView autoGeneratedImageContainer { get; }
Property Value
Type | Description |
---|---|
PayoutView |
autoGeneratePromoImage
Determines whether or not the promotion's image will be auto-generated. If true (default), the image will be generated using the sprite asset name's for each Inventory or Currency Item listed in the Transaction's Payout. If false, the Promotion Sprite property key will be used to get the image from the transaction's static property.
Declaration
public bool autoGeneratePromoImage { get; }
Property Value
Type | Description |
---|---|
Boolean |
badgeField
The ImageInfoView to assign the badge to.
Declaration
public ImageInfoView badgeField { get; }
Property Value
Type | Description |
---|---|
ImageInfoView |
badgeTextPropertyKey
The Static Property key for the badge to be displayed in callout.
Declaration
public string badgeTextPropertyKey { get; }
Property Value
Type | Description |
---|---|
String |
currencyPayoutCountPrefix
The string to prefix the payout Currency counts when auto generating the promotion image.
Declaration
public string currencyPayoutCountPrefix { get; }
Property Value
Type | Description |
---|---|
String |
descriptionPropertyKey
The Static Property key for the promotion description to be displayed.
Declaration
public string descriptionPropertyKey { get; }
Property Value
Type | Description |
---|---|
String |
descriptionTextField
The TextMeshProUGUI component to assign the description to.
Declaration
public TextMeshProUGUI descriptionTextField { get; }
Property Value
Type | Description |
---|---|
TMPro.TextMeshProUGUI |
itemPayoutCountPrefix
The string to prefix the payout InventoryItem counts when auto generating the promotion image.
Declaration
public string itemPayoutCountPrefix { get; }
Property Value
Type | Description |
---|---|
String |
payoutItemIconSpritePropertyKey
The Static Property key for the icon of the Inventory or Currency Items listed in the Transaction's Payout, as specified in their Static Properties. Used only when Auto Generate Promo Image is enabled.
Declaration
public string payoutItemIconSpritePropertyKey { get; }
Property Value
Type | Description |
---|---|
String |
priceIconSpritePropertyKey
The Static Property key for price icon that will be displayed on the PurchaseButton, as specified in the Static Property for the Inventory Item or Currency listed in the price.
Declaration
public string priceIconSpritePropertyKey { get; }
Property Value
Type | Description |
---|---|
String |
promoImageField
The Image component to assign the Promotion Image to. Used only when Auto Generate Promo Image is disabled.
Declaration
public Image promoImageField { get; }
Property Value
Type | Description |
---|---|
Image |
promoImageSpritePropertyKey
The Static Property key for the promotion image that will be displayed on this view, as specified in the Transaction's Static Property. Used only when Auto Generate Promo Image is disabled.
Declaration
public string promoImageSpritePropertyKey { get; }
Property Value
Type | Description |
---|---|
String |
purchaseButton
The PurchaseButton to set with the TransactionItem's purchase info.
Declaration
public PurchaseButton purchaseButton { get; }
Property Value
Type | Description |
---|---|
PurchaseButton |
titleTextField
The TextMeshProUGUI component to assign the Transaction's display name to.
Declaration
public TextMeshProUGUI titleTextField { get; }
Property Value
Type | Description |
---|---|
TMPro.TextMeshProUGUI |
transaction
The BaseTransaction to display in the view.
Declaration
public BaseTransaction transaction { get; }
Property Value
Type | Description |
---|---|
BaseTransaction |
transactionKey
The key of the Transaction Item being displayed.
Declaration
public string transactionKey { get; }
Property Value
Type | Description |
---|---|
String |
Methods
Close()
Hides the promotion popup. Will trigger a PopupClosedEvent (PromotionPopupView.PopupClosedEvent) and a PopupWillCloseEvent ( PromotionPopupView.PopupWillCloseEvent).
Declaration
public void Close()
Open()
Displays the promotion popup. Will trigger a PopupOpenedEvent (PromotionPopupView.PopupOpenedEvent).
Declaration
public void Open()
Open(BaseTransaction)
Displays the promotion popup. Will trigger a PopupOpenedEvent (PromotionPopupView.PopupOpenedEvent).
Declaration
public void Open(BaseTransaction transaction)
Parameters
Type | Name | Description |
---|---|---|
BaseTransaction | transaction | A reference to BaseTransaction that should be displayed. |
Open(BaseTransaction, Boolean)
Displays the promotion popup. Will trigger a PopupOpenedEvent (PromotionPopupView.PopupOpenedEvent).
Declaration
public void Open(BaseTransaction transaction, bool autoGeneratePromoImage)
Parameters
Type | Name | Description |
---|---|---|
BaseTransaction | transaction | A reference to BaseTransaction that should be displayed. |
Boolean | autoGeneratePromoImage | Specifies whether the promotion image should be auto generated using the Payout sprite property key or will be user provided via the promotion sprite property key. |
SetAutoGeneratedImageContainer(PayoutView)
Sets the Transform in which to display the promotion's image on this view.
Declaration
public void SetAutoGeneratedImageContainer(PayoutView container)
Parameters
Type | Name | Description |
---|---|---|
PayoutView | container | The Transform in which to display the promotion's image. |
SetAutoGenerateImage(Boolean)
Sets whether the image used for the promotion should be auto generated or use an asset from the transaction's Asset Detail.
Declaration
public void SetAutoGenerateImage(bool autoGenerateImage)
Parameters
Type | Name | Description |
---|---|---|
Boolean | autoGenerateImage | If true it will auto generate the Promotion Image, ignoring the promoImageSpritePropertyKey field. Field is true by default. If false, it will use the key specified in promoImageSpritePropertyKey to get the image from the Transaction's Static Property. |
SetAutoGeneratePromotionImage(String, String, String)
Set the image used for the promotion should be auto generated.
Declaration
public void SetAutoGeneratePromotionImage(string itemIconSpritePropertyKey, string itemCountPrefix = "x", string currencyCountPrefix = "x")
Parameters
Type | Name | Description |
---|---|---|
String | itemIconSpritePropertyKey | The Static Property key for the icon of the Inventory or Currency Items listed in the Transaction's Payout, as specified in their Static Properties. |
String | itemCountPrefix | The string to prefix the payout inventory item counts when auto generating the promotion image. |
String | currencyCountPrefix | The string to prefix the payout currency counts when auto generating the promotion image. |
SetBadgeField(ImageInfoView)
Sets the ImageInfoView component to display the promotion's badge on this view.
Declaration
public void SetBadgeField(ImageInfoView badge)
Parameters
Type | Name | Description |
---|---|---|
ImageInfoView | badge | The ImageInfoView component to display the promotion's badge. |
SetBadgeTextPropertyKey(String)
Sets the Static Property key that will be used when displaying the promotion's badge.
Declaration
public void SetBadgeTextPropertyKey(string propertyKey)
Parameters
Type | Name | Description |
---|---|---|
String | propertyKey | The key that is defined in the Transaction's static properties for the promotion's badge. |
SetDescriptionPropertyKey(String)
Sets the static property key that will be used when displaying the promotion's description.
Declaration
public void SetDescriptionPropertyKey(string propertyKey)
Parameters
Type | Name | Description |
---|---|---|
String | propertyKey | The key that is defined in the Transaction's Static Properties for the promotion's description. |
SetDescriptionTextField(TextMeshProUGUI)
Sets the TextMeshProUGUI component to display the promotion's description on this view.
Declaration
public void SetDescriptionTextField(TextMeshProUGUI text)
Parameters
Type | Name | Description |
---|---|---|
TMPro.TextMeshProUGUI | text | The TextMeshProUGUI component to display the promotion's description. |
SetPriceIconSpritePropertyKey(String)
Sets the Static Property key for price icon that will be displayed on PurchaseButton.
Declaration
public void SetPriceIconSpritePropertyKey(string propertyKey)
Parameters
Type | Name | Description |
---|---|---|
String | propertyKey | The key is defined in the Transaction's Static Properties. |
SetPromoImageField(Image)
Sets the Image component to display the promotion image on this view.
Declaration
public void SetPromoImageField(Image image)
Parameters
Type | Name | Description |
---|---|---|
Image | image | The Image component to display the promotion. |
SetPromotionImagePropertyKey(String)
Sets Static Property key for the promotion image asset that will be used when displaying the user-provided promotion image and disable Auto Generate Promo Image (autoGeneratePromoImage).
Declaration
public void SetPromotionImagePropertyKey(string propertyKey)
Parameters
Type | Name | Description |
---|---|---|
String | propertyKey | The key that is defined on the Transaction item's Static Property for the promotion image. |
SetPurchaseButton(PurchaseButton)
Sets PurchaseButton to be able to purchase Transaction Item by UI.
Declaration
public void SetPurchaseButton(PurchaseButton purchaseButton)
Parameters
Type | Name | Description |
---|---|---|
PurchaseButton | purchaseButton | The PurchaseButton to display price and price icon and to be able to purchase the TransactionItem by using UI. |
SetTitleTextField(TextMeshProUGUI)
Sets the TextMeshProUGUI component to display the Transaction's display name on this view.
Declaration
public void SetTitleTextField(TextMeshProUGUI text)
Parameters
Type | Name | Description |
---|---|---|
TMPro.TextMeshProUGUI | text | The TextMeshProUGUI component to display the transaction's name. |
SetTransaction(BaseTransaction)
Sets Transaction Item should be displayed by this view.
Declaration
public void SetTransaction(BaseTransaction transaction)
Parameters
Type | Name | Description |
---|---|---|
BaseTransaction | transaction | A reference to BaseTransaction that should be displayed. |