示例#1
0
    private void AddButtons()
    {
        GameObject newButton;
        ShopButton ShopButton;

        if (currentField.owner == null)
        {
            newButton = buttonObjectPool.GetObject();
            newButton.transform.SetParent(contentPanel, false);
            //  Debug.Log(itemList.Count);
            ShopButton = newButton.GetComponent <ShopButton>();
            ShopButton.Setup(currentField, this);
        }
        if (this.currentField.type == FieldType.defaultField)
        {
            for (int i = 0; i < itemList.Count; i++)
            {
                Seed item = itemList[i];

                if (currentField.seed != item)
                {
                    Debug.Log(item.name);
                    newButton = buttonObjectPool.GetObject();
                    newButton.transform.SetParent(contentPanel, false);

                    ShopButton = newButton.GetComponent <ShopButton>();
                    ShopButton.Setup(currentField, item, this);
                }
            }
        }
    }
示例#2
0
    private void AddButtons()
    {
        for (int i = 0; i < foodList.Count; ++i)
        {
            FoodObject food      = foodList[i];
            GameObject newButton = buttonObjectPool.GetObject();
            newButton.transform.SetParent(contentPanel, false);             // add false

            ShopButton shopButton = newButton.GetComponent <ShopButton>();
            shopButton.Setup(food, this);
        }
    }
示例#3
0
    private void AddButtons()
    {
        for (int i = 0; i < itemList.Count; i++)
        {
            Item       item      = itemList[i];
            GameObject newButton = object_pool.GetObject();
            newButton.transform.SetParent(contentPanel, false);

            ShopButton shop_button = newButton.GetComponent <ShopButton>();
            shop_button.Setup(item, this);
        }
    }