Фиксация
This commit is contained in:
parent
48a9ca1a44
commit
fe5fe24f5a
@ -6,20 +6,29 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace WarmlyShip
|
||||
{
|
||||
internal class DrawningMotorShip : DrawingWarmlyShip
|
||||
internal class DrawningMotorShip : DrawningWarmlyShip
|
||||
{
|
||||
public DrawningMotorShip(int speed, float weight, Color bodyColor, Color dopColor, bool bodyKit, bool wing, bool sportLine) : base(speed, weight, bodyColor, 110, 60)
|
||||
public DrawningMotorShip(int speed, float weight, Color bodyColor, Color dopColor, bool tubes, bool cistern) : base(speed, weight, bodyColor, 110, 60)
|
||||
{
|
||||
warmlyShip = new EntityMotorShip(speed, weight, bodyColor, dopColor, bodyKit, wing, sportLine);
|
||||
warmlyShip = new EntityMotorShip(speed, weight, bodyColor, dopColor, tubes , cistern);
|
||||
}
|
||||
|
||||
public override void DrawTransport(Graphics g)
|
||||
{
|
||||
if (warmlyShip is not EntityMotorShip sportCar)
|
||||
if (warmlyShip is not EntityMotorShip motorShip)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (motorShip.Tubes)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if (motorShip.Cistern)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace WarmlyShip
|
||||
{
|
||||
internal class DrawingWarmlyShip
|
||||
internal class DrawningWarmlyShip
|
||||
{
|
||||
public EntityWarmlyShip warmlyShip { protected set; get; } //Класс-сущность
|
||||
protected float _startPosX; //Координаты отрисовки по оси x
|
||||
@ -17,12 +17,12 @@ namespace WarmlyShip
|
||||
private readonly int _warmlyShipHeight = 50; //Высота отрисовки корабля
|
||||
|
||||
//Конструктор класса
|
||||
public DrawingWarmlyShip(int speed, float weight, Color bodyColor)
|
||||
public DrawningWarmlyShip(int speed, float weight, Color bodyColor)
|
||||
{
|
||||
warmlyShip = new EntityWarmlyShip(speed, weight, bodyColor);
|
||||
}
|
||||
|
||||
protected DrawingWarmlyShip(int speed, float weight, Color bodyColor, int warmlyWidth, int warmlyHeight) : this(speed, weight, bodyColor)
|
||||
protected DrawningWarmlyShip(int speed, float weight, Color bodyColor, int warmlyWidth, int warmlyHeight) : this(speed, weight, bodyColor)
|
||||
{
|
||||
_warmlyShipWidth = warmlyWidth;
|
||||
_warmlyShipHeight = warmlyHeight;
|
@ -9,16 +9,14 @@ namespace WarmlyShip
|
||||
internal class EntityMotorShip : EntityWarmlyShip
|
||||
{
|
||||
public Color DopColor { get; private set; }
|
||||
public bool BodyKit { get; private set; }
|
||||
public bool Wing { get; private set; }
|
||||
public bool SportLine { get; private set; }
|
||||
public bool Tubes { get; private set; }
|
||||
public bool Cistern { get; private set; }
|
||||
|
||||
public EntityMotorShip(int speed, float weight, Color bodyColor, Color dopColor, bool bodyKit, bool wing, bool sportLine) : base(speed, weight, bodyColor)
|
||||
public EntityMotorShip(int speed, float weight, Color bodyColor, Color dopColor, bool tubes, bool cistern) : base(speed, weight, bodyColor)
|
||||
{
|
||||
DopColor = dopColor;
|
||||
BodyKit = bodyKit;
|
||||
Wing = wing;
|
||||
SportLine = sportLine;
|
||||
Tubes = tubes;
|
||||
Cistern = cistern;
|
||||
}
|
||||
|
||||
}
|
||||
|
14
WarmlyShip/WarmlyShip/FormClass.Designer.cs
generated
14
WarmlyShip/WarmlyShip/FormClass.Designer.cs
generated
@ -38,6 +38,7 @@
|
||||
this.buttonLeft = new System.Windows.Forms.Button();
|
||||
this.buttonDown = new System.Windows.Forms.Button();
|
||||
this.ButtonCreate = new System.Windows.Forms.Button();
|
||||
this.buttonCreateModif = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
|
||||
this.statusStrip.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
@ -142,11 +143,23 @@
|
||||
this.ButtonCreate.UseVisualStyleBackColor = true;
|
||||
this.ButtonCreate.Click += new System.EventHandler(this.ButtonCreate_Click);
|
||||
//
|
||||
// buttonCreateModif
|
||||
//
|
||||
this.buttonCreateModif.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.buttonCreateModif.Location = new System.Drawing.Point(93, 402);
|
||||
this.buttonCreateModif.Name = "buttonCreateModif";
|
||||
this.buttonCreateModif.Size = new System.Drawing.Size(100, 23);
|
||||
this.buttonCreateModif.TabIndex = 8;
|
||||
this.buttonCreateModif.Text = "Модификация ";
|
||||
this.buttonCreateModif.UseVisualStyleBackColor = true;
|
||||
this.buttonCreateModif.Click += new System.EventHandler(this.ButtonCreateModif_Click);
|
||||
//
|
||||
// FormClass
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.buttonCreateModif);
|
||||
this.Controls.Add(this.ButtonCreate);
|
||||
this.Controls.Add(this.buttonDown);
|
||||
this.Controls.Add(this.buttonLeft);
|
||||
@ -176,5 +189,6 @@
|
||||
private Button buttonLeft;
|
||||
private Button buttonDown;
|
||||
private Button ButtonCreate;
|
||||
private Button buttonCreateModif;
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@ namespace WarmlyShip
|
||||
{
|
||||
public partial class FormClass : Form
|
||||
{
|
||||
private DrawingWarmlyShip _warmlyShip;
|
||||
private DrawningWarmlyShip _warmlyShip;
|
||||
|
||||
public FormClass()
|
||||
{
|
||||
@ -17,14 +17,20 @@ namespace WarmlyShip
|
||||
pictureBox.Image = bmp;
|
||||
}
|
||||
|
||||
private void ButtonCreate_Click(object sender, EventArgs e)
|
||||
private void SetData()
|
||||
{
|
||||
Random random = new Random();
|
||||
_warmlyShip = new DrawingWarmlyShip(random.Next(100, 300), random.Next(1000, 3000), Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)));
|
||||
_warmlyShip.SetPosition(random.Next(pictureBox.Width - 150, pictureBox.Width - 125), random.Next(pictureBox.Height - 150, pictureBox.Height - 50), pictureBox.Width, pictureBox.Height);
|
||||
toolStripStatusSpeed.Text = $"Ñêîðîñòü: {_warmlyShip.warmlyShip?.Speed}";
|
||||
toolStripStatusWeight.Text = $"Âåñ: {_warmlyShip.warmlyShip?.Weight}";
|
||||
toolStripStatusLabelBodyColor.Text = $"Öâåò: {_warmlyShip.warmlyShip?.BodyColor}";
|
||||
}
|
||||
|
||||
private void ButtonCreate_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new Random();
|
||||
_warmlyShip = new DrawningWarmlyShip(random.Next(100, 300), random.Next(1000, 3000), Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)));
|
||||
SetData();
|
||||
Draw();
|
||||
}
|
||||
|
||||
@ -54,5 +60,16 @@ namespace WarmlyShip
|
||||
_warmlyShip?.ChangeBorders(pictureBox.Width, pictureBox.Height);
|
||||
Draw();
|
||||
}
|
||||
|
||||
private void ButtonCreateModif_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new Random();
|
||||
_warmlyShip = new DrawningMotorShip(random.Next(100, 300), random.Next(1000, 3000),
|
||||
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, 1)), Convert.ToBoolean(random.Next(0, 1)));
|
||||
SetData();
|
||||
Draw();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user