Ejemplo n.º 1
0
    private void RGetShop(ApiBridge.ResponseParam response)
    {
        Logger.E("Return Get Shop: " + response.post_data);
        JGetShop json = JsonUtility.FromJson <JGetShop> (response.post_data);

        ShopManager.instance.SetJson(json);
    }
Ejemplo n.º 2
0
 public void SetJson(JGetShop json)
 {
     jsonItemCoins  = new List <JGetShopItem> ();
     jsonItemHeroes = new List <JGetShopItem> ();
     for (int i = 0; i < json.items.Length; i++)
     {
         if (json.items[i].item_type_id == 1)
         {
             jsonItemCoins.Add(json.items[i]);
         }
         else if (json.items[i].item_type_id == 5)
         {
             jsonItemHeroes.Add(json.items[i]);
         }
     }
     HeroManager.instance.SetJson(jsonItemHeroes);
     //sort here
     sortedItemHeroes = jsonItemHeroes.OrderBy(x => x.is_hero_owned ? 1 : 0).ThenBy(x => (x.is_new == 0) ? 0 : 1).ThenBy(x => int.Parse(x.price_idr)).ThenBy(x => long.Parse(x.price_coin)).ToArray();
     //
     ProfileManager.instance.SetOwnedHeroesJson(sortedItemHeroes);
     isSettingJson = false;
 }