From 56e1256a98e5c4f409c86b2829492f835320016e Mon Sep 17 00:00:00 2001 From: NikGapon <45200250+NikGapon@users.noreply.github.com> Date: Sat, 5 Nov 2022 14:21:44 +0400 Subject: [PATCH] name fix --- .../{DrawingAirbus.cs => DrawingAirplane.cs} | 60 +++++++++---------- .../{EntityAirbus.cs => EntityAirplane.cs} | 2 +- ...s.Designer.cs => FormAirplane.Designer.cs} | 6 +- .../Airbus/{FormAirbus.cs => FormAirplane.cs} | 30 +++++----- .../{FormAirbus.resx => FormAirplane.resx} | 0 Airbus/Airbus/Program.cs | 2 +- 6 files changed, 50 insertions(+), 50 deletions(-) rename Airbus/Airbus/{DrawingAirbus.cs => DrawingAirplane.cs} (56%) rename Airbus/Airbus/{EntityAirbus.cs => EntityAirplane.cs} (95%) rename Airbus/Airbus/{FormAirbus.Designer.cs => FormAirplane.Designer.cs} (98%) rename Airbus/Airbus/{FormAirbus.cs => FormAirplane.cs} (57%) rename Airbus/Airbus/{FormAirbus.resx => FormAirplane.resx} (100%) diff --git a/Airbus/Airbus/DrawingAirbus.cs b/Airbus/Airbus/DrawingAirplane.cs similarity index 56% rename from Airbus/Airbus/DrawingAirbus.cs rename to Airbus/Airbus/DrawingAirplane.cs index 12fd286..16598f0 100644 --- a/Airbus/Airbus/DrawingAirbus.cs +++ b/Airbus/Airbus/DrawingAirplane.cs @@ -6,10 +6,10 @@ using System.Threading.Tasks; namespace Airbus { - internal class DrawningAirbus + internal class DrawningAirplane { /// Класс-сущность - public EntityAirbus airbus { private set; get; } + public EntityAirplane airplane { private set; get; } /// Левая координата отрисовки автомобиля private float _startPosX; /// Верхняя кооридната отрисовки автомобиля @@ -19,20 +19,20 @@ namespace Airbus /// Высота окна отрисовки private int? _pictureHeight = null; /// Ширина отрисовки автомобиля - private readonly int _airbusWidth = 150; //Ширина отрисовки корабля - private readonly int _airbusHeight = 30; //Высота отрисовки корабля + private readonly int _airplaneWidth = 150; //Ширина отрисовки корабля + private readonly int _airplaneHeight = 30; //Высота отрисовки корабля public void Init(int speed, float weight, Color bodyColor) { - airbus = new EntityAirbus(); - airbus.Init(speed, weight, bodyColor); + airplane = new EntityAirplane(); + airplane.Init(speed, weight, bodyColor); } public void SetPosition(int x, int y, int width, int height) { - if (width < _airbusWidth || height < _airbusHeight) return; + if (width < _airplaneWidth || height < _airplaneHeight) return; Random random = new Random(); - _startPosX = x < 0 || x + _airbusWidth > width ? random.Next(0, width - _airbusWidth) : x; - _startPosY = y < 0 || y + _airbusHeight > height ? random.Next(0, height - _airbusHeight) : y; + _startPosX = x < 0 || x + _airplaneWidth > width ? random.Next(0, width - _airplaneWidth) : x; + _startPosY = y < 0 || y + _airplaneHeight > height ? random.Next(0, height - _airplaneHeight) : y; _startPosX = x; _startPosY = y; _pictureWidth = width; @@ -46,16 +46,16 @@ namespace Airbus { case Direction.Left: //Влево - if (_startPosX - airbus.Step > 0) _startPosX -= airbus.Step; + if (_startPosX - airplane.Step > 0) _startPosX -= airplane.Step; break; case Direction.Up: //Вверх - if (_startPosY - airbus.Step > 0) _startPosY -= airbus.Step; + if (_startPosY - airplane.Step > 0) _startPosY -= airplane.Step; break; case Direction.Right: //Вправо - if (_startPosX + _airbusWidth + airbus.Step - 6 < _pictureWidth) _startPosX += airbus.Step; + if (_startPosX + _airplaneWidth + airplane.Step - 6 < _pictureWidth) _startPosX += airplane.Step; break; case Direction.Down: //Вниз - if (_startPosY + _airbusHeight + airbus.Step + 25 < _pictureHeight) _startPosY += airbus.Step; + if (_startPosY + _airplaneHeight + airplane.Step + 25 < _pictureHeight) _startPosY += airplane.Step; break; } } @@ -68,15 +68,15 @@ namespace Airbus } Pen pen = new(Color.Black); - SolidBrush brush = new SolidBrush(airbus?.BodyColor ?? Color.White); + SolidBrush brush = new SolidBrush(airplane?.BodyColor ?? Color.White); g.FillPolygon(brush, new[] { - new Point((int)(_startPosX + _airbusWidth - 25), (int)(_startPosY + 25)), - new Point((int)(_startPosX + _airbusWidth), (int)(_startPosY + 40)), - new Point((int)(_startPosX + _airbusWidth - 25), (int)(_startPosY + 55)), - new Point((int)(_startPosX + _airbusWidth - 25), (int)(_startPosY + 15)), + new Point((int)(_startPosX + _airplaneWidth - 25), (int)(_startPosY + 25)), + new Point((int)(_startPosX + _airplaneWidth), (int)(_startPosY + 40)), + new Point((int)(_startPosX + _airplaneWidth - 25), (int)(_startPosY + 55)), + new Point((int)(_startPosX + _airplaneWidth - 25), (int)(_startPosY + 15)), }); - g.FillRectangle(brush, _startPosX, _startPosY + 25, _airbusWidth - 25, _airbusHeight ); + g.FillRectangle(brush, _startPosX, _startPosY + 25, _airplaneWidth - 25, _airplaneHeight); g.DrawPolygon(pen, new[] { new Point((int)(_startPosX), (int)(_startPosY)), @@ -86,32 +86,32 @@ namespace Airbus }); g.DrawEllipse(new(Color.Blue, 2), _startPosX, _startPosY + 15, 25, 5); - g.DrawEllipse(new(Color.Red, 2), _startPosX + _airbusWidth - 40, _startPosY + 30, 20, 20); - g.DrawEllipse(new(Color.Red, 2), _startPosX + _airbusWidth - 65, _startPosY + 30, 20, 20); - g.DrawEllipse(new(Color.Red, 2), _startPosX + _airbusWidth - 90, _startPosY + 30, 20, 20); + g.DrawEllipse(new(Color.Red, 2), _startPosX + _airplaneWidth - 40, _startPosY + 30, 20, 20); + g.DrawEllipse(new(Color.Red, 2), _startPosX + _airplaneWidth - 65, _startPosY + 30, 20, 20); + g.DrawEllipse(new(Color.Red, 2), _startPosX + _airplaneWidth - 90, _startPosY + 30, 20, 20); - g.DrawEllipse(new(Color.Black, 2), _startPosX + _airbusWidth - 30, _startPosY + _airbusHeight + 25, 4, 4); - g.DrawEllipse(new(Color.Black, 2), _startPosX + _airbusWidth - 35, _startPosY + _airbusHeight + 25, 4, 4); - g.DrawEllipse(new(Color.Black, 2), _startPosX , _startPosY + _airbusHeight + 25, 4, 4); + g.DrawEllipse(new(Color.Black, 2), _startPosX + _airplaneWidth - 30, _startPosY + _airplaneHeight + 25, 4, 4); + g.DrawEllipse(new(Color.Black, 2), _startPosX + _airplaneWidth - 35, _startPosY + _airplaneHeight + 25, 4, 4); + g.DrawEllipse(new(Color.Black, 2), _startPosX , _startPosY + _airplaneHeight + 25, 4, 4); } public void ChangeBorders(int width, int height) { _pictureWidth = width; _pictureHeight = height; - if (_pictureWidth <= _airbusWidth || _pictureHeight <= _airbusHeight) + if (_pictureWidth <= _airplaneWidth || _pictureHeight <= _airplaneHeight) { _pictureWidth = null; _pictureHeight = null; return; } - if (_startPosX + _airbusWidth > _pictureWidth) + if (_startPosX + _airplaneWidth > _pictureWidth) { - _startPosX = _pictureWidth.Value - _airbusWidth; + _startPosX = _pictureWidth.Value - _airplaneWidth; } - if (_startPosY + _airbusHeight > _pictureHeight) + if (_startPosY + _airplaneHeight > _pictureHeight) { - _startPosY = _pictureHeight.Value - _airbusHeight; + _startPosY = _pictureHeight.Value - _airplaneHeight; } } } diff --git a/Airbus/Airbus/EntityAirbus.cs b/Airbus/Airbus/EntityAirplane.cs similarity index 95% rename from Airbus/Airbus/EntityAirbus.cs rename to Airbus/Airbus/EntityAirplane.cs index 448c9ae..0cfad23 100644 --- a/Airbus/Airbus/EntityAirbus.cs +++ b/Airbus/Airbus/EntityAirplane.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace Airbus { - internal class EntityAirbus + internal class EntityAirplane { public int Speed { get; private set; } //Скорость public float Weight { get; private set; } //Вес diff --git a/Airbus/Airbus/FormAirbus.Designer.cs b/Airbus/Airbus/FormAirplane.Designer.cs similarity index 98% rename from Airbus/Airbus/FormAirbus.Designer.cs rename to Airbus/Airbus/FormAirplane.Designer.cs index d998927..4b6bfa6 100644 --- a/Airbus/Airbus/FormAirbus.Designer.cs +++ b/Airbus/Airbus/FormAirplane.Designer.cs @@ -1,6 +1,6 @@ namespace Airbus { - partial class FormAirbus + partial class FormAirplane { /// /// Required designer variable. @@ -140,7 +140,7 @@ this.buttonDown.UseVisualStyleBackColor = true; this.buttonDown.Click += new System.EventHandler(this.ButtonMove_Click); // - // FormAirbus + // FormAirplane // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; @@ -152,7 +152,7 @@ this.Controls.Add(this.buttonCreate); this.Controls.Add(this.statusStrip1); this.Controls.Add(this.pictureBox); - this.Name = "FormAirbus"; + this.Name = "FormAirplane"; this.Text = "Airbus"; this.statusStrip1.ResumeLayout(false); this.statusStrip1.PerformLayout(); diff --git a/Airbus/Airbus/FormAirbus.cs b/Airbus/Airbus/FormAirplane.cs similarity index 57% rename from Airbus/Airbus/FormAirbus.cs rename to Airbus/Airbus/FormAirplane.cs index 1d17750..26ef0e1 100644 --- a/Airbus/Airbus/FormAirbus.cs +++ b/Airbus/Airbus/FormAirplane.cs @@ -11,11 +11,11 @@ using System.Windows.Forms; namespace Airbus { - public partial class FormAirbus : Form + public partial class FormAirplane : Form { - private DrawningAirbus airbus; + private DrawningAirplane airplane; - public FormAirbus() + public FormAirplane() { InitializeComponent(); } @@ -24,19 +24,19 @@ namespace Airbus { Bitmap bmp = new(pictureBox.Width, pictureBox.Height); Graphics g = Graphics.FromImage(bmp); - airbus.DrawTransport(g); + airplane.DrawTransport(g); pictureBox.Image = bmp; } private void buttonCreate_Click(object sender, EventArgs e) { Random random = new Random(); - airbus = new DrawningAirbus(); - airbus.Init(random.Next(100, 300), random.Next(1000, 3000), Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256))); - airbus.SetPosition(random.Next(10, 100), random.Next(10, 100), pictureBox.Width, pictureBox.Height); - toolStripStatusLabelSpeed.Text = $"Скорость: {airbus.airbus?.Speed}"; - toolStripStatusLabelWight.Text = $"Вес: {airbus.airbus?.Weight}"; - toolStripStatusLabelColor.Text = $" : {airbus.airbus?.BodyColor}"; + airplane = new DrawningAirplane(); + airplane.Init(random.Next(100, 300), random.Next(1000, 3000), Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256))); + airplane.SetPosition(random.Next(10, 100), random.Next(10, 100), pictureBox.Width, pictureBox.Height); + toolStripStatusLabelSpeed.Text = $"Скорость: {airplane.airplane?.Speed}"; + toolStripStatusLabelWight.Text = $"Вес: {airplane.airplane?.Weight}"; + toolStripStatusLabelColor.Text = $" : {airplane.airplane?.BodyColor}"; Draw(); } @@ -47,16 +47,16 @@ namespace Airbus { case "buttonLeft": Console.WriteLine(""); - airbus?.MoveTransport(Direction.Left); + airplane?.MoveTransport(Direction.Left); break; case "buttonUp": - airbus?.MoveTransport(Direction.Up); + airplane?.MoveTransport(Direction.Up); break; case "buttonRight": - airbus?.MoveTransport(Direction.Right); + airplane?.MoveTransport(Direction.Right); break; case "buttonDown": - airbus?.MoveTransport(Direction.Down); + airplane?.MoveTransport(Direction.Down); break; } Draw(); @@ -64,7 +64,7 @@ namespace Airbus private void PictureBox_Resize(object sender, EventArgs e) { - airbus?.ChangeBorders(pictureBox.Width, pictureBox.Height); + airplane?.ChangeBorders(pictureBox.Width, pictureBox.Height); Draw(); } } diff --git a/Airbus/Airbus/FormAirbus.resx b/Airbus/Airbus/FormAirplane.resx similarity index 100% rename from Airbus/Airbus/FormAirbus.resx rename to Airbus/Airbus/FormAirplane.resx diff --git a/Airbus/Airbus/Program.cs b/Airbus/Airbus/Program.cs index 5486d2d..d0fc544 100644 --- a/Airbus/Airbus/Program.cs +++ b/Airbus/Airbus/Program.cs @@ -11,7 +11,7 @@ namespace Airbus // To customize application configuration such as set high DPI settings or default font, // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); - Application.Run(new FormAirbus()); + Application.Run(new FormAirplane()); } } } \ No newline at end of file