Compare commits
33 Commits
Author | SHA1 | Date | |
---|---|---|---|
3914bd51bb | |||
6ead695eac | |||
9b21f4a1ef | |||
c63daba830 | |||
1377cdaa77 | |||
350c0b31ea | |||
970eb473e5 | |||
4965346ea3 | |||
10edf8895b | |||
7b693f5fd7 | |||
f36062d9d8 | |||
f89e86bd93 | |||
73923d880e | |||
0cc4d81353 | |||
95b5a05be4 | |||
5d3f5731c3 | |||
5fb2d43e03 | |||
91a8bca853 | |||
203daf9a16 | |||
58872d7938 | |||
6e4ffe95d8 | |||
e9ec3ff774 | |||
4c46170f09 | |||
d5b447bf0f | |||
4bc51728fe | |||
d17975562c | |||
821102b9ed | |||
2419848c25 | |||
d9c313d1bf | |||
a0db4e8315 | |||
b48aa06661 | |||
cb138fd554 | |||
9512284e54 |
@ -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>
|
@ -1,9 +1,9 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.4.33110.190
|
||||
VisualStudioVersion = 17.5.33530.505
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AntiAirCraftGun", "AntiAirCraftGun\AntiAirCraftGun.csproj", "{FB18B709-9154-45E0-8BD8-28822B29FB4B}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AntiAircraftGun", "AntiAircraftGun.csproj", "{40C43023-14E0-4146-82EE-7A5A7384992F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -11,15 +11,15 @@ Global
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{FB18B709-9154-45E0-8BD8-28822B29FB4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FB18B709-9154-45E0-8BD8-28822B29FB4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FB18B709-9154-45E0-8BD8-28822B29FB4B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FB18B709-9154-45E0-8BD8-28822B29FB4B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{40C43023-14E0-4146-82EE-7A5A7384992F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{40C43023-14E0-4146-82EE-7A5A7384992F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{40C43023-14E0-4146-82EE-7A5A7384992F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{40C43023-14E0-4146-82EE-7A5A7384992F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {EB48B08E-3934-47B3-94AF-DF58D18CDB32}
|
||||
SolutionGuid = {990D8FF3-8567-49C7-90F4-1811AB7EB423}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
29
AntiAirCraftGun/AntiAirCraftGun/DirectionType.cs
Normal file
29
AntiAirCraftGun/AntiAirCraftGun/DirectionType.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AntiAircraftGun
|
||||
{
|
||||
public enum DirectionType
|
||||
{
|
||||
/// <summary>
|
||||
/// Вверх
|
||||
/// </summary>
|
||||
Up = 1,
|
||||
/// <summary>
|
||||
/// Вниз
|
||||
/// </summary>
|
||||
Down = 2,
|
||||
/// <summary>
|
||||
/// Влево
|
||||
/// </summary>
|
||||
Left = 3,
|
||||
/// <summary>
|
||||
/// Вправо
|
||||
/// </summary>
|
||||
Right = 4
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using AntiAircraftGun.Enitites;
|
||||
using static System.Windows.Forms.AxHost;
|
||||
|
||||
namespace AntiAircraftGun.DrawingObjects
|
||||
{
|
||||
public class AdvancedDrawingAntiAirCraftGun : BaseDrawingAntiAirCraftGun
|
||||
{
|
||||
private Point[] points = new Point[4];
|
||||
|
||||
public AdvancedDrawingAntiAirCraftGun(int speed, double weight, Color bodyColor, Color additionalColor, Color dopColor, bool rocket,bool radar, int width, int height) :
|
||||
base(speed, weight, bodyColor, additionalColor, width, height)
|
||||
{
|
||||
if (AntiAirСraftGun!=null)
|
||||
{
|
||||
AntiAirСraftGun = new EntityAdvancedAntiAirCraftGun(speed, weight, bodyColor, additionalColor, dopColor, rocket, radar);
|
||||
}
|
||||
}
|
||||
public void ChangeAddColor(Color col)
|
||||
{
|
||||
if (AntiAirСraftGun!=null)
|
||||
{
|
||||
((EntityAdvancedAntiAirCraftGun)AntiAirСraftGun).DopColor = col;
|
||||
}
|
||||
}
|
||||
public override void DrawTransport(Graphics g)
|
||||
{
|
||||
if (AntiAirСraftGun is not EntityAdvancedAntiAirCraftGun advancedGun)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Pen pen = new Pen(Color.Black);
|
||||
Brush bodyBrush = new SolidBrush(AntiAirСraftGun.BodyColor);
|
||||
Brush additionalBrush = new SolidBrush(AntiAirСraftGun.AdditionalColor);
|
||||
base.DrawTransport(g);
|
||||
Brush dopBrush = new SolidBrush(advancedGun.DopColor);
|
||||
Pen dopPen = new Pen(advancedGun.DopColor);
|
||||
if (advancedGun.Rocket)
|
||||
{
|
||||
points[0] = new Point(_startPosX, _startPosY + 30);
|
||||
points[1] = new Point(_startPosX + 95, _startPosY + 5);
|
||||
points[2] = new Point(_startPosX + 92, _startPosY);
|
||||
points[3] = new Point(_startPosX, _startPosY + 25);
|
||||
g.FillPolygon(dopBrush, points);
|
||||
g.DrawPolygon(pen, points);
|
||||
}
|
||||
if (advancedGun.Radar)
|
||||
{
|
||||
g.DrawLine(dopPen, _startPosX + 105, _startPosY + 20, _startPosX +105, _startPosY + 5);
|
||||
g.FillPie(dopBrush, _startPosX + 81, _startPosY-15, 30, 30, -45, 180);
|
||||
g.DrawLine(dopPen, _startPosX + 98, _startPosY , _startPosX + 93, _startPosY + 10);
|
||||
g.FillEllipse(dopBrush, _startPosX + 88, _startPosY -10, 10, 10);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,163 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using AntiAircraftGun.Enitites;
|
||||
using AntiAircraftGun.MovementStrategy;
|
||||
|
||||
namespace AntiAircraftGun.DrawingObjects
|
||||
{
|
||||
public class BaseDrawingAntiAirCraftGun
|
||||
{
|
||||
public EntityAntiAirCraftGun? AntiAirСraftGun { get; protected set; }
|
||||
private int _pictureWidth;
|
||||
private int _pictureHeight;
|
||||
protected int _startPosX;
|
||||
protected int _startPosY;
|
||||
protected int _zenitWidth = 110;
|
||||
protected int _zenitHeight = 60;
|
||||
|
||||
public BaseDrawingAntiAirCraftGun(int speed, double weight, Color bodyColor, Color additionalColor, int width, int height)
|
||||
{
|
||||
if (width <= _zenitWidth || height <= _zenitHeight)
|
||||
return;
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
AntiAirСraftGun = new EntityAntiAirCraftGun(speed, weight, bodyColor, additionalColor);
|
||||
}
|
||||
|
||||
protected BaseDrawingAntiAirCraftGun(int speed, double weight, Color bodyColor, Color additionalColor, int width, int height, int carWidth, int carHeight)
|
||||
{
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
_zenitWidth = carWidth;
|
||||
_zenitHeight = carHeight;
|
||||
AntiAirСraftGun = new EntityAntiAirCraftGun(speed, weight, bodyColor, additionalColor);
|
||||
}
|
||||
|
||||
public void SetPosition(int x, int y)
|
||||
{
|
||||
if (AntiAirСraftGun == null) return;
|
||||
_startPosX = x;
|
||||
_startPosY = y;
|
||||
if (x < 0 || y < 0 || x + _zenitWidth >= _pictureWidth || y + _zenitHeight >= _pictureHeight)
|
||||
{
|
||||
_startPosX = 1;
|
||||
_startPosY = 1;
|
||||
}
|
||||
|
||||
}
|
||||
public void ChangeColor(Color col)
|
||||
{
|
||||
if (AntiAirСraftGun == null)
|
||||
return;
|
||||
AntiAirСraftGun.BodyColor = col;
|
||||
}
|
||||
public void ChangePictureBoxSize(int pictureBoxWidth, int pictureBoxHeight)
|
||||
{
|
||||
_pictureHeight = pictureBoxHeight;
|
||||
_pictureWidth = pictureBoxWidth;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Координата X объекта
|
||||
/// </summary>
|
||||
public int GetPosX => _startPosX;
|
||||
/// <summary>
|
||||
/// Координата Y объекта
|
||||
/// </summary>
|
||||
public int GetPosY => _startPosY;
|
||||
/// <summary>
|
||||
/// Ширина объекта
|
||||
/// </summary>
|
||||
public int GetWidth => _zenitWidth;
|
||||
/// <summary>
|
||||
/// Высота объекта
|
||||
/// </summary>
|
||||
public int GetHeight => _zenitHeight;
|
||||
|
||||
/// <summary>
|
||||
/// Проверка, что объект может переместится по указанному направлению
|
||||
/// </summary>
|
||||
/// <param name="direction">Направление</param>
|
||||
/// <returns>true - можно переместится по указанному направлению</returns>
|
||||
public bool CanMove(DirectionType direction)
|
||||
{
|
||||
if (AntiAirСraftGun == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return direction switch
|
||||
{
|
||||
//влево
|
||||
DirectionType.Left => _startPosX - AntiAirСraftGun.Step > 0,
|
||||
//вверх
|
||||
DirectionType.Up => _startPosY - AntiAirСraftGun.Step > 0,
|
||||
// вправо
|
||||
DirectionType.Right =>_startPosX + AntiAirСraftGun.Step + _zenitWidth < _pictureWidth,
|
||||
//вниз
|
||||
DirectionType.Down => _startPosY + AntiAirСraftGun.Step + _zenitHeight< _pictureHeight,
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
/// <summary>
|
||||
/// Изменение направления перемещения
|
||||
/// </summary>
|
||||
/// <param name="direction">Направление</param>
|
||||
public void MoveTransport(DirectionType direction)
|
||||
{
|
||||
if (!CanMove(direction) || AntiAirСraftGun == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (direction)
|
||||
{
|
||||
//влево
|
||||
case DirectionType.Left:
|
||||
_startPosX -= (int)AntiAirСraftGun.Step;
|
||||
break;
|
||||
//вверх
|
||||
case DirectionType.Up:
|
||||
_startPosY -= (int)AntiAirСraftGun.Step;
|
||||
break;
|
||||
// вправо
|
||||
case DirectionType.Right:
|
||||
_startPosX += (int)AntiAirСraftGun.Step;
|
||||
break;
|
||||
//вниз
|
||||
case DirectionType.Down:
|
||||
_startPosY += (int)AntiAirСraftGun.Step;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void DrawTransport(Graphics g)
|
||||
{
|
||||
|
||||
|
||||
Pen pen = Pens.Black;
|
||||
Brush bodyBrush = new SolidBrush(AntiAirСraftGun.BodyColor);
|
||||
Brush additionalBrush = new SolidBrush(AntiAirСraftGun.AdditionalColor);
|
||||
|
||||
g.FillEllipse(additionalBrush, _startPosX, _startPosY + 40, 110, 10);
|
||||
g.DrawEllipse(pen, _startPosX, _startPosY + 40, 110, 10);
|
||||
g.FillRectangle(bodyBrush, _startPosX, _startPosY + 30, 110, 10);
|
||||
g.DrawRectangle(pen, _startPosX, _startPosY + 30, 110, 10);
|
||||
g.FillRectangle(bodyBrush, _startPosX + 80, _startPosY + 10, 30, 20);
|
||||
g.DrawRectangle(pen, _startPosX + 80, _startPosY + 10, 30, 20);
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
Rectangle trackRect = new Rectangle(_startPosX + 20 + i * 19, _startPosY + 40, 10, 10);
|
||||
g.DrawEllipse(pen, trackRect);
|
||||
g.FillEllipse(Brushes.Black, trackRect);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Получение объекта IMoveableObject из объекта DrawningCar
|
||||
/// </summary>
|
||||
public IMoveableObject GetMoveableObject => new DrawingObjectAntiAirCraftGun(this);
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
using AntiAircraftGun.Enitites;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AntiAircraftGun.DrawingObjects
|
||||
{
|
||||
public static class ExtentionDrawningAntiAirCraftGun
|
||||
{
|
||||
public static BaseDrawingAntiAirCraftGun? CreateDrawningAntiAirCraftGun(this string info, char separatorForObject,int width, int height)
|
||||
{
|
||||
string[] strs = info.Split(separatorForObject);
|
||||
if (strs.Length == 4)
|
||||
{
|
||||
return new BaseDrawingAntiAirCraftGun(Convert.ToInt32(strs[0]),
|
||||
Convert.ToInt32(strs[1]), Color.FromName(strs[2]), Color.FromName(strs[3]),
|
||||
width, height);
|
||||
}
|
||||
if (strs.Length == 7)
|
||||
{
|
||||
return new AdvancedDrawingAntiAirCraftGun(Convert.ToInt32(strs[0]),
|
||||
Convert.ToInt32(strs[1]), Color.FromName(strs[2]), Color.FromName(strs[3]),
|
||||
Color.FromName(strs[4]), Convert.ToBoolean(strs[5]), Convert.ToBoolean(strs[6]), width, height);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static string GetDataForSave(this BaseDrawingAntiAirCraftGun drawningAntiAirCraftGun, char separatorForObject)
|
||||
{
|
||||
var zenit = drawningAntiAirCraftGun.AntiAirСraftGun;
|
||||
if (zenit == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
var str = $"{zenit.Speed}{separatorForObject}{zenit.Weight}{separatorForObject}{zenit.BodyColor.Name}{separatorForObject}{zenit.AdditionalColor.Name}";
|
||||
if (zenit is not EntityAdvancedAntiAirCraftGun antiAirCraftGun)
|
||||
{
|
||||
return str;
|
||||
}
|
||||
return
|
||||
$"{str}{separatorForObject}{antiAirCraftGun.DopColor.Name}{separatorForObject}{antiAirCraftGun.Radar}{separatorForObject}{antiAirCraftGun.Rocket}";
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AntiAircraftGun.Enitites
|
||||
{
|
||||
public class EntityAdvancedAntiAirCraftGun : EntityAntiAirCraftGun
|
||||
{
|
||||
|
||||
public Color DopColor { get; set; }
|
||||
|
||||
public bool Rocket { get; private set; }
|
||||
|
||||
public bool Radar { get; private set; }
|
||||
|
||||
|
||||
|
||||
public EntityAdvancedAntiAirCraftGun(int speed, double weight, Color bodyColor, Color additionalColor,Color dopColor, bool rocket, bool radar)
|
||||
: base(speed, weight, bodyColor, additionalColor)
|
||||
{
|
||||
DopColor = dopColor;
|
||||
Rocket = rocket;
|
||||
Radar = radar;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AntiAircraftGun.Enitites
|
||||
{
|
||||
public class EntityAntiAirCraftGun
|
||||
{
|
||||
/// <summary>
|
||||
/// Скорость
|
||||
/// </summary>
|
||||
public int Speed { get; private set; }
|
||||
/// <summary>
|
||||
/// Вес
|
||||
/// </summary>
|
||||
public double Weight { get; private set; }
|
||||
/// <summary>
|
||||
/// Основной цвет
|
||||
/// </summary>
|
||||
public Color BodyColor { get; set; }
|
||||
/// <summary>
|
||||
/// Шаг перемещения автомобиля
|
||||
/// </summary>
|
||||
public Color AdditionalColor { get; set; }
|
||||
/// <summary>
|
||||
/// Шаг перемещения автомобиля
|
||||
/// </summary>
|
||||
public double Step => (double)Speed * 100 / Weight;
|
||||
/// <summary>
|
||||
/// Конструктор с параметрами
|
||||
/// </summary>
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="weight">Вес автомобиля</param>
|
||||
/// <param name="bodyColor">Основной цвет</param>
|
||||
public EntityAntiAirCraftGun(int speed, double weight, Color bodyColor, Color additionalColor)
|
||||
{
|
||||
Speed = speed;
|
||||
Weight = weight;
|
||||
BodyColor = bodyColor;
|
||||
AdditionalColor = additionalColor;
|
||||
}
|
||||
}
|
||||
}
|
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();
|
||||
}
|
||||
}
|
||||
}
|
193
AntiAirCraftGun/AntiAirCraftGun/FormAntiAirCraftGun.Designer.cs
generated
Normal file
193
AntiAirCraftGun/AntiAirCraftGun/FormAntiAirCraftGun.Designer.cs
generated
Normal file
@ -0,0 +1,193 @@
|
||||
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.pictureBoxAntiAircraftGun = new System.Windows.Forms.PictureBox();
|
||||
this.CreateAdavancedAntiAirCraftGun = new System.Windows.Forms.Button();
|
||||
this.buttonLeft = new System.Windows.Forms.Button();
|
||||
this.buttonUp = new System.Windows.Forms.Button();
|
||||
this.buttonRight = new System.Windows.Forms.Button();
|
||||
this.buttonDown = new System.Windows.Forms.Button();
|
||||
this.comboBoxStrategy = new System.Windows.Forms.ComboBox();
|
||||
this.CreateAntiAirCraftGun = new System.Windows.Forms.Button();
|
||||
this.Step = new System.Windows.Forms.Button();
|
||||
this.ButtonSelectZenit = new System.Windows.Forms.Button();
|
||||
this.colorDialog1 = new System.Windows.Forms.ColorDialog();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxAntiAircraftGun)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// 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(1491, 628);
|
||||
this.pictureBoxAntiAircraftGun.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
|
||||
this.pictureBoxAntiAircraftGun.TabIndex = 0;
|
||||
this.pictureBoxAntiAircraftGun.TabStop = false;
|
||||
//
|
||||
// CreateAdavancedAntiAirCraftGun
|
||||
//
|
||||
this.CreateAdavancedAntiAirCraftGun.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.CreateAdavancedAntiAirCraftGun.Location = new System.Drawing.Point(32, 577);
|
||||
this.CreateAdavancedAntiAirCraftGun.Name = "CreateAdavancedAntiAirCraftGun";
|
||||
this.CreateAdavancedAntiAirCraftGun.Size = new System.Drawing.Size(183, 23);
|
||||
this.CreateAdavancedAntiAirCraftGun.TabIndex = 1;
|
||||
this.CreateAdavancedAntiAirCraftGun.Text = "Создать с дополнениями";
|
||||
this.CreateAdavancedAntiAirCraftGun.UseVisualStyleBackColor = true;
|
||||
this.CreateAdavancedAntiAirCraftGun.Click += new System.EventHandler(this.CreateAdvancedAintiAirCraftGun_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.strelkaLeft;
|
||||
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.buttonLeft.Location = new System.Drawing.Point(1265, 562);
|
||||
this.buttonLeft.Name = "buttonLeft";
|
||||
this.buttonLeft.Size = new System.Drawing.Size(30, 30);
|
||||
this.buttonLeft.TabIndex = 2;
|
||||
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 = global::AntiAircraftGun.Properties.Resources.strelkaTop;
|
||||
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.buttonUp.Location = new System.Drawing.Point(1301, 526);
|
||||
this.buttonUp.Name = "buttonUp";
|
||||
this.buttonUp.Size = new System.Drawing.Size(30, 30);
|
||||
this.buttonUp.TabIndex = 3;
|
||||
this.buttonUp.UseVisualStyleBackColor = true;
|
||||
this.buttonUp.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.strelkaRight;
|
||||
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.buttonRight.Location = new System.Drawing.Point(1337, 562);
|
||||
this.buttonRight.Name = "buttonRight";
|
||||
this.buttonRight.Size = new System.Drawing.Size(30, 30);
|
||||
this.buttonRight.TabIndex = 4;
|
||||
this.buttonRight.UseVisualStyleBackColor = true;
|
||||
this.buttonRight.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.strelkaDown;
|
||||
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.buttonDown.Location = new System.Drawing.Point(1301, 562);
|
||||
this.buttonDown.Name = "buttonDown";
|
||||
this.buttonDown.Size = new System.Drawing.Size(30, 30);
|
||||
this.buttonDown.TabIndex = 5;
|
||||
this.buttonDown.UseVisualStyleBackColor = true;
|
||||
this.buttonDown.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||
//
|
||||
// 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(1244, 28);
|
||||
this.comboBoxStrategy.Name = "comboBoxStrategy";
|
||||
this.comboBoxStrategy.Size = new System.Drawing.Size(170, 23);
|
||||
this.comboBoxStrategy.TabIndex = 6;
|
||||
//
|
||||
// CreateAntiAirCraftGun
|
||||
//
|
||||
this.CreateAntiAirCraftGun.Location = new System.Drawing.Point(221, 577);
|
||||
this.CreateAntiAirCraftGun.Name = "CreateAntiAirCraftGun";
|
||||
this.CreateAntiAirCraftGun.Size = new System.Drawing.Size(185, 23);
|
||||
this.CreateAntiAirCraftGun.TabIndex = 7;
|
||||
this.CreateAntiAirCraftGun.Text = "Создать обычный";
|
||||
this.CreateAntiAirCraftGun.UseVisualStyleBackColor = true;
|
||||
this.CreateAntiAirCraftGun.Click += new System.EventHandler(this.CreateAntiAirCraftGun_Click);
|
||||
//
|
||||
// Step
|
||||
//
|
||||
this.Step.Location = new System.Drawing.Point(1323, 61);
|
||||
this.Step.Name = "Step";
|
||||
this.Step.Size = new System.Drawing.Size(75, 23);
|
||||
this.Step.TabIndex = 8;
|
||||
this.Step.Text = "Шаг";
|
||||
this.Step.UseVisualStyleBackColor = true;
|
||||
this.Step.Click += new System.EventHandler(this.ButtonStep_Click);
|
||||
//
|
||||
// ButtonSelectZenit
|
||||
//
|
||||
this.ButtonSelectZenit.Location = new System.Drawing.Point(412, 577);
|
||||
this.ButtonSelectZenit.Name = "ButtonSelectZenit";
|
||||
this.ButtonSelectZenit.Size = new System.Drawing.Size(157, 23);
|
||||
this.ButtonSelectZenit.TabIndex = 9;
|
||||
this.ButtonSelectZenit.Text = "Выбрать объект";
|
||||
this.ButtonSelectZenit.UseVisualStyleBackColor = true;
|
||||
this.ButtonSelectZenit.Click += new System.EventHandler(this.ButtonSelectZenit_Click);
|
||||
//
|
||||
// FormAntiAirCraftGun
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1491, 628);
|
||||
this.Controls.Add(this.ButtonSelectZenit);
|
||||
this.Controls.Add(this.Step);
|
||||
this.Controls.Add(this.CreateAntiAirCraftGun);
|
||||
this.Controls.Add(this.comboBoxStrategy);
|
||||
this.Controls.Add(this.buttonDown);
|
||||
this.Controls.Add(this.buttonRight);
|
||||
this.Controls.Add(this.buttonUp);
|
||||
this.Controls.Add(this.buttonLeft);
|
||||
this.Controls.Add(this.CreateAdavancedAntiAirCraftGun);
|
||||
this.Controls.Add(this.pictureBoxAntiAircraftGun);
|
||||
this.Name = "FormAntiAirCraftGun";
|
||||
this.Text = "FormAntiAirCraftGun";
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxAntiAircraftGun)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private PictureBox pictureBoxAntiAircraftGun;
|
||||
private Button CreateAdavancedAntiAirCraftGun;
|
||||
private Button buttonLeft;
|
||||
private Button buttonUp;
|
||||
private Button buttonRight;
|
||||
private Button buttonDown;
|
||||
private ComboBox comboBoxStrategy;
|
||||
private Button CreateAntiAirCraftGun;
|
||||
private Button Step;
|
||||
private Button ButtonSelectZenit;
|
||||
private ColorDialog colorDialog1;
|
||||
}
|
||||
}
|
149
AntiAirCraftGun/AntiAirCraftGun/FormAntiAirCraftGun.cs
Normal file
149
AntiAirCraftGun/AntiAirCraftGun/FormAntiAirCraftGun.cs
Normal file
@ -0,0 +1,149 @@
|
||||
using AntiAircraftGun.DrawingObjects;
|
||||
using AntiAircraftGun.MovementStrategy;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
|
||||
|
||||
namespace AntiAircraftGun
|
||||
{
|
||||
public partial class FormAntiAirCraftGun : Form
|
||||
{
|
||||
private BaseDrawingAntiAirCraftGun _drawingAntiAirCraftGun;
|
||||
|
||||
private AbstractStrategy? _abstractStrategy;
|
||||
|
||||
public BaseDrawingAntiAirCraftGun? SelectedZenit { get; private set; }
|
||||
public FormAntiAirCraftGun()
|
||||
{
|
||||
InitializeComponent();
|
||||
_abstractStrategy = null;
|
||||
SelectedZenit = null;
|
||||
}
|
||||
|
||||
private void ButtonMove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawingAntiAirCraftGun == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
string name = ((Button)sender)?.Name ?? string.Empty;
|
||||
switch (name)
|
||||
{
|
||||
case "buttonUp":
|
||||
_drawingAntiAirCraftGun.MoveTransport(DirectionType.Up);
|
||||
break;
|
||||
case "buttonDown":
|
||||
_drawingAntiAirCraftGun.MoveTransport(DirectionType.Down);
|
||||
break;
|
||||
case "buttonLeft":
|
||||
_drawingAntiAirCraftGun.MoveTransport(DirectionType.Left);
|
||||
break;
|
||||
case "buttonRight":
|
||||
_drawingAntiAirCraftGun.MoveTransport(DirectionType.Right);
|
||||
break;
|
||||
}
|
||||
Draw();
|
||||
}
|
||||
private void Draw()
|
||||
{
|
||||
if (_drawingAntiAirCraftGun == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Bitmap bmp = new Bitmap(pictureBoxAntiAircraftGun.Width, pictureBoxAntiAircraftGun.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_drawingAntiAirCraftGun.DrawTransport(gr);
|
||||
pictureBoxAntiAircraftGun.Image = bmp;
|
||||
}
|
||||
|
||||
private void CreateAdvancedAintiAirCraftGun_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new Random();
|
||||
Color bodyColor = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)); // Îñíîâíîé öâåò
|
||||
Color additionalColor = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
||||
Color dopColor = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)); // Äîï. öâåò äëÿ EntityAdvancedAntiAircraftGun
|
||||
ColorDialog dialog = new();
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
bodyColor = dialog.Color;
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
dopColor = dialog.Color;
|
||||
_drawingAntiAirCraftGun = new AdvancedDrawingAntiAirCraftGun(
|
||||
random.Next(100, 300), // Ñêîðîñòü
|
||||
random.Next(1000, 3000), // Âåñ
|
||||
bodyColor, additionalColor, dopColor,
|
||||
Convert.ToBoolean(random.Next(2)), // Rocket
|
||||
Convert.ToBoolean(random.Next(2)),
|
||||
pictureBoxAntiAircraftGun.Width,
|
||||
pictureBoxAntiAircraftGun.Height
|
||||
);
|
||||
|
||||
_drawingAntiAirCraftGun.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
Draw();
|
||||
}
|
||||
|
||||
private void CreateAntiAirCraftGun_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new Random();
|
||||
Color bodyColor = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)); // Îñíîâíîé öâåò
|
||||
Color additionalColor = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)); // Äîï. öâåò
|
||||
ColorDialog dialog = new();
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
bodyColor = dialog.Color;
|
||||
}
|
||||
_drawingAntiAirCraftGun = new BaseDrawingAntiAirCraftGun(
|
||||
random.Next(100, 300), // Ñêîðîñòü
|
||||
random.Next(1000, 3000), // Âåñ
|
||||
bodyColor, additionalColor,
|
||||
pictureBoxAntiAircraftGun.Width,
|
||||
pictureBoxAntiAircraftGun.Height
|
||||
);
|
||||
|
||||
_drawingAntiAirCraftGun.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
Draw();
|
||||
}
|
||||
|
||||
private void ButtonStep_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawingAntiAirCraftGun == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (comboBoxStrategy.Enabled)
|
||||
{
|
||||
_abstractStrategy = comboBoxStrategy.SelectedIndex
|
||||
switch
|
||||
{
|
||||
0 => new MoveToCenter(),
|
||||
1 => new MoveToBorder(),
|
||||
_ => null,
|
||||
};
|
||||
if (_abstractStrategy == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_abstractStrategy.SetData(new
|
||||
DrawingObjectAntiAirCraftGun(_drawingAntiAirCraftGun), pictureBoxAntiAircraftGun.Width,
|
||||
pictureBoxAntiAircraftGun.Height);
|
||||
comboBoxStrategy.Enabled = false;
|
||||
}
|
||||
if (_abstractStrategy == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_abstractStrategy.MakeStep();
|
||||
Draw();
|
||||
if (_abstractStrategy.GetStatus() == Status.Finish)
|
||||
{
|
||||
comboBoxStrategy.Enabled = true;
|
||||
_abstractStrategy = null;
|
||||
}
|
||||
|
||||
}
|
||||
private void ButtonSelectZenit_Click(object sender, EventArgs e)
|
||||
{
|
||||
SelectedZenit = _drawingAntiAirCraftGun;
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
63
AntiAirCraftGun/AntiAirCraftGun/FormAntiAirCraftGun.resx
Normal file
63
AntiAirCraftGun/AntiAirCraftGun/FormAntiAirCraftGun.resx
Normal file
@ -0,0 +1,63 @@
|
||||
<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>
|
||||
<metadata name="colorDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
246
AntiAirCraftGun/AntiAirCraftGun/FormAntiAirCraftGunCollection.Designer.cs
generated
Normal file
246
AntiAirCraftGun/AntiAirCraftGun/FormAntiAirCraftGunCollection.Designer.cs
generated
Normal file
@ -0,0 +1,246 @@
|
||||
namespace AntiAircraftGun
|
||||
{
|
||||
partial class FormAntiAirCraftGunCollection
|
||||
{
|
||||
/// <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.pictureBoxCollection = new System.Windows.Forms.PictureBox();
|
||||
this.panelTools = new System.Windows.Forms.Panel();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.textBoxStorageName = new System.Windows.Forms.TextBox();
|
||||
this.listBoxStorages = new System.Windows.Forms.ListBox();
|
||||
this.buttonAddCollection = new System.Windows.Forms.Button();
|
||||
this.buttonDelCollection = new System.Windows.Forms.Button();
|
||||
this.maskedTextBoxNumber = new System.Windows.Forms.TextBox();
|
||||
this.buttonUpdateColletion = new System.Windows.Forms.Button();
|
||||
this.buttonDeleteZenit = new System.Windows.Forms.Button();
|
||||
this.buttonAddZenit = new System.Windows.Forms.Button();
|
||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
this.toolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SaveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.LoadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
|
||||
this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).BeginInit();
|
||||
this.panelTools.SuspendLayout();
|
||||
this.panel1.SuspendLayout();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// pictureBoxCollection
|
||||
//
|
||||
this.pictureBoxCollection.Location = new System.Drawing.Point(12, 50);
|
||||
this.pictureBoxCollection.Name = "pictureBoxCollection";
|
||||
this.pictureBoxCollection.Size = new System.Drawing.Size(711, 571);
|
||||
this.pictureBoxCollection.TabIndex = 0;
|
||||
this.pictureBoxCollection.TabStop = false;
|
||||
//
|
||||
// panelTools
|
||||
//
|
||||
this.panelTools.Controls.Add(this.panel1);
|
||||
this.panelTools.Controls.Add(this.maskedTextBoxNumber);
|
||||
this.panelTools.Controls.Add(this.buttonUpdateColletion);
|
||||
this.panelTools.Controls.Add(this.buttonDeleteZenit);
|
||||
this.panelTools.Controls.Add(this.buttonAddZenit);
|
||||
this.panelTools.Location = new System.Drawing.Point(729, 50);
|
||||
this.panelTools.Name = "panelTools";
|
||||
this.panelTools.Size = new System.Drawing.Size(234, 568);
|
||||
this.panelTools.TabIndex = 1;
|
||||
this.panelTools.Tag = "";
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.textBoxStorageName);
|
||||
this.panel1.Controls.Add(this.listBoxStorages);
|
||||
this.panel1.Controls.Add(this.buttonAddCollection);
|
||||
this.panel1.Controls.Add(this.buttonDelCollection);
|
||||
this.panel1.Location = new System.Drawing.Point(15, 52);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(215, 294);
|
||||
this.panel1.TabIndex = 8;
|
||||
this.panel1.Tag = "Наборы";
|
||||
//
|
||||
// textBoxStorageName
|
||||
//
|
||||
this.textBoxStorageName.Location = new System.Drawing.Point(12, 53);
|
||||
this.textBoxStorageName.Name = "textBoxStorageName";
|
||||
this.textBoxStorageName.Size = new System.Drawing.Size(193, 23);
|
||||
this.textBoxStorageName.TabIndex = 7;
|
||||
//
|
||||
// listBoxStorages
|
||||
//
|
||||
this.listBoxStorages.FormattingEnabled = true;
|
||||
this.listBoxStorages.ItemHeight = 15;
|
||||
this.listBoxStorages.Location = new System.Drawing.Point(12, 137);
|
||||
this.listBoxStorages.Name = "listBoxStorages";
|
||||
this.listBoxStorages.Size = new System.Drawing.Size(191, 94);
|
||||
this.listBoxStorages.TabIndex = 6;
|
||||
this.listBoxStorages.SelectedIndexChanged += new System.EventHandler(this.ListBoxObjects_SelectedIndexChanged);
|
||||
//
|
||||
// buttonAddCollection
|
||||
//
|
||||
this.buttonAddCollection.Location = new System.Drawing.Point(10, 92);
|
||||
this.buttonAddCollection.Name = "buttonAddCollection";
|
||||
this.buttonAddCollection.Size = new System.Drawing.Size(193, 40);
|
||||
this.buttonAddCollection.TabIndex = 5;
|
||||
this.buttonAddCollection.Text = "Добавить набор";
|
||||
this.buttonAddCollection.UseVisualStyleBackColor = true;
|
||||
this.buttonAddCollection.Click += new System.EventHandler(this.ButtonAddObject_Click);
|
||||
//
|
||||
// buttonDelCollection
|
||||
//
|
||||
this.buttonDelCollection.Location = new System.Drawing.Point(12, 249);
|
||||
this.buttonDelCollection.Name = "buttonDelCollection";
|
||||
this.buttonDelCollection.Size = new System.Drawing.Size(193, 40);
|
||||
this.buttonDelCollection.TabIndex = 4;
|
||||
this.buttonDelCollection.Text = "Удалить набор";
|
||||
this.buttonDelCollection.UseVisualStyleBackColor = true;
|
||||
this.buttonDelCollection.Click += new System.EventHandler(this.ButtonDelObject_Click);
|
||||
//
|
||||
// maskedTextBoxNumber
|
||||
//
|
||||
this.maskedTextBoxNumber.Location = new System.Drawing.Point(23, 435);
|
||||
this.maskedTextBoxNumber.Name = "maskedTextBoxNumber";
|
||||
this.maskedTextBoxNumber.Size = new System.Drawing.Size(193, 23);
|
||||
this.maskedTextBoxNumber.TabIndex = 3;
|
||||
//
|
||||
// buttonUpdateColletion
|
||||
//
|
||||
this.buttonUpdateColletion.Location = new System.Drawing.Point(23, 525);
|
||||
this.buttonUpdateColletion.Name = "buttonUpdateColletion";
|
||||
this.buttonUpdateColletion.Size = new System.Drawing.Size(193, 40);
|
||||
this.buttonUpdateColletion.TabIndex = 2;
|
||||
this.buttonUpdateColletion.Text = "Обновить коллекцию";
|
||||
this.buttonUpdateColletion.UseVisualStyleBackColor = true;
|
||||
this.buttonUpdateColletion.Click += new System.EventHandler(this.ButtonUpdateCollection_Click);
|
||||
//
|
||||
// buttonDeleteZenit
|
||||
//
|
||||
this.buttonDeleteZenit.Location = new System.Drawing.Point(23, 464);
|
||||
this.buttonDeleteZenit.Name = "buttonDeleteZenit";
|
||||
this.buttonDeleteZenit.Size = new System.Drawing.Size(193, 40);
|
||||
this.buttonDeleteZenit.TabIndex = 1;
|
||||
this.buttonDeleteZenit.Text = "Удалить объект";
|
||||
this.buttonDeleteZenit.UseVisualStyleBackColor = true;
|
||||
this.buttonDeleteZenit.Click += new System.EventHandler(this.ButtonDeleteZenit_Click);
|
||||
//
|
||||
// buttonAddZenit
|
||||
//
|
||||
this.buttonAddZenit.Location = new System.Drawing.Point(23, 389);
|
||||
this.buttonAddZenit.Name = "buttonAddZenit";
|
||||
this.buttonAddZenit.Size = new System.Drawing.Size(193, 40);
|
||||
this.buttonAddZenit.TabIndex = 0;
|
||||
this.buttonAddZenit.Text = "Добавить объект";
|
||||
this.buttonAddZenit.UseVisualStyleBackColor = true;
|
||||
this.buttonAddZenit.Click += new System.EventHandler(this.ButtonAddZenit_Click);
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.toolStripMenuItem});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.Size = new System.Drawing.Size(971, 24);
|
||||
this.menuStrip1.TabIndex = 2;
|
||||
this.menuStrip1.Text = "File";
|
||||
//
|
||||
// toolStripMenuItem
|
||||
//
|
||||
this.toolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.SaveToolStripMenuItem,
|
||||
this.LoadToolStripMenuItem});
|
||||
this.toolStripMenuItem.Name = "toolStripMenuItem";
|
||||
this.toolStripMenuItem.Size = new System.Drawing.Size(48, 20);
|
||||
this.toolStripMenuItem.Text = "Файл";
|
||||
//
|
||||
// SaveToolStripMenuItem
|
||||
//
|
||||
this.SaveToolStripMenuItem.Name = "SaveToolStripMenuItem";
|
||||
this.SaveToolStripMenuItem.Size = new System.Drawing.Size(133, 22);
|
||||
this.SaveToolStripMenuItem.Text = "Сохранить";
|
||||
this.SaveToolStripMenuItem.Click += new System.EventHandler(this.SaveToolStripMenuItem_Click);
|
||||
//
|
||||
// LoadToolStripMenuItem
|
||||
//
|
||||
this.LoadToolStripMenuItem.Name = "LoadToolStripMenuItem";
|
||||
this.LoadToolStripMenuItem.Size = new System.Drawing.Size(133, 22);
|
||||
this.LoadToolStripMenuItem.Text = "Загрузить";
|
||||
this.LoadToolStripMenuItem.Click += new System.EventHandler(this.LoadToolStripMenuItem_Click);
|
||||
//
|
||||
// openFileDialog
|
||||
//
|
||||
this.openFileDialog.FileName = "openFileDialog";
|
||||
this.openFileDialog.Filter = "txt file | *.txt";
|
||||
//
|
||||
// saveFileDialog
|
||||
//
|
||||
this.saveFileDialog.Filter = "txt file | *.txt";
|
||||
//
|
||||
// FormAntiAirCraftGunCollection
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(971, 633);
|
||||
this.Controls.Add(this.panelTools);
|
||||
this.Controls.Add(this.pictureBoxCollection);
|
||||
this.Controls.Add(this.menuStrip1);
|
||||
this.MainMenuStrip = this.menuStrip1;
|
||||
this.Name = "FormAntiAirCraftGunCollection";
|
||||
this.Text = "FormAntiAirCraftGunCollection";
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).EndInit();
|
||||
this.panelTools.ResumeLayout(false);
|
||||
this.panelTools.PerformLayout();
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel1.PerformLayout();
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private PictureBox pictureBoxCollection;
|
||||
private Panel panelTools;
|
||||
private TextBox maskedTextBoxNumber;
|
||||
private Button buttonUpdateColletion;
|
||||
private Button buttonDeleteZenit;
|
||||
private Button buttonAddZenit;
|
||||
private Panel panel1;
|
||||
private TextBox textBoxStorageName;
|
||||
private ListBox listBoxStorages;
|
||||
private Button buttonAddCollection;
|
||||
private Button buttonDelCollection;
|
||||
private MenuStrip menuStrip1;
|
||||
private ToolStripMenuItem toolStripMenuItem;
|
||||
private ToolStripMenuItem SaveToolStripMenuItem;
|
||||
private ToolStripMenuItem LoadToolStripMenuItem;
|
||||
private OpenFileDialog openFileDialog;
|
||||
private SaveFileDialog saveFileDialog;
|
||||
}
|
||||
}
|
216
AntiAirCraftGun/AntiAirCraftGun/FormAntiAirCraftGunCollection.cs
Normal file
216
AntiAirCraftGun/AntiAirCraftGun/FormAntiAirCraftGunCollection.cs
Normal file
@ -0,0 +1,216 @@
|
||||
using AntiAircraftGun.DrawingObjects;
|
||||
using AntiAircraftGun.Generics;
|
||||
using AntiAircraftGun.MovementStrategy;
|
||||
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;
|
||||
|
||||
namespace AntiAircraftGun
|
||||
{
|
||||
public partial class FormAntiAirCraftGunCollection : Form
|
||||
{
|
||||
private readonly AntiAirCraftGunGenericStorage _storage;
|
||||
public FormAntiAirCraftGunCollection()
|
||||
{
|
||||
InitializeComponent();
|
||||
_storage = new AntiAirCraftGunGenericStorage(pictureBoxCollection.Width,pictureBoxCollection.Height);
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Заполнение listBoxObjects
|
||||
/// </summary>
|
||||
private void ReloadObjects()
|
||||
{
|
||||
int index = listBoxStorages.SelectedIndex;
|
||||
listBoxStorages.Items.Clear();
|
||||
for (int i = 0; i < _storage.Keys.Count; i++)
|
||||
{
|
||||
listBoxStorages.Items.Add(_storage.Keys[i]);
|
||||
}
|
||||
if (listBoxStorages.Items.Count > 0 && (index == -1 || index
|
||||
>= listBoxStorages.Items.Count))
|
||||
{
|
||||
listBoxStorages.SelectedIndex = 0;
|
||||
}
|
||||
else if (listBoxStorages.Items.Count > 0 && index > -1 &&
|
||||
index < listBoxStorages.Items.Count)
|
||||
{
|
||||
listBoxStorages.SelectedIndex = index;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Добавление набора в коллекцию
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonAddObject_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(textBoxStorageName.Text))
|
||||
{
|
||||
MessageBox.Show("Не все данные заполнены", "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_storage.AddSet(textBoxStorageName.Text);
|
||||
ReloadObjects();
|
||||
}
|
||||
/// <summary>
|
||||
/// Выбор набора
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ListBoxObjects_SelectedIndexChanged(object sender,
|
||||
EventArgs e)
|
||||
{
|
||||
pictureBoxCollection.Image =
|
||||
_storage[listBoxStorages.SelectedItem?.ToString() ?? string.Empty]?.ShowZenits();
|
||||
}
|
||||
/// <summary>
|
||||
/// Удаление набора
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonDelObject_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listBoxStorages.SelectedIndex == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show($"Удалить объект{ listBoxStorages.SelectedItem}?", "Удаление",
|
||||
MessageBoxButtons.YesNo,MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
_storage.DelSet(listBoxStorages.SelectedItem.ToString()
|
||||
?? string.Empty);
|
||||
ReloadObjects();
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonAddZenit_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listBoxStorages.SelectedIndex == -1)
|
||||
{
|
||||
MessageBox.Show("Выберите набор в списке.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
|
||||
if (obj == null)
|
||||
{
|
||||
MessageBox.Show("Выбранный набор не найден.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
FormAntiAirCraftGunConfig form = new();
|
||||
form.Show();
|
||||
Action<BaseDrawingAntiAirCraftGun>? zenitDelegate = new((m) => {
|
||||
bool q = (obj + m);
|
||||
if (q)
|
||||
{
|
||||
MessageBox.Show("Объект добавлен");
|
||||
m.ChangePictureBoxSize(pictureBoxCollection.Width, pictureBoxCollection.Height);
|
||||
pictureBoxCollection.Image = obj.ShowZenits();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось добавить объект");
|
||||
}
|
||||
});
|
||||
form.AddEvent(zenitDelegate);
|
||||
}
|
||||
private void ButtonDeleteZenit_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listBoxStorages.SelectedIndex == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
|
||||
if (obj == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show("Удалить объект?", "Удаление",
|
||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int pos = Convert.ToInt32(maskedTextBoxNumber.Text);
|
||||
if (obj - pos != null)
|
||||
{
|
||||
MessageBox.Show("Объект удален");
|
||||
pictureBoxCollection.Image = obj.ShowZenits();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось удалить объект");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void ButtonUpdateCollection_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listBoxStorages.SelectedIndex == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var obj = _storage[listBoxStorages.SelectedItem.ToString() ??
|
||||
string.Empty];
|
||||
if (obj == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
pictureBoxCollection.Image = obj.ShowZenits();
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Обработка нажатия "Сохранение"
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void SaveToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (_storage.SaveData(saveFileDialog.FileName))
|
||||
{
|
||||
MessageBox.Show("Сохранение прошло успешно",
|
||||
"Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не сохранилось", "Результат",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Обработка нажатия "Загрузка"
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void LoadToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (_storage.LoadData(openFileDialog.FileName))
|
||||
{
|
||||
MessageBox.Show("Загрузка прошла успешно",
|
||||
"Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
foreach (var collection in _storage.Keys)
|
||||
{
|
||||
listBoxStorages.Items.Add(collection);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не загрузилось", "Результат",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
<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>
|
||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>132, 17</value>
|
||||
</metadata>
|
||||
<metadata name="saveFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>272, 17</value>
|
||||
</metadata>
|
||||
</root>
|
368
AntiAirCraftGun/AntiAirCraftGun/FormAntiAirCraftGunConfig.Designer.cs
generated
Normal file
368
AntiAirCraftGun/AntiAirCraftGun/FormAntiAirCraftGunConfig.Designer.cs
generated
Normal file
@ -0,0 +1,368 @@
|
||||
namespace AntiAircraftGun
|
||||
{
|
||||
partial class FormAntiAirCraftGunConfig
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
panel1 = new Panel();
|
||||
groupBoxParameters = new GroupBox();
|
||||
labelAdvanced = new Label();
|
||||
labelBase = new Label();
|
||||
groupBoxColor = new GroupBox();
|
||||
panelPurple = new Panel();
|
||||
panelBlack = new Panel();
|
||||
panelGray = new Panel();
|
||||
panelWhite = new Panel();
|
||||
panelYellow = new Panel();
|
||||
panelBlue = new Panel();
|
||||
panelGreen = new Panel();
|
||||
panelRed = new Panel();
|
||||
checkBoxRocket = new CheckBox();
|
||||
checkBoxRadar = new CheckBox();
|
||||
numericUpDownWeight = new NumericUpDown();
|
||||
numericUpDownSpeed = new NumericUpDown();
|
||||
label2 = new Label();
|
||||
label1 = new Label();
|
||||
pictureBoxObject = new PictureBox();
|
||||
labelColor = new Label();
|
||||
labelAdditionalColor = new Label();
|
||||
buttonAdd = new Button();
|
||||
buttonCancel = new Button();
|
||||
allowPanel = new Panel();
|
||||
panel1.SuspendLayout();
|
||||
groupBoxParameters.SuspendLayout();
|
||||
groupBoxColor.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxObject).BeginInit();
|
||||
allowPanel.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(groupBoxParameters);
|
||||
panel1.Location = new Point(7, 9);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(574, 306);
|
||||
panel1.TabIndex = 0;
|
||||
//
|
||||
// groupBoxParameters
|
||||
//
|
||||
groupBoxParameters.Controls.Add(labelAdvanced);
|
||||
groupBoxParameters.Controls.Add(labelBase);
|
||||
groupBoxParameters.Controls.Add(groupBoxColor);
|
||||
groupBoxParameters.Controls.Add(checkBoxRocket);
|
||||
groupBoxParameters.Controls.Add(checkBoxRadar);
|
||||
groupBoxParameters.Controls.Add(numericUpDownWeight);
|
||||
groupBoxParameters.Controls.Add(numericUpDownSpeed);
|
||||
groupBoxParameters.Controls.Add(label2);
|
||||
groupBoxParameters.Controls.Add(label1);
|
||||
groupBoxParameters.Location = new Point(5, 3);
|
||||
groupBoxParameters.Name = "groupBoxParameters";
|
||||
groupBoxParameters.Size = new Size(566, 300);
|
||||
groupBoxParameters.TabIndex = 0;
|
||||
groupBoxParameters.TabStop = false;
|
||||
groupBoxParameters.Text = "Параметры";
|
||||
//
|
||||
// labelAdvanced
|
||||
//
|
||||
labelAdvanced.Anchor = AnchorStyles.None;
|
||||
labelAdvanced.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelAdvanced.Location = new Point(427, 217);
|
||||
labelAdvanced.Name = "labelAdvanced";
|
||||
labelAdvanced.Size = new Size(88, 40);
|
||||
labelAdvanced.TabIndex = 8;
|
||||
labelAdvanced.Text = "Продвинутый";
|
||||
labelAdvanced.TextAlign = ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// labelBase
|
||||
//
|
||||
labelBase.Anchor = AnchorStyles.None;
|
||||
labelBase.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelBase.Location = new Point(315, 217);
|
||||
labelBase.Name = "labelBase";
|
||||
labelBase.Size = new Size(88, 40);
|
||||
labelBase.TabIndex = 7;
|
||||
labelBase.Text = "Простой";
|
||||
labelBase.TextAlign = ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// groupBoxColor
|
||||
//
|
||||
groupBoxColor.Controls.Add(panelPurple);
|
||||
groupBoxColor.Controls.Add(panelBlack);
|
||||
groupBoxColor.Controls.Add(panelGray);
|
||||
groupBoxColor.Controls.Add(panelWhite);
|
||||
groupBoxColor.Controls.Add(panelYellow);
|
||||
groupBoxColor.Controls.Add(panelBlue);
|
||||
groupBoxColor.Controls.Add(panelGreen);
|
||||
groupBoxColor.Controls.Add(panelRed);
|
||||
groupBoxColor.Location = new Point(287, 36);
|
||||
groupBoxColor.Name = "groupBoxColor";
|
||||
groupBoxColor.Size = new Size(273, 151);
|
||||
groupBoxColor.TabIndex = 6;
|
||||
groupBoxColor.TabStop = false;
|
||||
groupBoxColor.Text = "Цвета";
|
||||
//
|
||||
// panelPurple
|
||||
//
|
||||
panelPurple.BackColor = Color.Purple;
|
||||
panelPurple.Location = new Point(196, 83);
|
||||
panelPurple.Name = "panelPurple";
|
||||
panelPurple.Size = new Size(50, 50);
|
||||
panelPurple.TabIndex = 2;
|
||||
//
|
||||
// panelBlack
|
||||
//
|
||||
panelBlack.BackColor = Color.Black;
|
||||
panelBlack.Location = new Point(140, 83);
|
||||
panelBlack.Name = "panelBlack";
|
||||
panelBlack.Size = new Size(50, 50);
|
||||
panelBlack.TabIndex = 2;
|
||||
//
|
||||
// panelGray
|
||||
//
|
||||
panelGray.BackColor = Color.Gray;
|
||||
panelGray.Location = new Point(84, 83);
|
||||
panelGray.Name = "panelGray";
|
||||
panelGray.Size = new Size(50, 50);
|
||||
panelGray.TabIndex = 2;
|
||||
//
|
||||
// panelWhite
|
||||
//
|
||||
panelWhite.BackColor = Color.White;
|
||||
panelWhite.Location = new Point(28, 83);
|
||||
panelWhite.Name = "panelWhite";
|
||||
panelWhite.Size = new Size(50, 50);
|
||||
panelWhite.TabIndex = 2;
|
||||
//
|
||||
// panelYellow
|
||||
//
|
||||
panelYellow.BackColor = Color.Yellow;
|
||||
panelYellow.Location = new Point(196, 27);
|
||||
panelYellow.Name = "panelYellow";
|
||||
panelYellow.Size = new Size(50, 50);
|
||||
panelYellow.TabIndex = 2;
|
||||
//
|
||||
// panelBlue
|
||||
//
|
||||
panelBlue.BackColor = Color.Blue;
|
||||
panelBlue.Location = new Point(140, 27);
|
||||
panelBlue.Name = "panelBlue";
|
||||
panelBlue.Size = new Size(50, 50);
|
||||
panelBlue.TabIndex = 2;
|
||||
//
|
||||
// panelGreen
|
||||
//
|
||||
panelGreen.BackColor = Color.Green;
|
||||
panelGreen.Location = new Point(84, 27);
|
||||
panelGreen.Name = "panelGreen";
|
||||
panelGreen.Size = new Size(50, 50);
|
||||
panelGreen.TabIndex = 1;
|
||||
//
|
||||
// panelRed
|
||||
//
|
||||
panelRed.BackColor = Color.Red;
|
||||
panelRed.Location = new Point(28, 27);
|
||||
panelRed.Name = "panelRed";
|
||||
panelRed.Size = new Size(50, 50);
|
||||
panelRed.TabIndex = 0;
|
||||
//
|
||||
// checkBoxRocket
|
||||
//
|
||||
checkBoxRocket.AutoSize = true;
|
||||
checkBoxRocket.Location = new Point(41, 229);
|
||||
checkBoxRocket.Name = "checkBoxRocket";
|
||||
checkBoxRocket.Size = new Size(165, 19);
|
||||
checkBoxRocket.TabIndex = 5;
|
||||
checkBoxRocket.Text = "Признак наличия ракеты";
|
||||
checkBoxRocket.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoxRadar
|
||||
//
|
||||
checkBoxRadar.AutoSize = true;
|
||||
checkBoxRadar.Location = new Point(41, 189);
|
||||
checkBoxRadar.Name = "checkBoxRadar";
|
||||
checkBoxRadar.Size = new Size(164, 19);
|
||||
checkBoxRadar.TabIndex = 4;
|
||||
checkBoxRadar.Text = "Признак наличия радара";
|
||||
checkBoxRadar.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// numericUpDownWeight
|
||||
//
|
||||
numericUpDownWeight.Location = new Point(128, 82);
|
||||
numericUpDownWeight.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
|
||||
numericUpDownWeight.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
numericUpDownWeight.Name = "numericUpDownWeight";
|
||||
numericUpDownWeight.Size = new Size(120, 23);
|
||||
numericUpDownWeight.TabIndex = 3;
|
||||
numericUpDownWeight.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
//
|
||||
// numericUpDownSpeed
|
||||
//
|
||||
numericUpDownSpeed.Location = new Point(128, 36);
|
||||
numericUpDownSpeed.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
|
||||
numericUpDownSpeed.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
numericUpDownSpeed.Name = "numericUpDownSpeed";
|
||||
numericUpDownSpeed.Size = new Size(120, 23);
|
||||
numericUpDownSpeed.TabIndex = 2;
|
||||
numericUpDownSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(44, 84);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(26, 15);
|
||||
label2.TabIndex = 1;
|
||||
label2.Text = "Вес";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(44, 38);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(59, 15);
|
||||
label1.TabIndex = 0;
|
||||
label1.Text = "Скорость";
|
||||
//
|
||||
// pictureBoxObject
|
||||
//
|
||||
pictureBoxObject.Location = new Point(41, 85);
|
||||
pictureBoxObject.Name = "pictureBoxObject";
|
||||
pictureBoxObject.Size = new Size(227, 141);
|
||||
pictureBoxObject.TabIndex = 1;
|
||||
pictureBoxObject.TabStop = false;
|
||||
//
|
||||
// labelColor
|
||||
//
|
||||
labelColor.AllowDrop = true;
|
||||
labelColor.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelColor.Location = new Point(20, 24);
|
||||
labelColor.Name = "labelColor";
|
||||
labelColor.Size = new Size(120, 32);
|
||||
labelColor.TabIndex = 2;
|
||||
labelColor.Text = "Цвет";
|
||||
labelColor.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelColor.DragDrop += colorLabel_DragDrop;
|
||||
labelColor.DragEnter += colorLabel_DragEnter;
|
||||
//
|
||||
// labelAdditionalColor
|
||||
//
|
||||
labelAdditionalColor.AllowDrop = true;
|
||||
labelAdditionalColor.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelAdditionalColor.Location = new Point(169, 24);
|
||||
labelAdditionalColor.Name = "labelAdditionalColor";
|
||||
labelAdditionalColor.Size = new Size(120, 32);
|
||||
labelAdditionalColor.TabIndex = 3;
|
||||
labelAdditionalColor.Text = "Доп.Цвет";
|
||||
labelAdditionalColor.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelAdditionalColor.DragDrop += addColorLabel_DragDrop;
|
||||
labelAdditionalColor.DragEnter += colorLabel_DragEnter;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.Location = new Point(587, 278);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(164, 37);
|
||||
buttonAdd.TabIndex = 4;
|
||||
buttonAdd.Text = "Добавить";
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += addButton_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(757, 278);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(152, 37);
|
||||
buttonCancel.TabIndex = 5;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// allowPanel
|
||||
//
|
||||
allowPanel.AllowDrop = true;
|
||||
allowPanel.Controls.Add(labelAdditionalColor);
|
||||
allowPanel.Controls.Add(labelColor);
|
||||
allowPanel.Controls.Add(pictureBoxObject);
|
||||
allowPanel.Location = new Point(589, 9);
|
||||
allowPanel.Name = "allowPanel";
|
||||
allowPanel.Size = new Size(316, 263);
|
||||
allowPanel.TabIndex = 6;
|
||||
allowPanel.DragDrop += allowPanel_DragDrop;
|
||||
allowPanel.DragEnter += allowPanel_DragEnter;
|
||||
//
|
||||
// FormAntiAirCraftGunConfig
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(912, 327);
|
||||
Controls.Add(allowPanel);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonAdd);
|
||||
Controls.Add(panel1);
|
||||
Name = "FormAntiAirCraftGunConfig";
|
||||
Text = "FormAntiAirCraftGunConfig";
|
||||
panel1.ResumeLayout(false);
|
||||
groupBoxParameters.ResumeLayout(false);
|
||||
groupBoxParameters.PerformLayout();
|
||||
groupBoxColor.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxObject).EndInit();
|
||||
allowPanel.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel1;
|
||||
private GroupBox groupBoxParameters;
|
||||
private Label labelAdvanced;
|
||||
private Label labelBase;
|
||||
private GroupBox groupBoxColor;
|
||||
private Panel panelPurple;
|
||||
private Panel panelBlack;
|
||||
private Panel panelGray;
|
||||
private Panel panelWhite;
|
||||
private Panel panelYellow;
|
||||
private Panel panelBlue;
|
||||
private Panel panelGreen;
|
||||
private Panel panelRed;
|
||||
private CheckBox checkBoxRocket;
|
||||
private CheckBox checkBoxRadar;
|
||||
private NumericUpDown numericUpDownWeight;
|
||||
private NumericUpDown numericUpDownSpeed;
|
||||
private Label label2;
|
||||
private Label label1;
|
||||
private PictureBox pictureBoxObject;
|
||||
private Label labelColor;
|
||||
private Label labelAdditionalColor;
|
||||
private Button buttonAdd;
|
||||
private Button buttonCancel;
|
||||
private Panel allowPanel;
|
||||
}
|
||||
}
|
178
AntiAirCraftGun/AntiAirCraftGun/FormAntiAirCraftGunConfig.cs
Normal file
178
AntiAirCraftGun/AntiAirCraftGun/FormAntiAirCraftGunConfig.cs
Normal file
@ -0,0 +1,178 @@
|
||||
using AntiAircraftGun.DrawingObjects;
|
||||
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;
|
||||
|
||||
namespace AntiAircraftGun
|
||||
{
|
||||
|
||||
|
||||
public partial class FormAntiAirCraftGunConfig : Form
|
||||
{
|
||||
/// <summary>
|
||||
/// Выбранная зенитная установка
|
||||
/// </summary>
|
||||
BaseDrawingAntiAirCraftGun? _zenit = null;
|
||||
|
||||
/// <summary>
|
||||
/// Событие для добавления зенитной установки
|
||||
/// </summary>
|
||||
private event Action<BaseDrawingAntiAirCraftGun>? EventAddZenit;
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор формы
|
||||
/// </summary>
|
||||
public FormAntiAirCraftGunConfig()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
panelBlack.MouseDown += PanelColor_MouseDown;
|
||||
panelGray.MouseDown += PanelColor_MouseDown;
|
||||
panelRed.MouseDown += PanelColor_MouseDown;
|
||||
panelBlue.MouseDown += PanelColor_MouseDown;
|
||||
panelGreen.MouseDown += PanelColor_MouseDown;
|
||||
panelYellow.MouseDown += PanelColor_MouseDown;
|
||||
panelPurple.MouseDown += PanelColor_MouseDown;
|
||||
panelWhite.MouseDown += PanelColor_MouseDown;
|
||||
labelBase.MouseDown += LabelObject_MouseDown;
|
||||
labelAdvanced.MouseDown += LabelObject_MouseDown;
|
||||
buttonCancel.Click += (s, e) => Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Отрисовка зенитной установки на PictureBox
|
||||
/// </summary>
|
||||
public void DrawAntiAirCraftGun()
|
||||
{
|
||||
Bitmap bmp = new Bitmap(pictureBoxObject.Width, pictureBoxObject.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_zenit?.SetPosition(15, 15);
|
||||
_zenit?.DrawTransport(gr);
|
||||
pictureBoxObject.Image = bmp;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Добавление обработчика события для добавления зенитной установки
|
||||
/// </summary>
|
||||
public void AddEvent(Action<BaseDrawingAntiAirCraftGun> ev)
|
||||
{
|
||||
if (EventAddZenit == null)
|
||||
{
|
||||
EventAddZenit = ev;
|
||||
}
|
||||
else
|
||||
{
|
||||
EventAddZenit += ev;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Обработчик события MouseDown для LabelObject
|
||||
/// </summary>
|
||||
private void LabelObject_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
(sender as Label)?.DoDragDrop((sender as Label)?.Name, DragDropEffects.Move | DragDropEffects.Copy);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Обработчик события DragEnter для allowPanel
|
||||
/// </summary>
|
||||
private void allowPanel_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data?.GetDataPresent(DataFormats.Text) ?? false)
|
||||
{
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Effect = DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Обработчик события DragDrop для allowPanel
|
||||
/// </summary>
|
||||
private void allowPanel_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
switch (e.Data?.GetData(DataFormats.Text).ToString())
|
||||
{
|
||||
case "labelBase":
|
||||
_zenit = new BaseDrawingAntiAirCraftGun((int)numericUpDownSpeed.Value,
|
||||
(int)numericUpDownWeight.Value, Color.White, Color.Gray, pictureBoxObject.Width,
|
||||
pictureBoxObject.Height);
|
||||
break;
|
||||
case "labelAdvanced":
|
||||
_zenit = new AdvancedDrawingAntiAirCraftGun((int)numericUpDownSpeed.Value,
|
||||
(int)numericUpDownWeight.Value, Color.White, Color.Gray, Color.Silver,
|
||||
checkBoxRadar.Checked, checkBoxRocket.Checked, pictureBoxObject.Width,
|
||||
pictureBoxObject.Height);
|
||||
break;
|
||||
}
|
||||
labelColor.BackColor = Color.Empty;
|
||||
labelAdditionalColor.BackColor = Color.Empty;
|
||||
DrawAntiAirCraftGun();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Обработчик события Click для addButton
|
||||
/// </summary>
|
||||
private void addButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
EventAddZenit?.Invoke(_zenit);
|
||||
Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Обработчик события MouseDown для панелей цвета
|
||||
/// </summary>
|
||||
private void PanelColor_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
(sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor,DragDropEffects.Move | DragDropEffects.Copy);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Обработчик события DragDrop для colorLabel
|
||||
/// </summary>
|
||||
private void colorLabel_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (_zenit == null)
|
||||
return;
|
||||
labelColor.BackColor = (Color)e.Data.GetData(typeof(Color));
|
||||
_zenit.ChangeColor(labelColor.BackColor);
|
||||
DrawAntiAirCraftGun();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Обработчик события DragEnter для colorLabel
|
||||
/// </summary>
|
||||
private void colorLabel_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(typeof(Color)))
|
||||
{
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Effect = DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Обработчик события DragDrop для addColorLabel
|
||||
/// </summary>
|
||||
private void addColorLabel_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if ((_zenit == null) || (_zenit is AdvancedDrawingAntiAirCraftGun == false))
|
||||
return;
|
||||
labelAdditionalColor.BackColor = (Color)e.Data.GetData(typeof(Color));
|
||||
((AdvancedDrawingAntiAirCraftGun)_zenit).ChangeAddColor(labelAdditionalColor.BackColor);
|
||||
DrawAntiAirCraftGun();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,17 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
|
||||
Example:
|
||||
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
@ -26,36 +26,36 @@
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
@ -0,0 +1,176 @@
|
||||
using AntiAircraftGun.DrawingObjects;
|
||||
using AntiAircraftGun.MovementStrategy;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AntiAircraftGun.Generics
|
||||
{
|
||||
internal class AntiAirCraftGunGenericCollection<T,U>
|
||||
where T : BaseDrawingAntiAirCraftGun
|
||||
where U : IMoveableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Получение объектов коллекции
|
||||
/// </summary>
|
||||
public IEnumerable<T?> GetCars => _collection.GetZenits();
|
||||
/// <summary>
|
||||
/// Ширина окна прорисовки
|
||||
/// </summary>
|
||||
private readonly int _pictureWidth;
|
||||
/// <summary>
|
||||
/// Высота окна прорисовки
|
||||
/// </summary>
|
||||
private readonly int _pictureHeight;
|
||||
/// <summary>
|
||||
/// Размер занимаемого объектом места (ширина)
|
||||
/// </summary>
|
||||
private readonly int _placeSizeWidth = 210;
|
||||
/// <summary>
|
||||
/// Размер занимаемого объектом места (высота)
|
||||
/// </summary>
|
||||
private readonly int _placeSizeHeight = 90;
|
||||
/// <summary>
|
||||
/// Набор объектов
|
||||
/// </summary>
|
||||
private readonly SetGeneric<T> _collection;
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="picWidth"></param>
|
||||
/// <param name="picHeight"></param>
|
||||
public AntiAirCraftGunGenericCollection(int picWidth, int picHeight)
|
||||
{
|
||||
int width = picWidth / _placeSizeWidth;
|
||||
int height = picHeight / _placeSizeHeight;
|
||||
_pictureWidth = picWidth;
|
||||
_pictureHeight = picHeight;
|
||||
_collection = new SetGeneric<T>(width * height);
|
||||
}
|
||||
/// <summary>
|
||||
/// Перегрузка оператора сложения
|
||||
/// </summary>
|
||||
/// <param name="collect"></param>
|
||||
/// <param name="obj"></param>
|
||||
/// <returns></returns>
|
||||
public static bool operator +(AntiAirCraftGunGenericCollection<T,U> collect, T? obj)
|
||||
{
|
||||
if (obj == null)
|
||||
return false;
|
||||
return collect?._collection.Insert(obj) ?? false;
|
||||
}
|
||||
/// <summary>
|
||||
/// Перегрузка оператора вычитания
|
||||
/// </summary>
|
||||
/// <param name="collect"></param>
|
||||
/// <param name="pos"></param>
|
||||
/// <returns></returns>
|
||||
public static T? operator -(AntiAirCraftGunGenericCollection<T, U> collect, int pos)
|
||||
{
|
||||
T? obj = collect._collection.Get(pos);
|
||||
if (obj != null)
|
||||
collect._collection.Remove(pos);
|
||||
return obj;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получение объекта IMoveableObject
|
||||
/// </summary>
|
||||
/// <param name="pos"></param>
|
||||
/// <returns></returns>
|
||||
public U? GetU(int pos)
|
||||
{
|
||||
return (U?)_collection[pos]?.GetMoveableObject;
|
||||
}
|
||||
/// <summary>
|
||||
/// Вывод всего набора объектов
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Bitmap ShowZenits()
|
||||
{
|
||||
Bitmap bmp = new(_pictureWidth, _pictureHeight);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
DrawBackground(gr);
|
||||
DrawObjects(gr);
|
||||
return bmp;
|
||||
}
|
||||
/// <summary>
|
||||
/// Метод отрисовки фона
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
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);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Метод прорисовки объектов
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
private void DrawObjects(Graphics g)
|
||||
{
|
||||
int x = 0; // Начальная координата X
|
||||
int y = 0; // Начальная координата Y
|
||||
int maxX = _pictureWidth; // Максимальное значение X, при достижении которого будет ошибка
|
||||
int maxY = _pictureHeight; // Максимальное значение Y, когда нужно изменить X
|
||||
int distance_between_objects = _placeSizeHeight;
|
||||
|
||||
foreach (var zenit in _collection.GetZenits())
|
||||
{
|
||||
|
||||
T? obj = zenit;
|
||||
|
||||
if (obj != null)
|
||||
{
|
||||
// Проверяем, если X достигло максимума, выводим ошибку
|
||||
if (x >= maxX)
|
||||
{
|
||||
MessageBox.Show("Не хватает места для объекта.");
|
||||
break;
|
||||
}
|
||||
|
||||
// Устанавливаем позицию
|
||||
obj.SetPosition(x, y + 10);
|
||||
|
||||
// TODO: Прорисовка объекта
|
||||
obj.DrawTransport(g);
|
||||
|
||||
// Увеличиваем координату Y для следующего объекта
|
||||
y += distance_between_objects;
|
||||
|
||||
// Проверяем, если Y достигло максимума, изменяем X и сбрасываем Y
|
||||
if (y + distance_between_objects >= maxY)
|
||||
{
|
||||
y = 0;
|
||||
x += _placeSizeWidth;
|
||||
}
|
||||
}
|
||||
if (obj == null)
|
||||
{
|
||||
// Увеличиваем координату Y для следующего объекта
|
||||
y += distance_between_objects;
|
||||
|
||||
// Проверяем, если Y достигло максимума, изменяем X и сбрасываем Y
|
||||
if (y+distance_between_objects >= maxY)
|
||||
{
|
||||
y = 0;
|
||||
x += _placeSizeWidth;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,198 @@
|
||||
using AntiAircraftGun.DrawingObjects;
|
||||
using AntiAircraftGun.MovementStrategy;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AntiAircraftGun.Generics
|
||||
{
|
||||
/// <summary>
|
||||
/// Класс для хранения коллекции
|
||||
/// </summary>
|
||||
internal class AntiAirCraftGunGenericStorage
|
||||
{
|
||||
/// <summary>
|
||||
/// Разделитель для записи ключа и значения элемента словаря
|
||||
/// </summary>
|
||||
private static readonly char _separatorForKeyValue = '|';
|
||||
/// <summary>
|
||||
/// Разделитель для записей коллекции данных в файл
|
||||
/// </summary>
|
||||
private readonly char _separatorRecords = ';';
|
||||
/// <summary>
|
||||
/// Разделитель для записи информации по объекту в файл
|
||||
/// </summary>
|
||||
private static readonly char _separatorForObject = ':';
|
||||
/// <summary>
|
||||
/// Словарь (хранилище)
|
||||
/// </summary>
|
||||
readonly Dictionary<string, AntiAirCraftGunGenericCollection<BaseDrawingAntiAirCraftGun, DrawingObjectAntiAirCraftGun>> _zenitStorages;
|
||||
/// <summary>
|
||||
/// Возвращение списка названий наборов
|
||||
/// </summary>
|
||||
public List<string> Keys => _zenitStorages.Keys.ToList();
|
||||
/// <summary>
|
||||
/// Ширина окна отрисовки
|
||||
/// </summary>
|
||||
private readonly int _pictureWidth;
|
||||
/// <summary>
|
||||
/// Высота окна отрисовки
|
||||
/// </summary>
|
||||
private readonly int _pictureHeight;
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="pictureWidth"></param>
|
||||
/// <param name="pictureHeight"></param>
|
||||
public AntiAirCraftGunGenericStorage(int pictureWidth, int pictureHeight)
|
||||
{
|
||||
_zenitStorages = new Dictionary<string, AntiAirCraftGunGenericCollection<BaseDrawingAntiAirCraftGun, DrawingObjectAntiAirCraftGun>>();
|
||||
_pictureWidth = pictureWidth;
|
||||
_pictureHeight = pictureHeight;
|
||||
}
|
||||
/// <summary>
|
||||
/// Добавление набора
|
||||
/// </summary>
|
||||
/// <param name="name">Название набора</param>
|
||||
public void AddSet(string name)
|
||||
{
|
||||
// TODO: Прописать логику для добавления набора
|
||||
if (_zenitStorages.ContainsKey(name))
|
||||
{
|
||||
MessageBox.Show("Набор с таким именем уже существует");
|
||||
return;
|
||||
}
|
||||
|
||||
_zenitStorages.Add(name, new AntiAirCraftGunGenericCollection<BaseDrawingAntiAirCraftGun, DrawingObjectAntiAirCraftGun>(_pictureWidth, _pictureHeight));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Удаление набора
|
||||
/// </summary>
|
||||
/// <param name="name">Название набора</param>
|
||||
public void DelSet(string name)
|
||||
{
|
||||
// TODO: Прописать логику для удаления набора
|
||||
if (_zenitStorages.ContainsKey(name) == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_zenitStorages.Remove(name);
|
||||
}
|
||||
/// <summary>
|
||||
/// Доступ к набору
|
||||
/// </summary>
|
||||
/// <param name="ind"></param>
|
||||
/// <returns></returns>
|
||||
public AntiAirCraftGunGenericCollection<BaseDrawingAntiAirCraftGun, DrawingObjectAntiAirCraftGun>?
|
||||
this[string ind]
|
||||
{
|
||||
get
|
||||
{
|
||||
// TODO: Продумать логику получения набора
|
||||
if (_zenitStorages.ContainsKey(ind))
|
||||
{
|
||||
return _zenitStorages[ind];
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Сохранение информации по автомобилям в хранилище в файл
|
||||
/// </summary>
|
||||
/// <param name="filename">Путь и имя файла</param>
|
||||
/// <returns>true - сохранение прошло успешно, false - ошибка при сохранении данных</returns>
|
||||
public bool SaveData(string filename)
|
||||
{
|
||||
if (File.Exists(filename))
|
||||
{
|
||||
File.Delete(filename);
|
||||
}
|
||||
StringBuilder data = new();
|
||||
foreach (KeyValuePair<string,
|
||||
AntiAirCraftGunGenericCollection<BaseDrawingAntiAirCraftGun, DrawingObjectAntiAirCraftGun>> record in _zenitStorages)
|
||||
{
|
||||
StringBuilder records = new();
|
||||
foreach (BaseDrawingAntiAirCraftGun? elem in record.Value.GetCars)
|
||||
{
|
||||
records.Append($"{elem?.GetDataForSave(_separatorForObject)}{_separatorRecords}");
|
||||
}
|
||||
data.AppendLine($"{record.Key}{_separatorForKeyValue}{records}");
|
||||
}
|
||||
if (data.Length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
string toWrite = $"CarStorage{Environment.NewLine}{data}";
|
||||
var strs = toWrite.Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
using (StreamWriter sw = new(filename))
|
||||
{
|
||||
foreach (var str in strs)
|
||||
{
|
||||
sw.WriteLine(str);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/// <summary>
|
||||
/// Загрузка информации по автомобилям в хранилище из файла
|
||||
/// </summary>
|
||||
/// <param name="filename">Путь и имя файла</param>
|
||||
/// <returns>true - загрузка прошла успешно, false - ошибка при загрузке данных</returns>
|
||||
public bool LoadData(string filename)
|
||||
{
|
||||
if (!File.Exists(filename))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
using (StreamReader sr = new(filename))
|
||||
{
|
||||
string str = sr.ReadLine();
|
||||
var strs = str.Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (strs == null || strs.Length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!strs[0].StartsWith("CarStorage"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
_zenitStorages.Clear();
|
||||
do
|
||||
{
|
||||
string[] record = str.Split(_separatorForKeyValue, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (record.Length != 2)
|
||||
{
|
||||
str = sr.ReadLine();
|
||||
continue;
|
||||
}
|
||||
AntiAirCraftGunGenericCollection<BaseDrawingAntiAirCraftGun, DrawingObjectAntiAirCraftGun> collection = new(_pictureWidth, _pictureHeight);
|
||||
string[] set = record[1].Split(_separatorRecords, StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach (string elem in set)
|
||||
{
|
||||
BaseDrawingAntiAirCraftGun? zenit =
|
||||
elem?.CreateDrawningAntiAirCraftGun(_separatorForObject, _pictureWidth, _pictureHeight);
|
||||
if (zenit != null)
|
||||
{
|
||||
if (!(collection + zenit))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
_zenitStorages.Add(record[0], collection);
|
||||
|
||||
str = sr.ReadLine();
|
||||
} while (str != null);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
115
AntiAirCraftGun/AntiAirCraftGun/Generics/SetGeneric.cs
Normal file
115
AntiAirCraftGun/AntiAirCraftGun/Generics/SetGeneric.cs
Normal file
@ -0,0 +1,115 @@
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Массив объектов, которые храним
|
||||
/// </summary>
|
||||
private readonly List<T?> _places;
|
||||
/// <summary>
|
||||
/// Количество объектов в списке
|
||||
/// </summary>
|
||||
public int Count => _places.Count;
|
||||
/// <summary>
|
||||
/// Максимальное количество объектов в списке
|
||||
/// </summary>
|
||||
private readonly int _maxCount;
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="count"></param>
|
||||
public SetGeneric(int count)
|
||||
{
|
||||
_maxCount = count;
|
||||
_places = new List<T?>(count);
|
||||
}
|
||||
/// <summary>
|
||||
/// Добавление объекта в набор
|
||||
/// </summary>
|
||||
/// <param name="car">Добавляемый автомобиль</param>
|
||||
/// <returns></returns>
|
||||
public bool Insert(T car)
|
||||
{
|
||||
if (_places.Count == _maxCount)
|
||||
return false;
|
||||
Insert(car, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Insert(T car, int position)
|
||||
{
|
||||
if (!(position >= 0 && position <= Count && _places.Count < _maxCount))
|
||||
return false;
|
||||
_places.Insert(position, car);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Удаление объекта из набора с конкретной позиции
|
||||
/// </summary>
|
||||
/// <param name="position"></param>
|
||||
/// <returns></returns>
|
||||
public bool Remove(int position)
|
||||
{
|
||||
// Проверка позиции
|
||||
if (position < 0 || position >= Count)
|
||||
return false;
|
||||
|
||||
|
||||
_places.RemoveAt(position);
|
||||
return true;
|
||||
}
|
||||
/// <summary>
|
||||
/// Получение объекта из набора по позиции
|
||||
/// </summary>
|
||||
/// <param name="position"></param>
|
||||
/// <returns></returns>
|
||||
public T? this[int position]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!(position >= 0 && position < Count))
|
||||
return null;
|
||||
return _places[position];
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!(position >= 0 && position < Count && _places.Count < _maxCount))
|
||||
return;
|
||||
_places.Insert(position, value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Проход по списку
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<T?> GetZenits(int? maxCars = null)
|
||||
{
|
||||
for (int i = 0; i < _places.Count; ++i)
|
||||
{
|
||||
yield return _places[i];
|
||||
if (maxCars.HasValue && i == maxCars.Value)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
public T? Get(int position)
|
||||
{
|
||||
if (position < 0 || position >= Count)
|
||||
{
|
||||
// Позиция находится за пределами допустимого диапазона, вернем null
|
||||
return null;
|
||||
}
|
||||
return _places[position];
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,132 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
|
||||
namespace AntiAircraftGun.MovementStrategy
|
||||
{
|
||||
public abstract class AbstractStrategy
|
||||
{
|
||||
/// <summary>
|
||||
/// Перемещаемый объект
|
||||
/// </summary>
|
||||
private IMoveableObject? _moveableObject;
|
||||
/// <summary>
|
||||
/// Статус перемещения
|
||||
/// </summary>
|
||||
private Status _state = Status.NotInit;
|
||||
/// <summary>
|
||||
/// Ширина поля
|
||||
/// </summary>
|
||||
protected int FieldWidth { get; private set; }
|
||||
/// <summary>
|
||||
/// Высота поля
|
||||
/// </summary>
|
||||
protected int FieldHeight { get; private set; }
|
||||
/// <summary>
|
||||
/// Статус перемещения
|
||||
/// </summary>
|
||||
public Status GetStatus() { return _state; }
|
||||
/// <summary>
|
||||
/// Установка данных
|
||||
/// </summary>
|
||||
/// <param name="moveableObject">Перемещаемый объект</param>
|
||||
/// <param name="width">Ширина поля</param>
|
||||
/// <param name="height">Высота поля</param>
|
||||
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;
|
||||
}
|
||||
/// <summary>
|
||||
/// Шаг перемещения
|
||||
/// </summary>
|
||||
public void MakeStep()
|
||||
{
|
||||
if (_state != Status.InProgress)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (IsTargetDestinaion())
|
||||
{
|
||||
_state = Status.Finish;
|
||||
return;
|
||||
}
|
||||
MoveToTarget();
|
||||
}
|
||||
/// <summary>
|
||||
/// Перемещение влево
|
||||
/// </summary>
|
||||
/// <returns>Результат перемещения (true - удалось переместиться, false - неудача)</returns>
|
||||
protected bool MoveLeft() => MoveTo(DirectionType.Left);
|
||||
/// <summary>
|
||||
/// Перемещение вправо
|
||||
/// </summary>
|
||||
/// <returns>Результат перемещения (true - удалось переместиться,false - неудача)</returns>
|
||||
protected bool MoveRight() => MoveTo(DirectionType.Right);
|
||||
/// <summary>
|
||||
/// Перемещение вверх
|
||||
/// </summary>
|
||||
/// <returns>Результат перемещения (true - удалось переместиться, false - неудача)</returns>
|
||||
protected bool MoveUp() => MoveTo(DirectionType.Up);
|
||||
/// <summary>
|
||||
/// Перемещение вниз
|
||||
/// </summary>
|
||||
/// <returns>Результат перемещения (true - удалось переместиться, false - неудача)</returns>
|
||||
protected bool MoveDown() => MoveTo(DirectionType.Down);
|
||||
/// <summary>
|
||||
/// Параметры объекта
|
||||
/// </summary>
|
||||
protected ObjectParameters? GetObjectParameters =>
|
||||
_moveableObject?.GetObjectPosition;
|
||||
/// <summary>
|
||||
/// Шаг объекта
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected int? GetStep()
|
||||
{
|
||||
if (_state != Status.InProgress)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return _moveableObject?.GetStep;
|
||||
}
|
||||
/// <summary>
|
||||
/// Перемещение к цели
|
||||
/// </summary>
|
||||
protected abstract void MoveToTarget();
|
||||
/// <summary>
|
||||
/// Достигнута ли цель
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected abstract bool IsTargetDestinaion();
|
||||
/// <summary>
|
||||
/// Попытка перемещения в требуемом направлении
|
||||
/// </summary>
|
||||
/// <param name="directionType">Направление</param>
|
||||
/// <returns>Результат попытки (true - удалось переместиться, false - неудача)</returns>
|
||||
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,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using AntiAircraftGun.DrawingObjects;
|
||||
|
||||
namespace AntiAircraftGun.MovementStrategy
|
||||
{
|
||||
public class DrawingObjectAntiAirCraftGun : IMoveableObject
|
||||
{
|
||||
private readonly BaseDrawingAntiAirCraftGun? _drawningAntiAirCraftGun = null;
|
||||
public DrawingObjectAntiAirCraftGun(BaseDrawingAntiAirCraftGun drawningCar)
|
||||
{
|
||||
_drawningAntiAirCraftGun = drawningCar;
|
||||
}
|
||||
public ObjectParameters? GetObjectPosition
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_drawningAntiAirCraftGun == null || _drawningAntiAirCraftGun.AntiAirСraftGun ==
|
||||
null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new ObjectParameters(_drawningAntiAirCraftGun.GetPosX,
|
||||
_drawningAntiAirCraftGun.GetPosY, _drawningAntiAirCraftGun.GetWidth, _drawningAntiAirCraftGun.GetHeight);
|
||||
}
|
||||
}
|
||||
public int GetStep => (int)(_drawningAntiAirCraftGun?.AntiAirСraftGun?.Step ?? 0);
|
||||
public bool CheckCanMove(DirectionType direction) =>
|
||||
_drawningAntiAirCraftGun?.CanMove(direction) ?? false;
|
||||
public void MoveObject(DirectionType direction) =>
|
||||
_drawningAntiAirCraftGun?.MoveTransport(direction);
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AntiAircraftGun.MovementStrategy
|
||||
{
|
||||
public interface IMoveableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Получение координаты X объекта
|
||||
/// </summary>
|
||||
ObjectParameters? GetObjectPosition { get; }
|
||||
/// <summary>
|
||||
/// Шаг объекта
|
||||
/// </summary>
|
||||
int GetStep { get; }
|
||||
/// <summary>
|
||||
/// Проверка, можно ли переместиться по нужному направлению
|
||||
/// </summary>
|
||||
/// <param name="direction"></param>
|
||||
/// <returns></returns>
|
||||
bool CheckCanMove(DirectionType direction);
|
||||
/// <summary>
|
||||
/// Изменение направления пермещения объекта
|
||||
/// </summary>
|
||||
/// <param name="direction">Направление</param>
|
||||
void MoveObject(DirectionType direction);
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
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.RightBorder - FieldWidth;
|
||||
if (Math.Abs(diffX) > GetStep())
|
||||
{
|
||||
if (diffX > 0)
|
||||
{
|
||||
MoveLeft();
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveRight();
|
||||
}
|
||||
}
|
||||
var diffY = objParams.DownBorder - FieldHeight;
|
||||
if (Math.Abs(diffY) > GetStep())
|
||||
{
|
||||
if (diffY > 0)
|
||||
{
|
||||
MoveUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveDown();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,56 @@
|
||||
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,54 @@
|
||||
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;
|
||||
/// <summary>
|
||||
/// Левая граница
|
||||
/// </summary>
|
||||
public int LeftBorder => _x;
|
||||
/// <summary>
|
||||
/// Верхняя граница
|
||||
/// </summary>
|
||||
public int TopBorder => _y;
|
||||
/// <summary>
|
||||
/// Правая граница
|
||||
/// </summary>
|
||||
public int RightBorder => _x + _width;
|
||||
/// <summary>
|
||||
/// Нижняя граница
|
||||
/// </summary>
|
||||
public int DownBorder => _y + _height;
|
||||
/// <summary>
|
||||
/// Середина объекта
|
||||
/// </summary>
|
||||
public int ObjectMiddleHorizontal => _x + _width / 2;
|
||||
/// <summary>
|
||||
/// Середина объекта
|
||||
/// </summary>
|
||||
public int ObjectMiddleVertical => _y + _height / 2;
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="x">Координата X</param>
|
||||
/// <param name="y">Координата Y</param>
|
||||
/// <param name="width">Ширина</param>
|
||||
/// <param name="height">Высота</param>
|
||||
public ObjectParameters(int x, int y, int width, int height)
|
||||
{
|
||||
_x = x;
|
||||
_y = y;
|
||||
_width = width;
|
||||
_height = height;
|
||||
}
|
||||
}
|
||||
}
|
15
AntiAirCraftGun/AntiAirCraftGun/MovementStrategy/Status.cs
Normal file
15
AntiAirCraftGun/AntiAirCraftGun/MovementStrategy/Status.cs
Normal file
@ -0,0 +1,15 @@
|
||||
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
|
||||
}
|
||||
}
|
@ -1,17 +1,17 @@
|
||||
namespace AntiAirCraftGun
|
||||
namespace AntiAircraftGun
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new Form1());
|
||||
}
|
||||
}
|
||||
internal static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new FormAntiAirCraftGunCollection());
|
||||
}
|
||||
}
|
||||
}
|
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 strelkaDown {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("strelkaDown", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap strelkaLeft {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("strelkaLeft", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap strelkaRight {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("strelkaRight", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap strelkaTop {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("strelkaTop", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
133
AntiAirCraftGun/AntiAirCraftGun/Properties/Resources.resx
Normal file
133
AntiAirCraftGun/AntiAirCraftGun/Properties/Resources.resx
Normal file
@ -0,0 +1,133 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<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>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="strelkaDown" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\strelkaDown.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="strelkaTop" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\strelkaTop.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="strelkaLeft" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\strelkaLeft.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="strelkaRight" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\strelkaRight.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
BIN
AntiAirCraftGun/AntiAirCraftGun/Resources/strelkaDown.png
Normal file
BIN
AntiAirCraftGun/AntiAirCraftGun/Resources/strelkaDown.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
BIN
AntiAirCraftGun/AntiAirCraftGun/Resources/strelkaLeft.png
Normal file
BIN
AntiAirCraftGun/AntiAirCraftGun/Resources/strelkaLeft.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
BIN
AntiAirCraftGun/AntiAirCraftGun/Resources/strelkaRight.png
Normal file
BIN
AntiAirCraftGun/AntiAirCraftGun/Resources/strelkaRight.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
AntiAirCraftGun/AntiAirCraftGun/Resources/strelkaTop.png
Normal file
BIN
AntiAirCraftGun/AntiAirCraftGun/Resources/strelkaTop.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
Loading…
Reference in New Issue
Block a user