/// <summary> /// Sets a product to purchased after successful verification (or without). /// This alters the database entry for non-consumable or products with usage as well. /// </summary> public void PurchaseVerified(string id) { if (!IAPObjects.ContainsKey(id)) { id = GetIAPIdentifier(id); } if (!IAPObjects.ContainsKey(id)) { return; } IAPObject obj = IAPObjects[id]; switch (obj.editorType) { case IAPType.Currency: foreach (IAPCurrency cur in obj.virtualPrice) { DBManager.IncreaseFunds(cur.name, cur.amount); } break; default: //for consumables, add the defined usage count to tracking in player data //on non-consumables, don't continue if the product is already purchased, //for example if we just want to verify an existing product again switch (obj.type) { case ProductType.Consumable: if (obj.usageCount > 0) { DBManager.IncreasePlayerData(id, obj.usageCount); //update server player data #if PLAYFAB && !PLAYFAB_VALIDATION PlayfabManager.SetPlayerData(); #endif } break; default: if (DBManager.GetPurchase(id) > 0) { return; } DBManager.IncreasePurchase(id, 1); break; } break; } purchaseSucceededEvent(id); }