Compare commits
No commits in common. "лаб3" and "main" have entirely different histories.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
MotorShip/.vs/MotorShip/v17/.futdcache.v2
Normal file
BIN
MotorShip/.vs/MotorShip/v17/.futdcache.v2
Normal file
Binary file not shown.
BIN
MotorShip/.vs/MotorShip/v17/.suo
Normal file
BIN
MotorShip/.vs/MotorShip/v17/.suo
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.3.32922.545
|
VisualStudioVersion = 17.3.32922.545
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WarmlyShip", "MotorShip\WarmlyShip.csproj", "{93B18DF4-AAEC-4934-9DA3-99513CAABB98}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MotorShip", "MotorShip\MotorShip.csproj", "{93B18DF4-AAEC-4934-9DA3-99513CAABB98}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
@ -1,109 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using WarmlyShip.DrawingObjects;
|
|
||||||
|
|
||||||
|
|
||||||
namespace WarmlyShip.MovementStrategy
|
|
||||||
{
|
|
||||||
public abstract class AbstractStrategy
|
|
||||||
{
|
|
||||||
private IMoveableObject? _moveableObject;
|
|
||||||
private Status _state = Status.NotInit;
|
|
||||||
protected int FieldWidth { get; private set; }
|
|
||||||
protected int FieldHeight { get; private set; }
|
|
||||||
public Status GetStatus() { return _state; }
|
|
||||||
public void SetData(IMoveableObject moveableObject, int width, int
|
|
||||||
height)
|
|
||||||
{
|
|
||||||
if (moveableObject == null)
|
|
||||||
{
|
|
||||||
_state = Status.NotInit;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_state = Status.InProgress;
|
|
||||||
_moveableObject = moveableObject;
|
|
||||||
FieldWidth = width;
|
|
||||||
FieldHeight = height;
|
|
||||||
}
|
|
||||||
public void MakeStep()
|
|
||||||
{
|
|
||||||
if (_state != Status.InProgress)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (IsTargetDestinaion())
|
|
||||||
{
|
|
||||||
_state = Status.Finish;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
MoveToTarget();
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Перемещение влево
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Результат перемещения (true - удалось переместиться, false - неудача)</returns>
|
|
||||||
protected bool MoveLeft() => MoveTo(DirectionType.Left);
|
|
||||||
/// <summary>
|
|
||||||
/// Перемещение вправо
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Результат перемещения (true - удалось переместиться, false - неудача)</returns>
|
|
||||||
protected bool MoveRight() => MoveTo(DirectionType.Right);
|
|
||||||
/// <summary>
|
|
||||||
/// Перемещение вверх
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Результат перемещения (true - удалось переместиться, false - неудача)</returns>
|
|
||||||
protected bool MoveUp() => MoveTo(DirectionType.Up);
|
|
||||||
/// <summary>
|
|
||||||
/// Перемещение вниз
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Результат перемещения (true - удалось переместиться, false - неудача)</returns>
|
|
||||||
protected bool MoveDown() => MoveTo(DirectionType.Down);
|
|
||||||
/// <summary>
|
|
||||||
/// Параметры объекта
|
|
||||||
/// </summary>
|
|
||||||
protected ObjectParameters? GetObjectParameters =>
|
|
||||||
_moveableObject?.GetObjectPosition;
|
|
||||||
/// <summary>
|
|
||||||
/// Шаг объекта
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
protected int? GetStep()
|
|
||||||
{
|
|
||||||
if (_state != Status.InProgress)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return _moveableObject?.GetStep;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Перемещение к цели
|
|
||||||
/// </summary>
|
|
||||||
protected abstract void MoveToTarget();
|
|
||||||
/// <summary>
|
|
||||||
/// Достигнута ли цель
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
protected abstract bool IsTargetDestinaion();
|
|
||||||
/// <summary>
|
|
||||||
/// Попытка перемещения в требуемом направлении
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="directionType">Направление</param>
|
|
||||||
/// <returns>Результат попытки (true - удалось переместиться, false - неудача)</returns>
|
|
||||||
private bool MoveTo(DirectionType directionType)
|
|
||||||
{
|
|
||||||
if (_state != Status.InProgress)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (_moveableObject?.CheckCanMove(directionType) ?? false)
|
|
||||||
{
|
|
||||||
_moveableObject.MoveObject(directionType);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace WarmlyShip
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Направление перемещения
|
|
||||||
/// </summary>
|
|
||||||
public enum DirectionType
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Вверх
|
|
||||||
/// </summary>
|
|
||||||
Up = 1,
|
|
||||||
/// <summary>
|
|
||||||
/// Вниз
|
|
||||||
/// </summary>
|
|
||||||
Down = 2,
|
|
||||||
/// <summary>
|
|
||||||
/// Влево
|
|
||||||
/// </summary>
|
|
||||||
Left = 3,
|
|
||||||
/// <summary>
|
|
||||||
/// Вправо
|
|
||||||
/// </summary>
|
|
||||||
Right = 4
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using WarmlyShip.DrawingObjects;
|
|
||||||
|
|
||||||
namespace WarmlyShip.MovementStrategy
|
|
||||||
{
|
|
||||||
public class DrawingObjectShip : IMoveableObject
|
|
||||||
{
|
|
||||||
private readonly DrawingWarmlyShip? _drawingWarmlyShip = null;
|
|
||||||
public DrawingObjectShip(DrawingWarmlyShip drawingWarmlyShip)
|
|
||||||
{
|
|
||||||
_drawingWarmlyShip = drawingWarmlyShip;
|
|
||||||
}
|
|
||||||
public ObjectParameters? GetObjectPosition
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (_drawingWarmlyShip == null || _drawingWarmlyShip.EntityWarmlyShip == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new ObjectParameters(_drawingWarmlyShip.GetPosX,
|
|
||||||
_drawingWarmlyShip.GetPosY, _drawingWarmlyShip.GetWidth, _drawingWarmlyShip.GetHeight);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public int GetStep => (int)(_drawingWarmlyShip?.EntityWarmlyShip?.Step ?? 0);
|
|
||||||
public bool CheckCanMove(DirectionType direction) =>
|
|
||||||
_drawingWarmlyShip?.CanMove(direction) ?? false;
|
|
||||||
public void MoveObject(DirectionType direction) =>
|
|
||||||
_drawingWarmlyShip?.MoveTransport(direction);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,133 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using WarmlyShip.Entities;
|
|
||||||
using WarmlyShip.MovementStrategy;
|
|
||||||
|
|
||||||
namespace WarmlyShip.DrawingObjects
|
|
||||||
{
|
|
||||||
public class DrawingWarmlyShip
|
|
||||||
{
|
|
||||||
public EntityWarmlyShip? EntityWarmlyShip { get; protected set; }
|
|
||||||
private int _pictureWidth;
|
|
||||||
private int _pictureHeight;
|
|
||||||
protected int _startPosX;
|
|
||||||
protected int _startPosY;
|
|
||||||
protected readonly int _WarmlyShipWidth = 185;
|
|
||||||
protected readonly int _WarmlyShipHeight = 180;
|
|
||||||
public DrawingWarmlyShip(int speed, double weight, Color bodyColor, int width, int height)
|
|
||||||
{
|
|
||||||
if (width < _WarmlyShipWidth || height < _WarmlyShipHeight)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_pictureWidth = width;
|
|
||||||
_pictureHeight = height;
|
|
||||||
EntityWarmlyShip = new EntityWarmlyShip(speed, weight, bodyColor);
|
|
||||||
|
|
||||||
}
|
|
||||||
protected DrawingWarmlyShip(int speed, double weight, Color bodyColor, int
|
|
||||||
width, int height, int warmlyShipWidth, int warmlyShipHeight)
|
|
||||||
{
|
|
||||||
if (width <= _WarmlyShipWidth || height <= _WarmlyShipHeight)
|
|
||||||
return;
|
|
||||||
_pictureWidth = width;
|
|
||||||
_pictureHeight = height;
|
|
||||||
_WarmlyShipWidth = warmlyShipWidth;
|
|
||||||
_WarmlyShipHeight = warmlyShipHeight;
|
|
||||||
EntityWarmlyShip = new EntityWarmlyShip(speed, weight, bodyColor);
|
|
||||||
}
|
|
||||||
public void SetPosition(int x, int y)
|
|
||||||
{
|
|
||||||
if (x >= 0 && x + _WarmlyShipWidth <= _pictureWidth && y >= 0 && y + _WarmlyShipHeight <= _pictureHeight)
|
|
||||||
{
|
|
||||||
_startPosX = x;
|
|
||||||
_startPosY = y;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public virtual void DrawTransport(Graphics g)
|
|
||||||
{
|
|
||||||
if (EntityWarmlyShip == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Pen pen = new(Color.Black, 2);
|
|
||||||
Pen anchor = new(Color.Black, 4);
|
|
||||||
Brush bodyBrush = new SolidBrush(EntityWarmlyShip.BodyColor);
|
|
||||||
//корпус теплохода
|
|
||||||
Point[] hull = new Point[]
|
|
||||||
{
|
|
||||||
new Point(_startPosX, _startPosY + 110),
|
|
||||||
new Point(_startPosX + 180, _startPosY + 110),
|
|
||||||
new Point(_startPosX + 140, _startPosY + 185),
|
|
||||||
new Point(_startPosX + 40, _startPosY + 185),
|
|
||||||
};
|
|
||||||
g.FillPolygon(bodyBrush, hull);
|
|
||||||
g.DrawPolygon(pen, hull);
|
|
||||||
//палуба
|
|
||||||
g.FillRectangle(bodyBrush, _startPosX + 25, _startPosY + 80, 130, 30);
|
|
||||||
g.DrawRectangle(pen, _startPosX + 25, _startPosY + 80, 130, 30);
|
|
||||||
|
|
||||||
//якорь
|
|
||||||
g.DrawLine(anchor, new Point(_startPosX + 50, _startPosY + 130), new Point(_startPosX + 50, _startPosY + 150));
|
|
||||||
g.DrawLine(anchor, new Point(_startPosX + 40, _startPosY + 140), new Point(_startPosX + 60, _startPosY + 140));
|
|
||||||
g.DrawLine(anchor, new Point(_startPosX + 45, _startPosY + 150), new Point(_startPosX + 55, _startPosY + 150));
|
|
||||||
}
|
|
||||||
public int GetPosX => _startPosX;
|
|
||||||
public int GetPosY => _startPosY;
|
|
||||||
public int GetWidth => _WarmlyShipWidth;
|
|
||||||
public int GetHeight => _WarmlyShipHeight;
|
|
||||||
public bool CanMove(DirectionType direction)
|
|
||||||
{
|
|
||||||
if (EntityWarmlyShip == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return direction switch
|
|
||||||
{
|
|
||||||
//влево
|
|
||||||
DirectionType.Left => _startPosX - EntityWarmlyShip.Step > 0,
|
|
||||||
//вверх
|
|
||||||
DirectionType.Up => _startPosY - EntityWarmlyShip.Step > 0,
|
|
||||||
//вправо
|
|
||||||
DirectionType.Right => _startPosX + EntityWarmlyShip.Step + _WarmlyShipWidth < _pictureWidth,
|
|
||||||
//вниз
|
|
||||||
DirectionType.Down => _startPosY + EntityWarmlyShip.Step + _WarmlyShipHeight < _pictureHeight,
|
|
||||||
_ => false,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
public void MoveTransport(DirectionType direction)
|
|
||||||
{
|
|
||||||
if (!CanMove(direction) || EntityWarmlyShip == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
switch (direction)
|
|
||||||
{
|
|
||||||
//влево
|
|
||||||
case DirectionType.Left:
|
|
||||||
_startPosX -= (int)EntityWarmlyShip.Step;
|
|
||||||
break;
|
|
||||||
//вверх
|
|
||||||
case DirectionType.Up:
|
|
||||||
_startPosY -= (int)EntityWarmlyShip.Step;
|
|
||||||
break;
|
|
||||||
// вправо
|
|
||||||
case DirectionType.Right:
|
|
||||||
_startPosX += (int)EntityWarmlyShip.Step;
|
|
||||||
break;
|
|
||||||
//вниз
|
|
||||||
case DirectionType.Down:
|
|
||||||
_startPosY += (int)EntityWarmlyShip.Step;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Получение объекта IMoveableObject из объекта DrawingCar
|
|
||||||
/// </summary>
|
|
||||||
public IMoveableObject GetMoveableObject => new DrawingObjectShip(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using WarmlyShip.Entities;
|
|
||||||
|
|
||||||
namespace WarmlyShip.DrawingObjects
|
|
||||||
{
|
|
||||||
public class DrawingWarmlyShipWithPipes : DrawingWarmlyShip
|
|
||||||
{
|
|
||||||
public DrawingWarmlyShipWithPipes(int speed, double weight, Color bodyColor, Color
|
|
||||||
additionalColor, bool pipes, bool section, int width, int height)
|
|
||||||
: base(speed, weight, bodyColor, width, height, 185, 180)
|
|
||||||
{
|
|
||||||
if (EntityWarmlyShip != null)
|
|
||||||
{
|
|
||||||
EntityWarmlyShip = new EntityWarmlyShipWithPipes(speed, weight, bodyColor, additionalColor, pipes, section);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public override void DrawTransport(Graphics g)
|
|
||||||
{
|
|
||||||
if (EntityWarmlyShip is not EntityWarmlyShipWithPipes warmlyShip)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Pen pen = new(Color.Black, 2);
|
|
||||||
Brush additionalBrush = new SolidBrush(warmlyShip.AdditionalColor);
|
|
||||||
base.DrawTransport(g);
|
|
||||||
//отсек для топлива
|
|
||||||
Brush brGray = new SolidBrush(Color.Gray);
|
|
||||||
if (warmlyShip.Section)
|
|
||||||
{
|
|
||||||
g.FillEllipse(brGray, _startPosX + 130, _startPosY + 130, 20, 20);
|
|
||||||
g.DrawEllipse(pen, _startPosX + 130, _startPosY + 130, 20, 20);
|
|
||||||
}
|
|
||||||
//трубы
|
|
||||||
if (warmlyShip.Pipes)
|
|
||||||
{
|
|
||||||
g.FillRectangle(additionalBrush, _startPosX + 55, _startPosY, 25, 80);
|
|
||||||
g.DrawRectangle(pen, _startPosX + 55, _startPosY, 25, 80);
|
|
||||||
g.FillRectangle(additionalBrush, _startPosX + 90, _startPosY + 20, 25, 60);
|
|
||||||
g.DrawRectangle(pen, _startPosX + 90, _startPosY + 20, 25, 60);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace WarmlyShip.Entities
|
|
||||||
{
|
|
||||||
public class EntityWarmlyShip
|
|
||||||
{
|
|
||||||
public int Speed { get; private set; }
|
|
||||||
public double Weight { get; private set; }
|
|
||||||
public Color BodyColor { get; private set; }
|
|
||||||
public double Step => (double)Speed * 100 / Weight;
|
|
||||||
public EntityWarmlyShip(int speed, double weight, Color bodyColor)
|
|
||||||
{
|
|
||||||
Speed = speed;
|
|
||||||
Weight = weight;
|
|
||||||
BodyColor = bodyColor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace WarmlyShip.Entities
|
|
||||||
{
|
|
||||||
public class EntityWarmlyShipWithPipes : EntityWarmlyShip
|
|
||||||
{
|
|
||||||
public Color AdditionalColor { get; private set; }
|
|
||||||
public bool Pipes { get; private set; }
|
|
||||||
public bool Section { get; private set; }
|
|
||||||
public EntityWarmlyShipWithPipes(int speed, double weight, Color bodyColor, Color
|
|
||||||
additionalColor, bool pipes, bool section)
|
|
||||||
: base(speed, weight, bodyColor)
|
|
||||||
{
|
|
||||||
AdditionalColor = additionalColor;
|
|
||||||
Pipes = pipes;
|
|
||||||
Section = section;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
39
MotorShip/MotorShip/Form1.Designer.cs
generated
Normal file
39
MotorShip/MotorShip/Form1.Designer.cs
generated
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
namespace MotorShip
|
||||||
|
{
|
||||||
|
partial class Form1
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
this.components = new System.ComponentModel.Container();
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||||
|
this.Text = "Form1";
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
10
MotorShip/MotorShip/Form1.cs
Normal file
10
MotorShip/MotorShip/Form1.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
namespace MotorShip
|
||||||
|
{
|
||||||
|
public partial class Form1 : Form
|
||||||
|
{
|
||||||
|
public Form1()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
131
MotorShip/MotorShip/FormShipCollection.Designer.cs
generated
131
MotorShip/MotorShip/FormShipCollection.Designer.cs
generated
@ -1,131 +0,0 @@
|
|||||||
namespace WarmlyShip
|
|
||||||
{
|
|
||||||
partial class FormShipCollection
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
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()
|
|
||||||
{
|
|
||||||
this.pictureBoxCollection = new System.Windows.Forms.PictureBox();
|
|
||||||
this.panelCollection = new System.Windows.Forms.Panel();
|
|
||||||
this.labelCollection = new System.Windows.Forms.Label();
|
|
||||||
this.buttonAddShip = new System.Windows.Forms.Button();
|
|
||||||
this.maskedTextBoxNumber = new System.Windows.Forms.MaskedTextBox();
|
|
||||||
this.buttonRemoveShip = new System.Windows.Forms.Button();
|
|
||||||
this.buttonRefreshCollection = new System.Windows.Forms.Button();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).BeginInit();
|
|
||||||
this.panelCollection.SuspendLayout();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// pictureBoxCollection
|
|
||||||
//
|
|
||||||
this.pictureBoxCollection.Location = new System.Drawing.Point(0, 0);
|
|
||||||
this.pictureBoxCollection.Name = "pictureBoxCollection";
|
|
||||||
this.pictureBoxCollection.Size = new System.Drawing.Size(700, 453);
|
|
||||||
this.pictureBoxCollection.TabIndex = 0;
|
|
||||||
this.pictureBoxCollection.TabStop = false;
|
|
||||||
//
|
|
||||||
// panelCollection
|
|
||||||
//
|
|
||||||
this.panelCollection.Controls.Add(this.buttonRefreshCollection);
|
|
||||||
this.panelCollection.Controls.Add(this.buttonRemoveShip);
|
|
||||||
this.panelCollection.Controls.Add(this.maskedTextBoxNumber);
|
|
||||||
this.panelCollection.Controls.Add(this.buttonAddShip);
|
|
||||||
this.panelCollection.Controls.Add(this.labelCollection);
|
|
||||||
this.panelCollection.Location = new System.Drawing.Point(699, 0);
|
|
||||||
this.panelCollection.Name = "panelCollection";
|
|
||||||
this.panelCollection.Size = new System.Drawing.Size(218, 453);
|
|
||||||
this.panelCollection.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// labelCollection
|
|
||||||
//
|
|
||||||
this.labelCollection.AutoSize = true;
|
|
||||||
this.labelCollection.Location = new System.Drawing.Point(3, 9);
|
|
||||||
this.labelCollection.Name = "labelCollection";
|
|
||||||
this.labelCollection.Size = new System.Drawing.Size(103, 20);
|
|
||||||
this.labelCollection.TabIndex = 0;
|
|
||||||
this.labelCollection.Text = "Инструменты";
|
|
||||||
//
|
|
||||||
// buttonAddShip
|
|
||||||
//
|
|
||||||
this.buttonAddShip.Location = new System.Drawing.Point(16, 38);
|
|
||||||
this.buttonAddShip.Name = "buttonAddShip";
|
|
||||||
this.buttonAddShip.Size = new System.Drawing.Size(171, 40);
|
|
||||||
this.buttonAddShip.TabIndex = 1;
|
|
||||||
this.buttonAddShip.Text = "Добавить теплоход";
|
|
||||||
this.buttonAddShip.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// maskedTextBoxNumber
|
|
||||||
//
|
|
||||||
this.maskedTextBoxNumber.Location = new System.Drawing.Point(16, 117);
|
|
||||||
this.maskedTextBoxNumber.Name = "maskedTextBoxNumber";
|
|
||||||
this.maskedTextBoxNumber.Size = new System.Drawing.Size(171, 27);
|
|
||||||
this.maskedTextBoxNumber.TabIndex = 2;
|
|
||||||
//
|
|
||||||
// buttonRemoveShip
|
|
||||||
//
|
|
||||||
this.buttonRemoveShip.Location = new System.Drawing.Point(16, 166);
|
|
||||||
this.buttonRemoveShip.Name = "buttonRemoveShip";
|
|
||||||
this.buttonRemoveShip.Size = new System.Drawing.Size(171, 40);
|
|
||||||
this.buttonRemoveShip.TabIndex = 3;
|
|
||||||
this.buttonRemoveShip.Text = "Удалить теплоход";
|
|
||||||
this.buttonRemoveShip.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// buttonRefreshCollection
|
|
||||||
//
|
|
||||||
this.buttonRefreshCollection.Location = new System.Drawing.Point(16, 239);
|
|
||||||
this.buttonRefreshCollection.Name = "buttonRefreshCollection";
|
|
||||||
this.buttonRefreshCollection.Size = new System.Drawing.Size(171, 40);
|
|
||||||
this.buttonRefreshCollection.TabIndex = 4;
|
|
||||||
this.buttonRefreshCollection.Text = "Обновить коллекцию";
|
|
||||||
this.buttonRefreshCollection.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// FormShipCollection
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(918, 453);
|
|
||||||
this.Controls.Add(this.panelCollection);
|
|
||||||
this.Controls.Add(this.pictureBoxCollection);
|
|
||||||
this.Name = "FormShipCollection";
|
|
||||||
this.Text = "FormShipCollection";
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).EndInit();
|
|
||||||
this.panelCollection.ResumeLayout(false);
|
|
||||||
this.panelCollection.PerformLayout();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private PictureBox pictureBoxCollection;
|
|
||||||
private Panel panelCollection;
|
|
||||||
private Button buttonRefreshCollection;
|
|
||||||
private Button buttonRemoveShip;
|
|
||||||
private MaskedTextBox maskedTextBoxNumber;
|
|
||||||
private Button buttonAddShip;
|
|
||||||
private Label labelCollection;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace WarmlyShip
|
|
||||||
{
|
|
||||||
public partial class FormShipCollection : Form
|
|
||||||
{
|
|
||||||
public FormShipCollection()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
<root>
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
179
MotorShip/MotorShip/FormWarmlyShip.Designer.cs
generated
179
MotorShip/MotorShip/FormWarmlyShip.Designer.cs
generated
@ -1,179 +0,0 @@
|
|||||||
namespace MotorShip
|
|
||||||
{
|
|
||||||
partial class FormWarmlyShip
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
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()
|
|
||||||
{
|
|
||||||
this.pictureBoxWarmlyShip = new System.Windows.Forms.PictureBox();
|
|
||||||
this.buttonCreateWarmlyShip = new System.Windows.Forms.Button();
|
|
||||||
this.buttonCreate = new System.Windows.Forms.Button();
|
|
||||||
this.buttonStep = new System.Windows.Forms.Button();
|
|
||||||
this.comboBoxStrategy = new System.Windows.Forms.ComboBox();
|
|
||||||
this.buttonSelectShip = new System.Windows.Forms.Button();
|
|
||||||
this.buttonLeft = new System.Windows.Forms.Button();
|
|
||||||
this.buttonUp = new System.Windows.Forms.Button();
|
|
||||||
this.buttonDown = new System.Windows.Forms.Button();
|
|
||||||
this.buttonRight = new System.Windows.Forms.Button();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxWarmlyShip)).BeginInit();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// pictureBoxWarmlyShip
|
|
||||||
//
|
|
||||||
this.pictureBoxWarmlyShip.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
||||||
this.pictureBoxWarmlyShip.Location = new System.Drawing.Point(0, 0);
|
|
||||||
this.pictureBoxWarmlyShip.Name = "pictureBoxWarmlyShip";
|
|
||||||
this.pictureBoxWarmlyShip.Size = new System.Drawing.Size(882, 453);
|
|
||||||
this.pictureBoxWarmlyShip.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
|
|
||||||
this.pictureBoxWarmlyShip.TabIndex = 0;
|
|
||||||
this.pictureBoxWarmlyShip.TabStop = false;
|
|
||||||
this.pictureBoxWarmlyShip.Click += new System.EventHandler(this.pictureBoxWarmlyShip_Click);
|
|
||||||
//
|
|
||||||
// buttonCreateWarmlyShip
|
|
||||||
//
|
|
||||||
this.buttonCreateWarmlyShip.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
|
||||||
this.buttonCreateWarmlyShip.Location = new System.Drawing.Point(12, 389);
|
|
||||||
this.buttonCreateWarmlyShip.Name = "buttonCreateWarmlyShip";
|
|
||||||
this.buttonCreateWarmlyShip.Size = new System.Drawing.Size(163, 50);
|
|
||||||
this.buttonCreateWarmlyShip.TabIndex = 1;
|
|
||||||
this.buttonCreateWarmlyShip.Text = "Создать теплоход с трубами";
|
|
||||||
this.buttonCreateWarmlyShip.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// buttonCreate
|
|
||||||
//
|
|
||||||
this.buttonCreate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
|
||||||
this.buttonCreate.Location = new System.Drawing.Point(197, 389);
|
|
||||||
this.buttonCreate.Name = "buttonCreate";
|
|
||||||
this.buttonCreate.Size = new System.Drawing.Size(122, 50);
|
|
||||||
this.buttonCreate.TabIndex = 2;
|
|
||||||
this.buttonCreate.Text = "Создать теплоход";
|
|
||||||
this.buttonCreate.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// buttonStep
|
|
||||||
//
|
|
||||||
this.buttonStep.Location = new System.Drawing.Point(720, 56);
|
|
||||||
this.buttonStep.Name = "buttonStep";
|
|
||||||
this.buttonStep.Size = new System.Drawing.Size(150, 29);
|
|
||||||
this.buttonStep.TabIndex = 8;
|
|
||||||
this.buttonStep.Text = "Шаг";
|
|
||||||
this.buttonStep.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// comboBoxStrategy
|
|
||||||
//
|
|
||||||
this.comboBoxStrategy.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
|
||||||
this.comboBoxStrategy.FormattingEnabled = true;
|
|
||||||
this.comboBoxStrategy.Location = new System.Drawing.Point(720, 13);
|
|
||||||
this.comboBoxStrategy.Name = "comboBoxStrategy";
|
|
||||||
this.comboBoxStrategy.Size = new System.Drawing.Size(151, 28);
|
|
||||||
this.comboBoxStrategy.TabIndex = 7;
|
|
||||||
//
|
|
||||||
// buttonSelectShip
|
|
||||||
//
|
|
||||||
this.buttonSelectShip.Location = new System.Drawing.Point(720, 107);
|
|
||||||
this.buttonSelectShip.Name = "buttonSelectShip";
|
|
||||||
this.buttonSelectShip.Size = new System.Drawing.Size(150, 29);
|
|
||||||
this.buttonSelectShip.TabIndex = 9;
|
|
||||||
this.buttonSelectShip.Text = "Выбрать теплоход";
|
|
||||||
this.buttonSelectShip.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// buttonLeft
|
|
||||||
//
|
|
||||||
this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
|
||||||
this.buttonLeft.Location = new System.Drawing.Point(720, 411);
|
|
||||||
this.buttonLeft.Name = "buttonLeft";
|
|
||||||
this.buttonLeft.Size = new System.Drawing.Size(30, 30);
|
|
||||||
this.buttonLeft.TabIndex = 3;
|
|
||||||
this.buttonLeft.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// buttonUp
|
|
||||||
//
|
|
||||||
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
|
||||||
this.buttonUp.Location = new System.Drawing.Point(756, 375);
|
|
||||||
this.buttonUp.Name = "buttonUp";
|
|
||||||
this.buttonUp.Size = new System.Drawing.Size(30, 30);
|
|
||||||
this.buttonUp.TabIndex = 4;
|
|
||||||
this.buttonUp.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// buttonDown
|
|
||||||
//
|
|
||||||
this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
|
||||||
this.buttonDown.Location = new System.Drawing.Point(756, 411);
|
|
||||||
this.buttonDown.Name = "buttonDown";
|
|
||||||
this.buttonDown.Size = new System.Drawing.Size(30, 30);
|
|
||||||
this.buttonDown.TabIndex = 5;
|
|
||||||
this.buttonDown.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// buttonRight
|
|
||||||
//
|
|
||||||
this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
|
||||||
this.buttonRight.Location = new System.Drawing.Point(792, 411);
|
|
||||||
this.buttonRight.Name = "buttonRight";
|
|
||||||
this.buttonRight.Size = new System.Drawing.Size(30, 30);
|
|
||||||
this.buttonRight.TabIndex = 6;
|
|
||||||
this.buttonRight.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// FormWarmlyShip
|
|
||||||
//
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
|
||||||
this.ClientSize = new System.Drawing.Size(882, 453);
|
|
||||||
this.Controls.Add(this.buttonRight);
|
|
||||||
this.Controls.Add(this.buttonDown);
|
|
||||||
this.Controls.Add(this.buttonUp);
|
|
||||||
this.Controls.Add(this.buttonLeft);
|
|
||||||
this.Controls.Add(this.buttonSelectShip);
|
|
||||||
this.Controls.Add(this.comboBoxStrategy);
|
|
||||||
this.Controls.Add(this.buttonStep);
|
|
||||||
this.Controls.Add(this.buttonCreate);
|
|
||||||
this.Controls.Add(this.buttonCreateWarmlyShip);
|
|
||||||
this.Controls.Add(this.pictureBoxWarmlyShip);
|
|
||||||
this.Name = "FormWarmlyShip";
|
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
|
||||||
this.Text = "Теплоход";
|
|
||||||
this.Load += new System.EventHandler(this.FormWarmlyShip_Load);
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxWarmlyShip)).EndInit();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private PictureBox pictureBoxWarmlyShip;
|
|
||||||
private Button buttonCreateWarmlyShip;
|
|
||||||
private Button buttonCreate;
|
|
||||||
private Button buttonStep;
|
|
||||||
private ComboBox comboBoxStrategy;
|
|
||||||
private Button buttonSelectShip;
|
|
||||||
private Button buttonLeft;
|
|
||||||
private Button buttonUp;
|
|
||||||
private Button buttonDown;
|
|
||||||
private Button buttonRight;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
namespace MotorShip
|
|
||||||
{
|
|
||||||
public partial class FormWarmlyShip : Form
|
|
||||||
{
|
|
||||||
public FormWarmlyShip()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FormWarmlyShip_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void pictureBoxWarmlyShip_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
<root>
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
@ -1,18 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using WarmlyShip.DrawingObjects;
|
|
||||||
|
|
||||||
|
|
||||||
namespace WarmlyShip.MovementStrategy
|
|
||||||
{
|
|
||||||
public interface IMoveableObject
|
|
||||||
{
|
|
||||||
ObjectParameters? GetObjectPosition { get; }
|
|
||||||
int GetStep { get; }
|
|
||||||
bool CheckCanMove(DirectionType direction);
|
|
||||||
void MoveObject(DirectionType direction);
|
|
||||||
}
|
|
||||||
}
|
|
11
MotorShip/MotorShip/MotorShip.csproj
Normal file
11
MotorShip/MotorShip/MotorShip.csproj
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<TargetFramework>net6.0-windows</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
8
MotorShip/MotorShip/MotorShip.csproj.user
Normal file
8
MotorShip/MotorShip/MotorShip.csproj.user
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Update="Form1.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
@ -1,57 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace WarmlyShip.MovementStrategy
|
|
||||||
{
|
|
||||||
public class MoveToBorder : AbstractStrategy
|
|
||||||
{
|
|
||||||
protected override bool IsTargetDestinaion()
|
|
||||||
{
|
|
||||||
var objParams = GetObjectParameters;
|
|
||||||
if (objParams == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return objParams.RightBorder <= FieldWidth &&
|
|
||||||
objParams.RightBorder + GetStep() >= FieldWidth &&
|
|
||||||
objParams.DownBorder <= FieldHeight &&
|
|
||||||
objParams.DownBorder + GetStep() >= FieldHeight;
|
|
||||||
|
|
||||||
}
|
|
||||||
protected override void MoveToTarget()
|
|
||||||
{
|
|
||||||
var objParams = GetObjectParameters;
|
|
||||||
if (objParams == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var diffX = objParams.RightBorder - FieldWidth;
|
|
||||||
if (Math.Abs(diffX) > GetStep())
|
|
||||||
{
|
|
||||||
if (diffX > 0)
|
|
||||||
{
|
|
||||||
MoveLeft();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MoveRight();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var diffY = objParams.DownBorder - FieldHeight;
|
|
||||||
if (Math.Abs(diffY) > GetStep())
|
|
||||||
{
|
|
||||||
if (diffY > 0)
|
|
||||||
{
|
|
||||||
MoveUp();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MoveDown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,56 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace WarmlyShip.MovementStrategy
|
|
||||||
{
|
|
||||||
public class MoveToCenter : AbstractStrategy
|
|
||||||
{
|
|
||||||
protected override bool IsTargetDestinaion()
|
|
||||||
{
|
|
||||||
var objParams = GetObjectParameters;
|
|
||||||
if (objParams == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return objParams.ObjectMiddleHorizontal <= FieldWidth / 2 &&
|
|
||||||
objParams.ObjectMiddleHorizontal + GetStep() >= FieldWidth / 2 &&
|
|
||||||
objParams.ObjectMiddleVertical <= FieldHeight / 2 &&
|
|
||||||
objParams.ObjectMiddleVertical + GetStep() >= FieldHeight / 2;
|
|
||||||
}
|
|
||||||
protected override void MoveToTarget()
|
|
||||||
{
|
|
||||||
var objParams = GetObjectParameters;
|
|
||||||
if (objParams == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var diffX = objParams.ObjectMiddleHorizontal - FieldWidth / 2;
|
|
||||||
if (Math.Abs(diffX) > GetStep())
|
|
||||||
{
|
|
||||||
if (diffX > 0)
|
|
||||||
{
|
|
||||||
MoveLeft();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MoveRight();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var diffY = objParams.ObjectMiddleVertical - FieldHeight / 2;
|
|
||||||
if (Math.Abs(diffY) > GetStep())
|
|
||||||
{
|
|
||||||
if (diffY > 0)
|
|
||||||
{
|
|
||||||
MoveUp();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MoveDown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace WarmlyShip.MovementStrategy
|
|
||||||
{
|
|
||||||
public class ObjectParameters
|
|
||||||
{
|
|
||||||
private readonly int _x;
|
|
||||||
private readonly int _y;
|
|
||||||
private readonly int _width;
|
|
||||||
private readonly int _height;
|
|
||||||
public int LeftBorder => _x;
|
|
||||||
public int TopBorder => _y;
|
|
||||||
public int RightBorder => _x + _width;
|
|
||||||
public int DownBorder => _y + _height;
|
|
||||||
public int ObjectMiddleHorizontal => _x + _width / 2;
|
|
||||||
public int ObjectMiddleVertical => _y + _height / 2;
|
|
||||||
public ObjectParameters(int x, int y, int width, int height)
|
|
||||||
{
|
|
||||||
_x = x;
|
|
||||||
_y = y;
|
|
||||||
_width = width;
|
|
||||||
_height = height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
namespace WarmlyShip
|
namespace MotorShip
|
||||||
{
|
{
|
||||||
internal static class Program
|
internal static class Program
|
||||||
{
|
{
|
||||||
@ -11,7 +11,7 @@ namespace WarmlyShip
|
|||||||
// To customize application configuration such as set high DPI settings or default font,
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
// see https://aka.ms/applicationconfiguration.
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
Application.Run(new FormShipCollection());
|
Application.Run(new Form1());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
63
MotorShip/MotorShip/Properties/Resources.Designer.cs
generated
63
MotorShip/MotorShip/Properties/Resources.Designer.cs
generated
@ -1,63 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// Этот код создан программой.
|
|
||||||
// Исполняемая версия:4.0.30319.42000
|
|
||||||
//
|
|
||||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
|
||||||
// повторной генерации кода.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace WarmlyShip.Properties {
|
|
||||||
using System;
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
|
|
||||||
/// </summary>
|
|
||||||
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
|
|
||||||
// с помощью такого средства, как ResGen или Visual Studio.
|
|
||||||
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
|
|
||||||
// с параметром /str или перестройте свой проект VS.
|
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
|
||||||
internal class Resources {
|
|
||||||
|
|
||||||
private static global::System.Resources.ResourceManager resourceMan;
|
|
||||||
|
|
||||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
|
||||||
|
|
||||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
|
||||||
internal Resources() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
|
|
||||||
/// </summary>
|
|
||||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
|
||||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
|
||||||
get {
|
|
||||||
if (object.ReferenceEquals(resourceMan, null)) {
|
|
||||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WarmlyShip.Properties.Resources", typeof(Resources).Assembly);
|
|
||||||
resourceMan = temp;
|
|
||||||
}
|
|
||||||
return resourceMan;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
|
|
||||||
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
|
|
||||||
/// </summary>
|
|
||||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
|
||||||
internal static global::System.Globalization.CultureInfo Culture {
|
|
||||||
get {
|
|
||||||
return resourceCulture;
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
resourceCulture = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,97 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace WarmlyShip.Generics
|
|
||||||
{
|
|
||||||
internal class SetGeneric<T>
|
|
||||||
where T : class
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Массив объектов, которые храним
|
|
||||||
/// </summary>
|
|
||||||
private readonly T?[] _places;
|
|
||||||
/// <summary>
|
|
||||||
/// Количество объектов в массиве
|
|
||||||
/// </summary>
|
|
||||||
public int Count => _places.Length;
|
|
||||||
/// <summary>
|
|
||||||
/// Конструктор
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="count"></param>
|
|
||||||
public SetGeneric(int count)
|
|
||||||
{
|
|
||||||
_places = new T?[count];
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Добавление объекта в набор
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="warmlyship">Добавляемый теплоход</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public int Insert(T warmlyship)
|
|
||||||
{
|
|
||||||
return Insert(warmlyship, 0);
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Добавление объекта в набор на конкретную позицию
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="warmlyship">Добавляемый теплоход</param>
|
|
||||||
/// <param name="position">Позиция</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public int Insert(T warmlyship, int position)
|
|
||||||
{
|
|
||||||
int nullIndex = -1;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (position < 0 || position >= Count)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
for (i = position; i < Count; i++)
|
|
||||||
{
|
|
||||||
if (_places[i] == null)
|
|
||||||
{
|
|
||||||
nullIndex = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (nullIndex < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
for (i = nullIndex; i > position; i--)
|
|
||||||
{
|
|
||||||
_places[i] = _places[i - 1];
|
|
||||||
}
|
|
||||||
_places[position] = warmlyship;
|
|
||||||
return position;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Удаление объекта из набора с конкретной позиции
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="position"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public bool Remove(int position)
|
|
||||||
{
|
|
||||||
if (position < 0 || position >= Count)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_places[position] = null;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Получение объекта из набора по позиции
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="position"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public T? Get(int position)
|
|
||||||
{
|
|
||||||
if (position < 0 || position >= Count)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return _places[position];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,150 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
using WarmlyShip.DrawingObjects;
|
|
||||||
using WarmlyShip.MovementStrategy;
|
|
||||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
|
||||||
|
|
||||||
namespace WarmlyShip.Generics
|
|
||||||
{
|
|
||||||
internal class ShipsGenericCollection<T, U>
|
|
||||||
where T : DrawingWarmlyShip
|
|
||||||
where U : IMoveableObject
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Ширина окна прорисовки
|
|
||||||
/// </summary>
|
|
||||||
private readonly int _pictureWidth;
|
|
||||||
/// <summary>
|
|
||||||
/// Высота окна прорисовки
|
|
||||||
/// </summary>
|
|
||||||
private readonly int _pictureHeight;
|
|
||||||
/// <summary>
|
|
||||||
/// Размер занимаемого объектом места (ширина)
|
|
||||||
/// </summary>
|
|
||||||
private readonly int _placeSizeWidth = 185;
|
|
||||||
/// <summary>
|
|
||||||
/// Размер занимаемого объектом места (высота)
|
|
||||||
/// </summary>
|
|
||||||
private readonly int _placeSizeHeight = 185;
|
|
||||||
/// <summary>
|
|
||||||
/// Набор объектов
|
|
||||||
/// </summary>
|
|
||||||
private readonly SetGeneric<T> _collection;
|
|
||||||
/// <summary>
|
|
||||||
/// Конструктор
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="picWidth"></param>
|
|
||||||
/// <param name="picHeight"></param>
|
|
||||||
public ShipsGenericCollection(int picWidth, int picHeight)
|
|
||||||
{
|
|
||||||
int width = picWidth / _placeSizeWidth;
|
|
||||||
int height = picHeight / _placeSizeHeight;
|
|
||||||
_pictureWidth = picWidth;
|
|
||||||
_pictureHeight = picHeight;
|
|
||||||
_collection = new SetGeneric<T>(width * height);
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Перегрузка оператора сложения
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="collect"></param>
|
|
||||||
/// <param name="obj"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static int operator +(ShipsGenericCollection<T, U> collect, T?
|
|
||||||
obj)
|
|
||||||
{
|
|
||||||
if (obj == null)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return collect._collection.Insert(obj);
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Перегрузка оператора вычитания
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="collect"></param>
|
|
||||||
/// <param name="pos"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static bool operator -(ShipsGenericCollection<T, U> collect, int
|
|
||||||
pos)
|
|
||||||
{
|
|
||||||
T? obj = collect._collection.Get(pos);
|
|
||||||
if (obj != null)
|
|
||||||
{
|
|
||||||
collect._collection.Remove(pos);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Получение объекта IMoveableObject
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="pos"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public U? GetU(int pos)
|
|
||||||
{
|
|
||||||
return (U?)_collection.Get(pos)?.GetMoveableObject;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Вывод всего набора объектов
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public Bitmap ShowShips()
|
|
||||||
{
|
|
||||||
Bitmap bmp = new(_pictureWidth, _pictureHeight);
|
|
||||||
Graphics gr = Graphics.FromImage(bmp);
|
|
||||||
DrawBackground(gr);
|
|
||||||
DrawObjects(gr);
|
|
||||||
return bmp;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Метод отрисовки фона
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="g"></param>
|
|
||||||
private void DrawBackground(Graphics g)
|
|
||||||
{
|
|
||||||
Pen pen = new(Color.Black, 3);
|
|
||||||
for (int i = 0; i < _pictureWidth / _placeSizeWidth; i++)
|
|
||||||
{
|
|
||||||
for (int j = 0; j < _pictureHeight / _placeSizeHeight +
|
|
||||||
1; ++j)
|
|
||||||
{//линия рамзетки места
|
|
||||||
g.DrawLine(pen, i * _placeSizeWidth, j *
|
|
||||||
_placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth / 2, j *
|
|
||||||
_placeSizeHeight);
|
|
||||||
}
|
|
||||||
g.DrawLine(pen, i * _placeSizeWidth, 0, i *
|
|
||||||
_placeSizeWidth, _pictureHeight / _placeSizeHeight * _placeSizeHeight);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// /// Метод прорисовки объектов
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="g"></param>
|
|
||||||
private void DrawObjects(Graphics g)
|
|
||||||
{
|
|
||||||
T? ship;
|
|
||||||
int width = _pictureWidth / _placeSizeWidth;
|
|
||||||
int diff = 1;
|
|
||||||
int currWidth = 0;
|
|
||||||
for (int i = 0; i < _collection.Count; i++)
|
|
||||||
{
|
|
||||||
currWidth++;
|
|
||||||
if (currWidth > width)
|
|
||||||
{
|
|
||||||
diff++;
|
|
||||||
currWidth = 1;
|
|
||||||
}
|
|
||||||
ship = _collection.Get(i);
|
|
||||||
if (ship != null)
|
|
||||||
{
|
|
||||||
ship.SetPosition((width - 1 - (i % width)) * _placeSizeWidth, i / width * _placeSizeHeight);
|
|
||||||
ship.DrawTransport(g);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace WarmlyShip.MovementStrategy
|
|
||||||
{
|
|
||||||
public enum Status
|
|
||||||
{
|
|
||||||
NotInit,
|
|
||||||
InProgress,
|
|
||||||
Finish
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutputType>WinExe</OutputType>
|
|
||||||
<TargetFramework>net6.0-windows</TargetFramework>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Update="Properties\Resources.Designer.cs">
|
|
||||||
<DesignTime>True</DesignTime>
|
|
||||||
<AutoGen>True</AutoGen>
|
|
||||||
<DependentUpon>Resources.resx</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<EmbeddedResource Update="Properties\Resources.resx">
|
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
|
||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
|
||||||
</EmbeddedResource>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
@ -1,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Update="FormShipCollection.cs">
|
|
||||||
<SubType>Form</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Update="FormWarmlyShip.cs">
|
|
||||||
<SubType>Form</SubType>
|
|
||||||
</Compile>
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
@ -1,23 +0,0 @@
|
|||||||
{
|
|
||||||
"runtimeTarget": {
|
|
||||||
"name": ".NETCoreApp,Version=v6.0",
|
|
||||||
"signature": ""
|
|
||||||
},
|
|
||||||
"compilationOptions": {},
|
|
||||||
"targets": {
|
|
||||||
".NETCoreApp,Version=v6.0": {
|
|
||||||
"WarmlyShip/1.0.0": {
|
|
||||||
"runtime": {
|
|
||||||
"WarmlyShip.dll": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"libraries": {
|
|
||||||
"WarmlyShip/1.0.0": {
|
|
||||||
"type": "project",
|
|
||||||
"serviceable": false,
|
|
||||||
"sha512": ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
"runtimeOptions": {
|
|
||||||
"tfm": "net6.0",
|
|
||||||
"frameworks": [
|
|
||||||
{
|
|
||||||
"name": "Microsoft.NETCore.App",
|
|
||||||
"version": "6.0.0"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Microsoft.WindowsDesktop.App",
|
|
||||||
"version": "6.0.0"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
Binary file not shown.
@ -1,25 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// Этот код создан программой.
|
|
||||||
// Исполняемая версия:4.0.30319.42000
|
|
||||||
//
|
|
||||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
|
||||||
// повторной генерации кода.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Reflection;
|
|
||||||
|
|
||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("WarmlyShip")]
|
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
|
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("WarmlyShip")]
|
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("WarmlyShip")]
|
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
|
||||||
[assembly: System.Runtime.Versioning.TargetPlatformAttribute("Windows7.0")]
|
|
||||||
[assembly: System.Runtime.Versioning.SupportedOSPlatformAttribute("Windows7.0")]
|
|
||||||
|
|
||||||
// Создано классом WriteCodeFragment MSBuild.
|
|
||||||
|
|
@ -1 +0,0 @@
|
|||||||
9e4fa9fd1ecdd07181264594cdb4ea30b2f8e7a9
|
|
Binary file not shown.
@ -1,16 +0,0 @@
|
|||||||
is_global = true
|
|
||||||
build_property.ApplicationManifest =
|
|
||||||
build_property.StartupObject =
|
|
||||||
build_property.ApplicationDefaultFont =
|
|
||||||
build_property.ApplicationHighDpiMode =
|
|
||||||
build_property.ApplicationUseCompatibleTextRendering =
|
|
||||||
build_property.ApplicationVisualStyles =
|
|
||||||
build_property.TargetFramework = net6.0-windows
|
|
||||||
build_property.TargetPlatformMinVersion = 7.0
|
|
||||||
build_property.UsingMicrosoftNETSdkWeb =
|
|
||||||
build_property.ProjectTypeGuids =
|
|
||||||
build_property.InvariantGlobalization =
|
|
||||||
build_property.PlatformNeutralAssembly =
|
|
||||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
|
||||||
build_property.RootNamespace = WarmlyShip
|
|
||||||
build_property.ProjectDir = C:\Users\Екатерина\OneDrive\Desktop\РПП\MotorShip\MotorShip\
|
|
@ -1,10 +0,0 @@
|
|||||||
// <auto-generated/>
|
|
||||||
global using global::System;
|
|
||||||
global using global::System.Collections.Generic;
|
|
||||||
global using global::System.Drawing;
|
|
||||||
global using global::System.IO;
|
|
||||||
global using global::System.Linq;
|
|
||||||
global using global::System.Net.Http;
|
|
||||||
global using global::System.Threading;
|
|
||||||
global using global::System.Threading.Tasks;
|
|
||||||
global using global::System.Windows.Forms;
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +0,0 @@
|
|||||||
06cd6889c77069e0f55068eddb8f6c6d07ea4abf
|
|
@ -1,19 +0,0 @@
|
|||||||
C:\Users\Екатерина\OneDrive\Desktop\РПП\MotorShip\MotorShip\bin\Debug\net6.0-windows\WarmlyShip.exe
|
|
||||||
C:\Users\Екатерина\OneDrive\Desktop\РПП\MotorShip\MotorShip\bin\Debug\net6.0-windows\WarmlyShip.deps.json
|
|
||||||
C:\Users\Екатерина\OneDrive\Desktop\РПП\MotorShip\MotorShip\bin\Debug\net6.0-windows\WarmlyShip.runtimeconfig.json
|
|
||||||
C:\Users\Екатерина\OneDrive\Desktop\РПП\MotorShip\MotorShip\bin\Debug\net6.0-windows\WarmlyShip.dll
|
|
||||||
C:\Users\Екатерина\OneDrive\Desktop\РПП\MotorShip\MotorShip\bin\Debug\net6.0-windows\WarmlyShip.pdb
|
|
||||||
C:\Users\Екатерина\OneDrive\Desktop\РПП\MotorShip\MotorShip\obj\Debug\net6.0-windows\WarmlyShip.csproj.AssemblyReference.cache
|
|
||||||
C:\Users\Екатерина\OneDrive\Desktop\РПП\MotorShip\MotorShip\obj\Debug\net6.0-windows\WarmlyShip.FormShipCollection.resources
|
|
||||||
C:\Users\Екатерина\OneDrive\Desktop\РПП\MotorShip\MotorShip\obj\Debug\net6.0-windows\MotorShip.FormWarmlyShip.resources
|
|
||||||
C:\Users\Екатерина\OneDrive\Desktop\РПП\MotorShip\MotorShip\obj\Debug\net6.0-windows\WarmlyShip.Properties.Resources.resources
|
|
||||||
C:\Users\Екатерина\OneDrive\Desktop\РПП\MotorShip\MotorShip\obj\Debug\net6.0-windows\WarmlyShip.csproj.GenerateResource.cache
|
|
||||||
C:\Users\Екатерина\OneDrive\Desktop\РПП\MotorShip\MotorShip\obj\Debug\net6.0-windows\WarmlyShip.GeneratedMSBuildEditorConfig.editorconfig
|
|
||||||
C:\Users\Екатерина\OneDrive\Desktop\РПП\MotorShip\MotorShip\obj\Debug\net6.0-windows\WarmlyShip.AssemblyInfoInputs.cache
|
|
||||||
C:\Users\Екатерина\OneDrive\Desktop\РПП\MotorShip\MotorShip\obj\Debug\net6.0-windows\WarmlyShip.AssemblyInfo.cs
|
|
||||||
C:\Users\Екатерина\OneDrive\Desktop\РПП\MotorShip\MotorShip\obj\Debug\net6.0-windows\WarmlyShip.csproj.CoreCompileInputs.cache
|
|
||||||
C:\Users\Екатерина\OneDrive\Desktop\РПП\MotorShip\MotorShip\obj\Debug\net6.0-windows\WarmlyShip.dll
|
|
||||||
C:\Users\Екатерина\OneDrive\Desktop\РПП\MotorShip\MotorShip\obj\Debug\net6.0-windows\refint\WarmlyShip.dll
|
|
||||||
C:\Users\Екатерина\OneDrive\Desktop\РПП\MotorShip\MotorShip\obj\Debug\net6.0-windows\WarmlyShip.pdb
|
|
||||||
C:\Users\Екатерина\OneDrive\Desktop\РПП\MotorShip\MotorShip\obj\Debug\net6.0-windows\WarmlyShip.genruntimeconfig.cache
|
|
||||||
C:\Users\Екатерина\OneDrive\Desktop\РПП\MotorShip\MotorShip\obj\Debug\net6.0-windows\ref\WarmlyShip.dll
|
|
Binary file not shown.
@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"runtimeTarget": {
|
|
||||||
"name": ".NETCoreApp,Version=v6.0",
|
|
||||||
"signature": ""
|
|
||||||
},
|
|
||||||
"compilationOptions": {},
|
|
||||||
"targets": {
|
|
||||||
".NETCoreApp,Version=v6.0": {}
|
|
||||||
},
|
|
||||||
"libraries": {}
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
{
|
|
||||||
"runtimeOptions": {
|
|
||||||
"tfm": "net6.0",
|
|
||||||
"frameworks": [
|
|
||||||
{
|
|
||||||
"name": "Microsoft.NETCore.App",
|
|
||||||
"version": "6.0.0"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Microsoft.WindowsDesktop.App",
|
|
||||||
"version": "6.0.0"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"additionalProbingPaths": [
|
|
||||||
"C:\\Users\\Екатерина\\.dotnet\\store\\|arch|\\|tfm|",
|
|
||||||
"C:\\Users\\Екатерина\\.nuget\\packages",
|
|
||||||
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
|
|
||||||
],
|
|
||||||
"configProperties": {
|
|
||||||
"Microsoft.NETCore.DotNetHostPolicy.SetAppPaths": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
@ -1 +0,0 @@
|
|||||||
b5ff27391765f54d26fb3871c8501fdc7aeba875
|
|
Binary file not shown.
@ -1 +0,0 @@
|
|||||||
obj\Debug\net6.0-windows\\_IsIncrementalBuild
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,71 +0,0 @@
|
|||||||
{
|
|
||||||
"format": 1,
|
|
||||||
"restore": {
|
|
||||||
"C:\\Users\\Екатерина\\OneDrive\\Desktop\\РПП\\MotorShip\\MotorShip\\WarmlyShip.csproj": {}
|
|
||||||
},
|
|
||||||
"projects": {
|
|
||||||
"C:\\Users\\Екатерина\\OneDrive\\Desktop\\РПП\\MotorShip\\MotorShip\\WarmlyShip.csproj": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"restore": {
|
|
||||||
"projectUniqueName": "C:\\Users\\Екатерина\\OneDrive\\Desktop\\РПП\\MotorShip\\MotorShip\\WarmlyShip.csproj",
|
|
||||||
"projectName": "WarmlyShip",
|
|
||||||
"projectPath": "C:\\Users\\Екатерина\\OneDrive\\Desktop\\РПП\\MotorShip\\MotorShip\\WarmlyShip.csproj",
|
|
||||||
"packagesPath": "C:\\Users\\Екатерина\\.nuget\\packages\\",
|
|
||||||
"outputPath": "C:\\Users\\Екатерина\\OneDrive\\Desktop\\РПП\\MotorShip\\MotorShip\\obj\\",
|
|
||||||
"projectStyle": "PackageReference",
|
|
||||||
"fallbackFolders": [
|
|
||||||
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
|
|
||||||
],
|
|
||||||
"configFilePaths": [
|
|
||||||
"C:\\Users\\Екатерина\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
|
||||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
|
|
||||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
|
|
||||||
],
|
|
||||||
"originalTargetFrameworks": [
|
|
||||||
"net6.0-windows"
|
|
||||||
],
|
|
||||||
"sources": {
|
|
||||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
|
||||||
"C:\\Program Files\\dotnet\\library-packs": {},
|
|
||||||
"https://api.nuget.org/v3/index.json": {}
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net6.0-windows7.0": {
|
|
||||||
"targetAlias": "net6.0-windows",
|
|
||||||
"projectReferences": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"warningProperties": {
|
|
||||||
"warnAsError": [
|
|
||||||
"NU1605"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net6.0-windows7.0": {
|
|
||||||
"targetAlias": "net6.0-windows",
|
|
||||||
"imports": [
|
|
||||||
"net461",
|
|
||||||
"net462",
|
|
||||||
"net47",
|
|
||||||
"net471",
|
|
||||||
"net472",
|
|
||||||
"net48",
|
|
||||||
"net481"
|
|
||||||
],
|
|
||||||
"assetTargetFallback": true,
|
|
||||||
"warn": true,
|
|
||||||
"frameworkReferences": {
|
|
||||||
"Microsoft.NETCore.App": {
|
|
||||||
"privateAssets": "all"
|
|
||||||
},
|
|
||||||
"Microsoft.WindowsDesktop.App.WindowsForms": {
|
|
||||||
"privateAssets": "none"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\6.0.401\\RuntimeIdentifierGraph.json"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
|
||||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
|
||||||
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
|
||||||
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
|
||||||
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
|
||||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
|
||||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Екатерина\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
|
|
||||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
|
||||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.3.0</NuGetToolVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
|
||||||
<SourceRoot Include="C:\Users\Екатерина\.nuget\packages\" />
|
|
||||||
<SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
@ -1,2 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
|
||||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
|
|
@ -14,9 +14,9 @@
|
|||||||
"project": {
|
"project": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"restore": {
|
"restore": {
|
||||||
"projectUniqueName": "C:\\Users\\Екатерина\\OneDrive\\Desktop\\РПП\\MotorShip\\MotorShip\\WarmlyShip.csproj",
|
"projectUniqueName": "C:\\Users\\Екатерина\\OneDrive\\Desktop\\РПП\\MotorShip\\MotorShip\\MotorShip.csproj",
|
||||||
"projectName": "WarmlyShip",
|
"projectName": "MotorShip",
|
||||||
"projectPath": "C:\\Users\\Екатерина\\OneDrive\\Desktop\\РПП\\MotorShip\\MotorShip\\WarmlyShip.csproj",
|
"projectPath": "C:\\Users\\Екатерина\\OneDrive\\Desktop\\РПП\\MotorShip\\MotorShip\\MotorShip.csproj",
|
||||||
"packagesPath": "C:\\Users\\Екатерина\\.nuget\\packages\\",
|
"packagesPath": "C:\\Users\\Екатерина\\.nuget\\packages\\",
|
||||||
"outputPath": "C:\\Users\\Екатерина\\OneDrive\\Desktop\\РПП\\MotorShip\\MotorShip\\obj\\",
|
"outputPath": "C:\\Users\\Екатерина\\OneDrive\\Desktop\\РПП\\MotorShip\\MotorShip\\obj\\",
|
||||||
"projectStyle": "PackageReference",
|
"projectStyle": "PackageReference",
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"version": 2,
|
"version": 2,
|
||||||
"dgSpecHash": "aDampGwy73k7qtg/YN7p9IeoOxrz4wCzs0qYdTQADvRaI/+G2V69SclPzeFFbFSm7K1+pDPW7S+T49iijnW1Xg==",
|
"dgSpecHash": "bnUESf/Rv6V72tUo+jhmSGhXmC6Pqj7O2CTNWB9EejNBsTYuPhenT/pJ78ztAR8PVDXUh5QMU+FThm53y2XUQg==",
|
||||||
"success": true,
|
"success": true,
|
||||||
"projectFilePath": "C:\\Users\\Екатерина\\OneDrive\\Desktop\\РПП\\MotorShip\\MotorShip\\WarmlyShip.csproj",
|
"projectFilePath": "C:\\Users\\Екатерина\\OneDrive\\Desktop\\РПП\\MotorShip\\MotorShip\\MotorShip.csproj",
|
||||||
"expectedPackageFiles": [],
|
"expectedPackageFiles": [],
|
||||||
"logs": []
|
"logs": []
|
||||||
}
|
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,75 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
|
||||||
using ProjectMotorShip.DrawingObjects;
|
|
||||||
|
|
||||||
namespace ProjectMotorShip.MovementStrategy
|
|
||||||
{
|
|
||||||
public abstract class AbstractStrategy
|
|
||||||
{
|
|
||||||
private IMoveableObject? _movebleObject;
|
|
||||||
private Status _state = Status.NotInit;
|
|
||||||
protected int FieldWidth { get; private set; }
|
|
||||||
protected int FieldHeight { get; private set; }
|
|
||||||
public Status GetStatus() { return _state; }
|
|
||||||
public void SetData(IMoveableObject moveableObject, int width, int height)
|
|
||||||
{
|
|
||||||
if (moveableObject == null)
|
|
||||||
{
|
|
||||||
_state = Status.NotInit;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_state = Status.InProgress;
|
|
||||||
_movebleObject = moveableObject;
|
|
||||||
FieldWidth = width;
|
|
||||||
FieldHeight = height;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void MakeStep()
|
|
||||||
{
|
|
||||||
if (_state != Status.InProgress)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (IsTargetDestination())
|
|
||||||
{
|
|
||||||
_state = Status.Finish;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
MoveToTarget();
|
|
||||||
}
|
|
||||||
protected bool MoveLeft() => MoveTo(DirectionType.Left);
|
|
||||||
protected bool MoveRight() => MoveTo(DirectionType.Right);
|
|
||||||
protected bool MoveUp() => MoveTo(DirectionType.Up);
|
|
||||||
protected bool MoveDown() => MoveTo(DirectionType.Down);
|
|
||||||
|
|
||||||
protected ObjectParametrs? GetObjectParametrs => _movebleObject?.GetObjectPosition;
|
|
||||||
|
|
||||||
protected int? GetStep()
|
|
||||||
{
|
|
||||||
if (_state != Status.InProgress)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return _movebleObject?.GetStep;
|
|
||||||
}
|
|
||||||
protected abstract void MoveToTarget();
|
|
||||||
protected abstract bool IsTargetDestination();
|
|
||||||
private bool MoveTo(DirectionType directionType)
|
|
||||||
{
|
|
||||||
if (_state != Status.InProgress)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (_movebleObject?.CheckCanMove(directionType) ?? false)
|
|
||||||
{
|
|
||||||
_movebleObject.MoveObject(directionType);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectMotorShip
|
|
||||||
{
|
|
||||||
public enum DirectionType
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Вверх
|
|
||||||
/// </summary>
|
|
||||||
Up = 1,
|
|
||||||
/// <summary>
|
|
||||||
/// Вниз
|
|
||||||
/// </summary>
|
|
||||||
Down = 2,
|
|
||||||
/// <summary>
|
|
||||||
/// Влево
|
|
||||||
/// </summary>
|
|
||||||
Left = 3,
|
|
||||||
/// <summary>
|
|
||||||
/// Вправо
|
|
||||||
/// </summary>
|
|
||||||
Right = 4
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,52 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using ProjectMotorShip.Entities;
|
|
||||||
|
|
||||||
namespace ProjectMotorShip.DrawingObjects
|
|
||||||
{
|
|
||||||
public class DrawningMotorShip : DrawningShip
|
|
||||||
{
|
|
||||||
public DrawningMotorShip(int speed, double weight,
|
|
||||||
Color mainColor, Color optionalColor, bool pipes,
|
|
||||||
bool fuelCompartment, int width, int height) :
|
|
||||||
base(speed, weight, mainColor, width, height, 100, 60)
|
|
||||||
{
|
|
||||||
if (EntityShip != null)
|
|
||||||
{
|
|
||||||
EntityShip = new EntityMotorShip(speed, weight, mainColor,
|
|
||||||
optionalColor, pipes, fuelCompartment);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void DrawTrasport(Graphics g)
|
|
||||||
{
|
|
||||||
if (EntityShip is not EntityMotorShip motorShip)
|
|
||||||
{
|
|
||||||
|
|
||||||
return;
|
|
||||||
|
|
||||||
}
|
|
||||||
Pen pen = new(Color.Black);
|
|
||||||
Brush optionalBrush = new SolidBrush(motorShip.OptionalColor);
|
|
||||||
if (motorShip.Pipes)
|
|
||||||
{
|
|
||||||
g.FillRectangle(optionalBrush, _startPosX + 70, _startPosY, 10, 30);
|
|
||||||
g.FillRectangle(optionalBrush, _startPosX + 50, _startPosY + 10, 10, 20);
|
|
||||||
g.DrawRectangle(pen, _startPosX + 50, _startPosY + 10, 10, 20);
|
|
||||||
g.DrawRectangle(pen, _startPosX + 70, _startPosY, 10, 30);
|
|
||||||
}
|
|
||||||
if (motorShip.FuelCompartment)
|
|
||||||
{
|
|
||||||
g.FillRectangle(optionalBrush, _startPosX + 10, _startPosY + 30, 10, 10);
|
|
||||||
g.DrawRectangle(pen, _startPosX + 10, _startPosY + 30, 10, 10);
|
|
||||||
}
|
|
||||||
_startPosY += 30;
|
|
||||||
base.DrawTrasport(g);
|
|
||||||
_startPosY -= 30;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using ProjectMotorShip.DrawingObjects;
|
|
||||||
|
|
||||||
|
|
||||||
namespace ProjectMotorShip.MovementStrategy
|
|
||||||
{
|
|
||||||
public class DrawningObjectShip : IMoveableObject
|
|
||||||
{
|
|
||||||
private readonly DrawningShip? _drawningShip = null;
|
|
||||||
public DrawningObjectShip(DrawningShip drawningShip)
|
|
||||||
{
|
|
||||||
_drawningShip = drawningShip;
|
|
||||||
}
|
|
||||||
public ObjectParametrs? GetObjectPosition
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (_drawningShip == null || _drawningShip.EntityShip == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new ObjectParametrs(_drawningShip.GetPosX,
|
|
||||||
_drawningShip.GetPosY, _drawningShip.GetWidth,
|
|
||||||
_drawningShip.GetHeight);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public int GetStep => (int)(_drawningShip?.EntityShip?.Step ?? 0);
|
|
||||||
public bool CheckCanMove(DirectionType direction) =>
|
|
||||||
_drawningShip?.CanMove(direction) ?? false;
|
|
||||||
public void MoveObject(DirectionType direction) =>
|
|
||||||
_drawningShip?.MoveTransport(direction);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,132 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using ProjectMotorShip.Entities;
|
|
||||||
|
|
||||||
namespace ProjectMotorShip.DrawingObjects
|
|
||||||
{
|
|
||||||
public class DrawningShip
|
|
||||||
{
|
|
||||||
public EntityShip? EntityShip { get; protected set; }
|
|
||||||
private int _pictureWidth;
|
|
||||||
private int _pictureHeight;
|
|
||||||
protected int _startPosX;
|
|
||||||
protected int _startPosY;
|
|
||||||
protected readonly int _shipWidth = 100;
|
|
||||||
protected readonly int _shipHeight = 30;
|
|
||||||
|
|
||||||
public DrawningShip(int speed, double weight, Color mainColor, int width, int heigth)
|
|
||||||
{
|
|
||||||
if (width <= _shipWidth || heigth <= _shipHeight)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_pictureWidth = width;
|
|
||||||
_pictureHeight = heigth;
|
|
||||||
EntityShip = new EntityShip(speed, weight, mainColor);
|
|
||||||
}
|
|
||||||
protected DrawningShip(int speed, double weight,
|
|
||||||
Color mainColor, int width, int heigth,
|
|
||||||
int shipWidth, int shipHeight)
|
|
||||||
{
|
|
||||||
if (width <= shipWidth || heigth <= shipHeight)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_pictureHeight = heigth;
|
|
||||||
_pictureWidth = width;
|
|
||||||
_shipHeight = shipHeight;
|
|
||||||
_shipWidth = shipWidth;
|
|
||||||
EntityShip = new EntityShip(speed, weight, mainColor);
|
|
||||||
}
|
|
||||||
public void SetPosition(int x, int y)
|
|
||||||
{
|
|
||||||
if (x < 0 || y < 0 || x + _shipWidth > _pictureWidth || y + _shipHeight > _pictureHeight)
|
|
||||||
{
|
|
||||||
x = 10;
|
|
||||||
y = 10;
|
|
||||||
}
|
|
||||||
_startPosX = x;
|
|
||||||
_startPosY = y;
|
|
||||||
}
|
|
||||||
public int GetPosX => _startPosX;
|
|
||||||
public int GetPosY => _startPosY;
|
|
||||||
public int GetWidth => _shipWidth;
|
|
||||||
public int GetHeight => _shipHeight;
|
|
||||||
public bool CanMove(DirectionType direction)
|
|
||||||
{
|
|
||||||
if (EntityShip == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return direction switch
|
|
||||||
{
|
|
||||||
DirectionType.Left => _startPosX - EntityShip.Step > 0,
|
|
||||||
DirectionType.Up => _startPosY - EntityShip.Step > 0,
|
|
||||||
DirectionType.Right => _startPosX + EntityShip.Step + _shipWidth <= _pictureWidth,
|
|
||||||
DirectionType.Down => _startPosY + EntityShip.Step + _shipHeight <= _pictureHeight,
|
|
||||||
_ => false,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public void MoveTransport(DirectionType direction)
|
|
||||||
{
|
|
||||||
if (!CanMove(direction) || EntityShip == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
switch (direction)
|
|
||||||
{
|
|
||||||
case DirectionType.Left:
|
|
||||||
_startPosX -= (int)EntityShip.Step;
|
|
||||||
break;
|
|
||||||
case DirectionType.Up:
|
|
||||||
_startPosY -= (int)EntityShip.Step;
|
|
||||||
break;
|
|
||||||
case DirectionType.Right:
|
|
||||||
_startPosX += (int)EntityShip.Step;
|
|
||||||
break;
|
|
||||||
case DirectionType.Down:
|
|
||||||
_startPosY += (int)EntityShip.Step;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public virtual void DrawTrasport(Graphics g)
|
|
||||||
{
|
|
||||||
if (EntityShip == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Pen pen = new(Color.Black);
|
|
||||||
Brush mainBrush = new SolidBrush(EntityShip.MainColor);
|
|
||||||
//палуба
|
|
||||||
g.FillRectangle(mainBrush, _startPosX + 30, _startPosY, 60, 10);
|
|
||||||
g.DrawRectangle(pen, _startPosX + 30, _startPosY, 60, 10);
|
|
||||||
//корпус
|
|
||||||
g.FillPolygon(mainBrush, new Point[]
|
|
||||||
{
|
|
||||||
new Point(_startPosX, _startPosY + 10),
|
|
||||||
new Point(_startPosX + 100, _startPosY + 10),
|
|
||||||
new Point(_startPosX + 90, _startPosY + 30),
|
|
||||||
new Point(_startPosX + 20, _startPosY + 30),
|
|
||||||
new Point(_startPosX, _startPosY + 10),
|
|
||||||
}
|
|
||||||
);
|
|
||||||
g.DrawPolygon(pen, new Point[]
|
|
||||||
{
|
|
||||||
new Point(_startPosX, _startPosY + 10),
|
|
||||||
new Point(_startPosX + 100, _startPosY + 10),
|
|
||||||
new Point(_startPosX + 90, _startPosY + 30),
|
|
||||||
new Point(_startPosX + 20, _startPosY + 30),
|
|
||||||
new Point(_startPosX, _startPosY + 10),
|
|
||||||
}
|
|
||||||
);
|
|
||||||
//якорь
|
|
||||||
g.DrawLine(pen, _startPosX + 25, _startPosY + 15, _startPosX + 25, _startPosY + 25);
|
|
||||||
g.DrawLine(pen, _startPosX + 20, _startPosY + 20, _startPosX + 30, _startPosY + 20);
|
|
||||||
g.DrawLine(pen, _startPosX + 23, _startPosY + 25, _startPosX + 27, _startPosY + 25);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using static System.Collections.Specialized.BitVector32;
|
|
||||||
|
|
||||||
namespace ProjectMotorShip.Entities
|
|
||||||
{
|
|
||||||
public class EntityMotorShip : EntityShip
|
|
||||||
{
|
|
||||||
public Color OptionalColor { get; private set; }
|
|
||||||
public bool Pipes { get; private set; }
|
|
||||||
public bool FuelCompartment { get; private set; }
|
|
||||||
public EntityMotorShip(int speed, double weight,
|
|
||||||
Color mainColor, Color optionalColor,
|
|
||||||
bool pipes, bool fuelCompartment) : base(speed, weight, mainColor)
|
|
||||||
{
|
|
||||||
OptionalColor = optionalColor;
|
|
||||||
Pipes = pipes;
|
|
||||||
FuelCompartment = fuelCompartment;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectMotorShip.Entities
|
|
||||||
{
|
|
||||||
public class EntityShip
|
|
||||||
{
|
|
||||||
public int Speed { get; private set; }
|
|
||||||
public double Weight { get; private set; }
|
|
||||||
public Color MainColor { get; private set; }
|
|
||||||
public double Step => (double)Speed * 100 / Weight;
|
|
||||||
public EntityShip(int speed, double weight, Color mainColor)
|
|
||||||
{
|
|
||||||
Speed = speed;
|
|
||||||
Weight = weight;
|
|
||||||
MainColor = mainColor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
39
ProjectMotorShip/ProjectMotorShip/Form1.Designer.cs
generated
Normal file
39
ProjectMotorShip/ProjectMotorShip/Form1.Designer.cs
generated
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
namespace ProjectMotorShip
|
||||||
|
{
|
||||||
|
partial class Form1
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
this.components = new System.ComponentModel.Container();
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||||
|
this.Text = "Form1";
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
10
ProjectMotorShip/ProjectMotorShip/Form1.cs
Normal file
10
ProjectMotorShip/ProjectMotorShip/Form1.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
namespace ProjectMotorShip
|
||||||
|
{
|
||||||
|
public partial class Form1 : Form
|
||||||
|
{
|
||||||
|
public Form1()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user