RAGENativeUI.Elements.UIMenuListItem.IndexToItem C# (CSharp) Method

IndexToItem() public method

Find an item by it's index and return the item.
public IndexToItem ( int index ) : dynamic
index int Item's index.
return dynamic
        public virtual dynamic IndexToItem(int index)
        {
            return _items[index];
        }

Usage Example

コード例 #1
0
        public virtual void Build(string type)
        {
            Clear();
            var typeList = Items.Select(pair => pair.Key).Cast<dynamic>().ToList();
            var typeItem = new UIMenuListItem("Category", typeList, typeList.FindIndex(n => n.ToString() == type));
            AddItem(typeItem);

            typeItem.OnListChanged += (sender, index) =>
            {
                string newType = ((UIMenuListItem) MenuItems[0]).IndexToItem(((UIMenuListItem) MenuItems[0]).Index).ToString();
                Build(newType);
                SelectionChanged?.Invoke(this, EventArgs.Empty);
            };

            var itemListItem = new UIMenuListItem(ItemName, Items[type].Select(s => (dynamic)s).ToList(), 0);
            AddItem(itemListItem);

            CurrentSelectedItem = (string)itemListItem.IndexToItem(0);
            CurrentSelectedCategory = type;
            itemListItem.OnListChanged += (sender, index) =>
            {
                CurrentSelectedItem = (string)itemListItem.IndexToItem(index);
                SelectionChanged?.Invoke(this, EventArgs.Empty);
            };

            RefreshIndex();
        }
All Usage Examples Of RAGENativeUI.Elements.UIMenuListItem::IndexToItem