public void MouseClicked(MouseEvent evt) { if (IsActive && ((clickableRegion == null && BoundingBox.Contains(evt.CurrentLocation)) || (clickableRegion != null && clickableRegion.Contains(evt.CurrentLocation)))) { foreach (ActionListener al in actionListeners) { al.ActionPerformed(new ActionEvent(this)); } evt.Consumed = true; } }
public void MouseClicked(MouseEvent evt) { Point gridLocation = Display.RelativeViewportToGridLocation(evt.CurrentLocation); if (World.ItemToPlace != null) { World.PlaceItem(gridLocation); } HashSet <Entity> entities = World.GetEntities(gridLocation.X, gridLocation.Y); if (entities.Count > 0) { Entity entity = entities.First(); if (entity.Selectable) { if (!evt.IsShiftDown) { World.ClearSelection(); } if (evt.IsShiftDown && World.SelectedEntities.Contains(entity)) { World.DeselectEntity(entity); } else { World.SelectEntity(entity); } } else { World.ClearSelection(); } } else { World.ClearSelection(); } informationPanel.UpdateInformationPanel(); }
public void MouseReleased(MouseEvent evt) { Point gridLocation = Display.RelativeViewportToGridLocation(evt.CurrentLocation); if (evt.Button == MouseEvent.MouseButton.Right) { if (World.SelectedEntities.Count == 0) { return; } if (World.SelectedEntities.Count == 1 && World.SelectedEntityType == World.EntityType.Person) { if (World.IsClear(gridLocation.X, gridLocation.Y)) { Person person = (Person) World.SelectedEntities.First(); Dictionary <Point, Person.SearchNode> range = person.ComputeMovementRange(); if (range.ContainsKey(gridLocation)) { World.MovePerson(person, gridLocation); person.RemainingMovement -= range[gridLocation].cost; PersonAnimation.CreateMovementAnimation(person, range[gridLocation]); World.ClearSelection(); informationPanel.UpdateInformationPanel(); } } } } }
public void MousePressed(MouseEvent evt) { /* Ignore */ }
public void MouseMoved(MouseEvent evt) { Point gridLocation = Display.RelativeViewportToGridLocation(evt.CurrentLocation); if (World.ItemToPlace != null) { World.RemoveAllHighlight(); Tile.TileHighlightColor highlightColor = World.IsClear(gridLocation, World.ItemToPlace.ItemDimension) ? Tile.TileHighlightColor.Green : Tile.TileHighlightColor.Red; World.AddHighlight(gridLocation, World.ItemToPlace.ItemDimension, highlightColor); } }
public void MouseDragged(MouseEvent evt) { }
public void MouseReleased(MouseEvent evt) { /* Ignore */ }
private void ConsumeMouseEvent(MouseEvent evt) { if (consumesMouseEvent && isActive && boundingBox.Contains(evt.CurrentLocation)) { evt.Consumed = true; } }
public void MouseReleased(MouseEvent evt) { ConsumeMouseEvent(evt); }
public void MousePressed(MouseEvent evt) { ConsumeMouseEvent(evt); }
public void MouseClicked(MouseEvent evt) { ConsumeMouseEvent(evt); }