private void GridExVillage_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { var rowCount = GridExVillage.SelectedItems.Count; if (rowCount == 1) { var row = GridExVillage.CurrentRow; if (row != null && row.RowType == RowType.Record) { VillageGridExRow record = GetVillageRow(row); var contextMenu = new VillageContextMenu(World.Default.Map, record.Village, () => GridExVillage.Refresh()); contextMenu.Show(GridExVillage, e.Location); } } else if (rowCount > 1) { IEnumerable <Village> villages = GridExVillage.SelectedItems.GetRows <VillageGridExRow>().Select(x => x.Village); var contextMenu = new VillagesContextMenu(World.Default.Map, villages.ToArray(), type => GridExVillage.Refresh()); contextMenu.Show(GridExVillage, e.Location); } } }
public void ShowContext(Point p) { if (TableModel != null) { var context = new VillageContextMenu(_map, _village, () => Cells[1].Image = _village.Type.GetImage(true)); context.Show(TableModel.Table, p); } }
private void _Village_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { var cm = new VillageContextMenu(World.Default.Map, Plan.Target); cm.Show(_Village, e.Location); } else if (e.Button == MouseButtons.Left) { World.Default.Map.Manipulators.SetManipulator(ManipulatorManagerTypes.Attack); World.Default.Map.EventPublisher.AttackSelect(this, Plan); } }
private void AttackPlanFromControl_MouseClick(object sender, MouseEventArgs e) { if (Attacker.Attacker != null) { if (e.Button == MouseButtons.Right) { var cm = new VillageContextMenu(World.Default.Map, Attacker.Attacker); cm.Show(_Village, e.Location); } else if (e.Button == MouseButtons.Left) { World.Default.Map.Manipulators.SetManipulator(ManipulatorManagerTypes.Attack); World.Default.Map.EventPublisher.AttackSelect(null, Attacker); World.Default.Map.GiveFocus(); } } }