GetSubmenusCommands() private method

private GetSubmenusCommands ( string menuPath ) : string[]
menuPath string
return string[]
コード例 #1
0
        private static List <KeyValuePair <string, string> > GetMenuDictionary()
        {
            var menus    = Unsupported.GetSubmenus("Component");
            var commands = Unsupported.GetSubmenusCommands("Component");

            var menuDictionary = new Dictionary <string, string>(menus.Length);

            for (var i = 0; i < menus.Length; i++)
            {
                menuDictionary.Add(menus[i], commands[i]);
            }
            return(menuDictionary.ToList());
        }
コード例 #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);
        }
コード例 #3
0
        private void CreateComponentTree()
        {
            GroupElement element2;

            string[]       submenus         = Unsupported.GetSubmenus("Component");
            string[]       submenusCommands = Unsupported.GetSubmenusCommands("Component");
            List <string>  list             = new List <string>();
            List <Element> list2            = new List <Element>();

            for (int i = 0; i < submenus.Length; i++)
            {
                if (submenusCommands[i] != "ADD")
                {
                    string   menuPath  = submenus[i];
                    char[]   separator = new char[] { '/' };
                    string[] strArray3 = menuPath.Split(separator);
                    while ((strArray3.Length - 1) < list.Count)
                    {
                        list.RemoveAt(list.Count - 1);
                    }
                    while ((list.Count > 0) && (strArray3[list.Count - 1] != list[list.Count - 1]))
                    {
                        list.RemoveAt(list.Count - 1);
                    }
                    while ((strArray3.Length - 1) > list.Count)
                    {
                        list2.Add(new GroupElement(list.Count, LocalizationDatabase.GetLocalizedString(strArray3[list.Count])));
                        list.Add(strArray3[list.Count]);
                    }
                    list2.Add(new ComponentElement(list.Count, LocalizationDatabase.GetLocalizedString(strArray3[strArray3.Length - 1]), menuPath, submenusCommands[i]));
                }
            }
            list2.Add(new NewScriptElement());
            this.m_Tree = list2.ToArray();
            if (this.m_Stack.Count == 0)
            {
                this.m_Stack.Add(this.m_Tree[0] as GroupElement);
                goto Label_02BE;
            }
コード例 #4
0
        private void CreateComponentTree()
        {
            string[]      submenus                  = Unsupported.GetSubmenus("Component");
            string[]      submenusCommands          = Unsupported.GetSubmenusCommands("Component");
            List <string> list                      = new List <string>();
            List <AddComponentWindow.Element> list2 = new List <AddComponentWindow.Element>();

            for (int i = 0; i < submenus.Length; i++)
            {
                if (!(submenusCommands[i] == "ADD"))
                {
                    string   text  = submenus[i];
                    string[] array = text.Split(new char[]
                    {
                        '/'
                    });
                    while (array.Length - 1 < list.Count)
                    {
                        list.RemoveAt(list.Count - 1);
                    }
                    while (list.Count > 0 && array[list.Count - 1] != list[list.Count - 1])
                    {
                        list.RemoveAt(list.Count - 1);
                    }
                    while (array.Length - 1 > list.Count)
                    {
                        list2.Add(new AddComponentWindow.GroupElement(list.Count, LocalizationDatabase.GetLocalizedString(array[list.Count])));
                        list.Add(array[list.Count]);
                    }
                    list2.Add(new AddComponentWindow.ComponentElement(list.Count, LocalizationDatabase.GetLocalizedString(array[array.Length - 1]), text, submenusCommands[i]));
                }
            }
            list2.Add(new AddComponentWindow.NewScriptElement());
            this.m_Tree = list2.ToArray();
            if (this.m_Stack.Count == 0)
            {
                this.m_Stack.Add(this.m_Tree[0] as AddComponentWindow.GroupElement);
            }
            else
            {
                AddComponentWindow.GroupElement groupElement = this.m_Tree[0] as AddComponentWindow.GroupElement;
                int level = 0;
                while (true)
                {
                    AddComponentWindow.GroupElement groupElement2 = this.m_Stack[level];
                    this.m_Stack[level] = groupElement;
                    this.m_Stack[level].selectedIndex = groupElement2.selectedIndex;
                    this.m_Stack[level].scroll        = groupElement2.scroll;
                    level++;
                    if (level == this.m_Stack.Count)
                    {
                        break;
                    }
                    List <AddComponentWindow.Element> children = this.GetChildren(this.activeTree, groupElement);
                    AddComponentWindow.Element        element  = children.FirstOrDefault((AddComponentWindow.Element c) => c.name == this.m_Stack[level].name);
                    if (element != null && element is AddComponentWindow.GroupElement)
                    {
                        groupElement = (element as AddComponentWindow.GroupElement);
                    }
                    else
                    {
                        while (this.m_Stack.Count > level)
                        {
                            this.m_Stack.RemoveAt(level);
                        }
                    }
                }
            }
            AddComponentWindow.s_DirtyList = false;
            this.RebuildSearch();
        }
コード例 #5
0
        private void CreateComponentTree()
        {
            string[]      submenus         = Unsupported.GetSubmenus("Component");
            string[]      submenusCommands = Unsupported.GetSubmenusCommands("Component");
            List <string> stringList       = new List <string>();
            List <AddComponentWindow.Element> elementList = new List <AddComponentWindow.Element>();

            for (int index = 0; index < submenus.Length; ++index)
            {
                if (!(submenusCommands[index] == "ADD"))
                {
                    string   menuPath = submenus[index];
                    string[] strArray = menuPath.Split('/');
                    while (strArray.Length - 1 < stringList.Count)
                    {
                        stringList.RemoveAt(stringList.Count - 1);
                    }
                    while (stringList.Count > 0 && strArray[stringList.Count - 1] != stringList[stringList.Count - 1])
                    {
                        stringList.RemoveAt(stringList.Count - 1);
                    }
                    while (strArray.Length - 1 > stringList.Count)
                    {
                        elementList.Add((AddComponentWindow.Element) new AddComponentWindow.GroupElement(stringList.Count, LocalizationDatabase.GetLocalizedString(strArray[stringList.Count])));
                        stringList.Add(strArray[stringList.Count]);
                    }
                    elementList.Add((AddComponentWindow.Element) new AddComponentWindow.ComponentElement(stringList.Count, LocalizationDatabase.GetLocalizedString(strArray[strArray.Length - 1]), menuPath, submenusCommands[index]));
                }
            }
            elementList.Add((AddComponentWindow.Element) new AddComponentWindow.NewScriptElement());
            this.m_Tree = elementList.ToArray();
            if (this.m_Stack.Count == 0)
            {
                this.m_Stack.Add(this.m_Tree[0] as AddComponentWindow.GroupElement);
            }
            else
            {
                // ISSUE: object of a compiler-generated type is created
                // ISSUE: variable of a compiler-generated type
                AddComponentWindow.\u003CCreateComponentTree\u003Ec__AnonStorey80 treeCAnonStorey80 = new AddComponentWindow.\u003CCreateComponentTree\u003Ec__AnonStorey80();
                // ISSUE: reference to a compiler-generated field
                treeCAnonStorey80.\u003C\u003Ef__this = this;
                AddComponentWindow.GroupElement groupElement1 = this.m_Tree[0] as AddComponentWindow.GroupElement;
                // ISSUE: reference to a compiler-generated field
                treeCAnonStorey80.level = 0;
label_15:
                while (true)
                {
                    // ISSUE: reference to a compiler-generated field
                    AddComponentWindow.GroupElement groupElement2 = this.m_Stack[treeCAnonStorey80.level];
                    // ISSUE: reference to a compiler-generated field
                    this.m_Stack[treeCAnonStorey80.level] = groupElement1;
                    // ISSUE: reference to a compiler-generated field
                    this.m_Stack[treeCAnonStorey80.level].selectedIndex = groupElement2.selectedIndex;
                    // ISSUE: reference to a compiler-generated field
                    this.m_Stack[treeCAnonStorey80.level].scroll = groupElement2.scroll;
                    // ISSUE: reference to a compiler-generated field
                    // ISSUE: reference to a compiler-generated field
                    treeCAnonStorey80.level = treeCAnonStorey80.level + 1;
                    // ISSUE: reference to a compiler-generated field
                    if (treeCAnonStorey80.level != this.m_Stack.Count)
                    {
                        // ISSUE: reference to a compiler-generated method
                        AddComponentWindow.Element element = this.GetChildren(this.activeTree, (AddComponentWindow.Element)groupElement1).FirstOrDefault <AddComponentWindow.Element>(new Func <AddComponentWindow.Element, bool>(treeCAnonStorey80.\u003C\u003Em__13A));
                        if (element != null && element is AddComponentWindow.GroupElement)
                        {
                            groupElement1 = element as AddComponentWindow.GroupElement;
                        }
                        else
                        {
                            break;
                        }
                    }
                    else
                    {
                        goto label_20;
                    }
                }
                // ISSUE: reference to a compiler-generated field
                while (this.m_Stack.Count > treeCAnonStorey80.level)
                {
                    // ISSUE: reference to a compiler-generated field
                    this.m_Stack.RemoveAt(treeCAnonStorey80.level);
                }
                goto label_15;
            }
label_20:
            AddComponentWindow.s_DirtyList = false;
            this.RebuildSearch();
        }