Ejemplo n.º 1
0
 public void DeleteCurrency(ZFCurrency currency)
 {
     for (int i = 0; i < goods.Count; i++)
     {
         if (goods[i].typePurchase == ZFGood.PurchaseInfo.VirtualItem && goods[i].virtualInfo.pvi_itemId == currency.ID)
         {
             goods.Remove(goods[i]);
         }
     }
     currencies.Remove(currency);
 }
Ejemplo n.º 2
0
    public void AddCurrency()
    {
        ZFCurrency currency           = new ZFCurrency(newCurrency);
        int        currencyItemNumber = currencies.Count + 1;

        currency.ID = "currency_" + currencyItemNumber;
        currencies.Add(currency);
        while (!areUniqueCurrencies())
        {
            currencyItemNumber++;
            currency.ID = "currency_" + currencyItemNumber;
        }
    }
Ejemplo n.º 3
0
    private void InitObjects()
    {
        newGood = new ZFGood();

        goods             = new List <ZFGood> ();
        singleUseGoodsIDs = new List <string> ();

        newCurrency      = new ZFCurrency();
        newCurrency.name = "Currency Name";

        currencies      = new List <ZFCurrency> ();
        newCurrencyPack = new ZFCurrencyPack();
        currencyPacks   = new List <ZFCurrencyPack> ();
        newCategory     = new ZFCategory();
        categories      = new List <ZFCategory> ();
    }
Ejemplo n.º 4
0
    void ShowCurrency(int currencyIndex)
    {
        ZFCurrency currency = editorData.currencies [currencyIndex];

        EditorGUILayout.BeginHorizontal();

        currency.render = EditorGUILayout.Foldout(currency.render, "<" + currency.name + "> (" + currency.ID + ")");

        if (currencyIndex != 0)
        {
            GUIContent btnMoveUp = new GUIContent(char.ConvertFromUtf32(8593), "Move Up");
            if (GUILayout.Button(btnMoveUp, EditorStyles.miniButton, GUILayout.Width(20f)))
            {
                editorData.currencies[currencyIndex]     = editorData.currencies[currencyIndex - 1];
                editorData.currencies[currencyIndex - 1] = currency;
            }
        }

        if (currencyIndex != editorData.currencies.Count - 1)
        {
            GUIContent btnMoveDown = new GUIContent(char.ConvertFromUtf32(8595), "Move Down");
            if (GUILayout.Button(btnMoveDown, EditorStyles.miniButton, GUILayout.Width(20f)))
            {
                editorData.currencies[currencyIndex]     = editorData.currencies[currencyIndex + 1];
                editorData.currencies[currencyIndex + 1] = currency;
            }
        }

        GUIContent deleteButtonContent = new GUIContent("X", "Delete");

        if (GUILayout.Button(deleteButtonContent, EditorStyles.miniButton, GUILayout.Width(20)))
        {
            editorData.DeleteCurrency(currency);
        }

        EditorGUILayout.EndHorizontal();

        if (currency.render)
        {
            EditorGUI.indentLevel++;
            currency.ID   = EditorGUILayout.TextField("Item ID ", currency.ID);
            currency.name = EditorGUILayout.TextField("Name", currency.name);
            currency.name = Regex.Replace(currency.name, "\n", "");
            EditorGUI.indentLevel--;
        }
    }
Ejemplo n.º 5
0
    public bool areUniqueCurrencies()
    {
        for (int i = 0; i < this.currencies.Count; i++)
        {
            ZFCurrency currency1 = this.currencies[i];

            for (int j = 0; j < this.currencies.Count; j++)
            {
                ZFCurrency currency2 = this.currencies[j];
                if (currency1.ID == currency2.ID && i != j)
                {
                    rememberSameItems("Currencies", currency1.name, currency2.name);
                    return(false);
                }
            }
        }
        return(true);
    }
Ejemplo n.º 6
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);
			}
		}
	}
Ejemplo n.º 7
0
	public void DeleteCurrency(ZFCurrency currency)
	{
		for (int i = 0; i < goods.Count; i++) 
		{
			if (goods[i].typePurchase == ZFGood.PurchaseInfo.VirtualItem && goods[i].virtualInfo.pvi_itemId == currency.ID)
			{
				goods.Remove(goods[i]);
			}
		}
		currencies.Remove (currency);
	}
Ejemplo n.º 8
0
	public void AddCurrency() {
        ZFCurrency currency = new ZFCurrency(newCurrency);
		int currencyItemNumber = currencies.Count + 1;
		currency.ID = "currency_" + currencyItemNumber;
		currencies.Add(currency);
		while (!areUniqueCurrencies()) {
			currencyItemNumber++;
			currency.ID = "currency_" + currencyItemNumber;
		}
	}
Ejemplo n.º 9
0
	private void InitObjects()	
	{
		newGood = new ZFGood();

		goods = new List<ZFGood> ();
		singleUseGoodsIDs = new List<string> ();

		newCurrency = new ZFCurrency ();
		newCurrency.name = "Currency Name";
        
        currencies = new List<ZFCurrency> ();
		newCurrencyPack = new ZFCurrencyPack ();
		currencyPacks = new List<ZFCurrencyPack> ();
		newCategory = new ZFCategory ();
		categories = new List<ZFCategory> ();
	}
Ejemplo n.º 10
0
	public ZFCurrency(ZFCurrency currency)
	{
		this.ID = currency.ID;
		this.name = currency.name;
	}
Ejemplo n.º 11
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);
            }
        }
    }
Ejemplo n.º 12
0
 public ZFCurrency(ZFCurrency currency)
 {
     this.ID   = currency.ID;
     this.name = currency.name;
 }