private static void UpdateInventory(AN_Inventory inventory) { Inventory.SetPurchases(inventory.Purchases); foreach (var product in inventory.Products) { if (Inventory.HasProductWithId(product.ProductId)) { var inventoryProduct = Inventory.GetProductById(product.ProductId); string json = JsonUtility.ToJson(product); //We need to save consumable state since, it was set manually //and product from google server will not have it bool isConsumable = inventoryProduct.IsConsumable; JsonUtility.FromJsonOverwrite(json, inventoryProduct); inventoryProduct.MarkAsValid(); inventoryProduct.IsConsumable = isConsumable; } } }
public AN_InventoryResult() : base() { m_inventory = new AN_Inventory(); }