Ejemplo n.º 1
0
        public ShopItemParser()
        {
            if (this._holder == null)
            {
                this._holder = ShopItemHolder.getInstance();
            }
            string path = "data//shopItems";

            if (Directory.Exists(path))
            {
                string[] strArray = Directory.GetFiles(path, "*.xml", SearchOption.AllDirectories);
                for (int i = 0; i < strArray.Length; i++)
                {
                    this.parse(strArray[i]);
                }
            }
            else
            {
                CLogger.getInstance().info("|[SIP]| No Have Dir: " + path);
            }
            if (this._holder != null)
            {
                this._holder.log();
            }
        }
Ejemplo n.º 2
0
 void SeedsUnlocked(ShopItemHolder shopItemHolderScript, PlantItem plantItem)
 {
     shopItemHolderScript.SetItemExp(plantItem.GetItemExp());
     shopItemHolderScript.SetItemTime(plantItem.GetItemTime());
     shopItemHolderScript.SetItemPrize(plantItem.GetItemPrize());
     shopItemHolderScript.SetItemAdditionalPrize(plantItem.GetItemAdditionalPrize());
 }
Ejemplo n.º 3
0
    void FillShop()
    {
        foreach (ShopTab shopTab in shopTabs)
        {
            GameObject    shopTabHolder       = Instantiate(shopTabHolderPrefab, shopTabsParent);
            ShopTabHolder shopTabHolderScript = shopTabHolder.GetComponent <ShopTabHolder>();
            shopTabHolderScript.SetTabIcon(shopTab.GetShopTabIcon());

            GameObject shopItemsGrid = Instantiate(shopItemsGridPrefab, shopItemsGridsParent);
            shopTab.ShopItemsGrid = shopItemsGrid;
            shopItemsGrid.SetActive(false);

            List <Item> shopItems = shopTab.getShopItems();
            foreach (Item shopItem in shopItems)
            {
                GameObject     shopItemHolder       = (GameObject)Instantiate(shopItemHolderPrefab, shopItemsGrid.transform);
                ShopItemHolder shopItemHolderScript = shopItemHolder.GetComponent <ShopItemHolder>();
                shopItemHolderScript.SetItemName(shopItem.GetItemName());
                shopItemHolderScript.SetItemIcon(shopItem.GetItemIcon());

                if (shopItem.GetLevelToUnlock() > 1)
                {
                    SetItemLocked(shopItemHolderScript, shopItem);
                }
                else
                {
                    SetItemUnlocked(shopItemHolderScript, shopItem);
                }
            }

            shopTabHolderScript.SetButtonEvent(OpenTab, shopTab, 1);
        }
    }
Ejemplo n.º 4
0
    void SetItemUnlocked(ShopItemHolder shopItemHolderScript, Item shopItem)
    {
        shopItemHolderScript.SetItemCost(shopItem.GetItemDollarCost(), shopItem.GetItemCoinCost());

        switch (shopItem.GetItemType())
        {
        case ItemType.Grid:
            break;

        case ItemType.Plant:
            SeedsUnlocked(shopItemHolderScript, (PlantItem)shopItem);
            break;
        }

        shopItemHolderScript.SetBuyButtonEvent(BuyShopItem, shopItem);
        shopItemHolderScript.SetUnlocked();
    }
Ejemplo n.º 5
0
    void SetItemLocked(ShopItemHolder shopItemHolderScript, Item shopItem)
    {
        shopItemHolderScript.SetLevelToUnlock(shopItem.GetLevelToUnlock());

        shopItemHolderScript.SetLocked();
    }