Пример #1
0
    public override void OnInspectorGUI()
    {
        GUI.enabled = false;
        base.OnInspectorGUI();
        GUI.enabled = true;

        shopSlot = (ShopSlot)target;

        UpdateItemListNames();

        if (itemListNames.Count == 0)
        {
            return;
        }
        dropdownIndex = EditorGUILayout.Popup("Item", dropdownIndex, itemListNames.ToArray());

        if (dropdownIndex == lastDropdownIndex)
        {
            lastDropdownIndex = dropdownIndex;
            return;
        }

        if (dropdownIndex > 0)
        {
            currentItemIndex = dropdownIndex - 1;
            currentItem      = ItemList.GetAsset().items[currentItemIndex];
            shopSlot.UpdateItem(currentItem);
        }
        else
        {
            currentItem = null;
            shopSlot.UpdateItem(null);
        }

        lastDropdownIndex = dropdownIndex;
    }