Пример #1
0
    public void RenderKnob(Vector3[] corners, int sel_index)
    {
        Vector3[] gui_knobs = BuildKnobs(corners);

        for (int i = 0; i < gui_knobs.Length; ++i)
        {
            Vector3[] rect = MathTool.GetRect(gui_knobs[i], MathTool.s_knob_half_size);
            if (MathTool.ClipRect(m_view_rect, rect))
            {
                Color color = (i == sel_index ? Color.yellow : Color.green);

                Handles.DrawSolidRectangleWithOutline(rect, color, color);
            }
        }
    }
Пример #2
0
    private void SelKnob(Layout layout, Vector2 mousePosition)
    {
        m_knob_sel_res.m_knob_index = -1;

        UIElement w = layout.FirstUI;

        if (w != null)
        {
            Vector3[] gui_knobs = m_view.BuildKnobs(w.worldCorners);
            Vector3   p         = new Vector3(mousePosition.x, mousePosition.y);

            for (int i = 0; i < gui_knobs.Length; ++i)
            {
                Vector3[] rect = MathTool.GetRect(gui_knobs[i], MathTool.s_knob_half_size);
                if (MathTool.IsPointInConvexPoly(p, rect))
                {
                    m_knob_sel_res.m_knob_index = i;
                    break;
                }
            }
        }
    }