Фикс Лабораторная №1
This commit is contained in:
parent
fcbb37a221
commit
dcb0b44290
@ -32,12 +32,12 @@ public class DrawingSeaplane
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ширина прорисовки автомобиля
|
/// Ширина прорисовки автомобиля
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly int _drawningSeaplaneWidth = 110;
|
private readonly int _drawningSeaplaneWidth = 155;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Высота прорисовки автомобиля
|
/// Высота прорисовки автомобиля
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly int _drawningSeaplaneHeight = 60;
|
private readonly int _drawningSeaplaneHeight = 70;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Инициализация свойств
|
/// Инициализация свойств
|
||||||
@ -46,12 +46,12 @@ public class DrawingSeaplane
|
|||||||
/// <param name="weight">Вес</param>
|
/// <param name="weight">Вес</param>
|
||||||
/// <param name="bodyColor">Основной цвет</param>
|
/// <param name="bodyColor">Основной цвет</param>
|
||||||
/// <param name="additionalColor">Дополнительный цвет</param>
|
/// <param name="additionalColor">Дополнительный цвет</param>
|
||||||
/// <param name="wingsOpened">Признак cворачивания крыла(0 - свернуто, 1 - развернуто)</param>
|
/// <param name="landingGear">Тип "шасси" (0 - поплавки, 1 - лодочный тип)</param>
|
||||||
/// <param name="screwEngine">Признак типа двигателя (1 - винтовой, 0 - реативный)</param>
|
/// <param name="radar">Признак наличия радара </param>
|
||||||
public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool wingsOpened, bool screwEngine)
|
public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool landingGear, bool radar)
|
||||||
{
|
{
|
||||||
EntitySeaplane = new EntitySeaplane();
|
EntitySeaplane = new EntitySeaplane();
|
||||||
EntitySeaplane.Init(speed, weight, bodyColor, additionalColor, wingsOpened, screwEngine);
|
EntitySeaplane.Init(speed, weight, bodyColor, additionalColor, landingGear, radar);
|
||||||
_pictureWidth = null;
|
_pictureWidth = null;
|
||||||
_pictureHeight = null;
|
_pictureHeight = null;
|
||||||
_startPosX = null;
|
_startPosX = null;
|
||||||
@ -139,7 +139,7 @@ public class DrawingSeaplane
|
|||||||
// вправо
|
// вправо
|
||||||
case DirectionType.Right:
|
case DirectionType.Right:
|
||||||
|
|
||||||
if (_startPosX + (int)EntitySeaplane.Step < _pictureWidth - 110)
|
if (_startPosX + (int)EntitySeaplane.Step < _pictureWidth - _drawningSeaplaneWidth)
|
||||||
{
|
{
|
||||||
_startPosX += (int)EntitySeaplane.Step;
|
_startPosX += (int)EntitySeaplane.Step;
|
||||||
}
|
}
|
||||||
@ -147,7 +147,7 @@ public class DrawingSeaplane
|
|||||||
//вниз
|
//вниз
|
||||||
case DirectionType.Down:
|
case DirectionType.Down:
|
||||||
|
|
||||||
if (_startPosY + (int)EntitySeaplane.Step < _pictureHeight - 60)
|
if (_startPosY + (int)EntitySeaplane.Step < _pictureHeight - _drawningSeaplaneHeight)
|
||||||
{
|
{
|
||||||
_startPosY += (int)EntitySeaplane.Step;
|
_startPosY += (int)EntitySeaplane.Step;
|
||||||
}
|
}
|
||||||
@ -169,51 +169,135 @@ public class DrawingSeaplane
|
|||||||
}
|
}
|
||||||
|
|
||||||
Pen pen = new(Color.Black);
|
Pen pen = new(Color.Black);
|
||||||
|
Pen penKraya = new(Color.Black, 2);
|
||||||
Brush additionalBrush = new SolidBrush(EntitySeaplane.AdditionalColor);
|
Brush additionalBrush = new SolidBrush(EntitySeaplane.AdditionalColor);
|
||||||
|
|
||||||
|
|
||||||
|
//Начинаем рисовать
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Полигон для хвоста
|
||||||
|
Point point1 = new Point(_startPosX.Value, _startPosY.Value);
|
||||||
|
Point point2 = new Point(_startPosX.Value + 35, _startPosY.Value + 35);
|
||||||
|
Point point3 = new Point(_startPosX.Value, _startPosY.Value+35);
|
||||||
|
Point point4 = new Point(_startPosX.Value, _startPosY.Value);
|
||||||
|
Point[] Hvost =
|
||||||
|
{
|
||||||
|
point1, point2 , point3 , point4
|
||||||
|
};
|
||||||
|
Point point5 = new Point(_startPosX.Value + 50, _startPosY.Value + 22);
|
||||||
|
Point point6 = new Point(_startPosX.Value + 45, _startPosY.Value + 30);
|
||||||
|
Point point7 = new Point(_startPosX.Value + 55, _startPosY.Value + 30);
|
||||||
|
Point point8 = new Point(_startPosX.Value + 50, _startPosY.Value + 22);
|
||||||
|
Point[] Radar =
|
||||||
|
{
|
||||||
|
point5, point6 , point7 , point8
|
||||||
|
};
|
||||||
|
|
||||||
|
//Кисти для основного цвета и дополнительного
|
||||||
|
Brush brBody = new SolidBrush(EntitySeaplane.BodyColor);
|
||||||
|
Brush brAdditional = new SolidBrush(EntitySeaplane.AdditionalColor);
|
||||||
|
Brush brWhity = new SolidBrush(Color.GhostWhite);
|
||||||
|
//Хвост
|
||||||
|
g.FillPolygon(brBody, Hvost);
|
||||||
|
//Тело
|
||||||
|
|
||||||
|
|
||||||
|
g.FillRectangle(brBody, _startPosX.Value + 30, _startPosY.Value + 30, 85, 25);
|
||||||
|
|
||||||
|
|
||||||
|
g.FillEllipse(brBody, _startPosX.Value + 45, _startPosY.Value + 30, 110, 24);
|
||||||
|
|
||||||
|
|
||||||
|
g.FillEllipse(brBody, _startPosX.Value - 5, _startPosY.Value + 30, 100, 24);
|
||||||
|
g.DrawEllipse(penKraya, _startPosX.Value, _startPosY.Value + 27, 17, 6);
|
||||||
|
g.FillEllipse(brAdditional, _startPosX.Value, _startPosY.Value + 27, 17, 6);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Крыло
|
||||||
|
g.FillEllipse(brAdditional, _startPosX.Value + 45, _startPosY.Value + 43, 50, 7);
|
||||||
|
|
||||||
|
//Иллюминаторы
|
||||||
|
|
||||||
|
for (int i = 0; i < 80; i += 10)
|
||||||
|
{
|
||||||
|
|
||||||
|
g.FillEllipse(brWhity, _startPosX.Value + 30 + i, _startPosY.Value + 34, 6, 6);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Поплавки
|
||||||
|
|
||||||
|
if (EntitySeaplane.LandingGear)
|
||||||
|
{
|
||||||
|
g.FillEllipse(brAdditional, _startPosX.Value + 60, _startPosY.Value + 50, 20, 7);
|
||||||
|
g.DrawLine(penKraya, _startPosX.Value + 70, _startPosY.Value + 48, _startPosX.Value + 70, _startPosY.Value + 52);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g.FillEllipse(brAdditional, _startPosX.Value + 60, _startPosY.Value + 60, 70, 10);
|
||||||
|
g.FillEllipse(brAdditional, _startPosX.Value + 10, _startPosY.Value + 60, 20, 10);
|
||||||
|
g.DrawLine(penKraya, _startPosX.Value + 20, _startPosY.Value + 53, _startPosX.Value + 20, _startPosY.Value + 63);
|
||||||
|
g.DrawLine(penKraya, _startPosX.Value + 110, _startPosY.Value + 53, _startPosX.Value + 90, _startPosY.Value + 63);
|
||||||
|
g.DrawLine(penKraya, _startPosX.Value + 70, _startPosY.Value + 53, _startPosX.Value + 90, _startPosY.Value + 63);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (EntitySeaplane.Radar)
|
||||||
|
{
|
||||||
|
g.FillEllipse(brAdditional, _startPosX.Value + 30, _startPosY.Value + 12, 40, 15);
|
||||||
|
g.FillPolygon(brAdditional, Radar);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
}
|
||||||
|
//Пилоты
|
||||||
|
g.FillEllipse(brWhity, _startPosX.Value + 115, _startPosY.Value + 34, 20, 8);
|
||||||
|
|
||||||
//границы автомобиля
|
//границы автомобиля
|
||||||
g.DrawEllipse(pen, _startPosX.Value + 10, _startPosY.Value + 5, 20, 20);
|
//g.DrawEllipse(pen, _startPosX.Value + 10, _startPosY.Value + 5, 20, 20);
|
||||||
g.DrawEllipse(pen, _startPosX.Value + 10, _startPosY.Value + 35, 20, 20);
|
//g.DrawEllipse(pen, _startPosX.Value + 10, _startPosY.Value + 35, 20, 20);
|
||||||
g.DrawEllipse(pen, _startPosX.Value + 80, _startPosY.Value + 5, 20, 20);
|
//g.DrawEllipse(pen, _startPosX.Value + 80, _startPosY.Value + 5, 20, 20);
|
||||||
g.DrawEllipse(pen, _startPosX.Value + 80, _startPosY.Value + 35, 20, 20);
|
//g.DrawEllipse(pen, _startPosX.Value + 80, _startPosY.Value + 35, 20, 20);
|
||||||
g.DrawRectangle(pen, _startPosX.Value + 9, _startPosY.Value + 15, 10, 30);
|
//g.DrawRectangle(pen, _startPosX.Value + 9, _startPosY.Value + 15, 10, 30);
|
||||||
g.DrawRectangle(pen, _startPosX.Value + 90, _startPosY.Value + 15, 10, 30);
|
//g.DrawRectangle(pen, _startPosX.Value + 90, _startPosY.Value + 15, 10, 30);
|
||||||
g.DrawRectangle(pen, _startPosX.Value + 20, _startPosY.Value + 4, 70, 52);
|
//g.DrawRectangle(pen, _startPosX.Value + 20, _startPosY.Value + 4, 70, 52);
|
||||||
|
|
||||||
//задние фары
|
////задние фары
|
||||||
Brush brRed = new SolidBrush(Color.Red);
|
//Brush brRed = new SolidBrush(Color.Red);
|
||||||
g.FillEllipse(brRed, _startPosX.Value + 10, _startPosY.Value + 5, 20, 20);
|
//g.FillEllipse(brRed, _startPosX.Value + 10, _startPosY.Value + 5, 20, 20);
|
||||||
g.FillEllipse(brRed, _startPosX.Value + 10, _startPosY.Value + 35, 20, 20);
|
//g.FillEllipse(brRed, _startPosX.Value + 10, _startPosY.Value + 35, 20, 20);
|
||||||
|
|
||||||
//передние фары
|
////передние фары
|
||||||
Brush brYellow = new SolidBrush(Color.Yellow);
|
//Brush brYellow = new SolidBrush(Color.Yellow);
|
||||||
g.FillEllipse(brYellow, _startPosX.Value + 80, _startPosY.Value + 5, 20, 20);
|
//g.FillEllipse(brYellow, _startPosX.Value + 80, _startPosY.Value + 5, 20, 20);
|
||||||
g.FillEllipse(brYellow, _startPosX.Value + 80, _startPosY.Value + 35, 20, 20);
|
//g.FillEllipse(brYellow, _startPosX.Value + 80, _startPosY.Value + 35, 20, 20);
|
||||||
|
|
||||||
|
////кузов
|
||||||
|
//Brush br = new SolidBrush(EntitySeaplane.BodyColor);
|
||||||
|
//g.FillRectangle(br, _startPosX.Value + 10, _startPosY.Value + 15, 10, 30);
|
||||||
|
//g.FillRectangle(br, _startPosX.Value + 90, _startPosY.Value + 15, 10, 30);
|
||||||
|
//g.FillRectangle(br, _startPosX.Value + 20, _startPosY.Value + 5, 70, 50);
|
||||||
|
|
||||||
|
////стекла
|
||||||
|
//Brush brBlue = new SolidBrush(Color.LightBlue);
|
||||||
|
//g.FillRectangle(brBlue, _startPosX.Value + 70, _startPosY.Value + 10, 5, 40);
|
||||||
|
//g.FillRectangle(brBlue, _startPosX.Value + 30, _startPosY.Value + 10, 5, 40);
|
||||||
|
//g.FillRectangle(brBlue, _startPosX.Value + 35, _startPosY.Value + 8, 35, 2);
|
||||||
|
//g.FillRectangle(brBlue, _startPosX.Value + 35, _startPosY.Value + 51, 35, 2);
|
||||||
|
|
||||||
|
////выделяем рамкой крышу
|
||||||
|
//g.DrawRectangle(pen, _startPosX.Value + 35, _startPosY.Value + 10, 35, 40);
|
||||||
|
//g.DrawRectangle(pen, _startPosX.Value + 75, _startPosY.Value + 15, 25, 30);
|
||||||
|
//g.DrawRectangle(pen, _startPosX.Value + 10, _startPosY.Value + 15, 15, 30);
|
||||||
|
|
||||||
//кузов
|
|
||||||
Brush br = new SolidBrush(EntitySeaplane.BodyColor);
|
|
||||||
g.FillRectangle(br, _startPosX.Value + 10, _startPosY.Value + 15, 10, 30);
|
|
||||||
g.FillRectangle(br, _startPosX.Value + 90, _startPosY.Value + 15, 10, 30);
|
|
||||||
g.FillRectangle(br, _startPosX.Value + 20, _startPosY.Value + 5, 70, 50);
|
|
||||||
|
|
||||||
//стекла
|
|
||||||
Brush brBlue = new SolidBrush(Color.LightBlue);
|
|
||||||
g.FillRectangle(brBlue, _startPosX.Value + 70, _startPosY.Value + 10, 5, 40);
|
|
||||||
g.FillRectangle(brBlue, _startPosX.Value + 30, _startPosY.Value + 10, 5, 40);
|
|
||||||
g.FillRectangle(brBlue, _startPosX.Value + 35, _startPosY.Value + 8, 35, 2);
|
|
||||||
g.FillRectangle(brBlue, _startPosX.Value + 35, _startPosY.Value + 51, 35, 2);
|
|
||||||
|
|
||||||
//выделяем рамкой крышу
|
|
||||||
g.DrawRectangle(pen, _startPosX.Value + 35, _startPosY.Value + 10, 35, 40);
|
|
||||||
g.DrawRectangle(pen, _startPosX.Value + 75, _startPosY.Value + 15, 25, 30);
|
|
||||||
g.DrawRectangle(pen, _startPosX.Value + 10, _startPosY.Value + 15, 15, 30);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,13 +21,13 @@ public class EntitySeaplane
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Color AdditionalColor { get; private set; }
|
public Color AdditionalColor { get; private set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Cложенно ли крыло (0 - нет, 1 - да)
|
/// Тип "шасси" (0 - лодочный, 1 - поплавковый)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool WingsOpened { get; private set; }
|
public bool LandingGear { get; private set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Тип двигателя, где 1 - винтовой и 0 - реактивный
|
/// Признак наличия радара
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool ScrewEngine { get; private set; }
|
public bool Radar { get; private set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Расстояние шага передвижения
|
/// Расстояние шага передвижения
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -39,16 +39,16 @@ public class EntitySeaplane
|
|||||||
/// <param name="weight">Вес</param>
|
/// <param name="weight">Вес</param>
|
||||||
/// <param name="bodyColor">Основной цвет</param>
|
/// <param name="bodyColor">Основной цвет</param>
|
||||||
/// <param name="additionalColor">Дополнительный цвет</param>
|
/// <param name="additionalColor">Дополнительный цвет</param>
|
||||||
/// <param name="wingsOpened">Сложенно ли крыло</param>
|
/// <param name="landingGear">Тип "шасси"</param>
|
||||||
/// <param name="screwEngine">Тип двигателя</param>
|
/// <param name="radar">Тип двигателя</param>
|
||||||
public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool wingsOpened, bool screwEngine)
|
public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool landingGear, bool radar)
|
||||||
{
|
{
|
||||||
Speed = speed;
|
Speed = speed;
|
||||||
Weight = weight;
|
Weight = weight;
|
||||||
BodyColor = bodyColor;
|
BodyColor = bodyColor;
|
||||||
AdditionalColor = additionalColor;
|
AdditionalColor = additionalColor;
|
||||||
WingsOpened = wingsOpened;
|
LandingGear = landingGear;
|
||||||
ScrewEngine = screwEngine;
|
Radar = radar;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user