public void ItemButtonClick(int itemArrayIndex) { if (_selectedItemIndex != itemArrayIndex) { UnselectSelectedItem(); _selectedItemIndex = itemArrayIndex; _selectedItem = _currentlyLoadedItemArray[itemArrayIndex]; System.Action <Item> trueAction = delegate(Item item) { item.SetShaderOutline(_itemSettings.InstantiateOutlineColor); item.State = ItemState.Instantiate; }; System.Action <Item> falseAction = delegate(Item item) { item.SetShaderNormal(); item.State = ItemState.NoInstantiate; }; System.Func <Item, bool> filterAction = delegate(Item item) { ItemDrop itemDrop = item.GetComponent <ItemDrop>(); ItemColor itemColor = item.GetComponent <ItemColor>(); const string colorTag = "Color"; if (itemDrop != null) { return(itemDrop.CanAttach(_selectedItem.TagArray)); } if (itemColor != null && _selectedItem.HasTag(colorTag)) { return(true); } return(false); }; int trueCount = Root.CallDelegateTagFilter(filterAction, trueAction, falseAction); if (trueCount == 0) { _selectedItem = null; Root.SetAllOutlineNormalAttach(); _selectedItemIndex = -1; } else { System.Action action = delegate() { UnselectSelectedItem(); }; _catcher.EmptyClickAction = action; ItemBarHorizontalGroupItemList[_selectedItemIndex].GetComponent <Transform>().FindChild("ItemBarItemHighlight").GetComponent <Image>().enabled = true; } } else { UnselectSelectedItem(); } }
public void ItemButtonClick(int itemArrayIndex) { if (_selectedItemIndex != itemArrayIndex) { UnselectSelectedItem(); _selectedItemIndex = itemArrayIndex; _selectedItem = _currentlyLoadedItemArray[itemArrayIndex]; System.Action<Item> trueAction = delegate(Item item) { item.SetShaderOutline(_itemSettings.InstantiateOutlineColor); item.State = ItemState.Instantiate; }; System.Action<Item> falseAction = delegate(Item item) { item.SetShaderNormal(); item.State = ItemState.NoInstantiate; }; System.Func<Item,bool> filterAction = delegate(Item item) { ItemDrop itemDrop = item.GetComponent<ItemDrop>(); ItemColor itemColor = item.GetComponent<ItemColor>(); const string colorTag = "Color"; if (itemDrop != null) { return itemDrop.CanAttach(_selectedItem.TagArray); } if (itemColor != null && _selectedItem.HasTag(colorTag)) { return true; } return false; }; int trueCount = Root.CallDelegateTagFilter(filterAction, trueAction, falseAction); if (trueCount == 0) { _selectedItem = null; Root.SetAllOutlineNormalAttach(); _selectedItemIndex = -1; } else { System.Action action = delegate() { UnselectSelectedItem(); }; _catcher.EmptyClickAction = action; ItemBarHorizontalGroupItemList[_selectedItemIndex].GetComponent<Transform>().FindChild("ItemBarItemHighlight").GetComponent<Image>().enabled = true; } } else { UnselectSelectedItem(); } }