Beispiel #1
0
    public void ShowTypeItems(ItemFilterType type, bool setNewCurrentSlot = true)
    {
        ClearSlots();

        _weight.text = _inventory.CurrentWeight.ToString() + " / " + _inventory.MaxWeight.ToString();
        List <ItemSlot> container = _inventory.Items.Container;

        if (type != ItemFilterType.All)
        {
            container = container.FindAll(s => s.Item.FilterType == type);
        }
        container.Sort();
        GenerateSlots(container);

        if (container.Count == 0)
        {
            _currentSlot = null;
        }
        else if (setNewCurrentSlot)
        {
            _currentSlot = container[0];
        }
        ShowItemInfo(_currentSlot);

        _currentFilter = type;
    }
Beispiel #2
0
    public void Btn_OnFilterTypeOpen()
    {
        var labels = EnumUtils.ToStringArray <ItemFilterType>();

        ConfirmFilter.Ask("Item Filter", null, labels)
        .Then(answer => {
            Debug.Log("Answer is: " + answer);

            _ITEM_FILTER_TYPE = answer.AsEnum <ItemFilterType>();

            UpdateFilterLabel();
            RefreshItems();
        });
    }