Esempio n. 1
0
        protected override DropdownElement RebuildTree()
        {
            GroupDropdownElement groupDropdownElement = new GroupDropdownElement(this.m_Label);

            for (int i = 0; i < this.m_DisplayedOptions.Length; i++)
            {
                string   text  = this.m_DisplayedOptions[i];
                string[] array = text.Split(new char[]
                {
                    '/'
                });
                DropdownElement dropdownElement = groupDropdownElement;
                for (int j = 0; j < array.Length; j++)
                {
                    string name = array[j];
                    if (j == array.Length - 1)
                    {
                        SearchableDropdownElement searchableDropdownElement = new SearchableDropdownElement(name, text, i);
                        searchableDropdownElement.SetParent(dropdownElement);
                        dropdownElement.AddChild(searchableDropdownElement);
                        if (i == AdvancedDropdown.m_SelectedIndex)
                        {
                            DropdownElement dropdownElement2 = dropdownElement;
                            DropdownElement item             = searchableDropdownElement;
                            while (dropdownElement2 != null)
                            {
                                dropdownElement2.selectedItem = dropdownElement2.children.IndexOf(item);
                                item             = dropdownElement2;
                                dropdownElement2 = dropdownElement2.parent;
                            }
                        }
                    }
                    else
                    {
                        string groupPathId = "";
                        for (int k = 0; k <= j; k++)
                        {
                            groupPathId = groupPathId + array[k] + ".";
                        }
                        DropdownElement dropdownElement3 = dropdownElement.children.SingleOrDefault((DropdownElement c) => c.id == groupPathId);
                        if (dropdownElement3 == null)
                        {
                            dropdownElement3 = new GroupDropdownElement(name, groupPathId);
                            dropdownElement3.SetParent(dropdownElement);
                            dropdownElement.AddChild(dropdownElement3);
                        }
                        dropdownElement = dropdownElement3;
                    }
                }
            }
            return(groupDropdownElement);
        }
Esempio n. 2
0
        protected override DropdownElement RebuildTree()
        {
            DropdownElement dropdownElement = new DropdownElement("ROOT");

            string[] submenus         = Unsupported.GetSubmenus("Component");
            string[] submenusCommands = Unsupported.GetSubmenusCommands("Component");
            for (int i = 0; i < submenus.Length; i++)
            {
                if (!(submenusCommands[i] == "ADD"))
                {
                    string   text  = submenus[i];
                    string[] array = text.Split(new char[]
                    {
                        '/'
                    });
                    DropdownElement dropdownElement2 = dropdownElement;
                    for (int j = 0; j < array.Length; j++)
                    {
                        string path = array[j];
                        if (j == array.Length - 1)
                        {
                            ComponentDropdownElement componentDropdownElement = new ComponentDropdownElement(LocalizationDatabase.GetLocalizedString(path), text, submenusCommands[i]);
                            componentDropdownElement.SetParent(dropdownElement2);
                            dropdownElement2.AddChild(componentDropdownElement);
                        }
                        else
                        {
                            DropdownElement dropdownElement3 = dropdownElement2.children.SingleOrDefault((DropdownElement c) => c.name == path);
                            if (dropdownElement3 == null)
                            {
                                dropdownElement3 = new GroupDropdownElement(path);
                                dropdownElement3.SetParent(dropdownElement2);
                                dropdownElement2.AddChild(dropdownElement3);
                            }
                            dropdownElement2 = dropdownElement3;
                        }
                    }
                }
            }
            dropdownElement = dropdownElement.children.Single <DropdownElement>();
            dropdownElement.SetParent(null);
            GroupDropdownElement groupDropdownElement = new GroupDropdownElement("New script");

            groupDropdownElement.AddChild(new NewScriptDropdownElement());
            groupDropdownElement.SetParent(dropdownElement);
            dropdownElement.AddChild(groupDropdownElement);
            return(dropdownElement);
        }
Esempio n. 3
0
        protected override DropdownElement RebuildSearch()
        {
            DropdownElement dropdownElement = base.RebuildSearch();

            if (dropdownElement != null)
            {
                GroupDropdownElement     groupDropdownElement     = new GroupDropdownElement("New script");
                NewScriptDropdownElement newScriptDropdownElement = new NewScriptDropdownElement();
                newScriptDropdownElement.className = this.m_Search;
                groupDropdownElement.AddChild(newScriptDropdownElement);
                newScriptDropdownElement.SetParent(groupDropdownElement);
                groupDropdownElement.SetParent(dropdownElement);
                dropdownElement.AddChild(groupDropdownElement);
            }
            return(dropdownElement);
        }
        protected virtual DropdownElement RebuildSearch()
        {
            DropdownElement result;

            if (string.IsNullOrEmpty(this.m_Search))
            {
                result = null;
            }
            else
            {
                string[] array = this.m_Search.ToLower().Split(new char[]
                {
                    ' '
                });
                List <DropdownElement> list  = new List <DropdownElement>();
                List <DropdownElement> list2 = new List <DropdownElement>();
                foreach (DropdownElement current in this.m_MainTree.GetSearchableElements())
                {
                    string text  = current.name.ToLower().Replace(" ", "");
                    bool   flag  = true;
                    bool   flag2 = false;
                    for (int i = 0; i < array.Length; i++)
                    {
                        string value = array[i];
                        if (!text.Contains(value))
                        {
                            flag = false;
                            break;
                        }
                        if (i == 0 && text.StartsWith(value))
                        {
                            flag2 = true;
                        }
                    }
                    if (flag)
                    {
                        if (flag2)
                        {
                            list.Add(current);
                        }
                        else
                        {
                            list2.Add(current);
                        }
                    }
                }
                list.Sort();
                list2.Sort();
                GroupDropdownElement groupDropdownElement = new GroupDropdownElement("Search");
                foreach (DropdownElement current2 in list)
                {
                    groupDropdownElement.AddChild(current2);
                }
                foreach (DropdownElement current3 in list2)
                {
                    groupDropdownElement.AddChild(current3);
                }
                result = groupDropdownElement;
            }
            return(result);
        }