Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
9c3fb88fab | |||
80ef61aef3 | |||
37b09eeac5 | |||
16a64b9ff7 | |||
f526a5f2bc | |||
b5fa935cf2 | |||
ec127f33aa | |||
802379a969 |
@ -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 = 85;
|
||||
|
||||
|
||||
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();
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
namespace WarmlyShip.CollectionGenericObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Тип коллекции
|
||||
/// </summary>
|
||||
public enum CollectionType
|
||||
{
|
||||
None = 0,
|
||||
|
||||
Massive = 1,
|
||||
|
||||
List = 2
|
||||
}
|
@ -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);
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
namespace WarmlyShip.CollectionGenericObjects;
|
||||
|
||||
|
||||
public class ListGenericObjects<T> : ICollectionGenericObjects<T> where T : class
|
||||
{
|
||||
|
||||
private readonly List<T> _collection;
|
||||
|
||||
private int _maxCount;
|
||||
|
||||
public int Count => _collection.Count;
|
||||
|
||||
public int SetMaxCount
|
||||
{
|
||||
set
|
||||
{
|
||||
if (value > 0)
|
||||
{
|
||||
_maxCount = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ListGenericObjects()
|
||||
{
|
||||
_collection = new();
|
||||
}
|
||||
|
||||
public T? Get(int position)
|
||||
{
|
||||
if (position < 0 || position >= Count)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return _collection[position];
|
||||
}
|
||||
|
||||
public int Insert(T obj)
|
||||
{
|
||||
if (Count == _maxCount)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
_collection.Add(obj);
|
||||
return Count;
|
||||
}
|
||||
|
||||
public int Insert(T obj, int position)
|
||||
{
|
||||
if (Count == _maxCount)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if (position >= Count || position < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
_collection.Insert(position, obj);
|
||||
return position;
|
||||
}
|
||||
|
||||
public T Remove(int position)
|
||||
{
|
||||
if (position >= Count || position < 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
T obj = _collection[position];
|
||||
_collection.RemoveAt(position);
|
||||
return obj;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
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);
|
||||
int countOfVertical = _pictureHeight / _placeSizeHeight;
|
||||
|
||||
int countW = 0;
|
||||
int countH = 0;
|
||||
|
||||
for (int i = 1; i < _collection.Count; i++)
|
||||
{
|
||||
|
||||
if (countW == 4)
|
||||
{
|
||||
countW = 0;
|
||||
countH++;
|
||||
}
|
||||
if (_collection.Get(i) != null)
|
||||
{
|
||||
|
||||
_collection.Get(i)?.SetPictureSize(_pictureWidth, _pictureHeight);
|
||||
|
||||
_collection.Get(i)?.SetPosition((_placeSizeWidth + _placeSizeWidth / 2) * (countOfHorizontal - countW - 1) + 5, _placeSizeHeight * countH + 5);
|
||||
|
||||
}
|
||||
countW++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
namespace WarmlyShip.CollectionGenericObjects;
|
||||
|
||||
|
||||
public class StorageCollection<T> where T : class
|
||||
{
|
||||
|
||||
readonly Dictionary<string, ICollectionGenericObjects<T>> _storages;
|
||||
|
||||
public List<string> Keys => _storages.Keys.ToList();
|
||||
|
||||
public StorageCollection()
|
||||
{
|
||||
_storages = new Dictionary<string, ICollectionGenericObjects<T>>();
|
||||
}
|
||||
|
||||
public void AddCollection(string name, CollectionType collectionType)
|
||||
{
|
||||
if (_storages.ContainsKey(name) || collectionType == CollectionType.None)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (collectionType)
|
||||
{
|
||||
case CollectionType.Massive:
|
||||
_storages[name] = new MassiveGenericObjects<T>();
|
||||
break;
|
||||
case CollectionType.List:
|
||||
_storages[name] = new ListGenericObjects<T>();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void DelCollection(string name)
|
||||
{
|
||||
if (_storages.ContainsKey(name) && name != null)
|
||||
{
|
||||
_storages.Remove(name);
|
||||
}
|
||||
}
|
||||
|
||||
public ICollectionGenericObjects<T>? this[string name]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_storages.ContainsKey(name))
|
||||
{
|
||||
return _storages[name];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
17
WarmlyShip/WarmlyShip/Drawnings/DirectionType.cs
Normal file
17
WarmlyShip/WarmlyShip/Drawnings/DirectionType.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WarmlyShip.Drawnings
|
||||
{
|
||||
public enum DirectionType
|
||||
{
|
||||
Up = 1,
|
||||
Down = 2,
|
||||
Left = 3,
|
||||
Right = 4,
|
||||
Unknow = -1
|
||||
}
|
||||
}
|
185
WarmlyShip/WarmlyShip/Drawnings/DrawningShip.cs
Normal file
185
WarmlyShip/WarmlyShip/Drawnings/DrawningShip.cs
Normal file
@ -0,0 +1,185 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WarmlyShip.Entities;
|
||||
|
||||
namespace WarmlyShip.Drawnings;
|
||||
|
||||
public class DrawningShip
|
||||
{
|
||||
|
||||
|
||||
public EntityShip? EntityShip { get; protected set; }
|
||||
|
||||
|
||||
private int? _pictureWidth;
|
||||
|
||||
private int? _pictureHeight;
|
||||
|
||||
protected int? _startPosX;
|
||||
|
||||
protected int? _startPosY;
|
||||
|
||||
private readonly int _drawningWarmlyShipWidth = 150;
|
||||
|
||||
private readonly int _drawningWarmlyShipHeight = 80;
|
||||
|
||||
public int? GetPosX => _startPosX;
|
||||
|
||||
|
||||
public int? GetPosY => _startPosY;
|
||||
|
||||
|
||||
public int GetWidth => _drawningWarmlyShipWidth;
|
||||
|
||||
public int GetHeight => _drawningWarmlyShipHeight;
|
||||
|
||||
|
||||
private DrawningShip() {
|
||||
_pictureHeight = null;
|
||||
_pictureWidth = null;
|
||||
_startPosX = null;
|
||||
_startPosY = null;
|
||||
}
|
||||
public DrawningShip (int speed, double weight, Color bodyColor) : this()
|
||||
{
|
||||
EntityShip = new EntityShip(speed, weight, bodyColor);
|
||||
|
||||
}
|
||||
|
||||
protected DrawningShip(int drawningWarmlyShipWidth, int drawningWarmlyShipHeigh) : this()
|
||||
{
|
||||
_drawningWarmlyShipWidth = drawningWarmlyShipWidth;
|
||||
_drawningWarmlyShipHeight= drawningWarmlyShipHeigh;
|
||||
|
||||
}
|
||||
|
||||
public bool SetPictureSize(int width, int height)
|
||||
{
|
||||
if (width > _drawningWarmlyShipWidth && height > _drawningWarmlyShipHeight)
|
||||
{
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
if (_startPosX != null && _startPosY != null)
|
||||
{
|
||||
if (_startPosX.Value + _drawningWarmlyShipWidth > _pictureWidth)
|
||||
{
|
||||
_startPosX = _pictureWidth - _drawningWarmlyShipWidth;
|
||||
}
|
||||
if (_startPosY.Value + _drawningWarmlyShipHeight > _pictureHeight)
|
||||
{
|
||||
_startPosY = _pictureHeight - _drawningWarmlyShipHeight;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
public void SetPosition(int x, int y)
|
||||
{
|
||||
if (!_pictureHeight.HasValue || !_pictureWidth.HasValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
_startPosX = x;
|
||||
_startPosY = y;
|
||||
|
||||
if (_startPosX < 0) _startPosX = 0;
|
||||
if (_startPosY < 0) _startPosY = 0;
|
||||
|
||||
if (_startPosX + _drawningWarmlyShipWidth > _pictureWidth.Value)
|
||||
{
|
||||
_startPosX = _pictureWidth.Value - _drawningWarmlyShipWidth;
|
||||
}
|
||||
if (_startPosY + _drawningWarmlyShipHeight > _pictureHeight.Value)
|
||||
{
|
||||
_startPosY = _pictureHeight.Value - _drawningWarmlyShipHeight;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public bool MoveTransport(DirectionType direction)
|
||||
{
|
||||
if (EntityShip == null || !_startPosX.HasValue || !_startPosY.HasValue)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
case DirectionType.Left:
|
||||
if (_startPosX.Value - EntityShip.Step > 0)
|
||||
{
|
||||
_startPosX -= (int)EntityShip.Step;
|
||||
}
|
||||
return true;
|
||||
|
||||
case DirectionType.Up:
|
||||
if (_startPosY.Value - EntityShip.Step > 0)
|
||||
{
|
||||
_startPosY -= (int)EntityShip.Step;
|
||||
}
|
||||
return true;
|
||||
|
||||
case DirectionType.Right:
|
||||
if (_startPosX.Value + _drawningWarmlyShipWidth + EntityShip.Step < _pictureWidth)
|
||||
{
|
||||
_startPosX += (int)EntityShip.Step;
|
||||
}
|
||||
return true;
|
||||
|
||||
case DirectionType.Down:
|
||||
if (_startPosY.Value + _drawningWarmlyShipHeight + EntityShip.Step < _pictureHeight)
|
||||
{
|
||||
_startPosY += (int)EntityShip.Step;
|
||||
}
|
||||
return true;
|
||||
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityShip == null || !_startPosX.HasValue || !_startPosY.HasValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// нарисовать корабль
|
||||
Pen pen = new(Color.Black, 2);
|
||||
Brush brMain = new SolidBrush(EntityShip.BodyColor);
|
||||
// трапеция
|
||||
Point[] points = new Point[]
|
||||
{
|
||||
|
||||
new Point(_startPosX.Value, _startPosY.Value+50),
|
||||
new Point(_startPosX.Value + 150, _startPosY.Value+ 50),
|
||||
new Point(_startPosX.Value + 120, _startPosY.Value + 80),
|
||||
new Point(_startPosX.Value + 30, _startPosY.Value + 80)
|
||||
|
||||
};
|
||||
g.FillPolygon(brMain, points);
|
||||
g.DrawPolygon(pen, points);
|
||||
|
||||
//палуба
|
||||
g.FillRectangle(brMain, _startPosX.Value + 25, _startPosY.Value + 30, 100, 20);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 25, _startPosY.Value + 30, 100, 20);
|
||||
|
||||
//якорь
|
||||
g.DrawLine(pen, _startPosX.Value + 30, _startPosY.Value + 53, _startPosX.Value + 30, _startPosY.Value + 70);
|
||||
g.DrawLine(pen, _startPosX.Value + 23, _startPosY.Value + 70, _startPosX.Value + 37, _startPosY.Value + 70);
|
||||
g.DrawLine(pen, _startPosX.Value + 23, _startPosY.Value + 60, _startPosX.Value + 37, _startPosY.Value + 60);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
59
WarmlyShip/WarmlyShip/Drawnings/DrawningWarmlyShip.cs
Normal file
59
WarmlyShip/WarmlyShip/Drawnings/DrawningWarmlyShip.cs
Normal file
@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WarmlyShip.Entities;
|
||||
|
||||
namespace WarmlyShip.Drawnings
|
||||
{
|
||||
public class DrawningWarmlyShip : DrawningShip
|
||||
{
|
||||
|
||||
public DrawningWarmlyShip(int speed, double weight, Color bodyColor, Color seckondColor, bool fuelHole, bool pipes) : base(150, 80)
|
||||
{
|
||||
EntityShip = new EntityWarmlyShip(speed, weight, bodyColor, seckondColor, fuelHole, pipes);
|
||||
|
||||
}
|
||||
|
||||
public override void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityShip == null || !_startPosX.HasValue || !_startPosY.HasValue || EntityShip is not EntityWarmlyShip warmlyShip)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
base.DrawTransport(g);
|
||||
|
||||
|
||||
|
||||
|
||||
Pen pen = new(Color.Black, 2);
|
||||
Brush brMain = new SolidBrush(EntityShip.BodyColor);
|
||||
Brush brSecond = new SolidBrush(warmlyShip.SeckondColor);
|
||||
|
||||
|
||||
//трубы
|
||||
if (warmlyShip.Pipes)
|
||||
{
|
||||
g.FillRectangle(brSecond, _startPosX.Value + 35, _startPosY.Value, 20, 30);
|
||||
g.FillRectangle(brSecond, _startPosX.Value + 64, _startPosY.Value, 20, 30);
|
||||
g.FillRectangle(brSecond, _startPosX.Value + 93, _startPosY.Value, 20, 30);
|
||||
}
|
||||
|
||||
//топливный отсек
|
||||
if (warmlyShip.FuelHole)
|
||||
{
|
||||
g.FillEllipse(brSecond, _startPosX.Value + 100, _startPosY.Value + 55, 15, 15);
|
||||
g.DrawEllipse(pen, _startPosX.Value + 100, _startPosY.Value + 55, 15, 15);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
38
WarmlyShip/WarmlyShip/Entities/EntityShip.cs
Normal file
38
WarmlyShip/WarmlyShip/Entities/EntityShip.cs
Normal file
@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WarmlyShip.Entities;
|
||||
|
||||
public class EntityShip
|
||||
{
|
||||
/// <summary>
|
||||
/// Скорость
|
||||
/// </summary>
|
||||
public int Speed { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Вес
|
||||
/// </summary>
|
||||
public double Weight { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Основной цвет
|
||||
/// </summary>
|
||||
public Color BodyColor { get; private set; }
|
||||
|
||||
|
||||
public double Step => Speed * 100 / Weight;
|
||||
|
||||
|
||||
public EntityShip (int speed, double weight, Color bodyColor)
|
||||
{
|
||||
Speed = speed;
|
||||
Weight = weight;
|
||||
BodyColor = bodyColor;
|
||||
|
||||
}
|
||||
|
||||
}
|
45
WarmlyShip/WarmlyShip/Entities/EntityWarmlyShip.cs
Normal file
45
WarmlyShip/WarmlyShip/Entities/EntityWarmlyShip.cs
Normal file
@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WarmlyShip.Entities;
|
||||
|
||||
public class EntityWarmlyShip : EntityShip
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// доп. цвет
|
||||
/// </summary>
|
||||
public Color SeckondColor { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// признак наличия отсека для топлива
|
||||
/// </summary>
|
||||
public bool FuelHole { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Признак наличия трубы
|
||||
/// </summary>
|
||||
public bool Pipes { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="speed"> скорость </param>
|
||||
/// <param name="weight">вес</param>
|
||||
/// <param name="bodyColor">основной цвет</param>
|
||||
/// <param name="seckondColor">доп. цвет</param>
|
||||
/// <param name="fuelHole">признак наличия отсека для топлива</param>
|
||||
/// <param name="pipes">признак наличия трубы</param>
|
||||
public EntityWarmlyShip (int speed, double weight, Color bodyColor, Color seckondColor, bool fuelHole, bool pipes) : base (speed, weight, bodyColor)
|
||||
{
|
||||
|
||||
SeckondColor = seckondColor;
|
||||
FuelHole = fuelHole;
|
||||
Pipes = pipes;
|
||||
|
||||
}
|
||||
|
||||
}
|
39
WarmlyShip/WarmlyShip/Form1.Designer.cs
generated
39
WarmlyShip/WarmlyShip/Form1.Designer.cs
generated
@ -1,39 +0,0 @@
|
||||
namespace WarmlyShip
|
||||
{
|
||||
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);
|
||||
}
|
||||
//123
|
||||
#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
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
namespace WarmlyShip
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
300
WarmlyShip/WarmlyShip/FormShipCollection.Designer.cs
generated
Normal file
300
WarmlyShip/WarmlyShip/FormShipCollection.Designer.cs
generated
Normal file
@ -0,0 +1,300 @@
|
||||
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();
|
||||
panelCompanyTools = new Panel();
|
||||
buttonAddShip = new Button();
|
||||
buttonAddWarmlyShip = new Button();
|
||||
buttonRefresh = new Button();
|
||||
maskedTextBoxPosition = new MaskedTextBox();
|
||||
buttonGoToCheck = new Button();
|
||||
buttonRemoveShip = new Button();
|
||||
buttonCreateCompany = new Button();
|
||||
panelStoreage = new Panel();
|
||||
buttonCollectionDel = new Button();
|
||||
listBoxCollection = new ListBox();
|
||||
buttonCollectionAdd = new Button();
|
||||
radioButtonList = new RadioButton();
|
||||
radioButtonMssive = new RadioButton();
|
||||
textBoxCollectionName = new TextBox();
|
||||
labelCollectionName = new Label();
|
||||
comboBoxSelectorCompany = new ComboBox();
|
||||
pictureBox = new PictureBox();
|
||||
groupBoxTools.SuspendLayout();
|
||||
panelCompanyTools.SuspendLayout();
|
||||
panelStoreage.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// groupBoxTools
|
||||
//
|
||||
groupBoxTools.Controls.Add(panelCompanyTools);
|
||||
groupBoxTools.Controls.Add(buttonCreateCompany);
|
||||
groupBoxTools.Controls.Add(panelStoreage);
|
||||
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 = "Инструменты";
|
||||
//
|
||||
// panelCompanyTools
|
||||
//
|
||||
panelCompanyTools.Controls.Add(buttonAddShip);
|
||||
panelCompanyTools.Controls.Add(buttonAddWarmlyShip);
|
||||
panelCompanyTools.Controls.Add(buttonRefresh);
|
||||
panelCompanyTools.Controls.Add(maskedTextBoxPosition);
|
||||
panelCompanyTools.Controls.Add(buttonGoToCheck);
|
||||
panelCompanyTools.Controls.Add(buttonRemoveShip);
|
||||
panelCompanyTools.Enabled = false;
|
||||
panelCompanyTools.Location = new Point(6, 292);
|
||||
panelCompanyTools.Name = "panelCompanyTools";
|
||||
panelCompanyTools.Size = new Size(178, 234);
|
||||
panelCompanyTools.TabIndex = 4;
|
||||
//
|
||||
// buttonAddShip
|
||||
//
|
||||
buttonAddShip.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonAddShip.Location = new Point(3, 3);
|
||||
buttonAddShip.Name = "buttonAddShip";
|
||||
buttonAddShip.Size = new Size(166, 36);
|
||||
buttonAddShip.TabIndex = 1;
|
||||
buttonAddShip.Text = "Добавление корабля";
|
||||
buttonAddShip.UseVisualStyleBackColor = true;
|
||||
buttonAddShip.Click += ButtonAddShip_Click;
|
||||
//
|
||||
// buttonAddWarmlyShip
|
||||
//
|
||||
buttonAddWarmlyShip.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonAddWarmlyShip.Location = new Point(3, 45);
|
||||
buttonAddWarmlyShip.Name = "buttonAddWarmlyShip";
|
||||
buttonAddWarmlyShip.Size = new Size(166, 36);
|
||||
buttonAddWarmlyShip.TabIndex = 2;
|
||||
buttonAddWarmlyShip.Text = "Добавление парохода";
|
||||
buttonAddWarmlyShip.UseVisualStyleBackColor = true;
|
||||
buttonAddWarmlyShip.Click += ButtonAddWarmlyShip_Click;
|
||||
//
|
||||
// buttonRefresh
|
||||
//
|
||||
buttonRefresh.Anchor = AnchorStyles.None;
|
||||
buttonRefresh.Location = new Point(0, 198);
|
||||
buttonRefresh.Name = "buttonRefresh";
|
||||
buttonRefresh.Size = new Size(169, 28);
|
||||
buttonRefresh.TabIndex = 7;
|
||||
buttonRefresh.Text = "Обновить";
|
||||
buttonRefresh.UseVisualStyleBackColor = true;
|
||||
buttonRefresh.Click += ButtonRefresh_Click;
|
||||
//
|
||||
// maskedTextBoxPosition
|
||||
//
|
||||
maskedTextBoxPosition.Location = new Point(3, 87);
|
||||
maskedTextBoxPosition.Mask = "00";
|
||||
maskedTextBoxPosition.Name = "maskedTextBoxPosition";
|
||||
maskedTextBoxPosition.Size = new Size(169, 23);
|
||||
maskedTextBoxPosition.TabIndex = 4;
|
||||
maskedTextBoxPosition.ValidatingType = typeof(int);
|
||||
//
|
||||
// buttonGoToCheck
|
||||
//
|
||||
buttonGoToCheck.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
buttonGoToCheck.Location = new Point(3, 158);
|
||||
buttonGoToCheck.Name = "buttonGoToCheck";
|
||||
buttonGoToCheck.Size = new Size(166, 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(3, 116);
|
||||
buttonRemoveShip.Name = "buttonRemoveShip";
|
||||
buttonRemoveShip.Size = new Size(166, 36);
|
||||
buttonRemoveShip.TabIndex = 5;
|
||||
buttonRemoveShip.Text = "Удаление судна";
|
||||
buttonRemoveShip.UseVisualStyleBackColor = true;
|
||||
buttonRemoveShip.Click += ButtonRemoveShip_Click;
|
||||
//
|
||||
// buttonCreateCompany
|
||||
//
|
||||
buttonCreateCompany.Location = new Point(6, 263);
|
||||
buttonCreateCompany.Name = "buttonCreateCompany";
|
||||
buttonCreateCompany.Size = new Size(175, 23);
|
||||
buttonCreateCompany.TabIndex = 7;
|
||||
buttonCreateCompany.Text = "Создать компанию";
|
||||
buttonCreateCompany.UseVisualStyleBackColor = false;
|
||||
buttonCreateCompany.Click += ButtonCreateCompany_Click;
|
||||
//
|
||||
// panelStoreage
|
||||
//
|
||||
panelStoreage.Controls.Add(buttonCollectionDel);
|
||||
panelStoreage.Controls.Add(listBoxCollection);
|
||||
panelStoreage.Controls.Add(buttonCollectionAdd);
|
||||
panelStoreage.Controls.Add(radioButtonList);
|
||||
panelStoreage.Controls.Add(radioButtonMssive);
|
||||
panelStoreage.Controls.Add(textBoxCollectionName);
|
||||
panelStoreage.Controls.Add(labelCollectionName);
|
||||
panelStoreage.Dock = DockStyle.Top;
|
||||
panelStoreage.Location = new Point(3, 19);
|
||||
panelStoreage.Name = "panelStoreage";
|
||||
panelStoreage.Size = new Size(181, 213);
|
||||
panelStoreage.TabIndex = 9;
|
||||
//
|
||||
// buttonCollectionDel
|
||||
//
|
||||
buttonCollectionDel.Location = new Point(0, 186);
|
||||
buttonCollectionDel.Name = "buttonCollectionDel";
|
||||
buttonCollectionDel.Size = new Size(175, 23);
|
||||
buttonCollectionDel.TabIndex = 6;
|
||||
buttonCollectionDel.Text = "Удалить коллекцию";
|
||||
buttonCollectionDel.UseVisualStyleBackColor = false;
|
||||
buttonCollectionDel.Click += ButtonCollectionDel_Click;
|
||||
//
|
||||
// listBoxCollection
|
||||
//
|
||||
listBoxCollection.FormattingEnabled = true;
|
||||
listBoxCollection.ItemHeight = 15;
|
||||
listBoxCollection.Location = new Point(3, 101);
|
||||
listBoxCollection.Name = "listBoxCollection";
|
||||
listBoxCollection.Size = new Size(175, 79);
|
||||
listBoxCollection.TabIndex = 5;
|
||||
//
|
||||
// buttonCollectionAdd
|
||||
//
|
||||
buttonCollectionAdd.Location = new Point(3, 72);
|
||||
buttonCollectionAdd.Name = "buttonCollectionAdd";
|
||||
buttonCollectionAdd.Size = new Size(175, 23);
|
||||
buttonCollectionAdd.TabIndex = 4;
|
||||
buttonCollectionAdd.Text = "Добавить коллекцию";
|
||||
buttonCollectionAdd.UseVisualStyleBackColor = false;
|
||||
buttonCollectionAdd.Click += ButtonCollectionAdd_Click;
|
||||
//
|
||||
// radioButtonList
|
||||
//
|
||||
radioButtonList.AutoSize = true;
|
||||
radioButtonList.Location = new Point(106, 47);
|
||||
radioButtonList.Name = "radioButtonList";
|
||||
radioButtonList.Size = new Size(66, 19);
|
||||
radioButtonList.TabIndex = 3;
|
||||
radioButtonList.TabStop = true;
|
||||
radioButtonList.Text = "Список";
|
||||
radioButtonList.UseVisualStyleBackColor = true;
|
||||
|
||||
//
|
||||
// radioButtonMssive
|
||||
//
|
||||
radioButtonMssive.AutoSize = true;
|
||||
radioButtonMssive.Location = new Point(3, 47);
|
||||
radioButtonMssive.Name = "radioButtonMssive";
|
||||
radioButtonMssive.Size = new Size(67, 19);
|
||||
radioButtonMssive.TabIndex = 2;
|
||||
radioButtonMssive.TabStop = true;
|
||||
radioButtonMssive.Text = "Массив";
|
||||
radioButtonMssive.UseVisualStyleBackColor = true;
|
||||
|
||||
//
|
||||
// textBoxCollectionName
|
||||
//
|
||||
textBoxCollectionName.Location = new Point(3, 18);
|
||||
textBoxCollectionName.Name = "textBoxCollectionName";
|
||||
textBoxCollectionName.Size = new Size(175, 23);
|
||||
textBoxCollectionName.TabIndex = 1;
|
||||
//
|
||||
// labelCollectionName
|
||||
//
|
||||
labelCollectionName.AutoSize = true;
|
||||
labelCollectionName.Location = new Point(28, 0);
|
||||
labelCollectionName.Name = "labelCollectionName";
|
||||
labelCollectionName.Size = new Size(122, 15);
|
||||
labelCollectionName.TabIndex = 0;
|
||||
labelCollectionName.Text = "Название коллекции";
|
||||
//
|
||||
// comboBoxSelectorCompany
|
||||
//
|
||||
comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" });
|
||||
comboBoxSelectorCompany.Location = new Point(6, 234);
|
||||
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);
|
||||
panelCompanyTools.ResumeLayout(false);
|
||||
panelCompanyTools.PerformLayout();
|
||||
panelStoreage.ResumeLayout(false);
|
||||
panelStoreage.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;
|
||||
private Panel panelStoreage;
|
||||
private Label labelCollectionName;
|
||||
private Button buttonCollectionAdd;
|
||||
private RadioButton radioButtonList;
|
||||
private RadioButton radioButtonMssive;
|
||||
private TextBox textBoxCollectionName;
|
||||
private Button buttonCreateCompany;
|
||||
private Button buttonCollectionDel;
|
||||
private ListBox listBoxCollection;
|
||||
private Panel panelCompanyTools;
|
||||
}
|
||||
}
|
227
WarmlyShip/WarmlyShip/FormShipCollection.cs
Normal file
227
WarmlyShip/WarmlyShip/FormShipCollection.cs
Normal file
@ -0,0 +1,227 @@
|
||||
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();
|
||||
_storageCollection = new();
|
||||
}
|
||||
private AbstractCompany? _company = null;
|
||||
private readonly StorageCollection<DrawningShip> _storageCollection;
|
||||
|
||||
private void ComboBoxSelectorCompany_SelectedIndexChanged(Object sender, EventArgs e)
|
||||
{
|
||||
panelCompanyTools.Enabled = false;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
if (_company == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pictureBox.Image = _company.Show();
|
||||
}
|
||||
|
||||
|
||||
private void ButtonCollectionAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(textBoxCollectionName.Text) || (!radioButtonList.Checked && !radioButtonMssive.Checked))
|
||||
{
|
||||
MessageBox.Show("Не все данные заполнены", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
CollectionType collectionType = CollectionType.None;
|
||||
if (radioButtonMssive.Checked)
|
||||
{
|
||||
collectionType = CollectionType.Massive;
|
||||
}
|
||||
else if (radioButtonList.Checked)
|
||||
{
|
||||
collectionType = CollectionType.List;
|
||||
}
|
||||
|
||||
_storageCollection.AddCollection(textBoxCollectionName.Text, collectionType);
|
||||
RefreshListBoxItems();
|
||||
}
|
||||
|
||||
private void ButtonCollectionDel_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listBoxCollection.SelectedIndex < 0 || listBoxCollection.SelectedItem == null)
|
||||
{
|
||||
MessageBox.Show("Коллекция не выбрана");
|
||||
return;
|
||||
}
|
||||
|
||||
if (MessageBox.Show("Удалить коллекцию?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_storageCollection.DelCollection(listBoxCollection.SelectedItem.ToString());
|
||||
RefreshListBoxItems();
|
||||
|
||||
}
|
||||
|
||||
private void ButtonCreateCompany_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listBoxCollection.SelectedIndex < 0 || listBoxCollection.SelectedItems == null)
|
||||
{
|
||||
MessageBox.Show("Коллекция не выбрана");
|
||||
return;
|
||||
}
|
||||
|
||||
ICollectionGenericObjects<DrawningShip>? collection = _storageCollection[listBoxCollection.SelectedItem?.ToString() ?? string.Empty];
|
||||
if (collection == null)
|
||||
{
|
||||
MessageBox.Show("Коллекция не проинициализирована");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (comboBoxSelectorCompany.Text)
|
||||
{
|
||||
case "Хранилище":
|
||||
_company = new PortForShips(pictureBox.Width, pictureBox.Height, collection);
|
||||
break;
|
||||
}
|
||||
|
||||
panelCompanyTools.Enabled = true;
|
||||
RefreshListBoxItems();
|
||||
}
|
||||
private void RefreshListBoxItems()
|
||||
{
|
||||
listBoxCollection.Items.Clear();
|
||||
for (int i = 0; i < _storageCollection.Keys?.Count; ++i)
|
||||
{
|
||||
string? colName = _storageCollection.Keys?[i];
|
||||
if (!string.IsNullOrEmpty(colName))
|
||||
{
|
||||
listBoxCollection.Items.Add(colName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -1,17 +1,17 @@
|
||||
<?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
|
||||
|
||||
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>
|
||||
@ -26,36 +26,36 @@
|
||||
<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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
147
WarmlyShip/WarmlyShip/FormShips.Designer.cs
generated
Normal file
147
WarmlyShip/WarmlyShip/FormShips.Designer.cs
generated
Normal file
@ -0,0 +1,147 @@
|
||||
namespace WarmlyShip
|
||||
{
|
||||
partial class FormShips
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
pictureBoxShips = new PictureBox();
|
||||
buttonDown = new Button();
|
||||
buttonUp = new Button();
|
||||
buttonRight = new Button();
|
||||
buttonLeft = new Button();
|
||||
comboBoxStrategy = new ComboBox();
|
||||
buttonStrategyStep = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxShips).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// pictureBoxShips
|
||||
//
|
||||
pictureBoxShips.Dock = DockStyle.Fill;
|
||||
pictureBoxShips.Location = new Point(0, 0);
|
||||
pictureBoxShips.Name = "pictureBoxShips";
|
||||
pictureBoxShips.Size = new Size(854, 493);
|
||||
pictureBoxShips.TabIndex = 0;
|
||||
pictureBoxShips.TabStop = false;
|
||||
//
|
||||
// buttonDown
|
||||
//
|
||||
buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonDown.BackgroundImage = Properties.Resources.arrowDown;
|
||||
buttonDown.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDown.Location = new Point(766, 446);
|
||||
buttonDown.Name = "buttonDown";
|
||||
buttonDown.Size = new Size(35, 35);
|
||||
buttonDown.TabIndex = 10;
|
||||
buttonDown.UseVisualStyleBackColor = true;
|
||||
buttonDown.Click += ButtonMove_Click;
|
||||
//
|
||||
// buttonUp
|
||||
//
|
||||
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonUp.BackgroundImage = Properties.Resources.arrowUp;
|
||||
buttonUp.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonUp.Location = new Point(766, 405);
|
||||
buttonUp.Name = "buttonUp";
|
||||
buttonUp.Size = new Size(35, 35);
|
||||
buttonUp.TabIndex = 9;
|
||||
buttonUp.UseVisualStyleBackColor = true;
|
||||
buttonUp.Click += ButtonMove_Click;
|
||||
//
|
||||
// buttonRight
|
||||
//
|
||||
buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonRight.BackgroundImage = Properties.Resources.arrowRight;
|
||||
buttonRight.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonRight.Location = new Point(807, 446);
|
||||
buttonRight.Name = "buttonRight";
|
||||
buttonRight.Size = new Size(35, 35);
|
||||
buttonRight.TabIndex = 8;
|
||||
buttonRight.UseVisualStyleBackColor = true;
|
||||
buttonRight.Click += ButtonMove_Click;
|
||||
//
|
||||
// buttonLeft
|
||||
//
|
||||
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonLeft.BackgroundImage = Properties.Resources.arrowLeft;
|
||||
buttonLeft.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonLeft.Location = new Point(725, 446);
|
||||
buttonLeft.Name = "buttonLeft";
|
||||
buttonLeft.Size = new Size(35, 35);
|
||||
buttonLeft.TabIndex = 7;
|
||||
buttonLeft.UseVisualStyleBackColor = true;
|
||||
buttonLeft.Click += ButtonMove_Click;
|
||||
//
|
||||
// comboBoxStrategy
|
||||
//
|
||||
comboBoxStrategy.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxStrategy.FormattingEnabled = true;
|
||||
comboBoxStrategy.Items.AddRange(new object[] { "К центру", "К краю" });
|
||||
comboBoxStrategy.Location = new Point(721, 12);
|
||||
comboBoxStrategy.Name = "comboBoxStrategy";
|
||||
comboBoxStrategy.Size = new Size(121, 23);
|
||||
comboBoxStrategy.TabIndex = 12;
|
||||
//
|
||||
// buttonStrategyStep
|
||||
//
|
||||
buttonStrategyStep.Location = new Point(766, 41);
|
||||
buttonStrategyStep.Name = "buttonStrategyStep";
|
||||
buttonStrategyStep.Size = new Size(75, 23);
|
||||
buttonStrategyStep.TabIndex = 13;
|
||||
buttonStrategyStep.Text = "шаг";
|
||||
buttonStrategyStep.UseVisualStyleBackColor = true;
|
||||
buttonStrategyStep.Click += buttonStrategyStep_Click;
|
||||
//
|
||||
// FormShips
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(854, 493);
|
||||
Controls.Add(buttonStrategyStep);
|
||||
Controls.Add(comboBoxStrategy);
|
||||
Controls.Add(buttonDown);
|
||||
Controls.Add(buttonUp);
|
||||
Controls.Add(buttonRight);
|
||||
Controls.Add(buttonLeft);
|
||||
Controls.Add(pictureBoxShips);
|
||||
Name = "FormShips";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "pictureBoxShips";
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxShips).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private PictureBox pictureBoxShips;
|
||||
private Button buttonDown;
|
||||
private Button buttonUp;
|
||||
private Button buttonRight;
|
||||
private Button buttonLeft;
|
||||
private ComboBox comboBoxStrategy;
|
||||
private Button buttonStrategyStep;
|
||||
}
|
||||
}
|
128
WarmlyShip/WarmlyShip/FormShips.cs
Normal file
128
WarmlyShip/WarmlyShip/FormShips.cs
Normal file
@ -0,0 +1,128 @@
|
||||
using ProjectShip.MovementStrategy;
|
||||
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;
|
||||
using WarmlyShip.MovementStrategy;
|
||||
|
||||
namespace WarmlyShip
|
||||
{
|
||||
public partial class FormShips : Form
|
||||
{
|
||||
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();
|
||||
_strategy = null;
|
||||
}
|
||||
|
||||
private void Draw()
|
||||
{
|
||||
|
||||
if (_drawningShip == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Bitmap bmp = new(pictureBoxShips.Width, pictureBoxShips.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_drawningShip.DrawTransport(gr);
|
||||
pictureBoxShips.Image = bmp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void ButtonMove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawningShip == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
string name = ((Button)sender)?.Name ?? string.Empty;
|
||||
bool result = false;
|
||||
switch (name)
|
||||
{
|
||||
case "buttonUp":
|
||||
result = _drawningShip.MoveTransport(DirectionType.Up);
|
||||
break;
|
||||
case "buttonDown":
|
||||
result = _drawningShip.MoveTransport(DirectionType.Down);
|
||||
break;
|
||||
case "buttonLeft":
|
||||
result = _drawningShip.MoveTransport(DirectionType.Left);
|
||||
break;
|
||||
case "buttonRight":
|
||||
result = _drawningShip.MoveTransport(DirectionType.Right);
|
||||
break;
|
||||
}
|
||||
|
||||
if (result)
|
||||
{
|
||||
Draw();
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonStrategyStep_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawningShip == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (comboBoxStrategy.Enabled)
|
||||
{
|
||||
_strategy = comboBoxStrategy.SelectedIndex switch
|
||||
{
|
||||
0 => new MoveToCenter(),
|
||||
1 => new MoveToBorder(),
|
||||
_ => null,
|
||||
};
|
||||
|
||||
if (_strategy == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_strategy.SetData(new MoveableShip(_drawningShip), pictureBoxShips.Width, pictureBoxShips.Height);
|
||||
}
|
||||
|
||||
if (_strategy == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
comboBoxStrategy.Enabled = false;
|
||||
_strategy.MakeStep();
|
||||
Draw();
|
||||
|
||||
if (_strategy.GetStatus() == StrategyStatus.Finish)
|
||||
{
|
||||
comboBoxStrategy.Enabled = true;
|
||||
_strategy = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
120
WarmlyShip/WarmlyShip/FormShips.resx
Normal file
120
WarmlyShip/WarmlyShip/FormShips.resx
Normal 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>
|
80
WarmlyShip/WarmlyShip/MovementStrategy/AbstractStrategy.cs
Normal file
80
WarmlyShip/WarmlyShip/MovementStrategy/AbstractStrategy.cs
Normal file
@ -0,0 +1,80 @@
|
||||
using WarmlyShip.MovementStrategy;
|
||||
|
||||
namespace WarmlyShip.MovementStrategy;
|
||||
|
||||
public abstract class AbstractStrategy
|
||||
{
|
||||
private IMoveableObject? _moveableObject;
|
||||
|
||||
private StrategyStatus _state = StrategyStatus.NotInit;
|
||||
|
||||
protected int FieldWidth { get; private set; }
|
||||
|
||||
protected int FieldHeight { get; private set; }
|
||||
|
||||
public StrategyStatus GetStatus() { return _state; }
|
||||
|
||||
public void SetData(IMoveableObject moveableObject, int width, int height)
|
||||
{
|
||||
if (moveableObject == null)
|
||||
{
|
||||
_state = StrategyStatus.NotInit;
|
||||
return;
|
||||
}
|
||||
|
||||
_state = StrategyStatus.InProgress;
|
||||
_moveableObject = moveableObject;
|
||||
FieldWidth = width;
|
||||
FieldHeight = height;
|
||||
}
|
||||
|
||||
public void MakeStep()
|
||||
{
|
||||
if (_state != StrategyStatus.InProgress)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsTargetDestination())
|
||||
{
|
||||
_state = StrategyStatus.Finish;
|
||||
return;
|
||||
}
|
||||
|
||||
MoveToTarget();
|
||||
}
|
||||
|
||||
protected bool MoveLeft() => MoveTo(MovementDirection.Left);
|
||||
|
||||
protected bool MoveRight() => MoveTo(MovementDirection.Right);
|
||||
|
||||
protected bool MoveUp() => MoveTo(MovementDirection.Up);
|
||||
|
||||
protected bool MoveDown() => MoveTo(MovementDirection.Down);
|
||||
|
||||
protected ObjectParameters? GetObjectParameters => _moveableObject?.GetObjectPosition;
|
||||
|
||||
protected int? GetStep()
|
||||
{
|
||||
if (_state != StrategyStatus.InProgress)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return _moveableObject.GetStep;
|
||||
}
|
||||
|
||||
protected abstract void MoveToTarget();
|
||||
|
||||
protected abstract bool IsTargetDestination();
|
||||
|
||||
private bool MoveTo(MovementDirection movementDirection)
|
||||
{
|
||||
if (_state != StrategyStatus.InProgress)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return _moveableObject?.TryMoveObject(movementDirection) ?? false;
|
||||
}
|
||||
}
|
11
WarmlyShip/WarmlyShip/MovementStrategy/IMoveableObject.cs
Normal file
11
WarmlyShip/WarmlyShip/MovementStrategy/IMoveableObject.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using WarmlyShip.MovementStrategy;
|
||||
|
||||
namespace WarmlyShip.MovementStrategy;
|
||||
public interface IMoveableObject
|
||||
{
|
||||
ObjectParameters? GetObjectPosition { get; }
|
||||
|
||||
int GetStep { get; }
|
||||
|
||||
bool TryMoveObject(MovementDirection direction);
|
||||
}
|
37
WarmlyShip/WarmlyShip/MovementStrategy/MoveToBorder.cs
Normal file
37
WarmlyShip/WarmlyShip/MovementStrategy/MoveToBorder.cs
Normal file
@ -0,0 +1,37 @@
|
||||
namespace WarmlyShip.MovementStrategy;
|
||||
|
||||
public class MoveToBorder : AbstractStrategy
|
||||
{
|
||||
protected override bool IsTargetDestination()
|
||||
{
|
||||
ObjectParameters? objParams = GetObjectParameters;
|
||||
if (objParams == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return objParams.LeftBorder - GetStep() <= 0 || objParams.RightBorder + GetStep() >= FieldWidth ||
|
||||
objParams.TopBorder - GetStep() <= 0 || objParams.ObjectMiddleVertical + GetStep() >= FieldHeight;
|
||||
}
|
||||
|
||||
protected override void MoveToTarget()
|
||||
{
|
||||
ObjectParameters? objParams = GetObjectParameters;
|
||||
if (objParams == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int diffX = objParams.RightBorder - FieldWidth;
|
||||
if (Math.Abs(diffX) > GetStep())
|
||||
{
|
||||
MoveRight();
|
||||
}
|
||||
|
||||
int diffY = objParams.BottomBorder - FieldHeight;
|
||||
if (Math.Abs(diffY) > GetStep())
|
||||
{
|
||||
MoveDown();
|
||||
}
|
||||
}
|
||||
}
|
54
WarmlyShip/WarmlyShip/MovementStrategy/MoveToCenter.cs
Normal file
54
WarmlyShip/WarmlyShip/MovementStrategy/MoveToCenter.cs
Normal file
@ -0,0 +1,54 @@
|
||||
using WarmlyShip.MovementStrategy;
|
||||
|
||||
namespace WarmlyShip.MovementStrategy;
|
||||
|
||||
public class MoveToCenter : AbstractStrategy
|
||||
{
|
||||
protected override bool IsTargetDestination()
|
||||
{
|
||||
ObjectParameters? objParams = GetObjectParameters;
|
||||
if(objParams == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return objParams.ObjectMiddleHorizontal - GetStep() <= FieldWidth / 2 && objParams.ObjectMiddleHorizontal + GetStep() >= FieldWidth / 2
|
||||
&&
|
||||
objParams.ObjectMiddleVertical - GetStep() <= FieldHeight / 2 && objParams.ObjectMiddleVertical + GetStep() >= FieldHeight / 2;
|
||||
}
|
||||
|
||||
protected override void MoveToTarget()
|
||||
{
|
||||
ObjectParameters? objParams = GetObjectParameters;
|
||||
if(objParams == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int diffX = objParams.ObjectMiddleHorizontal - FieldWidth / 2;
|
||||
if (Math.Abs(diffX) > GetStep())
|
||||
{
|
||||
if (diffX > 0)
|
||||
{
|
||||
MoveLeft();
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveRight();
|
||||
}
|
||||
}
|
||||
|
||||
int diffY = objParams.ObjectMiddleVertical - FieldHeight / 2;
|
||||
if (Math.Abs(diffY) > GetStep())
|
||||
{
|
||||
if (diffY > 0)
|
||||
{
|
||||
MoveUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveDown();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
53
WarmlyShip/WarmlyShip/MovementStrategy/MoveableShip.cs
Normal file
53
WarmlyShip/WarmlyShip/MovementStrategy/MoveableShip.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using WarmlyShip.MovementStrategy;
|
||||
using WarmlyShip.Drawnings;
|
||||
|
||||
|
||||
|
||||
namespace ProjectShip.MovementStrategy;
|
||||
|
||||
public class MoveableShip : IMoveableObject
|
||||
{
|
||||
private readonly DrawningShip? _drawningShip = null;
|
||||
|
||||
public MoveableShip(DrawningShip ship)
|
||||
{
|
||||
_drawningShip = ship;
|
||||
}
|
||||
|
||||
public ObjectParameters? GetObjectPosition
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_drawningShip == null || _drawningShip.EntityShip == null || !_drawningShip.GetPosX.HasValue || !_drawningShip.GetPosY.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ObjectParameters(_drawningShip.GetPosX.Value, _drawningShip.GetPosY.Value, _drawningShip.GetWidth, _drawningShip.GetHeight);
|
||||
}
|
||||
}
|
||||
|
||||
public int GetStep => (int)(_drawningShip?.EntityShip?.Step ?? 0);
|
||||
|
||||
public bool TryMoveObject(MovementDirection direction)
|
||||
{
|
||||
if(_drawningShip == null || _drawningShip.EntityShip == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return _drawningShip.MoveTransport(GetDirectionType(direction));
|
||||
}
|
||||
|
||||
private static DirectionType GetDirectionType(MovementDirection direction)
|
||||
{
|
||||
return direction switch
|
||||
{
|
||||
MovementDirection.Left => DirectionType.Left,
|
||||
MovementDirection.Right => DirectionType.Right,
|
||||
MovementDirection.Up => DirectionType.Up,
|
||||
MovementDirection.Down => DirectionType.Down,
|
||||
_ => DirectionType.Unknow,
|
||||
};
|
||||
}
|
||||
}
|
15
WarmlyShip/WarmlyShip/MovementStrategy/MovementDirection.cs
Normal file
15
WarmlyShip/WarmlyShip/MovementStrategy/MovementDirection.cs
Normal 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 MovementDirection
|
||||
{
|
||||
Up = 1,
|
||||
Down = 2,
|
||||
Left = 3,
|
||||
Right = 4
|
||||
}
|
32
WarmlyShip/WarmlyShip/MovementStrategy/ObjectParameters.cs
Normal file
32
WarmlyShip/WarmlyShip/MovementStrategy/ObjectParameters.cs
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
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 BottomBorder => _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;
|
||||
}
|
||||
}
|
||||
|
14
WarmlyShip/WarmlyShip/MovementStrategy/StrategyStatus.cs
Normal file
14
WarmlyShip/WarmlyShip/MovementStrategy/StrategyStatus.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WarmlyShip.MovementStrategy;
|
||||
|
||||
public enum StrategyStatus
|
||||
{
|
||||
NotInit,
|
||||
InProgress,
|
||||
Finish
|
||||
}
|
@ -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 Form1());
|
||||
Application.Run(new FormShipCollection());
|
||||
}
|
||||
}
|
||||
}
|
103
WarmlyShip/WarmlyShip/Properties/Resources.Designer.cs
generated
Normal file
103
WarmlyShip/WarmlyShip/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,103 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace WarmlyShip.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[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>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </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>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap arrowDown {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("arrowDown", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap arrowLeft {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("arrowLeft", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap arrowRight {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("arrowRight", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap arrowUp {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("arrowUp", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
133
WarmlyShip/WarmlyShip/Properties/Resources.resx
Normal file
133
WarmlyShip/WarmlyShip/Properties/Resources.resx
Normal file
@ -0,0 +1,133 @@
|
||||
<?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>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="arrowDown" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\arrowDown.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="arrowLeft" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\arrowLeft.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="arrowRight" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\arrowRight.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="arrowUp" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\arrowUp.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
BIN
WarmlyShip/WarmlyShip/Resources/arrowDown.jpg
Normal file
BIN
WarmlyShip/WarmlyShip/Resources/arrowDown.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 61 KiB |
BIN
WarmlyShip/WarmlyShip/Resources/arrowLeft.jpg
Normal file
BIN
WarmlyShip/WarmlyShip/Resources/arrowLeft.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 60 KiB |
BIN
WarmlyShip/WarmlyShip/Resources/arrowRight.jpg
Normal file
BIN
WarmlyShip/WarmlyShip/Resources/arrowRight.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 60 KiB |
BIN
WarmlyShip/WarmlyShip/Resources/arrowUp.jpg
Normal file
BIN
WarmlyShip/WarmlyShip/Resources/arrowUp.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 61 KiB |
@ -8,4 +8,19 @@
|
||||
<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>
|
Loading…
Reference in New Issue
Block a user