public void SelectPoint(int i, ShapeEditor.SelectionType type)
        {
            switch (type)
            {
            case ShapeEditor.SelectionType.Normal:
                this.m_SelectedPoints.Clear();
                this.m_ShapeEditor.activePoint = i;
                this.m_SelectedPoints.Add(i);
                break;

            case ShapeEditor.SelectionType.Additive:
                this.m_ShapeEditor.activePoint = i;
                this.m_SelectedPoints.Add(i);
                break;

            case ShapeEditor.SelectionType.Subtractive:
                this.m_ShapeEditor.activePoint = ((i <= 0) ? 0 : (i - 1));
                this.m_SelectedPoints.Remove(i);
                break;

            default:
                this.m_ShapeEditor.activePoint = i;
                break;
            }
            this.m_ShapeEditor.Repaint();
        }
 public void RectSelect(Rect rect, ShapeEditor.SelectionType type)
 {
     if (type == ShapeEditor.SelectionType.Normal)
     {
         this.m_SelectedPoints.Clear();
         this.m_ShapeEditor.activePoint = -1;
         type = ShapeEditor.SelectionType.Additive;
     }
     for (int i = 0; i < this.m_ShapeEditor.GetPointsCount(); i++)
     {
         Vector2 point = this.m_ShapeEditor.LocalToScreen(this.m_ShapeEditor.GetPointPosition(i));
         if (rect.Contains(point))
         {
             this.SelectPoint(i, type);
         }
     }
     this.m_ShapeEditor.Repaint();
 }
        public void OnGUI()
        {
            Event current = Event.current;

            Handles.BeginGUI();
            Vector2 mousePosition = current.mousePosition;
            int     num           = this.k_RectSelectionID;

            switch (current.GetTypeForControl(num))
            {
            case EventType.MouseDown:
                if (HandleUtility.nearestControl == num && current.button == 0)
                {
                    GUIUtility.hotControl   = num;
                    this.m_SelectStartPoint = mousePosition;
                }
                break;

            case EventType.MouseUp:
                if (GUIUtility.hotControl == num && current.button == 0)
                {
                    GUIUtility.hotControl      = 0;
                    GUIUtility.keyboardControl = 0;
                    if (this.m_RectSelecting)
                    {
                        this.m_SelectMousePoint = new Vector2(mousePosition.x, mousePosition.y);
                        ShapeEditor.SelectionType type = ShapeEditor.SelectionType.Normal;
                        if (Event.current.control)
                        {
                            type = ShapeEditor.SelectionType.Subtractive;
                        }
                        else if (Event.current.shift)
                        {
                            type = ShapeEditor.SelectionType.Additive;
                        }
                        this.RectSelect(EditorGUIExt.FromToRect(this.m_SelectMousePoint, this.m_SelectStartPoint), type);
                        this.m_RectSelecting = false;
                        current.Use();
                    }
                    else
                    {
                        this.m_SelectedPoints.Clear();
                        this.m_ShapeEditor.activePoint = -1;
                        this.m_ShapeEditor.Repaint();
                        current.Use();
                    }
                }
                break;

            case EventType.MouseDrag:
                if (GUIUtility.hotControl == num)
                {
                    if (!this.m_RectSelecting && (mousePosition - this.m_SelectStartPoint).magnitude > 6f)
                    {
                        this.m_RectSelecting = true;
                    }
                    if (this.m_RectSelecting)
                    {
                        this.m_SelectMousePoint = new Vector2(mousePosition.x, mousePosition.y);
                        ShapeEditor.SelectionType type2 = ShapeEditor.SelectionType.Normal;
                        if (Event.current.control)
                        {
                            type2 = ShapeEditor.SelectionType.Subtractive;
                        }
                        else if (Event.current.shift)
                        {
                            type2 = ShapeEditor.SelectionType.Additive;
                        }
                        this.RectSelect(EditorGUIExt.FromToRect(this.m_SelectMousePoint, this.m_SelectStartPoint), type2);
                    }
                    current.Use();
                }
                break;

            case EventType.Repaint:
                if (GUIUtility.hotControl == num && this.m_RectSelecting)
                {
                    EditorStyles.selectionRect.Draw(EditorGUIExt.FromToRect(this.m_SelectStartPoint, this.m_SelectMousePoint), GUIContent.none, false, false, false, false);
                }
                break;

            case EventType.Layout:
                if (!Tools.viewToolActive)
                {
                    HandleUtility.AddDefaultControl(num);
                }
                break;
            }
            Handles.EndGUI();
        }
        private void RectSelect(Rect r, ShapeEditor.SelectionType selectionType)
        {
            var localRect = EditorGUIExt.FromToRect(ScreenToLocal(r.min), ScreenToLocal(r.max));

            m_SelectionRect = localRect;
        }
        private void RectSelect(Rect r, ShapeEditor.SelectionType selectionType)
        {
            Rect value = EditorGUIExt.FromToRect(this.ScreenToLocal(r.min), this.ScreenToLocal(r.max));

            this.m_SelectionRect = new Rect?(value);
        }