Compare commits
4 Commits
main
...
Lab3_AntiA
Author | SHA1 | Date | |
---|---|---|---|
c6fffe2777 | |||
32e13d828f | |||
4f2298a184 | |||
04cfe0d2b6 |
@ -8,4 +8,19 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
20
AntiAircraftGun/AntiAircraftGun/Direction.cs
Normal file
20
AntiAircraftGun/AntiAircraftGun/Direction.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AntiAircraftGun
|
||||
{
|
||||
public enum DirectionType
|
||||
{
|
||||
//Вверх
|
||||
Up = 1,
|
||||
//Вниз
|
||||
Down = 2,
|
||||
//Влево
|
||||
Left = 3,
|
||||
//Вправо
|
||||
Right = 4,
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using AntiAircraftGun.Entities;
|
||||
|
||||
namespace AntiAircraftGun.DrawningObjects
|
||||
{
|
||||
public class DrawingAntiAircraftGun : DrawningAircraftGun
|
||||
{
|
||||
// Конструктор
|
||||
public DrawingAntiAircraftGun(int speed, double weight, Color bodyColor, Color additionalColor, bool luke, bool zenitkaGun, bool radar, int width, int height) :
|
||||
base(speed, weight, bodyColor, width, height, 185, 128)
|
||||
{
|
||||
if (EntityAircraftGun != null)
|
||||
{
|
||||
EntityAircraftGun = new EntityAntiAircraftGun(speed, weight, bodyColor, additionalColor, luke, zenitkaGun, radar);
|
||||
}
|
||||
}
|
||||
|
||||
public override void DrawZenitka(Graphics g)
|
||||
{
|
||||
if (EntityAircraftGun is not EntityAntiAircraftGun aircraftGun)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Pen pen = new(Color.Black);
|
||||
pen.Width = 2;
|
||||
Brush additionalBrush = new SolidBrush(aircraftGun.AdditionalColor);
|
||||
// Два орудия у зенитки
|
||||
if (aircraftGun.ZenitkaGun)
|
||||
{
|
||||
Pen penTolst = new(Color.Black);
|
||||
penTolst.Width = 5;
|
||||
g.DrawLine(penTolst, startPosX + 105, startPosY + 63, startPosX + 175, startPosY + 13);
|
||||
g.DrawLine(penTolst, startPosX + 105, startPosY + 73, startPosX + 185, startPosY + 18);
|
||||
}
|
||||
base.DrawZenitka(g);
|
||||
// Лючек зенитки
|
||||
if (aircraftGun.Luke)
|
||||
{
|
||||
g.FillRectangle(additionalBrush, startPosX + 80, startPosY + 43, 25, 10);
|
||||
}
|
||||
// Радар зенитки
|
||||
if (aircraftGun.Radar)
|
||||
{
|
||||
g.DrawLine(pen, startPosX + 35, startPosY + 78, startPosX + 35, startPosY + 26);
|
||||
g.DrawLine(pen, startPosX + 60, startPosY + 53, startPosX + 38, startPosY + 23);
|
||||
g.DrawLine(pen, startPosX + 18, startPosY + 31, startPosX + 52, startPosY + 18);
|
||||
g.DrawLine(pen, startPosX + 18, startPosY + 31, startPosX, startPosY + 18);
|
||||
g.DrawLine(pen, startPosX + 52, startPosY + 18, startPosX + 55, startPosY - 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,152 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using AntiAircraftGun.Entities;
|
||||
using AntiAircraftGun.MovementStrategy;
|
||||
|
||||
namespace AntiAircraftGun.DrawningObjects
|
||||
{
|
||||
// Класс, отвечающий за прорисовку и перемещение объекта-сущности
|
||||
public class DrawningAircraftGun
|
||||
{
|
||||
// Класс-сущность
|
||||
public EntityAircraftGun? EntityAircraftGun { get; protected set; }
|
||||
|
||||
// Ширина окна
|
||||
private int pictureWidth;
|
||||
|
||||
// Высота окна
|
||||
private int pictureHeight;
|
||||
|
||||
// Левая координата прорисовки зенитки
|
||||
protected int startPosX;
|
||||
|
||||
// Верхняя координата прорисовки зенитки
|
||||
protected int startPosY;
|
||||
|
||||
// Ширина прорисоки зенитки
|
||||
protected readonly int _zenitkaWidth = 185;
|
||||
|
||||
// Высота прорисовки зенитки
|
||||
protected readonly int _zenitkaHeight = 128;
|
||||
|
||||
// Координата Х объекта
|
||||
public int GetPosX => startPosX;
|
||||
// Координата Y объекта
|
||||
public int GetPosY => startPosY;
|
||||
// Ширина объекта
|
||||
public int GetWidth => _zenitkaWidth;
|
||||
// Высота объекта
|
||||
public int GetHeight => _zenitkaHeight;
|
||||
// Конструктор
|
||||
public DrawningAircraftGun(int speed, double weight, Color bodyColor, int width, int height)
|
||||
{
|
||||
if (width < _zenitkaWidth) { return; }
|
||||
if (height < _zenitkaHeight) { return; }
|
||||
pictureWidth = width;
|
||||
pictureHeight = height;
|
||||
EntityAircraftGun = new EntityAircraftGun(speed, weight, bodyColor);
|
||||
}
|
||||
|
||||
// Конструктор
|
||||
protected DrawningAircraftGun(int speed, double weight, Color bodyColor, int width, int height, int zenitkaWidth, int zenitkaHeight)
|
||||
{
|
||||
pictureWidth = width;
|
||||
pictureHeight = height;
|
||||
_zenitkaWidth = zenitkaWidth;
|
||||
_zenitkaHeight = zenitkaHeight;
|
||||
EntityAircraftGun = new EntityAircraftGun(speed, weight, bodyColor);
|
||||
}
|
||||
|
||||
// Установка позиции
|
||||
public void SetPosition(int x, int y)
|
||||
{
|
||||
if (x < 0) { x = 0; }
|
||||
else if (x > pictureWidth) { x = pictureWidth; }
|
||||
if (y < 0) { y = 0; }
|
||||
else if (y > pictureHeight) { y = pictureHeight; }
|
||||
startPosX = x;
|
||||
startPosY = y;
|
||||
}
|
||||
|
||||
// Проверка, что объект может переместиться по указанному направлению
|
||||
public bool CanMove(DirectionType direction)
|
||||
{
|
||||
if (EntityAircraftGun == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return direction switch
|
||||
{
|
||||
// влево
|
||||
DirectionType.Left => startPosX - EntityAircraftGun.Step > 0,
|
||||
// вверх
|
||||
DirectionType.Up => startPosY - EntityAircraftGun.Step > 0,
|
||||
// вправо
|
||||
DirectionType.Right => startPosX + EntityAircraftGun.Step + _zenitkaWidth < pictureWidth,
|
||||
// вниз
|
||||
DirectionType.Down => startPosY + EntityAircraftGun.Step + _zenitkaHeight < pictureHeight,
|
||||
};
|
||||
}
|
||||
|
||||
// Изменение направления перемещения
|
||||
public void MoveTransport(DirectionType direction)
|
||||
{
|
||||
if (!CanMove(direction) || EntityAircraftGun == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (direction)
|
||||
{
|
||||
// влево
|
||||
case DirectionType.Left:
|
||||
startPosX -= (int)EntityAircraftGun.Step;
|
||||
break;
|
||||
// вверх
|
||||
case DirectionType.Up:
|
||||
startPosY -= (int)EntityAircraftGun.Step;
|
||||
break;
|
||||
// вправо
|
||||
case DirectionType.Right:
|
||||
startPosX += (int)EntityAircraftGun.Step;
|
||||
break;
|
||||
// вниз
|
||||
case DirectionType.Down:
|
||||
startPosY += (int)EntityAircraftGun.Step;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Прорисовка объекта
|
||||
public virtual void DrawZenitka(Graphics g)
|
||||
{
|
||||
if (EntityAircraftGun == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Pen pen = new(Color.Black);
|
||||
pen.Width = 2;
|
||||
Brush additionalBrush = new SolidBrush(EntityAircraftGun.BodyColor);
|
||||
// Гусеница
|
||||
g.DrawEllipse(pen, startPosX, startPosY + 103, 150, 25);
|
||||
g.DrawEllipse(pen, startPosX + 5, startPosY + 110, 10, 10);
|
||||
g.DrawEllipse(pen, startPosX + 18, startPosY + 108, 15, 15);
|
||||
g.DrawEllipse(pen, startPosX + 36, startPosY + 107, 17, 17);
|
||||
g.DrawEllipse(pen, startPosX + 56, startPosY + 107, 17, 17);
|
||||
g.DrawEllipse(pen, startPosX + 76, startPosY + 107, 17, 17);
|
||||
g.DrawEllipse(pen, startPosX + 96, startPosY + 107, 17, 17);
|
||||
g.DrawEllipse(pen, startPosX + 116, startPosY + 108, 15, 15);
|
||||
g.DrawEllipse(pen, startPosX + 136, startPosY + 110, 10, 10);
|
||||
// Корпус зенитки
|
||||
Brush brGreen = new SolidBrush(Color.Green);
|
||||
g.FillRectangle(brGreen, startPosX + 20, startPosY + 78, 110, 25);
|
||||
// Башня зенитки
|
||||
g.FillRectangle(additionalBrush, startPosX + 45, startPosY + 53, 60, 25);
|
||||
}
|
||||
|
||||
// Получение объекта IMoveableObject из объекта DrawingAntiAircraftGun
|
||||
public IMoveableObject GetMoveableObject => new DrawningObjectAircraftGun(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AntiAircraftGun.Entities
|
||||
{
|
||||
// Класс-сущность "Зенитка"
|
||||
public class EntityAircraftGun
|
||||
{
|
||||
// Скорость
|
||||
public int Speed { get; private set; }
|
||||
|
||||
// Вес
|
||||
public double Weight { get; private set; }
|
||||
|
||||
// Основной цвет
|
||||
public Color BodyColor { get; private set; }
|
||||
|
||||
// Шаг перемещения зенитки
|
||||
public double Step => (double)Speed * 100 / Weight;
|
||||
|
||||
// Конструктор с параметрами
|
||||
public EntityAircraftGun(int speed, double weight, Color bodyColor)
|
||||
{
|
||||
Speed = speed;
|
||||
Weight = weight;
|
||||
BodyColor = bodyColor;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AntiAircraftGun.Entities
|
||||
{
|
||||
// Класс-сущность "Стреляющая зенитка"
|
||||
public class EntityAntiAircraftGun : EntityAircraftGun
|
||||
{
|
||||
// Доп. цвет
|
||||
public Color AdditionalColor { get; private set; }
|
||||
// Признак наличия люка
|
||||
public bool Luke { get; private set; }
|
||||
// Признак наличия зенитного орудия
|
||||
public bool ZenitkaGun { get; private set; }
|
||||
// признак наличия радара
|
||||
public bool Radar { get; private set; }
|
||||
|
||||
// Инициализация полей объекта-класса продвинутой зенитки
|
||||
public EntityAntiAircraftGun(int speed, double weight, Color bodyColor, Color additionalColor, bool luke, bool zenitkaGun, bool radar) :
|
||||
base(speed, weight, bodyColor)
|
||||
{
|
||||
AdditionalColor = additionalColor;
|
||||
Luke = luke;
|
||||
ZenitkaGun = zenitkaGun;
|
||||
Radar = radar;
|
||||
}
|
||||
}
|
||||
}
|
39
AntiAircraftGun/AntiAircraftGun/Form1.Designer.cs
generated
39
AntiAircraftGun/AntiAircraftGun/Form1.Designer.cs
generated
@ -1,39 +0,0 @@
|
||||
namespace AntiAircraftGun
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <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.components = new System.ComponentModel.Container();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Text = "Form1";
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
namespace AntiAircraftGun
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
123
AntiAircraftGun/AntiAircraftGun/FormAircraftGunCollection.Designer.cs
generated
Normal file
123
AntiAircraftGun/AntiAircraftGun/FormAircraftGunCollection.Designer.cs
generated
Normal file
@ -0,0 +1,123 @@
|
||||
namespace AntiAircraftGun
|
||||
{
|
||||
partial class FormAircraftGunCollection
|
||||
{
|
||||
/// <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.panel1 = new System.Windows.Forms.Panel();
|
||||
this.maskedTextBoxNumber = new System.Windows.Forms.TextBox();
|
||||
this.ButtonRefreshCollection = new System.Windows.Forms.Button();
|
||||
this.ButtonAddAircraftGun = new System.Windows.Forms.Button();
|
||||
this.ButtonRemoveAircraftGun = new System.Windows.Forms.Button();
|
||||
this.pictureBoxCollection = new System.Windows.Forms.PictureBox();
|
||||
this.panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.maskedTextBoxNumber);
|
||||
this.panel1.Controls.Add(this.ButtonRefreshCollection);
|
||||
this.panel1.Controls.Add(this.ButtonAddAircraftGun);
|
||||
this.panel1.Controls.Add(this.ButtonRemoveAircraftGun);
|
||||
this.panel1.Location = new System.Drawing.Point(667, 12);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(180, 436);
|
||||
this.panel1.TabIndex = 0;
|
||||
//
|
||||
// maskedTextBoxNumber
|
||||
//
|
||||
this.maskedTextBoxNumber.Location = new System.Drawing.Point(24, 80);
|
||||
this.maskedTextBoxNumber.Name = "maskedTextBoxNumber";
|
||||
this.maskedTextBoxNumber.Size = new System.Drawing.Size(134, 23);
|
||||
this.maskedTextBoxNumber.TabIndex = 3;
|
||||
//
|
||||
// ButtonRefreshCollection
|
||||
//
|
||||
this.ButtonRefreshCollection.Location = new System.Drawing.Point(3, 210);
|
||||
this.ButtonRefreshCollection.Name = "ButtonRefreshCollection";
|
||||
this.ButtonRefreshCollection.Size = new System.Drawing.Size(174, 44);
|
||||
this.ButtonRefreshCollection.TabIndex = 2;
|
||||
this.ButtonRefreshCollection.Text = "Обновить коллекцию";
|
||||
this.ButtonRefreshCollection.UseVisualStyleBackColor = true;
|
||||
this.ButtonRefreshCollection.Click += new System.EventHandler(this.ButtonRefreshCollection_Click);
|
||||
//
|
||||
// ButtonAddAircraftGun
|
||||
//
|
||||
this.ButtonAddAircraftGun.Location = new System.Drawing.Point(3, 12);
|
||||
this.ButtonAddAircraftGun.Name = "ButtonAddAircraftGun";
|
||||
this.ButtonAddAircraftGun.Size = new System.Drawing.Size(174, 44);
|
||||
this.ButtonAddAircraftGun.TabIndex = 0;
|
||||
this.ButtonAddAircraftGun.Text = "Добавить зенитку";
|
||||
this.ButtonAddAircraftGun.UseVisualStyleBackColor = true;
|
||||
this.ButtonAddAircraftGun.Click += new System.EventHandler(this.ButtonAddAircraftGun_Click);
|
||||
//
|
||||
// ButtonRemoveAircraftGun
|
||||
//
|
||||
this.ButtonRemoveAircraftGun.Location = new System.Drawing.Point(3, 135);
|
||||
this.ButtonRemoveAircraftGun.Name = "ButtonRemoveAircraftGun";
|
||||
this.ButtonRemoveAircraftGun.Size = new System.Drawing.Size(174, 44);
|
||||
this.ButtonRemoveAircraftGun.TabIndex = 1;
|
||||
this.ButtonRemoveAircraftGun.Text = "Удалить зенитку";
|
||||
this.ButtonRemoveAircraftGun.UseVisualStyleBackColor = true;
|
||||
this.ButtonRemoveAircraftGun.Click += new System.EventHandler(this.ButtonRemoveAircraftGun_Click);
|
||||
//
|
||||
// pictureBoxCollection
|
||||
//
|
||||
this.pictureBoxCollection.Location = new System.Drawing.Point(2, 2);
|
||||
this.pictureBoxCollection.Name = "pictureBoxCollection";
|
||||
this.pictureBoxCollection.Size = new System.Drawing.Size(659, 490);
|
||||
this.pictureBoxCollection.TabIndex = 1;
|
||||
this.pictureBoxCollection.TabStop = false;
|
||||
//
|
||||
// FormAircraftGunCollection
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(850, 504);
|
||||
this.Controls.Add(this.pictureBoxCollection);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Name = "FormAircraftGunCollection";
|
||||
this.Text = "Набор зениток";
|
||||
this.Load += new System.EventHandler(this.FormAircraftGunCollection_Load);
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel1;
|
||||
private Button ButtonRefreshCollection;
|
||||
private Button ButtonAddAircraftGun;
|
||||
private Button ButtonRemoveAircraftGun;
|
||||
private PictureBox pictureBoxCollection;
|
||||
private TextBox maskedTextBoxNumber;
|
||||
}
|
||||
}
|
74
AntiAircraftGun/AntiAircraftGun/FormAircraftGunCollection.cs
Normal file
74
AntiAircraftGun/AntiAircraftGun/FormAircraftGunCollection.cs
Normal file
@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using AntiAircraftGun.DrawningObjects;
|
||||
using AntiAircraftGun.MovementStrategy;
|
||||
using AntiAircraftGun.Generics;
|
||||
|
||||
namespace AntiAircraftGun
|
||||
{
|
||||
public partial class FormAircraftGunCollection : Form
|
||||
{
|
||||
|
||||
private readonly AntiAircraftGunsGenericCollection<DrawningAircraftGun, DrawningObjectAircraftGun> _aircraftguns;
|
||||
public FormAircraftGunCollection()
|
||||
{
|
||||
InitializeComponent();
|
||||
_aircraftguns = new AntiAircraftGunsGenericCollection<DrawningAircraftGun, DrawningObjectAircraftGun>(pictureBoxCollection.Width, pictureBoxCollection.Height);
|
||||
}
|
||||
|
||||
private void FormAircraftGunCollection_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Добавление объекта в набор
|
||||
private void ButtonAddAircraftGun_Click(object sender, EventArgs e)
|
||||
{
|
||||
FormAntiAircraftGun form = new();
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if ((_aircraftguns + form.SelectedAircraftGun) == 0)
|
||||
{
|
||||
MessageBox.Show("Объект добавлен");
|
||||
pictureBoxCollection.Image = _aircraftguns.ShowAntiAircraftGuns();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось добавить объект");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Удаление объекта из набора
|
||||
private void ButtonRemoveAircraftGun_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (MessageBox.Show("удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int pos = Convert.ToInt32(maskedTextBoxNumber.Text);
|
||||
if (_aircraftguns - pos != null)
|
||||
{
|
||||
MessageBox.Show("Объект удалён");
|
||||
pictureBoxCollection.Image = _aircraftguns.ShowAntiAircraftGuns();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось удалить объект");
|
||||
}
|
||||
}
|
||||
|
||||
// Обновление рисунка по набору
|
||||
private void ButtonRefreshCollection_Click(object sender, EventArgs e)
|
||||
{
|
||||
pictureBoxCollection.Image = _aircraftguns.ShowAntiAircraftGuns();
|
||||
}
|
||||
}
|
||||
}
|
@ -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>
|
206
AntiAircraftGun/AntiAircraftGun/FormAntiAircraftGun.Designer.cs
generated
Normal file
206
AntiAircraftGun/AntiAircraftGun/FormAntiAircraftGun.Designer.cs
generated
Normal file
@ -0,0 +1,206 @@
|
||||
namespace AntiAircraftGun
|
||||
{
|
||||
partial class FormAntiAircraftGun
|
||||
{
|
||||
/// <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.pictureBox = new System.Windows.Forms.PictureBox();
|
||||
this.buttonUp = new System.Windows.Forms.Button();
|
||||
this.buttonLeft = new System.Windows.Forms.Button();
|
||||
this.buttonDown = new System.Windows.Forms.Button();
|
||||
this.buttonRight = new System.Windows.Forms.Button();
|
||||
this.buttonCreateAntiAircraftGun = new System.Windows.Forms.Button();
|
||||
this.pictureBoxAntiAircraftGun = new System.Windows.Forms.PictureBox();
|
||||
this.comboBoxStrategy = new System.Windows.Forms.ComboBox();
|
||||
this.ButtonCreateAntiAircraftGun_Click = new System.Windows.Forms.Button();
|
||||
this.ButtonStep_Click = new System.Windows.Forms.Button();
|
||||
this.ButtonSelectAircraftGun_Click = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxAntiAircraftGun)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// pictureBox
|
||||
//
|
||||
this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.pictureBox.Location = new System.Drawing.Point(0, 0);
|
||||
this.pictureBox.Name = "pictureBox";
|
||||
this.pictureBox.Size = new System.Drawing.Size(884, 461);
|
||||
this.pictureBox.TabIndex = 0;
|
||||
this.pictureBox.TabStop = false;
|
||||
//
|
||||
// buttonUp
|
||||
//
|
||||
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonUp.BackgroundImage = global::AntiAircraftGun.Properties.Resources.arrowUp;
|
||||
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.buttonUp.Location = new System.Drawing.Point(791, 373);
|
||||
this.buttonUp.Name = "buttonUp";
|
||||
this.buttonUp.Size = new System.Drawing.Size(35, 35);
|
||||
this.buttonUp.TabIndex = 11;
|
||||
this.buttonUp.UseVisualStyleBackColor = true;
|
||||
this.buttonUp.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 = global::AntiAircraftGun.Properties.Resources.arrowLeft;
|
||||
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.buttonLeft.Location = new System.Drawing.Point(750, 414);
|
||||
this.buttonLeft.Name = "buttonLeft";
|
||||
this.buttonLeft.Size = new System.Drawing.Size(35, 35);
|
||||
this.buttonLeft.TabIndex = 10;
|
||||
this.buttonLeft.UseVisualStyleBackColor = true;
|
||||
this.buttonLeft.Click += new System.EventHandler(this.buttonMove_Click);
|
||||
//
|
||||
// buttonDown
|
||||
//
|
||||
this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonDown.BackgroundImage = global::AntiAircraftGun.Properties.Resources.arrowDown;
|
||||
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.buttonDown.Location = new System.Drawing.Point(791, 414);
|
||||
this.buttonDown.Name = "buttonDown";
|
||||
this.buttonDown.Size = new System.Drawing.Size(35, 35);
|
||||
this.buttonDown.TabIndex = 9;
|
||||
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 = global::AntiAircraftGun.Properties.Resources.arrowRight;
|
||||
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.buttonRight.Location = new System.Drawing.Point(832, 414);
|
||||
this.buttonRight.Name = "buttonRight";
|
||||
this.buttonRight.Size = new System.Drawing.Size(35, 35);
|
||||
this.buttonRight.TabIndex = 8;
|
||||
this.buttonRight.UseVisualStyleBackColor = true;
|
||||
this.buttonRight.Click += new System.EventHandler(this.buttonMove_Click);
|
||||
//
|
||||
// buttonCreateAntiAircraftGun
|
||||
//
|
||||
this.buttonCreateAntiAircraftGun.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.buttonCreateAntiAircraftGun.Location = new System.Drawing.Point(148, 406);
|
||||
this.buttonCreateAntiAircraftGun.Name = "buttonCreateAntiAircraftGun";
|
||||
this.buttonCreateAntiAircraftGun.Size = new System.Drawing.Size(186, 43);
|
||||
this.buttonCreateAntiAircraftGun.TabIndex = 7;
|
||||
this.buttonCreateAntiAircraftGun.Text = "Создать стреляющую зенитку";
|
||||
this.buttonCreateAntiAircraftGun.UseVisualStyleBackColor = true;
|
||||
this.buttonCreateAntiAircraftGun.Click += new System.EventHandler(this.buttonCreate_Click);
|
||||
//
|
||||
// pictureBoxAntiAircraftGun
|
||||
//
|
||||
this.pictureBoxAntiAircraftGun.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.pictureBoxAntiAircraftGun.Location = new System.Drawing.Point(0, 0);
|
||||
this.pictureBoxAntiAircraftGun.Name = "pictureBoxAntiAircraftGun";
|
||||
this.pictureBoxAntiAircraftGun.Size = new System.Drawing.Size(884, 461);
|
||||
this.pictureBoxAntiAircraftGun.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
|
||||
this.pictureBoxAntiAircraftGun.TabIndex = 6;
|
||||
this.pictureBoxAntiAircraftGun.TabStop = false;
|
||||
//
|
||||
// comboBoxStrategy
|
||||
//
|
||||
this.comboBoxStrategy.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxStrategy.FormattingEnabled = true;
|
||||
this.comboBoxStrategy.Items.AddRange(new object[] {
|
||||
"Движение к центру",
|
||||
"Движение в правый нижний угол"});
|
||||
this.comboBoxStrategy.Location = new System.Drawing.Point(633, 12);
|
||||
this.comboBoxStrategy.Name = "comboBoxStrategy";
|
||||
this.comboBoxStrategy.Size = new System.Drawing.Size(239, 23);
|
||||
this.comboBoxStrategy.TabIndex = 12;
|
||||
//
|
||||
// ButtonCreateAntiAircraftGun_Click
|
||||
//
|
||||
this.ButtonCreateAntiAircraftGun_Click.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.ButtonCreateAntiAircraftGun_Click.Location = new System.Drawing.Point(12, 406);
|
||||
this.ButtonCreateAntiAircraftGun_Click.Name = "ButtonCreateAntiAircraftGun_Click";
|
||||
this.ButtonCreateAntiAircraftGun_Click.Size = new System.Drawing.Size(111, 43);
|
||||
this.ButtonCreateAntiAircraftGun_Click.TabIndex = 13;
|
||||
this.ButtonCreateAntiAircraftGun_Click.Text = "Создать зенитку";
|
||||
this.ButtonCreateAntiAircraftGun_Click.UseVisualStyleBackColor = true;
|
||||
this.ButtonCreateAntiAircraftGun_Click.Click += new System.EventHandler(this.ButtonCreateAntiAircraftGun_Click_Click);
|
||||
//
|
||||
// ButtonStep_Click
|
||||
//
|
||||
this.ButtonStep_Click.Location = new System.Drawing.Point(812, 50);
|
||||
this.ButtonStep_Click.Name = "ButtonStep_Click";
|
||||
this.ButtonStep_Click.Size = new System.Drawing.Size(55, 42);
|
||||
this.ButtonStep_Click.TabIndex = 14;
|
||||
this.ButtonStep_Click.Text = "Шаг";
|
||||
this.ButtonStep_Click.UseVisualStyleBackColor = true;
|
||||
this.ButtonStep_Click.Click += new System.EventHandler(this.ButtonStep_Click_Click);
|
||||
//
|
||||
// ButtonSelectAircraftGun_Click
|
||||
//
|
||||
this.ButtonSelectAircraftGun_Click.Location = new System.Drawing.Point(349, 406);
|
||||
this.ButtonSelectAircraftGun_Click.Name = "ButtonSelectAircraftGun_Click";
|
||||
this.ButtonSelectAircraftGun_Click.Size = new System.Drawing.Size(120, 43);
|
||||
this.ButtonSelectAircraftGun_Click.TabIndex = 15;
|
||||
this.ButtonSelectAircraftGun_Click.Text = "Выбрать зенитку";
|
||||
this.ButtonSelectAircraftGun_Click.UseVisualStyleBackColor = true;
|
||||
this.ButtonSelectAircraftGun_Click.Click += new System.EventHandler(this.ButtonSelectAircraftGun_Click_Click);
|
||||
//
|
||||
// FormAntiAircraftGun
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(884, 461);
|
||||
this.Controls.Add(this.ButtonSelectAircraftGun_Click);
|
||||
this.Controls.Add(this.ButtonStep_Click);
|
||||
this.Controls.Add(this.ButtonCreateAntiAircraftGun_Click);
|
||||
this.Controls.Add(this.comboBoxStrategy);
|
||||
this.Controls.Add(this.buttonUp);
|
||||
this.Controls.Add(this.buttonLeft);
|
||||
this.Controls.Add(this.buttonDown);
|
||||
this.Controls.Add(this.buttonRight);
|
||||
this.Controls.Add(this.buttonCreateAntiAircraftGun);
|
||||
this.Controls.Add(this.pictureBoxAntiAircraftGun);
|
||||
this.Controls.Add(this.pictureBox);
|
||||
this.Name = "FormAntiAircraftGun";
|
||||
this.Text = "Зенитное орудие";
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxAntiAircraftGun)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private PictureBox pictureBox;
|
||||
private Button buttonUp;
|
||||
private Button buttonLeft;
|
||||
private Button buttonDown;
|
||||
private Button buttonRight;
|
||||
private Button buttonCreateAntiAircraftGun;
|
||||
private PictureBox pictureBoxAntiAircraftGun;
|
||||
private ComboBox comboBoxStrategy;
|
||||
private Button ButtonCreateAntiAircraftGun_Click;
|
||||
private Button ButtonStep_Click;
|
||||
private Button ButtonSelectAircraftGun_Click;
|
||||
}
|
||||
}
|
139
AntiAircraftGun/AntiAircraftGun/FormAntiAircraftGun.cs
Normal file
139
AntiAircraftGun/AntiAircraftGun/FormAntiAircraftGun.cs
Normal file
@ -0,0 +1,139 @@
|
||||
using AntiAircraftGun.DrawningObjects;
|
||||
using AntiAircraftGun.MovementStrategy;
|
||||
|
||||
namespace AntiAircraftGun
|
||||
{
|
||||
public partial class FormAntiAircraftGun : Form
|
||||
{
|
||||
private DrawningAircraftGun? _drawningAircraftGun;
|
||||
|
||||
private AbstractStrategy? abstractStrategy;
|
||||
|
||||
// Âûáðàííàÿ çåíèòêà
|
||||
public DrawningAircraftGun? SelectedAircraftGun { get; private set; }
|
||||
public FormAntiAircraftGun()
|
||||
{
|
||||
InitializeComponent();
|
||||
abstractStrategy = null;
|
||||
SelectedAircraftGun = null;
|
||||
}
|
||||
|
||||
private void Draw()
|
||||
{
|
||||
if (_drawningAircraftGun == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Bitmap bmp = new(pictureBoxAntiAircraftGun.Width, pictureBoxAntiAircraftGun.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_drawningAircraftGun.DrawZenitka(gr);
|
||||
pictureBoxAntiAircraftGun.Image = bmp;
|
||||
}
|
||||
// Îáðàáîòêà íàæàòèÿ êíîïêè "Ñîçäàòü ñòðåëÿþùóþ çåíèòêó"
|
||||
private void buttonCreate_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new();
|
||||
Color color = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
||||
ColorDialog dialog = new();
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
color = dialog.Color;
|
||||
}
|
||||
Color dopColor = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
dopColor = dialog.Color;
|
||||
}
|
||||
|
||||
_drawningAircraftGun = new DrawingAntiAircraftGun(random.Next(100, 300), random.Next(1000, 3000), color, dopColor,
|
||||
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)), pictureBoxAntiAircraftGun.Width,
|
||||
pictureBoxAntiAircraftGun.Height);
|
||||
_drawningAircraftGun.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
Draw();
|
||||
}
|
||||
|
||||
// Îáðàáîòêà íàæàòèÿ êíîïêè "Ñîçäàòü çåíèòêó"
|
||||
private void ButtonCreateAntiAircraftGun_Click_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new();
|
||||
Color color = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
||||
ColorDialog dialog = new();
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
color = dialog.Color;
|
||||
}
|
||||
_drawningAircraftGun = new DrawningAircraftGun(random.Next(100, 300), random.Next(1000, 3000), color, pictureBoxAntiAircraftGun.Width, pictureBoxAntiAircraftGun.Height);
|
||||
_drawningAircraftGun.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
Draw();
|
||||
}
|
||||
|
||||
private void buttonMove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawningAircraftGun == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
string name = ((Button)sender)?.Name ?? string.Empty;
|
||||
switch (name)
|
||||
{
|
||||
case "buttonUp":
|
||||
_drawningAircraftGun.MoveTransport(DirectionType.Up);
|
||||
break;
|
||||
case "buttonDown":
|
||||
_drawningAircraftGun.MoveTransport(DirectionType.Down);
|
||||
break;
|
||||
case "buttonLeft":
|
||||
_drawningAircraftGun.MoveTransport(DirectionType.Left);
|
||||
break;
|
||||
case "buttonRight":
|
||||
_drawningAircraftGun.MoveTransport(DirectionType.Right);
|
||||
break;
|
||||
}
|
||||
Draw();
|
||||
}
|
||||
|
||||
// Îáðàáîòêà íàæàòèÿ êíîïêè "Øàã"
|
||||
private void ButtonStep_Click_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawningAircraftGun == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (comboBoxStrategy.Enabled)
|
||||
{
|
||||
abstractStrategy = comboBoxStrategy.SelectedIndex
|
||||
switch
|
||||
{
|
||||
0 => new MoveToCenter(),
|
||||
1 => new MoveToBorder(),
|
||||
_ => null,
|
||||
};
|
||||
if (abstractStrategy == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
abstractStrategy.SetData(new DrawningObjectAircraftGun(_drawningAircraftGun), pictureBoxAntiAircraftGun.Width, pictureBoxAntiAircraftGun.Height);
|
||||
}
|
||||
if (abstractStrategy == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
comboBoxStrategy.Enabled = false;
|
||||
abstractStrategy.MakeStep();
|
||||
Draw();
|
||||
if (abstractStrategy.GetStatus() == Status.Finish)
|
||||
{
|
||||
comboBoxStrategy.Enabled = true;
|
||||
abstractStrategy = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Âûáîð çåíèòêè
|
||||
private void ButtonSelectAircraftGun_Click_Click(object sender, EventArgs e)
|
||||
{
|
||||
SelectedAircraftGun = _drawningAircraftGun;
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
}
|
||||
}
|
60
AntiAircraftGun/AntiAircraftGun/FormAntiAircraftGun.resx
Normal file
60
AntiAircraftGun/AntiAircraftGun/FormAntiAircraftGun.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>
|
@ -0,0 +1,105 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using AntiAircraftGun.DrawningObjects;
|
||||
using AntiAircraftGun.MovementStrategy;
|
||||
|
||||
namespace AntiAircraftGun.Generics
|
||||
{
|
||||
internal class AntiAircraftGunsGenericCollection<T, U>
|
||||
where T : DrawningAircraftGun
|
||||
where U : IMoveableObject
|
||||
{
|
||||
private readonly int _pictureWidth;
|
||||
private readonly int _pictureHeight;
|
||||
// Размер занимаемого объектом места(ширина)
|
||||
private readonly int _placeSizeWidth = 185;
|
||||
// Размер занимаемого объектом места(высота)
|
||||
private readonly int _placeSizeHeight = 128;
|
||||
|
||||
// Набор объектов
|
||||
private readonly SetGeneric<T> _collection;
|
||||
|
||||
// Конструктор
|
||||
public AntiAircraftGunsGenericCollection(int picWidth, int picHeight)
|
||||
{
|
||||
int width = picWidth / _placeSizeWidth;
|
||||
int height = picHeight / _placeSizeHeight;
|
||||
_pictureWidth = picWidth;
|
||||
_pictureHeight = picHeight;
|
||||
|
||||
_collection = new SetGeneric<T>(width * height);
|
||||
}
|
||||
|
||||
// Перегрузка оператора сложения
|
||||
public static int? operator +(AntiAircraftGunsGenericCollection<T, U> collect, T? obj)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return collect?._collection.Insert(obj);
|
||||
}
|
||||
|
||||
// Перегрузка оператора вычитания
|
||||
public static bool operator -(AntiAircraftGunsGenericCollection<T, U> collect, int pos)
|
||||
{
|
||||
T? obj = collect._collection.Get(pos);
|
||||
if (obj == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
collect._collection.Remove(pos);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Получение объекта IMoveableObject
|
||||
public U? GetU(int pos)
|
||||
{
|
||||
return (U?)_collection.Get(pos)?.GetMoveableObject;
|
||||
}
|
||||
|
||||
// Вывод всего набора объектов
|
||||
public Bitmap ShowAntiAircraftGuns()
|
||||
{
|
||||
Bitmap bmp = new(_pictureWidth, _pictureHeight);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
DrawBackground(gr);
|
||||
DrawObjects(gr);
|
||||
return bmp;
|
||||
}
|
||||
|
||||
// Метод отрисовки фона
|
||||
private void DrawBackground(Graphics g)
|
||||
{
|
||||
Pen pen = new(Color.Black, 3);
|
||||
for (int i = 0; i < _pictureWidth / _placeSizeWidth; i++)
|
||||
{
|
||||
for (int j = 0; j < _pictureHeight / _placeSizeHeight + 1; j++)
|
||||
{
|
||||
g.DrawLine(pen, i * _placeSizeWidth, j * _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth / 2, j * _placeSizeHeight);
|
||||
}
|
||||
g.DrawLine(pen, i * _placeSizeWidth, 0, i * _placeSizeWidth, _pictureHeight / _placeSizeHeight * _placeSizeHeight);
|
||||
}
|
||||
}
|
||||
|
||||
// Метод прорисовки объектов
|
||||
private void DrawObjects(Graphics g)
|
||||
{
|
||||
int height = _pictureHeight / _placeSizeHeight;
|
||||
int width = _pictureWidth / _placeSizeWidth;
|
||||
for (int i = 0; i < _collection.Count; i++)
|
||||
{
|
||||
DrawningAircraftGun aircraftGun = _collection.Get(i);
|
||||
if(aircraftGun == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
aircraftGun.SetPosition((i % width) * _placeSizeWidth, (i / height) * _placeSizeHeight);
|
||||
aircraftGun.DrawZenitka(g);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
95
AntiAircraftGun/AntiAircraftGun/Generics/SetGeneric.cs
Normal file
95
AntiAircraftGun/AntiAircraftGun/Generics/SetGeneric.cs
Normal file
@ -0,0 +1,95 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AntiAircraftGun.Generics
|
||||
{
|
||||
internal class SetGeneric<T>
|
||||
where T : class
|
||||
{
|
||||
// Массив
|
||||
private readonly T?[] _places;
|
||||
|
||||
// Кол-во объектов в массиве
|
||||
public int Count => _places.Length;
|
||||
|
||||
// Конструктор
|
||||
public SetGeneric(int Count)
|
||||
{
|
||||
_places = new T?[Count];
|
||||
}
|
||||
|
||||
// Добавление объекта в набор
|
||||
public int Insert(T antiaircraftgun)
|
||||
{
|
||||
int i = 0;
|
||||
while(_places[i] != null)
|
||||
{
|
||||
i++;
|
||||
if (i == Count)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
while (i != 0)
|
||||
{
|
||||
_places[i] = _places[i - 1];
|
||||
i--;
|
||||
}
|
||||
_places[0] = antiaircraftgun;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Добавление объекта на конкретную позицию
|
||||
public bool Insert(T antiaircraftgun, int position)
|
||||
{
|
||||
if (position < 0 || position >= Count)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (_places[position] == null)
|
||||
{
|
||||
_places[position] = antiaircraftgun;
|
||||
return true;
|
||||
}
|
||||
int index = position;
|
||||
while (_places[index] != null)
|
||||
{
|
||||
index++;
|
||||
}
|
||||
if (index == Count)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (int i = index; i > position; i--)
|
||||
{
|
||||
_places[i] = _places[i - 1];
|
||||
}
|
||||
_places[position] = antiaircraftgun;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Удаление объекта из набора с конкретной позиции
|
||||
public bool Remove(int position)
|
||||
{
|
||||
if (position < 0 || position >= Count)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
_places[position] = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Получение объекта из набора по позиции
|
||||
public T? Get(int position)
|
||||
{
|
||||
if (position < 0 || position >= Count)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return _places[position];
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using AntiAircraftGun.DrawningObjects;
|
||||
|
||||
namespace AntiAircraftGun.MovementStrategy
|
||||
{
|
||||
public abstract class AbstractStrategy
|
||||
{
|
||||
// Перемещаемый объект
|
||||
private IMoveableObject? _moveableObject;
|
||||
|
||||
// Статус перемещения
|
||||
private Status _state = Status.NotInit;
|
||||
|
||||
// Ширина поля
|
||||
protected int FieldWidth { get; private set; }
|
||||
|
||||
// Высота поля
|
||||
protected int FieldHeight { get; private set; }
|
||||
|
||||
// Статус перемещения
|
||||
public Status GetStatus() { return _state; }
|
||||
|
||||
// Установка данных
|
||||
public void SetData(IMoveableObject moveableObject, int width, int height)
|
||||
{
|
||||
if (moveableObject == null)
|
||||
{
|
||||
_state = Status.NotInit;
|
||||
return;
|
||||
}
|
||||
_state = Status.InProgress;
|
||||
_moveableObject = moveableObject;
|
||||
FieldWidth = width;
|
||||
FieldHeight = height;
|
||||
}
|
||||
|
||||
// Шаг перемещения
|
||||
public void MakeStep()
|
||||
{
|
||||
if (_state != Status.InProgress)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (IsTargetDestinaion())
|
||||
{
|
||||
_state = Status.Finish;
|
||||
return;
|
||||
}
|
||||
MoveToTarget();
|
||||
}
|
||||
|
||||
// Перемещение влево
|
||||
// результат перемещения(true - удалось, false - не удалось)
|
||||
protected bool MoveLeft() => MoveTo(DirectionType.Left);
|
||||
|
||||
// Перемещение вправо
|
||||
// результат перемещения(true - удалось, false - не удалось)
|
||||
protected bool MoveRight() => MoveTo(DirectionType.Right);
|
||||
|
||||
// Перемещение вверх
|
||||
// результат перемещения(true - удалось, false - не удалось)
|
||||
protected bool MoveUp() => MoveTo(DirectionType.Up);
|
||||
|
||||
// Перемещение вниз
|
||||
// результат перемещения(true - удалось, false - не удалось)
|
||||
protected bool MoveDown() => MoveTo(DirectionType.Down);
|
||||
|
||||
// Параметры объекта
|
||||
protected ObjectParameters? GetObjectParameters => _moveableObject?.GetObjectPosition;
|
||||
|
||||
// Шаг объекта
|
||||
protected int? GetStep()
|
||||
{
|
||||
if (_state != Status.InProgress)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return _moveableObject?.GetStep;
|
||||
}
|
||||
|
||||
// перемещение к цели
|
||||
protected abstract void MoveToTarget();
|
||||
protected abstract bool IsTargetDestinaion();
|
||||
|
||||
// Попытка перемещения в требуемом направлении
|
||||
// Результат попытки(true - удалось, false - не удалось)
|
||||
|
||||
private bool MoveTo(DirectionType directionType)
|
||||
{
|
||||
if (_state != Status.InProgress)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (_moveableObject?.CheckCanMove(directionType) ?? false)
|
||||
{
|
||||
_moveableObject.MoveObject(directionType);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using AntiAircraftGun.DrawningObjects;
|
||||
|
||||
namespace AntiAircraftGun.MovementStrategy
|
||||
{
|
||||
// Реализация интерфейса IDrawningObject для работы с объектом DrawningCar (паттерн Adapter)
|
||||
|
||||
public class DrawningObjectAircraftGun : IMoveableObject
|
||||
{
|
||||
private readonly DrawningAircraftGun? _drawningAircraftGun = null;
|
||||
|
||||
public DrawningObjectAircraftGun(DrawningAircraftGun drawningAircraftGun)
|
||||
{
|
||||
_drawningAircraftGun = drawningAircraftGun;
|
||||
}
|
||||
|
||||
public ObjectParameters? GetObjectPosition
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_drawningAircraftGun == null || _drawningAircraftGun.EntityAircraftGun == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new ObjectParameters(_drawningAircraftGun.GetPosX, _drawningAircraftGun.GetPosY, _drawningAircraftGun.GetWidth, _drawningAircraftGun.GetHeight);
|
||||
}
|
||||
}
|
||||
|
||||
public int GetStep => (int)(_drawningAircraftGun?.EntityAircraftGun?.Step ?? 0);
|
||||
|
||||
public bool CheckCanMove(DirectionType direction) => _drawningAircraftGun?.CanMove(direction) ?? false;
|
||||
|
||||
public void MoveObject(DirectionType direction) => _drawningAircraftGun?.MoveTransport(direction);
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using AntiAircraftGun.DrawningObjects;
|
||||
|
||||
namespace AntiAircraftGun.MovementStrategy
|
||||
{
|
||||
// Интерфейс для работы с перемещаемым объектом
|
||||
public interface IMoveableObject
|
||||
{
|
||||
// Поулчение координаты X объекта
|
||||
ObjectParameters? GetObjectPosition { get; }
|
||||
|
||||
// Шаг объекта
|
||||
int GetStep { get; }
|
||||
|
||||
// Првоерка, можно ли переместиться по нужному направлению
|
||||
bool CheckCanMove(DirectionType direction);
|
||||
|
||||
// Изменение направления перемещения объекта
|
||||
void MoveObject(DirectionType direction);
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AntiAircraftGun.MovementStrategy
|
||||
{
|
||||
// Стратегия перемещения объекта в правый нижний угол экрана
|
||||
public class MoveToBorder : AbstractStrategy
|
||||
{
|
||||
protected override bool IsTargetDestinaion()
|
||||
{
|
||||
var objParams = GetObjectParameters;
|
||||
if (objParams == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return objParams.RightBorder <= FieldWidth && objParams.RightBorder + GetStep() >= FieldWidth && objParams.DownBorder <= FieldHeight && objParams.DownBorder + GetStep() >= FieldHeight;
|
||||
}
|
||||
protected override void MoveToTarget()
|
||||
{
|
||||
var objParams = GetObjectParameters;
|
||||
if (objParams == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var diffX = objParams.ObjectMiddleHorizontal - FieldWidth;
|
||||
if (Math.Abs(diffX) > GetStep())
|
||||
{
|
||||
if (diffX > 0)
|
||||
{
|
||||
MoveLeft();
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveRight();
|
||||
}
|
||||
}
|
||||
var diffY = objParams.ObjectMiddleVertical - FieldHeight;
|
||||
if (Math.Abs(diffY) > GetStep())
|
||||
{
|
||||
if (diffY > 0)
|
||||
{
|
||||
MoveUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveDown();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AntiAircraftGun.MovementStrategy
|
||||
{
|
||||
// Стратегия перемещения объекта в центр экрана
|
||||
public class MoveToCenter : AbstractStrategy
|
||||
{
|
||||
protected override bool IsTargetDestinaion()
|
||||
{
|
||||
var objParams = GetObjectParameters;
|
||||
if (objParams == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return objParams.ObjectMiddleHorizontal <= FieldWidth / 2 && objParams.ObjectMiddleHorizontal + GetStep() >= FieldWidth / 2 && objParams.ObjectMiddleVertical <= FieldHeight / 2 && objParams.ObjectMiddleVertical + GetStep() >= FieldHeight / 2;
|
||||
}
|
||||
|
||||
protected override void MoveToTarget()
|
||||
{
|
||||
var objParams = GetObjectParameters;
|
||||
if (objParams == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var diffX = objParams.ObjectMiddleHorizontal - FieldWidth / 2;
|
||||
if (Math.Abs(diffX) > GetStep())
|
||||
{
|
||||
if (diffX > 0)
|
||||
{
|
||||
MoveLeft();
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveRight();
|
||||
}
|
||||
}
|
||||
var diffY = objParams.ObjectMiddleVertical - FieldHeight / 2;
|
||||
if (Math.Abs(diffY) > GetStep())
|
||||
{
|
||||
if (diffY > 0)
|
||||
{
|
||||
MoveUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveDown();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AntiAircraftGun.MovementStrategy
|
||||
{
|
||||
public class ObjectParameters
|
||||
{
|
||||
private readonly int _x;
|
||||
private readonly int _y;
|
||||
private readonly int _width;
|
||||
private readonly int _height;
|
||||
|
||||
// Левая граница
|
||||
public int LeftBorder => _x;
|
||||
// Верхняя граница
|
||||
public int TopBorder => _y;
|
||||
// Правая граница
|
||||
public int RightBorder => _x + _width;
|
||||
// Нижняя граница
|
||||
public int DownBorder => _y + _height;
|
||||
|
||||
// Середина объекта
|
||||
public int ObjectMiddleHorizontal => _x + _width / 2;
|
||||
// Середина объекта
|
||||
public int ObjectMiddleVertical => _y + _height / 2;
|
||||
|
||||
//Конструктор
|
||||
public ObjectParameters(int x, int y, int width, int height)
|
||||
{
|
||||
_x = x;
|
||||
_y = y;
|
||||
_width = width;
|
||||
_height = height;
|
||||
}
|
||||
}
|
||||
}
|
16
AntiAircraftGun/AntiAircraftGun/MovementStrategy/Status.cs
Normal file
16
AntiAircraftGun/AntiAircraftGun/MovementStrategy/Status.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AntiAircraftGun.MovementStrategy
|
||||
{
|
||||
//Статус выполнения операции перемещения
|
||||
public enum Status
|
||||
{
|
||||
NotInit,
|
||||
InProgress,
|
||||
Finish
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@ namespace AntiAircraftGun
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new Form1());
|
||||
Application.Run(new FormAircraftGunCollection());
|
||||
}
|
||||
}
|
||||
}
|
103
AntiAircraftGun/AntiAircraftGun/Properties/Resources.Designer.cs
generated
Normal file
103
AntiAircraftGun/AntiAircraftGun/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,103 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace AntiAircraftGun.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
|
||||
/// </summary>
|
||||
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
|
||||
// с помощью такого средства, как ResGen или Visual Studio.
|
||||
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
|
||||
// с параметром /str или перестройте свой проект VS.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AntiAircraftGun.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
|
||||
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap arrowDown {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("arrowDown", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap arrowLeft {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("arrowLeft", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap arrowRight {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("arrowRight", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap arrowUp {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("arrowUp", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -117,4 +117,17 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="arrowDown" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\arrowDown.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="arrowLeft" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\arrowLeft.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="arrowRight" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\arrowRight.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="arrowUp" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\arrowUp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
BIN
AntiAircraftGun/AntiAircraftGun/Resources/arrowDown.png
Normal file
BIN
AntiAircraftGun/AntiAircraftGun/Resources/arrowDown.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 418 B |
BIN
AntiAircraftGun/AntiAircraftGun/Resources/arrowLeft.png
Normal file
BIN
AntiAircraftGun/AntiAircraftGun/Resources/arrowLeft.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 362 B |
BIN
AntiAircraftGun/AntiAircraftGun/Resources/arrowRight.png
Normal file
BIN
AntiAircraftGun/AntiAircraftGun/Resources/arrowRight.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 428 B |
BIN
AntiAircraftGun/AntiAircraftGun/Resources/arrowUp.png
Normal file
BIN
AntiAircraftGun/AntiAircraftGun/Resources/arrowUp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 412 B |
Loading…
Reference in New Issue
Block a user