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)]
[ExecuteInEditMode]
public class StoreView : MonoBehaviour
Fields
m_IsDirty
Tracks whether any properties have been changed. Checked by Update() to see whether content should be updated.
Declaration
protected bool m_IsDirty
Field Value
Type | Description |
---|---|
Boolean |
onPurchasableStatusChanged
Callback that will get triggered any time one of the TransactionItemViews in the store has the status of it's itemPurchasableStatus change.
Declaration
[Space]
public StoreView.PurchasableStatusChangedEvent onPurchasableStatusChanged
Field Value
Type | Description |
---|---|
StoreView.PurchasableStatusChangedEvent |
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
public StoreView.TransactionSuccessEvent onTransactionSucceeded
Field Value
Type | Description |
---|---|
StoreView.TransactionSuccessEvent |
Properties
badgeTextPropertyKey
The Static Property key for the text to display in the badge for any Bundle Transaction Items that have the key defined. The key specified here will overwrite any that might be set in the supplied bundleItemPrefab.
Declaration
public string badgeTextPropertyKey { get; }
Property Value
Type | Description |
---|---|
String |
bundleItemPrefab
The prefab with DetailedTransactionItemView component attached to use for creating the TransactionItemView items that have more than one payout, if UseBundleTransactionItem is enabled.
Declaration
public DetailedTransactionItemView bundleItemPrefab { get; set; }
Property Value
Type | Description |
---|---|
DetailedTransactionItemView |
currencyPayoutCountPrefix
The string to prefix the payout Currency counts when displaying a bundle transaction's payouts. The key specified here will overwrite any that might be set in the supplied bundleItemPrefab.
Declaration
public string currencyPayoutCountPrefix { get; }
Property Value
Type | Description |
---|---|
String |
featuredBundleItemPrefab
The prefab with DetailedTransactionItemView component attached to use for creating the first transaction item in the Store, if UnityEngine.GameFoundation.Components.StoreView.useFeaturedTransactionItem is enabled, and the first item in the Store has more than one payout.
Declaration
public DetailedTransactionItemView featuredBundleItemPrefab { get; set; }
Property Value
Type | Description |
---|---|
DetailedTransactionItemView |
featuredItemPrefab
The prefab with TransactionItemView component attached to use for creating the first transaction item in the Store, if UnityEngine.GameFoundation.Components.StoreView.useFeaturedTransactionItem is enabled.
Note: If UnityEngine.GameFoundation.Components.StoreView.useFeaturedTransactionItem is enabled, and the first transaction item in the Store has more than one payout, this prefab will not be used and only featuredBundleItemPrefab will be used.
Declaration
public TransactionItemView featuredItemPrefab { get; set; }
Property Value
Type | Description |
---|---|
TransactionItemView |
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 sprites of the Transaction Items for displaying in the Store View. The key specified here will overwrite any that might be set in the supplied transactionItemPrefab.
Declaration
public string itemIconSpritePropertyKey { get; }
Property Value
Type | Description |
---|---|
String |
itemPayoutCountPrefix
The string to prefix the payout InventoryItem counts when displaying a bundle transaction's payouts. The string specified here will overwrite any that might be set in the supplied bundleItemPrefab.
Declaration
public string itemPayoutCountPrefix { get; }
Property Value
Type | Description |
---|---|
String |
noPriceString
The string to display on Purchase Button if the Transaction Item has no cost. The string specified here will overwrite any that might be set in the supplied transactionItemPrefab.
Declaration
public string noPriceString { get; }
Property Value
Type | Description |
---|---|
String |
payoutItemIconPropertyKey
The Static Property key for the icon of the Inventory or Currency payout items of a bundle transaction, as specified in the payout items' Static Properties. The key specified here will overwrite any that might be set in the supplied bundleItemPrefab.
Declaration
public string payoutItemIconPropertyKey { 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. The key specified here will overwrite any that might be set in the supplied transactionItemPrefab.
Declaration
public string priceIconSpritePropertyKey { get; }
Property Value
Type | Description |
---|---|
String |
revealHiddenItemsButton
Optional button that, when clicked, will reveal any transaction items in the Store list that don't have the tag specified by tag.
Declaration
public Button revealHiddenItemsButton { get; set; }
Property Value
Type | Description |
---|---|
Button |
showHiddenItems
Controls whether items that are by default hidden from display in the Store should be shown or not. By default this value is false.
Declaration
public bool showHiddenItems { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
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 Transaction Item Tag that the specified store should be filtered to for its default display. If a revealHiddenItemsButton is provided, the entire store list will be revealed, irrespective of this filter.
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; set; }
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. |
SetBadgeTextPropertyKey(String)
Sets the Static Property key that will be used when displaying the bundle transaction's badge.
Declaration
public void SetBadgeTextPropertyKey(string propertyKey)
Parameters
Type | Name | Description |
---|---|---|
String | propertyKey | The key that is defined in the bundle transaction's static properties for the transaction's badge. |
SetBundleTransactionItemPrefab(DetailedTransactionItemView)
Sets the value of bundleItemPrefab and updates the view if the application is playing. If null is passed in, any bundle transaction items in the store view will use transactionItemPrefab to display their content.
Declaration
public void SetBundleTransactionItemPrefab(DetailedTransactionItemView itemPrefab)
Parameters
Type | Name | Description |
---|---|---|
DetailedTransactionItemView | itemPrefab | The prefab of type DetailedTransactionItemView to use for displaying bundle transaction items. |
SetCurrencyPayoutCountPrefix(String)
Sets the string to prefix the payout Currency counts with when displaying Bundle Transaction Items.
Declaration
public void SetCurrencyPayoutCountPrefix(string prefix)
Parameters
Type | Name | Description |
---|---|---|
String | prefix | The string to prefix. |
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 StoreView and the StoreView's TransactionItemViews should be enabled or not. |
SetInteractableTransactionItems(Boolean)
Sets the interactability of all the child TransactionItemViews. Does not effect the interactability of the StoreView itself.
Declaration
public void SetInteractableTransactionItems(bool interactable)
Parameters
Type | Name | Description |
---|---|---|
Boolean | interactable | Whether the TransactionItemViews in the StoreView should be enabled or not. |
SetInventoryItemPayoutCountPrefix(String)
Sets the string to prefix the payout Inventory Item counts with when displaying Bundle Transaction Items.
Declaration
public void SetInventoryItemPayoutCountPrefix(string prefix)
Parameters
Type | Name | Description |
---|---|---|
String | prefix | The string to prefix. |
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. |
SetPayoutItemIconPropertyKey(String)
Sets the Static Property key for the payout item icons used by DetailedTransactionItemView.
Declaration
public void SetPayoutItemIconPropertyKey(string propertyKey)
Parameters
Type | Name | Description |
---|---|---|
String | propertyKey | The Static Property key that is defined on the Currency or Inventory Item payouts for the transaction. |
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 Static Property key that is defined on the Currency or Inventory Item costs for the transaction. |
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. |
SetTransactionItemPrefab(TransactionItemView)
Sets the value of transactionItemPrefab and updates the view if the application is playing.
Declaration
public void SetTransactionItemPrefab(TransactionItemView itemPrefab)
Parameters
Type | Name | Description |
---|---|---|
TransactionItemView | itemPrefab | The prefab of type TransactionItemView to use for displaying transaction items. |
ShowHiddenItems(Boolean)
Method that sets showHiddenItems and controls whether to filter the Store View to the value set in tag.
If true is passed in, all items in the Store list will be shown, and, if a revealHiddenItemsButton has been provided, it will hide the button. If false is passed in, only the items that have the given tag will be shown and, if a revealHiddenItemsButton has been provided, it will be shown.
Declaration
public void ShowHiddenItems(bool showItems)
Parameters
Type | Name | Description |
---|---|---|
Boolean | showItems | Whether or not to show items that don't have the selected tag. |