Class TransactionItemView
Component that manages displaying a BaseTransaction's icon, display name and PurchaseButton. When attached to a game object, it will display the Transaction Item's icon and displayName and create and display a PurchaseButton (PurchaseButton) to complete purchase transactions for it.
Inherited Members
Namespace: UnityEngine.GameFoundation.Components
Syntax
[AddComponentMenu("Game Foundation/Transaction Item View", 2)]
[ExecuteInEditMode]
public class TransactionItemView : MonoBehaviour
Fields
onTransactionFailed
Callback that will get triggered if a purchase for any item in the store fails.
Declaration
public TransactionItemView.TransactionFailureEvent onTransactionFailed
Field Value
Type | Description |
---|---|
TransactionItemView.TransactionFailureEvent |
onTransactionSucceeded
Callback that will get triggered if a purchase for any item in the store completes successfully.
Declaration
[Space]
public TransactionItemView.TransactionSuccessEvent onTransactionSucceeded
Field Value
Type | Description |
---|---|
TransactionItemView.TransactionSuccessEvent |
Properties
interactable
Use to enable or disable interaction on the store UI.
Declaration
public bool interactable { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
itemIconImageField
The Image component to assign the Transaction Item's icon image to.
Declaration
public Image itemIconImageField { get; }
Property Value
Type | Description |
---|---|
Image |
itemIconSpritePropertyKey
The Static Property key string that should be used for getting the item icon sprite of the Transaction Item for displaying in the view.
Declaration
public string itemIconSpritePropertyKey { get; }
Property Value
Type | Description |
---|---|
String |
itemNameTextField
The Text component to assign the item's display name to.
Declaration
public Text itemNameTextField { get; }
Property Value
Type | Description |
---|---|
Text |
noPriceString
The string to display on PurchaseButton if the Transaction Item has no cost.
Declaration
public string noPriceString { get; }
Property Value
Type | Description |
---|---|
String |
priceIconSpritePropertyKey
The Static Property key string that should be used for getting the price icon sprite of the Transaction Item for displaying in the PurchaseButton.
Declaration
public string priceIconSpritePropertyKey { 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 |
transaction
The BaseTransaction to display in the view.
Declaration
public BaseTransaction transaction { get; }
Property Value
Type | Description |
---|---|
BaseTransaction |
transactionKey
The key of the BaseTransaction being displayed.
Declaration
public string transactionKey { get; }
Property Value
Type | Description |
---|---|
String |
Methods
SetInteractable(Boolean)
Sets the button's interactable state if the state specified is different from the current state.
Declaration
public void SetInteractable(bool interactable)
Parameters
Type | Name | Description |
---|---|---|
Boolean | interactable | Whether the button should be enabled or not. |
SetItemIconImageField(Image)
Sets the Image component to display item icon sprite on this view.
Declaration
public void SetItemIconImageField(Image image)
Parameters
Type | Name | Description |
---|---|---|
Image | image | The Image component to display item icon sprite. |
SetItemIconSpritePropertyKey(String)
Sets the Static Property key for Transaction Item icon that will be displayed on this view.
Declaration
public void SetItemIconSpritePropertyKey(string propertyKey)
Parameters
Type | Name | Description |
---|---|---|
String | propertyKey | The Static Property key that is defined on Transaction Item for item icon sprite. |
SetItemNameTextField(Text)
Sets the Text component to display item name on this view.
Declaration
public void SetItemNameTextField(Text text)
Parameters
Type | Name | Description |
---|---|---|
Text | text | The Text component to display the item name. |
SetNoPriceString(String)
Sets the string to display on PurchaseButton when there is no cost defined in the Transaction Item.
Declaration
public void SetNoPriceString(string noPriceString)
Parameters
Type | Name | Description |
---|---|---|
String | noPriceString | The string to display. |
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 the Static Property key that is defined on Transaction Item for price icon sprite. |
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. |
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. |