Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
a2997fa460 | |||
650433518e | |||
4af7ea9e8a |
121
AirFighter/AbstractStrategy.cs
Normal file
121
AirFighter/AbstractStrategy.cs
Normal file
@ -0,0 +1,121 @@
|
||||
|
||||
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
|
||||
namespace ProjectAirFighter.MovementStrategy
|
||||
{
|
||||
/// <summary>
|
||||
/// Класс-стратегия перемещения объекта
|
||||
/// </summary>
|
||||
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();
|
||||
}
|
||||
|
||||
protected bool MoveLeft() => MoveTo(DirectionType.Left);
|
||||
|
||||
protected bool MoveRight() => MoveTo(DirectionType.Right);
|
||||
|
||||
protected bool MoveUp() => MoveTo(DirectionType.Up);
|
||||
|
||||
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>
|
||||
|
||||
private bool MoveTo(DirectionType directionType)
|
||||
{
|
||||
if (_state != Status.InProgress)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (_moveableObject?.CheckCanMove(directionType) ?? false)
|
||||
{
|
||||
_moveableObject.MoveObject(directionType);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
34
AirFighter/AirFighter.csproj
Normal file
34
AirFighter/AirFighter.csproj
Normal file
@ -0,0 +1,34 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="DirectionType.enum" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="DirectionType.enum" />
|
||||
</ItemGroup>
|
||||
|
||||
<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>
|
29
AirFighter/DirectionType.enum
Normal file
29
AirFighter/DirectionType.enum
Normal file
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectAirFighter
|
||||
{
|
||||
public enum DirectionType
|
||||
{
|
||||
/// <summary>
|
||||
/// Вверх
|
||||
/// </summary>
|
||||
Up = 1,
|
||||
/// <summary>
|
||||
/// Вниз
|
||||
/// </summary>
|
||||
Down = 2,
|
||||
/// <summary>
|
||||
/// Влево
|
||||
/// </summary>
|
||||
Left = 3,
|
||||
/// <summary>
|
||||
/// Вправо
|
||||
/// </summary>
|
||||
Right = 4
|
||||
}
|
||||
|
||||
}
|
103
AirFighter/DrawningAirFighter.cs
Normal file
103
AirFighter/DrawningAirFighter.cs
Normal file
@ -0,0 +1,103 @@
|
||||
using ProjectAirFighter.Entities;
|
||||
|
||||
namespace ProjectAirFighter.DrawningObjects
|
||||
{
|
||||
public class DrawningAirFighter : DrawningAirplane
|
||||
{
|
||||
public DrawningAirFighter(int speed, double weight, Color bodyColor, Color
|
||||
additionalColor, bool racket, bool wing, int width, int height) :
|
||||
base(speed, weight, bodyColor, width, height, 160, 160)
|
||||
{
|
||||
if (EntityAirplane != null)
|
||||
{
|
||||
EntityAirplane = new EntityAirFighter(speed, weight, bodyColor, additionalColor, racket, wing);
|
||||
}
|
||||
}
|
||||
|
||||
public override void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityAirplane is not EntityAirFighter airFighter)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Brush additionalBrush = new SolidBrush(airFighter.AdditionalColor);
|
||||
Pen pen = new(Color.Black);
|
||||
base.DrawTransport(g);
|
||||
if (airFighter.Racket)
|
||||
{
|
||||
Brush brGrey = new SolidBrush(Color.LightGray);
|
||||
g.FillRectangle(brGrey, _startPosX + 70, _startPosY - 15, 10, 10);
|
||||
g.DrawRectangle(pen, _startPosX + 70, _startPosY - 15, 10, 10);
|
||||
Point[] noseracketPoints =
|
||||
{
|
||||
new Point(_startPosX + 70, _startPosY -5),
|
||||
new Point(_startPosX + 70, _startPosY - 15),
|
||||
new Point(_startPosX + 60,_startPosY -10)
|
||||
};
|
||||
Brush brRed = new SolidBrush(Color.Red);
|
||||
g.FillPolygon(brRed, noseracketPoints);
|
||||
g.DrawPolygon(pen, noseracketPoints);
|
||||
|
||||
g.FillRectangle(brGrey, _startPosX + 70, _startPosY - 40, 10, 10);
|
||||
g.DrawRectangle(pen, _startPosX + 70, _startPosY - 40, 10, 10);
|
||||
Point[] noseracketPoints2 =
|
||||
{
|
||||
new Point(_startPosX + 70, _startPosY -30),
|
||||
new Point(_startPosX + 70, _startPosY - 40),
|
||||
new Point(_startPosX + 60,_startPosY -35)
|
||||
};
|
||||
g.FillPolygon(brRed, noseracketPoints2);
|
||||
g.DrawPolygon(pen, noseracketPoints2);
|
||||
g.FillPolygon(brRed, noseracketPoints);
|
||||
g.DrawPolygon(pen, noseracketPoints);
|
||||
|
||||
g.FillRectangle(brGrey, _startPosX + 70, _startPosY + 59, 10, 10);
|
||||
g.DrawRectangle(pen, _startPosX + 70, _startPosY + 59, 10, 10);
|
||||
Point[] noseracketPoints3 =
|
||||
{
|
||||
new Point(_startPosX + 70, _startPosY +59),
|
||||
new Point(_startPosX + 70, _startPosY + 69),
|
||||
new Point(_startPosX + 60,_startPosY + 64)
|
||||
};
|
||||
g.FillPolygon(brRed, noseracketPoints3);
|
||||
g.DrawPolygon(pen, noseracketPoints3);
|
||||
|
||||
g.FillRectangle(brGrey, _startPosX + 70, _startPosY + 34, 10, 10);
|
||||
g.DrawRectangle(pen, _startPosX + 70, _startPosY + 34, 10, 10);
|
||||
Point[] noseracketPoints4 =
|
||||
{
|
||||
new Point(_startPosX + 70, _startPosY +34),
|
||||
new Point(_startPosX + 70, _startPosY + 44),
|
||||
new Point(_startPosX + 60,_startPosY + 39)
|
||||
};
|
||||
g.FillPolygon(brRed, noseracketPoints4);
|
||||
g.DrawPolygon(pen, noseracketPoints4);
|
||||
}
|
||||
if (airFighter.Wing)
|
||||
{
|
||||
Point[] doprightwingPoints =
|
||||
{
|
||||
new Point(_startPosX + 30, _startPosY + 4),
|
||||
new Point(_startPosX+30,_startPosY - 34),
|
||||
new Point(_startPosX+35,_startPosY - 34),
|
||||
new Point(_startPosX + 45, _startPosY + 4)
|
||||
|
||||
};
|
||||
g.FillPolygon(additionalBrush, doprightwingPoints);
|
||||
g.DrawPolygon(pen, doprightwingPoints);
|
||||
|
||||
Point[] doplefttwingPoints =
|
||||
{
|
||||
new Point(_startPosX + 30, _startPosY + 24),
|
||||
new Point(_startPosX + 30, _startPosY + 59),
|
||||
new Point(_startPosX+35,_startPosY + 59),
|
||||
new Point(_startPosX+45,_startPosY + 24)
|
||||
|
||||
};
|
||||
g.FillPolygon(additionalBrush, doplefttwingPoints);
|
||||
g.DrawPolygon(pen, doplefttwingPoints);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
182
AirFighter/DrawningAirplane.cs
Normal file
182
AirFighter/DrawningAirplane.cs
Normal file
@ -0,0 +1,182 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ProjectAirFighter.Entities;
|
||||
|
||||
namespace ProjectAirFighter.DrawningObjects
|
||||
{
|
||||
public class DrawningAirplane
|
||||
{
|
||||
public EntityAirplane? EntityAirplane { get; protected set; }
|
||||
private int _pictureWidth;
|
||||
private int _pictureHeight;
|
||||
protected int _startPosX;
|
||||
protected int _startPosY;
|
||||
protected readonly int _airplaneWidth = 163;
|
||||
protected readonly int _airplaneHeight = 160;
|
||||
protected readonly int _airplanewingHeight = 70;
|
||||
protected readonly int _airplanerwingkorpusHeight = 90;
|
||||
public int GetPosX => _startPosX;
|
||||
public int GetPosY => _startPosY;
|
||||
public int GetWidth => _airplaneWidth;
|
||||
public int GetHeight => _airplaneHeight;
|
||||
|
||||
public DrawningAirplane(int speed, double weight, Color bodyColor,int width, int height)
|
||||
{
|
||||
if (width <= _airplaneWidth || height <= _airplanewingHeight)
|
||||
return;
|
||||
_pictureWidth = width;
|
||||
|
||||
_pictureHeight = height;
|
||||
|
||||
EntityAirplane = new EntityAirplane(speed, weight, bodyColor);
|
||||
}
|
||||
|
||||
protected DrawningAirplane(int speed, double weight, Color bodyColor, int
|
||||
width, int height, int airplaneWidth, int airplaneHeight)
|
||||
{
|
||||
if (width <= _airplaneWidth || height <= _airplanewingHeight)
|
||||
return;
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
_airplaneWidth = airplaneWidth;
|
||||
_airplanewingHeight = airplaneHeight;
|
||||
|
||||
EntityAirplane = new EntityAirplane(speed, weight, bodyColor);
|
||||
}
|
||||
|
||||
public void SetPosition(int x, int y)
|
||||
{
|
||||
if (EntityAirplane == null)
|
||||
return;
|
||||
_startPosX = x;
|
||||
_startPosY = y;
|
||||
if (x + _airplaneWidth >= _pictureWidth || y + _airplaneHeight >= _pictureHeight)
|
||||
{
|
||||
_startPosX = 1;
|
||||
_startPosY = (_airplanewingHeight+_airplanerwingkorpusHeight)/2;
|
||||
}
|
||||
}
|
||||
public bool CanMove(DirectionType direction)
|
||||
{
|
||||
if (EntityAirplane == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return direction switch
|
||||
{
|
||||
DirectionType.Left => _startPosX - EntityAirplane.Step > 0,
|
||||
|
||||
DirectionType.Up => _startPosY - EntityAirplane.Step - (_airplaneHeight - _airplaneHeight * 125 / 1000) / 2 > 0,
|
||||
|
||||
DirectionType.Right => _startPosX+ EntityAirplane.Step + _airplaneWidth < _pictureWidth,
|
||||
|
||||
DirectionType.Down => _startPosY + EntityAirplane.Step + _airplanerwingkorpusHeight < _pictureHeight,
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
public void MoveTransport(DirectionType direction)
|
||||
{
|
||||
if (!CanMove(direction) || EntityAirplane == null)
|
||||
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (direction)
|
||||
{
|
||||
case DirectionType.Left:
|
||||
_startPosX -= (int)EntityAirplane.Step;
|
||||
break;
|
||||
|
||||
case DirectionType.Up:
|
||||
_startPosY -= (int)EntityAirplane.Step;
|
||||
break;
|
||||
|
||||
case DirectionType.Right:
|
||||
_startPosX += (int)EntityAirplane.Step;
|
||||
break;
|
||||
|
||||
case DirectionType.Down:
|
||||
_startPosY += (int)EntityAirplane.Step;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityAirplane == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Pen pen = new(Color.Black);
|
||||
|
||||
Brush br = new SolidBrush(EntityAirplane.BodyColor);
|
||||
Point[] nosePoints =
|
||||
{
|
||||
new Point(_startPosX + 20, _startPosY + 4),
|
||||
new Point(_startPosX + 20, _startPosY + 24),
|
||||
new Point(_startPosX-3,_startPosY + 12)
|
||||
};
|
||||
Brush brBlack = new SolidBrush(Color.Black);
|
||||
g.FillPolygon(brBlack, nosePoints);
|
||||
g.DrawPolygon(pen, nosePoints);
|
||||
|
||||
Point[] rightwingPoints =
|
||||
{
|
||||
new Point(_startPosX + 80, _startPosY + 4),
|
||||
new Point(_startPosX+80,_startPosY - 64),
|
||||
new Point(_startPosX+85,_startPosY - 64),
|
||||
new Point(_startPosX + 100, _startPosY + 4)
|
||||
|
||||
};
|
||||
|
||||
g.DrawPolygon(pen, rightwingPoints);
|
||||
g.FillPolygon(br, rightwingPoints);
|
||||
|
||||
Point[] lefttwingPoints =
|
||||
{
|
||||
new Point(_startPosX + 80, _startPosY + 24),
|
||||
new Point(_startPosX + 100, _startPosY + 24),
|
||||
new Point(_startPosX+85,_startPosY + 94),
|
||||
new Point(_startPosX+80,_startPosY + 94)
|
||||
|
||||
};
|
||||
|
||||
g.DrawPolygon(pen, lefttwingPoints);
|
||||
g.FillPolygon(br, lefttwingPoints);
|
||||
|
||||
Point[] leftenginePoints =
|
||||
{
|
||||
new Point(_startPosX + 140, _startPosY + 24),
|
||||
new Point(_startPosX + 160, _startPosY + 24),
|
||||
new Point(_startPosX+160,_startPosY + 50),
|
||||
new Point(_startPosX+140,_startPosY + 32)
|
||||
|
||||
};
|
||||
|
||||
g.DrawPolygon(pen, leftenginePoints);
|
||||
g.FillPolygon(br, leftenginePoints);
|
||||
|
||||
Point[] rightenginePoints =
|
||||
{
|
||||
new Point(_startPosX + 140, _startPosY + 24),
|
||||
new Point(_startPosX + 160, _startPosY + 24),
|
||||
new Point(_startPosX+160,_startPosY - 16),
|
||||
new Point(_startPosX+140,_startPosY -4)
|
||||
|
||||
};
|
||||
|
||||
g.DrawPolygon(pen, rightenginePoints);
|
||||
g.FillPolygon(br, rightenginePoints);
|
||||
|
||||
g.DrawRectangle(pen, _startPosX + 20, _startPosY + 4, 140, _airplaneHeight * 125 / 1000);
|
||||
g.FillRectangle(br, _startPosX + 20, _startPosY + 4, 140, _airplaneHeight * 125 / 1000);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
39
AirFighter/DrawningObjectAirplane.cs
Normal file
39
AirFighter/DrawningObjectAirplane.cs
Normal file
@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ProjectAirFighter.DrawningObjects;
|
||||
|
||||
namespace ProjectAirFighter.MovementStrategy
|
||||
{
|
||||
public class DrawningObjectAirplane: IMoveableObject
|
||||
{
|
||||
private readonly DrawningAirplane? _drawningAirplane = null;
|
||||
public DrawningObjectAirplane(DrawningAirplane drawningAirplane)
|
||||
{
|
||||
_drawningAirplane = drawningAirplane;
|
||||
}
|
||||
public ObjectParameters? GetObjectPosition
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_drawningAirplane == null || _drawningAirplane.EntityAirplane ==
|
||||
null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new ObjectParameters(_drawningAirplane.GetPosX,
|
||||
_drawningAirplane.GetPosY, _drawningAirplane.GetWidth, _drawningAirplane.GetHeight);
|
||||
}
|
||||
}
|
||||
public int GetStep => (int)(_drawningAirplane?.EntityAirplane?.Step ?? 0);
|
||||
public bool CheckCanMove(DirectionType direction) =>
|
||||
_drawningAirplane?.CanMove(direction) ?? false;
|
||||
public void MoveObject(DirectionType direction) =>
|
||||
_drawningAirplane?.MoveTransport(direction);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
24
AirFighter/EntityAirFighter.cs
Normal file
24
AirFighter/EntityAirFighter.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectAirFighter.Entities
|
||||
|
||||
{
|
||||
public class EntityAirFighter: EntityAirplane
|
||||
{
|
||||
public Color AdditionalColor { get; private set; }
|
||||
public bool Racket { get; private set; }
|
||||
public bool Wing { get; private set; }
|
||||
|
||||
public EntityAirFighter(int speed, double weight, Color bodyColor, Color additionalColor, bool racket, bool wing):
|
||||
base(speed,weight,bodyColor)
|
||||
{
|
||||
AdditionalColor = additionalColor;
|
||||
Racket = racket;
|
||||
Wing = wing;
|
||||
}
|
||||
}
|
||||
}
|
25
AirFighter/EntityAirplane.cs
Normal file
25
AirFighter/EntityAirplane.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectAirFighter.Entities
|
||||
{
|
||||
public class EntityAirplane
|
||||
{
|
||||
public int Speed { get; private set; }
|
||||
public double Weight { get; private set; }
|
||||
public Color BodyColor { get; private set; }
|
||||
public double Step => (double)Speed * 100 / Weight;
|
||||
|
||||
public EntityAirplane(int speed, double weight, Color bodyColor)
|
||||
{
|
||||
Speed = speed;
|
||||
Weight = weight;
|
||||
BodyColor = bodyColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
171
AirFighter/FormAirFighter.Designer.cs
generated
Normal file
171
AirFighter/FormAirFighter.Designer.cs
generated
Normal file
@ -0,0 +1,171 @@
|
||||
namespace ProjectAirFighter
|
||||
{
|
||||
partial class FormAirFighter
|
||||
{
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
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.pictureBoxAirFighter = new System.Windows.Forms.PictureBox();
|
||||
this.ButtonCreateAirFighter = new System.Windows.Forms.Button();
|
||||
this.buttonUp = new System.Windows.Forms.Button();
|
||||
this.buttonLeft = new System.Windows.Forms.Button();
|
||||
this.buttonDown = new System.Windows.Forms.Button();
|
||||
this.buttonRight = new System.Windows.Forms.Button();
|
||||
this.comboBoxStrategy = new System.Windows.Forms.ComboBox();
|
||||
this.ButtonCreateAirplane = new System.Windows.Forms.Button();
|
||||
this.ButtonStep = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxAirFighter)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// pictureBoxAirFighter
|
||||
//
|
||||
this.pictureBoxAirFighter.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.pictureBoxAirFighter.Location = new System.Drawing.Point(0, 0);
|
||||
this.pictureBoxAirFighter.Name = "pictureBoxAirFighter";
|
||||
this.pictureBoxAirFighter.Size = new System.Drawing.Size(882, 453);
|
||||
this.pictureBoxAirFighter.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
|
||||
this.pictureBoxAirFighter.TabIndex = 0;
|
||||
this.pictureBoxAirFighter.TabStop = false;
|
||||
//
|
||||
// ButtonCreateAirFighter
|
||||
//
|
||||
this.ButtonCreateAirFighter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.ButtonCreateAirFighter.Location = new System.Drawing.Point(0, 405);
|
||||
this.ButtonCreateAirFighter.Name = "ButtonCreateAirFighter";
|
||||
this.ButtonCreateAirFighter.Size = new System.Drawing.Size(144, 48);
|
||||
this.ButtonCreateAirFighter.TabIndex = 1;
|
||||
this.ButtonCreateAirFighter.Text = "Создать военный самолёт";
|
||||
this.ButtonCreateAirFighter.UseVisualStyleBackColor = true;
|
||||
this.ButtonCreateAirFighter.Click += new System.EventHandler(this.ButtonCreateAirFighter_Click);
|
||||
//
|
||||
// buttonUp
|
||||
//
|
||||
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonUp.BackgroundImage = global::AirFighter.Properties.Resources.kisspng_up_arrow_computer_icons_arrow_down_clip_art_5af6157c473cb4_0747815015260767962918;
|
||||
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.buttonUp.Location = new System.Drawing.Point(816, 387);
|
||||
this.buttonUp.Name = "buttonUp";
|
||||
this.buttonUp.Size = new System.Drawing.Size(30, 30);
|
||||
this.buttonUp.TabIndex = 2;
|
||||
this.buttonUp.UseVisualStyleBackColor = true;
|
||||
this.buttonUp.Click += new System.EventHandler(this.buttonMove_Click);
|
||||
//
|
||||
// buttonLeft
|
||||
//
|
||||
this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonLeft.BackgroundImage = global::AirFighter.Properties.Resources.png_clipart_computer_icons_graphics_arrow_symbol_arrow_angle_desktop_wallpaper;
|
||||
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.buttonLeft.Location = new System.Drawing.Point(780, 424);
|
||||
this.buttonLeft.Name = "buttonLeft";
|
||||
this.buttonLeft.Size = new System.Drawing.Size(30, 30);
|
||||
this.buttonLeft.TabIndex = 3;
|
||||
this.buttonLeft.UseVisualStyleBackColor = true;
|
||||
this.buttonLeft.Click += new System.EventHandler(this.buttonMove_Click);
|
||||
//
|
||||
// buttonDown
|
||||
//
|
||||
this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonDown.BackgroundImage = global::AirFighter.Properties.Resources.png_clipart_computer_icons_uma_musume_pretty_derby_fate_grand_order_saber_kemono_friends_three_arrow_game_angle;
|
||||
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.buttonDown.Location = new System.Drawing.Point(816, 424);
|
||||
this.buttonDown.Name = "buttonDown";
|
||||
this.buttonDown.Size = new System.Drawing.Size(30, 30);
|
||||
this.buttonDown.TabIndex = 4;
|
||||
this.buttonDown.UseVisualStyleBackColor = true;
|
||||
this.buttonDown.Click += new System.EventHandler(this.buttonMove_Click);
|
||||
//
|
||||
// buttonRight
|
||||
//
|
||||
this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonRight.BackgroundImage = global::AirFighter.Properties.Resources.png_transparent_grammatical_person_paper_narration_direzione_didattica_statale_gestione_scuola_elementare_copy_print_right_arrow_miscellaneous_game_angle;
|
||||
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.buttonRight.Location = new System.Drawing.Point(852, 423);
|
||||
this.buttonRight.Name = "buttonRight";
|
||||
this.buttonRight.Size = new System.Drawing.Size(30, 30);
|
||||
this.buttonRight.TabIndex = 5;
|
||||
this.buttonRight.UseVisualStyleBackColor = true;
|
||||
this.buttonRight.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[] {
|
||||
"0",
|
||||
"1"});
|
||||
this.comboBoxStrategy.Location = new System.Drawing.Point(731, 0);
|
||||
this.comboBoxStrategy.Name = "comboBoxStrategy";
|
||||
this.comboBoxStrategy.Size = new System.Drawing.Size(151, 28);
|
||||
this.comboBoxStrategy.TabIndex = 6;
|
||||
//
|
||||
// ButtonCreateAirplane
|
||||
//
|
||||
this.ButtonCreateAirplane.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.ButtonCreateAirplane.Location = new System.Drawing.Point(150, 405);
|
||||
this.ButtonCreateAirplane.Name = "ButtonCreateAirplane";
|
||||
this.ButtonCreateAirplane.Size = new System.Drawing.Size(143, 47);
|
||||
this.ButtonCreateAirplane.TabIndex = 7;
|
||||
this.ButtonCreateAirplane.Text = "Создать самолёт";
|
||||
this.ButtonCreateAirplane.UseVisualStyleBackColor = true;
|
||||
this.ButtonCreateAirplane.Click += new System.EventHandler(this.ButtonCreateAirplane_Click);
|
||||
//
|
||||
// ButtonStep
|
||||
//
|
||||
this.ButtonStep.Location = new System.Drawing.Point(788, 34);
|
||||
this.ButtonStep.Name = "ButtonStep";
|
||||
this.ButtonStep.Size = new System.Drawing.Size(94, 29);
|
||||
this.ButtonStep.TabIndex = 8;
|
||||
this.ButtonStep.Text = "Шаг";
|
||||
this.ButtonStep.UseVisualStyleBackColor = true;
|
||||
this.ButtonStep.Click += new System.EventHandler(this.ButtonStep_Click);
|
||||
//
|
||||
// FormAirFighter
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(882, 453);
|
||||
this.Controls.Add(this.ButtonStep);
|
||||
this.Controls.Add(this.ButtonCreateAirplane);
|
||||
this.Controls.Add(this.comboBoxStrategy);
|
||||
this.Controls.Add(this.buttonRight);
|
||||
this.Controls.Add(this.buttonDown);
|
||||
this.Controls.Add(this.buttonLeft);
|
||||
this.Controls.Add(this.buttonUp);
|
||||
this.Controls.Add(this.ButtonCreateAirFighter);
|
||||
this.Controls.Add(this.pictureBoxAirFighter);
|
||||
this.Name = "FormAirFighter";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "FormAirFighter";
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxAirFighter)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private PictureBox pictureBoxAirFighter;
|
||||
private Button ButtonCreateAirFighter;
|
||||
private Button buttonUp;
|
||||
private Button buttonLeft;
|
||||
private Button buttonDown;
|
||||
private Button buttonRight;
|
||||
private ComboBox comboBoxStrategy;
|
||||
private Button ButtonCreateAirplane;
|
||||
private Button ButtonStep;
|
||||
}
|
||||
}
|
118
AirFighter/FormAirFighter.cs
Normal file
118
AirFighter/FormAirFighter.cs
Normal file
@ -0,0 +1,118 @@
|
||||
using ProjectAirFighter.MovementStrategy;
|
||||
using ProjectAirFighter.DrawningObjects;
|
||||
|
||||
namespace ProjectAirFighter
|
||||
{
|
||||
public partial class FormAirFighter : Form
|
||||
{
|
||||
private DrawningAirplane? _drawningAirplane;
|
||||
private AbstractStrategy? _abstractStrategy;
|
||||
|
||||
public FormAirFighter()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void Draw()
|
||||
{
|
||||
if (_drawningAirplane == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Bitmap bmp = new(pictureBoxAirFighter.Width,
|
||||
pictureBoxAirFighter.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_drawningAirplane.DrawTransport(gr);
|
||||
pictureBoxAirFighter.Image = bmp;
|
||||
}
|
||||
|
||||
private void ButtonCreateAirplane_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new();
|
||||
_drawningAirplane = new DrawningAirplane(random.Next(100, 300),
|
||||
random.Next(1000, 3000),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
||||
pictureBoxAirFighter.Width, pictureBoxAirFighter.Height);
|
||||
_drawningAirplane.SetPosition(random.Next(10, 100), random.Next(70, 100));
|
||||
|
||||
Draw();
|
||||
}
|
||||
private void ButtonCreateAirFighter_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new();
|
||||
_drawningAirplane = new DrawningAirFighter (random.Next(100, 300),
|
||||
random.Next(1000, 3000),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256),random.Next(0, 256)),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256),random.Next(0, 256)),
|
||||
Convert.ToBoolean(random.Next(0, 2)),
|
||||
Convert.ToBoolean(random.Next(0, 2)),
|
||||
pictureBoxAirFighter.Width, pictureBoxAirFighter.Height);
|
||||
_drawningAirplane.SetPosition(random.Next(10, 100), random.Next(70, 100));
|
||||
Draw();
|
||||
}
|
||||
|
||||
private void buttonMove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawningAirplane == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
string name = ((Button)sender)?.Name ?? string.Empty;
|
||||
switch (name)
|
||||
{
|
||||
case "buttonUp":
|
||||
_drawningAirplane.MoveTransport(DirectionType.Up);
|
||||
break;
|
||||
case "buttonDown":
|
||||
_drawningAirplane.MoveTransport(DirectionType.Down);
|
||||
break;
|
||||
case "buttonLeft":
|
||||
_drawningAirplane.MoveTransport(DirectionType.Left);
|
||||
break;
|
||||
case "buttonRight":
|
||||
_drawningAirplane.MoveTransport(DirectionType.Right);
|
||||
break;
|
||||
}
|
||||
Draw();
|
||||
}
|
||||
|
||||
private void ButtonStep_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawningAirplane == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (comboBoxStrategy.Enabled)
|
||||
{
|
||||
_abstractStrategy = comboBoxStrategy.SelectedIndex
|
||||
switch
|
||||
{
|
||||
0 => new MoveToCenter(),
|
||||
1 => new MoveToBorder(),
|
||||
_ => null,
|
||||
};
|
||||
if (_abstractStrategy == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_abstractStrategy.SetData(new
|
||||
DrawningObjectAirplane(_drawningAirplane), pictureBoxAirFighter.Width,
|
||||
pictureBoxAirFighter.Height);
|
||||
comboBoxStrategy.Enabled = false;
|
||||
}
|
||||
if (_abstractStrategy == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_abstractStrategy.MakeStep();
|
||||
Draw();
|
||||
if (_abstractStrategy.GetStatus() == Status.Finish)
|
||||
{
|
||||
comboBoxStrategy.Enabled = true;
|
||||
_abstractStrategy = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
60
AirFighter/FormAirFighter.resx
Normal file
60
AirFighter/FormAirFighter.resx
Normal file
@ -0,0 +1,60 @@
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
28
AirFighter/IMoveableObject.cs
Normal file
28
AirFighter/IMoveableObject.cs
Normal file
@ -0,0 +1,28 @@
|
||||
namespace ProjectAirFighter.MovementStrategy
|
||||
{
|
||||
/// <summary>
|
||||
/// Интерфейс для работы с перемещаемым объектом
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
50
AirFighter/MoveToBorder.cs
Normal file
50
AirFighter/MoveToBorder.cs
Normal file
@ -0,0 +1,50 @@
|
||||
using ProjectAirFighter.MovementStrategy;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectAirFighter.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 + GetStep() >= FieldHeight;
|
||||
}
|
||||
|
||||
protected override void MoveToTarget()
|
||||
{
|
||||
var objParams = GetObjectParameters;
|
||||
if (objParams == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var diffX = objParams.RightBorder - (FieldWidth - 1);
|
||||
if (Math.Abs(diffX) > GetStep())
|
||||
{
|
||||
if (diffX < 0)
|
||||
{
|
||||
MoveRight();
|
||||
}
|
||||
}
|
||||
var diffY = objParams.DownBorder - (FieldHeight - 1);
|
||||
if (Math.Abs(diffY) > GetStep())
|
||||
{
|
||||
if (diffY < 0)
|
||||
{
|
||||
MoveDown();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
51
AirFighter/MoveToCenter.cs
Normal file
51
AirFighter/MoveToCenter.cs
Normal file
@ -0,0 +1,51 @@
|
||||
namespace ProjectAirFighter.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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
31
AirFighter/ObjectParameters.cs
Normal file
31
AirFighter/ObjectParameters.cs
Normal file
@ -0,0 +1,31 @@
|
||||
namespace ProjectAirFighter.MovementStrategy
|
||||
{
|
||||
public class ObjectParameters
|
||||
{
|
||||
private readonly int _x;
|
||||
private readonly int _y;
|
||||
private readonly int _width;
|
||||
private readonly int _height;
|
||||
|
||||
public int LeftBorder => _x;
|
||||
|
||||
public int TopBorder => _y;
|
||||
|
||||
public int RightBorder => _x + _width;
|
||||
|
||||
public int DownBorder => _y + _height * 125 / 1000 + (_height-_height * 125 / 1000)/2 ;
|
||||
|
||||
public int ObjectMiddleHorizontal => _x + _width / 2;
|
||||
|
||||
public int ObjectMiddleVertical => _y +(_height - _height * 125 / 1000) / 2 / 2;
|
||||
|
||||
public ObjectParameters(int x, int y, int width, int height)
|
||||
{
|
||||
_x = x;
|
||||
_y = y;
|
||||
_width = width;
|
||||
_height = height;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
15
AirFighter/Program.cs
Normal file
15
AirFighter/Program.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System.Drawing;
|
||||
|
||||
namespace ProjectAirFighter
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new FormAirFighter());
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.3.32825.248
|
||||
VisualStudioVersion = 17.5.33530.505
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormsApp1", "WinFormsApp1.csproj", "{855C52EB-A23F-42BD-875C-C5703182C585}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AirFighter", "AirFighter.csproj", "{22602141-1DD8-4CA2-ACE8-935BC23A9C30}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -11,15 +11,15 @@ Global
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{855C52EB-A23F-42BD-875C-C5703182C585}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{855C52EB-A23F-42BD-875C-C5703182C585}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{855C52EB-A23F-42BD-875C-C5703182C585}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{855C52EB-A23F-42BD-875C-C5703182C585}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{22602141-1DD8-4CA2-ACE8-935BC23A9C30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{22602141-1DD8-4CA2-ACE8-935BC23A9C30}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{22602141-1DD8-4CA2-ACE8-935BC23A9C30}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{22602141-1DD8-4CA2-ACE8-935BC23A9C30}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {599F48E4-DA50-4BFB-9FCF-C72D7D505673}
|
||||
SolutionGuid = {2CDBC790-EBFB-4261-A416-9D0938E15A56}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
106
AirFighter/Properties/Resources.Designer.cs
generated
Normal file
106
AirFighter/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,106 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace AirFighter.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("AirFighter.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 kisspng_up_arrow_computer_icons_arrow_down_clip_art_5af6157c473cb4_0747815015260767962918 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("kisspng-up-arrow-computer-icons-arrow-down-clip-art-5af6157c473cb4.07478150152607" +
|
||||
"67962918", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap png_clipart_computer_icons_graphics_arrow_symbol_arrow_angle_desktop_wallpaper {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("png-clipart-computer-icons-graphics-arrow-symbol-arrow-angle-desktop-wallpaper", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap png_clipart_computer_icons_uma_musume_pretty_derby_fate_grand_order_saber_kemono_friends_three_arrow_game_angle {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("png-clipart-computer-icons-uma-musume-pretty-derby-fate-grand-order-saber-kemono-" +
|
||||
"friends-three-arrow-game-angle", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap png_transparent_grammatical_person_paper_narration_direzione_didattica_statale_gestione_scuola_elementare_copy_print_right_arrow_miscellaneous_game_angle {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("png-transparent-grammatical-person-paper-narration-direzione-didattica-statale-ge" +
|
||||
"stione-scuola-elementare-copy-print-right-arrow-miscellaneous-game-angle", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -117,4 +117,17 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="png-clipart-computer-icons-uma-musume-pretty-derby-fate-grand-order-saber-kemono-friends-three-arrow-game-angle" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\png-clipart-computer-icons-uma-musume-pretty-derby-fate-grand-order-saber-kemono-friends-three-arrow-game-angle.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="png-transparent-grammatical-person-paper-narration-direzione-didattica-statale-gestione-scuola-elementare-copy-print-right-arrow-miscellaneous-game-angle" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\png-transparent-grammatical-person-paper-narration-direzione-didattica-statale-gestione-scuola-elementare-copy-print-right-arrow-miscellaneous-game-angle.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="png-clipart-computer-icons-graphics-arrow-symbol-arrow-angle-desktop-wallpaper" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\png-clipart-computer-icons-graphics-arrow-symbol-arrow-angle-desktop-wallpaper.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="kisspng-up-arrow-computer-icons-arrow-down-clip-art-5af6157c473cb4.0747815015260767962918" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\kisspng-up-arrow-computer-icons-arrow-down-clip-art-5af6157c473cb4.0747815015260767962918.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
12
AirFighter/Status.cs
Normal file
12
AirFighter/Status.cs
Normal file
@ -0,0 +1,12 @@
|
||||
namespace ProjectAirFighter.MovementStrategy
|
||||
{
|
||||
/// <summary>
|
||||
/// Статус выполнения операции перемещения
|
||||
/// </summary>
|
||||
public enum Status
|
||||
{
|
||||
NotInit,
|
||||
InProgress,
|
||||
Finish
|
||||
}
|
||||
}
|
39
WinFormsApp1/Form1.Designer.cs
generated
39
WinFormsApp1/Form1.Designer.cs
generated
@ -1,39 +0,0 @@
|
||||
namespace WinFormsApp1
|
||||
{
|
||||
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 WinFormsApp1
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
namespace WinFormsApp1
|
||||
{
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user