62 lines
2.0 KiB
C#
62 lines
2.0 KiB
C#
using AirBomber.Generics;
|
||
using AirBomber.MovementStrategy;
|
||
using AirBomber.Rendering;
|
||
|
||
namespace AirBomber
|
||
{
|
||
public partial class FormEntityCollection : Form
|
||
{
|
||
private readonly EntitiesGenericCollection<BomberRendererBase, ObjectEntityRenderer> _entities;
|
||
|
||
|
||
public FormEntityCollection()
|
||
{
|
||
InitializeComponent();
|
||
|
||
_entities = new EntitiesGenericCollection<BomberRendererBase, ObjectEntityRenderer>(
|
||
CollectionPictureBox.Width, CollectionPictureBox.Height
|
||
);
|
||
}
|
||
|
||
public void ButtonAddEntity_Click(object sender, EventArgs e)
|
||
{
|
||
BomberForm Form = new BomberForm();
|
||
|
||
if (Form.ShowDialog() == DialogResult.OK)
|
||
{
|
||
if (_entities + Form.SelectedRenderer != -1)
|
||
{
|
||
MessageBox.Show("Объект добавлен");
|
||
CollectionPictureBox.Image = _entities.ShowEntities();
|
||
}
|
||
else
|
||
{
|
||
MessageBox.Show("Не удалось добавить объект");
|
||
}
|
||
}
|
||
}
|
||
|
||
public void ButtonRemoveEntity_Click(object sender, EventArgs e)
|
||
{
|
||
if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||
return;
|
||
|
||
int Pos = Convert.ToInt32(NumberMaskedTextBox.Text);
|
||
if (_entities - Pos == true)
|
||
{
|
||
MessageBox.Show("Объект удален");
|
||
CollectionPictureBox.Image = _entities.ShowEntities();
|
||
}
|
||
else
|
||
{
|
||
MessageBox.Show("Не удалось удалить объект");
|
||
}
|
||
}
|
||
|
||
public void ButtonRefreshCollection_Click(object sender, EventArgs e)
|
||
{
|
||
CollectionPictureBox.Image = _entities.ShowEntities();
|
||
}
|
||
}
|
||
}
|