Class StoreView
Component that manages displaying the Transaction Items contained within a given store. When attached to a game object, it will create a TransactionItemView (TransactionItemView) for each store item in the designated list, with the given game object as their parent.
Inherited Members
Namespace: UnityEngine.GameFoundation.Components
Syntax
[AddComponentMenu("Game Foundation/Store View", 1)]
public class StoreView : MonoBehaviour
Fields
onTransactionFailed
Callback that will get triggered if a purchase for any item in the store fails.
Declaration
public StoreView.TransactionFailureEvent onTransactionFailed
Field Value
Type | Description |
---|---|
StoreView.TransactionFailureEvent |
onTransactionSucceeded
Callback that will get triggered if a purchase for any item in the store completes successfully.
Declaration
[Space]
public StoreView.TransactionSuccessEvent onTransactionSucceeded
Field Value
Type | Description |
---|---|
StoreView.TransactionSuccessEvent |
Properties
interactable
Use to enable or disable interaction on the store UI.
Declaration
public bool interactable { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
itemContainer
The Transform in which to generate the list of TransactionItemView items.
Declaration
public Transform itemContainer { get; }
Property Value
Type | Description |
---|---|
Transform |
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 |
noPriceString
The string to display on Purchase Button 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 |
store
The Store to display in the view.
Declaration
public Store store { get; }
Property Value
Type | Description |
---|---|
Store |
storeKey
The identifier of the Store being purchased.
Declaration
public string storeKey { get; }
Property Value
Type | Description |
---|---|
String |
tag
The Tag in the specified store should be filtered to for display.
Declaration
public Tag tag { get; }
Property Value
Type | Description |
---|---|
Tag |
tagKey
The identifier of the tag items in the specified store should be filtered to for display.
Declaration
public string tagKey { get; }
Property Value
Type | Description |
---|---|
String |
transactionItemPrefab
The prefab with TransactionItemView component attached to use for creating the list of TransactionItemView items.
Declaration
public TransactionItemView transactionItemPrefab { get; }
Property Value
Type | Description |
---|---|
TransactionItemView |
Methods
GetItems()
Gets the list of TransactionItemViews that represents all items being displayed in this store view for the designated store.
Declaration
public TransactionItemView[] GetItems()
Returns
Type | Description |
---|---|
TransactionItemView[] | Array of TransactionItemViews objects for items being displayed in the store view. |
SetInteractable(Boolean)
Sets the PurchaseButton'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. |
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. |
SetNoPriceString(String)
Sets the string to display on Purchase Button 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. |
SetStore(Store, Tag)
Sets which Store should be displayed by this view.
Declaration
public void SetStore(Store store, Tag tag = null)
Parameters
Type | Name | Description |
---|---|---|
Store | store | The identifier for the Store that should be displayed. |
Tag | tag | A reference to Tag in specified Transactions of the Store to be displayed. |
Remarks
If the tag
param is null, all transactions in a store will be displayed.
SetTag(Tag)
Updates which tag of items within the store should be displayed by this view.
Declaration
public void SetTag(Tag tag)
Parameters
Type | Name | Description |
---|---|---|
Tag | tag | A reference to Tag in specified Transactions of the Store to be displayed. To show all Transactions in a store (no tag filtering) null can be passed as the tag. |