示例#1
0
        void CheckImguiOverride()
        {
            var hasOverride = ModeService.HasExecuteHandler("gui_playbar");

            m_ImguiOverride.style.display  = hasOverride ? DisplayStyle.Flex : DisplayStyle.None;
            m_ImguiOverride.onGUIHandler   = hasOverride ? (Action)OverrideGUIHandler : null;
            m_UIElementsRoot.style.display = hasOverride ? DisplayStyle.None : DisplayStyle.Flex;
        }
示例#2
0
        static List <MenuItemData> GetSortedMenuItems(UnityEngine.GameObject[] targets)
        {
            var menus    = Unsupported.GetSubmenus("Component");
            var commands = Unsupported.GetSubmenusCommands("Component");

            var          menuItems       = new List <MenuItemData>(menus.Length);
            var          legacyMenuItems = new List <MenuItemData>(menus.Length);
            const string kLegacyString   = "legacy";

            var hasFilterOverride = ModeService.HasExecuteHandler("inspector_filter_component");

            for (var i = 0; i < menus.Length; i++)
            {
                var  menuPath = menus[i];
                bool isLegacy = menuPath.ToLower().Contains(kLegacyString);
                var  item     = new MenuItemData
                {
                    path     = menuPath,
                    command  = commands[i],
                    isLegacy = isLegacy
                };

                if (!hasFilterOverride || ModeService.Execute("inspector_filter_component", targets, menuPath))
                {
                    if (isLegacy)
                    {
                        legacyMenuItems.Add(item);
                    }
                    else
                    {
                        menuItems.Add(item);
                    }
                }
            }

            int comparison(MenuItemData x, MenuItemData y) => string.CompareOrdinal(x.path, y.path);

            menuItems.Sort(comparison);
            legacyMenuItems.Sort(comparison);

            menuItems.AddRange(legacyMenuItems);

            return(menuItems);
        }