1 лабораторная работа
This commit is contained in:
parent
437fb1522c
commit
24286ac666
@ -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>
|
137
AirFighter/AirFighter/AirFighterForm.Designer.cs
generated
Normal file
137
AirFighter/AirFighter/AirFighterForm.Designer.cs
generated
Normal file
@ -0,0 +1,137 @@
|
||||
namespace AirFighter
|
||||
{
|
||||
partial class AirFighterForm
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
pictureBoxAirFighter = new PictureBox();
|
||||
buttonCreate = new Button();
|
||||
buttonUp = new Button();
|
||||
buttonLeft = new Button();
|
||||
buttonDown = new Button();
|
||||
buttonRight = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxAirFighter).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// pictureBoxAirFighter
|
||||
//
|
||||
pictureBoxAirFighter.Dock = DockStyle.Fill;
|
||||
pictureBoxAirFighter.Location = new Point(0, 0);
|
||||
pictureBoxAirFighter.Name = "pictureBoxAirFighter";
|
||||
pictureBoxAirFighter.Size = new Size(882, 453);
|
||||
pictureBoxAirFighter.SizeMode = PictureBoxSizeMode.AutoSize;
|
||||
pictureBoxAirFighter.TabIndex = 0;
|
||||
pictureBoxAirFighter.TabStop = false;
|
||||
//
|
||||
// buttonCreate
|
||||
//
|
||||
buttonCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
buttonCreate.Location = new Point(23, 403);
|
||||
buttonCreate.Name = "buttonCreate";
|
||||
buttonCreate.Size = new Size(94, 29);
|
||||
buttonCreate.TabIndex = 1;
|
||||
buttonCreate.Text = "Создать";
|
||||
buttonCreate.UseVisualStyleBackColor = true;
|
||||
buttonCreate.Click += buttonCreate_Click;
|
||||
//
|
||||
// buttonUp
|
||||
//
|
||||
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonUp.BackgroundImage = Properties.Resources.up;
|
||||
buttonUp.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
buttonUp.Location = new Point(691, 366);
|
||||
buttonUp.Name = "buttonUp";
|
||||
buttonUp.Size = new Size(30, 30);
|
||||
buttonUp.TabIndex = 2;
|
||||
buttonUp.UseVisualStyleBackColor = true;
|
||||
buttonUp.Click += buttonMove_Click;
|
||||
//
|
||||
// buttonLeft
|
||||
//
|
||||
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonLeft.BackgroundImage = Properties.Resources.left;
|
||||
buttonLeft.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
buttonLeft.Location = new Point(655, 402);
|
||||
buttonLeft.Name = "buttonLeft";
|
||||
buttonLeft.Size = new Size(30, 30);
|
||||
buttonLeft.TabIndex = 3;
|
||||
buttonLeft.UseVisualStyleBackColor = true;
|
||||
buttonLeft.Click += buttonMove_Click;
|
||||
//
|
||||
// buttonDown
|
||||
//
|
||||
buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonDown.BackgroundImage = Properties.Resources.down;
|
||||
buttonDown.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
buttonDown.Location = new Point(691, 402);
|
||||
buttonDown.Name = "buttonDown";
|
||||
buttonDown.Size = new Size(30, 30);
|
||||
buttonDown.TabIndex = 4;
|
||||
buttonDown.UseVisualStyleBackColor = true;
|
||||
buttonDown.Click += buttonMove_Click;
|
||||
//
|
||||
// buttonRight
|
||||
//
|
||||
buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonRight.BackgroundImage = Properties.Resources.right;
|
||||
buttonRight.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
buttonRight.Location = new Point(727, 402);
|
||||
buttonRight.Name = "buttonRight";
|
||||
buttonRight.Size = new Size(30, 30);
|
||||
buttonRight.TabIndex = 5;
|
||||
buttonRight.UseVisualStyleBackColor = true;
|
||||
buttonRight.Click += buttonMove_Click;
|
||||
//
|
||||
// AirFighterForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(882, 453);
|
||||
Controls.Add(buttonRight);
|
||||
Controls.Add(buttonDown);
|
||||
Controls.Add(buttonLeft);
|
||||
Controls.Add(buttonUp);
|
||||
Controls.Add(buttonCreate);
|
||||
Controls.Add(pictureBoxAirFighter);
|
||||
Name = "AirFighterForm";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "AirFighter";
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxAirFighter).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private PictureBox pictureBoxAirFighter;
|
||||
private Button buttonCreate;
|
||||
private Button buttonUp;
|
||||
private Button buttonLeft;
|
||||
private Button buttonDown;
|
||||
private Button buttonRight;
|
||||
}
|
||||
}
|
66
AirFighter/AirFighter/AirFighterForm.cs
Normal file
66
AirFighter/AirFighter/AirFighterForm.cs
Normal file
@ -0,0 +1,66 @@
|
||||
namespace AirFighter
|
||||
{
|
||||
public partial class AirFighterForm : Form
|
||||
{
|
||||
private DrawningAirFighter? _drawningAirFighter;
|
||||
public AirFighterForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
private void Draw()
|
||||
{
|
||||
if (_drawningAirFighter == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Bitmap bmp = new(pictureBoxAirFighter.Width,
|
||||
pictureBoxAirFighter.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_drawningAirFighter.DrawTransport(gr);
|
||||
pictureBoxAirFighter.Image = bmp;
|
||||
}
|
||||
private void buttonCreate_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new();
|
||||
_drawningAirFighter = new DrawningAirFighter();
|
||||
_drawningAirFighter.Init(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);
|
||||
|
||||
_drawningAirFighter.SetPosition(random.Next(10, 100),
|
||||
random.Next(random.Next(10, 100)));
|
||||
Draw();
|
||||
}
|
||||
|
||||
private void buttonMove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawningAirFighter == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
string name = ((Button)sender)?.Name ?? string.Empty;
|
||||
switch (name)
|
||||
{
|
||||
case "buttonUp":
|
||||
_drawningAirFighter.MoveTransport(DirectionType.Up);
|
||||
break;
|
||||
case "buttonDown":
|
||||
_drawningAirFighter.MoveTransport(DirectionType.Down);
|
||||
break;
|
||||
case "buttonLeft":
|
||||
_drawningAirFighter.MoveTransport(DirectionType.Left);
|
||||
break;
|
||||
case "buttonRight":
|
||||
_drawningAirFighter.MoveTransport(DirectionType.Right);
|
||||
break;
|
||||
}
|
||||
Draw();
|
||||
}
|
||||
}
|
||||
}
|
@ -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.
|
||||
-->
|
19
AirFighter/AirFighter/DirectionType.cs
Normal file
19
AirFighter/AirFighter/DirectionType.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AirFighter
|
||||
{
|
||||
public enum DirectionType
|
||||
{
|
||||
Up = 1,
|
||||
|
||||
Down = 2,
|
||||
|
||||
Left = 3,
|
||||
|
||||
Right = 4
|
||||
}
|
||||
}
|
245
AirFighter/AirFighter/DrawningAirFighter.cs
Normal file
245
AirFighter/AirFighter/DrawningAirFighter.cs
Normal file
@ -0,0 +1,245 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AirFighter
|
||||
{
|
||||
internal class DrawningAirFighter
|
||||
{
|
||||
public EntityAirFighter? EntityAirFighter { get; private set; }
|
||||
|
||||
private int _pictureWidth;
|
||||
|
||||
private int _pictureHeight;
|
||||
|
||||
private int _startPosX;
|
||||
|
||||
private int _startPosY;
|
||||
|
||||
private readonly int _airFigherWidth = 90;
|
||||
|
||||
private readonly int _airFigherHeight = 95;
|
||||
|
||||
public bool Init(int speed, double weight, Color bodyColor, Color
|
||||
additionalColor, bool rockets, bool wings, int width, int height)
|
||||
{
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
|
||||
if (_airFigherWidth < _pictureWidth || _airFigherHeight < _pictureHeight)
|
||||
{
|
||||
EntityAirFighter = new EntityAirFighter();
|
||||
EntityAirFighter.Init(speed, weight, bodyColor, additionalColor,
|
||||
rockets, wings);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void SetPosition(int x, int y)
|
||||
{
|
||||
_startPosX = x;
|
||||
_startPosY = y;
|
||||
|
||||
if (_startPosX < 0 || _startPosY < 0 || _startPosX > (_pictureWidth - _airFigherWidth) || _startPosY > (_pictureHeight - _airFigherHeight))
|
||||
{
|
||||
_startPosX = 50;
|
||||
_startPosY = 50;
|
||||
}
|
||||
}
|
||||
|
||||
public void MoveTransport(DirectionType direction)
|
||||
{
|
||||
if (EntityAirFighter == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (direction)
|
||||
{
|
||||
//влево
|
||||
case DirectionType.Left:
|
||||
if (_startPosX - EntityAirFighter.Step > 0)
|
||||
{
|
||||
_startPosX -= (int)EntityAirFighter.Step;
|
||||
}
|
||||
break;
|
||||
//вверх
|
||||
case DirectionType.Up:
|
||||
if (_startPosY - EntityAirFighter.Step > 0)
|
||||
{
|
||||
_startPosY -= (int)EntityAirFighter.Step;
|
||||
}
|
||||
break;
|
||||
// вправо
|
||||
case DirectionType.Right:
|
||||
if (_startPosX + EntityAirFighter.Step < _pictureWidth - _airFigherWidth)
|
||||
{
|
||||
_startPosX += (int)EntityAirFighter.Step;
|
||||
}
|
||||
break;
|
||||
//вниз
|
||||
case DirectionType.Down:
|
||||
if (_startPosY + EntityAirFighter.Step < _pictureHeight - _airFigherHeight)
|
||||
{
|
||||
_startPosY += (int)EntityAirFighter.Step;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityAirFighter == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Pen pen = new(Color.Black);
|
||||
Brush bodyBrush = new SolidBrush(EntityAirFighter.BodyColor);
|
||||
Brush additionalBrush = new SolidBrush(EntityAirFighter.AdditionalColor);
|
||||
|
||||
//тело истребителя
|
||||
g.DrawRectangle(pen, _startPosX + 10, _startPosY + 40, 80, 15);
|
||||
|
||||
//нос
|
||||
Point nose1 = new Point(_startPosX, _startPosY + 48);
|
||||
Point nose2 = new Point(_startPosX + 10, _startPosY + 48 - 8);
|
||||
Point nose3 = new Point(_startPosX + 10, _startPosY + 48 + 8);
|
||||
|
||||
Point[] nosePoints =
|
||||
{
|
||||
nose1,
|
||||
nose2,
|
||||
nose3
|
||||
};
|
||||
g.FillPolygon(additionalBrush, nosePoints);
|
||||
|
||||
//передние крылья
|
||||
Point wingUp1 = new Point(_startPosX + 30, _startPosY + 40);
|
||||
Point wingUp2 = new Point(_startPosX + 30, _startPosY);
|
||||
Point wingUp3 = new Point(_startPosX + 40, _startPosY);
|
||||
Point wingUp4 = new Point(_startPosX + 45, _startPosY + 40);
|
||||
|
||||
Point[] wingUpPoints =
|
||||
{
|
||||
wingUp1,
|
||||
wingUp2,
|
||||
wingUp3,
|
||||
wingUp4
|
||||
};
|
||||
g.DrawPolygon(pen, wingUpPoints);
|
||||
|
||||
Point wingDown1 = new Point(_startPosX + 30, _startPosY + 55);
|
||||
Point wingDown2 = new Point(_startPosX + 30, _startPosY + 95);
|
||||
Point wingDown3 = new Point(_startPosX + 40, _startPosY + 95);
|
||||
Point wingDown4 = new Point(_startPosX + 45, _startPosY + 55);
|
||||
|
||||
Point[] wingDownPoints =
|
||||
{
|
||||
wingDown1,
|
||||
wingDown2,
|
||||
wingDown3,
|
||||
wingDown4
|
||||
};
|
||||
g.DrawPolygon(pen, wingDownPoints);
|
||||
|
||||
//хвост
|
||||
Point tailUp1 = new Point(_startPosX + 75, _startPosY + 40);
|
||||
Point tailUp2 = new Point(_startPosX + 75, _startPosY + 30);
|
||||
Point tailUp3 = new Point(_startPosX + 90, _startPosY + 15);
|
||||
Point tailUp4 = new Point(_startPosX + 90, _startPosY + 40);
|
||||
Point[] tailUpPoints =
|
||||
{
|
||||
tailUp1,
|
||||
tailUp2,
|
||||
tailUp3,
|
||||
tailUp4,
|
||||
};
|
||||
g.DrawPolygon(pen, tailUpPoints);
|
||||
|
||||
Point tailDown1 = new Point(_startPosX + 75, _startPosY + 55);
|
||||
Point tailDown2 = new Point(_startPosX + 75, _startPosY + 65);
|
||||
Point tailDown3 = new Point(_startPosX + 90, _startPosY + 80);
|
||||
Point tailDown4 = new Point(_startPosX + 90, _startPosY + 55);
|
||||
Point[] tailDownPoints =
|
||||
{
|
||||
tailDown1,
|
||||
tailDown2,
|
||||
tailDown3,
|
||||
tailDown4,
|
||||
};
|
||||
g.DrawPolygon(pen, tailDownPoints);
|
||||
|
||||
//ракеты
|
||||
if (EntityAirFighter.Rockets)
|
||||
{
|
||||
Point rocketUp1 = new Point(_startPosX + 50, _startPosY + 15);
|
||||
Point rocketUp2 = new Point(_startPosX + 50, _startPosY + 5);
|
||||
Point rocketUp3 = new Point(_startPosX + 20, _startPosY + 5);
|
||||
Point rocketUp4 = new Point(_startPosX + 10, _startPosY + 10);
|
||||
Point rocketUp5 = new Point(_startPosX + 20, _startPosY + 15);
|
||||
Point rocketUp6 = new Point(_startPosX + 50, _startPosY + 15);
|
||||
Point[] rocketUpPoints =
|
||||
{
|
||||
rocketUp1,
|
||||
rocketUp2,
|
||||
rocketUp3,
|
||||
rocketUp4,
|
||||
rocketUp5,
|
||||
rocketUp6
|
||||
};
|
||||
g.FillPolygon(additionalBrush, rocketUpPoints);
|
||||
|
||||
Point rocketDown1 = new Point(_startPosX + 50, _startPosY + 90);
|
||||
Point rocketDown2 = new Point(_startPosX + 50, _startPosY + 80);
|
||||
Point rocketDown3 = new Point(_startPosX + 20, _startPosY + 80);
|
||||
Point rocketDown4 = new Point(_startPosX + 10, _startPosY + 85);
|
||||
Point rocketDown5 = new Point(_startPosX + 20, _startPosY + 90);
|
||||
Point rocketDown6 = new Point(_startPosX + 50, _startPosY + 90);
|
||||
Point[] rocketDownPoints =
|
||||
{
|
||||
rocketDown1,
|
||||
rocketDown2,
|
||||
rocketDown3,
|
||||
rocketDown4,
|
||||
rocketDown5,
|
||||
rocketDown6
|
||||
};
|
||||
g.FillPolygon(additionalBrush, rocketDownPoints);
|
||||
}
|
||||
|
||||
//дополнительные крылья
|
||||
if (EntityAirFighter.Wings)
|
||||
{
|
||||
Point miniWingUp1 = new Point(_startPosX + 50, _startPosY + 40);
|
||||
Point miniWingUp2 = new Point(_startPosX + 50, _startPosY + 20);
|
||||
Point miniWingUp3 = new Point(_startPosX + 55, _startPosY + 20);
|
||||
Point miniWingUp4 = new Point(_startPosX + 60, _startPosY + 40);
|
||||
|
||||
Point[] miniWingUpPoints =
|
||||
{
|
||||
miniWingUp1,
|
||||
miniWingUp2,
|
||||
miniWingUp3,
|
||||
miniWingUp4
|
||||
};
|
||||
g.FillPolygon(bodyBrush, miniWingUpPoints);
|
||||
|
||||
Point miniWingDown1 = new Point(_startPosX + 50, _startPosY + 55);
|
||||
Point miniWingDown2 = new Point(_startPosX + 50, _startPosY + 75);
|
||||
Point miniWingDown3 = new Point(_startPosX + 55, _startPosY + 75);
|
||||
Point miniWingDown4 = new Point(_startPosX + 60, _startPosY + 55);
|
||||
|
||||
Point[] miniWingDownPoints =
|
||||
{
|
||||
miniWingDown1,
|
||||
miniWingDown2,
|
||||
miniWingDown3,
|
||||
miniWingDown4
|
||||
};
|
||||
g.FillPolygon(bodyBrush, miniWingDownPoints);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
43
AirFighter/AirFighter/EntityAirFighter.cs
Normal file
43
AirFighter/AirFighter/EntityAirFighter.cs
Normal file
@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AirFighter
|
||||
{
|
||||
public class EntityAirFighter
|
||||
{
|
||||
//Скорость
|
||||
public int Speed { get; private set; }
|
||||
|
||||
//Вес
|
||||
public double Weight { get; private set; }
|
||||
|
||||
//Основной цвет
|
||||
public Color BodyColor { get; private set; }
|
||||
|
||||
//Дополнительный цвет (для опциональных элементов)
|
||||
public Color AdditionalColor { get; private set; }
|
||||
|
||||
// Признак(опция) наличия ракет
|
||||
public bool Rockets { get; private set; }
|
||||
// Признак(опция) наличия крыльев
|
||||
public bool Wings { get; private set; }
|
||||
|
||||
// Шаг перемещения автомобиля
|
||||
public double Step => (double)Speed * 100 / Weight;
|
||||
|
||||
public void Init(int speed, double weight, Color bodyColor, Color
|
||||
additionalColor, bool rockets, bool wings)
|
||||
{
|
||||
Speed = speed;
|
||||
Weight = weight;
|
||||
BodyColor = bodyColor;
|
||||
AdditionalColor = additionalColor;
|
||||
|
||||
Rockets = rockets;
|
||||
Wings = wings;
|
||||
}
|
||||
}
|
||||
}
|
39
AirFighter/AirFighter/Form1.Designer.cs
generated
39
AirFighter/AirFighter/Form1.Designer.cs
generated
@ -1,39 +0,0 @@
|
||||
namespace AirFighter
|
||||
{
|
||||
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 AirFighter
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@ namespace AirFighter
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new Form1());
|
||||
Application.Run(new AirFighterForm());
|
||||
}
|
||||
}
|
||||
}
|
103
AirFighter/AirFighter/Properties/Resources.Designer.cs
generated
Normal file
103
AirFighter/AirFighter/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,103 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <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 down {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("down", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap left {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("left", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap right {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("right", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap up {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("up", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
133
AirFighter/AirFighter/Properties/Resources.resx
Normal file
133
AirFighter/AirFighter/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="down" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\down.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="left" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\left.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="right" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\right.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="up" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\up.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
BIN
AirFighter/AirFighter/Resources/down.png
Normal file
BIN
AirFighter/AirFighter/Resources/down.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
BIN
AirFighter/AirFighter/Resources/left.png
Normal file
BIN
AirFighter/AirFighter/Resources/left.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
BIN
AirFighter/AirFighter/Resources/right.png
Normal file
BIN
AirFighter/AirFighter/Resources/right.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
BIN
AirFighter/AirFighter/Resources/up.png
Normal file
BIN
AirFighter/AirFighter/Resources/up.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
Loading…
Reference in New Issue
Block a user