public override void UpdateHoverElements(List <KSelectable> selected) { var now = System.DateTime.Now; if ((now - lastUpdated).TotalMilliseconds > 200) // recalculating everything every frame is unnecessary { ElementInspector.UpdateElementData(); lastUpdated = now; } DrawTextCard(); }
public override void OnMouseMove(Vector3 cursorPos) { base.OnMouseMove(cursorPos); if (!Dragging) { return; } var selectedCells = new List <int>(); Grid.PosToXY(downPos, out int x, out int y); Grid.PosToXY(cursorPos, out int x2, out int y2); if (x2 < x) { Util.Swap(ref x, ref x2); } if (y2 < y) { Util.Swap(ref y, ref y2); } for (int i = y; i <= y2; i++) { for (int j = x; j <= x2; j++) { int cell = Grid.XYToCell(j, i); if (Grid.IsValidCell(cell) && Grid.IsVisible(cell) && (Diggable.IsDiggable(cell) || Grid.IsLiquid(cell) || Grid.IsGas(cell)) /* && Grid.IsSolidCell(cell)*/) { selectedCells.Add(cell); } } } ElementInspector.UpdateElementData(selectedCells); }
public override void OnLeftClickDown(Vector3 cursor_pos) { base.OnLeftClickDown(cursor_pos); ElementInspector.UpdateElementData(new[] { Grid.PosToCell(cursor_pos) }); }