Compare commits

..

7 Commits

Author SHA1 Message Date
8dd04c6ee1 л5 2024-03-04 18:12:22 +04:00
169edd19f7 л5 2024-03-04 18:06:21 +04:00
61099f558b л4 2023-12-29 22:57:36 +04:00
bb1b96f3ff л3 2023-12-29 22:34:02 +04:00
2b478161f0 л2 2023-11-13 14:05:09 +04:00
ce9b9e2d60 лабораторная работа 2 2023-11-13 14:04:53 +04:00
5eb0454b66 зафиксировать всё 2023-10-30 12:05:50 +04:00
144 changed files with 3371 additions and 132 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,109 @@
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;
}
}
}

View File

@ -0,0 +1,32 @@
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
}
}

View File

@ -0,0 +1,35 @@
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);
}
}

View File

@ -0,0 +1,139 @@
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; }
public int _pictureWidth;
public 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);
public void ChangePictureBoxSize(int pictureBoxWidth, int pictureBoxHeight)
{
_pictureWidth = pictureBoxWidth;
_pictureHeight = pictureBoxHeight;
}
}
}

View File

@ -0,0 +1,48 @@
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);
}
}
}
}

View File

@ -0,0 +1,26 @@
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;
}
public void SetBodyColor(Color color)
{
BodyColor = color;
}
}
}

View File

@ -0,0 +1,27 @@
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;
}
public void SetAdditionalColor(Color color)
{
AdditionalColor = color;
}
}
}

View File

@ -1,39 +0,0 @@
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
}
}

View File

@ -1,10 +0,0 @@
namespace MotorShip
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,193 @@
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.groupBoxSets = new System.Windows.Forms.GroupBox();
this.buttonDelObject = new System.Windows.Forms.Button();
this.listBoxStorages = new System.Windows.Forms.ListBox();
this.buttonnAddObject = new System.Windows.Forms.Button();
this.textBoxStorageName = new System.Windows.Forms.TextBox();
this.buttonRefreshCollection = new System.Windows.Forms.Button();
this.buttonRemoveShip = new System.Windows.Forms.Button();
this.maskedTextBoxNumber = new System.Windows.Forms.MaskedTextBox();
this.buttonAddShip = new System.Windows.Forms.Button();
this.labelCollection = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).BeginInit();
this.panelCollection.SuspendLayout();
this.groupBoxSets.SuspendLayout();
this.SuspendLayout();
//
// pictureBoxCollection
//
this.pictureBoxCollection.Location = new System.Drawing.Point(0, 0);
this.pictureBoxCollection.Name = "pictureBoxCollection";
this.pictureBoxCollection.Size = new System.Drawing.Size(864, 536);
this.pictureBoxCollection.TabIndex = 0;
this.pictureBoxCollection.TabStop = false;
//
// panelCollection
//
this.panelCollection.Controls.Add(this.groupBoxSets);
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(870, 0);
this.panelCollection.Name = "panelCollection";
this.panelCollection.Size = new System.Drawing.Size(218, 536);
this.panelCollection.TabIndex = 1;
//
// groupBoxSets
//
this.groupBoxSets.BackColor = System.Drawing.SystemColors.Control;
this.groupBoxSets.Controls.Add(this.buttonDelObject);
this.groupBoxSets.Controls.Add(this.listBoxStorages);
this.groupBoxSets.Controls.Add(this.buttonnAddObject);
this.groupBoxSets.Controls.Add(this.textBoxStorageName);
this.groupBoxSets.Location = new System.Drawing.Point(12, 42);
this.groupBoxSets.Name = "groupBoxSets";
this.groupBoxSets.Size = new System.Drawing.Size(199, 242);
this.groupBoxSets.TabIndex = 5;
this.groupBoxSets.TabStop = false;
this.groupBoxSets.Text = "Наборы";
//
// buttonDelObject
//
this.buttonDelObject.Location = new System.Drawing.Point(6, 207);
this.buttonDelObject.Name = "buttonDelObject";
this.buttonDelObject.Size = new System.Drawing.Size(187, 29);
this.buttonDelObject.TabIndex = 3;
this.buttonDelObject.Text = "Удалить набор";
this.buttonDelObject.UseVisualStyleBackColor = true;
//
// listBoxStorages
//
this.listBoxStorages.FormattingEnabled = true;
this.listBoxStorages.ItemHeight = 20;
this.listBoxStorages.Location = new System.Drawing.Point(6, 117);
this.listBoxStorages.Name = "listBoxStorages";
this.listBoxStorages.Size = new System.Drawing.Size(187, 84);
this.listBoxStorages.TabIndex = 2;
//
// buttonnAddObject
//
this.buttonnAddObject.Location = new System.Drawing.Point(4, 71);
this.buttonnAddObject.Name = "buttonnAddObject";
this.buttonnAddObject.Size = new System.Drawing.Size(189, 29);
this.buttonnAddObject.TabIndex = 1;
this.buttonnAddObject.Text = "Добавить набор";
this.buttonnAddObject.UseVisualStyleBackColor = true;
//
// textBoxStorageName
//
this.textBoxStorageName.Location = new System.Drawing.Point(0, 26);
this.textBoxStorageName.Name = "textBoxStorageName";
this.textBoxStorageName.Size = new System.Drawing.Size(193, 27);
this.textBoxStorageName.TabIndex = 0;
//
// buttonRefreshCollection
//
this.buttonRefreshCollection.Location = new System.Drawing.Point(16, 482);
this.buttonRefreshCollection.Name = "buttonRefreshCollection";
this.buttonRefreshCollection.Size = new System.Drawing.Size(171, 40);
this.buttonRefreshCollection.TabIndex = 4;
this.buttonRefreshCollection.Text = "Обновить коллекцию";
this.buttonRefreshCollection.UseVisualStyleBackColor = true;
//
// buttonRemoveShip
//
this.buttonRemoveShip.Location = new System.Drawing.Point(16, 424);
this.buttonRemoveShip.Name = "buttonRemoveShip";
this.buttonRemoveShip.Size = new System.Drawing.Size(171, 40);
this.buttonRemoveShip.TabIndex = 3;
this.buttonRemoveShip.Text = "Удалить теплоход";
this.buttonRemoveShip.UseVisualStyleBackColor = true;
//
// maskedTextBoxNumber
//
this.maskedTextBoxNumber.Location = new System.Drawing.Point(16, 375);
this.maskedTextBoxNumber.Name = "maskedTextBoxNumber";
this.maskedTextBoxNumber.Size = new System.Drawing.Size(171, 27);
this.maskedTextBoxNumber.TabIndex = 2;
//
// buttonAddShip
//
this.buttonAddShip.Location = new System.Drawing.Point(16, 309);
this.buttonAddShip.Name = "buttonAddShip";
this.buttonAddShip.Size = new System.Drawing.Size(171, 40);
this.buttonAddShip.TabIndex = 1;
this.buttonAddShip.Text = "Добавить теплоход";
this.buttonAddShip.UseVisualStyleBackColor = true;
//
// 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 = "Инструменты";
//
// FormShipCollection
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1093, 534);
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.groupBoxSets.ResumeLayout(false);
this.groupBoxSets.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;
private GroupBox groupBoxSets;
private Button buttonDelObject;
private ListBox listBoxStorages;
private Button buttonnAddObject;
private TextBox textBoxStorageName;
}
}

View File

@ -0,0 +1,20 @@
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();
}
}
}

View File

@ -0,0 +1,60 @@
<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>

View File

@ -0,0 +1,372 @@
namespace WarmlyShip
{
partial class FormShipConfig
{
/// <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.groupBoxParameters = new System.Windows.Forms.GroupBox();
this.labelSpeed = new System.Windows.Forms.Label();
this.labelWeight = new System.Windows.Forms.Label();
this.numericUpDownSpeed = new System.Windows.Forms.NumericUpDown();
this.numericUpDownWeight = new System.Windows.Forms.NumericUpDown();
this.checkBoxPipes = new System.Windows.Forms.CheckBox();
this.checkBoxSection = new System.Windows.Forms.CheckBox();
this.groupBoxColor = new System.Windows.Forms.GroupBox();
this.panelRed = new System.Windows.Forms.Panel();
this.panelGreen = new System.Windows.Forms.Panel();
this.panelWhite = new System.Windows.Forms.Panel();
this.panelYellow = new System.Windows.Forms.Panel();
this.panelBlue = new System.Windows.Forms.Panel();
this.panelGray = new System.Windows.Forms.Panel();
this.panelBlack = new System.Windows.Forms.Panel();
this.panelPurple = new System.Windows.Forms.Panel();
this.labelSimpleObject = new System.Windows.Forms.Label();
this.labelModifiedObject = new System.Windows.Forms.Label();
this.panelColor = new System.Windows.Forms.Panel();
this.labelBodyColor = new System.Windows.Forms.Label();
this.labelAddColor = new System.Windows.Forms.Label();
this.pictureBoxObject = new System.Windows.Forms.PictureBox();
this.button1 = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
this.groupBoxParameters.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).BeginInit();
this.groupBoxColor.SuspendLayout();
this.panelColor.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).BeginInit();
this.SuspendLayout();
//
// groupBoxParameters
//
this.groupBoxParameters.Controls.Add(this.labelModifiedObject);
this.groupBoxParameters.Controls.Add(this.labelSimpleObject);
this.groupBoxParameters.Controls.Add(this.groupBoxColor);
this.groupBoxParameters.Controls.Add(this.checkBoxSection);
this.groupBoxParameters.Controls.Add(this.checkBoxPipes);
this.groupBoxParameters.Controls.Add(this.numericUpDownWeight);
this.groupBoxParameters.Controls.Add(this.numericUpDownSpeed);
this.groupBoxParameters.Controls.Add(this.labelWeight);
this.groupBoxParameters.Controls.Add(this.labelSpeed);
this.groupBoxParameters.Location = new System.Drawing.Point(20, 12);
this.groupBoxParameters.Name = "groupBoxParameters";
this.groupBoxParameters.Size = new System.Drawing.Size(599, 347);
this.groupBoxParameters.TabIndex = 0;
this.groupBoxParameters.TabStop = false;
this.groupBoxParameters.Text = "Параметры";
//
// labelSpeed
//
this.labelSpeed.AutoSize = true;
this.labelSpeed.Location = new System.Drawing.Point(20, 45);
this.labelSpeed.Name = "labelSpeed";
this.labelSpeed.Size = new System.Drawing.Size(73, 20);
this.labelSpeed.TabIndex = 0;
this.labelSpeed.Text = "Скорость";
//
// labelWeight
//
this.labelWeight.AutoSize = true;
this.labelWeight.Location = new System.Drawing.Point(20, 97);
this.labelWeight.Name = "labelWeight";
this.labelWeight.Size = new System.Drawing.Size(33, 20);
this.labelWeight.TabIndex = 1;
this.labelWeight.Text = "Вес";
//
// numericUpDownSpeed
//
this.numericUpDownSpeed.Location = new System.Drawing.Point(117, 38);
this.numericUpDownSpeed.Maximum = new decimal(new int[] {
1000,
0,
0,
0});
this.numericUpDownSpeed.Minimum = new decimal(new int[] {
100,
0,
0,
0});
this.numericUpDownSpeed.Name = "numericUpDownSpeed";
this.numericUpDownSpeed.Size = new System.Drawing.Size(67, 27);
this.numericUpDownSpeed.TabIndex = 2;
this.numericUpDownSpeed.Value = new decimal(new int[] {
100,
0,
0,
0});
//
// numericUpDownWeight
//
this.numericUpDownWeight.Location = new System.Drawing.Point(117, 90);
this.numericUpDownWeight.Maximum = new decimal(new int[] {
1000,
0,
0,
0});
this.numericUpDownWeight.Minimum = new decimal(new int[] {
100,
0,
0,
0});
this.numericUpDownWeight.Name = "numericUpDownWeight";
this.numericUpDownWeight.Size = new System.Drawing.Size(58, 27);
this.numericUpDownWeight.TabIndex = 3;
this.numericUpDownWeight.Value = new decimal(new int[] {
100,
0,
0,
0});
//
// checkBoxPipes
//
this.checkBoxPipes.AutoSize = true;
this.checkBoxPipes.Location = new System.Drawing.Point(15, 152);
this.checkBoxPipes.Name = "checkBoxPipes";
this.checkBoxPipes.Size = new System.Drawing.Size(189, 24);
this.checkBoxPipes.TabIndex = 4;
this.checkBoxPipes.Text = "Признак наличия труб";
this.checkBoxPipes.UseVisualStyleBackColor = true;
//
// checkBoxSection
//
this.checkBoxSection.AutoSize = true;
this.checkBoxSection.Location = new System.Drawing.Point(15, 182);
this.checkBoxSection.Name = "checkBoxSection";
this.checkBoxSection.Size = new System.Drawing.Size(292, 24);
this.checkBoxSection.TabIndex = 5;
this.checkBoxSection.Text = "Признак наличия отсека для топлива";
this.checkBoxSection.UseVisualStyleBackColor = true;
//
// groupBoxColor
//
this.groupBoxColor.Controls.Add(this.panelPurple);
this.groupBoxColor.Controls.Add(this.panelBlack);
this.groupBoxColor.Controls.Add(this.panelGray);
this.groupBoxColor.Controls.Add(this.panelBlue);
this.groupBoxColor.Controls.Add(this.panelYellow);
this.groupBoxColor.Controls.Add(this.panelWhite);
this.groupBoxColor.Controls.Add(this.panelGreen);
this.groupBoxColor.Controls.Add(this.panelRed);
this.groupBoxColor.Location = new System.Drawing.Point(313, 38);
this.groupBoxColor.Name = "groupBoxColor";
this.groupBoxColor.Size = new System.Drawing.Size(271, 216);
this.groupBoxColor.TabIndex = 6;
this.groupBoxColor.TabStop = false;
this.groupBoxColor.Text = "Цвета";
//
// panelRed
//
this.panelRed.BackColor = System.Drawing.Color.Red;
this.panelRed.Location = new System.Drawing.Point(6, 39);
this.panelRed.Name = "panelRed";
this.panelRed.Size = new System.Drawing.Size(50, 50);
this.panelRed.TabIndex = 0;
//
// panelGreen
//
this.panelGreen.BackColor = System.Drawing.Color.Green;
this.panelGreen.Location = new System.Drawing.Point(74, 39);
this.panelGreen.Name = "panelGreen";
this.panelGreen.Size = new System.Drawing.Size(50, 50);
this.panelGreen.TabIndex = 1;
//
// panelWhite
//
this.panelWhite.BackColor = System.Drawing.Color.White;
this.panelWhite.Location = new System.Drawing.Point(6, 114);
this.panelWhite.Name = "panelWhite";
this.panelWhite.Size = new System.Drawing.Size(50, 50);
this.panelWhite.TabIndex = 2;
//
// panelYellow
//
this.panelYellow.BackColor = System.Drawing.Color.Yellow;
this.panelYellow.Location = new System.Drawing.Point(214, 39);
this.panelYellow.Name = "panelYellow";
this.panelYellow.Size = new System.Drawing.Size(50, 50);
this.panelYellow.TabIndex = 3;
//
// panelBlue
//
this.panelBlue.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192)))));
this.panelBlue.Location = new System.Drawing.Point(143, 39);
this.panelBlue.Name = "panelBlue";
this.panelBlue.Size = new System.Drawing.Size(50, 50);
this.panelBlue.TabIndex = 4;
//
// panelGray
//
this.panelGray.BackColor = System.Drawing.Color.Gray;
this.panelGray.Location = new System.Drawing.Point(74, 114);
this.panelGray.Name = "panelGray";
this.panelGray.Size = new System.Drawing.Size(50, 50);
this.panelGray.TabIndex = 5;
//
// panelBlack
//
this.panelBlack.BackColor = System.Drawing.Color.Black;
this.panelBlack.Location = new System.Drawing.Point(143, 114);
this.panelBlack.Name = "panelBlack";
this.panelBlack.Size = new System.Drawing.Size(50, 50);
this.panelBlack.TabIndex = 6;
//
// panelPurple
//
this.panelPurple.BackColor = System.Drawing.Color.Purple;
this.panelPurple.Location = new System.Drawing.Point(214, 114);
this.panelPurple.Name = "panelPurple";
this.panelPurple.Size = new System.Drawing.Size(50, 50);
this.panelPurple.TabIndex = 7;
//
// labelSimpleObject
//
this.labelSimpleObject.Font = new System.Drawing.Font("Segoe UI", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.labelSimpleObject.Location = new System.Drawing.Point(313, 273);
this.labelSimpleObject.Name = "labelSimpleObject";
this.labelSimpleObject.Size = new System.Drawing.Size(124, 36);
this.labelSimpleObject.TabIndex = 7;
this.labelSimpleObject.Text = "Простой";
this.labelSimpleObject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// labelModifiedObject
//
this.labelModifiedObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.labelModifiedObject.Font = new System.Drawing.Font("Segoe UI", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.labelModifiedObject.Location = new System.Drawing.Point(456, 273);
this.labelModifiedObject.Name = "labelModifiedObject";
this.labelModifiedObject.Size = new System.Drawing.Size(121, 36);
this.labelModifiedObject.TabIndex = 8;
this.labelModifiedObject.Text = "Продвинутый";
this.labelModifiedObject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// panelColor
//
this.panelColor.Controls.Add(this.buttonCancel);
this.panelColor.Controls.Add(this.button1);
this.panelColor.Controls.Add(this.pictureBoxObject);
this.panelColor.Controls.Add(this.labelAddColor);
this.panelColor.Controls.Add(this.labelBodyColor);
this.panelColor.Location = new System.Drawing.Point(625, 11);
this.panelColor.Name = "panelColor";
this.panelColor.Size = new System.Drawing.Size(355, 351);
this.panelColor.TabIndex = 1;
//
// labelBodyColor
//
this.labelBodyColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.labelBodyColor.Font = new System.Drawing.Font("Segoe UI", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.labelBodyColor.Location = new System.Drawing.Point(44, 30);
this.labelBodyColor.Name = "labelBodyColor";
this.labelBodyColor.Size = new System.Drawing.Size(124, 36);
this.labelBodyColor.TabIndex = 0;
this.labelBodyColor.Text = "Цвет";
this.labelBodyColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// labelAddColor
//
this.labelAddColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.labelAddColor.Font = new System.Drawing.Font("Segoe UI", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.labelAddColor.Location = new System.Drawing.Point(200, 30);
this.labelAddColor.Name = "labelAddColor";
this.labelAddColor.Size = new System.Drawing.Size(124, 36);
this.labelAddColor.TabIndex = 1;
this.labelAddColor.Text = "Доп. цвет";
this.labelAddColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// pictureBoxObject
//
this.pictureBoxObject.Location = new System.Drawing.Point(15, 78);
this.pictureBoxObject.Name = "pictureBoxObject";
this.pictureBoxObject.Size = new System.Drawing.Size(332, 213);
this.pictureBoxObject.TabIndex = 2;
this.pictureBoxObject.TabStop = false;
//
// button1
//
this.button1.Location = new System.Drawing.Point(44, 297);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(124, 32);
this.button1.TabIndex = 3;
this.button1.Text = "Добавить";
this.button1.UseVisualStyleBackColor = true;
//
// buttonCancel
//
this.buttonCancel.Location = new System.Drawing.Point(200, 297);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(124, 32);
this.buttonCancel.TabIndex = 4;
this.buttonCancel.Text = "Отмена";
this.buttonCancel.UseVisualStyleBackColor = true;
//
// FormShipConfig
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(986, 369);
this.Controls.Add(this.panelColor);
this.Controls.Add(this.groupBoxParameters);
this.Name = "FormShipConfig";
this.Text = "FormShipConfig";
this.groupBoxParameters.ResumeLayout(false);
this.groupBoxParameters.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).EndInit();
this.groupBoxColor.ResumeLayout(false);
this.panelColor.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).EndInit();
this.ResumeLayout(false);
}
#endregion
private GroupBox groupBoxParameters;
private Label labelModifiedObject;
private Label labelSimpleObject;
private GroupBox groupBoxColor;
private Panel panelPurple;
private Panel panelBlack;
private Panel panelGray;
private Panel panelBlue;
private Panel panelYellow;
private Panel panelWhite;
private Panel panelGreen;
private Panel panelRed;
private CheckBox checkBoxSection;
private CheckBox checkBoxPipes;
private NumericUpDown numericUpDownWeight;
private NumericUpDown numericUpDownSpeed;
private Label labelWeight;
private Label labelSpeed;
private Panel panelColor;
private Button buttonCancel;
private Button button1;
private PictureBox pictureBoxObject;
private Label labelAddColor;
private Label labelBodyColor;
}
}

View File

@ -0,0 +1,20 @@
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 FormShipConfig : Form
{
public FormShipConfig()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,60 @@
<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>

View File

@ -0,0 +1,179 @@
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;
}
}

View File

@ -0,0 +1,20 @@
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)
{
}
}
}

View File

@ -0,0 +1,60 @@
<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>

View File

@ -0,0 +1,18 @@
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);
}
}

View File

@ -1,11 +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>
</Project>

View File

@ -1,8 +0,0 @@
<?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>

View File

@ -0,0 +1,57 @@
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();
}
}
}
}
}

View File

@ -0,0 +1,56 @@
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();
}
}
}
}
}

View File

@ -0,0 +1,29 @@
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;
}
}
}

View File

@ -1,4 +1,4 @@
namespace MotorShip namespace WarmlyShip
{ {
internal static class Program internal static class Program
{ {
@ -11,7 +11,7 @@ namespace MotorShip
// 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 Form1()); Application.Run(new FormShipCollection());
} }
} }
} }

View File

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <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;
}
}
}
}

View File

@ -0,0 +1,114 @@
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 List<T?> _places;
/// Количество объектов в массиве
/// </summary>
public int Count => _places.Count;
/// <summary>
/// Максимальное количество объектов в списке
/// </summary>
private readonly int _maxCount;
/// <summary>
/// Конструктор
/// </summary>
/// <param name="count"></param>
public SetGeneric(int count)
{
_maxCount = count;
_places = new List<T?>(count);
}
/// <summary>
/// Добавление объекта в набор
/// </summary>
/// <param name="warmlyship">Добавляемый теплоход</param>
/// <returns></returns>
public bool Insert(T warmlyship)
{
if (_places.Count == _maxCount)
{
return false;
}
Insert(warmlyship, 0);
return true;
}
/// <summary>
/// Добавление объекта в набор на конкретную позицию
/// </summary>
/// <param name="warmlyship">Добавляемый теплоход</param>
/// <param name="position">Позиция</param>
/// <returns></returns>
public bool Insert(T warmlyship, int position)
{
if (!(position >= 0 && position <= Count && _places.Count < _maxCount))
{
return false;
}
_places.Insert(position, warmlyship);
return true;
}
/// <summary>
/// Удаление объекта из набора с конкретной позиции
/// </summary>
/// <param name="position"></param>
/// <returns></returns>
public bool Remove(int position)
{
if (position < 0 || position >= Count)
{
return false;
}
_places.RemoveAt(position);
return true;
}
/// <summary>
/// Получение объекта из набора по позиции
/// </summary>
/// <param name="position"></param>
/// <returns></returns>
public T? this[int position]
{
get
{
if (position < 0 || position >= Count)
{
return null;
}
return _places[position];
}
set
{
if (!(position >= 0 && position < Count && _places.Count < _maxCount))
{
return;
}
_places.Insert(position, value);
return;
}
}
public IEnumerable<T> GetShips(int? maxShips = null)
{
for (int i = 0; i < _places.Count; ++i)
{
yield return _places[i];
if (maxShips.HasValue && i == maxShips.Value)
{
yield break;
}
}
}
}
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WarmlyShip.DrawingObjects;
namespace WarmlyShip
{
internal class ShipDelegate
{
/// <summary>
/// Делегат для передачи объекта-теплоход
/// </summary>
/// <param name="ship"></param>
public delegate void Action(DrawingWarmlyShip ship);
}
}

View File

@ -0,0 +1,144 @@
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 bool operator +(ShipsGenericCollection<T, U> collect, T?
obj)
{
if (obj == null)
{
return false;
}
return (bool)collect?._collection.Insert(obj);
}
/// <summary>
/// Перегрузка оператора вычитания
/// </summary>
/// <param name="collect"></param>
/// <param name="pos"></param>
/// <returns></returns>
public static T? operator -(ShipsGenericCollection<T, U> collect, int
pos)
{
T? obj = collect._collection[pos];
if (obj != null)
{
collect._collection.Remove(pos);
}
return obj;
}
/// <summary>
/// Получение объекта IMoveableObject
/// </summary>
/// <param name="pos"></param>
/// <returns></returns>
public U? GetU(int pos)
{
return (U?)_collection[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)
{
int i = 0;
foreach (var ship in _collection.GetShips())
{
if (ship != null)
{
int width = _pictureWidth / _placeSizeWidth;
ship._pictureWidth = _pictureWidth;
ship._pictureHeight = _pictureHeight;
ship.SetPosition((width - 1 - (i % width)) * _placeSizeWidth, i / width * _placeSizeHeight);
ship.DrawTransport(g);
}
i++;
}
}
}
}

View File

@ -0,0 +1,87 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WarmlyShip.DrawingObjects;
using WarmlyShip.MovementStrategy;
namespace WarmlyShip.Generics
{
/// <summary>
/// Класс для хранения коллекции
/// </summary>
internal class ShipsGenericStorage
{
/// <summary>
/// Словарь (хранилище)
/// </summary>
readonly Dictionary<string, ShipsGenericCollection<DrawingWarmlyShip,
DrawingObjectShip>> _shipStorages;
/// <summary>
/// Возвращение списка названий наборов
/// </summary>
public List<string> Keys => _shipStorages.Keys.ToList();
/// <summary>
/// Ширина окна отрисовки
/// </summary>
private readonly int _pictureWidth;
/// <summary>
/// Высота окна отрисовки
/// </summary>
private readonly int _pictureHeight;
/// <summary>
/// Конструктор
/// </summary>
/// <param name="pictureWidth"></param>
/// <param name="pictureHeight"></param>
public ShipsGenericStorage(int pictureWidth, int pictureHeight)
{
_shipStorages = new Dictionary<string,
ShipsGenericCollection<DrawingWarmlyShip, DrawingObjectShip>>();
_pictureWidth = pictureWidth;
_pictureHeight = pictureHeight;
}
/// <summary>
/// Добавление набора
/// </summary>
/// <param name="name">Название набора</param>
public void AddSet(string name)
{
if (_shipStorages.ContainsKey(name))
{
return;
}
_shipStorages[name] = new ShipsGenericCollection<DrawingWarmlyShip, DrawingObjectShip>(_pictureWidth, _pictureHeight);
}
/// <summary>
/// Удаление набора
/// </summary>
/// <param name="name">Название набора</param>
public void DelSet(string name)
{
if (!_shipStorages.ContainsKey(name))
{
return;
}
_shipStorages.Remove(name);
}
/// <summary>
/// Доступ к набору
/// </summary>
/// <param name="ind"></param>
/// <returns></returns>
public ShipsGenericCollection<DrawingWarmlyShip, DrawingObjectShip>?
this[string ind]
{
get
{
if (_shipStorages.ContainsKey(ind))
{
return _shipStorages[ind];
}
return null;
}
}
}
}

View File

@ -0,0 +1,15 @@
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
}
}

View File

@ -0,0 +1,26 @@
<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>

View File

@ -0,0 +1,14 @@
<?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="FormShipConfig.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="FormWarmlyShip.cs">
<SubType>Form</SubType>
</Compile>
</ItemGroup>
</Project>

View File

@ -0,0 +1,23 @@
{
"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": ""
}
}
}

View File

@ -0,0 +1,15 @@
{
"runtimeOptions": {
"tfm": "net6.0",
"frameworks": [
{
"name": "Microsoft.NETCore.App",
"version": "6.0.0"
},
{
"name": "Microsoft.WindowsDesktop.App",
"version": "6.0.0"
}
]
}
}

View File

@ -0,0 +1,25 @@
//------------------------------------------------------------------------------
// <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.

View File

@ -0,0 +1 @@
9e4fa9fd1ecdd07181264594cdb4ea30b2f8e7a9

View File

@ -0,0 +1,16 @@
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\

View File

@ -0,0 +1,10 @@
// <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;

View File

@ -0,0 +1 @@
b0cc6ac0be05ffb8fdd9efd25a085f52551f71ce

View File

@ -0,0 +1,20 @@
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
C:\Users\Екатерина\OneDrive\Desktop\РПП\MotorShip\MotorShip\obj\Debug\net6.0-windows\WarmlyShip.FormShipConfig.resources

View File

@ -0,0 +1,11 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v6.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v6.0": {}
},
"libraries": {}
}

View File

@ -0,0 +1,23 @@
{
"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
}
}
}

View File

@ -0,0 +1 @@
b5ff27391765f54d26fb3871c8501fdc7aeba875

View File

@ -0,0 +1 @@
obj\Debug\net6.0-windows\\_IsIncrementalBuild

View File

@ -0,0 +1,71 @@
{
"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"
}
}
}
}
}

View File

@ -0,0 +1,16 @@
<?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>

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />

View File

@ -14,9 +14,9 @@
"project": { "project": {
"version": "1.0.0", "version": "1.0.0",
"restore": { "restore": {
"projectUniqueName": "C:\\Users\\Екатерина\\OneDrive\\Desktop\\РПП\\MotorShip\\MotorShip\\MotorShip.csproj", "projectUniqueName": "C:\\Users\\Екатерина\\OneDrive\\Desktop\\РПП\\MotorShip\\MotorShip\\WarmlyShip.csproj",
"projectName": "MotorShip", "projectName": "WarmlyShip",
"projectPath": "C:\\Users\\Екатерина\\OneDrive\\Desktop\\РПП\\MotorShip\\MotorShip\\MotorShip.csproj", "projectPath": "C:\\Users\\Екатерина\\OneDrive\\Desktop\\РПП\\MotorShip\\MotorShip\\WarmlyShip.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",

View File

@ -1,8 +1,8 @@
{ {
"version": 2, "version": 2,
"dgSpecHash": "bnUESf/Rv6V72tUo+jhmSGhXmC6Pqj7O2CTNWB9EejNBsTYuPhenT/pJ78ztAR8PVDXUh5QMU+FThm53y2XUQg==", "dgSpecHash": "aDampGwy73k7qtg/YN7p9IeoOxrz4wCzs0qYdTQADvRaI/+G2V69SclPzeFFbFSm7K1+pDPW7S+T49iijnW1Xg==",
"success": true, "success": true,
"projectFilePath": "C:\\Users\\Екатерина\\OneDrive\\Desktop\\РПП\\MotorShip\\MotorShip\\MotorShip.csproj", "projectFilePath": "C:\\Users\\Екатерина\\OneDrive\\Desktop\\РПП\\MotorShip\\MotorShip\\WarmlyShip.csproj",
"expectedPackageFiles": [], "expectedPackageFiles": [],
"logs": [] "logs": []
} }

View File

@ -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("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MotorShip", "MotorShip\MotorShip.csproj", "{93B18DF4-AAEC-4934-9DA3-99513CAABB98}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WarmlyShip", "MotorShip\WarmlyShip.csproj", "{93B18DF4-AAEC-4934-9DA3-99513CAABB98}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@ -0,0 +1,75 @@
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;
}
}
}

Some files were not shown because too many files have changed in this diff Show More