Внесение небольших правок. Сдана работа.
This commit is contained in:
parent
16b6400b36
commit
ef93a0293c
@ -119,13 +119,9 @@ namespace ProjectBulldozer.Drawning
|
|||||||
}
|
}
|
||||||
return direction switch
|
return direction switch
|
||||||
{
|
{
|
||||||
//влево
|
|
||||||
DirectionType.Left => _startPosX - EntityTractor.Step > 0,
|
DirectionType.Left => _startPosX - EntityTractor.Step > 0,
|
||||||
//вверх
|
|
||||||
DirectionType.Up => _startPosY - EntityTractor.Step > 0,
|
DirectionType.Up => _startPosY - EntityTractor.Step > 0,
|
||||||
// вправо
|
|
||||||
DirectionType.Right => _startPosX + EntityTractor.Step < _pictureWidth,
|
DirectionType.Right => _startPosX + EntityTractor.Step < _pictureWidth,
|
||||||
//вниз
|
|
||||||
DirectionType.Down => _startPosY + EntityTractor.Step < _pictureHeight,
|
DirectionType.Down => _startPosY + EntityTractor.Step < _pictureHeight,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
22
ProjectBulldozer/FormBulldozer.Designer.cs
generated
22
ProjectBulldozer/FormBulldozer.Designer.cs
generated
@ -1,27 +1,8 @@
|
|||||||
|
namespace Bulldozer
|
||||||
namespace Bulldozer
|
|
||||||
{
|
{
|
||||||
partial class FormBulldozer
|
partial class FormBulldozer
|
||||||
{
|
{
|
||||||
private System.ComponentModel.IContainer components = null;
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormBulldozer));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormBulldozer));
|
||||||
@ -185,7 +166,6 @@ namespace Bulldozer
|
|||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
private PictureBox pictureBoxBulldozer;
|
private PictureBox pictureBoxBulldozer;
|
||||||
private Button buttonCreateBulldozer;
|
private Button buttonCreateBulldozer;
|
||||||
private Button buttonLeft;
|
private Button buttonLeft;
|
||||||
|
@ -31,7 +31,6 @@ namespace ProjectBulldozer
|
|||||||
listBoxStorage.SelectedIndex = index;
|
listBoxStorage.SelectedIndex = index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonAddObject_Click(object sender, EventArgs e)
|
private void ButtonAddObject_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(textBoxStorageName.Text))
|
if (string.IsNullOrEmpty(textBoxStorageName.Text))
|
||||||
@ -42,12 +41,10 @@ namespace ProjectBulldozer
|
|||||||
_storage.AddSet(textBoxStorageName.Text);
|
_storage.AddSet(textBoxStorageName.Text);
|
||||||
ReloadObjects();
|
ReloadObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void listBoxStorage_SelectedIndexChanged(object sender, EventArgs e)
|
private void listBoxStorage_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
pictureBoxCollections.Image = _storage[listBoxStorage.SelectedItem?.ToString() ?? string.Empty]?.ShowTractors();
|
pictureBoxCollections.Image = _storage[listBoxStorage.SelectedItem?.ToString() ?? string.Empty]?.ShowTractors();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonRemoveObject_Click(object sender, EventArgs e)
|
private void ButtonRemoveObject_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (listBoxStorage.SelectedIndex == -1)
|
if (listBoxStorage.SelectedIndex == -1)
|
||||||
@ -118,9 +115,5 @@ namespace ProjectBulldozer
|
|||||||
MessageBox.Show("Не удалось удалить объект");
|
MessageBox.Show("Не удалось удалить объект");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void textBoxStorageName_TextChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
3
ProjectBulldozer/FormBulldozerConfig.Designer.cs
generated
3
ProjectBulldozer/FormBulldozerConfig.Designer.cs
generated
@ -1,5 +1,4 @@
|
|||||||
|
namespace Bulldozer
|
||||||
namespace Bulldozer
|
|
||||||
{
|
{
|
||||||
partial class FormBulldozerConfig
|
partial class FormBulldozerConfig
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using ProjectBulldozer.Drawning;
|
using ProjectBulldozer.Drawning;
|
||||||
using ProjectBulldozer.Entities;
|
using ProjectBulldozer.Entities;
|
||||||
|
|
||||||
namespace Bulldozer
|
namespace Bulldozer
|
||||||
{
|
{
|
||||||
public partial class FormBulldozerConfig : Form
|
public partial class FormBulldozerConfig : Form
|
||||||
@ -115,7 +114,6 @@ namespace Bulldozer
|
|||||||
{
|
{
|
||||||
EventAddTractor?.Invoke(obj: _tractor);
|
EventAddTractor?.Invoke(obj: _tractor);
|
||||||
Close();
|
Close();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
using Bulldozer;
|
using ProjectBulldozer.MovementStrategy;
|
||||||
using ProjectBulldozer.MovementStrategy;
|
|
||||||
namespace ProjectBulldozer.Drawning
|
namespace ProjectBulldozer.Drawning
|
||||||
{
|
{
|
||||||
public class DrawingObjectTractor : IMoveableObject
|
public class DrawingObjectTractor : IMoveableObject
|
||||||
{
|
{
|
||||||
private readonly DrawingTractor? _drawningTractor = null;
|
private readonly DrawingTractor? _drawningTractor = null;
|
||||||
|
|
||||||
public DrawingObjectTractor(DrawingTractor drawningTractor)
|
public DrawingObjectTractor(DrawingTractor drawningTractor)
|
||||||
{
|
{
|
||||||
_drawningTractor = drawningTractor;
|
_drawningTractor = drawningTractor;
|
||||||
|
@ -6,17 +6,9 @@
|
|||||||
private readonly int _y;
|
private readonly int _y;
|
||||||
private readonly int _width;
|
private readonly int _width;
|
||||||
private readonly int _height;
|
private readonly int _height;
|
||||||
/// Левая граница
|
|
||||||
public int LeftBorder => _x;
|
|
||||||
/// Верхняя граница
|
|
||||||
public int TopBorder => _y;
|
|
||||||
/// Правая граница
|
|
||||||
public int RightBorder => _x + _width;
|
public int RightBorder => _x + _width;
|
||||||
/// Нижняя граница
|
|
||||||
public int DownBorder => _y + _height;
|
public int DownBorder => _y + _height;
|
||||||
/// Середина объекта по горизонтали
|
|
||||||
public int ObjectMiddleHorizontal => _x + _width / 2;
|
public int ObjectMiddleHorizontal => _x + _width / 2;
|
||||||
/// Середина объекта по вертикали
|
|
||||||
public int ObjectMiddleVertical => _y + _height / 2;
|
public int ObjectMiddleVertical => _y + _height / 2;
|
||||||
public ObjectParameters(int x, int y, int width, int height)
|
public ObjectParameters(int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user