Exemplo n.º 1
0
    public static void DrawHelper(GameObject obj)
    {
        if (_checktip == null)
        {
            _checktip = new GUIContent(string.Empty, "Check Multi be Same");
            _multitip = new GUIContent(string.Empty, "Multi TreeTransform");
            _subtip   = new GUIContent(string.Empty, "Sub From TreeTransform");
            _addtip   = new GUIContent(string.Empty, "Add To TreeTransform");
        }
        Rect rect = HierarchyHelperManager.GetControlRect(8f);

        rect.y      += 3;
        rect.height -= 6;

        TreeTransform mine = obj.GetComponentInParent <TreeTransform>();
        int           num  = 0;

        if (mine == null)
        {
            return;
        }
        else if (mine.gameObject == obj)
        {
            num = mine.CheckMulti();
            HierarchyHelperTools.DrawWithColor(num == 2?Color.yellow:(num == 1?Color.red:Color.green), () =>
            {
                GUI.DrawTexture(rect, HierarchyHelperTools.WhiteTexture, ScaleMode.StretchToFill, true);
                GUI.Label(rect, _checktip);
            });
            return;
        }
        num = mine.CheckChild(obj.transform);
        Color color = num == 0 ? Color.white : (num == 1 ? Color.green : Color.red);

        if (GUI.Button(rect, "", "label"))
        {
            if (num == 0)
            {
                mine.AddChild(obj.transform);
            }
            else
            {
                mine.SubChild(obj.transform);
            }
        }
        HierarchyHelperTools.DrawWithColor(color, () => {
            GUI.Label(rect, num == 0 ? _addtip : (num == 1 ? _subtip : _multitip));
            rect.y      += 4;
            rect.height -= 8;
            GUI.DrawTexture(rect, HierarchyHelperTools.WhiteTexture, ScaleMode.StretchToFill, true);
            if (num == 0)
            {
                rect.y      -= 4;
                rect.x      += 3;
                rect.height += 8;
                rect.width  -= 6;
                GUI.DrawTexture(rect, HierarchyHelperTools.WhiteTexture, ScaleMode.StretchToFill, true);
            }
        });
    }
Exemplo n.º 2
0
    public static void test(Transform t)
    {
        GUIContent c    = new GUIContent(t.position.ToString());
        Vector2    l    = HierarchyHelperTools.GetContentSize(c);
        Rect       rect = HierarchyHelperManager.GetControlRect(l.x + _sliderValue);

        GUI.Label(rect, c);
    }
    public static void DrawLayerName(GameObject obj)
    {
        GUIContent layerName = new GUIContent(LayerMask.LayerToName(obj.layer));
        Vector2    size      = HierarchyHelperTools.GetContentSize(layerName);

        Rect rect = HierarchyHelperManager.GetControlRect(size.x);

        GUI.Label(rect, layerName);
    }
Exemplo n.º 4
0
    public static void DrawHelper(GameObject obj)
    {
        Rect rect   = HierarchyHelperManager.GetControlRect(10f);
        bool active = GUI.Toggle(rect, obj.activeSelf, string.Empty);

        if (!EditorGUIUtility.editingTextField && active != obj.activeSelf)
        {
            obj.SetActive(active);
        }
    }
Exemplo n.º 5
0
    public static void DrawHelper(GameObject obj)
    {
        if (t == null)
        {
            t = new Texture2D(16, 16);
        }
        Rect rect = HierarchyHelperManager.GetControlRect(30f);

        GUI.Label(rect, t);
    }
    public static void DrawLayerVisible(GameObject obj)
    {
        bool visible    = (Tools.visibleLayers & 1 << obj.layer) > 0;
        Rect rect       = HierarchyHelperManager.GetControlRect(10);
        bool newVisible = GUI.Toggle(rect, visible, new GUIContent("", LayerMask.LayerToName(obj.layer)), "VisibilityToggle");

        if (newVisible != visible)
        {
            Tools.visibleLayers ^= 1 << obj.layer;
            SceneView.RepaintAll();
        }
    }
Exemplo n.º 7
0
    public static void DrawHelper(GameObject obj)
    {
        if (_yellowTooltip == null)
        {
            _yellowTooltip = new GUIContent(string.Empty, "Contains Missing Script(s) in Children");
            _redTooltip    = new GUIContent(string.Empty, "Contains Missing Script(s)");
            _greenTooltip  = new GUIContent(string.Empty);
        }

        Rect rect = HierarchyHelperManager.GetControlRect(4);

        rect.y      += 1;
        rect.height -= 2;

        Component[] allComponents   = obj.GetComponentsInChildren <Component>(true);
        bool        found           = false;
        bool        isMissingOnThis = false;

        foreach (Component allC in allComponents)
        {
            if (allC == null)
            {
                Component[] myComponents = obj.GetComponents <Component>( );
                foreach (Component myC in myComponents)
                {
                    if (myC == null)
                    {
                        isMissingOnThis = true;
                        break;
                    }
                }
                found = true;
                break;
            }
        }

        HierarchyHelperTools.DrawWithColor(found ? isMissingOnThis ? Color.red : Color.yellow : Color.green, () => {
            GUI.DrawTexture(rect, HierarchyHelperTools.WhiteTexture, ScaleMode.StretchToFill, true);
            GUI.Label(rect, found ? isMissingOnThis ? _redTooltip : _yellowTooltip : _greenTooltip);
        });
    }
    public static void DrawLayerLock(GameObject obj)
    {
        bool locked = (Tools.lockedLayers & 1 << obj.layer) > 0;
        Rect rect   = HierarchyHelperManager.GetControlRect(16f);

        bool newLocked = locked;

        if (!locked)
        {
            HierarchyHelperTools.DrawWithColor(new Color(1f, 1f, 1f, 0.25f), () =>
                                               newLocked = GUI.Toggle(rect, locked, new GUIContent("", LayerMask.LayerToName(obj.layer)), "IN LockButton"));
        }
        else
        {
            newLocked = GUI.Toggle(rect, locked, new GUIContent("", LayerMask.LayerToName(obj.layer)), "IN LockButton");
        }

        if (newLocked != locked)
        {
            Tools.lockedLayers ^= 1 << obj.layer;
        }
    }
    public static void DrawHelper(GameObject obj)
    {
        Rect rect = HierarchyHelperManager.GetControlRect(20f);

        GUI.Label(rect, "N2");
    }
    public static void DrawHelper(GameObject obj)
    {
        Rect rect = HierarchyHelperManager.GetControlRect(10f);

        obj.SetActive(GUI.Toggle(rect, obj.activeSelf, string.Empty));
    }
Exemplo n.º 11
0
    public void DrawHelper( )
    {
        Rect rect = HierarchyHelperManager.GetControlRect(15f);

        GUI.Label(rect, "S1");
    }
Exemplo n.º 12
0
    public void DrawHelper( )
    {
        Rect rect = HierarchyHelperManager.GetControlRect(16f);

        toggle = GUI.Toggle(rect, toggle, "");
    }