This commit is contained in:
Robert 2023-12-15 14:10:17 +04:00
parent 729ce56642
commit 76412b309a
4 changed files with 11 additions and 12 deletions

View File

@ -40,7 +40,7 @@ namespace DumpTruck.DrawningObjects
if (dumpTruck.Trailer) if (dumpTruck.Trailer)
{ {
//прицеп //прицеп
Brush trailer = new SolidBrush(Color.Black); Brush trailer = new SolidBrush(EntityTruck.AdditionalColor);
g.FillRectangle(trailer, _startPosX, _startPosY, 5, 38); g.FillRectangle(trailer, _startPosX, _startPosY, 5, 38);
g.FillRectangle(trailer, _startPosX + 5, _startPosY + 33, 70, 5); g.FillRectangle(trailer, _startPosX + 5, _startPosY + 33, 70, 5);
g.FillRectangle(trailer, _startPosX + 70, _startPosY, 5, 38); g.FillRectangle(trailer, _startPosX + 70, _startPosY, 5, 38);

View File

@ -203,7 +203,7 @@ namespace DumpTruck.DrawningObjects
//кузов //кузов
Brush br = new SolidBrush(EntityTruck.BodyColor); Brush br = new SolidBrush(EntityTruck.BodyColor);
g.FillRectangle(br, _startPosX + 81, _startPosY + 1, 29, 40); g.FillRectangle(br, _startPosX + 81, _startPosY + 1, 29, 40);
Brush br1 = new SolidBrush(EntityTruck.AdditionalColor); Brush br1 = new SolidBrush(EntityTruck.BodyColor);
g.FillRectangle(br1, _startPosX + 1, _startPosY + 41, 109, 19); g.FillRectangle(br1, _startPosX + 1, _startPosY + 41, 109, 19);
//колеса //колеса
Brush wheels = new SolidBrush(Color.Black); Brush wheels = new SolidBrush(Color.Black);

View File

@ -65,20 +65,20 @@ namespace DumpTruck
private void CreateDumpTruckButton_Click(object sender, EventArgs e) private void CreateDumpTruckButton_Click(object sender, EventArgs e)
{ {
Random random = new(); Random random = new();
Color color = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)); Color color1 = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
ColorDialog dialog = new(); ColorDialog dialog1 = new();
if (dialog.ShowDialog() == DialogResult.OK) if (dialog1.ShowDialog() == DialogResult.OK)
{ {
color = dialog.Color; color1 = dialog1.Color;
} }
Color color2 = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)); Color color2 = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
ColorDialog dialog2 = new(); ColorDialog dialog2 = new();
if (dialog.ShowDialog() == DialogResult.OK) if (dialog2.ShowDialog() == DialogResult.OK)
{ {
color2 = dialog2.Color; color2 = dialog2.Color;
} }
_drawningTruck = new DrawningDumpTruck(random.Next(100, 300), random.Next(1000, 3000), _drawningTruck = new DrawningDumpTruck(random.Next(100, 300), random.Next(1000, 3000),
color, color2, color1, color2,
Convert.ToBoolean(1), pictureBoxDumpTruck.Width, pictureBoxDumpTruck.Height); Convert.ToBoolean(1), pictureBoxDumpTruck.Width, pictureBoxDumpTruck.Height);
_drawningTruck.SetPosition(random.Next(10, 100), random.Next(10, 100)); _drawningTruck.SetPosition(random.Next(10, 100), random.Next(10, 100));
Draw(); Draw();

View File

@ -51,8 +51,7 @@ namespace DumpTruck.Generics
/// <param name="collect"></param> /// <param name="collect"></param>
/// <param name="obj"></param> /// <param name="obj"></param>
/// <returns></returns> /// <returns></returns>
public static int operator +(TrucksGenericCollection<T, U> collect, T? public static int operator +(TrucksGenericCollection<T, U> collect, T? obj)
obj)
{ {
if (obj == null) if (obj == null)
{ {
@ -107,7 +106,7 @@ namespace DumpTruck.Generics
{ {
for (int j = 0; j < _pictureHeight / _placeSizeHeight + for (int j = 0; j < _pictureHeight / _placeSizeHeight +
1; ++j) 1; ++j)
{//линия рамзетки места {//рамзетка места
g.DrawLine(pen, i * _placeSizeWidth, j * g.DrawLine(pen, i * _placeSizeWidth, j *
_placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth / 2, j * _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth / 2, j *
_placeSizeHeight); _placeSizeHeight);
@ -129,7 +128,7 @@ namespace DumpTruck.Generics
// TODO получение объекта // TODO получение объекта
// TODO установка позиции // TODO установка позиции
// TODO прорисовка объекта // TODO прорисовка объекта
DrawningTruck? truck = _collection.Get(i); T? truck = _collection.Get(i);
if (truck == null) if (truck == null)
continue; continue;
truck.SetPosition(i % width * _placeSizeWidth, i / width * _placeSizeHeight); truck.SetPosition(i % width * _placeSizeWidth, i / width * _placeSizeHeight);