This commit is contained in:
pnevmoslon1 2024-04-09 07:29:48 +04:00
parent 16a64b9ff7
commit 37b09eeac5
13 changed files with 719 additions and 67 deletions

View File

@ -0,0 +1,74 @@
using WarmlyShip.CollectionGenericObjects;
using WarmlyShip.Drawnings;
namespace WarmlyShip.CollectionGenericObjects;
public abstract class AbstractCompany
{
protected readonly int _placeSizeWidth = 150;
protected readonly int _placeSizeHeight = 80;
protected readonly int _pictureWidth;
protected readonly int _pictureHeight;
protected ICollectionGenericObjects<DrawningShip> _collection = null;
private int GetMaxCount => _pictureWidth * _pictureHeight / ((_placeSizeWidth + _placeSizeWidth /2) * _placeSizeHeight) - 1;
public AbstractCompany(int picWidth, int picHeight, ICollectionGenericObjects<DrawningShip> collection)
{
_pictureWidth = picWidth;
_pictureHeight = picHeight;
_collection = collection;
_collection.SetMaxCount = GetMaxCount;
}
public static int operator +(AbstractCompany company, DrawningShip ship)
{
return company._collection.Insert(ship);
}
public static DrawningShip operator -(AbstractCompany company, int position)
{
return company._collection.Remove(position);
}
public DrawningShip? GetRandomObject()
{
Random rnd = new();
return _collection?.Get(rnd.Next(GetMaxCount));
}
public Bitmap? Show()
{
Bitmap bitmap = new(_pictureWidth, _pictureHeight);
Graphics graphics = Graphics.FromImage(bitmap);
DrawBackgroud(graphics);
SetObjectPosition();
for (int i = 0; i < (_collection?.Count ?? 0); i++)
{
DrawningShip? obj = _collection?.Get(i);
obj?.DrawTransport(graphics);
}
return bitmap;
}
protected abstract void DrawBackgroud(Graphics g);
protected abstract void SetObjectPosition();
}

View File

@ -0,0 +1,24 @@
namespace WarmlyShip.CollectionGenericObjects;
public interface ICollectionGenericObjects<T>
where T : class
{
int Count { get; }
int SetMaxCount { set; }
int Insert(T obj);
int Insert(T obj, int position);
T Remove(int position);
T? Get(int position);
}

View File

@ -0,0 +1,117 @@
namespace WarmlyShip.CollectionGenericObjects;
public class MassiveGenericObjects<T> : ICollectionGenericObjects<T>
where T : class
{
private T?[] _collection;
public int Count => _collection.Length;
public int SetMaxCount
{
set
{
if (value > 0)
{
if (Count > 0)
{
Array.Resize(ref _collection, value);
}
else
{
_collection = new T?[value];
}
}
}
}
public MassiveGenericObjects()
{
_collection = Array.Empty<T?>();
}
public T? Get(int position)
{
// TODO проверка позиции
if (position < 0 || position > Count)
{
return null;
}
return _collection[position];
}
public int Insert(T obj)
{
// TODO вставка в свободное место набора
for (int i = 0; i < Count; i++)
{
if (_collection[i] == null)
{
_collection[i] = obj;
return i;
}
}
return -1;
}
public int Insert(T obj, int position)
{
// TODO проверка позиции
// TODO проверка, что элемент массима по этой позиции пустой,
// если элемент массима по этой позиции не пустой,
// найти свободное место после этой позиции, если не найдено,
// то искать до
// TODO вставка
if (position < 0 || position >= Count)
{
return -1;
}
if (_collection[position] == null)
{
_collection[position] = obj;
return position;
}
else
{
for (int i = position + 1; i < Count; i++)
{
if (_collection[i] == null)
{
_collection[i] = obj;
return i;
}
}
for (int i = position; i >= 0; i--)
{
if (_collection[i] == null)
{
_collection[i] = obj;
return i;
}
}
}
return -1;
}
public T Remove(int position)
{
// TODO проверка позиции
// TODO удаление объекта из массива,
// присвоив элементу массива значение null
if (position >= Count || position < 0)
{
return null;
}
T obj = _collection[position];
_collection[position] = null;
return obj;
}
}

View File

@ -0,0 +1,53 @@
using WarmlyShip.CollectionGenericObjects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WarmlyShip.Drawnings;
namespace WarmlyShip.CollectionGenericObjects
{
public class PortForShips : AbstractCompany
{
public PortForShips(int picWidth, int picHeight, ICollectionGenericObjects<DrawningShip> collection) : base(picWidth, picHeight, collection)
{
}
protected override void DrawBackgroud(Graphics g)
{
int _placeWidth = _placeSizeWidth + _placeSizeWidth / 2;
int _placeHeight = _placeSizeHeight;
for (int x = 2; x < _pictureWidth - _placeSizeWidth; x += _placeWidth)
{
for (int y = 2; y < _pictureHeight - _placeSizeHeight; y += _placeHeight)
{
Pen pen = new Pen(Color.Black, 3);
Point[] points =
{
new Point(x + _placeSizeWidth, y),
new Point(x, y),
new Point(x, y + _placeSizeHeight),
new Point(x + _placeSizeWidth, y + _placeSizeHeight)
};
g.DrawLines(pen, points);
}
}
}
protected override void SetObjectPosition()
{
int countOfHorizontal = _pictureWidth / (_placeSizeWidth + _placeSizeWidth / 2) + 1;
int countOfVertical = _pictureHeight / _placeSizeHeight;
for (int i = 1; i < _collection.Count; i++)
{
if (_collection.Get(i) != null)
{
_collection.Get(i)?.SetPictureSize(_pictureWidth, _pictureHeight);
_collection.Get(i)?.SetPosition((_placeSizeWidth + _placeSizeWidth / 2) * (i % countOfHorizontal - 1) + 5,
_placeSizeHeight * (i / countOfHorizontal - 1) + 5);
}
}
}
}
}

View File

@ -151,7 +151,7 @@ public class DrawningShip
return;
}
// нарисовать корабль
Pen pen = new(Color.Black, 2);
Brush brMain = new SolidBrush(EntityShip.BodyColor);

View File

@ -0,0 +1,170 @@
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()
{
groupBoxTools = new GroupBox();
buttonRefresh = new Button();
buttonGoToCheck = new Button();
buttonRemoveShip = new Button();
maskedTextBoxPosition = new MaskedTextBox();
buttonAddWarmlyShip = new Button();
buttonAddShip = new Button();
comboBoxSelectorCompany = new ComboBox();
pictureBox = new PictureBox();
groupBoxTools.SuspendLayout();
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
SuspendLayout();
//
// groupBoxTools
//
groupBoxTools.Controls.Add(buttonRefresh);
groupBoxTools.Controls.Add(buttonGoToCheck);
groupBoxTools.Controls.Add(buttonRemoveShip);
groupBoxTools.Controls.Add(maskedTextBoxPosition);
groupBoxTools.Controls.Add(buttonAddWarmlyShip);
groupBoxTools.Controls.Add(buttonAddShip);
groupBoxTools.Controls.Add(comboBoxSelectorCompany);
groupBoxTools.Dock = DockStyle.Right;
groupBoxTools.Location = new Point(961, 0);
groupBoxTools.Name = "groupBoxTools";
groupBoxTools.Size = new Size(187, 521);
groupBoxTools.TabIndex = 0;
groupBoxTools.TabStop = false;
groupBoxTools.Text = "Инструменты";
//
// buttonRefresh
//
buttonRefresh.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
buttonRefresh.Location = new Point(6, 473);
buttonRefresh.Name = "buttonRefresh";
buttonRefresh.Size = new Size(175, 36);
buttonRefresh.TabIndex = 7;
buttonRefresh.Text = "Обновить";
buttonRefresh.UseVisualStyleBackColor = true;
buttonRefresh.Click += ButtonRefresh_Click;
//
// buttonGoToCheck
//
buttonGoToCheck.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonGoToCheck.Location = new Point(6, 290);
buttonGoToCheck.Name = "buttonGoToCheck";
buttonGoToCheck.Size = new Size(175, 36);
buttonGoToCheck.TabIndex = 6;
buttonGoToCheck.Text = "Передать на тесты";
buttonGoToCheck.UseVisualStyleBackColor = true;
buttonGoToCheck.Click += ButtonGoToCheck_Click;
//
// buttonRemoveShip
//
buttonRemoveShip.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonRemoveShip.Location = new Point(6, 191);
buttonRemoveShip.Name = "buttonRemoveShip";
buttonRemoveShip.Size = new Size(175, 36);
buttonRemoveShip.TabIndex = 5;
buttonRemoveShip.Text = "Удаление судна";
buttonRemoveShip.UseVisualStyleBackColor = true;
buttonRemoveShip.Click += ButtonRemoveShip_Click;
//
// maskedTextBoxPosition
//
maskedTextBoxPosition.Location = new Point(6, 152);
maskedTextBoxPosition.Mask = "00";
maskedTextBoxPosition.Name = "maskedTextBoxPosition";
maskedTextBoxPosition.Size = new Size(181, 23);
maskedTextBoxPosition.TabIndex = 4;
maskedTextBoxPosition.ValidatingType = typeof(int);
//
// buttonAddWarmlyShip
//
buttonAddWarmlyShip.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonAddWarmlyShip.Location = new Point(6, 90);
buttonAddWarmlyShip.Name = "buttonAddWarmlyShip";
buttonAddWarmlyShip.Size = new Size(175, 36);
buttonAddWarmlyShip.TabIndex = 2;
buttonAddWarmlyShip.Text = "Добавление парохода";
buttonAddWarmlyShip.UseVisualStyleBackColor = true;
buttonAddWarmlyShip.Click += ButtonAddWarmlyShip_Click;
//
// buttonAddShip
//
buttonAddShip.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
buttonAddShip.Location = new Point(6, 48);
buttonAddShip.Name = "buttonAddShip";
buttonAddShip.Size = new Size(175, 36);
buttonAddShip.TabIndex = 1;
buttonAddShip.Text = "Добавление корабля";
buttonAddShip.UseVisualStyleBackColor = true;
buttonAddShip.Click += ButtonAddShip_Click;
//
// comboBoxSelectorCompany
//
comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" });
comboBoxSelectorCompany.Location = new Point(6, 22);
comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
comboBoxSelectorCompany.Size = new Size(175, 23);
comboBoxSelectorCompany.TabIndex = 8;
comboBoxSelectorCompany.SelectedIndexChanged += ComboBoxSelectorCompany_SelectedIndexChanged;
//
// pictureBox
//
pictureBox.Dock = DockStyle.Fill;
pictureBox.Location = new Point(0, 0);
pictureBox.Name = "pictureBox";
pictureBox.Size = new Size(961, 521);
pictureBox.TabIndex = 3;
pictureBox.TabStop = false;
//
// FormShipCollection
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1148, 521);
Controls.Add(pictureBox);
Controls.Add(groupBoxTools);
Name = "FormShipCollection";
Text = "Коллекция кораблей";
groupBoxTools.ResumeLayout(false);
groupBoxTools.PerformLayout();
((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
ResumeLayout(false);
}
#endregion
private GroupBox groupBoxTools;
private ComboBox comboBoxSelectorCompany;
private Button buttonAddWarmlyShip;
private Button buttonAddShip;
private PictureBox pictureBox;
private Button buttonRemoveShip;
private MaskedTextBox maskedTextBoxPosition;
private Button buttonRefresh;
private Button buttonGoToCheck;
}
}

View File

@ -0,0 +1,144 @@
using WarmlyShip.CollectionGenericObjects;
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;
using WarmlyShip.Drawnings;
namespace WarmlyShip
{
public partial class FormShipCollection : Form
{
public FormShipCollection()
{
InitializeComponent();
}
private AbstractCompany? _company = null;
private void ComboBoxSelectorCompany_SelectedIndexChanged(Object sender, EventArgs e)
{
switch (comboBoxSelectorCompany.Text)
{
case "Хранилище":
_company = new PortForShips(pictureBox.Width, pictureBox.Height, new MassiveGenericObjects<DrawningShip>());
break;
}
}
private void CreateObject(string type)
{
if (_company == null)
{
return;
}
Random random = new();
DrawningShip drawningShip;
switch (type)
{
case nameof(DrawningShip):
drawningShip = new DrawningShip(random.Next(100, 300), random.Next(1000, 3000), GetColor(random));
break;
case nameof(DrawningWarmlyShip):
drawningShip = new DrawningWarmlyShip(random.Next(100, 300), random.Next(1000, 3000),
GetColor(random), GetColor(random), true, true);
break;
default:
return;
}
if (_company + drawningShip != -1)
{
MessageBox.Show("Объект добавлен");
pictureBox.Image = _company.Show();
}
else
{
MessageBox.Show("Не удалось добавить объект");
}
}
private void ButtonAddShip_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningShip));
private void ButtonAddWarmlyShip_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningWarmlyShip));
private static Color GetColor(Random random)
{
Color color = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
ColorDialog dialog = new();
if (dialog.ShowDialog() == DialogResult.OK)
{
color = dialog.Color;
}
return color;
}
private void ButtonRemoveShip_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(maskedTextBoxPosition.Text) || _company == null)
{
return;
}
if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
{
return;
}
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
if (_company - pos != null)
{
MessageBox.Show("Объект удален");
pictureBox.Image = _company.Show();
}
else
{
MessageBox.Show("Не удалось удалить объект");
}
}
private void ButtonGoToCheck_Click(object sender, EventArgs e)
{
if (_company == null)
{
return;
}
DrawningShip? ship = null;
int counter = 100;
while (ship == null)
{
ship = _company.GetRandomObject();
counter--;
if (counter <= 0)
{
break;
}
}
if (ship == null)
{
return;
}
FormShips form = new()
{
SetShip = ship
};
form.ShowDialog();
}
private void ButtonRefresh_Click(object sender, EventArgs e)
{
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<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

@ -33,8 +33,6 @@
buttonUp = new Button();
buttonRight = new Button();
buttonLeft = new Button();
buttonCreateWarmlyShip = new Button();
buttonCreateShip = new Button();
comboBoxStrategy = new ComboBox();
buttonStrategyStep = new Button();
((System.ComponentModel.ISupportInitialize)pictureBoxShips).BeginInit();
@ -97,28 +95,6 @@
buttonLeft.UseVisualStyleBackColor = true;
buttonLeft.Click += ButtonMove_Click;
//
// buttonCreateWarmlyShip
//
buttonCreateWarmlyShip.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
buttonCreateWarmlyShip.Location = new Point(12, 458);
buttonCreateWarmlyShip.Name = "buttonCreateWarmlyShip";
buttonCreateWarmlyShip.Size = new Size(161, 23);
buttonCreateWarmlyShip.TabIndex = 6;
buttonCreateWarmlyShip.Text = "создать пароход";
buttonCreateWarmlyShip.UseVisualStyleBackColor = true;
buttonCreateWarmlyShip.Click += buttonCreate_Click;
//
// buttonCreateShip
//
buttonCreateShip.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
buttonCreateShip.Location = new Point(179, 458);
buttonCreateShip.Name = "buttonCreateShip";
buttonCreateShip.Size = new Size(161, 23);
buttonCreateShip.TabIndex = 11;
buttonCreateShip.Text = "создать лодку";
buttonCreateShip.UseVisualStyleBackColor = true;
buttonCreateShip.Click += buttonCreateShip_Click;
//
// comboBoxStrategy
//
comboBoxStrategy.DropDownStyle = ComboBoxStyle.DropDownList;
@ -146,12 +122,10 @@
ClientSize = new Size(854, 493);
Controls.Add(buttonStrategyStep);
Controls.Add(comboBoxStrategy);
Controls.Add(buttonCreateShip);
Controls.Add(buttonDown);
Controls.Add(buttonUp);
Controls.Add(buttonRight);
Controls.Add(buttonLeft);
Controls.Add(buttonCreateWarmlyShip);
Controls.Add(pictureBoxShips);
Name = "FormShips";
StartPosition = FormStartPosition.CenterScreen;
@ -167,8 +141,6 @@
private Button buttonUp;
private Button buttonRight;
private Button buttonLeft;
private Button buttonCreateWarmlyShip;
private Button buttonCreateShip;
private ComboBox comboBoxStrategy;
private Button buttonStrategyStep;
}

View File

@ -18,6 +18,19 @@ namespace WarmlyShip
private DrawningShip? _drawningShip;
private AbstractStrategy? _strategy;
public DrawningShip SetShip
{
set
{
_drawningShip = value;
_drawningShip.SetPictureSize(pictureBoxShips.Width, pictureBoxShips.Height);
comboBoxStrategy.Enabled = true;
_strategy = null;
Draw();
}
}
public FormShips()
{
InitializeComponent();
@ -38,36 +51,7 @@ namespace WarmlyShip
pictureBoxShips.Image = bmp;
}
private void CreateObject(string type)
{
Random random = new();
switch (type)
{
case nameof(DrawningShip):
_drawningShip = new DrawningShip(random.Next(100, 300), random.Next(1000, 3000),
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)));
break;
case nameof(DrawningWarmlyShip):
_drawningShip = new DrawningWarmlyShip(random.Next(100, 300), random.Next(1000, 3000),
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
break;
default:
return;
}
_strategy = null;
_drawningShip.SetPictureSize(pictureBoxShips.Width, pictureBoxShips.Height);
_drawningShip.SetPosition(random.Next(10, 100), random.Next(10, 100));
comboBoxStrategy.Enabled = true;
Draw();
}
private void buttonCreate_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningWarmlyShip));
private void buttonCreateShip_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningShip));
private void ButtonMove_Click(object sender, EventArgs e)
{

View File

@ -1,6 +1,6 @@
using WarmlyShip.MovementStrategy;
using WarmlyShip.Drawnings;
using WarmlyShip.MovementStrategy;
namespace ProjectShip.MovementStrategy;

View File

@ -11,7 +11,7 @@ namespace WarmlyShip
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new FormShips());
Application.Run(new FormShipCollection());
}
}
}

View File

@ -8,12 +8,6 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<Compile Remove="NewFolder\**" />
<EmbeddedResource Remove="NewFolder\**" />
<None Remove="NewFolder\**" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>