GetSubmenus() private method

private GetSubmenus ( string menuPath ) : string[]
menuPath string
return string[]
 private void AddCreateGameObjectItemsToMenu(GenericMenu menu, UnityEngine.Object[] context, bool includeCreateEmptyChild, bool includeGameObjectInPath, int targetSceneHandle)
 {
     string[] submenus = Unsupported.GetSubmenus("GameObject");
     string[] array    = submenus;
     for (int i = 0; i < array.Length; i++)
     {
         string text = array[i];
         UnityEngine.Object[] temporaryContext = context;
         if (includeCreateEmptyChild || !(text.ToLower() == "GameObject/Create Empty Child".ToLower()))
         {
             if (text.EndsWith("..."))
             {
                 temporaryContext = null;
             }
             if (text.ToLower() == "GameObject/Center On Children".ToLower())
             {
                 return;
             }
             string replacementMenuString = text;
             if (!includeGameObjectInPath)
             {
                 replacementMenuString = text.Substring(11);
             }
             MenuUtils.ExtractMenuItemWithPath(text, menu, replacementMenuString, temporaryContext, targetSceneHandle, new Action <string, UnityEngine.Object[], int>(this.BeforeCreateGameObjectMenuItemWasExecuted), new Action <string, UnityEngine.Object[], int>(this.AfterCreateGameObjectMenuItemWasExecuted));
         }
     }
 }
示例#2
0
        public static void ExtractSubMenuWithPath(string path, GenericMenu menu, string replacementPath, Object[] temporaryContext)
        {
            HashSet <string> set = new HashSet <string>(Unsupported.GetSubmenus(path));

            foreach (string str in Unsupported.GetSubmenusIncludingSeparators(path))
            {
                string replacementMenuString = replacementPath + str.Substring(path.Length);
                if (set.Contains(str))
                {
                    ExtractMenuItemWithPath(str, menu, replacementMenuString, temporaryContext, -1, null, null);
                }
            }
        }
示例#3
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());
        }
示例#4
0
        public static void ExtractSubMenuWithPath(string path, GenericMenu menu, string replacementPath, UnityEngine.Object[] temporaryContext)
        {
            HashSet <string> stringSet = new HashSet <string>((IEnumerable <string>)Unsupported.GetSubmenus(path));

            foreach (string includingSeparator in Unsupported.GetSubmenusIncludingSeparators(path))
            {
                string replacementMenuString = replacementPath + includingSeparator.Substring(path.Length);
                if (stringSet.Contains(includingSeparator))
                {
                    MenuUtils.ExtractMenuItemWithPath(includingSeparator, menu, replacementMenuString, temporaryContext, -1, (System.Action <string, UnityEngine.Object[], int>)null, (System.Action <string, UnityEngine.Object[], int>)null);
                }
            }
        }
示例#5
0
        public static void ExtractSubMenuWithPath(string path, GenericMenu menu, string replacementPath, UnityEngine.Object[] temporaryContext)
        {
            HashSet <string> hashSet = new HashSet <string>(Unsupported.GetSubmenus(path));

            string[] submenusIncludingSeparators = Unsupported.GetSubmenusIncludingSeparators(path);
            for (int i = 0; i < submenusIncludingSeparators.Length; i++)
            {
                string text = submenusIncludingSeparators[i];
                string replacementMenuString = replacementPath + text.Substring(path.Length);
                if (hashSet.Contains(text))
                {
                    MenuUtils.ExtractMenuItemWithPath(text, menu, replacementMenuString, temporaryContext, -1, null, null);
                }
            }
        }
示例#6
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);
        }
示例#7
0
        public static void ExtractSubMenuWithPath(string path, GenericMenu menu, string replacementPath, Object[] temporaryContext)
        {
            HashSet <string> menusWithCommands = new HashSet <string>(Unsupported.GetSubmenus(path));

            string[] menus = Unsupported.GetSubmenusIncludingSeparators(path);
            for (int i = 0; i < menus.Length; i++)
            {
                string menuString         = menus[i];
                string replacedMenuString = replacementPath + menuString.Substring(path.Length);
                if (menusWithCommands.Contains(menuString))
                {
                    ExtractMenuItemWithPath(menuString, menu, replacedMenuString, temporaryContext, -1, null, null);
                }
                //else // Comment back in when GenericMenu can handle separators
                //  menu.AddSeparator(replacedMenuString);
            }
        }
示例#8
0
 private void AddCreateGameObjectItemsToMenu(GenericMenu menu, UnityEngine.Object[] context, bool includeCreateEmptyChild)
 {
     foreach (string str in Unsupported.GetSubmenus("GameObject"))
     {
         UnityEngine.Object[] temporaryContext = context;
         if (includeCreateEmptyChild || (str.ToLower() != "GameObject/Create Empty Child".ToLower()))
         {
             if (str.EndsWith("..."))
             {
                 temporaryContext = null;
             }
             if (str.ToLower() == "GameObject/Center On Children".ToLower())
             {
                 return;
             }
             MenuUtils.ExtractMenuItemWithPath(str, menu, str.Substring(11), temporaryContext);
         }
     }
 }
示例#9
0
 private void AddCreateGameObjectItemsToMenu(GenericMenu menu, UnityEngine.Object[] context, bool includeCreateEmptyChild)
 {
     string[] submenus = Unsupported.GetSubmenus("GameObject");
     string[] array    = submenus;
     for (int i = 0; i < array.Length; i++)
     {
         string text = array[i];
         UnityEngine.Object[] temporaryContext = context;
         if (includeCreateEmptyChild || !(text.ToLower() == "GameObject/Create Empty Child".ToLower()))
         {
             if (text.EndsWith("..."))
             {
                 temporaryContext = null;
             }
             if (text.ToLower() == "GameObject/Center On Children".ToLower())
             {
                 return;
             }
             MenuUtils.ExtractMenuItemWithPath(text, menu, text.Substring(11), temporaryContext);
         }
     }
 }
        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;
            }
 private void AddCreateGameObjectItemsToMenu(GenericMenu menu, Object[] context, bool includeCreateEmptyChild, bool includeGameObjectInPath, int targetSceneHandle)
 {
     foreach (string str in Unsupported.GetSubmenus("GameObject"))
     {
         Object[] temporaryContext = context;
         if (includeCreateEmptyChild || (str.ToLower() != "GameObject/Create Empty Child".ToLower()))
         {
             if (str.EndsWith("..."))
             {
                 temporaryContext = null;
             }
             if (str.ToLower() == "GameObject/Center On Children".ToLower())
             {
                 return;
             }
             string replacementMenuString = str;
             if (!includeGameObjectInPath)
             {
                 replacementMenuString = str.Substring(11);
             }
             MenuUtils.ExtractMenuItemWithPath(str, menu, replacementMenuString, temporaryContext, targetSceneHandle, new Action <string, Object[], int>(this.BeforeCreateGameObjectMenuItemWasExecuted), new Action <string, Object[], int>(this.AfterCreateGameObjectMenuItemWasExecuted));
         }
     }
 }
        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();
        }
        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();
        }