public void ShowWithParams(Vector2 inPosition, List <GameObject> selectedObjects, int firstSelected)
        {
            _selectedObjects = selectedObjects;

            var scene = selectedObjects[0].scene;

            _rainbowHierarchySceneConf = RainbowHierarchySceneConf.GetConfByScene(scene, true);

            _currentObject = selectedObjects[firstSelected];

            var item = _rainbowHierarchySceneConf.GetItem(_currentObject);

            _currentHierarchyItem = item == null ?
                                    new HierarchyItem(KeyType.Object, _currentObject, _currentObject.name) :
                                    new HierarchyItem(item);

            _currentHierarchyItem.GameObject = _currentObject;

            // Resize

            var customIconHeight       = (_currentHierarchyItem.IsIconCustom) ? LINE_HEIGHT : 0f;
            var customBackgroundHeight = (_currentHierarchyItem.IsBackgroundCustom) ? LINE_HEIGHT : 0f;

            var rect = new Rect(inPosition, WINDOW_SIZE)
            {
                height = WINDOW_HEIGHT + customIconHeight + customBackgroundHeight
            };

            _windowRect     = new Rect(Vector2.zero, rect.size);
            _backgroundRect = new Rect(Vector2.one, rect.size - new Vector2(2f, 2f));

            Show <RainbowHierarchyPopup>(rect);
        }
示例#2
0
        //---------------------------------------------------------------------
        // Helpers
        //---------------------------------------------------------------------

        private static void Colorize(HierarchyColorName color, HierarchyItem hierarchyItem)
        {
            var colorIcon = HierarchyColorsStorage.Instance.GetBackgroundByColor(color);

            hierarchyItem.Background         = colorIcon;
            hierarchyItem.IsBackgroundCustom = false;
        }
        //---------------------------------------------------------------------
        // Helpers
        //---------------------------------------------------------------------

        private static void DrawCustomIcon(HierarchyItem hierarchyItem, Rect selectionRect)
        {
            if (hierarchyItem == null || !hierarchyItem.HasIcon())
            {
                return;
            }
            DrawCustomIcon(hierarchyItem.Icon, selectionRect);
        }
 private static void DrawCustomBackground(HierarchyItem hierarchyItem, Rect selectionRect)
 {
     if (hierarchyItem == null || !hierarchyItem.HasBackground())
     {
         return;
     }
     selectionRect.x -= 1f;
     GUI.DrawTexture(selectionRect, hierarchyItem.Background);
 }
 private static void CheckRecursiveListUpdate(HierarchyItem hierarchyItem, GameObject gameObject)
 {
     if (hierarchyItem.HasRecursive() && !RecursiveList.Contains(gameObject))
     {
         RecursiveList.Add(gameObject);
         RecursiveList.Sort(SortByParenting);
     }
     else if (!hierarchyItem.HasRecursive() && RecursiveList.Contains(gameObject))
     {
         RecursiveList.Remove(gameObject);
     }
 }
示例#6
0
        //---------------------------------------------------------------------
        // Public
        //---------------------------------------------------------------------

        public void CopyFrom(HierarchyItem target)
        {
            Type = target.Type;
            Name = target.Name;

            GameObject = target.GameObject;

            Icon            = target.Icon;
            IsIconCustom    = target.IsIconCustom;
            IsIconRecursive = target.IsIconRecursive;

            Background            = target.Background;
            IsBackgroundCustom    = target.IsBackgroundCustom;
            IsBackgroundRecursive = target.IsBackgroundRecursive;
        }
示例#7
0
        public HierarchyItem(HierarchyItem value)
        {
            Type = value.Type;
            Name = value.Name;

            GameObject = value.GameObject;

            Icon            = value.Icon;
            IsIconCustom    = value.IsIconCustom;
            IsIconRecursive = value.IsIconRecursive;

            Background            = value.Background;
            IsBackgroundCustom    = value.IsBackgroundCustom;
            IsBackgroundRecursive = value.IsBackgroundRecursive;
        }
示例#8
0
        //---------------------------------------------------------------------
        // Public
        //---------------------------------------------------------------------

        public static void ShowDropDown(Rect position, HierarchyItem hierarchyItem)
        {
            var menu = new GenericMenu();

            // Colors
            menu.AddItem(COLOR_RED, false, RedCallback, hierarchyItem);
            menu.AddItem(COLOR_VERMILION, false, VermilionCallback, hierarchyItem);
            menu.AddItem(COLOR_ORANGE, false, OrangeCallback, hierarchyItem);
            menu.AddItem(COLOR_AMBER, false, AmberCallback, hierarchyItem);
            menu.AddItem(COLOR_YELLOW, false, YellowCallback, hierarchyItem);
            menu.AddItem(COLOR_LIME, false, LimeCallback, hierarchyItem);
            menu.AddItem(COLOR_CHARTREUSE, false, ChartreuseCallback, hierarchyItem);
            menu.AddItem(COLOR_HARLEQUIN, false, HarlequinCallback, hierarchyItem);
            menu.AddSeparator(MENU_COLORIZE);
            menu.AddItem(COLOR_GREEN, false, GreenCallback, hierarchyItem);
            menu.AddItem(COLOR_EMERALD, false, EmeraldCallback, hierarchyItem);
            menu.AddItem(COLOR_SPRING_GREEN, false, SpringGreenCallback, hierarchyItem);
            menu.AddItem(COLOR_AQUAMARINE, false, AquamarineCallback, hierarchyItem);
            menu.AddItem(COLOR_CYAN, false, CyanCallback, hierarchyItem);
            menu.AddItem(COLOR_SKY_BLUE, false, SkyBlueCallback, hierarchyItem);
            menu.AddItem(COLOR_AZURE, false, AzureCallback, hierarchyItem);
            menu.AddItem(COLOR_CERULEAN, false, CeruleanCallback, hierarchyItem);
            menu.AddSeparator(MENU_COLORIZE);
            menu.AddItem(COLOR_BLUE, false, BlueCallback, hierarchyItem);
            menu.AddItem(COLOR_INDIGO, false, IndigoCallback, hierarchyItem);
            menu.AddItem(COLOR_VIOLET, false, VioletCallback, hierarchyItem);
            menu.AddItem(COLOR_PURPLE, false, PurpleCallback, hierarchyItem);
            menu.AddItem(COLOR_MAGENTA, false, MagentaCallback, hierarchyItem);
            menu.AddItem(COLOR_FUCHSIA, false, FuchsiaCallback, hierarchyItem);
            menu.AddItem(COLOR_ROSE, false, RoseCallback, hierarchyItem);
            menu.AddItem(COLOR_CRIMSON, false, CrimsonCallback, hierarchyItem);

            // Separator
            menu.AddSeparator(string.Empty);
            // Custom
            menu.AddItem(SELECT_CUSTOM, false, SelectCustomCallback, hierarchyItem);
            // None
            menu.AddItem(SELECT_NONE, false, SelectNoneCallback, hierarchyItem);

            menu.DropDown(position);
        }
示例#9
0
        public void UpdateItem(GameObject selectedObject, HierarchyItem hierarchyItem)
        {
            var existingItem = GetItem(selectedObject);

            if (existingItem != null)
            {
                if (hierarchyItem.HasAtLeastOneTexture())
                {
                    existingItem.CopyFrom(hierarchyItem);
                }
                else
                {
                    RemoveAll(selectedObject, existingItem.Type);
                }
            }
            else
            {
                if (hierarchyItem.HasAtLeastOneTexture())
                {
                    AddItem(hierarchyItem);
                }
            }
        }
示例#10
0
 private static void SelectCustom(HierarchyItem hierarchyItem)
 {
     hierarchyItem.Background         = null;
     hierarchyItem.IsBackgroundCustom = true;
 }
示例#11
0
 private static void SelectNone(HierarchyItem hierarchyItem)
 {
     hierarchyItem.Background            = null;
     hierarchyItem.IsBackgroundCustom    = false;
     hierarchyItem.IsBackgroundRecursive = false;
 }
示例#12
0
        public void AddItem(HierarchyItem hierarchyItem)
        {
            var item = new HierarchyItem(hierarchyItem);

            HierarchyItems.Add(item);
        }