Simple IAP System  4.3
Public Member Functions | Static Public Member Functions | Public Attributes | Events | List of all members
ShopManager

Instantiates shop items in the scene, unlocks/locks and selects/deselects shop items based on previous purchases/selections. Can also be used in a scene with manually placed IAPItem. Initialized after database initialization. More...

Inheritance diagram for ShopManager:

Public Member Functions

void Init ()
 Initializes all IAPItem in the scene and instantiates them with their correct state. Called by IAPManager. More...
 
void Refresh (string id)
 Refreshes the visual representation of a specific 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...
 
ShopContainer GetContainer (string id)
 Returns container for a specific group id. More...
 

Static Public Member Functions

static ShopManager GetInstance ()
 Returns a static reference to this script. More...
 
static void RefreshAll ()
 Refreshes the visual representation of all shop items based on previous actions or user interaction, meaning we set them to 'purchased' or 'selected' in the GUI. You can call this manually in case PlayerData (unlock requirements) have changed. More...
 
static void RefreshGroup (string groupName)
 Refreshes the visual representation of a specific group in the IAP Settings editor. Same as RefreshAll(), but only for items within this specific group name. You can call this manually i.e. when manually changing product selections in a group. More...
 
static void OverwriteWithFetch (Product[] products)
 Method for overwriting shop item's properties with localized IAP data from the App Store servers. When we receive the online item list of products from the IAPManager, we loop over our products and check if 'fetch' was checked in the IAP Settings editor, then simply reinitialize the items by using the new data. More...
 
static void SetToSelected (IAPItem item)
 Sets an item to 'selected' in the database. More...
 
static void SetToDeselected (IAPItem item)
 Sets an item to 'deselected' in the database. More...
 
static void ShowMessage (string text)
 Show feedback/error window with text received through an event: This gets called in IAPListener's HandleSuccessfulPurchase method with some feedback, or automatically with the error message when a purchase failed at billing. More...
 
static void ShowConfirmation ()
 Shows window waiting for transaction confirmation. This gets called by PlayfabPayPalStore when waiting for the user to confirm his purchase payment with PayPal. More...
 
static IAPItem GetIAPItem (string id)
 Returns instantiated IAPItem shop item reference. More...
 

Public Attributes

GameObject errorWindow
 Window for showing feedback on IAPListener events to the user. More...
 
GameObject confirmWindow
 Confirmation window for refreshing transactions. Only required when using PayPal. More...
 
Text message
 Text component of the errorWindow gameobject. More...
 
List< ShopContainercontainers = new List<ShopContainer>()
 Store the relation between an IAP Group set in the IAP Settings Editor and its "parent" transform. This is because IAP Manager is a prefab that exists during scene changes, thus can't keep scene-specific data like transforms. More...
 
Dictionary< string, IAPItemIAPItems = new Dictionary<string, IAPItem>()
 Instantiated shop items, ordered by their ID. More...
 

Events

static Action< string > itemSelectedEvent
 Fired when selecting a shop item. More...
 
static Action< string > itemDeselectedEvent
 Fired when deselecting a shop item. More...
 

Detailed Description

Instantiates shop items in the scene, unlocks/locks and selects/deselects shop items based on previous purchases/selections. Can also be used in a scene with manually placed IAPItem. Initialized after database initialization.

Member Function Documentation

ShopContainer GetContainer ( string  id)

Returns container for a specific group id.

static IAPItem GetIAPItem ( string  id)
static

Returns instantiated IAPItem shop item reference.

static ShopManager GetInstance ( )
static

Returns a static reference to this script.

void Init ( )

Initializes all IAPItem in the scene and instantiates them with their correct state. Called by IAPManager.

static void OverwriteWithFetch ( Product[]  products)
static

Method for overwriting shop item's properties with localized IAP data from the App Store servers. When we receive the online item list of products from the IAPManager, we loop over our products and check if 'fetch' was checked in the IAP Settings editor, then simply reinitialize the items by using the new data.

void Refresh ( string  id)

Refreshes the visual representation of a specific 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.

static void RefreshAll ( )
static

Refreshes the visual representation of all shop items based on previous actions or user interaction, meaning we set them to 'purchased' or 'selected' in the GUI. You can call this manually in case PlayerData (unlock requirements) have changed.

static void RefreshGroup ( string  groupName)
static

Refreshes the visual representation of a specific group in the IAP Settings editor. Same as RefreshAll(), but only for items within this specific group name. You can call this manually i.e. when manually changing product selections in a group.

static void SetToDeselected ( IAPItem  item)
static

Sets an item to 'deselected' in the database.

static void SetToSelected ( IAPItem  item)
static

Sets an item to 'selected' in the database.

static void ShowConfirmation ( )
static

Shows window waiting for transaction confirmation. This gets called by PlayfabPayPalStore when waiting for the user to confirm his purchase payment with PayPal.

static void ShowMessage ( string  text)
static

Show feedback/error window with text received through an event: This gets called in IAPListener's HandleSuccessfulPurchase method with some feedback, or automatically with the error message when a purchase failed at billing.

Member Data Documentation

GameObject confirmWindow

Confirmation window for refreshing transactions. Only required when using PayPal.

List<ShopContainer> containers = new List<ShopContainer>()

Store the relation between an IAP Group set in the IAP Settings Editor and its "parent" transform. This is because IAP Manager is a prefab that exists during scene changes, thus can't keep scene-specific data like transforms.

GameObject errorWindow

Window for showing feedback on IAPListener events to the user.

Dictionary<string, IAPItem> IAPItems = new Dictionary<string, IAPItem>()

Instantiated shop items, ordered by their ID.

Text message

Text component of the errorWindow gameobject.

Event Documentation

Action<string> itemDeselectedEvent
static

Fired when deselecting a shop item.

Action<string> itemSelectedEvent
static

Fired when selecting a shop item.


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