public void ParseJSONObject(JSONObject json)
	{
		JSONObject jsonCurrencies = json.GetField ("currencies");
		JSONObject jsonGoods = json.GetField ("goods");
		JSONObject jsonCurrencyPacks = json.GetField ("currencyPacks");
		if (jsonCurrencies.IsNull == false) 
		{
			foreach(JSONObject jsonCurrency in jsonCurrencies.list)
			{
				ZFCurrency currency = new ZFCurrency();
				currency.fromJSONObject(jsonCurrency);
				currencies.Add(currency);
			}
		}
		if (jsonGoods.IsNull == false) 
		{
			JSONObject jsonEquippableVGs = jsonGoods.GetField("equippable");
			JSONObject jsonLifetimeVGs = jsonGoods.GetField("lifetime");
			JSONObject jsonSingleUsePackVGs = jsonGoods.GetField("goodPacks");
			JSONObject jsonSingleUseVGs = jsonGoods.GetField("singleUse");
			JSONObject jsonUpgradeVGs = jsonGoods.GetField("goodUpgrades");
			
			foreach(JSONObject jsonEquippableVG in jsonEquippableVGs.list)
			{
				ZFGood good = new ZFGood();
				good.fromJSONObject(jsonEquippableVG);
				good.goodType = ZFGood.GoodType.EquippableVG;
				goods.Add(good);
			}
			
			foreach(JSONObject jsonLifetimeVG in jsonLifetimeVGs.list)
			{
				ZFGood good = new ZFGood();
				good.fromJSONObject(jsonLifetimeVG);
				good.goodType = ZFGood.GoodType.LifetimeVG;
				goods.Add(good);
			}
			
			foreach(JSONObject jsonSingleUsePackVG in jsonSingleUsePackVGs.list)
			{
				ZFGood good = new ZFGood();
				good.goodType = ZFGood.GoodType.SingleUsePackVG;
				good.fromJSONObject(jsonSingleUsePackVG);
				goods.Add(good);
			}
			
			foreach(JSONObject jsonSingleUseVG in jsonSingleUseVGs.list)
			{
				ZFGood good = new ZFGood();
				good.fromJSONObject(jsonSingleUseVG);
				good.goodType = ZFGood.GoodType.SingleUseVG;
				goods.Add(good);
			}
			
			foreach(JSONObject jsonUpgradeVG in jsonUpgradeVGs.list)
			{
				ZFGood good = new ZFGood();
				good.fromJSONObject(jsonUpgradeVG);
				good.goodType = ZFGood.GoodType.UpgradeVG;
				goods.Add(good);
			}
		}
		
		if (jsonCurrencyPacks.IsNull == false)
		{
			foreach(JSONObject jsonCurrencyPack in jsonCurrencyPacks.list)
			{
				ZFCurrencyPack currencyPack = new ZFCurrencyPack();
				currencyPack.fromJSONObject(jsonCurrencyPack);
				currencyPacks.Add(currencyPack);
			}
		}
	}
Esempio n. 2
0
    public void ParseJSONObject(JSONObject json)
    {
        JSONObject jsonCurrencies    = json.GetField("currencies");
        JSONObject jsonGoods         = json.GetField("goods");
        JSONObject jsonCurrencyPacks = json.GetField("currencyPacks");

        if (jsonCurrencies.IsNull == false)
        {
            foreach (JSONObject jsonCurrency in jsonCurrencies.list)
            {
                ZFCurrency currency = new ZFCurrency();
                currency.fromJSONObject(jsonCurrency);
                currencies.Add(currency);
            }
        }
        if (jsonGoods.IsNull == false)
        {
            JSONObject jsonEquippableVGs    = jsonGoods.GetField("equippable");
            JSONObject jsonLifetimeVGs      = jsonGoods.GetField("lifetime");
            JSONObject jsonSingleUsePackVGs = jsonGoods.GetField("goodPacks");
            JSONObject jsonSingleUseVGs     = jsonGoods.GetField("singleUse");
            JSONObject jsonUpgradeVGs       = jsonGoods.GetField("goodUpgrades");

            foreach (JSONObject jsonEquippableVG in jsonEquippableVGs.list)
            {
                ZFGood good = new ZFGood();
                good.fromJSONObject(jsonEquippableVG);
                good.goodType = ZFGood.GoodType.EquippableVG;
                goods.Add(good);
            }

            foreach (JSONObject jsonLifetimeVG in jsonLifetimeVGs.list)
            {
                ZFGood good = new ZFGood();
                good.fromJSONObject(jsonLifetimeVG);
                good.goodType = ZFGood.GoodType.LifetimeVG;
                goods.Add(good);
            }

            foreach (JSONObject jsonSingleUsePackVG in jsonSingleUsePackVGs.list)
            {
                ZFGood good = new ZFGood();
                good.goodType = ZFGood.GoodType.SingleUsePackVG;
                good.fromJSONObject(jsonSingleUsePackVG);
                goods.Add(good);
            }

            foreach (JSONObject jsonSingleUseVG in jsonSingleUseVGs.list)
            {
                ZFGood good = new ZFGood();
                good.fromJSONObject(jsonSingleUseVG);
                good.goodType = ZFGood.GoodType.SingleUseVG;
                goods.Add(good);
            }

            foreach (JSONObject jsonUpgradeVG in jsonUpgradeVGs.list)
            {
                ZFGood good = new ZFGood();
                good.fromJSONObject(jsonUpgradeVG);
                good.goodType = ZFGood.GoodType.UpgradeVG;
                goods.Add(good);
            }
        }

        if (jsonCurrencyPacks.IsNull == false)
        {
            foreach (JSONObject jsonCurrencyPack in jsonCurrencyPacks.list)
            {
                ZFCurrencyPack currencyPack = new ZFCurrencyPack();
                currencyPack.fromJSONObject(jsonCurrencyPack);
                currencyPacks.Add(currencyPack);
            }
        }
    }