From 534e7be294703bff2b40b1b2556ec4c4c2a56d7e Mon Sep 17 00:00:00 2001
From: antoc0der <1@DESKTOP-K1L8ND3>
Date: Mon, 9 Oct 2023 12:15:04 +0300
Subject: [PATCH 1/8] =?UTF-8?q?Revert=20"=D0=B3=D0=BE=D1=82=D0=BE=D0=B2?=
=?UTF-8?q?=D1=8B=D0=B9=20=D0=BF=D1=80=D0=BE=D0=B5=D0=BA=D1=82"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This reverts commit 0a80ff07df26d5864adf04514763896cb28286cf.
---
.../ProjectAirplaneWithRadar/Direction.cs | 20 ---
.../DrawningAirplaneWithRadar.cs | 149 ------------------
.../EntityAirplaneWithRadar.cs | 36 -----
.../Form1.Designer.cs | 39 +++++
.../ProjectAirplaneWithRadar/Form1.cs | 10 ++
...{FormAirplaneWithRadar.resx => Form1.resx} | 50 +++---
.../FormAirplaneWithRadar.Designer.cs | 128 ---------------
.../FormAirplaneWithRadar.cs | 73 ---------
.../ProjectAirplaneWithRadar/Program.cs | 11 +-
ProjectAirplaneWithRadar/Новый файл | 0
10 files changed, 77 insertions(+), 439 deletions(-)
delete mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Direction.cs
delete mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/DrawningAirplaneWithRadar.cs
delete mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplaneWithRadar.cs
create mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.Designer.cs
create mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.cs
rename ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/{FormAirplaneWithRadar.resx => Form1.resx} (93%)
delete mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.Designer.cs
delete mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs
delete mode 100644 ProjectAirplaneWithRadar/Новый файл
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Direction.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Direction.cs
deleted file mode 100644
index a42ae78..0000000
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Direction.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace ProjectAirplaneWithRadar
-{
- public enum Direction
- {
- // Вверх
- Up = 1,
- /// Вниз
- Down = 2,
- /// Влево
- Left = 3,
- /// Вправо
- Right = 4
- }
-}
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/DrawningAirplaneWithRadar.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/DrawningAirplaneWithRadar.cs
deleted file mode 100644
index 33f429e..0000000
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/DrawningAirplaneWithRadar.cs
+++ /dev/null
@@ -1,149 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Linq;
-using System.Net.NetworkInformation;
-using System.Reflection;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace ProjectAirplaneWithRadar
-{
- public class DrawningAirplaneWithRadar
- {
- public EntityAirplaneWithRadar? EntityAirplaneWithRadar { get; private set; }
- public int _pictureWidth;
- public int _pictureHeight;
- public int _startPosX;
- public int _startPosY;
- private readonly int _airplaneWidth = 200;
- private readonly int _airplaneHeight = 78;
- public bool Init(int speed, double weight, Color bodyColor, Color additionalColor, bool radar, bool dopbak, int width, int height)
- {
- _pictureWidth = width;
- _pictureHeight = height;
- if (_airplaneWidth > _pictureWidth || _airplaneHeight > _pictureHeight)
- return false;
- EntityAirplaneWithRadar = new EntityAirplaneWithRadar();
- EntityAirplaneWithRadar.Init(speed, weight, bodyColor, additionalColor, radar, dopbak);
- return true;
- }
- public void SetPosition(int x, int y)
- {
- if(x < 0 || y < 0 ||x+_airplaneWidth >= _pictureWidth|| y + _airplaneHeight >= _pictureHeight)
- {
- x = y = 10;
- _startPosX = x;
- _startPosY=y;
- }
- _startPosX = x;
- _startPosY = y;
- }
- public void MoveTransport(Direction direction)
- {
- if (EntityAirplaneWithRadar == null)
- {
- return;
- }
- switch (direction)
- {
- case Direction.Left:
- if (_startPosX - EntityAirplaneWithRadar.Step > 0)
- {
- _startPosX -= (int)EntityAirplaneWithRadar.Step;
- }
- break;
- case Direction.Up:
- if (_startPosY - EntityAirplaneWithRadar.Step > 0)
- {
- _startPosY -= (int)EntityAirplaneWithRadar.Step;
- }
- break;
- case Direction.Right:
- if (_startPosX + EntityAirplaneWithRadar.Step+_airplaneWidth < _pictureWidth)
- {
- _startPosX += (int)EntityAirplaneWithRadar.Step;
- }
- break;
- case Direction.Down:
- if (_startPosY + EntityAirplaneWithRadar.Step+_airplaneHeight < _pictureHeight)
- {
- _startPosY += (int)EntityAirplaneWithRadar.Step;
- }
- break;
- }
- }
- public void DrawTransport(Graphics g)
- {
- if(EntityAirplaneWithRadar == null)
- {
- return;
- }
- Pen pen = new Pen(Color.Black, 3);
- Brush additionalBrush = new SolidBrush(EntityAirplaneWithRadar.AdditionalColor);
- // корпус
- Brush br = new SolidBrush(EntityAirplaneWithRadar.BodyColor);
- g.DrawEllipse(pen, _startPosX, _startPosY+25,180, 30) ;
- g.FillEllipse(br, _startPosX, _startPosY+25, 180, 30);
- // крыло
- Brush blackBrush = new SolidBrush(Color.Black);
- g.FillEllipse(blackBrush, _startPosX + 70, _startPosY + 35, 80, 10);
- // стекла
- Pen blackPen = new Pen(Color.Black, 2);
- Brush blueBrush = new SolidBrush(Color.LightBlue);
- Point point1 = new Point(_startPosX+170, _startPosY+30);
- Point point2 = new Point(_startPosX+200, _startPosY+40);
- Point point3 = new Point(_startPosX+170, _startPosY + 50);
- Point[] curvePoints =
- {
- point1,
- point2,
- point3,
- };
- g.FillPolygon(blueBrush, curvePoints);
- g.DrawPolygon(blackPen, curvePoints);
- g.DrawLine(blackPen, _startPosX + 170, _startPosY + 40, _startPosX + 200, _startPosY + 40);
- // хвост
- Point point4 = new Point(_startPosX, _startPosY + 35);
- Point point5 = new Point(_startPosX, _startPosY +5 );
- Point point6 = new Point(_startPosX + 30, _startPosY + 35);
- Point[] curvePoints2 =
- {
- point4,
- point5,
- point6,
- };
- g.FillPolygon(br, curvePoints2);
- g.DrawPolygon(blackPen, curvePoints2);
- // шасси
- g.DrawLine(blackPen, _startPosX + 50, _startPosY + 55, _startPosX + 50, _startPosY + 70);
- g.DrawLine(blackPen, _startPosX + 150, _startPosY + 51, _startPosX + 150, _startPosY + 70);
- g.FillEllipse(blackBrush, _startPosX + 40, _startPosY + 65, 10, 10);
- g.FillEllipse(blackBrush, _startPosX + 50, _startPosY + 65, 10, 10);
- g.FillEllipse(blackBrush, _startPosX + 145, _startPosY + 65, 10, 10);
- if (EntityAirplaneWithRadar.DopBak)
- {
- //бак
- g.FillEllipse(additionalBrush, _startPosX, _startPosY + 45, 40, 20);
- g.DrawEllipse(blackPen, _startPosX, _startPosY + 45, 40, 20);
- }
- if (EntityAirplaneWithRadar.Radar)
- {
- //радар
- g.DrawLine(blackPen, _startPosX + 60, _startPosY + 25, _startPosX + 60, _startPosY + 15);
- g.DrawLine(blackPen, _startPosX + 60, _startPosY + 15, _startPosX + 67, _startPosY + 11);
- Point point7 = new Point(_startPosX + 60, _startPosY + 15);
- Point point8 = new Point(_startPosX + 60, _startPosY + 5);
- Point point9 = new Point(_startPosX + 70, _startPosY + 25);
- Point[] curvePoints3 =
- {
- point7,
- point8,
- point9,
- };
- g.FillPolygon(additionalBrush, curvePoints3);
- }
- }
- }
-}
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplaneWithRadar.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplaneWithRadar.cs
deleted file mode 100644
index 4bed01a..0000000
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplaneWithRadar.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace ProjectAirplaneWithRadar
-{
- public class EntityAirplaneWithRadar
- {
- //скорость
- 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 Radar{ get; private set; }
- // наличие дополнительных топливных баков
- public bool DopBak{ get; private set; }
- //шаг перемещения самолета
- public double Step => (double)Speed*100/Weight;
- public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool radar, bool dopbak)
- {
- Speed = speed;
- Weight = weight;
- BodyColor = bodyColor;
- AdditionalColor = additionalColor;
- Radar = radar;
- DopBak = dopbak;
- }
- }
-}
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.Designer.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.Designer.cs
new file mode 100644
index 0000000..6118ed6
--- /dev/null
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.Designer.cs
@@ -0,0 +1,39 @@
+namespace ProjectAirplaneWithRadar
+{
+ partial class Form1
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ 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
+ }
+}
\ No newline at end of file
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.cs
new file mode 100644
index 0000000..20983c4
--- /dev/null
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.cs
@@ -0,0 +1,10 @@
+namespace ProjectAirplaneWithRadar
+{
+ public partial class Form1 : Form
+ {
+ public Form1()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.resx b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.resx
similarity index 93%
rename from ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.resx
rename to ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.resx
index af32865..1af7de1 100644
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.resx
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.resx
@@ -1,17 +1,17 @@
-
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.Designer.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.Designer.cs
deleted file mode 100644
index 425e755..0000000
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.Designer.cs
+++ /dev/null
@@ -1,128 +0,0 @@
-namespace ProjectAirplaneWithRadar
-{
- partial class FormAirplaneWithRadar
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- pictureBoxAirplaneWithRadar = new PictureBox();
- buttonCreate = new Button();
- buttonDown = new Button();
- buttonRight = new Button();
- buttonLeft = new Button();
- buttonUp = new Button();
- ((System.ComponentModel.ISupportInitialize)pictureBoxAirplaneWithRadar).BeginInit();
- SuspendLayout();
- //
- // pictureBoxAirplaneWithRadar
- //
- pictureBoxAirplaneWithRadar.Dock = DockStyle.Fill;
- pictureBoxAirplaneWithRadar.Location = new Point(0, 0);
- pictureBoxAirplaneWithRadar.Name = "pictureBoxAirplaneWithRadar";
- pictureBoxAirplaneWithRadar.Size = new Size(882, 453);
- pictureBoxAirplaneWithRadar.SizeMode = PictureBoxSizeMode.AutoSize;
- pictureBoxAirplaneWithRadar.TabIndex = 0;
- pictureBoxAirplaneWithRadar.TabStop = false;
- pictureBoxAirplaneWithRadar.Click += buttonMove_Click;
- //
- // buttonCreate
- //
- buttonCreate.Location = new Point(12, 412);
- buttonCreate.Name = "buttonCreate";
- buttonCreate.Size = new Size(94, 29);
- buttonCreate.TabIndex = 1;
- buttonCreate.Text = "Create";
- buttonCreate.UseVisualStyleBackColor = true;
- buttonCreate.Click += buttonCreate_Click;
- //
- // buttonDown
- //
- buttonDown.Location = new Point(766, 396);
- buttonDown.Name = "buttonDown";
- buttonDown.Size = new Size(49, 45);
- buttonDown.TabIndex = 2;
- buttonDown.Text = "↓";
- buttonDown.UseVisualStyleBackColor = true;
- buttonDown.Click += buttonMove_Click;
- //
- // buttonRight
- //
- buttonRight.Location = new Point(821, 396);
- buttonRight.Name = "buttonRight";
- buttonRight.Size = new Size(49, 45);
- buttonRight.TabIndex = 3;
- buttonRight.Text = "→";
- buttonRight.UseVisualStyleBackColor = true;
- buttonRight.Click += buttonMove_Click;
- //
- // buttonLeft
- //
- buttonLeft.Location = new Point(711, 396);
- buttonLeft.Name = "buttonLeft";
- buttonLeft.Size = new Size(49, 45);
- buttonLeft.TabIndex = 4;
- buttonLeft.Text = "←";
- buttonLeft.UseVisualStyleBackColor = true;
- buttonLeft.Click += buttonMove_Click;
- //
- // buttonUp
- //
- buttonUp.Location = new Point(766, 345);
- buttonUp.Name = "buttonUp";
- buttonUp.Size = new Size(49, 45);
- buttonUp.TabIndex = 5;
- buttonUp.Text = "↑";
- buttonUp.UseVisualStyleBackColor = true;
- buttonUp.Click += buttonMove_Click;
- //
- // FormAirplaneWithRadar
- //
- AutoScaleDimensions = new SizeF(8F, 20F);
- AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size(882, 453);
- Controls.Add(buttonUp);
- Controls.Add(buttonLeft);
- Controls.Add(buttonRight);
- Controls.Add(buttonDown);
- Controls.Add(buttonCreate);
- Controls.Add(pictureBoxAirplaneWithRadar);
- Name = "FormAirplaneWithRadar";
- Text = "FormAirplaneWithRadar";
- ((System.ComponentModel.ISupportInitialize)pictureBoxAirplaneWithRadar).EndInit();
- ResumeLayout(false);
- PerformLayout();
- }
-
- #endregion
-
- private PictureBox pictureBoxAirplaneWithRadar;
- private Button buttonCreate;
- private Button buttonDown;
- private Button buttonRight;
- private Button buttonLeft;
- private Button buttonUp;
- }
-}
\ No newline at end of file
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs
deleted file mode 100644
index efcd6f2..0000000
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-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 ProjectAirplaneWithRadar
-{
- public partial class FormAirplaneWithRadar : Form
- {
- private DrawningAirplaneWithRadar? _drawningAirplaneWithRadar;
- private void Draw()
- {
- if (_drawningAirplaneWithRadar == null)
- {
- return;
- }
- Bitmap bmp = new Bitmap(pictureBoxAirplaneWithRadar.Width, pictureBoxAirplaneWithRadar.Height);
- Graphics gr = Graphics.FromImage(bmp);
- _drawningAirplaneWithRadar.DrawTransport(gr);
- pictureBoxAirplaneWithRadar.Image = bmp;
- }
- public FormAirplaneWithRadar()
- {
- InitializeComponent();
- }
- private void buttonCreate_Click(object sender, EventArgs e)
- {
- Random random = new Random();
- _drawningAirplaneWithRadar = new DrawningAirplaneWithRadar();
- if (_drawningAirplaneWithRadar.Init
- (random.Next(100, 300), // speed
- random.Next(1000, 3000),// weight
- Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),// bodycolor
- Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)), //additionalColor
- Convert.ToBoolean(random.Next(0, 2)), // radar
- Convert.ToBoolean(random.Next(0, 2)), //dopbak
- pictureBoxAirplaneWithRadar.Width, pictureBoxAirplaneWithRadar.Height))
- {
- _drawningAirplaneWithRadar.SetPosition(random.Next(10, 100), random.Next(10, 100));
- Draw();
- }
- }
- private void buttonMove_Click(object sender, EventArgs e)
- {
- if (_drawningAirplaneWithRadar == null)
- {
- return;
- }
- string name = ((Button)sender)?.Name ?? string.Empty;
- switch (name)
- {
- case "buttonUp":
- _drawningAirplaneWithRadar.MoveTransport(Direction.Up);
- break;
- case "buttonDown":
- _drawningAirplaneWithRadar.MoveTransport(Direction.Down);
- break;
- case "buttonLeft":
- _drawningAirplaneWithRadar.MoveTransport(Direction.Left);
- break;
- case "buttonRight":
- _drawningAirplaneWithRadar.MoveTransport(Direction.Right);
- break;
- }
- Draw();
- }
- }
-}
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Program.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Program.cs
index a78f7d5..f11c631 100644
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Program.cs
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Program.cs
@@ -1,9 +1,3 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
namespace ProjectAirplaneWithRadar
{
internal static class Program
@@ -14,9 +8,10 @@ namespace ProjectAirplaneWithRadar
[STAThread]
static void Main()
{
- Application.EnableVisualStyles();
+ // To customize application configuration such as set high DPI settings or default font,
+ // see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
- Application.Run(new FormAirplaneWithRadar());
+ Application.Run(new Form1());
}
}
}
\ No newline at end of file
diff --git a/ProjectAirplaneWithRadar/Новый файл b/ProjectAirplaneWithRadar/Новый файл
deleted file mode 100644
index e69de29..0000000
--
2.25.1
From 3a34dff17055258d477d2886768384b3f246e9fa Mon Sep 17 00:00:00 2001
From: antoc0der <1@DESKTOP-K1L8ND3>
Date: Mon, 9 Oct 2023 12:15:34 +0300
Subject: [PATCH 2/8] =?UTF-8?q?Revert=20"Revert=20"=D0=B3=D0=BE=D1=82?=
=?UTF-8?q?=D0=BE=D0=B2=D1=8B=D0=B9=20=D0=BF=D1=80=D0=BE=D0=B5=D0=BA=D1=82?=
=?UTF-8?q?""?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This reverts commit 534e7be294703bff2b40b1b2556ec4c4c2a56d7e.
---
.../ProjectAirplaneWithRadar/Direction.cs | 20 +++
.../DrawningAirplaneWithRadar.cs | 149 ++++++++++++++++++
.../EntityAirplaneWithRadar.cs | 36 +++++
.../Form1.Designer.cs | 39 -----
.../ProjectAirplaneWithRadar/Form1.cs | 10 --
.../FormAirplaneWithRadar.Designer.cs | 128 +++++++++++++++
.../FormAirplaneWithRadar.cs | 73 +++++++++
...{Form1.resx => FormAirplaneWithRadar.resx} | 50 +++---
.../ProjectAirplaneWithRadar/Program.cs | 11 +-
ProjectAirplaneWithRadar/Новый файл | 0
10 files changed, 439 insertions(+), 77 deletions(-)
create mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Direction.cs
create mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/DrawningAirplaneWithRadar.cs
create mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplaneWithRadar.cs
delete mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.Designer.cs
delete mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.cs
create mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.Designer.cs
create mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs
rename ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/{Form1.resx => FormAirplaneWithRadar.resx} (93%)
create mode 100644 ProjectAirplaneWithRadar/Новый файл
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Direction.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Direction.cs
new file mode 100644
index 0000000..a42ae78
--- /dev/null
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Direction.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProjectAirplaneWithRadar
+{
+ public enum Direction
+ {
+ // Вверх
+ Up = 1,
+ /// Вниз
+ Down = 2,
+ /// Влево
+ Left = 3,
+ /// Вправо
+ Right = 4
+ }
+}
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/DrawningAirplaneWithRadar.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/DrawningAirplaneWithRadar.cs
new file mode 100644
index 0000000..33f429e
--- /dev/null
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/DrawningAirplaneWithRadar.cs
@@ -0,0 +1,149 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Net.NetworkInformation;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace ProjectAirplaneWithRadar
+{
+ public class DrawningAirplaneWithRadar
+ {
+ public EntityAirplaneWithRadar? EntityAirplaneWithRadar { get; private set; }
+ public int _pictureWidth;
+ public int _pictureHeight;
+ public int _startPosX;
+ public int _startPosY;
+ private readonly int _airplaneWidth = 200;
+ private readonly int _airplaneHeight = 78;
+ public bool Init(int speed, double weight, Color bodyColor, Color additionalColor, bool radar, bool dopbak, int width, int height)
+ {
+ _pictureWidth = width;
+ _pictureHeight = height;
+ if (_airplaneWidth > _pictureWidth || _airplaneHeight > _pictureHeight)
+ return false;
+ EntityAirplaneWithRadar = new EntityAirplaneWithRadar();
+ EntityAirplaneWithRadar.Init(speed, weight, bodyColor, additionalColor, radar, dopbak);
+ return true;
+ }
+ public void SetPosition(int x, int y)
+ {
+ if(x < 0 || y < 0 ||x+_airplaneWidth >= _pictureWidth|| y + _airplaneHeight >= _pictureHeight)
+ {
+ x = y = 10;
+ _startPosX = x;
+ _startPosY=y;
+ }
+ _startPosX = x;
+ _startPosY = y;
+ }
+ public void MoveTransport(Direction direction)
+ {
+ if (EntityAirplaneWithRadar == null)
+ {
+ return;
+ }
+ switch (direction)
+ {
+ case Direction.Left:
+ if (_startPosX - EntityAirplaneWithRadar.Step > 0)
+ {
+ _startPosX -= (int)EntityAirplaneWithRadar.Step;
+ }
+ break;
+ case Direction.Up:
+ if (_startPosY - EntityAirplaneWithRadar.Step > 0)
+ {
+ _startPosY -= (int)EntityAirplaneWithRadar.Step;
+ }
+ break;
+ case Direction.Right:
+ if (_startPosX + EntityAirplaneWithRadar.Step+_airplaneWidth < _pictureWidth)
+ {
+ _startPosX += (int)EntityAirplaneWithRadar.Step;
+ }
+ break;
+ case Direction.Down:
+ if (_startPosY + EntityAirplaneWithRadar.Step+_airplaneHeight < _pictureHeight)
+ {
+ _startPosY += (int)EntityAirplaneWithRadar.Step;
+ }
+ break;
+ }
+ }
+ public void DrawTransport(Graphics g)
+ {
+ if(EntityAirplaneWithRadar == null)
+ {
+ return;
+ }
+ Pen pen = new Pen(Color.Black, 3);
+ Brush additionalBrush = new SolidBrush(EntityAirplaneWithRadar.AdditionalColor);
+ // корпус
+ Brush br = new SolidBrush(EntityAirplaneWithRadar.BodyColor);
+ g.DrawEllipse(pen, _startPosX, _startPosY+25,180, 30) ;
+ g.FillEllipse(br, _startPosX, _startPosY+25, 180, 30);
+ // крыло
+ Brush blackBrush = new SolidBrush(Color.Black);
+ g.FillEllipse(blackBrush, _startPosX + 70, _startPosY + 35, 80, 10);
+ // стекла
+ Pen blackPen = new Pen(Color.Black, 2);
+ Brush blueBrush = new SolidBrush(Color.LightBlue);
+ Point point1 = new Point(_startPosX+170, _startPosY+30);
+ Point point2 = new Point(_startPosX+200, _startPosY+40);
+ Point point3 = new Point(_startPosX+170, _startPosY + 50);
+ Point[] curvePoints =
+ {
+ point1,
+ point2,
+ point3,
+ };
+ g.FillPolygon(blueBrush, curvePoints);
+ g.DrawPolygon(blackPen, curvePoints);
+ g.DrawLine(blackPen, _startPosX + 170, _startPosY + 40, _startPosX + 200, _startPosY + 40);
+ // хвост
+ Point point4 = new Point(_startPosX, _startPosY + 35);
+ Point point5 = new Point(_startPosX, _startPosY +5 );
+ Point point6 = new Point(_startPosX + 30, _startPosY + 35);
+ Point[] curvePoints2 =
+ {
+ point4,
+ point5,
+ point6,
+ };
+ g.FillPolygon(br, curvePoints2);
+ g.DrawPolygon(blackPen, curvePoints2);
+ // шасси
+ g.DrawLine(blackPen, _startPosX + 50, _startPosY + 55, _startPosX + 50, _startPosY + 70);
+ g.DrawLine(blackPen, _startPosX + 150, _startPosY + 51, _startPosX + 150, _startPosY + 70);
+ g.FillEllipse(blackBrush, _startPosX + 40, _startPosY + 65, 10, 10);
+ g.FillEllipse(blackBrush, _startPosX + 50, _startPosY + 65, 10, 10);
+ g.FillEllipse(blackBrush, _startPosX + 145, _startPosY + 65, 10, 10);
+ if (EntityAirplaneWithRadar.DopBak)
+ {
+ //бак
+ g.FillEllipse(additionalBrush, _startPosX, _startPosY + 45, 40, 20);
+ g.DrawEllipse(blackPen, _startPosX, _startPosY + 45, 40, 20);
+ }
+ if (EntityAirplaneWithRadar.Radar)
+ {
+ //радар
+ g.DrawLine(blackPen, _startPosX + 60, _startPosY + 25, _startPosX + 60, _startPosY + 15);
+ g.DrawLine(blackPen, _startPosX + 60, _startPosY + 15, _startPosX + 67, _startPosY + 11);
+ Point point7 = new Point(_startPosX + 60, _startPosY + 15);
+ Point point8 = new Point(_startPosX + 60, _startPosY + 5);
+ Point point9 = new Point(_startPosX + 70, _startPosY + 25);
+ Point[] curvePoints3 =
+ {
+ point7,
+ point8,
+ point9,
+ };
+ g.FillPolygon(additionalBrush, curvePoints3);
+ }
+ }
+ }
+}
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplaneWithRadar.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplaneWithRadar.cs
new file mode 100644
index 0000000..4bed01a
--- /dev/null
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplaneWithRadar.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProjectAirplaneWithRadar
+{
+ public class EntityAirplaneWithRadar
+ {
+ //скорость
+ 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 Radar{ get; private set; }
+ // наличие дополнительных топливных баков
+ public bool DopBak{ get; private set; }
+ //шаг перемещения самолета
+ public double Step => (double)Speed*100/Weight;
+ public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool radar, bool dopbak)
+ {
+ Speed = speed;
+ Weight = weight;
+ BodyColor = bodyColor;
+ AdditionalColor = additionalColor;
+ Radar = radar;
+ DopBak = dopbak;
+ }
+ }
+}
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.Designer.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.Designer.cs
deleted file mode 100644
index 6118ed6..0000000
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.Designer.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-namespace ProjectAirplaneWithRadar
-{
- partial class Form1
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- 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
- }
-}
\ No newline at end of file
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.cs
deleted file mode 100644
index 20983c4..0000000
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace ProjectAirplaneWithRadar
-{
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- }
-}
\ No newline at end of file
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.Designer.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.Designer.cs
new file mode 100644
index 0000000..425e755
--- /dev/null
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.Designer.cs
@@ -0,0 +1,128 @@
+namespace ProjectAirplaneWithRadar
+{
+ partial class FormAirplaneWithRadar
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ pictureBoxAirplaneWithRadar = new PictureBox();
+ buttonCreate = new Button();
+ buttonDown = new Button();
+ buttonRight = new Button();
+ buttonLeft = new Button();
+ buttonUp = new Button();
+ ((System.ComponentModel.ISupportInitialize)pictureBoxAirplaneWithRadar).BeginInit();
+ SuspendLayout();
+ //
+ // pictureBoxAirplaneWithRadar
+ //
+ pictureBoxAirplaneWithRadar.Dock = DockStyle.Fill;
+ pictureBoxAirplaneWithRadar.Location = new Point(0, 0);
+ pictureBoxAirplaneWithRadar.Name = "pictureBoxAirplaneWithRadar";
+ pictureBoxAirplaneWithRadar.Size = new Size(882, 453);
+ pictureBoxAirplaneWithRadar.SizeMode = PictureBoxSizeMode.AutoSize;
+ pictureBoxAirplaneWithRadar.TabIndex = 0;
+ pictureBoxAirplaneWithRadar.TabStop = false;
+ pictureBoxAirplaneWithRadar.Click += buttonMove_Click;
+ //
+ // buttonCreate
+ //
+ buttonCreate.Location = new Point(12, 412);
+ buttonCreate.Name = "buttonCreate";
+ buttonCreate.Size = new Size(94, 29);
+ buttonCreate.TabIndex = 1;
+ buttonCreate.Text = "Create";
+ buttonCreate.UseVisualStyleBackColor = true;
+ buttonCreate.Click += buttonCreate_Click;
+ //
+ // buttonDown
+ //
+ buttonDown.Location = new Point(766, 396);
+ buttonDown.Name = "buttonDown";
+ buttonDown.Size = new Size(49, 45);
+ buttonDown.TabIndex = 2;
+ buttonDown.Text = "↓";
+ buttonDown.UseVisualStyleBackColor = true;
+ buttonDown.Click += buttonMove_Click;
+ //
+ // buttonRight
+ //
+ buttonRight.Location = new Point(821, 396);
+ buttonRight.Name = "buttonRight";
+ buttonRight.Size = new Size(49, 45);
+ buttonRight.TabIndex = 3;
+ buttonRight.Text = "→";
+ buttonRight.UseVisualStyleBackColor = true;
+ buttonRight.Click += buttonMove_Click;
+ //
+ // buttonLeft
+ //
+ buttonLeft.Location = new Point(711, 396);
+ buttonLeft.Name = "buttonLeft";
+ buttonLeft.Size = new Size(49, 45);
+ buttonLeft.TabIndex = 4;
+ buttonLeft.Text = "←";
+ buttonLeft.UseVisualStyleBackColor = true;
+ buttonLeft.Click += buttonMove_Click;
+ //
+ // buttonUp
+ //
+ buttonUp.Location = new Point(766, 345);
+ buttonUp.Name = "buttonUp";
+ buttonUp.Size = new Size(49, 45);
+ buttonUp.TabIndex = 5;
+ buttonUp.Text = "↑";
+ buttonUp.UseVisualStyleBackColor = true;
+ buttonUp.Click += buttonMove_Click;
+ //
+ // FormAirplaneWithRadar
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(882, 453);
+ Controls.Add(buttonUp);
+ Controls.Add(buttonLeft);
+ Controls.Add(buttonRight);
+ Controls.Add(buttonDown);
+ Controls.Add(buttonCreate);
+ Controls.Add(pictureBoxAirplaneWithRadar);
+ Name = "FormAirplaneWithRadar";
+ Text = "FormAirplaneWithRadar";
+ ((System.ComponentModel.ISupportInitialize)pictureBoxAirplaneWithRadar).EndInit();
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private PictureBox pictureBoxAirplaneWithRadar;
+ private Button buttonCreate;
+ private Button buttonDown;
+ private Button buttonRight;
+ private Button buttonLeft;
+ private Button buttonUp;
+ }
+}
\ No newline at end of file
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs
new file mode 100644
index 0000000..efcd6f2
--- /dev/null
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs
@@ -0,0 +1,73 @@
+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 ProjectAirplaneWithRadar
+{
+ public partial class FormAirplaneWithRadar : Form
+ {
+ private DrawningAirplaneWithRadar? _drawningAirplaneWithRadar;
+ private void Draw()
+ {
+ if (_drawningAirplaneWithRadar == null)
+ {
+ return;
+ }
+ Bitmap bmp = new Bitmap(pictureBoxAirplaneWithRadar.Width, pictureBoxAirplaneWithRadar.Height);
+ Graphics gr = Graphics.FromImage(bmp);
+ _drawningAirplaneWithRadar.DrawTransport(gr);
+ pictureBoxAirplaneWithRadar.Image = bmp;
+ }
+ public FormAirplaneWithRadar()
+ {
+ InitializeComponent();
+ }
+ private void buttonCreate_Click(object sender, EventArgs e)
+ {
+ Random random = new Random();
+ _drawningAirplaneWithRadar = new DrawningAirplaneWithRadar();
+ if (_drawningAirplaneWithRadar.Init
+ (random.Next(100, 300), // speed
+ random.Next(1000, 3000),// weight
+ Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),// bodycolor
+ Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)), //additionalColor
+ Convert.ToBoolean(random.Next(0, 2)), // radar
+ Convert.ToBoolean(random.Next(0, 2)), //dopbak
+ pictureBoxAirplaneWithRadar.Width, pictureBoxAirplaneWithRadar.Height))
+ {
+ _drawningAirplaneWithRadar.SetPosition(random.Next(10, 100), random.Next(10, 100));
+ Draw();
+ }
+ }
+ private void buttonMove_Click(object sender, EventArgs e)
+ {
+ if (_drawningAirplaneWithRadar == null)
+ {
+ return;
+ }
+ string name = ((Button)sender)?.Name ?? string.Empty;
+ switch (name)
+ {
+ case "buttonUp":
+ _drawningAirplaneWithRadar.MoveTransport(Direction.Up);
+ break;
+ case "buttonDown":
+ _drawningAirplaneWithRadar.MoveTransport(Direction.Down);
+ break;
+ case "buttonLeft":
+ _drawningAirplaneWithRadar.MoveTransport(Direction.Left);
+ break;
+ case "buttonRight":
+ _drawningAirplaneWithRadar.MoveTransport(Direction.Right);
+ break;
+ }
+ Draw();
+ }
+ }
+}
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.resx b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.resx
similarity index 93%
rename from ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.resx
rename to ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.resx
index 1af7de1..af32865 100644
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.resx
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.resx
@@ -1,17 +1,17 @@
-
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Program.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Program.cs
index f11c631..a78f7d5 100644
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Program.cs
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Program.cs
@@ -1,3 +1,9 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
namespace ProjectAirplaneWithRadar
{
internal static class Program
@@ -8,10 +14,9 @@ namespace ProjectAirplaneWithRadar
[STAThread]
static void Main()
{
- // To customize application configuration such as set high DPI settings or default font,
- // see https://aka.ms/applicationconfiguration.
+ Application.EnableVisualStyles();
ApplicationConfiguration.Initialize();
- Application.Run(new Form1());
+ Application.Run(new FormAirplaneWithRadar());
}
}
}
\ No newline at end of file
diff --git a/ProjectAirplaneWithRadar/Новый файл b/ProjectAirplaneWithRadar/Новый файл
new file mode 100644
index 0000000..e69de29
--
2.25.1
From 704a27c3aaacce97c28f79d2bdd8277e33e74a12 Mon Sep 17 00:00:00 2001
From: antoc0der <1@DESKTOP-K1L8ND3>
Date: Mon, 9 Oct 2023 12:19:44 +0300
Subject: [PATCH 3/8] =?UTF-8?q?Revert=20"Revert=20"Revert=20"=D0=B3=D0=BE?=
=?UTF-8?q?=D1=82=D0=BE=D0=B2=D1=8B=D0=B9=20=D0=BF=D1=80=D0=BE=D0=B5=D0=BA?=
=?UTF-8?q?=D1=82"""?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This reverts commit 3a34dff17055258d477d2886768384b3f246e9fa.
---
.../ProjectAirplaneWithRadar/Direction.cs | 20 ---
.../DrawningAirplaneWithRadar.cs | 149 ------------------
.../EntityAirplaneWithRadar.cs | 36 -----
.../Form1.Designer.cs | 39 +++++
.../ProjectAirplaneWithRadar/Form1.cs | 10 ++
...{FormAirplaneWithRadar.resx => Form1.resx} | 50 +++---
.../FormAirplaneWithRadar.Designer.cs | 128 ---------------
.../FormAirplaneWithRadar.cs | 73 ---------
.../ProjectAirplaneWithRadar/Program.cs | 11 +-
ProjectAirplaneWithRadar/Новый файл | 0
10 files changed, 77 insertions(+), 439 deletions(-)
delete mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Direction.cs
delete mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/DrawningAirplaneWithRadar.cs
delete mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplaneWithRadar.cs
create mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.Designer.cs
create mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.cs
rename ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/{FormAirplaneWithRadar.resx => Form1.resx} (93%)
delete mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.Designer.cs
delete mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs
delete mode 100644 ProjectAirplaneWithRadar/Новый файл
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Direction.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Direction.cs
deleted file mode 100644
index a42ae78..0000000
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Direction.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace ProjectAirplaneWithRadar
-{
- public enum Direction
- {
- // Вверх
- Up = 1,
- /// Вниз
- Down = 2,
- /// Влево
- Left = 3,
- /// Вправо
- Right = 4
- }
-}
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/DrawningAirplaneWithRadar.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/DrawningAirplaneWithRadar.cs
deleted file mode 100644
index 33f429e..0000000
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/DrawningAirplaneWithRadar.cs
+++ /dev/null
@@ -1,149 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Linq;
-using System.Net.NetworkInformation;
-using System.Reflection;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace ProjectAirplaneWithRadar
-{
- public class DrawningAirplaneWithRadar
- {
- public EntityAirplaneWithRadar? EntityAirplaneWithRadar { get; private set; }
- public int _pictureWidth;
- public int _pictureHeight;
- public int _startPosX;
- public int _startPosY;
- private readonly int _airplaneWidth = 200;
- private readonly int _airplaneHeight = 78;
- public bool Init(int speed, double weight, Color bodyColor, Color additionalColor, bool radar, bool dopbak, int width, int height)
- {
- _pictureWidth = width;
- _pictureHeight = height;
- if (_airplaneWidth > _pictureWidth || _airplaneHeight > _pictureHeight)
- return false;
- EntityAirplaneWithRadar = new EntityAirplaneWithRadar();
- EntityAirplaneWithRadar.Init(speed, weight, bodyColor, additionalColor, radar, dopbak);
- return true;
- }
- public void SetPosition(int x, int y)
- {
- if(x < 0 || y < 0 ||x+_airplaneWidth >= _pictureWidth|| y + _airplaneHeight >= _pictureHeight)
- {
- x = y = 10;
- _startPosX = x;
- _startPosY=y;
- }
- _startPosX = x;
- _startPosY = y;
- }
- public void MoveTransport(Direction direction)
- {
- if (EntityAirplaneWithRadar == null)
- {
- return;
- }
- switch (direction)
- {
- case Direction.Left:
- if (_startPosX - EntityAirplaneWithRadar.Step > 0)
- {
- _startPosX -= (int)EntityAirplaneWithRadar.Step;
- }
- break;
- case Direction.Up:
- if (_startPosY - EntityAirplaneWithRadar.Step > 0)
- {
- _startPosY -= (int)EntityAirplaneWithRadar.Step;
- }
- break;
- case Direction.Right:
- if (_startPosX + EntityAirplaneWithRadar.Step+_airplaneWidth < _pictureWidth)
- {
- _startPosX += (int)EntityAirplaneWithRadar.Step;
- }
- break;
- case Direction.Down:
- if (_startPosY + EntityAirplaneWithRadar.Step+_airplaneHeight < _pictureHeight)
- {
- _startPosY += (int)EntityAirplaneWithRadar.Step;
- }
- break;
- }
- }
- public void DrawTransport(Graphics g)
- {
- if(EntityAirplaneWithRadar == null)
- {
- return;
- }
- Pen pen = new Pen(Color.Black, 3);
- Brush additionalBrush = new SolidBrush(EntityAirplaneWithRadar.AdditionalColor);
- // корпус
- Brush br = new SolidBrush(EntityAirplaneWithRadar.BodyColor);
- g.DrawEllipse(pen, _startPosX, _startPosY+25,180, 30) ;
- g.FillEllipse(br, _startPosX, _startPosY+25, 180, 30);
- // крыло
- Brush blackBrush = new SolidBrush(Color.Black);
- g.FillEllipse(blackBrush, _startPosX + 70, _startPosY + 35, 80, 10);
- // стекла
- Pen blackPen = new Pen(Color.Black, 2);
- Brush blueBrush = new SolidBrush(Color.LightBlue);
- Point point1 = new Point(_startPosX+170, _startPosY+30);
- Point point2 = new Point(_startPosX+200, _startPosY+40);
- Point point3 = new Point(_startPosX+170, _startPosY + 50);
- Point[] curvePoints =
- {
- point1,
- point2,
- point3,
- };
- g.FillPolygon(blueBrush, curvePoints);
- g.DrawPolygon(blackPen, curvePoints);
- g.DrawLine(blackPen, _startPosX + 170, _startPosY + 40, _startPosX + 200, _startPosY + 40);
- // хвост
- Point point4 = new Point(_startPosX, _startPosY + 35);
- Point point5 = new Point(_startPosX, _startPosY +5 );
- Point point6 = new Point(_startPosX + 30, _startPosY + 35);
- Point[] curvePoints2 =
- {
- point4,
- point5,
- point6,
- };
- g.FillPolygon(br, curvePoints2);
- g.DrawPolygon(blackPen, curvePoints2);
- // шасси
- g.DrawLine(blackPen, _startPosX + 50, _startPosY + 55, _startPosX + 50, _startPosY + 70);
- g.DrawLine(blackPen, _startPosX + 150, _startPosY + 51, _startPosX + 150, _startPosY + 70);
- g.FillEllipse(blackBrush, _startPosX + 40, _startPosY + 65, 10, 10);
- g.FillEllipse(blackBrush, _startPosX + 50, _startPosY + 65, 10, 10);
- g.FillEllipse(blackBrush, _startPosX + 145, _startPosY + 65, 10, 10);
- if (EntityAirplaneWithRadar.DopBak)
- {
- //бак
- g.FillEllipse(additionalBrush, _startPosX, _startPosY + 45, 40, 20);
- g.DrawEllipse(blackPen, _startPosX, _startPosY + 45, 40, 20);
- }
- if (EntityAirplaneWithRadar.Radar)
- {
- //радар
- g.DrawLine(blackPen, _startPosX + 60, _startPosY + 25, _startPosX + 60, _startPosY + 15);
- g.DrawLine(blackPen, _startPosX + 60, _startPosY + 15, _startPosX + 67, _startPosY + 11);
- Point point7 = new Point(_startPosX + 60, _startPosY + 15);
- Point point8 = new Point(_startPosX + 60, _startPosY + 5);
- Point point9 = new Point(_startPosX + 70, _startPosY + 25);
- Point[] curvePoints3 =
- {
- point7,
- point8,
- point9,
- };
- g.FillPolygon(additionalBrush, curvePoints3);
- }
- }
- }
-}
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplaneWithRadar.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplaneWithRadar.cs
deleted file mode 100644
index 4bed01a..0000000
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplaneWithRadar.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace ProjectAirplaneWithRadar
-{
- public class EntityAirplaneWithRadar
- {
- //скорость
- 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 Radar{ get; private set; }
- // наличие дополнительных топливных баков
- public bool DopBak{ get; private set; }
- //шаг перемещения самолета
- public double Step => (double)Speed*100/Weight;
- public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool radar, bool dopbak)
- {
- Speed = speed;
- Weight = weight;
- BodyColor = bodyColor;
- AdditionalColor = additionalColor;
- Radar = radar;
- DopBak = dopbak;
- }
- }
-}
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.Designer.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.Designer.cs
new file mode 100644
index 0000000..6118ed6
--- /dev/null
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.Designer.cs
@@ -0,0 +1,39 @@
+namespace ProjectAirplaneWithRadar
+{
+ partial class Form1
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ 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
+ }
+}
\ No newline at end of file
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.cs
new file mode 100644
index 0000000..20983c4
--- /dev/null
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.cs
@@ -0,0 +1,10 @@
+namespace ProjectAirplaneWithRadar
+{
+ public partial class Form1 : Form
+ {
+ public Form1()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.resx b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.resx
similarity index 93%
rename from ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.resx
rename to ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.resx
index af32865..1af7de1 100644
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.resx
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.resx
@@ -1,17 +1,17 @@
-
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.Designer.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.Designer.cs
deleted file mode 100644
index 425e755..0000000
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.Designer.cs
+++ /dev/null
@@ -1,128 +0,0 @@
-namespace ProjectAirplaneWithRadar
-{
- partial class FormAirplaneWithRadar
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- pictureBoxAirplaneWithRadar = new PictureBox();
- buttonCreate = new Button();
- buttonDown = new Button();
- buttonRight = new Button();
- buttonLeft = new Button();
- buttonUp = new Button();
- ((System.ComponentModel.ISupportInitialize)pictureBoxAirplaneWithRadar).BeginInit();
- SuspendLayout();
- //
- // pictureBoxAirplaneWithRadar
- //
- pictureBoxAirplaneWithRadar.Dock = DockStyle.Fill;
- pictureBoxAirplaneWithRadar.Location = new Point(0, 0);
- pictureBoxAirplaneWithRadar.Name = "pictureBoxAirplaneWithRadar";
- pictureBoxAirplaneWithRadar.Size = new Size(882, 453);
- pictureBoxAirplaneWithRadar.SizeMode = PictureBoxSizeMode.AutoSize;
- pictureBoxAirplaneWithRadar.TabIndex = 0;
- pictureBoxAirplaneWithRadar.TabStop = false;
- pictureBoxAirplaneWithRadar.Click += buttonMove_Click;
- //
- // buttonCreate
- //
- buttonCreate.Location = new Point(12, 412);
- buttonCreate.Name = "buttonCreate";
- buttonCreate.Size = new Size(94, 29);
- buttonCreate.TabIndex = 1;
- buttonCreate.Text = "Create";
- buttonCreate.UseVisualStyleBackColor = true;
- buttonCreate.Click += buttonCreate_Click;
- //
- // buttonDown
- //
- buttonDown.Location = new Point(766, 396);
- buttonDown.Name = "buttonDown";
- buttonDown.Size = new Size(49, 45);
- buttonDown.TabIndex = 2;
- buttonDown.Text = "↓";
- buttonDown.UseVisualStyleBackColor = true;
- buttonDown.Click += buttonMove_Click;
- //
- // buttonRight
- //
- buttonRight.Location = new Point(821, 396);
- buttonRight.Name = "buttonRight";
- buttonRight.Size = new Size(49, 45);
- buttonRight.TabIndex = 3;
- buttonRight.Text = "→";
- buttonRight.UseVisualStyleBackColor = true;
- buttonRight.Click += buttonMove_Click;
- //
- // buttonLeft
- //
- buttonLeft.Location = new Point(711, 396);
- buttonLeft.Name = "buttonLeft";
- buttonLeft.Size = new Size(49, 45);
- buttonLeft.TabIndex = 4;
- buttonLeft.Text = "←";
- buttonLeft.UseVisualStyleBackColor = true;
- buttonLeft.Click += buttonMove_Click;
- //
- // buttonUp
- //
- buttonUp.Location = new Point(766, 345);
- buttonUp.Name = "buttonUp";
- buttonUp.Size = new Size(49, 45);
- buttonUp.TabIndex = 5;
- buttonUp.Text = "↑";
- buttonUp.UseVisualStyleBackColor = true;
- buttonUp.Click += buttonMove_Click;
- //
- // FormAirplaneWithRadar
- //
- AutoScaleDimensions = new SizeF(8F, 20F);
- AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size(882, 453);
- Controls.Add(buttonUp);
- Controls.Add(buttonLeft);
- Controls.Add(buttonRight);
- Controls.Add(buttonDown);
- Controls.Add(buttonCreate);
- Controls.Add(pictureBoxAirplaneWithRadar);
- Name = "FormAirplaneWithRadar";
- Text = "FormAirplaneWithRadar";
- ((System.ComponentModel.ISupportInitialize)pictureBoxAirplaneWithRadar).EndInit();
- ResumeLayout(false);
- PerformLayout();
- }
-
- #endregion
-
- private PictureBox pictureBoxAirplaneWithRadar;
- private Button buttonCreate;
- private Button buttonDown;
- private Button buttonRight;
- private Button buttonLeft;
- private Button buttonUp;
- }
-}
\ No newline at end of file
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs
deleted file mode 100644
index efcd6f2..0000000
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-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 ProjectAirplaneWithRadar
-{
- public partial class FormAirplaneWithRadar : Form
- {
- private DrawningAirplaneWithRadar? _drawningAirplaneWithRadar;
- private void Draw()
- {
- if (_drawningAirplaneWithRadar == null)
- {
- return;
- }
- Bitmap bmp = new Bitmap(pictureBoxAirplaneWithRadar.Width, pictureBoxAirplaneWithRadar.Height);
- Graphics gr = Graphics.FromImage(bmp);
- _drawningAirplaneWithRadar.DrawTransport(gr);
- pictureBoxAirplaneWithRadar.Image = bmp;
- }
- public FormAirplaneWithRadar()
- {
- InitializeComponent();
- }
- private void buttonCreate_Click(object sender, EventArgs e)
- {
- Random random = new Random();
- _drawningAirplaneWithRadar = new DrawningAirplaneWithRadar();
- if (_drawningAirplaneWithRadar.Init
- (random.Next(100, 300), // speed
- random.Next(1000, 3000),// weight
- Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),// bodycolor
- Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)), //additionalColor
- Convert.ToBoolean(random.Next(0, 2)), // radar
- Convert.ToBoolean(random.Next(0, 2)), //dopbak
- pictureBoxAirplaneWithRadar.Width, pictureBoxAirplaneWithRadar.Height))
- {
- _drawningAirplaneWithRadar.SetPosition(random.Next(10, 100), random.Next(10, 100));
- Draw();
- }
- }
- private void buttonMove_Click(object sender, EventArgs e)
- {
- if (_drawningAirplaneWithRadar == null)
- {
- return;
- }
- string name = ((Button)sender)?.Name ?? string.Empty;
- switch (name)
- {
- case "buttonUp":
- _drawningAirplaneWithRadar.MoveTransport(Direction.Up);
- break;
- case "buttonDown":
- _drawningAirplaneWithRadar.MoveTransport(Direction.Down);
- break;
- case "buttonLeft":
- _drawningAirplaneWithRadar.MoveTransport(Direction.Left);
- break;
- case "buttonRight":
- _drawningAirplaneWithRadar.MoveTransport(Direction.Right);
- break;
- }
- Draw();
- }
- }
-}
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Program.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Program.cs
index a78f7d5..f11c631 100644
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Program.cs
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Program.cs
@@ -1,9 +1,3 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
namespace ProjectAirplaneWithRadar
{
internal static class Program
@@ -14,9 +8,10 @@ namespace ProjectAirplaneWithRadar
[STAThread]
static void Main()
{
- Application.EnableVisualStyles();
+ // To customize application configuration such as set high DPI settings or default font,
+ // see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
- Application.Run(new FormAirplaneWithRadar());
+ Application.Run(new Form1());
}
}
}
\ No newline at end of file
diff --git a/ProjectAirplaneWithRadar/Новый файл b/ProjectAirplaneWithRadar/Новый файл
deleted file mode 100644
index e69de29..0000000
--
2.25.1
From aaa540c662d3fe8041f67a8e076ca202f6385c6c Mon Sep 17 00:00:00 2001
From: antoc0der <1@DESKTOP-K1L8ND3>
Date: Mon, 9 Oct 2023 12:20:02 +0300
Subject: [PATCH 4/8] =?UTF-8?q?Revert=20"Revert=20"Revert=20"Revert=20"?=
=?UTF-8?q?=D0=B3=D0=BE=D1=82=D0=BE=D0=B2=D1=8B=D0=B9=20=D0=BF=D1=80=D0=BE?=
=?UTF-8?q?=D0=B5=D0=BA=D1=82""""?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This reverts commit 704a27c3aaacce97c28f79d2bdd8277e33e74a12.
---
.../ProjectAirplaneWithRadar/Direction.cs | 20 +++
.../DrawningAirplaneWithRadar.cs | 149 ++++++++++++++++++
.../EntityAirplaneWithRadar.cs | 36 +++++
.../Form1.Designer.cs | 39 -----
.../ProjectAirplaneWithRadar/Form1.cs | 10 --
.../FormAirplaneWithRadar.Designer.cs | 128 +++++++++++++++
.../FormAirplaneWithRadar.cs | 73 +++++++++
...{Form1.resx => FormAirplaneWithRadar.resx} | 50 +++---
.../ProjectAirplaneWithRadar/Program.cs | 11 +-
ProjectAirplaneWithRadar/Новый файл | 0
10 files changed, 439 insertions(+), 77 deletions(-)
create mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Direction.cs
create mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/DrawningAirplaneWithRadar.cs
create mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplaneWithRadar.cs
delete mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.Designer.cs
delete mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.cs
create mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.Designer.cs
create mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs
rename ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/{Form1.resx => FormAirplaneWithRadar.resx} (93%)
create mode 100644 ProjectAirplaneWithRadar/Новый файл
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Direction.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Direction.cs
new file mode 100644
index 0000000..a42ae78
--- /dev/null
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Direction.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProjectAirplaneWithRadar
+{
+ public enum Direction
+ {
+ // Вверх
+ Up = 1,
+ /// Вниз
+ Down = 2,
+ /// Влево
+ Left = 3,
+ /// Вправо
+ Right = 4
+ }
+}
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/DrawningAirplaneWithRadar.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/DrawningAirplaneWithRadar.cs
new file mode 100644
index 0000000..33f429e
--- /dev/null
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/DrawningAirplaneWithRadar.cs
@@ -0,0 +1,149 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Net.NetworkInformation;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace ProjectAirplaneWithRadar
+{
+ public class DrawningAirplaneWithRadar
+ {
+ public EntityAirplaneWithRadar? EntityAirplaneWithRadar { get; private set; }
+ public int _pictureWidth;
+ public int _pictureHeight;
+ public int _startPosX;
+ public int _startPosY;
+ private readonly int _airplaneWidth = 200;
+ private readonly int _airplaneHeight = 78;
+ public bool Init(int speed, double weight, Color bodyColor, Color additionalColor, bool radar, bool dopbak, int width, int height)
+ {
+ _pictureWidth = width;
+ _pictureHeight = height;
+ if (_airplaneWidth > _pictureWidth || _airplaneHeight > _pictureHeight)
+ return false;
+ EntityAirplaneWithRadar = new EntityAirplaneWithRadar();
+ EntityAirplaneWithRadar.Init(speed, weight, bodyColor, additionalColor, radar, dopbak);
+ return true;
+ }
+ public void SetPosition(int x, int y)
+ {
+ if(x < 0 || y < 0 ||x+_airplaneWidth >= _pictureWidth|| y + _airplaneHeight >= _pictureHeight)
+ {
+ x = y = 10;
+ _startPosX = x;
+ _startPosY=y;
+ }
+ _startPosX = x;
+ _startPosY = y;
+ }
+ public void MoveTransport(Direction direction)
+ {
+ if (EntityAirplaneWithRadar == null)
+ {
+ return;
+ }
+ switch (direction)
+ {
+ case Direction.Left:
+ if (_startPosX - EntityAirplaneWithRadar.Step > 0)
+ {
+ _startPosX -= (int)EntityAirplaneWithRadar.Step;
+ }
+ break;
+ case Direction.Up:
+ if (_startPosY - EntityAirplaneWithRadar.Step > 0)
+ {
+ _startPosY -= (int)EntityAirplaneWithRadar.Step;
+ }
+ break;
+ case Direction.Right:
+ if (_startPosX + EntityAirplaneWithRadar.Step+_airplaneWidth < _pictureWidth)
+ {
+ _startPosX += (int)EntityAirplaneWithRadar.Step;
+ }
+ break;
+ case Direction.Down:
+ if (_startPosY + EntityAirplaneWithRadar.Step+_airplaneHeight < _pictureHeight)
+ {
+ _startPosY += (int)EntityAirplaneWithRadar.Step;
+ }
+ break;
+ }
+ }
+ public void DrawTransport(Graphics g)
+ {
+ if(EntityAirplaneWithRadar == null)
+ {
+ return;
+ }
+ Pen pen = new Pen(Color.Black, 3);
+ Brush additionalBrush = new SolidBrush(EntityAirplaneWithRadar.AdditionalColor);
+ // корпус
+ Brush br = new SolidBrush(EntityAirplaneWithRadar.BodyColor);
+ g.DrawEllipse(pen, _startPosX, _startPosY+25,180, 30) ;
+ g.FillEllipse(br, _startPosX, _startPosY+25, 180, 30);
+ // крыло
+ Brush blackBrush = new SolidBrush(Color.Black);
+ g.FillEllipse(blackBrush, _startPosX + 70, _startPosY + 35, 80, 10);
+ // стекла
+ Pen blackPen = new Pen(Color.Black, 2);
+ Brush blueBrush = new SolidBrush(Color.LightBlue);
+ Point point1 = new Point(_startPosX+170, _startPosY+30);
+ Point point2 = new Point(_startPosX+200, _startPosY+40);
+ Point point3 = new Point(_startPosX+170, _startPosY + 50);
+ Point[] curvePoints =
+ {
+ point1,
+ point2,
+ point3,
+ };
+ g.FillPolygon(blueBrush, curvePoints);
+ g.DrawPolygon(blackPen, curvePoints);
+ g.DrawLine(blackPen, _startPosX + 170, _startPosY + 40, _startPosX + 200, _startPosY + 40);
+ // хвост
+ Point point4 = new Point(_startPosX, _startPosY + 35);
+ Point point5 = new Point(_startPosX, _startPosY +5 );
+ Point point6 = new Point(_startPosX + 30, _startPosY + 35);
+ Point[] curvePoints2 =
+ {
+ point4,
+ point5,
+ point6,
+ };
+ g.FillPolygon(br, curvePoints2);
+ g.DrawPolygon(blackPen, curvePoints2);
+ // шасси
+ g.DrawLine(blackPen, _startPosX + 50, _startPosY + 55, _startPosX + 50, _startPosY + 70);
+ g.DrawLine(blackPen, _startPosX + 150, _startPosY + 51, _startPosX + 150, _startPosY + 70);
+ g.FillEllipse(blackBrush, _startPosX + 40, _startPosY + 65, 10, 10);
+ g.FillEllipse(blackBrush, _startPosX + 50, _startPosY + 65, 10, 10);
+ g.FillEllipse(blackBrush, _startPosX + 145, _startPosY + 65, 10, 10);
+ if (EntityAirplaneWithRadar.DopBak)
+ {
+ //бак
+ g.FillEllipse(additionalBrush, _startPosX, _startPosY + 45, 40, 20);
+ g.DrawEllipse(blackPen, _startPosX, _startPosY + 45, 40, 20);
+ }
+ if (EntityAirplaneWithRadar.Radar)
+ {
+ //радар
+ g.DrawLine(blackPen, _startPosX + 60, _startPosY + 25, _startPosX + 60, _startPosY + 15);
+ g.DrawLine(blackPen, _startPosX + 60, _startPosY + 15, _startPosX + 67, _startPosY + 11);
+ Point point7 = new Point(_startPosX + 60, _startPosY + 15);
+ Point point8 = new Point(_startPosX + 60, _startPosY + 5);
+ Point point9 = new Point(_startPosX + 70, _startPosY + 25);
+ Point[] curvePoints3 =
+ {
+ point7,
+ point8,
+ point9,
+ };
+ g.FillPolygon(additionalBrush, curvePoints3);
+ }
+ }
+ }
+}
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplaneWithRadar.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplaneWithRadar.cs
new file mode 100644
index 0000000..4bed01a
--- /dev/null
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplaneWithRadar.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProjectAirplaneWithRadar
+{
+ public class EntityAirplaneWithRadar
+ {
+ //скорость
+ 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 Radar{ get; private set; }
+ // наличие дополнительных топливных баков
+ public bool DopBak{ get; private set; }
+ //шаг перемещения самолета
+ public double Step => (double)Speed*100/Weight;
+ public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool radar, bool dopbak)
+ {
+ Speed = speed;
+ Weight = weight;
+ BodyColor = bodyColor;
+ AdditionalColor = additionalColor;
+ Radar = radar;
+ DopBak = dopbak;
+ }
+ }
+}
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.Designer.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.Designer.cs
deleted file mode 100644
index 6118ed6..0000000
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.Designer.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-namespace ProjectAirplaneWithRadar
-{
- partial class Form1
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- 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
- }
-}
\ No newline at end of file
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.cs
deleted file mode 100644
index 20983c4..0000000
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace ProjectAirplaneWithRadar
-{
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- }
-}
\ No newline at end of file
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.Designer.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.Designer.cs
new file mode 100644
index 0000000..425e755
--- /dev/null
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.Designer.cs
@@ -0,0 +1,128 @@
+namespace ProjectAirplaneWithRadar
+{
+ partial class FormAirplaneWithRadar
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ pictureBoxAirplaneWithRadar = new PictureBox();
+ buttonCreate = new Button();
+ buttonDown = new Button();
+ buttonRight = new Button();
+ buttonLeft = new Button();
+ buttonUp = new Button();
+ ((System.ComponentModel.ISupportInitialize)pictureBoxAirplaneWithRadar).BeginInit();
+ SuspendLayout();
+ //
+ // pictureBoxAirplaneWithRadar
+ //
+ pictureBoxAirplaneWithRadar.Dock = DockStyle.Fill;
+ pictureBoxAirplaneWithRadar.Location = new Point(0, 0);
+ pictureBoxAirplaneWithRadar.Name = "pictureBoxAirplaneWithRadar";
+ pictureBoxAirplaneWithRadar.Size = new Size(882, 453);
+ pictureBoxAirplaneWithRadar.SizeMode = PictureBoxSizeMode.AutoSize;
+ pictureBoxAirplaneWithRadar.TabIndex = 0;
+ pictureBoxAirplaneWithRadar.TabStop = false;
+ pictureBoxAirplaneWithRadar.Click += buttonMove_Click;
+ //
+ // buttonCreate
+ //
+ buttonCreate.Location = new Point(12, 412);
+ buttonCreate.Name = "buttonCreate";
+ buttonCreate.Size = new Size(94, 29);
+ buttonCreate.TabIndex = 1;
+ buttonCreate.Text = "Create";
+ buttonCreate.UseVisualStyleBackColor = true;
+ buttonCreate.Click += buttonCreate_Click;
+ //
+ // buttonDown
+ //
+ buttonDown.Location = new Point(766, 396);
+ buttonDown.Name = "buttonDown";
+ buttonDown.Size = new Size(49, 45);
+ buttonDown.TabIndex = 2;
+ buttonDown.Text = "↓";
+ buttonDown.UseVisualStyleBackColor = true;
+ buttonDown.Click += buttonMove_Click;
+ //
+ // buttonRight
+ //
+ buttonRight.Location = new Point(821, 396);
+ buttonRight.Name = "buttonRight";
+ buttonRight.Size = new Size(49, 45);
+ buttonRight.TabIndex = 3;
+ buttonRight.Text = "→";
+ buttonRight.UseVisualStyleBackColor = true;
+ buttonRight.Click += buttonMove_Click;
+ //
+ // buttonLeft
+ //
+ buttonLeft.Location = new Point(711, 396);
+ buttonLeft.Name = "buttonLeft";
+ buttonLeft.Size = new Size(49, 45);
+ buttonLeft.TabIndex = 4;
+ buttonLeft.Text = "←";
+ buttonLeft.UseVisualStyleBackColor = true;
+ buttonLeft.Click += buttonMove_Click;
+ //
+ // buttonUp
+ //
+ buttonUp.Location = new Point(766, 345);
+ buttonUp.Name = "buttonUp";
+ buttonUp.Size = new Size(49, 45);
+ buttonUp.TabIndex = 5;
+ buttonUp.Text = "↑";
+ buttonUp.UseVisualStyleBackColor = true;
+ buttonUp.Click += buttonMove_Click;
+ //
+ // FormAirplaneWithRadar
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(882, 453);
+ Controls.Add(buttonUp);
+ Controls.Add(buttonLeft);
+ Controls.Add(buttonRight);
+ Controls.Add(buttonDown);
+ Controls.Add(buttonCreate);
+ Controls.Add(pictureBoxAirplaneWithRadar);
+ Name = "FormAirplaneWithRadar";
+ Text = "FormAirplaneWithRadar";
+ ((System.ComponentModel.ISupportInitialize)pictureBoxAirplaneWithRadar).EndInit();
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private PictureBox pictureBoxAirplaneWithRadar;
+ private Button buttonCreate;
+ private Button buttonDown;
+ private Button buttonRight;
+ private Button buttonLeft;
+ private Button buttonUp;
+ }
+}
\ No newline at end of file
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs
new file mode 100644
index 0000000..efcd6f2
--- /dev/null
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs
@@ -0,0 +1,73 @@
+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 ProjectAirplaneWithRadar
+{
+ public partial class FormAirplaneWithRadar : Form
+ {
+ private DrawningAirplaneWithRadar? _drawningAirplaneWithRadar;
+ private void Draw()
+ {
+ if (_drawningAirplaneWithRadar == null)
+ {
+ return;
+ }
+ Bitmap bmp = new Bitmap(pictureBoxAirplaneWithRadar.Width, pictureBoxAirplaneWithRadar.Height);
+ Graphics gr = Graphics.FromImage(bmp);
+ _drawningAirplaneWithRadar.DrawTransport(gr);
+ pictureBoxAirplaneWithRadar.Image = bmp;
+ }
+ public FormAirplaneWithRadar()
+ {
+ InitializeComponent();
+ }
+ private void buttonCreate_Click(object sender, EventArgs e)
+ {
+ Random random = new Random();
+ _drawningAirplaneWithRadar = new DrawningAirplaneWithRadar();
+ if (_drawningAirplaneWithRadar.Init
+ (random.Next(100, 300), // speed
+ random.Next(1000, 3000),// weight
+ Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),// bodycolor
+ Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)), //additionalColor
+ Convert.ToBoolean(random.Next(0, 2)), // radar
+ Convert.ToBoolean(random.Next(0, 2)), //dopbak
+ pictureBoxAirplaneWithRadar.Width, pictureBoxAirplaneWithRadar.Height))
+ {
+ _drawningAirplaneWithRadar.SetPosition(random.Next(10, 100), random.Next(10, 100));
+ Draw();
+ }
+ }
+ private void buttonMove_Click(object sender, EventArgs e)
+ {
+ if (_drawningAirplaneWithRadar == null)
+ {
+ return;
+ }
+ string name = ((Button)sender)?.Name ?? string.Empty;
+ switch (name)
+ {
+ case "buttonUp":
+ _drawningAirplaneWithRadar.MoveTransport(Direction.Up);
+ break;
+ case "buttonDown":
+ _drawningAirplaneWithRadar.MoveTransport(Direction.Down);
+ break;
+ case "buttonLeft":
+ _drawningAirplaneWithRadar.MoveTransport(Direction.Left);
+ break;
+ case "buttonRight":
+ _drawningAirplaneWithRadar.MoveTransport(Direction.Right);
+ break;
+ }
+ Draw();
+ }
+ }
+}
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.resx b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.resx
similarity index 93%
rename from ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.resx
rename to ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.resx
index 1af7de1..af32865 100644
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.resx
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.resx
@@ -1,17 +1,17 @@
-
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Program.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Program.cs
index f11c631..a78f7d5 100644
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Program.cs
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Program.cs
@@ -1,3 +1,9 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
namespace ProjectAirplaneWithRadar
{
internal static class Program
@@ -8,10 +14,9 @@ namespace ProjectAirplaneWithRadar
[STAThread]
static void Main()
{
- // To customize application configuration such as set high DPI settings or default font,
- // see https://aka.ms/applicationconfiguration.
+ Application.EnableVisualStyles();
ApplicationConfiguration.Initialize();
- Application.Run(new Form1());
+ Application.Run(new FormAirplaneWithRadar());
}
}
}
\ No newline at end of file
diff --git a/ProjectAirplaneWithRadar/Новый файл b/ProjectAirplaneWithRadar/Новый файл
new file mode 100644
index 0000000..e69de29
--
2.25.1
From 2c1cedade6230c4e3243da783e18e7d84ce0b0fe Mon Sep 17 00:00:00 2001
From: antoc0der <1@DESKTOP-K1L8ND3>
Date: Mon, 9 Oct 2023 12:20:34 +0300
Subject: [PATCH 5/8] =?UTF-8?q?Revert=20"Revert=20"Revert=20"Revert=20"Rev?=
=?UTF-8?q?ert=20"=D0=B3=D0=BE=D1=82=D0=BE=D0=B2=D1=8B=D0=B9=20=D0=BF?=
=?UTF-8?q?=D1=80=D0=BE=D0=B5=D0=BA=D1=82"""""?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This reverts commit aaa540c662d3fe8041f67a8e076ca202f6385c6c.
---
.../ProjectAirplaneWithRadar/Direction.cs | 20 ---
.../DrawningAirplaneWithRadar.cs | 149 ------------------
.../EntityAirplaneWithRadar.cs | 36 -----
.../Form1.Designer.cs | 39 +++++
.../ProjectAirplaneWithRadar/Form1.cs | 10 ++
...{FormAirplaneWithRadar.resx => Form1.resx} | 50 +++---
.../FormAirplaneWithRadar.Designer.cs | 128 ---------------
.../FormAirplaneWithRadar.cs | 73 ---------
.../ProjectAirplaneWithRadar/Program.cs | 11 +-
ProjectAirplaneWithRadar/Новый файл | 0
10 files changed, 77 insertions(+), 439 deletions(-)
delete mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Direction.cs
delete mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/DrawningAirplaneWithRadar.cs
delete mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplaneWithRadar.cs
create mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.Designer.cs
create mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.cs
rename ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/{FormAirplaneWithRadar.resx => Form1.resx} (93%)
delete mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.Designer.cs
delete mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs
delete mode 100644 ProjectAirplaneWithRadar/Новый файл
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Direction.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Direction.cs
deleted file mode 100644
index a42ae78..0000000
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Direction.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace ProjectAirplaneWithRadar
-{
- public enum Direction
- {
- // Вверх
- Up = 1,
- /// Вниз
- Down = 2,
- /// Влево
- Left = 3,
- /// Вправо
- Right = 4
- }
-}
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/DrawningAirplaneWithRadar.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/DrawningAirplaneWithRadar.cs
deleted file mode 100644
index 33f429e..0000000
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/DrawningAirplaneWithRadar.cs
+++ /dev/null
@@ -1,149 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Linq;
-using System.Net.NetworkInformation;
-using System.Reflection;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace ProjectAirplaneWithRadar
-{
- public class DrawningAirplaneWithRadar
- {
- public EntityAirplaneWithRadar? EntityAirplaneWithRadar { get; private set; }
- public int _pictureWidth;
- public int _pictureHeight;
- public int _startPosX;
- public int _startPosY;
- private readonly int _airplaneWidth = 200;
- private readonly int _airplaneHeight = 78;
- public bool Init(int speed, double weight, Color bodyColor, Color additionalColor, bool radar, bool dopbak, int width, int height)
- {
- _pictureWidth = width;
- _pictureHeight = height;
- if (_airplaneWidth > _pictureWidth || _airplaneHeight > _pictureHeight)
- return false;
- EntityAirplaneWithRadar = new EntityAirplaneWithRadar();
- EntityAirplaneWithRadar.Init(speed, weight, bodyColor, additionalColor, radar, dopbak);
- return true;
- }
- public void SetPosition(int x, int y)
- {
- if(x < 0 || y < 0 ||x+_airplaneWidth >= _pictureWidth|| y + _airplaneHeight >= _pictureHeight)
- {
- x = y = 10;
- _startPosX = x;
- _startPosY=y;
- }
- _startPosX = x;
- _startPosY = y;
- }
- public void MoveTransport(Direction direction)
- {
- if (EntityAirplaneWithRadar == null)
- {
- return;
- }
- switch (direction)
- {
- case Direction.Left:
- if (_startPosX - EntityAirplaneWithRadar.Step > 0)
- {
- _startPosX -= (int)EntityAirplaneWithRadar.Step;
- }
- break;
- case Direction.Up:
- if (_startPosY - EntityAirplaneWithRadar.Step > 0)
- {
- _startPosY -= (int)EntityAirplaneWithRadar.Step;
- }
- break;
- case Direction.Right:
- if (_startPosX + EntityAirplaneWithRadar.Step+_airplaneWidth < _pictureWidth)
- {
- _startPosX += (int)EntityAirplaneWithRadar.Step;
- }
- break;
- case Direction.Down:
- if (_startPosY + EntityAirplaneWithRadar.Step+_airplaneHeight < _pictureHeight)
- {
- _startPosY += (int)EntityAirplaneWithRadar.Step;
- }
- break;
- }
- }
- public void DrawTransport(Graphics g)
- {
- if(EntityAirplaneWithRadar == null)
- {
- return;
- }
- Pen pen = new Pen(Color.Black, 3);
- Brush additionalBrush = new SolidBrush(EntityAirplaneWithRadar.AdditionalColor);
- // корпус
- Brush br = new SolidBrush(EntityAirplaneWithRadar.BodyColor);
- g.DrawEllipse(pen, _startPosX, _startPosY+25,180, 30) ;
- g.FillEllipse(br, _startPosX, _startPosY+25, 180, 30);
- // крыло
- Brush blackBrush = new SolidBrush(Color.Black);
- g.FillEllipse(blackBrush, _startPosX + 70, _startPosY + 35, 80, 10);
- // стекла
- Pen blackPen = new Pen(Color.Black, 2);
- Brush blueBrush = new SolidBrush(Color.LightBlue);
- Point point1 = new Point(_startPosX+170, _startPosY+30);
- Point point2 = new Point(_startPosX+200, _startPosY+40);
- Point point3 = new Point(_startPosX+170, _startPosY + 50);
- Point[] curvePoints =
- {
- point1,
- point2,
- point3,
- };
- g.FillPolygon(blueBrush, curvePoints);
- g.DrawPolygon(blackPen, curvePoints);
- g.DrawLine(blackPen, _startPosX + 170, _startPosY + 40, _startPosX + 200, _startPosY + 40);
- // хвост
- Point point4 = new Point(_startPosX, _startPosY + 35);
- Point point5 = new Point(_startPosX, _startPosY +5 );
- Point point6 = new Point(_startPosX + 30, _startPosY + 35);
- Point[] curvePoints2 =
- {
- point4,
- point5,
- point6,
- };
- g.FillPolygon(br, curvePoints2);
- g.DrawPolygon(blackPen, curvePoints2);
- // шасси
- g.DrawLine(blackPen, _startPosX + 50, _startPosY + 55, _startPosX + 50, _startPosY + 70);
- g.DrawLine(blackPen, _startPosX + 150, _startPosY + 51, _startPosX + 150, _startPosY + 70);
- g.FillEllipse(blackBrush, _startPosX + 40, _startPosY + 65, 10, 10);
- g.FillEllipse(blackBrush, _startPosX + 50, _startPosY + 65, 10, 10);
- g.FillEllipse(blackBrush, _startPosX + 145, _startPosY + 65, 10, 10);
- if (EntityAirplaneWithRadar.DopBak)
- {
- //бак
- g.FillEllipse(additionalBrush, _startPosX, _startPosY + 45, 40, 20);
- g.DrawEllipse(blackPen, _startPosX, _startPosY + 45, 40, 20);
- }
- if (EntityAirplaneWithRadar.Radar)
- {
- //радар
- g.DrawLine(blackPen, _startPosX + 60, _startPosY + 25, _startPosX + 60, _startPosY + 15);
- g.DrawLine(blackPen, _startPosX + 60, _startPosY + 15, _startPosX + 67, _startPosY + 11);
- Point point7 = new Point(_startPosX + 60, _startPosY + 15);
- Point point8 = new Point(_startPosX + 60, _startPosY + 5);
- Point point9 = new Point(_startPosX + 70, _startPosY + 25);
- Point[] curvePoints3 =
- {
- point7,
- point8,
- point9,
- };
- g.FillPolygon(additionalBrush, curvePoints3);
- }
- }
- }
-}
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplaneWithRadar.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplaneWithRadar.cs
deleted file mode 100644
index 4bed01a..0000000
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplaneWithRadar.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace ProjectAirplaneWithRadar
-{
- public class EntityAirplaneWithRadar
- {
- //скорость
- 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 Radar{ get; private set; }
- // наличие дополнительных топливных баков
- public bool DopBak{ get; private set; }
- //шаг перемещения самолета
- public double Step => (double)Speed*100/Weight;
- public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool radar, bool dopbak)
- {
- Speed = speed;
- Weight = weight;
- BodyColor = bodyColor;
- AdditionalColor = additionalColor;
- Radar = radar;
- DopBak = dopbak;
- }
- }
-}
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.Designer.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.Designer.cs
new file mode 100644
index 0000000..6118ed6
--- /dev/null
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.Designer.cs
@@ -0,0 +1,39 @@
+namespace ProjectAirplaneWithRadar
+{
+ partial class Form1
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ 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
+ }
+}
\ No newline at end of file
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.cs
new file mode 100644
index 0000000..20983c4
--- /dev/null
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.cs
@@ -0,0 +1,10 @@
+namespace ProjectAirplaneWithRadar
+{
+ public partial class Form1 : Form
+ {
+ public Form1()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.resx b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.resx
similarity index 93%
rename from ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.resx
rename to ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.resx
index af32865..1af7de1 100644
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.resx
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.resx
@@ -1,17 +1,17 @@
-
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.Designer.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.Designer.cs
deleted file mode 100644
index 425e755..0000000
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.Designer.cs
+++ /dev/null
@@ -1,128 +0,0 @@
-namespace ProjectAirplaneWithRadar
-{
- partial class FormAirplaneWithRadar
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- pictureBoxAirplaneWithRadar = new PictureBox();
- buttonCreate = new Button();
- buttonDown = new Button();
- buttonRight = new Button();
- buttonLeft = new Button();
- buttonUp = new Button();
- ((System.ComponentModel.ISupportInitialize)pictureBoxAirplaneWithRadar).BeginInit();
- SuspendLayout();
- //
- // pictureBoxAirplaneWithRadar
- //
- pictureBoxAirplaneWithRadar.Dock = DockStyle.Fill;
- pictureBoxAirplaneWithRadar.Location = new Point(0, 0);
- pictureBoxAirplaneWithRadar.Name = "pictureBoxAirplaneWithRadar";
- pictureBoxAirplaneWithRadar.Size = new Size(882, 453);
- pictureBoxAirplaneWithRadar.SizeMode = PictureBoxSizeMode.AutoSize;
- pictureBoxAirplaneWithRadar.TabIndex = 0;
- pictureBoxAirplaneWithRadar.TabStop = false;
- pictureBoxAirplaneWithRadar.Click += buttonMove_Click;
- //
- // buttonCreate
- //
- buttonCreate.Location = new Point(12, 412);
- buttonCreate.Name = "buttonCreate";
- buttonCreate.Size = new Size(94, 29);
- buttonCreate.TabIndex = 1;
- buttonCreate.Text = "Create";
- buttonCreate.UseVisualStyleBackColor = true;
- buttonCreate.Click += buttonCreate_Click;
- //
- // buttonDown
- //
- buttonDown.Location = new Point(766, 396);
- buttonDown.Name = "buttonDown";
- buttonDown.Size = new Size(49, 45);
- buttonDown.TabIndex = 2;
- buttonDown.Text = "↓";
- buttonDown.UseVisualStyleBackColor = true;
- buttonDown.Click += buttonMove_Click;
- //
- // buttonRight
- //
- buttonRight.Location = new Point(821, 396);
- buttonRight.Name = "buttonRight";
- buttonRight.Size = new Size(49, 45);
- buttonRight.TabIndex = 3;
- buttonRight.Text = "→";
- buttonRight.UseVisualStyleBackColor = true;
- buttonRight.Click += buttonMove_Click;
- //
- // buttonLeft
- //
- buttonLeft.Location = new Point(711, 396);
- buttonLeft.Name = "buttonLeft";
- buttonLeft.Size = new Size(49, 45);
- buttonLeft.TabIndex = 4;
- buttonLeft.Text = "←";
- buttonLeft.UseVisualStyleBackColor = true;
- buttonLeft.Click += buttonMove_Click;
- //
- // buttonUp
- //
- buttonUp.Location = new Point(766, 345);
- buttonUp.Name = "buttonUp";
- buttonUp.Size = new Size(49, 45);
- buttonUp.TabIndex = 5;
- buttonUp.Text = "↑";
- buttonUp.UseVisualStyleBackColor = true;
- buttonUp.Click += buttonMove_Click;
- //
- // FormAirplaneWithRadar
- //
- AutoScaleDimensions = new SizeF(8F, 20F);
- AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size(882, 453);
- Controls.Add(buttonUp);
- Controls.Add(buttonLeft);
- Controls.Add(buttonRight);
- Controls.Add(buttonDown);
- Controls.Add(buttonCreate);
- Controls.Add(pictureBoxAirplaneWithRadar);
- Name = "FormAirplaneWithRadar";
- Text = "FormAirplaneWithRadar";
- ((System.ComponentModel.ISupportInitialize)pictureBoxAirplaneWithRadar).EndInit();
- ResumeLayout(false);
- PerformLayout();
- }
-
- #endregion
-
- private PictureBox pictureBoxAirplaneWithRadar;
- private Button buttonCreate;
- private Button buttonDown;
- private Button buttonRight;
- private Button buttonLeft;
- private Button buttonUp;
- }
-}
\ No newline at end of file
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs
deleted file mode 100644
index efcd6f2..0000000
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-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 ProjectAirplaneWithRadar
-{
- public partial class FormAirplaneWithRadar : Form
- {
- private DrawningAirplaneWithRadar? _drawningAirplaneWithRadar;
- private void Draw()
- {
- if (_drawningAirplaneWithRadar == null)
- {
- return;
- }
- Bitmap bmp = new Bitmap(pictureBoxAirplaneWithRadar.Width, pictureBoxAirplaneWithRadar.Height);
- Graphics gr = Graphics.FromImage(bmp);
- _drawningAirplaneWithRadar.DrawTransport(gr);
- pictureBoxAirplaneWithRadar.Image = bmp;
- }
- public FormAirplaneWithRadar()
- {
- InitializeComponent();
- }
- private void buttonCreate_Click(object sender, EventArgs e)
- {
- Random random = new Random();
- _drawningAirplaneWithRadar = new DrawningAirplaneWithRadar();
- if (_drawningAirplaneWithRadar.Init
- (random.Next(100, 300), // speed
- random.Next(1000, 3000),// weight
- Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),// bodycolor
- Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)), //additionalColor
- Convert.ToBoolean(random.Next(0, 2)), // radar
- Convert.ToBoolean(random.Next(0, 2)), //dopbak
- pictureBoxAirplaneWithRadar.Width, pictureBoxAirplaneWithRadar.Height))
- {
- _drawningAirplaneWithRadar.SetPosition(random.Next(10, 100), random.Next(10, 100));
- Draw();
- }
- }
- private void buttonMove_Click(object sender, EventArgs e)
- {
- if (_drawningAirplaneWithRadar == null)
- {
- return;
- }
- string name = ((Button)sender)?.Name ?? string.Empty;
- switch (name)
- {
- case "buttonUp":
- _drawningAirplaneWithRadar.MoveTransport(Direction.Up);
- break;
- case "buttonDown":
- _drawningAirplaneWithRadar.MoveTransport(Direction.Down);
- break;
- case "buttonLeft":
- _drawningAirplaneWithRadar.MoveTransport(Direction.Left);
- break;
- case "buttonRight":
- _drawningAirplaneWithRadar.MoveTransport(Direction.Right);
- break;
- }
- Draw();
- }
- }
-}
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Program.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Program.cs
index a78f7d5..f11c631 100644
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Program.cs
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Program.cs
@@ -1,9 +1,3 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
namespace ProjectAirplaneWithRadar
{
internal static class Program
@@ -14,9 +8,10 @@ namespace ProjectAirplaneWithRadar
[STAThread]
static void Main()
{
- Application.EnableVisualStyles();
+ // To customize application configuration such as set high DPI settings or default font,
+ // see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
- Application.Run(new FormAirplaneWithRadar());
+ Application.Run(new Form1());
}
}
}
\ No newline at end of file
diff --git a/ProjectAirplaneWithRadar/Новый файл b/ProjectAirplaneWithRadar/Новый файл
deleted file mode 100644
index e69de29..0000000
--
2.25.1
From 1d8824c3e47c170686356e3fde8229442faafd73 Mon Sep 17 00:00:00 2001
From: antoc0der <1@DESKTOP-K1L8ND3>
Date: Mon, 9 Oct 2023 17:22:51 +0300
Subject: [PATCH 6/8] =?UTF-8?q?=D1=81=D0=BE=D0=B7=D0=B4=D0=B0=D0=BB=20?=
=?UTF-8?q?=D1=84=D0=BE=D1=80=D0=BC=D1=83?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../ProjectAirplaneWithRadar/Direction.cs | 20 +++
.../DrawningAirplaneWithRadar.cs | 149 ++++++++++++++++++
.../EntityAirplaneWithRadar.cs | 36 +++++
...r.cs => FormAirplaneWithRadar.Designer.cs} | 16 +-
.../{Form1.cs => FormAirplaneWithRadar.cs} | 4 +-
...{Form1.resx => FormAirplaneWithRadar.resx} | 50 +++---
.../ProjectAirplaneWithRadar/Program.cs | 2 +-
7 files changed, 244 insertions(+), 33 deletions(-)
create mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Direction.cs
create mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/DrawningAirplaneWithRadar.cs
create mode 100644 ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplaneWithRadar.cs
rename ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/{Form1.Designer.cs => FormAirplaneWithRadar.Designer.cs} (70%)
rename ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/{Form1.cs => FormAirplaneWithRadar.cs} (52%)
rename ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/{Form1.resx => FormAirplaneWithRadar.resx} (93%)
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Direction.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Direction.cs
new file mode 100644
index 0000000..a42ae78
--- /dev/null
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Direction.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProjectAirplaneWithRadar
+{
+ public enum Direction
+ {
+ // Вверх
+ Up = 1,
+ /// Вниз
+ Down = 2,
+ /// Влево
+ Left = 3,
+ /// Вправо
+ Right = 4
+ }
+}
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/DrawningAirplaneWithRadar.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/DrawningAirplaneWithRadar.cs
new file mode 100644
index 0000000..33f429e
--- /dev/null
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/DrawningAirplaneWithRadar.cs
@@ -0,0 +1,149 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Net.NetworkInformation;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace ProjectAirplaneWithRadar
+{
+ public class DrawningAirplaneWithRadar
+ {
+ public EntityAirplaneWithRadar? EntityAirplaneWithRadar { get; private set; }
+ public int _pictureWidth;
+ public int _pictureHeight;
+ public int _startPosX;
+ public int _startPosY;
+ private readonly int _airplaneWidth = 200;
+ private readonly int _airplaneHeight = 78;
+ public bool Init(int speed, double weight, Color bodyColor, Color additionalColor, bool radar, bool dopbak, int width, int height)
+ {
+ _pictureWidth = width;
+ _pictureHeight = height;
+ if (_airplaneWidth > _pictureWidth || _airplaneHeight > _pictureHeight)
+ return false;
+ EntityAirplaneWithRadar = new EntityAirplaneWithRadar();
+ EntityAirplaneWithRadar.Init(speed, weight, bodyColor, additionalColor, radar, dopbak);
+ return true;
+ }
+ public void SetPosition(int x, int y)
+ {
+ if(x < 0 || y < 0 ||x+_airplaneWidth >= _pictureWidth|| y + _airplaneHeight >= _pictureHeight)
+ {
+ x = y = 10;
+ _startPosX = x;
+ _startPosY=y;
+ }
+ _startPosX = x;
+ _startPosY = y;
+ }
+ public void MoveTransport(Direction direction)
+ {
+ if (EntityAirplaneWithRadar == null)
+ {
+ return;
+ }
+ switch (direction)
+ {
+ case Direction.Left:
+ if (_startPosX - EntityAirplaneWithRadar.Step > 0)
+ {
+ _startPosX -= (int)EntityAirplaneWithRadar.Step;
+ }
+ break;
+ case Direction.Up:
+ if (_startPosY - EntityAirplaneWithRadar.Step > 0)
+ {
+ _startPosY -= (int)EntityAirplaneWithRadar.Step;
+ }
+ break;
+ case Direction.Right:
+ if (_startPosX + EntityAirplaneWithRadar.Step+_airplaneWidth < _pictureWidth)
+ {
+ _startPosX += (int)EntityAirplaneWithRadar.Step;
+ }
+ break;
+ case Direction.Down:
+ if (_startPosY + EntityAirplaneWithRadar.Step+_airplaneHeight < _pictureHeight)
+ {
+ _startPosY += (int)EntityAirplaneWithRadar.Step;
+ }
+ break;
+ }
+ }
+ public void DrawTransport(Graphics g)
+ {
+ if(EntityAirplaneWithRadar == null)
+ {
+ return;
+ }
+ Pen pen = new Pen(Color.Black, 3);
+ Brush additionalBrush = new SolidBrush(EntityAirplaneWithRadar.AdditionalColor);
+ // корпус
+ Brush br = new SolidBrush(EntityAirplaneWithRadar.BodyColor);
+ g.DrawEllipse(pen, _startPosX, _startPosY+25,180, 30) ;
+ g.FillEllipse(br, _startPosX, _startPosY+25, 180, 30);
+ // крыло
+ Brush blackBrush = new SolidBrush(Color.Black);
+ g.FillEllipse(blackBrush, _startPosX + 70, _startPosY + 35, 80, 10);
+ // стекла
+ Pen blackPen = new Pen(Color.Black, 2);
+ Brush blueBrush = new SolidBrush(Color.LightBlue);
+ Point point1 = new Point(_startPosX+170, _startPosY+30);
+ Point point2 = new Point(_startPosX+200, _startPosY+40);
+ Point point3 = new Point(_startPosX+170, _startPosY + 50);
+ Point[] curvePoints =
+ {
+ point1,
+ point2,
+ point3,
+ };
+ g.FillPolygon(blueBrush, curvePoints);
+ g.DrawPolygon(blackPen, curvePoints);
+ g.DrawLine(blackPen, _startPosX + 170, _startPosY + 40, _startPosX + 200, _startPosY + 40);
+ // хвост
+ Point point4 = new Point(_startPosX, _startPosY + 35);
+ Point point5 = new Point(_startPosX, _startPosY +5 );
+ Point point6 = new Point(_startPosX + 30, _startPosY + 35);
+ Point[] curvePoints2 =
+ {
+ point4,
+ point5,
+ point6,
+ };
+ g.FillPolygon(br, curvePoints2);
+ g.DrawPolygon(blackPen, curvePoints2);
+ // шасси
+ g.DrawLine(blackPen, _startPosX + 50, _startPosY + 55, _startPosX + 50, _startPosY + 70);
+ g.DrawLine(blackPen, _startPosX + 150, _startPosY + 51, _startPosX + 150, _startPosY + 70);
+ g.FillEllipse(blackBrush, _startPosX + 40, _startPosY + 65, 10, 10);
+ g.FillEllipse(blackBrush, _startPosX + 50, _startPosY + 65, 10, 10);
+ g.FillEllipse(blackBrush, _startPosX + 145, _startPosY + 65, 10, 10);
+ if (EntityAirplaneWithRadar.DopBak)
+ {
+ //бак
+ g.FillEllipse(additionalBrush, _startPosX, _startPosY + 45, 40, 20);
+ g.DrawEllipse(blackPen, _startPosX, _startPosY + 45, 40, 20);
+ }
+ if (EntityAirplaneWithRadar.Radar)
+ {
+ //радар
+ g.DrawLine(blackPen, _startPosX + 60, _startPosY + 25, _startPosX + 60, _startPosY + 15);
+ g.DrawLine(blackPen, _startPosX + 60, _startPosY + 15, _startPosX + 67, _startPosY + 11);
+ Point point7 = new Point(_startPosX + 60, _startPosY + 15);
+ Point point8 = new Point(_startPosX + 60, _startPosY + 5);
+ Point point9 = new Point(_startPosX + 70, _startPosY + 25);
+ Point[] curvePoints3 =
+ {
+ point7,
+ point8,
+ point9,
+ };
+ g.FillPolygon(additionalBrush, curvePoints3);
+ }
+ }
+ }
+}
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplaneWithRadar.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplaneWithRadar.cs
new file mode 100644
index 0000000..4bed01a
--- /dev/null
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/EntityAirplaneWithRadar.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProjectAirplaneWithRadar
+{
+ public class EntityAirplaneWithRadar
+ {
+ //скорость
+ 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 Radar{ get; private set; }
+ // наличие дополнительных топливных баков
+ public bool DopBak{ get; private set; }
+ //шаг перемещения самолета
+ public double Step => (double)Speed*100/Weight;
+ public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool radar, bool dopbak)
+ {
+ Speed = speed;
+ Weight = weight;
+ BodyColor = bodyColor;
+ AdditionalColor = additionalColor;
+ Radar = radar;
+ DopBak = dopbak;
+ }
+ }
+}
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.Designer.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.Designer.cs
similarity index 70%
rename from ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.Designer.cs
rename to ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.Designer.cs
index 6118ed6..fbb5bf6 100644
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.Designer.cs
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.Designer.cs
@@ -1,6 +1,6 @@
namespace ProjectAirplaneWithRadar
{
- partial class Form1
+ partial class FormAirplaneWithRadar
{
///
/// Required designer variable.
@@ -28,10 +28,16 @@
///
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";
+ SuspendLayout();
+ //
+ // FormAirplaneWithRadar
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(882, 453);
+ Name = "FormAirplaneWithRadar";
+ Text = "FormAirplaneWithRadar";
+ ResumeLayout(false);
}
#endregion
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs
similarity index 52%
rename from ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.cs
rename to ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs
index 20983c4..8f2114d 100644
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.cs
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs
@@ -1,8 +1,8 @@
namespace ProjectAirplaneWithRadar
{
- public partial class Form1 : Form
+ public partial class FormAirplaneWithRadar : Form
{
- public Form1()
+ public FormAirplaneWithRadar()
{
InitializeComponent();
}
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.resx b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.resx
similarity index 93%
rename from ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.resx
rename to ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.resx
index 1af7de1..af32865 100644
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Form1.resx
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.resx
@@ -1,17 +1,17 @@
-
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Program.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Program.cs
index f11c631..3ed1af4 100644
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Program.cs
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/Program.cs
@@ -11,7 +11,7 @@ namespace ProjectAirplaneWithRadar
// 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 FormAirplaneWithRadar());
}
}
}
\ No newline at end of file
--
2.25.1
From 3fc0d392b01a657e35bc202ea38e154e89a58b88 Mon Sep 17 00:00:00 2001
From: antoc0der <1@DESKTOP-K1L8ND3>
Date: Mon, 9 Oct 2023 17:43:02 +0300
Subject: [PATCH 7/8] =?UTF-8?q?=D0=B3=D0=BE=D1=82=D0=BE=D0=B2=D1=8B=D0=B9?=
=?UTF-8?q?=20=D0=BF=D1=80=D0=BE=D0=B5=D0=BA=D1=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../FormAirplaneWithRadar.Designer.cs | 89 ++++++++++++++++++-
.../FormAirplaneWithRadar.cs | 53 +++++++++++
2 files changed, 141 insertions(+), 1 deletion(-)
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.Designer.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.Designer.cs
index fbb5bf6..dfb4116 100644
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.Designer.cs
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.Designer.cs
@@ -28,18 +28,105 @@
///
private void InitializeComponent()
{
+ pictureBoxAirplaneWithRadar = new PictureBox();
+ buttonCreate = new Button();
+ buttonRight = new Button();
+ buttonDown = new Button();
+ buttonLeft = new Button();
+ buttonUp = new Button();
+ ((System.ComponentModel.ISupportInitialize)pictureBoxAirplaneWithRadar).BeginInit();
SuspendLayout();
//
+ // pictureBoxAirplaneWithRadar
+ //
+ pictureBoxAirplaneWithRadar.Dock = DockStyle.Fill;
+ pictureBoxAirplaneWithRadar.Location = new Point(0, 0);
+ pictureBoxAirplaneWithRadar.Name = "pictureBoxAirplaneWithRadar";
+ pictureBoxAirplaneWithRadar.Size = new Size(887, 454);
+ pictureBoxAirplaneWithRadar.SizeMode = PictureBoxSizeMode.AutoSize;
+ pictureBoxAirplaneWithRadar.TabIndex = 0;
+ pictureBoxAirplaneWithRadar.TabStop = false;
+ //
+ // buttonCreate
+ //
+ buttonCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
+ buttonCreate.Location = new Point(12, 413);
+ buttonCreate.Name = "buttonCreate";
+ buttonCreate.Size = new Size(94, 29);
+ buttonCreate.TabIndex = 1;
+ buttonCreate.Text = "Create";
+ buttonCreate.UseVisualStyleBackColor = true;
+ buttonCreate.Click += buttonCreate_Click;
+ //
+ // buttonRight
+ //
+ buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
+ buttonRight.Location = new Point(825, 402);
+ buttonRight.Name = "buttonRight";
+ buttonRight.Size = new Size(50, 40);
+ buttonRight.TabIndex = 2;
+ buttonRight.Text = "→";
+ buttonRight.UseVisualStyleBackColor = true;
+ buttonRight.Click += buttonMove_Click;
+ //
+ // buttonDown
+ //
+ buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
+ buttonDown.Location = new Point(769, 402);
+ buttonDown.Name = "buttonDown";
+ buttonDown.Size = new Size(50, 40);
+ buttonDown.TabIndex = 3;
+ buttonDown.Text = "↓";
+ buttonDown.UseVisualStyleBackColor = true;
+ buttonDown.Click += buttonMove_Click;
+ //
+ // buttonLeft
+ //
+ buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
+ buttonLeft.Location = new Point(713, 402);
+ buttonLeft.Name = "buttonLeft";
+ buttonLeft.Size = new Size(50, 40);
+ buttonLeft.TabIndex = 4;
+ buttonLeft.Text = "←";
+ buttonLeft.UseVisualStyleBackColor = true;
+ buttonLeft.Click += buttonMove_Click;
+ //
+ // buttonUp
+ //
+ buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
+ buttonUp.Location = new Point(769, 356);
+ buttonUp.Name = "buttonUp";
+ buttonUp.Size = new Size(50, 40);
+ buttonUp.TabIndex = 5;
+ buttonUp.Text = "↑";
+ buttonUp.UseVisualStyleBackColor = true;
+ buttonUp.Click += buttonMove_Click;
+ //
// FormAirplaneWithRadar
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size(882, 453);
+ ClientSize = new Size(887, 454);
+ Controls.Add(buttonUp);
+ Controls.Add(buttonLeft);
+ Controls.Add(buttonDown);
+ Controls.Add(buttonRight);
+ Controls.Add(buttonCreate);
+ Controls.Add(pictureBoxAirplaneWithRadar);
Name = "FormAirplaneWithRadar";
Text = "FormAirplaneWithRadar";
+ ((System.ComponentModel.ISupportInitialize)pictureBoxAirplaneWithRadar).EndInit();
ResumeLayout(false);
+ PerformLayout();
}
#endregion
+
+ private PictureBox pictureBoxAirplaneWithRadar;
+ private Button buttonCreate;
+ private Button buttonRight;
+ private Button buttonDown;
+ private Button buttonLeft;
+ private Button buttonUp;
}
}
\ No newline at end of file
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs
index 8f2114d..0e1a4bd 100644
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs
@@ -2,9 +2,62 @@ namespace ProjectAirplaneWithRadar
{
public partial class FormAirplaneWithRadar : Form
{
+ private DrawningAirplaneWithRadar _drawningAirplaneWithRadar;
+ private void Draw()
+ {
+ if (_drawningAirplaneWithRadar == null)
+ {
+ return;
+ }
+ Bitmap bmp = new Bitmap(pictureBoxAirplaneWithRadar.Width, pictureBoxAirplaneWithRadar.Height);
+ Graphics gr = Graphics.FromImage(bmp);
+ _drawningAirplaneWithRadar.DrawTransport(gr);
+ pictureBoxAirplaneWithRadar.Image = bmp;
+ }
public FormAirplaneWithRadar()
{
InitializeComponent();
}
+ private void buttonMove_Click(object sender, EventArgs e)
+ {
+ if (_drawningAirplaneWithRadar == null)
+ {
+ return;
+ }
+ string name = ((Button)sender)?.Name ?? string.Empty;
+ switch (name)
+ {
+ case "buttonUp":
+ _drawningAirplaneWithRadar.MoveTransport(Direction.Up);
+ break;
+ case "buttonDown":
+ _drawningAirplaneWithRadar.MoveTransport(Direction.Down);
+ break;
+ case "buttonLeft":
+ _drawningAirplaneWithRadar.MoveTransport(Direction.Left);
+ break;
+ case "buttonRight":
+ _drawningAirplaneWithRadar.MoveTransport(Direction.Right);
+ break;
+ }
+ Draw();
+ }
+ private void buttonCreate_Click(object sender, EventArgs e)
+ {
+ Random random = new Random();
+ _drawningAirplaneWithRadar = new DrawningAirplaneWithRadar();
+ if (_drawningAirplaneWithRadar.Init
+ (random.Next(100, 300), // speed
+ random.Next(1000, 3000),// weight
+ Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),// bodycolor
+ Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)), //additionalColor
+ Convert.ToBoolean(random.Next(0, 2)), // radar
+ Convert.ToBoolean(random.Next(0, 2)), //dopbak
+ pictureBoxAirplaneWithRadar.Width, pictureBoxAirplaneWithRadar.Height))
+ {
+ _drawningAirplaneWithRadar.SetPosition(random.Next(10, 100), random.Next(10, 100));
+ Draw();
+ }
+ }
}
}
\ No newline at end of file
--
2.25.1
From 31671e87d0aed38e8e483153acde4d3fc880f0e9 Mon Sep 17 00:00:00 2001
From: antoc0der <1@DESKTOP-K1L8ND3>
Date: Mon, 9 Oct 2023 18:48:28 +0300
Subject: [PATCH 8/8] =?UTF-8?q?=D0=BD=D0=B5=D0=B1=D0=BE=D0=BB=D1=8C=D1=88?=
=?UTF-8?q?=D0=B8=D0=B5=20=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs
index 0e1a4bd..b4d5bcf 100644
--- a/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs
+++ b/ProjectAirplaneWithRadar/ProjectAirplaneWithRadar/FormAirplaneWithRadar.cs
@@ -2,7 +2,7 @@ namespace ProjectAirplaneWithRadar
{
public partial class FormAirplaneWithRadar : Form
{
- private DrawningAirplaneWithRadar _drawningAirplaneWithRadar;
+ private DrawningAirplaneWithRadar? _drawningAirplaneWithRadar;
private void Draw()
{
if (_drawningAirplaneWithRadar == null)
--
2.25.1