diff --git a/MotorBoat/MotorBoat/Direction.cs b/MotorBoat/MotorBoat/Direction.cs new file mode 100644 index 0000000..b843d16 --- /dev/null +++ b/MotorBoat/MotorBoat/Direction.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MotorBoat +{ + /// + /// Направление перемещения + /// + public enum DirectionType + { + /// + /// Вверх + /// + Up = 1, + + /// + /// Вниз + /// + Down = 2, + + /// + /// Влево + /// + Left = 3, + + /// + /// Вправо + /// + Right = 4 + } +} diff --git a/MotorBoat/MotorBoat/DrawningMotorBoat.cs b/MotorBoat/MotorBoat/DrawningMotorBoat.cs new file mode 100644 index 0000000..1354686 --- /dev/null +++ b/MotorBoat/MotorBoat/DrawningMotorBoat.cs @@ -0,0 +1,82 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MotorBoat +{ + /// . + /// Класс, отвечающий за прорисовку и перемещение объекта-сущности + /// + public class DrawningMotorboat + { + /// + /// Класс-сущность + /// + public EntityMotorBoat? EntityMotorBoat { get; private set; } + + /// + /// Ширина окна + /// + private int _pictureWight; + + /// + /// Высота окна + /// + private int _pictureHeight; + + /// + /// Левая координата прорисовки катера + /// + private int _startPosX; + + /// + /// Правая координата прорисовки катера + /// + private int _startPosY; + + /// + /// Ширина прорисовки автомобиля + /// + private readonly int _boatWight = 110; + + /// + /// Высота прорисовки автомобиля + /// + private readonly int _boatHeight = 60; + + /// + /// Инициализация свойств + /// + /// Скорость + /// Вес + /// Цвет корпуса + /// Дополнительный цвет + /// Ширина картинки + /// Выслота картинки + /// true - объект создан, false - проверка не пройдена, нельзя создать объект в этих размерах + public bool Init(int speed, double weight, Color bodyColor, Color AdditionalColor, + int width, int height) + { + // ПРИДУМАТЬ ПРОВЕРКИ + _pictureWight = width; + _pictureHeight = height; + EntityMotorBoat = new EntityMotorBoat(); + EntityMotorBoat.Init(speed, weight, bodyColor, AdditionalColor); + return true; + } + + /// + /// Установка позиции + /// + /// Координата X + /// Координата Y + public void SetPosition(int x, int y) + { + // ИЗМЕНЕНИЕ X Y + _startPosX = x; + _startPosY = y; + } + } +} diff --git a/MotorBoat/MotorBoat/EntityMotorBoat.cs b/MotorBoat/MotorBoat/EntityMotorBoat.cs new file mode 100644 index 0000000..3687804 --- /dev/null +++ b/MotorBoat/MotorBoat/EntityMotorBoat.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MotorBoat +{ + internal class EntityMotorBoat + { + /// + /// Скорость + /// + public int Speed { get; set; } + + /// + /// Вес + /// + public double Weight { get; set; } + + /// + /// Основной цвет + /// + public Color BodyColor { get; set; } + + /// + /// Дополнительный цвет + /// + public Color AdditionalColor { get; set; } + + /// + /// Шаг перемещения моторной лодки + /// + public double Step => (double)Speed * 100 / Weight; + + /// + /// Инициализация полей объекта-класса моторной лодки + /// + /// Скорость + /// Вес катера + /// Основной цвет + /// Дополнительный цвет + + public void Init(int speed, double weight, Color bodyColor, Color additionalColor) + { + Speed = speed; + Weight = weight; + BodyColor = bodyColor; + AdditionalColor = additionalColor; + } + } +} diff --git a/MotorBoat/MotorBoat/Form1.cs b/MotorBoat/MotorBoat/Form1.cs deleted file mode 100644 index 240dc5e..0000000 --- a/MotorBoat/MotorBoat/Form1.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace MotorBoat -{ - public partial class Form1 : Form - { - public Form1() - { - InitializeComponent(); - } - } -} \ No newline at end of file diff --git a/MotorBoat/MotorBoat/Form1.resx b/MotorBoat/MotorBoat/Form1.resx deleted file mode 100644 index 1af7de1..0000000 --- a/MotorBoat/MotorBoat/Form1.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/MotorBoat/MotorBoat/Form1.Designer.cs b/MotorBoat/MotorBoat/FormMotorBoat.Designer.cs similarity index 70% rename from MotorBoat/MotorBoat/Form1.Designer.cs rename to MotorBoat/MotorBoat/FormMotorBoat.Designer.cs index 4b86bb4..8021dff 100644 --- a/MotorBoat/MotorBoat/Form1.Designer.cs +++ b/MotorBoat/MotorBoat/FormMotorBoat.Designer.cs @@ -1,6 +1,6 @@ namespace MotorBoat { - partial class Form1 + partial class FormMotorBoat { /// /// Required designer variable. @@ -28,10 +28,17 @@ /// 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(); + // + // Form1 + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Name = "Form1"; + Text = "FormMotorBoat"; + Load += Form1_Load; + ResumeLayout(false); } #endregion diff --git a/MotorBoat/MotorBoat/FormMotorBoat.cs b/MotorBoat/MotorBoat/FormMotorBoat.cs new file mode 100644 index 0000000..04b1b7b --- /dev/null +++ b/MotorBoat/MotorBoat/FormMotorBoat.cs @@ -0,0 +1,15 @@ +namespace MotorBoat +{ + public partial class FormMotorBoat : Form + { + public FormMotorBoat() + { + InitializeComponent(); + } + + private void Form1_Load(object sender, EventArgs e) + { + + } + } +} \ No newline at end of file diff --git a/MotorBoat/MotorBoat/FormMotorBoat.resx b/MotorBoat/MotorBoat/FormMotorBoat.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/MotorBoat/MotorBoat/FormMotorBoat.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/MotorBoat/MotorBoat/Program.cs b/MotorBoat/MotorBoat/Program.cs index 974f0ab..83aea91 100644 --- a/MotorBoat/MotorBoat/Program.cs +++ b/MotorBoat/MotorBoat/Program.cs @@ -11,7 +11,7 @@ namespace MotorBoat // 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 FormMotorBoat()); } } } \ No newline at end of file