Exemplo n.º 1
0
        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);
                }
            }
        }
Exemplo n.º 2
0
 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);
     }
 }
Exemplo n.º 3
0
 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);
     }
 }
Exemplo n.º 4
0
 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();
         }
     }
 }