Esempio n. 1
0
 public void DestroyCurrentItem()
 {
     BroadcastMessage("OnClearItem");
     if (currentItem != null)
     {
         if (transform.childCount > 3)
         {
             Destroy(currentItem.gameObject);
         }
         else
         {
             ItemsBoxItem item = this.GetFirstComponentInChildren <ItemsBoxItem>();
             if (item.itemText.text != "")
             {
                 item.itemText.text = "";
             }
         }
     }
 }
Esempio n. 2
0
    public void AddItem(string nameItem)
    {
        GameObject go;

        if (transform.childCount == 3)
        {
            ItemsBoxItem item = this.GetFirstComponentInChildren <ItemsBoxItem>();
            if (item.itemText.text == "")
            {
                go = item.gameObject;
            }
            else
            {
                go = Instantiate(itemPrefab, transform, false) as GameObject;
            }
        }
        else
        {
            go = Instantiate(itemPrefab, transform, false) as GameObject;
        }

        go.name = nameItem;
        go.GetComponent <ItemsBoxItem>().itemText.text = nameItem;
    }
Esempio n. 3
0
//	VerticalLayoutGroup verticalLayoutGroup;
//	ContentSizeFitter contentSizeFitter;

//	void Start()
//	{
//		verticalLayoutGroup = GetComponent<VerticalLayoutGroup>();
//		contentSizeFitter = GetComponent<ContentSizeFitter>();
//	}

    void OnItemClick(ItemsBoxItem item)
    {
        BroadcastMessage("OnClearItem");
        currentItem = item;
    }