コード例 #1
0
        public static void Draw_GameObj_Bounds(GameObject obj)
        {
            if (obj == null)
            {
                return;
            }
            RectTransform trans = (obj.transform as RectTransform);

            Rect area = Util.Get_Unity_UI_Object_Area(obj);

            GL.Color(uiControl.color_purple);
            DebugUI.Draw_Rect(area);

            GL.Color(uiControl.color_orange);
            DebugUI.Draw_Point(Util.Get_Unity_UI_Object_AnchorPos(trans.gameObject));
        }
コード例 #2
0
        internal static void Draw_Debug_Outlines()
        {
            GL.Begin(GL.LINES);
            foreach (uiControl control in uiControl.ALL.Values)
            {
                Rect area      = control.absArea;
                bool DrawInner = false;
                if (DEBUG_DRAW_MODE == uiDebugDrawMode.SELECTED_ONLY)
                {
                    if (control != uiControl.debug_current_mouse_over)
                    {
                        continue;
                    }
                    // Draw all areas of the selected control

                    GL.Color(blue_trans);
                    DebugUI.Draw_Rect(control.internalToAbsolute(control.inner_area));

                    GL.Color(purple_trans);
                    DebugUI.Draw_Rect(control.internalToAbsolute(control.draw_area));

                    GL.Color(white_trans);
                    //DebugUI.Draw_Rect(control.absArea);
                    DebugUI.Draw_Rect(control.internalToAbsolute(control.Area));

                    /*
                     * GL.Color(yellow_trans);
                     * DebugUI.Draw_Rect(control.internalToAbsolute(control.content_area));
                     */
                    GL.Color(Color.clear);
                }
                else if (DEBUG_DRAW_MODE == uiDebugDrawMode.ACTIVE_ONLY)
                {
                    if (!control.isVisible)
                    {
                        continue;
                    }

                    GL.Color(white_trans);
                }
                else if (DEBUG_DRAW_MODE == uiDebugDrawMode.BORDER_AREAS)
                {
                    if (!control.isVisible)
                    {
                        continue;
                    }

                    GL.Color(yellow_trans);
                    area = control.internalToAbsolute(control.border_area);
                }
                else if (DEBUG_DRAW_MODE == uiDebugDrawMode.DRAW_AREAS)
                {
                    if (!control.isVisible)
                    {
                        continue;
                    }

                    GL.Color(purple_trans);
                    area = control.internalToAbsolute(control.draw_area);
                }
                else if (DEBUG_DRAW_MODE == uiDebugDrawMode.INNER_AREAS)
                {
                    if (!control.isVisible)
                    {
                        continue;
                    }

                    GL.Color(blue_trans);
                    area = control.internalToAbsolute(control.inner_area);
                }
                else if (DEBUG_DRAW_MODE == uiDebugDrawMode.ACTIVE_AND_INACTIVE)
                {
                    if (control.isVisible)
                    {
                        GL.Color(Color.white);
                    }
                    else
                    {
                        GL.Color(white_dark);
                    }
                }
                else if (DEBUG_DRAW_MODE == uiDebugDrawMode.HIGHLIGHT_PARENTS)
                {
                    if (control.isParent)
                    {
                        if (control.isVisible)
                        {
                            GL.Color(Color.white);
                        }
                        else
                        {
                            GL.Color(white_dark);
                        }
                    }
                    else
                    {
                        continue;
                    }
                }
                else if (DEBUG_DRAW_MODE == uiDebugDrawMode.HIGHLIGHT_PARENT_INNER_AREAS)
                {
                    if (control.isParent)
                    {
                        DrawInner = true;
                        if (control.isVisible)
                        {
                            GL.Color(Color.red);
                        }
                        else
                        {
                            GL.Color(red_dark);
                        }
                    }
                    else
                    {
                        continue;
                    }
                }

                if (area.x > area.xMax || area.y > area.yMax)
                {
                    GL.Color(grey_dark);
                }
                DebugUI.Draw_Rect(area);

                if (DrawInner)
                {
                    if (control.isVisible)
                    {
                        GL.Color(Color.blue);
                    }
                    else
                    {
                        GL.Color(blue_dark);
                    }

                    if (control.absInnerArea.x > control.absInnerArea.xMax || control.absInnerArea.y > control.absInnerArea.yMax)
                    {
                        GL.Color(Color.black);
                    }
                    DebugUI.Draw_Rect(control.absInnerArea);
                }
            }

            if (uiControl.debug_last_consumer_click != null)
            {
                GL.Color(Color.green);
                DebugUI.Draw_Rect(uiControl.debug_last_consumer_click.absArea);
            }

            if (uiControl.debug_current_mouse_over != null && DEBUG_DRAW_MODE != uiDebugDrawMode.SELECTED_ONLY)
            {
                GL.Color(Color.yellow);
                DebugUI.Draw_Rect(uiControl.debug_current_mouse_over.absArea);
            }

            GL.End();
            GL.Color(Color.white);// Always set the GL color back to white before returning from any debug drawing routine!
        }