Example #1
0
    private void updateView()
    {
        foreach (Transform child in iconButtonParent)
        {
            Destroy(child.gameObject);
        }

        stacks = container.GetStacks();

        UIQuickMenuIconButton button = Instantiate(iconButtonPrefab);

        button.SetIconSprite(iconTakeAll);
        button.onClick.AddListener(() => takeAll());
        button.transform.SetParent(iconButtonParent, false);

        foreach (PickableStack stack in stacks)
        {
            UIQuickMenuIconButton stackButton = Instantiate(iconButtonPrefab);
            stackButton.SetIconSprite(stack.icon);
            stackButton.onClick.AddListener(() => stackClicked(stack));
            stackButton.amount.text = stack.Count > 1 ? stack.Count.ToString() : string.Empty;
            stackButton.transform.SetParent(iconButtonParent, false);
        }

        Invoke("updateSelection", 0.0f);
    }
    private void updateView()
    {
        foreach (Transform child in iconButtonParent)
        {
            Destroy(child.gameObject);
        }

        combatItems = PlayerInventory.GetDistinctItemsOfType <Armor>(a => a.type == slot.type);

        foreach (Armor stack in combatItems)
        {
            UIQuickMenuIconButton button = Instantiate(iconButtonPrefab);
            button.SetIconSprite(stack.identity.icon);
            button.onClick.AddListener(() => stackClicked(stack));
            button.amount.text = string.Empty;
            button.transform.SetParent(iconButtonParent);
        }

        Invoke("updateSelection", 0.0f);
    }