revert 1f0eb7baa586ccdedefee88752ed11f6f596b53b
revert Лабораторная работа №1 (усложнённая)
This commit is contained in:
parent
1f0eb7baa5
commit
eb527d5c10
@ -13,11 +13,6 @@ public class DrawingMotorBoat
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public EntityMotorBoat? EntityMotorBoat { get; private set; }
|
public EntityMotorBoat? EntityMotorBoat { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Класс-сущность
|
|
||||||
/// </summary>
|
|
||||||
public EntityPaddle? EntityPaddle { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ширина окна
|
/// Ширина окна
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -59,12 +54,10 @@ public class DrawingMotorBoat
|
|||||||
/// <param name="inboardEngine"></param>
|
/// <param name="inboardEngine"></param>
|
||||||
/// <param name="paddle"></param>
|
/// <param name="paddle"></param>
|
||||||
/// <param name="protectiveGlass"></param>
|
/// <param name="protectiveGlass"></param>
|
||||||
public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool inboardEngine, bool protectiveGlass, int paddle)
|
public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool inboardEngine, bool paddle, bool protectiveGlass)
|
||||||
{
|
{
|
||||||
EntityMotorBoat = new EntityMotorBoat();
|
EntityMotorBoat = new EntityMotorBoat();
|
||||||
EntityMotorBoat.Init(speed, weight, bodyColor, additionalColor, inboardEngine, protectiveGlass);
|
EntityMotorBoat.Init(speed, weight, bodyColor, additionalColor, inboardEngine, paddle, protectiveGlass);
|
||||||
EntityPaddle = new EntityPaddle();
|
|
||||||
EntityPaddle.Init(paddle);
|
|
||||||
_pictureWidth = null;
|
_pictureWidth = null;
|
||||||
_pictureHeight = null;
|
_pictureHeight = null;
|
||||||
_startPosX = null;
|
_startPosX = null;
|
||||||
@ -252,32 +245,17 @@ public class DrawingMotorBoat
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Вёсла
|
// Вёсла
|
||||||
if (EntityPaddle.Paddle != 0)
|
if (EntityMotorBoat.Paddle)
|
||||||
{
|
{
|
||||||
if (EntityPaddle.Paddle >= 1)
|
g.DrawRectangle(pen, _startPosX.Value + 32, _startPosY.Value + 3, 2, 17);
|
||||||
{
|
g.DrawRectangle(pen, _startPosX.Value + 32, _startPosY.Value + 30, 2, 17);
|
||||||
g.DrawRectangle(pen, _startPosX.Value + 32, _startPosY.Value + 3, 2, 17);
|
g.FillRectangle(additionalBrush, _startPosX.Value + 33, _startPosY.Value + 3, 1, 17);
|
||||||
g.FillRectangle(additionalBrush, _startPosX.Value + 33, _startPosY.Value + 3, 1, 17);
|
g.FillRectangle(additionalBrush, _startPosX.Value + 33, _startPosY.Value + 31, 1, 16);
|
||||||
|
|
||||||
g.DrawEllipse(pen, _startPosX.Value + 30, _startPosY.Value, 6, 8);
|
g.DrawEllipse(pen, _startPosX.Value + 30, _startPosY.Value, 6, 8);
|
||||||
g.FillEllipse(additionalBrush, _startPosX.Value + 30, _startPosY.Value, 6, 8);
|
g.DrawEllipse(pen, _startPosX.Value + 30, _startPosY.Value + 42, 6, 8);
|
||||||
}
|
g.FillEllipse(additionalBrush, _startPosX.Value + 30, _startPosY.Value, 6, 8);
|
||||||
if (EntityPaddle.Paddle >= 2)
|
g.FillEllipse(additionalBrush, _startPosX.Value + 30, _startPosY.Value + 42, 6, 8);
|
||||||
{
|
|
||||||
g.DrawRectangle(pen, _startPosX.Value + 27, _startPosY.Value + 30, 2, 17);
|
|
||||||
g.FillRectangle(additionalBrush, _startPosX.Value + 28, _startPosY.Value + 31, 1, 16);
|
|
||||||
|
|
||||||
g.DrawEllipse(pen, _startPosX.Value + 25, _startPosY.Value + 42, 6, 8);
|
|
||||||
g.FillEllipse(additionalBrush, _startPosX.Value + 25, _startPosY.Value + 42, 6, 8);
|
|
||||||
}
|
|
||||||
if (EntityPaddle.Paddle == 3)
|
|
||||||
{
|
|
||||||
g.DrawRectangle(pen, _startPosX.Value + 36, _startPosY.Value + 30, 2, 17);
|
|
||||||
g.FillRectangle(additionalBrush, _startPosX.Value + 37, _startPosY.Value + 31, 1, 16);
|
|
||||||
|
|
||||||
g.DrawEllipse(pen, _startPosX.Value + 34, _startPosY.Value + 42, 6, 8);
|
|
||||||
g.FillEllipse(additionalBrush, _startPosX.Value + 34, _startPosY.Value + 42, 6, 8);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Защитное стекло
|
// Защитное стекло
|
||||||
|
@ -30,10 +30,10 @@ public class EntityMotorBoat
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool InboardEngine { get; private set; }
|
public bool InboardEngine { get; private set; }
|
||||||
|
|
||||||
///// <summary>
|
/// <summary>
|
||||||
///// Признак (опция) наличия вёсел
|
/// Признак (опция) наличия вёсел
|
||||||
///// </summary>
|
/// </summary>
|
||||||
//public int Paddle { get; private set; }
|
public bool Paddle { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Возможность глиссирования
|
/// Возможность глиссирования
|
||||||
@ -55,30 +55,14 @@ public class EntityMotorBoat
|
|||||||
/// <param name="inboardEngine"></param>
|
/// <param name="inboardEngine"></param>
|
||||||
/// <param name="inflatable"></param>
|
/// <param name="inflatable"></param>
|
||||||
/// <param name="planing"></param>
|
/// <param name="planing"></param>
|
||||||
public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool inboardEngine, bool protectiveGlass)
|
public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool inboardEngine, bool paddle, bool protectiveGlass)
|
||||||
{
|
{
|
||||||
Speed = speed;
|
Speed = speed;
|
||||||
Weight = weight;
|
Weight = weight;
|
||||||
BodyColor = bodyColor;
|
BodyColor = bodyColor;
|
||||||
AdditionalColor = additionalColor;
|
AdditionalColor = additionalColor;
|
||||||
InboardEngine = inboardEngine;
|
InboardEngine = inboardEngine;
|
||||||
|
Paddle = paddle;
|
||||||
ProtectiveGlass = protectiveGlass;
|
ProtectiveGlass = protectiveGlass;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EntityPaddle
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Признак (опция) наличия вёсел
|
|
||||||
/// </summary>
|
|
||||||
public int Paddle { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Инициализация полей объекта-класса вёсел
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="paddle"></param>
|
|
||||||
public void Init(int paddle)
|
|
||||||
{
|
|
||||||
Paddle = paddle;
|
|
||||||
}
|
|
||||||
}
|
|
@ -47,7 +47,7 @@ public partial class FormMotorBoat : Form
|
|||||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
||||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
||||||
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)),
|
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)),
|
||||||
random.Next(0, 4));
|
Convert.ToBoolean(random.Next(0, 2)));
|
||||||
_drawingMotorBoat.SetPictureSize(pictureBoxMotorBoat.Width, pictureBoxMotorBoat.Height);
|
_drawingMotorBoat.SetPictureSize(pictureBoxMotorBoat.Width, pictureBoxMotorBoat.Height);
|
||||||
_drawingMotorBoat.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
_drawingMotorBoat.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user