complete
This commit is contained in:
parent
999f216dc3
commit
0d6c8d7caf
@ -39,15 +39,15 @@ namespace Stormtrooper
|
||||
/// <summary>
|
||||
/// Инициализация свойств
|
||||
/// </summary>
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="Super">Скорость</param>
|
||||
/// <param name="weight">Вес автомобиля</param>
|
||||
/// <param name="bodyColor">Цвет кузова</param>
|
||||
public DrawningStormtrooper(int speed, float weight, Color bodyColor)
|
||||
public DrawningStormtrooper(int Super, float weight, Color bodyColor)
|
||||
{
|
||||
Stormtrooper = new EntityStormtrooper(speed, weight, bodyColor);
|
||||
Stormtrooper = new EntityStormtrooper(Super, weight, bodyColor);
|
||||
}
|
||||
protected DrawningStormtrooper(int speed, float weight, Color bodyColor, int StormtrooperWidth, int StormtrooperHeight) :
|
||||
this(speed, weight, bodyColor)
|
||||
protected DrawningStormtrooper(int Super, float weight, Color bodyColor, int StormtrooperWidth, int StormtrooperHeight) :
|
||||
this(Super, weight, bodyColor)
|
||||
{
|
||||
_stormtrooperWidth = StormtrooperWidth;
|
||||
_stormtrooperHeight = StormtrooperHeight;
|
||||
|
@ -8,9 +8,9 @@ namespace Stormtrooper
|
||||
{
|
||||
internal class DrawningSuperStormtrooper : DrawningStormtrooper
|
||||
{
|
||||
public DrawningSuperStormtrooper(int speed, float weight, Color bodyColor, Color dopColor, bool bombs, bool rockets, bool sportLine) : base(speed, weight, bodyColor, 90, 120)
|
||||
public DrawningSuperStormtrooper(int Super, float weight, Color bodyColor, Color dopColor, bool bombs, bool rockets, bool sportLine) : base(Super, weight, bodyColor, 90, 120)
|
||||
{
|
||||
Stormtrooper = new EntitySuperStormtrooper(speed, weight, bodyColor, dopColor, bombs, rockets, sportLine);
|
||||
Stormtrooper = new EntitySuperStormtrooper(Super, weight, bodyColor, dopColor, bombs, rockets, sportLine);
|
||||
}
|
||||
public override void DrawTransport(Graphics g)
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ namespace Stormtrooper
|
||||
{
|
||||
public class EntityStormtrooper
|
||||
{
|
||||
public int Speed { get; private set; }
|
||||
public int Super { get; private set; }
|
||||
/// <summary>
|
||||
/// Вес
|
||||
/// </summary>
|
||||
@ -16,22 +16,22 @@ namespace Stormtrooper
|
||||
/// <summary>
|
||||
/// Цвет кузова
|
||||
/// </summary>
|
||||
public Color BodyColor { get; private set; }
|
||||
public Color BodyColor { get; set; }
|
||||
/// <summary>
|
||||
/// Шаг перемещения автомобиля
|
||||
/// </summary>
|
||||
public float Step => Speed * 100 / Weight;
|
||||
public float Step => Super * 100 / Weight;
|
||||
/// <summary>
|
||||
/// Инициализация полей объекта-класса автомобиля
|
||||
/// </summary>
|
||||
/// <param name="speed"></param>
|
||||
/// <param name="Super"></param>
|
||||
/// <param name="weight"></param>
|
||||
/// <param name="bodyColor"></param>
|
||||
/// <returns></returns>
|
||||
public EntityStormtrooper(int speed, float weight, Color bodyColor)
|
||||
public EntityStormtrooper(int Super, float weight, Color bodyColor)
|
||||
{
|
||||
Random rnd = new();
|
||||
Speed = speed <= 0 ? rnd.Next(5, 30) : speed;
|
||||
Super = Super <= 0 ? rnd.Next(5, 30) : Super;
|
||||
Weight = weight <= 0 ? rnd.Next(30, 100) : weight;
|
||||
BodyColor = bodyColor;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ namespace Stormtrooper
|
||||
{
|
||||
internal class EntitySuperStormtrooper : EntityStormtrooper
|
||||
{
|
||||
public Color DopColor { get; private set; }
|
||||
public Color DopColor { get; set; }
|
||||
/// <summary>
|
||||
/// Признак наличия обвеса
|
||||
/// </summary>
|
||||
@ -24,7 +24,7 @@ namespace Stormtrooper
|
||||
/// <summary>
|
||||
/// Инициализация свойств
|
||||
/// </summary>
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="Super">Скорость</param>
|
||||
/// <param name="weight">Вес автомобиля</param>
|
||||
/// <param name="bodyColor">Цвет кузова</param>
|
||||
/// <param name="dopColor">Дополнительный цвет</param>
|
||||
@ -32,8 +32,8 @@ namespace Stormtrooper
|
||||
/// <param name="rockets">Признак наличия рокет</param>
|
||||
/// <param name="sportLine">Признак наличия гоночной полосы</param>
|
||||
|
||||
public EntitySuperStormtrooper(int speed, float weight, Color bodyColor, Color dopColor, bool bombs, bool rockets, bool sportLine) :
|
||||
base(speed, weight, bodyColor)
|
||||
public EntitySuperStormtrooper(int Super, float weight, Color bodyColor, Color dopColor, bool bombs, bool rockets, bool sportLine) :
|
||||
base(Super, weight, bodyColor)
|
||||
{
|
||||
DopColor = dopColor;
|
||||
Bombs = bombs;
|
||||
|
@ -28,209 +28,229 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMapWithSetStormtroopers));
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.groupBoxMaps = new System.Windows.Forms.GroupBox();
|
||||
this.listBoxMaps = new System.Windows.Forms.ListBox();
|
||||
this.groupBoxTools = new System.Windows.Forms.GroupBox();
|
||||
this.groupBoxMap = new System.Windows.Forms.GroupBox();
|
||||
this.buttonDeleteMap = new System.Windows.Forms.Button();
|
||||
this.listBoxMaps = new System.Windows.Forms.ListBox();
|
||||
this.buttonAddMap = new System.Windows.Forms.Button();
|
||||
this.textBoxNewMap = new System.Windows.Forms.TextBox();
|
||||
this.textBoxNewMapName = new System.Windows.Forms.TextBox();
|
||||
this.comboBoxSelectorMap = new System.Windows.Forms.ComboBox();
|
||||
this.buttonShowOnMap = new System.Windows.Forms.Button();
|
||||
this.buttonShowStorage = new System.Windows.Forms.Button();
|
||||
this.buttonRemoveStormtrooper = new System.Windows.Forms.Button();
|
||||
this.maskedTextBoxPosition = new System.Windows.Forms.MaskedTextBox();
|
||||
this.buttonAddStormtrooper = new System.Windows.Forms.Button();
|
||||
this.buttonRemoveStormtrooper = new System.Windows.Forms.Button();
|
||||
this.buttonShowStorage = new System.Windows.Forms.Button();
|
||||
this.buttonDown = new System.Windows.Forms.Button();
|
||||
this.buttonRight = new System.Windows.Forms.Button();
|
||||
this.buttonLeft = new System.Windows.Forms.Button();
|
||||
this.buttonUp = new System.Windows.Forms.Button();
|
||||
this.buttonShowOnMap = new System.Windows.Forms.Button();
|
||||
this.buttonAddStormtrooper = new System.Windows.Forms.Button();
|
||||
this.pictureBox = new System.Windows.Forms.PictureBox();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBoxMaps.SuspendLayout();
|
||||
this.groupBoxTools.SuspendLayout();
|
||||
this.groupBoxMap.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// groupBox1
|
||||
// groupBoxTools
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.groupBoxMaps);
|
||||
this.groupBox1.Controls.Add(this.buttonShowOnMap);
|
||||
this.groupBox1.Controls.Add(this.buttonShowStorage);
|
||||
this.groupBox1.Controls.Add(this.buttonRemoveStormtrooper);
|
||||
this.groupBox1.Controls.Add(this.maskedTextBoxPosition);
|
||||
this.groupBox1.Controls.Add(this.buttonAddStormtrooper);
|
||||
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.groupBox1.Location = new System.Drawing.Point(637, 0);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(250, 583);
|
||||
this.groupBox1.TabIndex = 0;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Инструменты";
|
||||
this.groupBoxTools.Controls.Add(this.groupBoxMap);
|
||||
this.groupBoxTools.Controls.Add(this.maskedTextBoxPosition);
|
||||
this.groupBoxTools.Controls.Add(this.buttonRemoveStormtrooper);
|
||||
this.groupBoxTools.Controls.Add(this.buttonShowStorage);
|
||||
this.groupBoxTools.Controls.Add(this.buttonDown);
|
||||
this.groupBoxTools.Controls.Add(this.buttonRight);
|
||||
this.groupBoxTools.Controls.Add(this.buttonLeft);
|
||||
this.groupBoxTools.Controls.Add(this.buttonUp);
|
||||
this.groupBoxTools.Controls.Add(this.buttonShowOnMap);
|
||||
this.groupBoxTools.Controls.Add(this.buttonAddStormtrooper);
|
||||
this.groupBoxTools.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.groupBoxTools.Location = new System.Drawing.Point(789, 0);
|
||||
this.groupBoxTools.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.groupBoxTools.Name = "groupBoxTools";
|
||||
this.groupBoxTools.Padding = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.groupBoxTools.Size = new System.Drawing.Size(233, 783);
|
||||
this.groupBoxTools.TabIndex = 0;
|
||||
this.groupBoxTools.TabStop = false;
|
||||
this.groupBoxTools.Text = "Инструменты";
|
||||
//
|
||||
// groupBoxMaps
|
||||
// groupBoxMap
|
||||
//
|
||||
this.groupBoxMaps.Controls.Add(this.listBoxMaps);
|
||||
this.groupBoxMaps.Controls.Add(this.buttonDeleteMap);
|
||||
this.groupBoxMaps.Controls.Add(this.buttonAddMap);
|
||||
this.groupBoxMaps.Controls.Add(this.textBoxNewMap);
|
||||
this.groupBoxMaps.Controls.Add(this.comboBoxSelectorMap);
|
||||
this.groupBoxMaps.Location = new System.Drawing.Point(23, 26);
|
||||
this.groupBoxMaps.Name = "groupBoxMaps";
|
||||
this.groupBoxMaps.Size = new System.Drawing.Size(203, 290);
|
||||
this.groupBoxMaps.TabIndex = 0;
|
||||
this.groupBoxMaps.TabStop = false;
|
||||
this.groupBoxMaps.Text = "Карты";
|
||||
this.groupBoxMap.Controls.Add(this.buttonDeleteMap);
|
||||
this.groupBoxMap.Controls.Add(this.listBoxMaps);
|
||||
this.groupBoxMap.Controls.Add(this.buttonAddMap);
|
||||
this.groupBoxMap.Controls.Add(this.textBoxNewMapName);
|
||||
this.groupBoxMap.Controls.Add(this.comboBoxSelectorMap);
|
||||
this.groupBoxMap.Location = new System.Drawing.Point(19, 29);
|
||||
this.groupBoxMap.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.groupBoxMap.Name = "groupBoxMap";
|
||||
this.groupBoxMap.Padding = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.groupBoxMap.Size = new System.Drawing.Size(200, 315);
|
||||
this.groupBoxMap.TabIndex = 11;
|
||||
this.groupBoxMap.TabStop = false;
|
||||
this.groupBoxMap.Text = "Карты";
|
||||
//
|
||||
// buttonDeleteMap
|
||||
//
|
||||
this.buttonDeleteMap.Location = new System.Drawing.Point(7, 261);
|
||||
this.buttonDeleteMap.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.buttonDeleteMap.Name = "buttonDeleteMap";
|
||||
this.buttonDeleteMap.Size = new System.Drawing.Size(186, 41);
|
||||
this.buttonDeleteMap.TabIndex = 4;
|
||||
this.buttonDeleteMap.Text = "Удалить карту";
|
||||
this.buttonDeleteMap.UseVisualStyleBackColor = true;
|
||||
this.buttonDeleteMap.Click += new System.EventHandler(this.buttonDeleteMap_Click);
|
||||
//
|
||||
// listBoxMaps
|
||||
//
|
||||
this.listBoxMaps.FormattingEnabled = true;
|
||||
this.listBoxMaps.ItemHeight = 20;
|
||||
this.listBoxMaps.Location = new System.Drawing.Point(19, 128);
|
||||
this.listBoxMaps.Location = new System.Drawing.Point(7, 148);
|
||||
this.listBoxMaps.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.listBoxMaps.Name = "listBoxMaps";
|
||||
this.listBoxMaps.Size = new System.Drawing.Size(178, 104);
|
||||
this.listBoxMaps.TabIndex = 4;
|
||||
this.listBoxMaps.Size = new System.Drawing.Size(186, 104);
|
||||
this.listBoxMaps.TabIndex = 3;
|
||||
this.listBoxMaps.SelectedIndexChanged += new System.EventHandler(this.listBoxMaps_SelectedIndexChanged);
|
||||
//
|
||||
// buttonDeleteMap
|
||||
//
|
||||
this.buttonDeleteMap.Location = new System.Drawing.Point(18, 238);
|
||||
this.buttonDeleteMap.Name = "buttonDeleteMap";
|
||||
this.buttonDeleteMap.Size = new System.Drawing.Size(179, 29);
|
||||
this.buttonDeleteMap.TabIndex = 3;
|
||||
this.buttonDeleteMap.Text = "Удалить карту";
|
||||
this.buttonDeleteMap.UseVisualStyleBackColor = true;
|
||||
this.buttonDeleteMap.Click += new System.EventHandler(this.buttonDeleteMap_Click);
|
||||
//
|
||||
// buttonAddMap
|
||||
//
|
||||
this.buttonAddMap.Location = new System.Drawing.Point(18, 93);
|
||||
this.buttonAddMap.Location = new System.Drawing.Point(7, 104);
|
||||
this.buttonAddMap.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.buttonAddMap.Name = "buttonAddMap";
|
||||
this.buttonAddMap.Size = new System.Drawing.Size(179, 29);
|
||||
this.buttonAddMap.Size = new System.Drawing.Size(186, 36);
|
||||
this.buttonAddMap.TabIndex = 2;
|
||||
this.buttonAddMap.Text = "Добавить карту";
|
||||
this.buttonAddMap.UseVisualStyleBackColor = true;
|
||||
this.buttonAddMap.Click += new System.EventHandler(this.buttonAddMap_Click);
|
||||
//
|
||||
// textBoxNewMap
|
||||
// textBoxNewMapName
|
||||
//
|
||||
this.textBoxNewMap.Location = new System.Drawing.Point(18, 26);
|
||||
this.textBoxNewMap.Name = "textBoxNewMap";
|
||||
this.textBoxNewMap.Size = new System.Drawing.Size(179, 27);
|
||||
this.textBoxNewMap.TabIndex = 1;
|
||||
this.textBoxNewMapName.Location = new System.Drawing.Point(7, 27);
|
||||
this.textBoxNewMapName.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.textBoxNewMapName.Name = "textBoxNewMapName";
|
||||
this.textBoxNewMapName.Size = new System.Drawing.Size(186, 27);
|
||||
this.textBoxNewMapName.TabIndex = 1;
|
||||
//
|
||||
// comboBoxSelectorMap
|
||||
//
|
||||
this.comboBoxSelectorMap.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxSelectorMap.FormattingEnabled = true;
|
||||
this.comboBoxSelectorMap.Location = new System.Drawing.Point(18, 59);
|
||||
this.comboBoxSelectorMap.Items.AddRange(new object[] {
|
||||
"Простая карта",
|
||||
"Собственная карта"});
|
||||
this.comboBoxSelectorMap.Location = new System.Drawing.Point(7, 65);
|
||||
this.comboBoxSelectorMap.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.comboBoxSelectorMap.Name = "comboBoxSelectorMap";
|
||||
this.comboBoxSelectorMap.Size = new System.Drawing.Size(179, 28);
|
||||
this.comboBoxSelectorMap.Size = new System.Drawing.Size(186, 28);
|
||||
this.comboBoxSelectorMap.TabIndex = 0;
|
||||
this.comboBoxSelectorMap.SelectedIndexChanged += new System.EventHandler(this.comboBoxSelector_SelectedIndexChanged);
|
||||
//
|
||||
// buttonShowOnMap
|
||||
// maskedTextBoxPosition
|
||||
//
|
||||
this.buttonShowOnMap.Location = new System.Drawing.Point(41, 517);
|
||||
this.buttonShowOnMap.Name = "buttonShowOnMap";
|
||||
this.buttonShowOnMap.Size = new System.Drawing.Size(185, 29);
|
||||
this.buttonShowOnMap.TabIndex = 5;
|
||||
this.buttonShowOnMap.Text = "Посмотреть карту";
|
||||
this.buttonShowOnMap.UseVisualStyleBackColor = true;
|
||||
this.buttonShowOnMap.Click += new System.EventHandler(this.ButtonShowOnMap_Click);
|
||||
//
|
||||
// buttonShowStorage
|
||||
//
|
||||
this.buttonShowStorage.Location = new System.Drawing.Point(41, 482);
|
||||
this.buttonShowStorage.Name = "buttonShowStorage";
|
||||
this.buttonShowStorage.Size = new System.Drawing.Size(185, 29);
|
||||
this.buttonShowStorage.TabIndex = 4;
|
||||
this.buttonShowStorage.Text = "Посмотреть хранилище";
|
||||
this.buttonShowStorage.UseVisualStyleBackColor = true;
|
||||
this.buttonShowStorage.Click += new System.EventHandler(this.ButtonShowStorage_Click);
|
||||
this.maskedTextBoxPosition.Location = new System.Drawing.Point(19, 447);
|
||||
this.maskedTextBoxPosition.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.maskedTextBoxPosition.Mask = "00";
|
||||
this.maskedTextBoxPosition.Name = "maskedTextBoxPosition";
|
||||
this.maskedTextBoxPosition.Size = new System.Drawing.Size(199, 27);
|
||||
this.maskedTextBoxPosition.TabIndex = 2;
|
||||
this.maskedTextBoxPosition.ValidatingType = typeof(int);
|
||||
//
|
||||
// buttonRemoveStormtrooper
|
||||
//
|
||||
this.buttonRemoveStormtrooper.Location = new System.Drawing.Point(41, 447);
|
||||
this.buttonRemoveStormtrooper.Location = new System.Drawing.Point(19, 485);
|
||||
this.buttonRemoveStormtrooper.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.buttonRemoveStormtrooper.Name = "buttonRemoveStormtrooper";
|
||||
this.buttonRemoveStormtrooper.Size = new System.Drawing.Size(185, 29);
|
||||
this.buttonRemoveStormtrooper.Size = new System.Drawing.Size(200, 47);
|
||||
this.buttonRemoveStormtrooper.TabIndex = 3;
|
||||
this.buttonRemoveStormtrooper.Text = "Удалить";
|
||||
this.buttonRemoveStormtrooper.UseVisualStyleBackColor = true;
|
||||
this.buttonRemoveStormtrooper.Click += new System.EventHandler(this.ButtonRemoveStormtrooper_Click);
|
||||
//
|
||||
// maskedTextBoxPosition
|
||||
// buttonShowStorage
|
||||
//
|
||||
this.maskedTextBoxPosition.Location = new System.Drawing.Point(41, 414);
|
||||
this.maskedTextBoxPosition.Mask = "00";
|
||||
this.maskedTextBoxPosition.Name = "maskedTextBoxPosition";
|
||||
this.maskedTextBoxPosition.Size = new System.Drawing.Size(185, 27);
|
||||
this.maskedTextBoxPosition.TabIndex = 2;
|
||||
this.maskedTextBoxPosition.ValidatingType = typeof(int);
|
||||
//
|
||||
// buttonAddStormtrooper
|
||||
//
|
||||
this.buttonAddStormtrooper.Location = new System.Drawing.Point(41, 379);
|
||||
this.buttonAddStormtrooper.Name = "buttonAddStormtrooper";
|
||||
this.buttonAddStormtrooper.Size = new System.Drawing.Size(185, 29);
|
||||
this.buttonAddStormtrooper.TabIndex = 1;
|
||||
this.buttonAddStormtrooper.Text = "Добавить";
|
||||
this.buttonAddStormtrooper.UseVisualStyleBackColor = true;
|
||||
this.buttonAddStormtrooper.Click += new System.EventHandler(this.ButtonAddStormtrooper_Click);
|
||||
this.buttonShowStorage.Location = new System.Drawing.Point(19, 540);
|
||||
this.buttonShowStorage.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.buttonShowStorage.Name = "buttonShowStorage";
|
||||
this.buttonShowStorage.Size = new System.Drawing.Size(200, 47);
|
||||
this.buttonShowStorage.TabIndex = 4;
|
||||
this.buttonShowStorage.Text = "Посмотреть хранилище";
|
||||
this.buttonShowStorage.UseVisualStyleBackColor = true;
|
||||
this.buttonShowStorage.Click += new System.EventHandler(this.ButtonShowStorage_Click);
|
||||
//
|
||||
// buttonDown
|
||||
//
|
||||
this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonDown.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonDown.BackgroundImage")));
|
||||
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.buttonDown.Location = new System.Drawing.Point(552, 541);
|
||||
this.buttonDown.Location = new System.Drawing.Point(104, 716);
|
||||
this.buttonDown.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.buttonDown.Name = "buttonDown";
|
||||
this.buttonDown.Size = new System.Drawing.Size(30, 30);
|
||||
this.buttonDown.TabIndex = 8;
|
||||
this.buttonDown.Size = new System.Drawing.Size(34, 40);
|
||||
this.buttonDown.TabIndex = 10;
|
||||
this.buttonDown.UseVisualStyleBackColor = true;
|
||||
this.buttonDown.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||
//
|
||||
// buttonRight
|
||||
//
|
||||
this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonRight.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonRight.BackgroundImage")));
|
||||
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.buttonRight.Location = new System.Drawing.Point(588, 541);
|
||||
this.buttonRight.Location = new System.Drawing.Point(145, 716);
|
||||
this.buttonRight.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.buttonRight.Name = "buttonRight";
|
||||
this.buttonRight.Size = new System.Drawing.Size(30, 30);
|
||||
this.buttonRight.TabIndex = 10;
|
||||
this.buttonRight.Size = new System.Drawing.Size(34, 40);
|
||||
this.buttonRight.TabIndex = 9;
|
||||
this.buttonRight.UseVisualStyleBackColor = true;
|
||||
this.buttonRight.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||
//
|
||||
// buttonLeft
|
||||
//
|
||||
this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonLeft.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonLeft.BackgroundImage")));
|
||||
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.buttonLeft.Location = new System.Drawing.Point(516, 542);
|
||||
this.buttonLeft.Location = new System.Drawing.Point(63, 716);
|
||||
this.buttonLeft.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.buttonLeft.Name = "buttonLeft";
|
||||
this.buttonLeft.Size = new System.Drawing.Size(30, 30);
|
||||
this.buttonLeft.TabIndex = 9;
|
||||
this.buttonLeft.Size = new System.Drawing.Size(34, 40);
|
||||
this.buttonLeft.TabIndex = 8;
|
||||
this.buttonLeft.UseVisualStyleBackColor = true;
|
||||
this.buttonLeft.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||
//
|
||||
// buttonUp
|
||||
//
|
||||
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonUp.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonUp.BackgroundImage")));
|
||||
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.buttonUp.Location = new System.Drawing.Point(552, 505);
|
||||
this.buttonUp.Location = new System.Drawing.Point(104, 668);
|
||||
this.buttonUp.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.buttonUp.Name = "buttonUp";
|
||||
this.buttonUp.Size = new System.Drawing.Size(30, 30);
|
||||
this.buttonUp.Size = new System.Drawing.Size(34, 40);
|
||||
this.buttonUp.TabIndex = 7;
|
||||
this.buttonUp.UseVisualStyleBackColor = true;
|
||||
this.buttonUp.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||
//
|
||||
// buttonShowOnMap
|
||||
//
|
||||
this.buttonShowOnMap.Location = new System.Drawing.Point(19, 595);
|
||||
this.buttonShowOnMap.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.buttonShowOnMap.Name = "buttonShowOnMap";
|
||||
this.buttonShowOnMap.Size = new System.Drawing.Size(200, 47);
|
||||
this.buttonShowOnMap.TabIndex = 5;
|
||||
this.buttonShowOnMap.Text = "Посмотреть карту";
|
||||
this.buttonShowOnMap.UseVisualStyleBackColor = true;
|
||||
this.buttonShowOnMap.Click += new System.EventHandler(this.ButtonShowOnMap_Click);
|
||||
//
|
||||
// buttonAddStormtrooper
|
||||
//
|
||||
this.buttonAddStormtrooper.Location = new System.Drawing.Point(19, 392);
|
||||
this.buttonAddStormtrooper.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.buttonAddStormtrooper.Name = "buttonAddStormtrooper";
|
||||
this.buttonAddStormtrooper.Size = new System.Drawing.Size(200, 47);
|
||||
this.buttonAddStormtrooper.TabIndex = 1;
|
||||
this.buttonAddStormtrooper.Text = "Добавить";
|
||||
this.buttonAddStormtrooper.UseVisualStyleBackColor = true;
|
||||
this.buttonAddStormtrooper.Click += new System.EventHandler(this.ButtonAddStormtrooper_Click);
|
||||
//
|
||||
// pictureBox
|
||||
//
|
||||
this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.pictureBox.Location = new System.Drawing.Point(0, 0);
|
||||
this.pictureBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.pictureBox.Name = "pictureBox";
|
||||
this.pictureBox.Size = new System.Drawing.Size(637, 583);
|
||||
this.pictureBox.Size = new System.Drawing.Size(789, 783);
|
||||
this.pictureBox.TabIndex = 1;
|
||||
this.pictureBox.TabStop = false;
|
||||
//
|
||||
@ -238,19 +258,16 @@
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(887, 583);
|
||||
this.Controls.Add(this.buttonRight);
|
||||
this.Controls.Add(this.buttonLeft);
|
||||
this.Controls.Add(this.buttonDown);
|
||||
this.Controls.Add(this.buttonUp);
|
||||
this.ClientSize = new System.Drawing.Size(1022, 783);
|
||||
this.Controls.Add(this.pictureBox);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.groupBoxTools);
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.Name = "FormMapWithSetStormtroopers";
|
||||
this.Text = "FormMapWithSetStormtroopers";
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.groupBoxMaps.ResumeLayout(false);
|
||||
this.groupBoxMaps.PerformLayout();
|
||||
this.Text = "Карта с набором объектов";
|
||||
this.groupBoxTools.ResumeLayout(false);
|
||||
this.groupBoxTools.PerformLayout();
|
||||
this.groupBoxMap.ResumeLayout(false);
|
||||
this.groupBoxMap.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
@ -258,22 +275,22 @@
|
||||
|
||||
#endregion
|
||||
|
||||
private GroupBox groupBox1;
|
||||
private GroupBox groupBoxTools;
|
||||
private PictureBox pictureBox;
|
||||
private ComboBox comboBoxSelectorMap;
|
||||
private Button buttonShowOnMap;
|
||||
private Button buttonAddStormtrooper;
|
||||
private Button buttonDown;
|
||||
private Button buttonRight;
|
||||
private Button buttonLeft;
|
||||
private Button buttonUp;
|
||||
private Button buttonShowStorage;
|
||||
private Button buttonRemoveStormtrooper;
|
||||
private MaskedTextBox maskedTextBoxPosition;
|
||||
private Button buttonAddStormtrooper;
|
||||
private PictureBox pictureBox;
|
||||
private Button buttonRight;
|
||||
private Button buttonLeft;
|
||||
private Button buttonDown;
|
||||
private Button buttonUp;
|
||||
private GroupBox groupBoxMaps;
|
||||
private ListBox listBoxMaps;
|
||||
private GroupBox groupBoxMap;
|
||||
private Button buttonDeleteMap;
|
||||
private ListBox listBoxMaps;
|
||||
private Button buttonAddMap;
|
||||
private TextBox textBoxNewMap;
|
||||
private ComboBox comboBoxSelectorMap;
|
||||
private TextBox textBoxNewMapName;
|
||||
}
|
||||
}
|
@ -67,24 +67,27 @@ namespace Stormtrooper
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonAddStormtrooper_Click(object sender, EventArgs e)
|
||||
{
|
||||
var formStormtrooperConfig = new FormStormtrooperConfig();
|
||||
formStormtrooperConfig.AddEvent(AddStormtrooper);
|
||||
formStormtrooperConfig.Show();
|
||||
}
|
||||
|
||||
private void AddStormtrooper(DrawningStormtrooper drawingStormtroopers)
|
||||
{
|
||||
if (listBoxMaps.SelectedIndex == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
FormStormtrooper form = new();
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
DrawningObjectStormtrooper stormtrooper = new DrawningObjectStormtrooper(drawingStormtroopers);
|
||||
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + stormtrooper != -1)
|
||||
{
|
||||
DrawningObjectStormtrooper stormtrooper = new(form.SelectedStormtrooper);
|
||||
if (_mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty] + stormtrooper != -1)
|
||||
{
|
||||
MessageBox.Show("Объект добавлен");
|
||||
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось добавить объект");
|
||||
}
|
||||
MessageBox.Show("Object added");
|
||||
pictureBox.Image = _mapsCollection[listBoxMaps.SelectedItem?.ToString() ?? string.Empty].ShowSet();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Cant add object");
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
@ -179,7 +182,7 @@ namespace Stormtrooper
|
||||
|
||||
private void buttonAddMap_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (comboBoxSelectorMap.SelectedIndex == -1 || string.IsNullOrEmpty(textBoxNewMap.Text))
|
||||
if (comboBoxSelectorMap.SelectedIndex == -1 || string.IsNullOrEmpty(textBoxNewMapName.Text))
|
||||
{
|
||||
MessageBox.Show("Не все данные заполнены", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
@ -189,7 +192,7 @@ namespace Stormtrooper
|
||||
MessageBox.Show("Нет такой карты", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_mapsCollection.AddMap(textBoxNewMap.Text, _mapsDict[comboBoxSelectorMap.Text]);
|
||||
_mapsCollection.AddMap(textBoxNewMapName.Text, _mapsDict[comboBoxSelectorMap.Text]);
|
||||
ReloadMaps();
|
||||
}
|
||||
|
||||
@ -210,12 +213,5 @@ namespace Stormtrooper
|
||||
ReloadMaps();
|
||||
}
|
||||
}
|
||||
|
||||
private void comboBoxSelector_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -31,7 +31,7 @@
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormStormtrooper));
|
||||
this.pictureBoxStormtrooper = new System.Windows.Forms.PictureBox();
|
||||
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
|
||||
this.toolStripStatusLabelSpeed = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.toolStripStatusLabelSuper = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.toolStripStatusLabelWeight = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.toolStripStatusLabelBodyColor = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.buttonCreate = new System.Windows.Forms.Button();
|
||||
@ -60,7 +60,7 @@
|
||||
//
|
||||
this.statusStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.toolStripStatusLabelSpeed,
|
||||
this.toolStripStatusLabelSuper,
|
||||
this.toolStripStatusLabelWeight,
|
||||
this.toolStripStatusLabelBodyColor});
|
||||
this.statusStrip1.Location = new System.Drawing.Point(0, 424);
|
||||
@ -69,11 +69,11 @@
|
||||
this.statusStrip1.TabIndex = 1;
|
||||
this.statusStrip1.Text = "statusStrip1";
|
||||
//
|
||||
// toolStripStatusLabelSpeed
|
||||
// toolStripStatusLabelSuper
|
||||
//
|
||||
this.toolStripStatusLabelSpeed.Name = "toolStripStatusLabelSpeed";
|
||||
this.toolStripStatusLabelSpeed.Size = new System.Drawing.Size(76, 20);
|
||||
this.toolStripStatusLabelSpeed.Text = "Скорость:";
|
||||
this.toolStripStatusLabelSuper.Name = "toolStripStatusLabelSuper";
|
||||
this.toolStripStatusLabelSuper.Size = new System.Drawing.Size(76, 20);
|
||||
this.toolStripStatusLabelSuper.Text = "Скорость:";
|
||||
//
|
||||
// toolStripStatusLabelWeight
|
||||
//
|
||||
@ -195,7 +195,7 @@
|
||||
|
||||
private PictureBox pictureBoxStormtrooper;
|
||||
private StatusStrip statusStrip1;
|
||||
private ToolStripStatusLabel toolStripStatusLabelSpeed;
|
||||
private ToolStripStatusLabel toolStripStatusLabelSuper;
|
||||
private ToolStripStatusLabel toolStripStatusLabelWeight;
|
||||
private ToolStripStatusLabel toolStripStatusLabelBodyColor;
|
||||
private Button buttonCreate;
|
||||
|
@ -22,7 +22,7 @@ namespace Stormtrooper
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void ToolStripStatusLabelSpeed_Click(object sender, EventArgs e)
|
||||
private void ToolStripStatusLabelSuper_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
@ -38,7 +38,7 @@ namespace Stormtrooper
|
||||
{
|
||||
Random rnd = new Random();
|
||||
_stormtrooper.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), pictureBoxStormtrooper.Width, pictureBoxStormtrooper.Height);
|
||||
toolStripStatusLabelSpeed.Text = $"Ñêîðîñòü: {_stormtrooper.Stormtrooper.Speed}";
|
||||
toolStripStatusLabelSuper.Text = $"Ñêîðîñòü: {_stormtrooper.Stormtrooper.Super}";
|
||||
toolStripStatusLabelWeight.Text = $"Âåñ: {_stormtrooper.Stormtrooper.Weight}";
|
||||
toolStripStatusLabelBodyColor.Text = $"Öâåò: {_stormtrooper.Stormtrooper.BodyColor.Name}";
|
||||
}
|
||||
|
420
Stormtrooper/Stormtrooper/FormStormtrooperConfig.Designer.cs
generated
Normal file
420
Stormtrooper/Stormtrooper/FormStormtrooperConfig.Designer.cs
generated
Normal file
@ -0,0 +1,420 @@
|
||||
namespace Stormtrooper
|
||||
{
|
||||
partial class FormStormtrooperConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.groupBoxConfig = new System.Windows.Forms.GroupBox();
|
||||
this.labelSpeed = new System.Windows.Forms.Label();
|
||||
this.labelModifiedObject = new System.Windows.Forms.Label();
|
||||
this.labelSimpleObject = new System.Windows.Forms.Label();
|
||||
this.groupBoxColors = new System.Windows.Forms.GroupBox();
|
||||
this.panelPurple = new System.Windows.Forms.Panel();
|
||||
this.panelYellow = new System.Windows.Forms.Panel();
|
||||
this.panelBlack = new System.Windows.Forms.Panel();
|
||||
this.panelBlue = new System.Windows.Forms.Panel();
|
||||
this.panelGray = new System.Windows.Forms.Panel();
|
||||
this.panelGreen = new System.Windows.Forms.Panel();
|
||||
this.panelWhite = new System.Windows.Forms.Panel();
|
||||
this.panelRed = new System.Windows.Forms.Panel();
|
||||
this.checkBoxWing = new System.Windows.Forms.CheckBox();
|
||||
this.checkBoxBodyKit = new System.Windows.Forms.CheckBox();
|
||||
this.numericUpDownWeight = new System.Windows.Forms.NumericUpDown();
|
||||
this.labelWeight = new System.Windows.Forms.Label();
|
||||
this.numericUpDownSpeed = new System.Windows.Forms.NumericUpDown();
|
||||
this.labelSuper = new System.Windows.Forms.Label();
|
||||
this.panelObject = new System.Windows.Forms.Panel();
|
||||
this.labelDopColor = new System.Windows.Forms.Label();
|
||||
this.labelBaseColor = new System.Windows.Forms.Label();
|
||||
this.pictureBoxObject = new System.Windows.Forms.PictureBox();
|
||||
this.buttonCancel = new System.Windows.Forms.Button();
|
||||
this.buttonOk = new System.Windows.Forms.Button();
|
||||
this.groupBoxConfig.SuspendLayout();
|
||||
this.groupBoxColors.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).BeginInit();
|
||||
this.panelObject.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// groupBoxConfig
|
||||
//
|
||||
this.groupBoxConfig.Controls.Add(this.labelSpeed);
|
||||
this.groupBoxConfig.Controls.Add(this.labelModifiedObject);
|
||||
this.groupBoxConfig.Controls.Add(this.labelSimpleObject);
|
||||
this.groupBoxConfig.Controls.Add(this.groupBoxColors);
|
||||
this.groupBoxConfig.Controls.Add(this.checkBoxWing);
|
||||
this.groupBoxConfig.Controls.Add(this.checkBoxBodyKit);
|
||||
this.groupBoxConfig.Controls.Add(this.numericUpDownWeight);
|
||||
this.groupBoxConfig.Controls.Add(this.labelWeight);
|
||||
this.groupBoxConfig.Controls.Add(this.numericUpDownSpeed);
|
||||
this.groupBoxConfig.Controls.Add(this.labelSuper);
|
||||
this.groupBoxConfig.Location = new System.Drawing.Point(16, 21);
|
||||
this.groupBoxConfig.Margin = new System.Windows.Forms.Padding(3, 5, 3, 5);
|
||||
this.groupBoxConfig.Name = "groupBoxConfig";
|
||||
this.groupBoxConfig.Padding = new System.Windows.Forms.Padding(3, 5, 3, 5);
|
||||
this.groupBoxConfig.Size = new System.Drawing.Size(679, 391);
|
||||
this.groupBoxConfig.TabIndex = 0;
|
||||
this.groupBoxConfig.TabStop = false;
|
||||
this.groupBoxConfig.Text = "Параметры";
|
||||
//
|
||||
// labelSpeed
|
||||
//
|
||||
this.labelSpeed.AutoSize = true;
|
||||
this.labelSpeed.Location = new System.Drawing.Point(25, 40);
|
||||
this.labelSpeed.Name = "labelSpeed";
|
||||
this.labelSpeed.Size = new System.Drawing.Size(73, 20);
|
||||
this.labelSpeed.TabIndex = 18;
|
||||
this.labelSpeed.Text = "Скорость";
|
||||
//
|
||||
// labelModifiedObject
|
||||
//
|
||||
this.labelModifiedObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.labelModifiedObject.Location = new System.Drawing.Point(450, 216);
|
||||
this.labelModifiedObject.Name = "labelModifiedObject";
|
||||
this.labelModifiedObject.Size = new System.Drawing.Size(111, 50);
|
||||
this.labelModifiedObject.TabIndex = 16;
|
||||
this.labelModifiedObject.Text = "Продвинутый";
|
||||
this.labelModifiedObject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.labelModifiedObject.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown);
|
||||
//
|
||||
// labelSimpleObject
|
||||
//
|
||||
this.labelSimpleObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.labelSimpleObject.Location = new System.Drawing.Point(322, 216);
|
||||
this.labelSimpleObject.Name = "labelSimpleObject";
|
||||
this.labelSimpleObject.Size = new System.Drawing.Size(111, 50);
|
||||
this.labelSimpleObject.TabIndex = 15;
|
||||
this.labelSimpleObject.Text = "Простой";
|
||||
this.labelSimpleObject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.labelSimpleObject.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown);
|
||||
//
|
||||
// groupBoxColors
|
||||
//
|
||||
this.groupBoxColors.Controls.Add(this.panelPurple);
|
||||
this.groupBoxColors.Controls.Add(this.panelYellow);
|
||||
this.groupBoxColors.Controls.Add(this.panelBlack);
|
||||
this.groupBoxColors.Controls.Add(this.panelBlue);
|
||||
this.groupBoxColors.Controls.Add(this.panelGray);
|
||||
this.groupBoxColors.Controls.Add(this.panelGreen);
|
||||
this.groupBoxColors.Controls.Add(this.panelWhite);
|
||||
this.groupBoxColors.Controls.Add(this.panelRed);
|
||||
this.groupBoxColors.Location = new System.Drawing.Point(305, 29);
|
||||
this.groupBoxColors.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.groupBoxColors.Name = "groupBoxColors";
|
||||
this.groupBoxColors.Padding = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.groupBoxColors.Size = new System.Drawing.Size(275, 169);
|
||||
this.groupBoxColors.TabIndex = 14;
|
||||
this.groupBoxColors.TabStop = false;
|
||||
this.groupBoxColors.Text = "Цвета";
|
||||
//
|
||||
// panelPurple
|
||||
//
|
||||
this.panelPurple.BackColor = System.Drawing.Color.Purple;
|
||||
this.panelPurple.Location = new System.Drawing.Point(210, 97);
|
||||
this.panelPurple.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.panelPurple.Name = "panelPurple";
|
||||
this.panelPurple.Size = new System.Drawing.Size(46, 53);
|
||||
this.panelPurple.TabIndex = 3;
|
||||
this.panelPurple.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||
//
|
||||
// panelYellow
|
||||
//
|
||||
this.panelYellow.BackColor = System.Drawing.Color.Yellow;
|
||||
this.panelYellow.Location = new System.Drawing.Point(210, 29);
|
||||
this.panelYellow.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.panelYellow.Name = "panelYellow";
|
||||
this.panelYellow.Size = new System.Drawing.Size(46, 53);
|
||||
this.panelYellow.TabIndex = 1;
|
||||
this.panelYellow.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||
//
|
||||
// panelBlack
|
||||
//
|
||||
this.panelBlack.BackColor = System.Drawing.Color.Black;
|
||||
this.panelBlack.Location = new System.Drawing.Point(145, 97);
|
||||
this.panelBlack.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.panelBlack.Name = "panelBlack";
|
||||
this.panelBlack.Size = new System.Drawing.Size(46, 53);
|
||||
this.panelBlack.TabIndex = 4;
|
||||
this.panelBlack.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||
//
|
||||
// panelBlue
|
||||
//
|
||||
this.panelBlue.BackColor = System.Drawing.Color.Blue;
|
||||
this.panelBlue.Location = new System.Drawing.Point(145, 29);
|
||||
this.panelBlue.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.panelBlue.Name = "panelBlue";
|
||||
this.panelBlue.Size = new System.Drawing.Size(46, 53);
|
||||
this.panelBlue.TabIndex = 1;
|
||||
this.panelBlue.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||
//
|
||||
// panelGray
|
||||
//
|
||||
this.panelGray.BackColor = System.Drawing.Color.Gray;
|
||||
this.panelGray.Location = new System.Drawing.Point(82, 97);
|
||||
this.panelGray.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.panelGray.Name = "panelGray";
|
||||
this.panelGray.Size = new System.Drawing.Size(46, 53);
|
||||
this.panelGray.TabIndex = 5;
|
||||
this.panelGray.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||
//
|
||||
// panelGreen
|
||||
//
|
||||
this.panelGreen.BackColor = System.Drawing.Color.Green;
|
||||
this.panelGreen.Location = new System.Drawing.Point(82, 29);
|
||||
this.panelGreen.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.panelGreen.Name = "panelGreen";
|
||||
this.panelGreen.Size = new System.Drawing.Size(46, 53);
|
||||
this.panelGreen.TabIndex = 1;
|
||||
this.panelGreen.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||
//
|
||||
// panelWhite
|
||||
//
|
||||
this.panelWhite.BackColor = System.Drawing.Color.White;
|
||||
this.panelWhite.Location = new System.Drawing.Point(17, 97);
|
||||
this.panelWhite.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.panelWhite.Name = "panelWhite";
|
||||
this.panelWhite.Size = new System.Drawing.Size(46, 53);
|
||||
this.panelWhite.TabIndex = 2;
|
||||
this.panelWhite.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||
//
|
||||
// panelRed
|
||||
//
|
||||
this.panelRed.BackColor = System.Drawing.Color.Red;
|
||||
this.panelRed.Location = new System.Drawing.Point(17, 29);
|
||||
this.panelRed.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.panelRed.Name = "panelRed";
|
||||
this.panelRed.Size = new System.Drawing.Size(46, 53);
|
||||
this.panelRed.TabIndex = 0;
|
||||
this.panelRed.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
|
||||
//
|
||||
// checkBoxWing
|
||||
//
|
||||
this.checkBoxWing.AutoSize = true;
|
||||
this.checkBoxWing.Location = new System.Drawing.Point(25, 199);
|
||||
this.checkBoxWing.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.checkBoxWing.Name = "checkBoxWing";
|
||||
this.checkBoxWing.Size = new System.Drawing.Size(196, 24);
|
||||
this.checkBoxWing.TabIndex = 12;
|
||||
this.checkBoxWing.Text = "Признак наличия ракет";
|
||||
this.checkBoxWing.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoxBodyKit
|
||||
//
|
||||
this.checkBoxBodyKit.AutoSize = true;
|
||||
this.checkBoxBodyKit.Location = new System.Drawing.Point(25, 153);
|
||||
this.checkBoxBodyKit.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.checkBoxBodyKit.Name = "checkBoxBodyKit";
|
||||
this.checkBoxBodyKit.Size = new System.Drawing.Size(196, 24);
|
||||
this.checkBoxBodyKit.TabIndex = 11;
|
||||
this.checkBoxBodyKit.Text = "Признак наличия бомб";
|
||||
this.checkBoxBodyKit.UseVisualStyleBackColor = true;
|
||||
this.checkBoxBodyKit.CheckedChanged += new System.EventHandler(this.checkBoxBodyKit_CheckedChanged);
|
||||
//
|
||||
// numericUpDownWeight
|
||||
//
|
||||
this.numericUpDownWeight.Location = new System.Drawing.Point(103, 96);
|
||||
this.numericUpDownWeight.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.numericUpDownWeight.Maximum = new decimal(new int[] {
|
||||
1000,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numericUpDownWeight.Minimum = new decimal(new int[] {
|
||||
100,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numericUpDownWeight.Name = "numericUpDownWeight";
|
||||
this.numericUpDownWeight.Size = new System.Drawing.Size(90, 27);
|
||||
this.numericUpDownWeight.TabIndex = 10;
|
||||
this.numericUpDownWeight.Value = new decimal(new int[] {
|
||||
100,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
//
|
||||
// labelWeight
|
||||
//
|
||||
this.labelWeight.AutoSize = true;
|
||||
this.labelWeight.Location = new System.Drawing.Point(25, 99);
|
||||
this.labelWeight.Name = "labelWeight";
|
||||
this.labelWeight.Size = new System.Drawing.Size(36, 20);
|
||||
this.labelWeight.TabIndex = 9;
|
||||
this.labelWeight.Text = "Вес:";
|
||||
//
|
||||
// numericUpDownSpeed
|
||||
//
|
||||
this.numericUpDownSpeed.Location = new System.Drawing.Point(103, 40);
|
||||
this.numericUpDownSpeed.Maximum = new decimal(new int[] {
|
||||
1000,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numericUpDownSpeed.Minimum = new decimal(new int[] {
|
||||
100,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numericUpDownSpeed.Name = "numericUpDownSpeed";
|
||||
this.numericUpDownSpeed.Size = new System.Drawing.Size(79, 27);
|
||||
this.numericUpDownSpeed.TabIndex = 8;
|
||||
this.numericUpDownSpeed.Value = new decimal(new int[] {
|
||||
100,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
//
|
||||
// labelSuper
|
||||
//
|
||||
this.labelSuper.Location = new System.Drawing.Point(0, 0);
|
||||
this.labelSuper.Name = "labelSuper";
|
||||
this.labelSuper.Size = new System.Drawing.Size(114, 31);
|
||||
this.labelSuper.TabIndex = 17;
|
||||
//
|
||||
// panelObject
|
||||
//
|
||||
this.panelObject.AllowDrop = true;
|
||||
this.panelObject.Controls.Add(this.labelDopColor);
|
||||
this.panelObject.Controls.Add(this.labelBaseColor);
|
||||
this.panelObject.Controls.Add(this.pictureBoxObject);
|
||||
this.panelObject.Location = new System.Drawing.Point(615, 16);
|
||||
this.panelObject.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.panelObject.Name = "panelObject";
|
||||
this.panelObject.Size = new System.Drawing.Size(299, 245);
|
||||
this.panelObject.TabIndex = 2;
|
||||
this.panelObject.DragDrop += new System.Windows.Forms.DragEventHandler(this.PanelObject_DragDrop);
|
||||
this.panelObject.DragEnter += new System.Windows.Forms.DragEventHandler(this.PanelObject_DragEnter);
|
||||
//
|
||||
// labelDopColor
|
||||
//
|
||||
this.labelDopColor.AllowDrop = true;
|
||||
this.labelDopColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.labelDopColor.Location = new System.Drawing.Point(161, 12);
|
||||
this.labelDopColor.Name = "labelDopColor";
|
||||
this.labelDopColor.Size = new System.Drawing.Size(119, 42);
|
||||
this.labelDopColor.TabIndex = 2;
|
||||
this.labelDopColor.Text = "Доп. цвет";
|
||||
this.labelDopColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.labelDopColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.LabelDopColor_DragDrop);
|
||||
this.labelDopColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.LabelBaseColor_DragEnter);
|
||||
//
|
||||
// labelBaseColor
|
||||
//
|
||||
this.labelBaseColor.AllowDrop = true;
|
||||
this.labelBaseColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.labelBaseColor.Location = new System.Drawing.Point(23, 12);
|
||||
this.labelBaseColor.Name = "labelBaseColor";
|
||||
this.labelBaseColor.Size = new System.Drawing.Size(119, 42);
|
||||
this.labelBaseColor.TabIndex = 1;
|
||||
this.labelBaseColor.Text = "Цвет";
|
||||
this.labelBaseColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.labelBaseColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.LabelBaseColor_DragDrop);
|
||||
this.labelBaseColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.LabelBaseColor_DragEnter);
|
||||
//
|
||||
// pictureBoxObject
|
||||
//
|
||||
this.pictureBoxObject.Location = new System.Drawing.Point(23, 59);
|
||||
this.pictureBoxObject.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.pictureBoxObject.Name = "pictureBoxObject";
|
||||
this.pictureBoxObject.Size = new System.Drawing.Size(257, 167);
|
||||
this.pictureBoxObject.TabIndex = 0;
|
||||
this.pictureBoxObject.TabStop = false;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
this.buttonCancel.Location = new System.Drawing.Point(776, 269);
|
||||
this.buttonCancel.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.buttonCancel.Name = "buttonCancel";
|
||||
this.buttonCancel.Size = new System.Drawing.Size(119, 40);
|
||||
this.buttonCancel.TabIndex = 5;
|
||||
this.buttonCancel.Text = "Отмена";
|
||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// buttonOk
|
||||
//
|
||||
this.buttonOk.Location = new System.Drawing.Point(638, 269);
|
||||
this.buttonOk.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.buttonOk.Name = "buttonOk";
|
||||
this.buttonOk.Size = new System.Drawing.Size(119, 40);
|
||||
this.buttonOk.TabIndex = 4;
|
||||
this.buttonOk.Text = "Добавить";
|
||||
this.buttonOk.UseVisualStyleBackColor = true;
|
||||
this.buttonOk.Click += new System.EventHandler(this.ButtonOk_Click);
|
||||
//
|
||||
// FormStormtrooperConfig
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(926, 323);
|
||||
this.Controls.Add(this.buttonCancel);
|
||||
this.Controls.Add(this.buttonOk);
|
||||
this.Controls.Add(this.panelObject);
|
||||
this.Controls.Add(this.groupBoxConfig);
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.Name = "FormStormtrooperConfig";
|
||||
this.Text = "Создание объекта";
|
||||
this.groupBoxConfig.ResumeLayout(false);
|
||||
this.groupBoxConfig.PerformLayout();
|
||||
this.groupBoxColors.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).EndInit();
|
||||
this.panelObject.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private GroupBox groupBoxConfig;
|
||||
private CheckBox checkBoxWing;
|
||||
private CheckBox checkBoxBodyKit;
|
||||
private NumericUpDown numericUpDownWeight;
|
||||
private Label labelWeight;
|
||||
private NumericUpDown numericUpDownSpeed;
|
||||
private Label labelSuper;
|
||||
private Label labelModifiedObject;
|
||||
private Label labelSimpleObject;
|
||||
private GroupBox groupBoxColors;
|
||||
private Panel panelPurple;
|
||||
private Panel panelYellow;
|
||||
private Panel panelBlack;
|
||||
private Panel panelBlue;
|
||||
private Panel panelGray;
|
||||
private Panel panelGreen;
|
||||
private Panel panelWhite;
|
||||
private Panel panelRed;
|
||||
private Panel panelObject;
|
||||
private Label labelDopColor;
|
||||
private Label labelBaseColor;
|
||||
private PictureBox pictureBoxObject;
|
||||
private Button buttonCancel;
|
||||
private Button buttonOk;
|
||||
private Label labelSpeed;
|
||||
}
|
||||
}
|
189
Stormtrooper/Stormtrooper/FormStormtrooperConfig.cs
Normal file
189
Stormtrooper/Stormtrooper/FormStormtrooperConfig.cs
Normal file
@ -0,0 +1,189 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Stormtrooper
|
||||
{
|
||||
public partial class FormStormtrooperConfig : Form
|
||||
{
|
||||
/// <summary>
|
||||
/// Переменная-выбранная машина
|
||||
/// </summary>
|
||||
DrawningStormtrooper _stormtrooper = null;
|
||||
/// <summary>
|
||||
/// Событие
|
||||
/// </summary>
|
||||
private event Action<DrawningStormtrooper> EventAddStormtrooper;
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
public FormStormtrooperConfig()
|
||||
{
|
||||
InitializeComponent();
|
||||
panelBlack.MouseDown += PanelColor_MouseDown;
|
||||
panelPurple.MouseDown += PanelColor_MouseDown;
|
||||
panelGray.MouseDown += PanelColor_MouseDown;
|
||||
panelGreen.MouseDown += PanelColor_MouseDown;
|
||||
panelRed.MouseDown += PanelColor_MouseDown;
|
||||
panelWhite.MouseDown += PanelColor_MouseDown;
|
||||
panelYellow.MouseDown += PanelColor_MouseDown;
|
||||
panelBlue.MouseDown += PanelColor_MouseDown;
|
||||
|
||||
buttonCancel.Click += (sender, e) => Close();
|
||||
}
|
||||
/// <summary>
|
||||
/// Отрисовать машину
|
||||
/// </summary>
|
||||
private void DrawStormtrooper()
|
||||
{
|
||||
Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_stormtrooper?.SetPosition(5, 5, pictureBoxObject.Width, pictureBoxObject.Height);
|
||||
_stormtrooper?.DrawTransport(gr);
|
||||
pictureBoxObject.Image = bmp;
|
||||
}
|
||||
/// <summary>
|
||||
/// Добавление события
|
||||
/// </summary>
|
||||
/// <param name="ev"></param>
|
||||
public void AddEvent(Action<DrawningStormtrooper> ev)
|
||||
{
|
||||
if (EventAddStormtrooper == null)
|
||||
{
|
||||
EventAddStormtrooper = new Action<DrawningStormtrooper>(ev);
|
||||
}
|
||||
else
|
||||
{
|
||||
EventAddStormtrooper += ev;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Передаем информацию при нажатии на Label
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>labelModiflabelModifiedObjectiedObject
|
||||
private void LabelObject_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
(sender as Label).DoDragDrop((sender as Label).Name, DragDropEffects.Move | DragDropEffects.Copy);
|
||||
}
|
||||
|
||||
private void LabelObject_MouseUp(object sender, MouseEventArgs e)
|
||||
{
|
||||
(sender as Label).DoDragDrop((sender as Label).Name, DragDropEffects.Move | DragDropEffects.Copy);
|
||||
}
|
||||
/// <summary>
|
||||
/// Проверка получаемой информации (ее labelSimpleObjectтипа на соответствие требуемому)
|
||||
/// </summary>labelSimpleObject
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void PanelObject_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(DataFormats.Text))
|
||||
{
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Effect = DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Действия при приеме перетаскиваемой информации
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void PanelObject_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
switch (e.Data.GetData(DataFormats.Text).ToString())
|
||||
{
|
||||
case "labelSimpleObject":
|
||||
_stormtrooper = new DrawningStormtrooper((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, Color.White);
|
||||
break;
|
||||
case "labelModifiedObject":
|
||||
_stormtrooper = new DrawningSuperStormtrooper((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, Color.White, Color.Black,
|
||||
checkBoxBodyKit.Checked, checkBoxWing.Checked, false);
|
||||
break;
|
||||
}
|
||||
DrawStormtrooper();
|
||||
}
|
||||
/// <summary>
|
||||
/// Отправляем цвет с панели
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void PanelColor_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
(sender as Control).DoDragDrop((sender as Control).BackColor, DragDropEffects.Move | DragDropEffects.Copy);
|
||||
}
|
||||
/// <summary>
|
||||
/// Проверка получаемой информации (ее типа на соответствие требуемому)
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void LabelBaseColor_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(typeof(Color)))
|
||||
{
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Effect = DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Принимаем основной цвет
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void LabelBaseColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (_stormtrooper == null || !e.Data.GetDataPresent(typeof(Color)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
_stormtrooper.Stormtrooper.BodyColor = (Color)e.Data.GetData(typeof(Color));
|
||||
DrawStormtrooper();
|
||||
}
|
||||
/// <summary>
|
||||
/// Принимаем дополнительный цвет
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void LabelDopColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (_stormtrooper == null || _stormtrooper.GetType() != typeof(DrawningSuperStormtrooper) || !e.Data.GetDataPresent(typeof(Color)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (_stormtrooper.Stormtrooper is EntitySuperStormtrooper advStormtrooper)
|
||||
{
|
||||
advStormtrooper.DopColor = (Color)e.Data.GetData(typeof(Color));
|
||||
}
|
||||
DrawStormtrooper();
|
||||
}
|
||||
/// <summary>
|
||||
/// Добавление машины
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonOk_Click(object sender, EventArgs e)
|
||||
{
|
||||
EventAddStormtrooper?.Invoke(_stormtrooper);
|
||||
Close();
|
||||
}
|
||||
|
||||
private void checkBoxBodyKit_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
60
Stormtrooper/Stormtrooper/FormStormtrooperConfig.resx
Normal file
60
Stormtrooper/Stormtrooper/FormStormtrooperConfig.resx
Normal file
@ -0,0 +1,60 @@
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -90,9 +90,9 @@ namespace Stormtrooper
|
||||
public Bitmap ShowOnMap()
|
||||
{
|
||||
Shaking();
|
||||
foreach (var stormtrooper in _setStormtroopers.GetStormtroopers())
|
||||
foreach (var Stormtrooper in _setStormtroopers.GetStormtroopers())
|
||||
{
|
||||
return _map.CreateMap(_pictureWidth, _pictureHeight, stormtrooper);
|
||||
return _map.CreateMap(_pictureWidth, _pictureHeight, Stormtrooper);
|
||||
}
|
||||
return new(_pictureWidth, _pictureHeight);
|
||||
}
|
||||
@ -121,10 +121,10 @@ namespace Stormtrooper
|
||||
{
|
||||
for (; j > i; j--)
|
||||
{
|
||||
var stormtrooper = _setStormtroopers[j];
|
||||
if (stormtrooper != null)
|
||||
var Stormtrooper = _setStormtroopers[j];
|
||||
if (Stormtrooper != null)
|
||||
{
|
||||
_setStormtroopers.Insert(stormtrooper, i);
|
||||
_setStormtroopers.Insert(Stormtrooper, i);
|
||||
_setStormtroopers.Remove(j);
|
||||
break;
|
||||
}
|
||||
@ -163,10 +163,10 @@ namespace Stormtrooper
|
||||
{
|
||||
int x = (_pictureWidth / _placeSizeWidth) * _placeSizeWidth - _placeSizeWidth;
|
||||
int y = 5;
|
||||
foreach (var stormtrooper in _setStormtroopers.GetStormtroopers())
|
||||
foreach (var Stormtrooper in _setStormtroopers.GetStormtroopers())
|
||||
{
|
||||
stormtrooper?.SetObject(x, y, _pictureWidth, _pictureHeight);
|
||||
stormtrooper?.DrawningObject(g);
|
||||
Stormtrooper?.SetObject(x, y, _pictureWidth, _pictureHeight);
|
||||
Stormtrooper?.DrawningObject(g);
|
||||
x -= _placeSizeWidth;
|
||||
if (x < 0)
|
||||
{
|
||||
|
@ -11,7 +11,7 @@ namespace Stormtrooper
|
||||
/// <summary>
|
||||
/// Цвет участка закрытого
|
||||
/// </summary>
|
||||
private readonly Brush barrierColor = new SolidBrush(Color.Blue);
|
||||
private readonly Brush barrierColor = new SolidBrush(Color.Red);
|
||||
/// <summary>
|
||||
/// Цвет участка открытого
|
||||
/// </summary>
|
||||
@ -41,15 +41,11 @@ namespace Stormtrooper
|
||||
}
|
||||
while (counter < 10)
|
||||
{
|
||||
int x = _random.Next(2, _map.GetLength(0));
|
||||
int y = _random.Next(2, _map.GetLength(1));
|
||||
int x = _random.Next(0, _map.GetLength(0));
|
||||
int y = _random.Next(0, _map.GetLength(1));
|
||||
if (_map[x, y] == _freeRoad)
|
||||
{
|
||||
_map[x, y] = _barrier;
|
||||
_map[x - 1, y] = _barrier;
|
||||
_map[x, y - 1] = _barrier;
|
||||
_map[x - 1, y - 1] = _barrier;
|
||||
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
|
@ -113,11 +113,11 @@ namespace Stormtrooper
|
||||
/// <returns></returns>
|
||||
public IEnumerable<T> GetStormtroopers()
|
||||
{
|
||||
foreach (var stormtrooper in _places)
|
||||
foreach (var Stormtrooper in _places)
|
||||
{
|
||||
if (stormtrooper != null)
|
||||
if (Stormtrooper != null)
|
||||
{
|
||||
yield return stormtrooper;
|
||||
yield return Stormtrooper;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user