protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); var location = new TileLocation(e.X / _owner.TileSize, e.Y / _owner.TileSize); if (currentTileLocation == location || !location.IsValid()) { return; } var previousTileLocation = currentTileLocation; currentTileLocation = location; _owner.EditorTool.OnMouseMove(this, location, _mouseButtons, ModifierKeys); var upperTile = Level.UpperLayer[location]; var lowerTile = Level.LowerLayer[location]; if (upperTile != Tile.Floor || lowerTile != Tile.Floor) { _owner.ItemDescriptionStatusText = lowerTile == Tile.Floor ? TileUtilities.GetDescription(upperTile) : string.Format(CultureInfo.CurrentCulture, "{0} | {1}", TileUtilities.GetDescription(upperTile), TileUtilities.GetDescription(lowerTile)); } else { _owner.ItemDescriptionStatusText = string.Empty; } Invalidate(previousTileLocation.ToRectangle(_owner.TileSize)); Invalidate(location.ToRectangle(_owner.TileSize)); UpdateTileCoordinatesAndHighlights(); }
protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); _mouseButtons = e.Button; var location = new TileLocation(e.X / _owner.TileSize, e.Y / _owner.TileSize); if (!location.IsValid()) { return; } currentTileLocation = location; _owner.EditorTool.OnMouseDown(this, location, _mouseButtons, ModifierKeys); var upperTile = Level.UpperLayer[location]; var lowerTile = Level.LowerLayer[location]; if (upperTile != Tile.Floor || lowerTile != Tile.Floor) { _owner.ItemDescriptionStatusText = lowerTile == Tile.Floor ? TileUtilities.GetDescription(upperTile) : string.Format(CultureInfo.CurrentCulture, "{0} | {1}", TileUtilities.GetDescription(upperTile), TileUtilities.GetDescription(lowerTile)); } else { _owner.ItemDescriptionStatusText = string.Empty; } }