Compare commits
No commits in common. "ISEbd-21-Beklenishev-D.A.-Lab-Work-01" and "main" have entirely different histories.
ISEbd-21-B
...
main
@ -1,29 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Bombardirovshchik
|
|
||||||
{
|
|
||||||
public enum DirectionType
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Вверх
|
|
||||||
/// </summary>
|
|
||||||
Up = 1,
|
|
||||||
/// <summary>
|
|
||||||
/// Вниз
|
|
||||||
/// </summary>
|
|
||||||
Down = 2,
|
|
||||||
/// <summary>
|
|
||||||
/// Влево
|
|
||||||
/// </summary>
|
|
||||||
Left = 3,
|
|
||||||
/// <summary>
|
|
||||||
/// Вправо
|
|
||||||
/// </summary>
|
|
||||||
Right = 4
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,191 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Bombardirovshchik;
|
|
||||||
|
|
||||||
namespace Bombardirovshchik
|
|
||||||
{
|
|
||||||
public class DrawningBombardirovshchik
|
|
||||||
{
|
|
||||||
public EntityBombardirovshchik? EntityBombardirovshchik { get; private set; }
|
|
||||||
private int _pictureWidth;
|
|
||||||
private int _pictureHeight;
|
|
||||||
private int _startPosX;
|
|
||||||
private int _startPosY;
|
|
||||||
private readonly int _bomberWidth = 160;
|
|
||||||
private readonly int _bomberHeight = 156;
|
|
||||||
public bool Init(int speed, double weight, Color bodyColor, Color additionalColor, bool bombs, Color bombsColor, bool fuelTanks, int width, int height)
|
|
||||||
{
|
|
||||||
_pictureWidth = width;
|
|
||||||
_pictureHeight = height;
|
|
||||||
if (width < _bomberWidth || height < _bomberHeight)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
EntityBombardirovshchik = new EntityBombardirovshchik();
|
|
||||||
EntityBombardirovshchik.Init(speed, weight, bodyColor, additionalColor, bombs, bombsColor, fuelTanks);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
public void SetPosition(int x, int y)
|
|
||||||
{
|
|
||||||
if (x < 0 || x + _bomberWidth > _pictureWidth)
|
|
||||||
{
|
|
||||||
x = _pictureWidth - _bomberWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (y < 0 || y + _bomberWidth > _pictureHeight)
|
|
||||||
{
|
|
||||||
y = _pictureHeight - _bomberHeight;
|
|
||||||
}
|
|
||||||
_startPosX = x;
|
|
||||||
_startPosY = y;
|
|
||||||
}
|
|
||||||
public void MoveTransport(DirectionType direction)
|
|
||||||
{
|
|
||||||
if (EntityBombardirovshchik == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
switch (direction)
|
|
||||||
{
|
|
||||||
case DirectionType.Left:
|
|
||||||
if (_startPosX - EntityBombardirovshchik.Step > 0)
|
|
||||||
{
|
|
||||||
_startPosX -= (int)EntityBombardirovshchik.Step;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case DirectionType.Up:
|
|
||||||
if (_startPosY - EntityBombardirovshchik.Step > 0)
|
|
||||||
{
|
|
||||||
_startPosY -= (int)EntityBombardirovshchik.Step;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case DirectionType.Right:
|
|
||||||
if (_startPosX + EntityBombardirovshchik.Step + _bomberWidth < _pictureWidth)
|
|
||||||
{
|
|
||||||
_startPosX += (int)EntityBombardirovshchik.Step;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case DirectionType.Down:
|
|
||||||
if (_startPosY + EntityBombardirovshchik.Step + _bomberHeight < _pictureHeight)
|
|
||||||
{
|
|
||||||
_startPosY += (int)EntityBombardirovshchik.Step;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public void DrawBombardirovshchik(Graphics g)
|
|
||||||
{
|
|
||||||
if (EntityBombardirovshchik == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Pen pen = new(Color.Black);
|
|
||||||
Brush additionalBrush = new SolidBrush(EntityBombardirovshchik.AdditionalColor);
|
|
||||||
Brush bodyColor = new SolidBrush(EntityBombardirovshchik.BodyColor);
|
|
||||||
Brush bombsColor = new SolidBrush(EntityBombardirovshchik.BombsColor);
|
|
||||||
Brush wingsColor = new SolidBrush(Color.Red);
|
|
||||||
if (EntityBombardirovshchik.Bombs)
|
|
||||||
{
|
|
||||||
g.FillEllipse(bombsColor, _startPosX + 90, _startPosY + 40, 15, 29);
|
|
||||||
g.DrawEllipse(pen, _startPosX + 90, _startPosY + 40, 15, 29);
|
|
||||||
g.FillEllipse(bombsColor, _startPosX + 90, _startPosY + 90, 15, 29);
|
|
||||||
g.DrawEllipse(pen, _startPosX + 90, _startPosY + 90, 15, 29);
|
|
||||||
g.FillEllipse(bombsColor, _startPosX + 140, _startPosY + 71, 29, 15);
|
|
||||||
g.DrawEllipse(pen, _startPosX + 140, _startPosY + 71, 29, 15);
|
|
||||||
|
|
||||||
}
|
|
||||||
g.FillPolygon(additionalBrush, new Point[] //nose
|
|
||||||
{
|
|
||||||
new Point(_startPosX + 19, _startPosY + 70),
|
|
||||||
new Point(_startPosX + 19, _startPosY + 89),
|
|
||||||
new Point(_startPosX + 1, _startPosY + 79),
|
|
||||||
}
|
|
||||||
);
|
|
||||||
g.FillRectangle(bodyColor, _startPosX + 20, _startPosY + 70, 120, 20); //body
|
|
||||||
g.FillPolygon(additionalBrush, new Point[] //up left wing(передние)
|
|
||||||
{
|
|
||||||
new Point(_startPosX + 36, _startPosY + 69),
|
|
||||||
new Point(_startPosX + 36, _startPosY ),
|
|
||||||
new Point(_startPosX + 45, _startPosY ),
|
|
||||||
new Point(_startPosX + 55, _startPosY + 69),
|
|
||||||
}
|
|
||||||
);
|
|
||||||
g.FillPolygon(additionalBrush, new Point[] //down left wing(передние)
|
|
||||||
{
|
|
||||||
new Point(_startPosX + 36, _startPosY + 91),
|
|
||||||
new Point(_startPosX + 36, _startPosY + 160),
|
|
||||||
new Point(_startPosX + 45, _startPosY + 160),
|
|
||||||
new Point(_startPosX + 54, _startPosY + 91),
|
|
||||||
}
|
|
||||||
);
|
|
||||||
g.FillPolygon(wingsColor, new Point[] //up right wing(задние)
|
|
||||||
{
|
|
||||||
new Point(_startPosX + 120, _startPosY + 69),
|
|
||||||
new Point(_startPosX + 120, _startPosY + 62),
|
|
||||||
new Point(_startPosX + 140, _startPosY + 40),
|
|
||||||
new Point(_startPosX + 140, _startPosY + 69),
|
|
||||||
}
|
|
||||||
);
|
|
||||||
g.FillPolygon(wingsColor, new Point[] //down right wing(задние)
|
|
||||||
{
|
|
||||||
new Point(_startPosX + 120, _startPosY + 90),
|
|
||||||
new Point(_startPosX + 120, _startPosY + 97),
|
|
||||||
new Point(_startPosX + 140, _startPosY + 119),
|
|
||||||
new Point(_startPosX + 140, _startPosY + 90),
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
g.DrawPolygon(pen, new Point[] //nose
|
|
||||||
{
|
|
||||||
new Point(_startPosX + 20, _startPosY + 69),
|
|
||||||
new Point(_startPosX + 20, _startPosY + 90),
|
|
||||||
new Point(_startPosX, _startPosY + 79),
|
|
||||||
}
|
|
||||||
);
|
|
||||||
g.DrawRectangle(pen, _startPosX + 19, _startPosY + 69, 121, 21); //body
|
|
||||||
g.DrawPolygon(pen, new Point[] //up left wing
|
|
||||||
{
|
|
||||||
new Point(_startPosX + 35, _startPosY + 69),
|
|
||||||
new Point(_startPosX + 35, _startPosY),
|
|
||||||
new Point(_startPosX + 45, _startPosY),
|
|
||||||
new Point(_startPosX + 55, _startPosY + 69),
|
|
||||||
}
|
|
||||||
);
|
|
||||||
g.DrawPolygon(pen, new Point[] //down left wing
|
|
||||||
{
|
|
||||||
new Point(_startPosX + 36, _startPosY + 91),
|
|
||||||
new Point(_startPosX + 36, _startPosY + 160),
|
|
||||||
new Point(_startPosX + 45, _startPosY + 160),
|
|
||||||
new Point(_startPosX + 54, _startPosY + 91),
|
|
||||||
}
|
|
||||||
);
|
|
||||||
g.DrawPolygon(pen, new Point[] //up right wing
|
|
||||||
{
|
|
||||||
new Point(_startPosX + 120, _startPosY + 69),
|
|
||||||
new Point(_startPosX + 120, _startPosY + 62),
|
|
||||||
new Point(_startPosX + 140, _startPosY + 40),
|
|
||||||
new Point(_startPosX + 140, _startPosY + 69),
|
|
||||||
}
|
|
||||||
);
|
|
||||||
g.DrawPolygon(pen, new Point[] //down right wing
|
|
||||||
{
|
|
||||||
new Point(_startPosX + 120, _startPosY + 90),
|
|
||||||
new Point(_startPosX + 120, _startPosY + 97),
|
|
||||||
new Point(_startPosX + 140, _startPosY + 119),
|
|
||||||
new Point(_startPosX + 140, _startPosY + 90),
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (EntityBombardirovshchik.FuelTanks)
|
|
||||||
{
|
|
||||||
g.FillRectangle(additionalBrush, _startPosX + 63, _startPosY + 54, 20, 15);
|
|
||||||
g.DrawRectangle(pen, _startPosX + 63, _startPosY + 54, 20, 15);
|
|
||||||
g.FillRectangle(additionalBrush, _startPosX + 63, _startPosY + 90, 20, 15);
|
|
||||||
g.DrawRectangle(pen, _startPosX + 63, _startPosY + 90, 20, 15);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Bombardirovshchik;
|
|
||||||
|
|
||||||
namespace Bombardirovshchik
|
|
||||||
{
|
|
||||||
public class EntityBombardirovshchik
|
|
||||||
{
|
|
||||||
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 Bombs { get; private set; }
|
|
||||||
public Color BombsColor { get; private set; }
|
|
||||||
public bool FuelTanks { get; private set; }
|
|
||||||
public double Step => (double)Speed * 100 / Weight;
|
|
||||||
public void Init(int speed, double weight, Color bodyColor, Color
|
|
||||||
additionalColor, bool bombs, Color bombsColor, bool fuelTanks)
|
|
||||||
{
|
|
||||||
Speed = speed;
|
|
||||||
Weight = weight;
|
|
||||||
BodyColor = bodyColor;
|
|
||||||
AdditionalColor = additionalColor;
|
|
||||||
Bombs = bombs;
|
|
||||||
BombsColor = bombsColor;
|
|
||||||
FuelTanks = fuelTanks;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
39
ProjectBombardirovshchik/Form1.Designer.cs
generated
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
namespace ProjectBombardirovshchik
|
||||||
|
{
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
10
ProjectBombardirovshchik/Form1.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
namespace ProjectBombardirovshchik
|
||||||
|
{
|
||||||
|
public partial class Form1 : Form
|
||||||
|
{
|
||||||
|
public Form1()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -18,7 +18,7 @@
|
|||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, 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="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="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
</data>
|
</data>
|
@ -1,133 +0,0 @@
|
|||||||
namespace ProjectBombardirovshchik
|
|
||||||
{
|
|
||||||
partial class FormBombardirovshchik
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
pictureBoxBombardirovshchik = new PictureBox();
|
|
||||||
buttonCreate = new Button();
|
|
||||||
buttonLeft = new Button();
|
|
||||||
buttonRight = new Button();
|
|
||||||
buttonUp = new Button();
|
|
||||||
buttonDown = new Button();
|
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBoxBombardirovshchik).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// pictureBoxBombardirovshchik
|
|
||||||
//
|
|
||||||
pictureBoxBombardirovshchik.Dock = DockStyle.Fill;
|
|
||||||
pictureBoxBombardirovshchik.Location = new Point(0, 0);
|
|
||||||
pictureBoxBombardirovshchik.Name = "pictureBoxBombardirovshchik";
|
|
||||||
pictureBoxBombardirovshchik.Size = new Size(882, 453);
|
|
||||||
pictureBoxBombardirovshchik.SizeMode = PictureBoxSizeMode.AutoSize;
|
|
||||||
pictureBoxBombardirovshchik.TabIndex = 0;
|
|
||||||
pictureBoxBombardirovshchik.TabStop = false;
|
|
||||||
pictureBoxBombardirovshchik.Click += pictureBoxBombardirovshchik_Click;
|
|
||||||
//
|
|
||||||
// buttonCreate
|
|
||||||
//
|
|
||||||
buttonCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
|
||||||
buttonCreate.Location = new Point(12, 413);
|
|
||||||
buttonCreate.Name = "buttonCreate";
|
|
||||||
buttonCreate.Size = new Size(118, 27);
|
|
||||||
buttonCreate.TabIndex = 1;
|
|
||||||
buttonCreate.Text = "Создать";
|
|
||||||
buttonCreate.UseVisualStyleBackColor = true;
|
|
||||||
buttonCreate.Click += buttonCreate_Click;
|
|
||||||
//
|
|
||||||
// buttonLeft
|
|
||||||
//
|
|
||||||
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
|
||||||
buttonLeft.BackgroundImageLayout = ImageLayout.Zoom;
|
|
||||||
buttonLeft.Location = new Point(768, 413);
|
|
||||||
buttonLeft.Name = "buttonLeft";
|
|
||||||
buttonLeft.Size = new Size(30, 30);
|
|
||||||
buttonLeft.TabIndex = 2;
|
|
||||||
buttonLeft.UseVisualStyleBackColor = true;
|
|
||||||
buttonLeft.Click += buttonMove_Click;
|
|
||||||
//
|
|
||||||
// buttonRight
|
|
||||||
//
|
|
||||||
buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
|
||||||
buttonRight.BackgroundImage = Properties.Resources.ArrowRight;
|
|
||||||
buttonRight.BackgroundImageLayout = ImageLayout.Zoom;
|
|
||||||
buttonRight.Location = new Point(840, 413);
|
|
||||||
buttonRight.Name = "buttonRight";
|
|
||||||
buttonRight.Size = new Size(30, 30);
|
|
||||||
buttonRight.TabIndex = 4;
|
|
||||||
buttonRight.UseVisualStyleBackColor = true;
|
|
||||||
buttonRight.Click += buttonMove_Click;
|
|
||||||
//
|
|
||||||
// buttonUp
|
|
||||||
//
|
|
||||||
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
|
||||||
buttonUp.BackgroundImageLayout = ImageLayout.Zoom;
|
|
||||||
buttonUp.Location = new Point(804, 377);
|
|
||||||
buttonUp.Name = "buttonUp";
|
|
||||||
buttonUp.Size = new Size(30, 30);
|
|
||||||
buttonUp.TabIndex = 5;
|
|
||||||
buttonUp.UseVisualStyleBackColor = true;
|
|
||||||
buttonUp.Click += buttonMove_Click;
|
|
||||||
//
|
|
||||||
// buttonDown
|
|
||||||
//
|
|
||||||
buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
|
||||||
buttonDown.BackgroundImageLayout = ImageLayout.Zoom;
|
|
||||||
buttonDown.Location = new Point(804, 413);
|
|
||||||
buttonDown.Name = "buttonDown";
|
|
||||||
buttonDown.Size = new Size(30, 30);
|
|
||||||
buttonDown.TabIndex = 3;
|
|
||||||
buttonDown.UseVisualStyleBackColor = true;
|
|
||||||
buttonDown.Click += buttonMove_Click;
|
|
||||||
//
|
|
||||||
// FormBombardirovshchik
|
|
||||||
//
|
|
||||||
ClientSize = new Size(882, 453);
|
|
||||||
Controls.Add(buttonUp);
|
|
||||||
Controls.Add(buttonRight);
|
|
||||||
Controls.Add(buttonDown);
|
|
||||||
Controls.Add(buttonLeft);
|
|
||||||
Controls.Add(buttonCreate);
|
|
||||||
Controls.Add(pictureBoxBombardirovshchik);
|
|
||||||
Name = "FormBombardirovshchik";
|
|
||||||
StartPosition = FormStartPosition.CenterParent;
|
|
||||||
Text = "Бомбардировщик";
|
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBoxBombardirovshchik).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
PerformLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private PictureBox pictureBoxBombardirovshchik;
|
|
||||||
private Button buttonCreate;
|
|
||||||
private Button buttonLeft;
|
|
||||||
private Button buttonRight;
|
|
||||||
private Button buttonUp;
|
|
||||||
private Button buttonDown;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,76 +0,0 @@
|
|||||||
using Bombardirovshchik;
|
|
||||||
using Bombardirovshchik;
|
|
||||||
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 ProjectBombardirovshchik
|
|
||||||
{
|
|
||||||
public partial class FormBombardirovshchik : Form
|
|
||||||
{
|
|
||||||
private DrawningBombardirovshchik? _drawningBombardirovshchik;
|
|
||||||
public FormBombardirovshchik()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
private void Draw()
|
|
||||||
{
|
|
||||||
if (_drawningBombardirovshchik == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Bitmap bmp = new(pictureBoxBombardirovshchik.Width, pictureBoxBombardirovshchik.Height);
|
|
||||||
Graphics gr = Graphics.FromImage(bmp);
|
|
||||||
_drawningBombardirovshchik.DrawBombardirovshchik(gr);
|
|
||||||
pictureBoxBombardirovshchik.Image = bmp;
|
|
||||||
}
|
|
||||||
private void buttonCreate_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Random random = new();
|
|
||||||
_drawningBombardirovshchik = new DrawningBombardirovshchik();
|
|
||||||
_drawningBombardirovshchik.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)),
|
|
||||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
|
||||||
Convert.ToBoolean(random.Next(0, 2)), pictureBoxBombardirovshchik.Width, pictureBoxBombardirovshchik.Height);
|
|
||||||
|
|
||||||
_drawningBombardirovshchik.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
|
||||||
Draw();
|
|
||||||
}
|
|
||||||
private void buttonMove_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (_drawningBombardirovshchik == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
string name = ((Button)sender)?.Name ?? string.Empty;
|
|
||||||
switch (name)
|
|
||||||
{
|
|
||||||
case "buttonUp":
|
|
||||||
_drawningBombardirovshchik.MoveTransport(DirectionType.Up);
|
|
||||||
break;
|
|
||||||
case "buttonDown":
|
|
||||||
_drawningBombardirovshchik.MoveTransport(DirectionType.Down);
|
|
||||||
break;
|
|
||||||
case "buttonLeft":
|
|
||||||
_drawningBombardirovshchik.MoveTransport(DirectionType.Left);
|
|
||||||
break;
|
|
||||||
case "buttonRight":
|
|
||||||
_drawningBombardirovshchik.MoveTransport(DirectionType.Right);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
Draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void pictureBoxBombardirovshchik_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,5 +1,3 @@
|
|||||||
using Bombardirovshchik;
|
|
||||||
|
|
||||||
namespace ProjectBombardirovshchik
|
namespace ProjectBombardirovshchik
|
||||||
{
|
{
|
||||||
internal static class Program
|
internal static class Program
|
||||||
@ -13,7 +11,7 @@ namespace ProjectBombardirovshchik
|
|||||||
// To customize application configuration such as set high DPI settings or default font,
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
// see https://aka.ms/applicationconfiguration.
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
Application.Run(new FormBombardirovshchik());
|
Application.Run(new Form1());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,19 +8,4 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</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>
|
</Project>
|
@ -1,133 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// Этот код создан программой.
|
|
||||||
// Исполняемая версия:4.0.30319.42000
|
|
||||||
//
|
|
||||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
|
||||||
// повторной генерации кода.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace ProjectBombardirovshchik.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("ProjectBombardirovshchik.Properties.Resources", typeof(Resources).Assembly);
|
|
||||||
resourceMan = temp;
|
|
||||||
}
|
|
||||||
return resourceMan;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
|
|
||||||
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
|
|
||||||
/// </summary>
|
|
||||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
|
||||||
internal static global::System.Globalization.CultureInfo Culture {
|
|
||||||
get {
|
|
||||||
return resourceCulture;
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
resourceCulture = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap ArrowDown {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("ArrowDown", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap ArrowDown1 {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("ArrowDown1", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap ArrowDown2 {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("ArrowDown2", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap ArrowDown3 {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("ArrowDown3", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap ArrowLeft {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("ArrowLeft", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap ArrowRight {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("ArrowRight", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap HbXYd7GRpGs {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("HbXYd7GRpGs", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,142 +0,0 @@
|
|||||||
<?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="ArrowDown" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\ArrowDown.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="ArrowDown1" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\ArrowDown1.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="ArrowRight" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\ArrowRight.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="HbXYd7GRpGs" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\HbXYd7GRpGs.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="ArrowDown3" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\ArrowDown3.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="ArrowDown2" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\ArrowDown2.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="ArrowLeft" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\ArrowLeft.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
|
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 12 KiB |