public void queryPurchasesSucceeded(string jsonStr) { JSONNode dataNode = JSON.Parse(jsonStr); JSONArray purchasesJsonArray = dataNode.AsArray; var purchases = BazaarPurchase.fromJsonArray(purchasesJsonArray); queryPurchasesSucceededEvent.SafeInvoke(purchases); }
public void consumePurchaseSucceeded(string jsonStr) { JSONNode dataNode = JSON.Parse(jsonStr); BazaarPurchase bazaarPurchase = new BazaarPurchase(); bazaarPurchase.fromJson(dataNode.AsObject); consumePurchaseSucceededEvent.SafeInvoke(bazaarPurchase); }
public void queryInventorySucceeded(string jsonStr) { JSONNode dataNode = JSON.Parse(jsonStr); JSONArray purchasesJsonArray = dataNode["purchases"].AsArray; var purchases = BazaarPurchase.fromJsonArray(purchasesJsonArray); JSONArray skusJsonArray = dataNode["skus"].AsArray; var skus = BazaarSkuInfo.fromJsonArray(skusJsonArray); queryInventorySucceededEvent.SafeInvoke(purchases, skus); }
public static List <BazaarPurchase> fromJsonArray(JSONArray items) { var purchases = new List <BazaarPurchase>(); foreach (JSONNode item in items.AsArray) { BazaarPurchase bPurchase = new BazaarPurchase(); bPurchase.fromJson(item.AsObject); purchases.Add(bPurchase); } return(purchases); }