예제 #1
0
 public void ItemDeselected()
 {
     selectedItem = null;
     foreach (var bt in itemSlot)
     {
         bt.myButton.image.color = Color.white;
     }
 }
예제 #2
0
    public void OnItemSelected(StoreItemSlot selected)
    {
        ItemDeselected();
        if (selectedItem == selected)
        {
            return;
        }

        selectedItem = selected;
        selectedItem.myButton.image.color = Color.green;
    }
예제 #3
0
    public void ClosePanel()
    {
        foreach (var bt in itemSlot)
        {
            bt.ClearButton();
        }
        selectedItem = null;

        if (actionCallback != null)
        {
            actionCallback();
        }

        gameObject.SetActive(false);
    }
예제 #4
0
    public void Init(List <string> itemList, System.Action callback = null)
    {
        selectedItem   = null;
        actionCallback = callback;

        ItemDeselected();

        for (int i = 0; i < itemList.Count; i++)
        {
            Item it = ItemData.allItemDictionary[itemList[i]];//CreateItem(itemList[i]);

            if (it != null)
            {
                itemSlot[i].ClearButton();

                containsItem.Add(it);
                itemSlot[i].SetupButton(it);
            }
        }
        gameObject.SetActive(true);
    }