Simple IAP System  5.0
Public Member Functions | Public Attributes | List of all members
ShopItem2D

Shop item properties: stores all necessary variables for visualizing a product in the 2D shop UI. More...

Inheritance diagram for ShopItem2D:

Public Member Functions

void Init (IAPProduct product)
 Initialize virtual or real item properties based on IAPProduct set in IAP Project Settings. Called by IAPContainer, or manually. More...
 
void OverwriteWithFetch ()
 Method for overwriting shop item's properties with localized IAP data from the Store server. When receiving this callback, we check if 'fetch' was checked for this product in the Project Settings editor, then simply reinitialize the items using the new data. More...
 
void Refresh ()
 Refreshes the visual representation of this shop item. This is called automatically because of subscribing to the DBManager update event. It also means saving performance due to not refreshing all items every time. More...
 
void Unlock ()
 Unlocks this item by hiding the 'locked' gameobject and setting up the default state. Called by ShopManager. More...
 
void ConfirmPurchase (bool selected)
 Show the buy button based on the bool passed in. This simulates 'double tap to purchase' behavior, and only works when setting a buyTrigger button. More...
 
void ShowPreview ()
 
void Purchase ()
 When the buy button has been clicked, here we try to purchase this item. This calls into the corresponding billing workflow of the IAPManager. More...
 
void Purchased (bool state)
 Set this item to 'purchased' state (true), or unpurchased state (false) for fake purchases. More...
 
void IsSelected (bool thisSelect)
 Handles selection state for this item, but this method gets called on other radio buttons within the same group too. Called by selectButton's Toggle component. More...
 
void Deselect ()
 Called when deselecting this item via the deselectButton. More...
 

Public Attributes

string productID
 ID of the product. Do not enter if you are letting IAPContainers instantiate your shop items. More...
 
Text title
 Label for product name or title. More...
 
Text description
 Label for product description. More...
 
bool uppercase = false
 Boolean for setting all label contents to uppercase. More...
 
Image icon
 Icon sprite for visualization. More...
 
Text amount
 Label displaying currently owned amount of a consumable product. More...
 
Text expiration
 Label displaying the expiration time of a subscription product. More...
 
GameObject buyButton
 Buy button that invokes the actual purchase. More...
 
GameObject buyTrigger
 Buy trigger, used for making the buy button visible. (optional - can be used for 'double tap to purchase') More...
 
GameObject previewButton
 Button for previewing bundle contents, if any. More...
 
GameObject selectButton
 Button for selecting this item. More...
 
GameObject deselectButton
 Button for deselecting this item. More...
 
Text lockedLabel
 Label that displays text while this item is locked. More...
 
GameObject[] hideOnUnlock
 UI elements that will be de-activated when unlocking this item. More...
 
GameObject[] showOnUnlock
 UI elements that will be activated when unlocking this item. More...
 
GameObject discounted
 Additional UI element that will be activated on sold items. More...
 
GameObject sold
 Additional UI element that will be activated on sold items. More...
 
GameObject selected
 Additional UI element that will be activated on selected items. More...
 
List< ShopItemCostcosts = new List<ShopItemCost>()
 Array of cost labels, associated to a real or virtual currency property. There could be more than one currency for virtual product purchases. More...
 

Detailed Description

Shop item properties: stores all necessary variables for visualizing a product in the 2D shop UI.

Member Function Documentation

void ConfirmPurchase ( bool  selected)

Show the buy button based on the bool passed in. This simulates 'double tap to purchase' behavior, and only works when setting a buyTrigger button.

void Deselect ( )

Called when deselecting this item via the deselectButton.

void Init ( IAPProduct  product)

Initialize virtual or real item properties based on IAPProduct set in IAP Project Settings. Called by IAPContainer, or manually.

void IsSelected ( bool  thisSelect)

Handles selection state for this item, but this method gets called on other radio buttons within the same group too. Called by selectButton's Toggle component.

void OverwriteWithFetch ( )

Method for overwriting shop item's properties with localized IAP data from the Store server. When receiving this callback, we check if 'fetch' was checked for this product in the Project Settings editor, then simply reinitialize the items using the new data.

void Purchase ( )

When the buy button has been clicked, here we try to purchase this item. This calls into the corresponding billing workflow of the IAPManager.

void Purchased ( bool  state)

Set this item to 'purchased' state (true), or unpurchased state (false) for fake purchases.

void Refresh ( )

Refreshes the visual representation of this shop item. This is called automatically because of subscribing to the DBManager update event. It also means saving performance due to not refreshing all items every time.

void ShowPreview ( )

void Unlock ( )

Unlocks this item by hiding the 'locked' gameobject and setting up the default state. Called by ShopManager.

Member Data Documentation

Text amount

Label displaying currently owned amount of a consumable product.

GameObject buyButton

Buy button that invokes the actual purchase.

GameObject buyTrigger

Buy trigger, used for making the buy button visible. (optional - can be used for 'double tap to purchase')

List<ShopItemCost> costs = new List<ShopItemCost>()

Array of cost labels, associated to a real or virtual currency property. There could be more than one currency for virtual product purchases.

Text description

Label for product description.

GameObject deselectButton

Button for deselecting this item.

GameObject discounted

Additional UI element that will be activated on sold items.

Text expiration

Label displaying the expiration time of a subscription product.

GameObject [] hideOnUnlock

UI elements that will be de-activated when unlocking this item.

Image icon

Icon sprite for visualization.

Text lockedLabel

Label that displays text while this item is locked.

GameObject previewButton

Button for previewing bundle contents, if any.

string productID

ID of the product. Do not enter if you are letting IAPContainers instantiate your shop items.

GameObject selectButton

Button for selecting this item.

GameObject selected

Additional UI element that will be activated on selected items.

GameObject [] showOnUnlock

UI elements that will be activated when unlocking this item.

GameObject sold

Additional UI element that will be activated on sold items.

Text title

Label for product name or title.

bool uppercase = false

Boolean for setting all label contents to uppercase.


The documentation for this class was generated from the following file: