コード例 #1
0
 public ZFCurrencyPack(ZFCurrencyPack currencyPack)
 {
     this.ID              = currencyPack.ID;
     this.name            = currencyPack.name;
     this.description     = currencyPack.description;
     this.currency_itemId = currencyPack.currency_itemId;
     this.currency_amount = currencyPack.currency_amount;
     this.marketInfo      = new MarketInfo(currencyPack.marketInfo);
 }
コード例 #2
0
    public void AddCurrencyPack()
    {
        ZFCurrencyPack currencyPack           = new ZFCurrencyPack(newCurrencyPack);
        int            currencyPackItemNumber = currencyPacks.Count + 1;

        currencyPack.ID = "currencypack_" + currencyPackItemNumber;
        currencyPacks.Add(currencyPack);
        while (!areUniqueCurrencyPacks())
        {
            currencyPackItemNumber++;
            currencyPack.ID = "currencypack_" + currencyPackItemNumber;
        }
    }
コード例 #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> ();
    }
コード例 #4
0
    public bool areUniqueCurrencyPacks()
    {
        for (int i = 0; i < this.currencyPacks.Count; i++)
        {
            ZFCurrencyPack currencyPack1 = this.currencyPacks[i];

            for (int j = 0; j < this.currencyPacks.Count; j++)
            {
                ZFCurrencyPack currencyPack2 = this.currencyPacks[j];
                if (currencyPack1.ID == currencyPack2.ID && i != j)
                {
                    rememberSameItems("Currency Packs", currencyPack1.name, currencyPack2.name);
                    return(false);
                }
            }
        }
        return(true);
    }
コード例 #5
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);
			}
		}
	}
コード例 #6
0
	public void AddCurrencyPack() {
        ZFCurrencyPack currencyPack = new ZFCurrencyPack(newCurrencyPack);
		int currencyPackItemNumber = currencyPacks.Count + 1;
		currencyPack.ID = "currencypack_" + currencyPackItemNumber;
		currencyPacks.Add (currencyPack);
		while (!areUniqueCurrencyPacks()) {
			currencyPackItemNumber++;
			currencyPack.ID = "currencypack_" + currencyPackItemNumber;
		}
	}
コード例 #7
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> ();
	}
コード例 #8
0
	public ZFCurrencyPack(ZFCurrencyPack currencyPack)
	{
		this.ID = currencyPack.ID;
		this.name = currencyPack.name;
		this.description = currencyPack.description;
		this.currency_itemId = currencyPack.currency_itemId;
		this.currency_amount = currencyPack.currency_amount;
		this.marketInfo = new MarketInfo(currencyPack.marketInfo);
	}
コード例 #9
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);
            }
        }
    }
コード例 #10
0
    void ShowCurrencyPack(int currencyPackIndex)
    {
        ZFCurrencyPack currencyPack = editorData.currencyPacks [currencyPackIndex];

        EditorGUILayout.BeginHorizontal();

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

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

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

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

        if (GUILayout.Button(deleteButtonContent, EditorStyles.miniButton, GUILayout.Width(20)))
        {
            editorData.currencyPacks.Remove(currencyPack);
        }

        EditorGUILayout.EndHorizontal();

        if (currencyPack.render)
        {
            EditorGUI.indentLevel++;
            currencyPack.ID          = EditorGUILayout.TextField("Item ID ", currencyPack.ID);
            currencyPack.name        = EditorGUILayout.TextField("Name", currencyPack.name);
            currencyPack.name        = Regex.Replace(currencyPack.name, "\n", "");
            currencyPack.description = EditorGUILayout.TextField("Description", currencyPack.description);
            currencyPack.description = Regex.Replace(currencyPack.description, "\n", "");

            // market info
            currencyPack.marketInfo.price = EditorGUILayout.FloatField("Price", currencyPack.marketInfo.price);

            currencyPack.marketInfo.productId = EditorGUILayout.TextField("Product ID", currencyPack.marketInfo.productId);

            // currency data
            if (editorData.currencies.Count > 0)
            {
                int           indexInArray  = 0;
                List <string> currencyNames = new List <string>();
                for (int i = 0; i < editorData.currencies.Count; i++)
                {
                    currencyNames.Add(editorData.currencies[i].name);
                    if (currencyPack.currency_itemId == null)
                    {
                        indexInArray = 0;
                    }
                    else if (editorData.currencies[i].ID == currencyPack.currency_itemId)
                    {
                        indexInArray = i;
                    }
                }

                int index = EditorGUILayout.Popup("Currency", indexInArray, currencyNames.ToArray());
                currencyPack.currency_itemId = editorData.currencies[index].ID;
                EditorGUI.indentLevel++;
                currencyPack.currency_amount = EditorGUILayout.IntField("Amount", currencyPack.currency_amount);
                EditorGUI.indentLevel--;
            }
            else
            {
                EditorGUILayout.HelpBox("You have no defined currencies", MessageType.Warning, true);
            }


            EditorGUI.indentLevel--;
        }
    }