示例#1
0
        private static void DrawCore(int instanceID, Rect selectionRect)
        {
            // skips early if item is not registered or not valid
            if (!sceneGameObjects.ContainsKey(instanceID))
            {
                return;
            }

            currentGO = EditorUtility.InstanceIDToObject(instanceID) as GameObject;
            if (currentGO == null)
            {
                return;
            }

            currentItem = sceneGameObjects[instanceID];

            /* Initialzie draw variables */
            {
                bool alphaSorted = HierarchyWindowAdapter.IsUsingAlphaSort();
                if (ALPHA_SORTED != alphaSorted)
                {
                    ALPHA_SORTED = alphaSorted;

                    // This is bad since we retrieve data twice when the user
                    // changes their hierarchy sorting type.
                    //
                    // Yet this may be okay since the user doesn't change
                    // the sorting type that often.
                    RetrieveDataFromHierarchy();
                }

                ROW_HEIGHT     = GUI.skin.label.lineHeight + 1; // default is 16 pixels
                MAX_TAG_LEN    = HierarchyUtil.MaxLabelLength(tags.ToArray(), (data.tag.GetEnabled() && data.tag.enabledText));
                MAX_LAYER_LEN  = HierarchyUtil.MaxLabelLength(layers.ToArray(), (data.layer.GetEnabled() && data.layer.enabledText));
                MAX_INSTID_LEN = HierarchyUtil.MaxIntLength(instanceIDs.ToArray(), data.instanceID.GetEnabled());

                RIGHT_BOUNDARY = 0.0f;  // reset
                if (EXISTS_PREFAB_ICON)
                {
                    RIGHT_BOUNDARY += ROW_HEIGHT;
                }
            }

            //-- Full
            DrawAlternatingBG(instanceID, selectionRect);
            DrawTree(instanceID, selectionRect);
            DrawSeparators(instanceID, selectionRect);
            //-- Left
            DrawIcons(instanceID, selectionRect);
            DrawLog(instanceID, selectionRect);
            //-- Right
            DrawComponents(instanceID, selectionRect);
            DrawTag(instanceID, selectionRect);
            DrawLayer(instanceID, selectionRect);
            DrawInstanceID(instanceID, selectionRect);
        }