public void Move(IInputElement element, NavigationDirection direction, KeyModifiers keyModifiers = KeyModifiers.None) { switch (direction) { case NavigationDirection.Next: MoveCursorNext(); break; case NavigationDirection.Previous: MoveCursorPrevious(); break; case NavigationDirection.First: SelectedRowIndex = 0; SelectedCellIndex = 0; break; case NavigationDirection.Last: SelectedRowIndex = Rows?.Count - 1 ?? -1; SelectedCellIndex = ColumnsCount - 1; break; case NavigationDirection.Left: MoveCursorLeft(); break; case NavigationDirection.Right: MoveCursorNext(); break; case NavigationDirection.Up: MoveCursorUp(); break; case NavigationDirection.Down: MoveCursorDown(); break; case NavigationDirection.PageUp: MoveCursorUp(); break; case NavigationDirection.PageDown: MoveCursorDown(); break; default: throw new ArgumentOutOfRangeException(nameof(direction), direction, null); } MultiSelection.Clear(); MultiSelection.Add(SelectedRowIndex); }
void BuildingMode() { Tools.current = Tool.None; HandleUtility.AddDefaultControl(GUIUtility.GetControlID(FocusType.Passive)); Handles.color = Color.blue; hover = GetSelectionAt(e.mousePosition); // Draw only if (hover != null) { DrawSelection(hover, hoverFaceColor, buildOutlineColor); } if (selected != null && !selected.IsEmpty) { DrawSelection(selected, selectFaceColor, Color.clear); EditorGUI.BeginChangeCheck(); var start = CenterOfSelection(selected); var pulled = Handles.Slider(start, selected.Face * 0.5f); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Edit Mesh"); MoveBlockAction(start, pulled); } } // only during hovering if (hover != null) { // mark tile as selected when clicked if (LeftButtonClick) { if (e.shift) { var index = selected.Tiles.FindIndex(t => t == hover.Tile && selected.Face == hover.Face); if (index >= 0) { selected.Tiles.RemoveAt(index); } else { if (selected.IsEmpty || hover.Face == selected.Face) { selected.Add(hover); } else { selected.Clear(); selected.Add(hover); } } } else { selected.Clear(); selected.Add(hover); } } } else { if (LeftButtonClick) { selected.Clear(); } } Selection.activeGameObject = tiler.transform.gameObject; }
public void Clear() { RootLevelNodes.Clear(); MultiSelection.Clear(); Current = null; }