コード例 #1
0
        private void OnRowClick(UIComponent component, UIMouseEventParameter eventParam)
        {
            for (int index = 0; index < _items.Length; ++index)
            {
                _items[index].IsSelected = false;
            }
            DropDownRow dropDownRow = component as DropDownRow;

            dropDownRow.IsSelected = !dropDownRow.IsSelected;
            Text = dropDownRow.Text;
            _dropDownPanel.isVisible = false;
            OnSelectedItemChanged();
        }
コード例 #2
0
        public void AddItems(ushort[] IDs, Func <ushort, string> func)
        {
            List <DropDownRow> dropDownRowList = new List <DropDownRow>();

            foreach (ushort id in IDs)
            {
                DropDownRow dropDownRow = _scrollablePanel.AddUIComponent <DropDownRow>();
                if ((UnityEngine.Object)Font != (UnityEngine.Object)null)
                {
                    dropDownRow.Font = Font;
                }
                dropDownRow.ID           = id;
                dropDownRow.IDToNameFunc = func;
                dropDownRow.eventClick  += new MouseEventHandler(OnRowClick);
                dropDownRowList.Add(dropDownRow);
            }
            _items = dropDownRowList.ToArray();
        }
コード例 #3
0
        public void AddItem(ushort ID, Func <ushort, string> func)
        {
            if (_items == null)
            {
                _items = new DropDownRow[0];
            }
            DropDownRow[] dropDownRowArray = new DropDownRow[_items.Length + 1];
            Array.Copy((Array)_items, (Array)dropDownRowArray, _items.Length);
            DropDownRow dropDownRow = _scrollablePanel.AddUIComponent <DropDownRow>();

            if ((UnityEngine.Object)Font != (UnityEngine.Object)null)
            {
                dropDownRow.Font = Font;
            }
            dropDownRow.ID                  = ID;
            dropDownRow.IDToNameFunc        = func;
            dropDownRow.eventClick         += new MouseEventHandler(OnRowClick);
            dropDownRowArray[_items.Length] = dropDownRow;
            _items = dropDownRowArray;
        }