Example #1
0
        public static HighLevelEvent MultiSelection(Rect rect, Rect[] positions, GUIContent content, Rect[] hitPositions, ref bool[] selections, bool[] readOnly, out int clickedIndex, out Vector2 offset, out float startSelect, out float endSelect, GUIStyle style)
        {
            int   controlID = GUIUtility.GetControlID(41623453, FocusType.Keyboard);
            Event current   = Event.current;

            offset       = Vector2.zero;
            clickedIndex = -1;
            startSelect  = (endSelect = 0f);
            HighLevelEvent result;

            if (current.type == EventType.Used)
            {
                result = HighLevelEvent.None;
            }
            else
            {
                bool flag = false;
                if (Event.current.type != EventType.Layout)
                {
                    if (GUIUtility.keyboardControl == controlID)
                    {
                        flag = true;
                    }
                }
                EventType typeForControl = current.GetTypeForControl(controlID);
                switch (typeForControl)
                {
                case EventType.MouseDown:
                {
                    if (current.button != 0)
                    {
                        goto IL_6A2;
                    }
                    GUIUtility.hotControl         = controlID;
                    GUIUtility.keyboardControl    = controlID;
                    EditorGUIExt.s_StartSelectPos = current.mousePosition;
                    int indexUnderMouse = EditorGUIExt.GetIndexUnderMouse(hitPositions, readOnly);
                    if (Event.current.clickCount == 2)
                    {
                        if (indexUnderMouse >= 0)
                        {
                            for (int i = 0; i < selections.Length; i++)
                            {
                                selections[i] = false;
                            }
                            selections[indexUnderMouse] = true;
                            current.Use();
                            clickedIndex = indexUnderMouse;
                            result       = HighLevelEvent.DoubleClick;
                            return(result);
                        }
                    }
                    if (indexUnderMouse >= 0)
                    {
                        if (!current.shift && !EditorGUI.actionKey && !selections[indexUnderMouse])
                        {
                            for (int j = 0; j < hitPositions.Length; j++)
                            {
                                selections[j] = false;
                            }
                        }
                        if (current.shift || EditorGUI.actionKey)
                        {
                            selections[indexUnderMouse] = !selections[indexUnderMouse];
                        }
                        else
                        {
                            selections[indexUnderMouse] = true;
                        }
                        EditorGUIExt.s_MouseDownPos             = current.mousePosition;
                        EditorGUIExt.s_MultiSelectDragSelection = EditorGUIExt.DragSelectionState.None;
                        current.Use();
                        clickedIndex = indexUnderMouse;
                        result       = HighLevelEvent.SelectionChanged;
                        return(result);
                    }
                    bool flag2;
                    if (!current.shift && !EditorGUI.actionKey)
                    {
                        for (int k = 0; k < hitPositions.Length; k++)
                        {
                            selections[k] = false;
                        }
                        flag2 = true;
                    }
                    else
                    {
                        flag2 = false;
                    }
                    EditorGUIExt.s_SelectionBackup          = new List <bool>(selections);
                    EditorGUIExt.s_LastFrameSelections      = new List <bool>(selections);
                    EditorGUIExt.s_MultiSelectDragSelection = EditorGUIExt.DragSelectionState.DragSelecting;
                    current.Use();
                    result = ((!flag2) ? HighLevelEvent.None : HighLevelEvent.SelectionChanged);
                    return(result);
                }

                case EventType.MouseUp:
                    if (GUIUtility.hotControl == controlID)
                    {
                        GUIUtility.hotControl = 0;
                        if (EditorGUIExt.s_StartSelectPos != current.mousePosition)
                        {
                            current.Use();
                        }
                        if (EditorGUIExt.s_MultiSelectDragSelection != EditorGUIExt.DragSelectionState.None)
                        {
                            EditorGUIExt.s_MultiSelectDragSelection = EditorGUIExt.DragSelectionState.None;
                            EditorGUIExt.s_SelectionBackup          = null;
                            EditorGUIExt.s_LastFrameSelections      = null;
                            result = HighLevelEvent.EndDrag;
                            return(result);
                        }
                        clickedIndex = EditorGUIExt.GetIndexUnderMouse(hitPositions, readOnly);
                        if (current.clickCount == 1)
                        {
                            result = HighLevelEvent.Click;
                            return(result);
                        }
                    }
                    goto IL_6A2;

                case EventType.MouseMove:
                case EventType.KeyUp:
                case EventType.ScrollWheel:
IL_98:
                    switch (typeForControl)
                    {
                    case EventType.ValidateCommand:
                    case EventType.ExecuteCommand:
                        if (flag)
                        {
                            bool   flag3       = current.type == EventType.ExecuteCommand;
                            string commandName = current.commandName;
                            if (commandName != null)
                            {
                                if (commandName == "Delete")
                                {
                                    current.Use();
                                    if (flag3)
                                    {
                                        result = HighLevelEvent.Delete;
                                        return(result);
                                    }
                                }
                            }
                        }
                        goto IL_6A2;

                    case EventType.DragExited:
                        goto IL_6A2;

                    case EventType.ContextClick:
                    {
                        int indexUnderMouse = EditorGUIExt.GetIndexUnderMouse(hitPositions, readOnly);
                        if (indexUnderMouse >= 0)
                        {
                            clickedIndex = indexUnderMouse;
                            GUIUtility.keyboardControl = controlID;
                            current.Use();
                            result = HighLevelEvent.ContextClick;
                            return(result);
                        }
                        goto IL_6A2;
                    }

                    default:
                        goto IL_6A2;
                    }
                    break;

                case EventType.MouseDrag:
                    if (GUIUtility.hotControl != controlID)
                    {
                        goto IL_6A2;
                    }
                    if (EditorGUIExt.s_MultiSelectDragSelection == EditorGUIExt.DragSelectionState.DragSelecting)
                    {
                        float num  = Mathf.Min(EditorGUIExt.s_StartSelectPos.x, current.mousePosition.x);
                        float num2 = Mathf.Max(EditorGUIExt.s_StartSelectPos.x, current.mousePosition.x);
                        EditorGUIExt.s_SelectionBackup.CopyTo(selections);
                        for (int l = 0; l < hitPositions.Length; l++)
                        {
                            if (!selections[l])
                            {
                                float num3 = hitPositions[l].x + hitPositions[l].width * 0.5f;
                                if (num3 >= num && num3 <= num2)
                                {
                                    selections[l] = true;
                                }
                            }
                        }
                        current.Use();
                        startSelect = num;
                        endSelect   = num2;
                        bool flag4 = false;
                        for (int m = 0; m < selections.Length; m++)
                        {
                            if (selections[m] != EditorGUIExt.s_LastFrameSelections[m])
                            {
                                flag4 = true;
                                EditorGUIExt.s_LastFrameSelections[m] = selections[m];
                            }
                        }
                        result = ((!flag4) ? HighLevelEvent.None : HighLevelEvent.SelectionChanged);
                        return(result);
                    }
                    offset = current.mousePosition - EditorGUIExt.s_MouseDownPos;
                    current.Use();
                    if (EditorGUIExt.s_MultiSelectDragSelection == EditorGUIExt.DragSelectionState.None)
                    {
                        EditorGUIExt.s_MultiSelectDragSelection = EditorGUIExt.DragSelectionState.Dragging;
                        result = HighLevelEvent.BeginDrag;
                        return(result);
                    }
                    result = HighLevelEvent.Drag;
                    return(result);

                case EventType.KeyDown:
                    if (flag)
                    {
                        if (current.keyCode == KeyCode.Backspace || current.keyCode == KeyCode.Delete)
                        {
                            current.Use();
                            result = HighLevelEvent.Delete;
                            return(result);
                        }
                    }
                    goto IL_6A2;

                case EventType.Repaint:
                {
                    if (GUIUtility.hotControl == controlID && EditorGUIExt.s_MultiSelectDragSelection == EditorGUIExt.DragSelectionState.DragSelecting)
                    {
                        float num4     = Mathf.Min(EditorGUIExt.s_StartSelectPos.x, current.mousePosition.x);
                        float num5     = Mathf.Max(EditorGUIExt.s_StartSelectPos.x, current.mousePosition.x);
                        Rect  position = new Rect(0f, 0f, rect.width, rect.height);
                        position.x     = num4;
                        position.width = num5 - num4;
                        if (position.width != 0f)
                        {
                            GUI.Box(position, "", EditorGUIExt.ms_Styles.selectionRect);
                        }
                    }
                    Color color = GUI.color;
                    for (int n = 0; n < positions.Length; n++)
                    {
                        if (readOnly != null && readOnly[n])
                        {
                            GUI.color = color * new Color(0.9f, 0.9f, 0.9f, 0.5f);
                        }
                        else if (selections[n])
                        {
                            GUI.color = color * new Color(0.3f, 0.55f, 0.95f, 1f);
                        }
                        else
                        {
                            GUI.color = color * new Color(0.9f, 0.9f, 0.9f, 1f);
                        }
                        style.Draw(positions[n], content, controlID, selections[n]);
                    }
                    GUI.color = color;
                    goto IL_6A2;
                }
                }
                goto IL_98;
IL_6A2:
                result = HighLevelEvent.None;
            }
            return(result);
        }
		public static HighLevelEvent MultiSelection(Rect rect, Rect[] positions, GUIContent content, Rect[] hitPositions, ref bool[] selections, bool[] readOnly, out int clickedIndex, out Vector2 offset, out float startSelect, out float endSelect, GUIStyle style)
		{
			int controlID = GUIUtility.GetControlID(41623453, FocusType.Keyboard);
			Event current = Event.current;
			offset = Vector2.zero;
			clickedIndex = -1;
			startSelect = (endSelect = 0f);
			if (current.type == EventType.Used)
			{
				return HighLevelEvent.None;
			}
			bool flag = false;
			if (GUIUtility.keyboardControl == controlID)
			{
				flag = true;
			}
			else
			{
				selections = new bool[selections.Length];
			}
			EventType typeForControl = current.GetTypeForControl(controlID);
			EventType eventType = typeForControl;
			switch (eventType)
			{
			case EventType.MouseDown:
			{
				if (current.button != 0)
				{
					return HighLevelEvent.None;
				}
				GUIUtility.hotControl = controlID;
				GUIUtility.keyboardControl = controlID;
				EditorGUIExt.s_StartSelectPos = current.mousePosition;
				int indexUnderMouse = EditorGUIExt.GetIndexUnderMouse(hitPositions, readOnly);
				if (Event.current.clickCount == 2 && indexUnderMouse >= 0)
				{
					for (int i = 0; i < selections.Length; i++)
					{
						selections[i] = false;
					}
					selections[indexUnderMouse] = true;
					current.Use();
					clickedIndex = indexUnderMouse;
					return HighLevelEvent.DoubleClick;
				}
				if (indexUnderMouse >= 0)
				{
					if (!current.shift && !EditorGUI.actionKey && !selections[indexUnderMouse])
					{
						for (int j = 0; j < hitPositions.Length; j++)
						{
							selections[j] = false;
						}
					}
					if (current.shift || EditorGUI.actionKey)
					{
						selections[indexUnderMouse] = !selections[indexUnderMouse];
					}
					else
					{
						selections[indexUnderMouse] = true;
					}
					EditorGUIExt.s_MouseDownPos = current.mousePosition;
					EditorGUIExt.s_MultiSelectDragSelection = EditorGUIExt.DragSelectionState.None;
					current.Use();
					clickedIndex = indexUnderMouse;
					return HighLevelEvent.SelectionChanged;
				}
				bool flag2;
				if (!current.shift && !EditorGUI.actionKey)
				{
					for (int k = 0; k < hitPositions.Length; k++)
					{
						selections[k] = false;
					}
					flag2 = true;
				}
				else
				{
					flag2 = false;
				}
				EditorGUIExt.s_SelectionBackup = new List<bool>(selections);
				EditorGUIExt.s_LastFrameSelections = new List<bool>(selections);
				EditorGUIExt.s_MultiSelectDragSelection = EditorGUIExt.DragSelectionState.DragSelecting;
				current.Use();
				return (!flag2) ? HighLevelEvent.None : HighLevelEvent.SelectionChanged;
			}
			case EventType.MouseUp:
				if (GUIUtility.hotControl == controlID)
				{
					GUIUtility.hotControl = 0;
					if (EditorGUIExt.s_StartSelectPos != current.mousePosition)
					{
						current.Use();
					}
					if (EditorGUIExt.s_MultiSelectDragSelection != EditorGUIExt.DragSelectionState.None)
					{
						EditorGUIExt.s_MultiSelectDragSelection = EditorGUIExt.DragSelectionState.None;
						EditorGUIExt.s_SelectionBackup = null;
						EditorGUIExt.s_LastFrameSelections = null;
						return HighLevelEvent.EndDrag;
					}
					clickedIndex = EditorGUIExt.GetIndexUnderMouse(hitPositions, readOnly);
					if (current.clickCount == 1)
					{
						return HighLevelEvent.Click;
					}
				}
				return HighLevelEvent.None;
			case EventType.MouseMove:
			case EventType.KeyUp:
			case EventType.ScrollWheel:
				IL_96:
				switch (eventType)
				{
				case EventType.ValidateCommand:
				case EventType.ExecuteCommand:
					if (flag)
					{
						bool flag3 = current.type == EventType.ExecuteCommand;
						string commandName = current.commandName;
						if (commandName != null)
						{
							if (EditorGUIExt.<>f__switch$mapB == null)
							{
								EditorGUIExt.<>f__switch$mapB = new Dictionary<string, int>(1)
								{

									{
										"Delete",
										0
									}
								};
							}
							int num;
							if (EditorGUIExt.<>f__switch$mapB.TryGetValue(commandName, out num))
							{
								if (num == 0)
								{
									current.Use();
									if (flag3)
									{
										return HighLevelEvent.Delete;
									}
								}
							}
						}
					}
					return HighLevelEvent.None;
				case EventType.DragExited:
					return HighLevelEvent.None;
				case EventType.ContextClick:
				{
					int indexUnderMouse = EditorGUIExt.GetIndexUnderMouse(hitPositions, readOnly);
					if (indexUnderMouse >= 0)
					{
						clickedIndex = indexUnderMouse;
						GUIUtility.keyboardControl = controlID;
						current.Use();
						return HighLevelEvent.ContextClick;
					}
					return HighLevelEvent.None;
				}
				default:
					return HighLevelEvent.None;
				}
				break;
			case EventType.MouseDrag:
				if (GUIUtility.hotControl != controlID)
				{
					return HighLevelEvent.None;
				}
				if (EditorGUIExt.s_MultiSelectDragSelection == EditorGUIExt.DragSelectionState.DragSelecting)
				{
					float num2 = Mathf.Min(EditorGUIExt.s_StartSelectPos.x, current.mousePosition.x);
					float num3 = Mathf.Max(EditorGUIExt.s_StartSelectPos.x, current.mousePosition.x);
					EditorGUIExt.s_SelectionBackup.CopyTo(selections);
					for (int l = 0; l < hitPositions.Length; l++)
					{
						if (!selections[l])
						{
							float num4 = hitPositions[l].x + hitPositions[l].width * 0.5f;
							if (num4 >= num2 && num4 <= num3)
							{
								selections[l] = true;
							}
						}
					}
					current.Use();
					startSelect = num2;
					endSelect = num3;
					bool flag4 = false;
					for (int m = 0; m < selections.Length; m++)
					{
						if (selections[m] != EditorGUIExt.s_LastFrameSelections[m])
						{
							flag4 = true;
							EditorGUIExt.s_LastFrameSelections[m] = selections[m];
						}
					}
					return (!flag4) ? HighLevelEvent.None : HighLevelEvent.SelectionChanged;
				}
				offset = current.mousePosition - EditorGUIExt.s_MouseDownPos;
				current.Use();
				if (EditorGUIExt.s_MultiSelectDragSelection == EditorGUIExt.DragSelectionState.None)
				{
					EditorGUIExt.s_MultiSelectDragSelection = EditorGUIExt.DragSelectionState.Dragging;
					return HighLevelEvent.BeginDrag;
				}
				return HighLevelEvent.Drag;
			case EventType.KeyDown:
				if (flag && (current.keyCode == KeyCode.Backspace || current.keyCode == KeyCode.Delete))
				{
					current.Use();
					return HighLevelEvent.Delete;
				}
				return HighLevelEvent.None;
			case EventType.Repaint:
			{
				if (GUIUtility.hotControl == controlID && EditorGUIExt.s_MultiSelectDragSelection == EditorGUIExt.DragSelectionState.DragSelecting)
				{
					float num5 = Mathf.Min(EditorGUIExt.s_StartSelectPos.x, current.mousePosition.x);
					float num6 = Mathf.Max(EditorGUIExt.s_StartSelectPos.x, current.mousePosition.x);
					Rect position = new Rect(0f, 0f, rect.width, rect.height);
					position.x = num5;
					position.width = num6 - num5;
					if (position.width != 0f)
					{
						GUI.Box(position, string.Empty, EditorGUIExt.ms_Styles.selectionRect);
					}
				}
				Color color = GUI.color;
				for (int n = 0; n < positions.Length; n++)
				{
					if (readOnly != null && readOnly[n])
					{
						GUI.color = color * new Color(0.9f, 0.9f, 0.9f, 0.5f);
					}
					else
					{
						if (selections[n])
						{
							GUI.color = color * new Color(0.3f, 0.55f, 0.95f, 1f);
						}
						else
						{
							GUI.color = color * new Color(0.9f, 0.9f, 0.9f, 1f);
						}
					}
					style.Draw(positions[n], content, controlID, selections[n]);
				}
				GUI.color = color;
				return HighLevelEvent.None;
			}
			}
			goto IL_96;
		}
Example #3
0
        public static HighLevelEvent MultiSelection(Rect rect, Rect[] positions, GUIContent content, Rect[] hitPositions, ref bool[] selections, bool[] readOnly, out int clickedIndex, out Vector2 offset, out float startSelect, out float endSelect, GUIStyle style)
        {
            int   controlId = GUIUtility.GetControlID(41623453, FocusType.Keyboard);
            Event current   = Event.current;

            offset       = Vector2.zero;
            clickedIndex = -1;
            startSelect  = endSelect = 0.0f;
            if (current.type == EventType.Used)
            {
                return(HighLevelEvent.None);
            }
            bool flag1 = false;

            if (Event.current.type != EventType.Layout)
            {
                if (GUIUtility.keyboardControl == controlId)
                {
                    flag1 = true;
                }
                else
                {
                    selections = new bool[selections.Length];
                }
            }
            EventType typeForControl = current.GetTypeForControl(controlId);

            switch (typeForControl)
            {
            case EventType.MouseDown:
                if (current.button == 0)
                {
                    GUIUtility.hotControl         = controlId;
                    GUIUtility.keyboardControl    = controlId;
                    EditorGUIExt.s_StartSelectPos = current.mousePosition;
                    int indexUnderMouse = EditorGUIExt.GetIndexUnderMouse(hitPositions, readOnly);
                    if (Event.current.clickCount == 2 && indexUnderMouse >= 0)
                    {
                        for (int index = 0; index < selections.Length; ++index)
                        {
                            selections[index] = false;
                        }
                        selections[indexUnderMouse] = true;
                        current.Use();
                        clickedIndex = indexUnderMouse;
                        return(HighLevelEvent.DoubleClick);
                    }
                    if (indexUnderMouse >= 0)
                    {
                        if (!current.shift && !EditorGUI.actionKey && !selections[indexUnderMouse])
                        {
                            for (int index = 0; index < hitPositions.Length; ++index)
                            {
                                selections[index] = false;
                            }
                        }
                        selections[indexUnderMouse]             = !current.shift && !EditorGUI.actionKey || !selections[indexUnderMouse];
                        EditorGUIExt.s_MouseDownPos             = current.mousePosition;
                        EditorGUIExt.s_MultiSelectDragSelection = EditorGUIExt.DragSelectionState.None;
                        current.Use();
                        clickedIndex = indexUnderMouse;
                        return(HighLevelEvent.SelectionChanged);
                    }
                    bool flag2;
                    if (!current.shift && !EditorGUI.actionKey)
                    {
                        for (int index = 0; index < hitPositions.Length; ++index)
                        {
                            selections[index] = false;
                        }
                        flag2 = true;
                    }
                    else
                    {
                        flag2 = false;
                    }
                    EditorGUIExt.s_SelectionBackup          = new List <bool>((IEnumerable <bool>)selections);
                    EditorGUIExt.s_LastFrameSelections      = new List <bool>((IEnumerable <bool>)selections);
                    EditorGUIExt.s_MultiSelectDragSelection = EditorGUIExt.DragSelectionState.DragSelecting;
                    current.Use();
                    return(flag2 ? HighLevelEvent.SelectionChanged : HighLevelEvent.None);
                }
                break;

            case EventType.MouseUp:
                if (GUIUtility.hotControl == controlId)
                {
                    GUIUtility.hotControl = 0;
                    if (EditorGUIExt.s_StartSelectPos != current.mousePosition)
                    {
                        current.Use();
                    }
                    if (EditorGUIExt.s_MultiSelectDragSelection == EditorGUIExt.DragSelectionState.None)
                    {
                        clickedIndex = EditorGUIExt.GetIndexUnderMouse(hitPositions, readOnly);
                        if (current.clickCount == 1)
                        {
                            return(HighLevelEvent.Click);
                        }
                        break;
                    }
                    EditorGUIExt.s_MultiSelectDragSelection = EditorGUIExt.DragSelectionState.None;
                    EditorGUIExt.s_SelectionBackup          = (List <bool>)null;
                    EditorGUIExt.s_LastFrameSelections      = (List <bool>)null;
                    return(HighLevelEvent.EndDrag);
                }
                break;

            case EventType.MouseDrag:
                if (GUIUtility.hotControl == controlId)
                {
                    if (EditorGUIExt.s_MultiSelectDragSelection == EditorGUIExt.DragSelectionState.DragSelecting)
                    {
                        float num1 = Mathf.Min(EditorGUIExt.s_StartSelectPos.x, current.mousePosition.x);
                        float num2 = Mathf.Max(EditorGUIExt.s_StartSelectPos.x, current.mousePosition.x);
                        EditorGUIExt.s_SelectionBackup.CopyTo(selections);
                        for (int index = 0; index < hitPositions.Length; ++index)
                        {
                            if (!selections[index])
                            {
                                float num3 = hitPositions[index].x + hitPositions[index].width * 0.5f;
                                if ((double)num3 >= (double)num1 && (double)num3 <= (double)num2)
                                {
                                    selections[index] = true;
                                }
                            }
                        }
                        current.Use();
                        startSelect = num1;
                        endSelect   = num2;
                        bool flag2 = false;
                        for (int index = 0; index < selections.Length; ++index)
                        {
                            if (selections[index] != EditorGUIExt.s_LastFrameSelections[index])
                            {
                                flag2 = true;
                                EditorGUIExt.s_LastFrameSelections[index] = selections[index];
                            }
                        }
                        return(flag2 ? HighLevelEvent.SelectionChanged : HighLevelEvent.None);
                    }
                    offset = current.mousePosition - EditorGUIExt.s_MouseDownPos;
                    current.Use();
                    if (EditorGUIExt.s_MultiSelectDragSelection != EditorGUIExt.DragSelectionState.None)
                    {
                        return(HighLevelEvent.Drag);
                    }
                    EditorGUIExt.s_MultiSelectDragSelection = EditorGUIExt.DragSelectionState.Dragging;
                    return(HighLevelEvent.BeginDrag);
                }
                break;

            case EventType.KeyDown:
                if (flag1 && (current.keyCode == KeyCode.Backspace || current.keyCode == KeyCode.Delete))
                {
                    current.Use();
                    return(HighLevelEvent.Delete);
                }
                break;

            case EventType.Repaint:
                if (GUIUtility.hotControl == controlId && EditorGUIExt.s_MultiSelectDragSelection == EditorGUIExt.DragSelectionState.DragSelecting)
                {
                    float num1     = Mathf.Min(EditorGUIExt.s_StartSelectPos.x, current.mousePosition.x);
                    float num2     = Mathf.Max(EditorGUIExt.s_StartSelectPos.x, current.mousePosition.x);
                    Rect  position = new Rect(0.0f, 0.0f, rect.width, rect.height);
                    position.x     = num1;
                    position.width = num2 - num1;
                    if ((double)position.width != 0.0)
                    {
                        GUI.Box(position, string.Empty, EditorGUIExt.ms_Styles.selectionRect);
                    }
                }
                Color color = GUI.color;
                for (int index = 0; index < positions.Length; ++index)
                {
                    GUI.color = readOnly == null || !readOnly[index] ? (!selections[index] ? color * new Color(0.9f, 0.9f, 0.9f, 1f) : color * new Color(0.3f, 0.55f, 0.95f, 1f)) : color * new Color(0.9f, 0.9f, 0.9f, 0.5f);
                    style.Draw(positions[index], content, controlId, selections[index]);
                }
                GUI.color = color;
                break;

            default:
                switch (typeForControl - 13)
                {
                case EventType.MouseDown:
                case EventType.MouseUp:
                    if (flag1)
                    {
                        bool   flag2       = current.type == EventType.ExecuteCommand;
                        string commandName = current.commandName;
                        if (commandName != null)
                        {
                            // ISSUE: reference to a compiler-generated field
                            if (EditorGUIExt.\u003C\u003Ef__switch\u0024mapE == null)
                            {
                                // ISSUE: reference to a compiler-generated field
                                EditorGUIExt.\u003C\u003Ef__switch\u0024mapE = new Dictionary <string, int>(1)
                                {
                                    {
                                        "Delete",
                                        0
                                    }
                                };
                            }
                            int num;
                            // ISSUE: reference to a compiler-generated field
                            if (EditorGUIExt.\u003C\u003Ef__switch\u0024mapE.TryGetValue(commandName, out num) && num == 0)
                            {
                                current.Use();
                                if (flag2)
                                {
                                    return(HighLevelEvent.Delete);
                                }
                                break;
                            }
                            break;
                        }
                        break;
                    }
                    break;

                case EventType.MouseDrag:
                    int indexUnderMouse1 = EditorGUIExt.GetIndexUnderMouse(hitPositions, readOnly);
                    if (indexUnderMouse1 >= 0)
                    {
                        clickedIndex = indexUnderMouse1;
                        GUIUtility.keyboardControl = controlId;
                        current.Use();
                        return(HighLevelEvent.ContextClick);
                    }
                    break;
                }
            }
            return(HighLevelEvent.None);
        }
 public static HighLevelEvent MultiSelection(Rect rect, Rect[] positions, GUIContent content, Rect[] hitPositions, ref bool[] selections, bool[] readOnly, out int clickedIndex, out Vector2 offset, out float startSelect, out float endSelect, GUIStyle style)
 {
   int controlId = GUIUtility.GetControlID(41623453, FocusType.Keyboard);
   Event current = Event.current;
   offset = Vector2.zero;
   clickedIndex = -1;
   startSelect = endSelect = 0.0f;
   if (current.type == EventType.Used)
     return HighLevelEvent.None;
   bool flag1 = false;
   if (Event.current.type != EventType.Layout)
   {
     if (GUIUtility.keyboardControl == controlId)
       flag1 = true;
     else
       selections = new bool[selections.Length];
   }
   EventType typeForControl = current.GetTypeForControl(controlId);
   switch (typeForControl)
   {
     case EventType.MouseDown:
       if (current.button == 0)
       {
         GUIUtility.hotControl = controlId;
         GUIUtility.keyboardControl = controlId;
         EditorGUIExt.s_StartSelectPos = current.mousePosition;
         int indexUnderMouse = EditorGUIExt.GetIndexUnderMouse(hitPositions, readOnly);
         if (Event.current.clickCount == 2 && indexUnderMouse >= 0)
         {
           for (int index = 0; index < selections.Length; ++index)
             selections[index] = false;
           selections[indexUnderMouse] = true;
           current.Use();
           clickedIndex = indexUnderMouse;
           return HighLevelEvent.DoubleClick;
         }
         if (indexUnderMouse >= 0)
         {
           if (!current.shift && !EditorGUI.actionKey && !selections[indexUnderMouse])
           {
             for (int index = 0; index < hitPositions.Length; ++index)
               selections[index] = false;
           }
           selections[indexUnderMouse] = !current.shift && !EditorGUI.actionKey || !selections[indexUnderMouse];
           EditorGUIExt.s_MouseDownPos = current.mousePosition;
           EditorGUIExt.s_MultiSelectDragSelection = EditorGUIExt.DragSelectionState.None;
           current.Use();
           clickedIndex = indexUnderMouse;
           return HighLevelEvent.SelectionChanged;
         }
         bool flag2;
         if (!current.shift && !EditorGUI.actionKey)
         {
           for (int index = 0; index < hitPositions.Length; ++index)
             selections[index] = false;
           flag2 = true;
         }
         else
           flag2 = false;
         EditorGUIExt.s_SelectionBackup = new List<bool>((IEnumerable<bool>) selections);
         EditorGUIExt.s_LastFrameSelections = new List<bool>((IEnumerable<bool>) selections);
         EditorGUIExt.s_MultiSelectDragSelection = EditorGUIExt.DragSelectionState.DragSelecting;
         current.Use();
         return flag2 ? HighLevelEvent.SelectionChanged : HighLevelEvent.None;
       }
       break;
     case EventType.MouseUp:
       if (GUIUtility.hotControl == controlId)
       {
         GUIUtility.hotControl = 0;
         if (EditorGUIExt.s_StartSelectPos != current.mousePosition)
           current.Use();
         if (EditorGUIExt.s_MultiSelectDragSelection == EditorGUIExt.DragSelectionState.None)
         {
           clickedIndex = EditorGUIExt.GetIndexUnderMouse(hitPositions, readOnly);
           if (current.clickCount == 1)
             return HighLevelEvent.Click;
           break;
         }
         EditorGUIExt.s_MultiSelectDragSelection = EditorGUIExt.DragSelectionState.None;
         EditorGUIExt.s_SelectionBackup = (List<bool>) null;
         EditorGUIExt.s_LastFrameSelections = (List<bool>) null;
         return HighLevelEvent.EndDrag;
       }
       break;
     case EventType.MouseDrag:
       if (GUIUtility.hotControl == controlId)
       {
         if (EditorGUIExt.s_MultiSelectDragSelection == EditorGUIExt.DragSelectionState.DragSelecting)
         {
           float num1 = Mathf.Min(EditorGUIExt.s_StartSelectPos.x, current.mousePosition.x);
           float num2 = Mathf.Max(EditorGUIExt.s_StartSelectPos.x, current.mousePosition.x);
           EditorGUIExt.s_SelectionBackup.CopyTo(selections);
           for (int index = 0; index < hitPositions.Length; ++index)
           {
             if (!selections[index])
             {
               float num3 = hitPositions[index].x + hitPositions[index].width * 0.5f;
               if ((double) num3 >= (double) num1 && (double) num3 <= (double) num2)
                 selections[index] = true;
             }
           }
           current.Use();
           startSelect = num1;
           endSelect = num2;
           bool flag2 = false;
           for (int index = 0; index < selections.Length; ++index)
           {
             if (selections[index] != EditorGUIExt.s_LastFrameSelections[index])
             {
               flag2 = true;
               EditorGUIExt.s_LastFrameSelections[index] = selections[index];
             }
           }
           return flag2 ? HighLevelEvent.SelectionChanged : HighLevelEvent.None;
         }
         offset = current.mousePosition - EditorGUIExt.s_MouseDownPos;
         current.Use();
         if (EditorGUIExt.s_MultiSelectDragSelection != EditorGUIExt.DragSelectionState.None)
           return HighLevelEvent.Drag;
         EditorGUIExt.s_MultiSelectDragSelection = EditorGUIExt.DragSelectionState.Dragging;
         return HighLevelEvent.BeginDrag;
       }
       break;
     case EventType.KeyDown:
       if (flag1 && (current.keyCode == KeyCode.Backspace || current.keyCode == KeyCode.Delete))
       {
         current.Use();
         return HighLevelEvent.Delete;
       }
       break;
     case EventType.Repaint:
       if (GUIUtility.hotControl == controlId && EditorGUIExt.s_MultiSelectDragSelection == EditorGUIExt.DragSelectionState.DragSelecting)
       {
         float num1 = Mathf.Min(EditorGUIExt.s_StartSelectPos.x, current.mousePosition.x);
         float num2 = Mathf.Max(EditorGUIExt.s_StartSelectPos.x, current.mousePosition.x);
         Rect position = new Rect(0.0f, 0.0f, rect.width, rect.height);
         position.x = num1;
         position.width = num2 - num1;
         if ((double) position.width != 0.0)
           GUI.Box(position, string.Empty, EditorGUIExt.ms_Styles.selectionRect);
       }
       Color color = GUI.color;
       for (int index = 0; index < positions.Length; ++index)
       {
         GUI.color = readOnly == null || !readOnly[index] ? (!selections[index] ? color * new Color(0.9f, 0.9f, 0.9f, 1f) : color * new Color(0.3f, 0.55f, 0.95f, 1f)) : color * new Color(0.9f, 0.9f, 0.9f, 0.5f);
         style.Draw(positions[index], content, controlId, selections[index]);
       }
       GUI.color = color;
       break;
     default:
       switch (typeForControl - 13)
       {
         case EventType.MouseDown:
         case EventType.MouseUp:
           if (flag1)
           {
             bool flag2 = current.type == EventType.ExecuteCommand;
             string commandName = current.commandName;
             if (commandName != null)
             {
               // ISSUE: reference to a compiler-generated field
               if (EditorGUIExt.\u003C\u003Ef__switch\u0024mapE == null)
               {
                 // ISSUE: reference to a compiler-generated field
                 EditorGUIExt.\u003C\u003Ef__switch\u0024mapE = new Dictionary<string, int>(1)
                 {
                   {
                     "Delete",
                     0
                   }
                 };
               }
               int num;
               // ISSUE: reference to a compiler-generated field
               if (EditorGUIExt.\u003C\u003Ef__switch\u0024mapE.TryGetValue(commandName, out num) && num == 0)
               {
                 current.Use();
                 if (flag2)
                   return HighLevelEvent.Delete;
                 break;
               }
               break;
             }
             break;
           }
           break;
         case EventType.MouseDrag:
           int indexUnderMouse1 = EditorGUIExt.GetIndexUnderMouse(hitPositions, readOnly);
           if (indexUnderMouse1 >= 0)
           {
             clickedIndex = indexUnderMouse1;
             GUIUtility.keyboardControl = controlId;
             current.Use();
             return HighLevelEvent.ContextClick;
           }
           break;
       }
   }
   return HighLevelEvent.None;
 }