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] =?UTF-8?q?Revert=20"Revert=20"Revert=20"Revert=20"Revert?= =?UTF-8?q?=20"=D0=B3=D0=BE=D1=82=D0=BE=D0=B2=D1=8B=D0=B9=20=D0=BF=D1=80?= =?UTF-8?q?=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