Exemple #1
0
    IEnumerator _UpdateStatus(JBuyShop json)
    {
        if (json.item.item_type_id == 5)
        {
            for (int i = 0; i < jsonItemHeroes.Count; i++)
            {
                for (int j = 0; j < json.player.costume_owned.Length; j++)
                {
                    if (jsonItemHeroes[i].default_item_id == json.player.costume_owned[j])
                    {
                        jsonItemHeroes[i].is_costume_owned = true;
                        jsonItemHeroes[i].is_hero_owned    = true;
                    }

                    yield return(_WFSUtility.wef);
                }
            }

            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();
            for (int x = 0; x < itemHeroes.Count; x++)
            {
                itemHeroes[x].SetData(sortedItemHeroes[x]);
                yield return(_WFSUtility.wef);
            }

            HeroManager.instance.UpdateStatusOwned(jsonItemHeroes);
        }
    }
Exemple #2
0
    public void UpdateStatus(JBuyShop json)
    {
        if (crUpdateStatus != null)
        {
            StopCoroutine(crUpdateStatus);
        }

        crUpdateStatus = StartCoroutine(_UpdateStatus(json));
    }
Exemple #3
0
    private void RBuyShop(ApiBridge.ResponseParam response)
    {
        Logger.E("Return Buy Shop: " + response.post_data);
        JBuyShop json = JsonUtility.FromJson <JBuyShop> (response.post_data);

        if (json.item.item_type_id == 1)
        {
            int             itemValue = int.Parse(json.item.bonus_coin);
            ItemReceiveData data      = new ItemReceiveData(json.item.item_type_id, json.item.item_id, itemValue);
            ReceiveItemManager.instance.Show(new ItemReceiveData[] { data });
        }
        PlayerData.owned_coin   = long.Parse(json.player.coin);
        PlayerData.owned_coupon = long.Parse(json.player.coupon);
        ShopManager.instance.UpdateStatus(json);
        _SceneManager.instance.UpdateAllCoinAndCoupon();
        MessageManager.instance.Show(this.gameObject, "Anda berhasil membeli " + json.item.item_name[0]);
    }