private bool Traverse(ExplorerItem item, ref int cur, bool root = false, int offset = 0, ExplorerItem test = null) { if (offset == 0 && !root) { cur += ItemHeight; _shiftSelection.Add(item.Instance); } if (cur >= _dist) { return(true); } if (item.IsExpanded) { var items = item.Items; var count = items.Count; for (int i = offset; i < count; i++) { var child = items[i]; if (child == test) { continue; } if (Traverse(child, ref cur)) { return(true); } } } var parent = item.Parent; if (parent != null) { if (parent.Parent != null && item.IsLastChild) { Traverse(parent.Parent, ref cur, true, parent.ChildIndex + 1, parent); } else { Traverse(parent, ref cur, true, item.ChildIndex + 1, parent); } } return(false); }
private void ShiftSelect(ExplorerItem item, int clickY) { if (_shiftSelection != null) { foreach (var inst in _shiftSelection) { Game.Selection.Deselect(inst, false); } } _shiftSelection = new List <Instance>(); int cur = ItemHeight; _dist = Math.Abs(clickY - _startClickY); Traverse(_startingItem, ref cur, true); foreach (var inst in _shiftSelection) { Game.Selection.Select(inst); } }
private static void GameOnInstanceAdded(Instance i) { ExplorerItem.TryCreate(i); }