Compare commits
No commits in common. "lab8" and "main" have entirely different histories.
@ -1,88 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
using ProjectCruiser.Drawnings;
|
|
||||||
namespace ProjectCruiser.MovementStrategy
|
|
||||||
{
|
|
||||||
public abstract class AbstractStrategy
|
|
||||||
{
|
|
||||||
private IMoveableObject? _moveableObject;
|
|
||||||
|
|
||||||
private Status _state = Status.NotInit;
|
|
||||||
|
|
||||||
protected int FieldWidth { get; private set; }
|
|
||||||
|
|
||||||
protected int FieldHeight { get; private set; }
|
|
||||||
|
|
||||||
public Status GetStatus() { return _state; }
|
|
||||||
|
|
||||||
public void SetData(IMoveableObject moveableObject, int width, int
|
|
||||||
height)
|
|
||||||
{
|
|
||||||
if (moveableObject == null)
|
|
||||||
{
|
|
||||||
_state = Status.NotInit;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_state = Status.InProgress;
|
|
||||||
_moveableObject = moveableObject;
|
|
||||||
FieldWidth = width;
|
|
||||||
FieldHeight = height;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void MakeStep()
|
|
||||||
{
|
|
||||||
if (_state != Status.InProgress)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (IsTargetDestinaion())
|
|
||||||
{
|
|
||||||
_state = Status.Finish;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
MoveToTarget();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected bool MoveLeft() => MoveTo(DirectionType.Left);
|
|
||||||
|
|
||||||
protected bool MoveRight() => MoveTo(DirectionType.Right);
|
|
||||||
|
|
||||||
protected bool MoveUp() => MoveTo(DirectionType.Up);
|
|
||||||
|
|
||||||
protected bool MoveDown() => MoveTo(DirectionType.Down);
|
|
||||||
|
|
||||||
protected ObjectParameters? GetObjectParameters =>
|
|
||||||
_moveableObject?.GetObjectPosition;
|
|
||||||
|
|
||||||
protected int? GetStep()
|
|
||||||
{
|
|
||||||
if (_state != Status.InProgress)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return _moveableObject?.GetStep;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract void MoveToTarget();
|
|
||||||
|
|
||||||
protected abstract bool IsTargetDestinaion();
|
|
||||||
|
|
||||||
private bool MoveTo(DirectionType directionType)
|
|
||||||
{
|
|
||||||
if (_state != Status.InProgress)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (_moveableObject?.CheckCanMove(directionType) ?? false)
|
|
||||||
{
|
|
||||||
_moveableObject.MoveObject(directionType);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -8,29 +8,4 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
|
||||||
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.7" />
|
|
||||||
<PackageReference Include="Serilog" Version="3.1.1" />
|
|
||||||
<PackageReference Include="Serilog.AspNetCore" Version="8.0.0" />
|
|
||||||
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.0" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<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>
|
</Project>
|
@ -1,28 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectCruiser.Generics
|
|
||||||
{
|
|
||||||
internal class CruiserCollectionInfo : IEquatable<CruiserCollectionInfo>
|
|
||||||
{
|
|
||||||
public string Name { get; private set; }
|
|
||||||
public string Description { get; private set; }
|
|
||||||
public CruiserCollectionInfo(string name, string description)
|
|
||||||
{
|
|
||||||
Name = name;
|
|
||||||
Description = description;
|
|
||||||
}
|
|
||||||
public bool Equals(CruiserCollectionInfo? other)
|
|
||||||
{
|
|
||||||
return Name == other.Name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override int GetHashCode()
|
|
||||||
{
|
|
||||||
return Name.GetHashCode();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
using ProjectCruiser.DrawningObjects;
|
|
||||||
using ProjectCruiser.Entities;
|
|
||||||
using ProjectCruiser.Generics;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectCruiser
|
|
||||||
{
|
|
||||||
internal class CruiserCompareByColor : IComparer<DrawningCruiser?>
|
|
||||||
{
|
|
||||||
public int Compare(DrawningCruiser? x, DrawningCruiser? y)
|
|
||||||
{
|
|
||||||
if (x == null || x.EntityCruiser == null)
|
|
||||||
throw new ArgumentNullException(nameof(x));
|
|
||||||
|
|
||||||
if (y == null || y.EntityCruiser == null)
|
|
||||||
throw new ArgumentNullException(nameof(y));
|
|
||||||
|
|
||||||
if (x.EntityCruiser.BodyColor.Name != y.EntityCruiser.BodyColor.Name)
|
|
||||||
{
|
|
||||||
return x.EntityCruiser.BodyColor.Name.CompareTo(y.EntityCruiser.BodyColor.Name);
|
|
||||||
}
|
|
||||||
if (x.GetType().Name != y.GetType().Name)
|
|
||||||
{
|
|
||||||
if (x is EntityCruiser)
|
|
||||||
return -1;
|
|
||||||
else
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (x.GetType().Name == y.GetType().Name && x is DrawningCruiserDou)
|
|
||||||
{
|
|
||||||
EntityCruiserDou EntityX = (EntityCruiserDou)x.EntityCruiser;
|
|
||||||
EntityCruiserDou EntityY = (EntityCruiserDou)y.EntityCruiser;
|
|
||||||
if (EntityX.AdditionalColor.Name != EntityY.AdditionalColor.Name)
|
|
||||||
{
|
|
||||||
return EntityX.AdditionalColor.Name.CompareTo(EntityY.AdditionalColor.Name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var speedCompare = x.EntityCruiser.Speed.CompareTo(y.EntityCruiser.Speed);
|
|
||||||
|
|
||||||
if (speedCompare != 0)
|
|
||||||
return speedCompare;
|
|
||||||
|
|
||||||
return x.EntityCruiser.Weight.CompareTo(y.EntityCruiser.Weight);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
using ProjectCruiser.DrawningObjects;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectCruiser
|
|
||||||
{
|
|
||||||
internal class CruiserCompareByType : IComparer<DrawningCruiser?>
|
|
||||||
{
|
|
||||||
public int Compare(DrawningCruiser? x, DrawningCruiser? y)
|
|
||||||
{
|
|
||||||
if (x == null || x.EntityCruiser == null)
|
|
||||||
throw new ArgumentNullException(nameof(x));
|
|
||||||
|
|
||||||
if (y == null || y.EntityCruiser == null)
|
|
||||||
throw new ArgumentNullException(nameof(y));
|
|
||||||
|
|
||||||
if (x.GetType().Name != y.GetType().Name)
|
|
||||||
{
|
|
||||||
return x.GetType().Name.CompareTo(y.GetType().Name);
|
|
||||||
}
|
|
||||||
var speedCompare = x.EntityCruiser.Speed.CompareTo(y.EntityCruiser.Speed);
|
|
||||||
|
|
||||||
if (speedCompare != 0)
|
|
||||||
return speedCompare;
|
|
||||||
|
|
||||||
return x.EntityCruiser.Weight.CompareTo(y.EntityCruiser.Weight);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,109 +0,0 @@
|
|||||||
using ProjectCruiser.Drawnings;
|
|
||||||
using ProjectCruiser.MovementStrategy;
|
|
||||||
using ProjectCruiser.DrawningObjects;
|
|
||||||
|
|
||||||
namespace ProjectCruiser.Generics
|
|
||||||
{
|
|
||||||
internal class CruiserGenericCollection<T, U>
|
|
||||||
where T : DrawningCruiser
|
|
||||||
where U : IMoveableObject
|
|
||||||
{
|
|
||||||
public IEnumerable<T?> GetCruiser => _collection.GetCruiser();
|
|
||||||
|
|
||||||
private readonly int _pictureWidth;
|
|
||||||
|
|
||||||
private readonly int _pictureHeight;
|
|
||||||
|
|
||||||
private readonly int _placeSizeWidth = 210;
|
|
||||||
|
|
||||||
private readonly int _placeSizeHeight = 100;
|
|
||||||
|
|
||||||
private readonly SetGeneric<T> _collection;
|
|
||||||
|
|
||||||
public void Sort(IComparer<T?> comparer) => _collection.SortSet(comparer);
|
|
||||||
|
|
||||||
public CruiserGenericCollection(int picWidth, int picHeight)
|
|
||||||
{
|
|
||||||
int width = picWidth / _placeSizeWidth;
|
|
||||||
int height = picHeight / _placeSizeHeight;
|
|
||||||
_pictureWidth = picWidth;
|
|
||||||
_pictureHeight = picHeight;
|
|
||||||
_collection = new SetGeneric<T>(width * height);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool operator +(CruiserGenericCollection<T, U> collect, T?
|
|
||||||
obj)
|
|
||||||
{
|
|
||||||
if (obj == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return collect?._collection.Insert(obj, new DrawningCruiserEqutables()) ?? false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static T operator -(CruiserGenericCollection<T, U> collect, int pos)
|
|
||||||
{
|
|
||||||
T obj = collect._collection[pos];
|
|
||||||
if (obj != null)
|
|
||||||
{
|
|
||||||
collect?._collection.Remove(pos);
|
|
||||||
}
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
public U? GetU(int pos)
|
|
||||||
{
|
|
||||||
return (U?)_collection[pos]?.GetMoveableObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Bitmap ShowCruiser()
|
|
||||||
{
|
|
||||||
Bitmap bmp = new(_pictureWidth, _pictureHeight);
|
|
||||||
Graphics gr = Graphics.FromImage(bmp);
|
|
||||||
DrawBackground(gr);
|
|
||||||
DrawObjects(gr);
|
|
||||||
return bmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DrawBackground(Graphics g)
|
|
||||||
{
|
|
||||||
Pen pen = new(Color.Black, 3);
|
|
||||||
for (int i = 0; i < _pictureWidth / _placeSizeWidth; i++)
|
|
||||||
{
|
|
||||||
for (int j = 0; j < _pictureHeight / _placeSizeHeight +
|
|
||||||
1; ++j)
|
|
||||||
{
|
|
||||||
g.DrawLine(pen, i * _placeSizeWidth, j *
|
|
||||||
_placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth / 2, j *
|
|
||||||
_placeSizeHeight);
|
|
||||||
}
|
|
||||||
g.DrawLine(pen, i * _placeSizeWidth, 0, i *
|
|
||||||
_placeSizeWidth, _pictureHeight / _placeSizeHeight * _placeSizeHeight);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DrawObjects(Graphics g)
|
|
||||||
{
|
|
||||||
int Ix = 3;
|
|
||||||
int Iy = 15;
|
|
||||||
int i = 0;
|
|
||||||
foreach (var cruiser in _collection.GetCruiser())
|
|
||||||
{
|
|
||||||
if (cruiser != null)
|
|
||||||
{
|
|
||||||
cruiser._pictureHeight = _pictureHeight;
|
|
||||||
cruiser._pictureWidth = _pictureWidth;
|
|
||||||
_collection[i]?.SetPosition(Ix, Iy);
|
|
||||||
_collection[i]?.DrawTransport(g);
|
|
||||||
Ix += _placeSizeWidth;
|
|
||||||
if (Ix + _placeSizeHeight > _pictureWidth)
|
|
||||||
{
|
|
||||||
Ix = 3;
|
|
||||||
Iy = _placeSizeHeight+15;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,151 +0,0 @@
|
|||||||
using Cruiser;
|
|
||||||
using Cruiser.Exceptions;
|
|
||||||
using ProjectCruiser.DrawningObjects;
|
|
||||||
using ProjectCruiser.MovementStrategy;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectCruiser.Generics
|
|
||||||
{
|
|
||||||
internal class CruiserGenericStorage
|
|
||||||
{
|
|
||||||
readonly Dictionary<CruiserCollectionInfo, CruiserGenericCollection<DrawningCruiser,
|
|
||||||
DrawningObjectCruiser>> _CruiserStorages;
|
|
||||||
|
|
||||||
public List<CruiserCollectionInfo> Keys => _CruiserStorages.Keys.ToList();
|
|
||||||
|
|
||||||
private readonly int _pictureWidth;
|
|
||||||
|
|
||||||
private readonly int _pictureHeight;
|
|
||||||
|
|
||||||
private static readonly char _separatorForKeyValue = '|';
|
|
||||||
|
|
||||||
private readonly char _separatorRecords = ';';
|
|
||||||
|
|
||||||
private static readonly char _separatorForObject = ':';
|
|
||||||
|
|
||||||
public CruiserGenericStorage(int pictureWidth, int pictureHeight)
|
|
||||||
{
|
|
||||||
_CruiserStorages = new Dictionary<CruiserCollectionInfo,
|
|
||||||
CruiserGenericCollection<DrawningCruiser, DrawningObjectCruiser>>();
|
|
||||||
_pictureWidth = pictureWidth;
|
|
||||||
_pictureHeight = pictureHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AddSet(string name)
|
|
||||||
{
|
|
||||||
if (!_CruiserStorages.ContainsKey(new CruiserCollectionInfo(name, string.Empty)))
|
|
||||||
{
|
|
||||||
var CruiserCollection = new CruiserGenericCollection<DrawningCruiser, DrawningObjectCruiser>(_pictureWidth, _pictureHeight);
|
|
||||||
_CruiserStorages.Add(new CruiserCollectionInfo(name, string.Empty), CruiserCollection);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DelSet(string name)
|
|
||||||
{
|
|
||||||
if (_CruiserStorages.ContainsKey(new CruiserCollectionInfo(name, string.Empty)))
|
|
||||||
{
|
|
||||||
_CruiserStorages.Remove(new CruiserCollectionInfo(name, string.Empty));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public CruiserGenericCollection<DrawningCruiser, DrawningObjectCruiser>? this[string ind]
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
CruiserCollectionInfo indObj = new CruiserCollectionInfo(ind, string.Empty);
|
|
||||||
if (_CruiserStorages.ContainsKey(indObj))
|
|
||||||
{
|
|
||||||
return _CruiserStorages[indObj];
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SaveData(string filename)
|
|
||||||
{
|
|
||||||
if (File.Exists(filename))
|
|
||||||
{
|
|
||||||
File.Delete(filename);
|
|
||||||
}
|
|
||||||
StringBuilder data = new();
|
|
||||||
foreach (KeyValuePair<CruiserCollectionInfo, CruiserGenericCollection<DrawningCruiser, DrawningObjectCruiser>> record in _CruiserStorages)
|
|
||||||
{
|
|
||||||
StringBuilder records = new();
|
|
||||||
foreach (DrawningCruiser? elem in record.Value.GetCruiser)
|
|
||||||
{
|
|
||||||
records.Append($"{elem?.GetDataForSave(_separatorForObject)}{_separatorRecords}");
|
|
||||||
}
|
|
||||||
data.AppendLine($"{record.Key}{_separatorForKeyValue}{records}");
|
|
||||||
}
|
|
||||||
if (data.Length == 0)
|
|
||||||
{
|
|
||||||
throw new Exception("Невалидная операция, нет данных для сохранения");
|
|
||||||
}
|
|
||||||
|
|
||||||
using (StreamWriter writer = new StreamWriter(filename))
|
|
||||||
{
|
|
||||||
writer.Write($"lincornStorage{Environment.NewLine}{data}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LoadData(string filename)
|
|
||||||
{
|
|
||||||
if (!File.Exists(filename))
|
|
||||||
{
|
|
||||||
throw new Exception("Файл не найден");
|
|
||||||
}
|
|
||||||
|
|
||||||
using (StreamReader reader = new StreamReader(filename))
|
|
||||||
{
|
|
||||||
string cheker = reader.ReadLine();
|
|
||||||
if (cheker == null)
|
|
||||||
{
|
|
||||||
throw new Exception("Нет данных для загрузки");
|
|
||||||
}
|
|
||||||
if (!cheker.StartsWith("CruiserStorage"))
|
|
||||||
{
|
|
||||||
throw new Exception("Неверный формат ввода");
|
|
||||||
}
|
|
||||||
_CruiserStorages.Clear();
|
|
||||||
string strs;
|
|
||||||
bool firstinit = true;
|
|
||||||
while ((strs = reader.ReadLine()) != null)
|
|
||||||
{
|
|
||||||
if (strs == null && firstinit)
|
|
||||||
{
|
|
||||||
throw new Exception("Нет данных для загрузки");
|
|
||||||
}
|
|
||||||
if (strs == null)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
firstinit = false;
|
|
||||||
string name = strs.Split(_separatorForKeyValue)[0];
|
|
||||||
CruiserGenericCollection<DrawningCruiser, DrawningObjectCruiser> collection = new(_pictureWidth, _pictureHeight);
|
|
||||||
foreach (string data in strs.Split(_separatorForKeyValue)[1].Split(_separatorRecords))
|
|
||||||
{
|
|
||||||
DrawningCruiser? cruiser =
|
|
||||||
data?.CreateDrawningCruiser(_separatorForObject, _pictureWidth, _pictureHeight);
|
|
||||||
if (cruiser != null)
|
|
||||||
{
|
|
||||||
try { _ = collection + cruiser; }
|
|
||||||
catch (CruiserNotFoundException e)
|
|
||||||
{
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
catch (StorageOverflowException e)
|
|
||||||
{
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_CruiserStorages.Add(new CruiserCollectionInfo(name, string.Empty), collection);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.Serialization;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Cruiser
|
|
||||||
{
|
|
||||||
[Serializable] internal class CruiserNotFoundException : ApplicationException
|
|
||||||
{
|
|
||||||
public CruiserNotFoundException(int i) : base($"Не найден объект по позиции {i}") { }
|
|
||||||
public CruiserNotFoundException() : base() { }
|
|
||||||
public CruiserNotFoundException(string message) : base(message) { }
|
|
||||||
public CruiserNotFoundException(string message, Exception exception) : base(message, exception) { }
|
|
||||||
protected CruiserNotFoundException(SerializationInfo info, StreamingContext contex) : base(info, contex) { }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectCruiser.Drawnings
|
|
||||||
{
|
|
||||||
public enum DirectionType
|
|
||||||
{
|
|
||||||
Up = 1,
|
|
||||||
|
|
||||||
Down = 2,
|
|
||||||
|
|
||||||
Left = 3,
|
|
||||||
|
|
||||||
Right = 4
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,160 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
using ProjectCruiser.Entities;
|
|
||||||
using ProjectCruiser.Drawnings;
|
|
||||||
using System.Drawing.Drawing2D;
|
|
||||||
using ProjectCruiser.MovementStrategy;
|
|
||||||
|
|
||||||
namespace ProjectCruiser.DrawningObjects
|
|
||||||
{
|
|
||||||
public class DrawningCruiser
|
|
||||||
{
|
|
||||||
public EntityCruiser? EntityCruiser { get; protected set; }
|
|
||||||
|
|
||||||
public int _pictureWidth;
|
|
||||||
|
|
||||||
public int _pictureHeight;
|
|
||||||
|
|
||||||
protected int _startPosX;
|
|
||||||
|
|
||||||
protected int _startPosY;
|
|
||||||
|
|
||||||
protected readonly int _carWidth = 145;
|
|
||||||
|
|
||||||
protected readonly int _carHeight = 45;
|
|
||||||
|
|
||||||
public DrawningCruiser(int speed, double weight, Color bodyColor, int
|
|
||||||
width, int height)
|
|
||||||
{
|
|
||||||
_pictureWidth = width;
|
|
||||||
_pictureHeight = height;
|
|
||||||
EntityCruiser = new EntityCruiser(speed, weight, bodyColor);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected DrawningCruiser(int speed, double weight, Color bodyColor, int
|
|
||||||
width, int height, int carWidth, int carHeight)
|
|
||||||
{
|
|
||||||
if (width <= _pictureWidth || height <= _pictureHeight)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_pictureWidth = width;
|
|
||||||
_pictureHeight = height;
|
|
||||||
_carWidth = carWidth;
|
|
||||||
_carHeight = carHeight;
|
|
||||||
EntityCruiser = new EntityCruiser(speed, weight, bodyColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetPosition(int x, int y)
|
|
||||||
{
|
|
||||||
if (x < 0 || y < 0 || x + _carWidth > _pictureWidth || y + _carHeight > _pictureHeight)
|
|
||||||
{
|
|
||||||
x = 10;
|
|
||||||
y = 10;
|
|
||||||
}
|
|
||||||
_startPosX = x;
|
|
||||||
_startPosY = y;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IMoveableObject GetMoveableObject => new DrawningObjectCruiser(this);
|
|
||||||
|
|
||||||
protected int PictureWidth
|
|
||||||
{
|
|
||||||
get { return _pictureWidth; }
|
|
||||||
}
|
|
||||||
|
|
||||||
protected int PictureHeight
|
|
||||||
{
|
|
||||||
get { return _pictureHeight; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int GetPosX => _startPosX;
|
|
||||||
|
|
||||||
public int GetPosY => _startPosY;
|
|
||||||
|
|
||||||
public int GetWidth => _carWidth;
|
|
||||||
|
|
||||||
public int GetHeight => _carHeight;
|
|
||||||
|
|
||||||
public virtual bool CanMove(DirectionType direction)
|
|
||||||
{
|
|
||||||
if (EntityCruiser == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return direction switch
|
|
||||||
{
|
|
||||||
DirectionType.Left => _startPosX - EntityCruiser.Step > 0,
|
|
||||||
|
|
||||||
DirectionType.Up => _startPosY - EntityCruiser.Step > 7,
|
|
||||||
|
|
||||||
DirectionType.Right => _startPosX + EntityCruiser.Step + _carWidth <= _pictureWidth,
|
|
||||||
|
|
||||||
DirectionType.Down => _startPosY + EntityCruiser.Step + _carHeight <= _pictureHeight,
|
|
||||||
_ => false,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void MoveTransport(DirectionType direction)
|
|
||||||
{
|
|
||||||
if (!CanMove(direction) || EntityCruiser == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
switch (direction)
|
|
||||||
{
|
|
||||||
case DirectionType.Left:
|
|
||||||
_startPosX -= (int)EntityCruiser.Step;
|
|
||||||
break;
|
|
||||||
case DirectionType.Up:
|
|
||||||
_startPosY -= (int)EntityCruiser.Step;
|
|
||||||
break;
|
|
||||||
case DirectionType.Right:
|
|
||||||
_startPosX += (int)EntityCruiser.Step;
|
|
||||||
break;
|
|
||||||
case DirectionType.Down:
|
|
||||||
_startPosY += (int)EntityCruiser.Step;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void DrawTransport(Graphics g)
|
|
||||||
{
|
|
||||||
if (EntityCruiser == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Pen pen = new(Color.Black);
|
|
||||||
Brush BodyColor = new SolidBrush(EntityCruiser.BodyColor);
|
|
||||||
|
|
||||||
GraphicsPath path1 = new GraphicsPath();
|
|
||||||
path1.AddLine(_startPosX + 100, _startPosY + 0, _startPosX + 0, _startPosY + 0);
|
|
||||||
path1.AddLine(_startPosX + 0, _startPosY + 50, _startPosX + 0, _startPosY + 0);
|
|
||||||
path1.AddLine(_startPosX + 0, _startPosY + 50, _startPosX + 100, _startPosY + 50);
|
|
||||||
path1.AddLine(_startPosX + 100, _startPosY + 50, _startPosX + 150, _startPosY + 25);
|
|
||||||
path1.AddLine(_startPosX + 100, _startPosY + 0, _startPosX + 150, _startPosY + 25);
|
|
||||||
|
|
||||||
g.FillPath(BodyColor, path1);
|
|
||||||
g.DrawPath(pen, path1);
|
|
||||||
|
|
||||||
Brush brBlack = new SolidBrush(Color.Black);
|
|
||||||
|
|
||||||
g.DrawRectangle(pen, _startPosX - 3, _startPosY + 7, 3, 15);
|
|
||||||
g.FillRectangle(brBlack, _startPosX - 3, _startPosY + 7, 3, 15);
|
|
||||||
g.DrawRectangle(pen, _startPosX - 3, _startPosY + 25, 3, 15);
|
|
||||||
g.FillRectangle(brBlack, _startPosX - 3, _startPosY + 25, 3, 15);
|
|
||||||
|
|
||||||
g.DrawRectangle(pen, _startPosX + 60, _startPosY + 12, 20, 25);
|
|
||||||
g.FillRectangle(brBlack, _startPosX + 60, _startPosY + 12, 20, 25);
|
|
||||||
g.DrawRectangle(pen, _startPosX + 30, _startPosY + 19, 30, 13);
|
|
||||||
g.FillRectangle(brBlack, _startPosX + 30, _startPosY + 19, 30, 13);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,57 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Drawing.Drawing2D;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
using ProjectCruiser.Drawnings;
|
|
||||||
using ProjectCruiser.Entities;
|
|
||||||
namespace ProjectCruiser.DrawningObjects
|
|
||||||
{
|
|
||||||
public class DrawningCruiserDou : DrawningCruiser
|
|
||||||
{
|
|
||||||
|
|
||||||
public DrawningCruiserDou(int speed, double weight, Color bodyColor, Color
|
|
||||||
additionalColor, bool vert, bool rocket, int width, int height) :
|
|
||||||
base(speed, weight, bodyColor, width, height, 145, 45)
|
|
||||||
{
|
|
||||||
if (EntityCruiser != null)
|
|
||||||
{
|
|
||||||
EntityCruiser = new EntityCruiserDou(speed, weight, bodyColor,
|
|
||||||
additionalColor, vert, rocket);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void DrawTransport(Graphics g)
|
|
||||||
{
|
|
||||||
if (EntityCruiser is not EntityCruiserDou cruiserDou)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Pen pen = new(Color.Black);
|
|
||||||
|
|
||||||
Brush additionalBrush = new SolidBrush(cruiserDou.AdditionalColor);
|
|
||||||
Brush brBlack = new SolidBrush(Color.Black);
|
|
||||||
|
|
||||||
base.DrawTransport(g);
|
|
||||||
|
|
||||||
if (cruiserDou.Vert)
|
|
||||||
{
|
|
||||||
Brush brRed = new SolidBrush(Color.Red);
|
|
||||||
g.FillEllipse(additionalBrush, _startPosX + 95, _startPosY + 15, 20, 20);
|
|
||||||
g.DrawEllipse(pen, _startPosX + 95, _startPosY + 15, 20, 20);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cruiserDou.Rocket)
|
|
||||||
{
|
|
||||||
g.DrawEllipse(pen, _startPosX + 8, _startPosY + 3, 15, 12);
|
|
||||||
g.FillEllipse(additionalBrush, _startPosX + 8, _startPosY + 3, 15, 12);
|
|
||||||
g.DrawEllipse(pen, _startPosX + 8, _startPosY + 18, 15, 12);
|
|
||||||
g.FillEllipse(additionalBrush, _startPosX + 8, _startPosY + 18, 15, 12);
|
|
||||||
g.DrawEllipse(pen, _startPosX + 8, _startPosY + 33, 15, 12);
|
|
||||||
g.FillEllipse(additionalBrush, _startPosX + 8, _startPosY + 33, 15, 12);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,54 +0,0 @@
|
|||||||
using ProjectCruiser.DrawningObjects;
|
|
||||||
using ProjectCruiser.Entities;
|
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
|
|
||||||
namespace ProjectCruiser.Generics
|
|
||||||
{
|
|
||||||
internal class DrawningCruiserEqutables : IEqualityComparer<DrawningCruiser?>
|
|
||||||
{
|
|
||||||
public bool Equals(DrawningCruiser? x, DrawningCruiser? y)
|
|
||||||
{
|
|
||||||
if (x == null || x.EntityCruiser == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(x));
|
|
||||||
}
|
|
||||||
if (y == null || y.EntityCruiser == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(y));
|
|
||||||
}
|
|
||||||
if (x.GetType().Name != y.GetType().Name)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (x.EntityCruiser.Speed != y.EntityCruiser.Speed)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (x.EntityCruiser.Weight != y.EntityCruiser.Weight)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (x.EntityCruiser.BodyColor != y.EntityCruiser.BodyColor)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (x is EntityCruiserDou && y is EntityCruiserDou)
|
|
||||||
{
|
|
||||||
EntityCruiserDou EntityX = (EntityCruiserDou)x.EntityCruiser;
|
|
||||||
EntityCruiserDou EntityY = (EntityCruiserDou)y.EntityCruiser;
|
|
||||||
if (EntityX.AdditionalColor != EntityY.AdditionalColor)
|
|
||||||
return false;
|
|
||||||
if (EntityX.Vert != EntityY.Vert)
|
|
||||||
return false;
|
|
||||||
if (EntityX.Rocket != EntityY.Rocket)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int GetHashCode([DisallowNull] DrawningCruiser obj)
|
|
||||||
{
|
|
||||||
return obj.GetHashCode();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectCruiser.Entities
|
|
||||||
{
|
|
||||||
public class EntityCruiser
|
|
||||||
{
|
|
||||||
public int Speed { get; private set; }
|
|
||||||
|
|
||||||
public double Weight { get; private set; }
|
|
||||||
|
|
||||||
public Color BodyColor { get; set; }
|
|
||||||
|
|
||||||
public double Step => (double)Speed * 100 / Weight;
|
|
||||||
|
|
||||||
public EntityCruiser(int speed, double weight, Color bodyColor)
|
|
||||||
{
|
|
||||||
Speed = speed;
|
|
||||||
Weight = weight;
|
|
||||||
BodyColor = bodyColor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace ProjectCruiser.Entities
|
|
||||||
{
|
|
||||||
public class EntityCruiserDou : EntityCruiser
|
|
||||||
{
|
|
||||||
public Color AdditionalColor { get; set; }
|
|
||||||
|
|
||||||
public bool Vert { get; private set; }
|
|
||||||
|
|
||||||
public bool Rocket { get; private set; }
|
|
||||||
|
|
||||||
public EntityCruiserDou(int speed, double weight, Color bodyColor, Color additionalColor, bool vert, bool rocket)
|
|
||||||
: base(speed, weight, bodyColor)
|
|
||||||
{
|
|
||||||
AdditionalColor = additionalColor;
|
|
||||||
Vert = vert;
|
|
||||||
Rocket = rocket;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,51 +0,0 @@
|
|||||||
using ProjectCruiser.DrawningObjects;
|
|
||||||
using ProjectCruiser.Entities;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectCruiser
|
|
||||||
{
|
|
||||||
public static class ExtentionDrawningCruiser
|
|
||||||
{
|
|
||||||
public static DrawningCruiser? CreateDrawningCruiser(this string info, char
|
|
||||||
separatorForObject, int width, int height)
|
|
||||||
{
|
|
||||||
string[] strs = info.Split(separatorForObject);
|
|
||||||
if (strs.Length == 3)
|
|
||||||
{
|
|
||||||
return new DrawningCruiser(Convert.ToInt32(strs[0]),
|
|
||||||
Convert.ToInt32(strs[1]), Color.FromName(strs[2]), width, height);
|
|
||||||
}
|
|
||||||
else if (strs.Length == 6)
|
|
||||||
{
|
|
||||||
return new DrawningCruiserDou(Convert.ToInt32(strs[0]),
|
|
||||||
Convert.ToInt32(strs[1]),
|
|
||||||
Color.FromName(strs[2]),
|
|
||||||
Color.FromName(strs[3]),
|
|
||||||
Convert.ToBoolean(strs[4]),
|
|
||||||
Convert.ToBoolean(strs[5]), width, height);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string GetDataForSave(this DrawningCruiser drawningCruiser,
|
|
||||||
char separatorForCruiser)
|
|
||||||
{
|
|
||||||
var cruiser = drawningCruiser.EntityCruiser;
|
|
||||||
if (cruiser == null)
|
|
||||||
{
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
var str =
|
|
||||||
$"{cruiser.Speed}{separatorForCruiser}{cruiser.Weight}{separatorForCruiser}{cruiser.BodyColor.Name}";
|
|
||||||
if (cruiser is not EntityCruiserDou sportCruiser)
|
|
||||||
{
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
return $"{str}{separatorForCruiser}{sportCruiser.AdditionalColor.Name}{separatorForCruiser}{sportCruiser.Vert}{separatorForCruiser}{sportCruiser.Rocket}";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
39
Cruiser/Cruiser/Form1.Designer.cs
generated
Normal file
39
Cruiser/Cruiser/Form1.Designer.cs
generated
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
namespace Cruiser
|
||||||
|
{
|
||||||
|
partial class Form1
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.components = new System.ComponentModel.Container();
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||||
|
this.Text = "Form1";
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
10
Cruiser/Cruiser/Form1.cs
Normal file
10
Cruiser/Cruiser/Form1.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
namespace Cruiser
|
||||||
|
{
|
||||||
|
public partial class Form1 : Form
|
||||||
|
{
|
||||||
|
public Form1()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -117,17 +117,4 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
|
||||||
<data name="вверх" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\вверх.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="влево" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\влево.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="вниз" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\вниз.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
<data name="вправо" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\вправо.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
187
Cruiser/Cruiser/FormCruiser.Designer.cs
generated
187
Cruiser/Cruiser/FormCruiser.Designer.cs
generated
@ -1,187 +0,0 @@
|
|||||||
namespace ProjectCruiser
|
|
||||||
{
|
|
||||||
partial class FormCruiser
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormCruiser));
|
|
||||||
this.comboBoxStrategy = new System.Windows.Forms.ComboBox();
|
|
||||||
this.ButtonCreateCruiserBat = new System.Windows.Forms.Button();
|
|
||||||
this.ButtonCreateCruiser = new System.Windows.Forms.Button();
|
|
||||||
this.ButtonStep = new System.Windows.Forms.Button();
|
|
||||||
this.buttonUp = new System.Windows.Forms.Button();
|
|
||||||
this.buttonDown = new System.Windows.Forms.Button();
|
|
||||||
this.buttonLeft = new System.Windows.Forms.Button();
|
|
||||||
this.buttonRight = new System.Windows.Forms.Button();
|
|
||||||
this.pictureBoxCruiser = new System.Windows.Forms.PictureBox();
|
|
||||||
this.ButtonSelectCruiser = new System.Windows.Forms.Button();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCruiser)).BeginInit();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// comboBoxStrategy
|
|
||||||
//
|
|
||||||
this.comboBoxStrategy.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
|
||||||
this.comboBoxStrategy.FormattingEnabled = true;
|
|
||||||
this.comboBoxStrategy.Items.AddRange(new object[] {
|
|
||||||
"MoveToCenter",
|
|
||||||
"MoveToBorder",
|
|
||||||
"-"});
|
|
||||||
this.comboBoxStrategy.Location = new System.Drawing.Point(667, 12);
|
|
||||||
this.comboBoxStrategy.Name = "comboBoxStrategy";
|
|
||||||
this.comboBoxStrategy.Size = new System.Drawing.Size(121, 23);
|
|
||||||
this.comboBoxStrategy.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// ButtonCreateCruiserBat
|
|
||||||
//
|
|
||||||
this.ButtonCreateCruiserBat.Location = new System.Drawing.Point(19, 386);
|
|
||||||
this.ButtonCreateCruiserBat.Name = "ButtonCreateCruiserBat";
|
|
||||||
this.ButtonCreateCruiserBat.Size = new System.Drawing.Size(160, 57);
|
|
||||||
this.ButtonCreateCruiserBat.TabIndex = 1;
|
|
||||||
this.ButtonCreateCruiserBat.Text = "Создать крейсер с ракетными шахтами и площадкой под вертолет";
|
|
||||||
this.ButtonCreateCruiserBat.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonCreateCruiserBat.Click += new System.EventHandler(this.ButtonCreateCruiserBat_Click);
|
|
||||||
//
|
|
||||||
// ButtonCreateCruiser
|
|
||||||
//
|
|
||||||
this.ButtonCreateCruiser.Location = new System.Drawing.Point(185, 386);
|
|
||||||
this.ButtonCreateCruiser.Name = "ButtonCreateCruiser";
|
|
||||||
this.ButtonCreateCruiser.Size = new System.Drawing.Size(160, 57);
|
|
||||||
this.ButtonCreateCruiser.TabIndex = 2;
|
|
||||||
this.ButtonCreateCruiser.Text = "Создать крейсер";
|
|
||||||
this.ButtonCreateCruiser.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonCreateCruiser.Click += new System.EventHandler(this.ButtonCreateCruiser_Click);
|
|
||||||
//
|
|
||||||
// ButtonStep
|
|
||||||
//
|
|
||||||
this.ButtonStep.Location = new System.Drawing.Point(713, 50);
|
|
||||||
this.ButtonStep.Name = "ButtonStep";
|
|
||||||
this.ButtonStep.Size = new System.Drawing.Size(75, 23);
|
|
||||||
this.ButtonStep.TabIndex = 3;
|
|
||||||
this.ButtonStep.Text = "Шаг";
|
|
||||||
this.ButtonStep.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonStep.Click += new System.EventHandler(this.ButtonStep_Click);
|
|
||||||
//
|
|
||||||
// buttonUp
|
|
||||||
//
|
|
||||||
this.buttonUp.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonUp.BackgroundImage")));
|
|
||||||
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
|
||||||
this.buttonUp.Location = new System.Drawing.Point(678, 352);
|
|
||||||
this.buttonUp.Name = "buttonUp";
|
|
||||||
this.buttonUp.Size = new System.Drawing.Size(44, 38);
|
|
||||||
this.buttonUp.TabIndex = 4;
|
|
||||||
this.buttonUp.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonUp.Click += new System.EventHandler(this.ButtonMove_Click);
|
|
||||||
//
|
|
||||||
// buttonDown
|
|
||||||
//
|
|
||||||
this.buttonDown.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonDown.BackgroundImage")));
|
|
||||||
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
|
||||||
this.buttonDown.Location = new System.Drawing.Point(678, 395);
|
|
||||||
this.buttonDown.Name = "buttonDown";
|
|
||||||
this.buttonDown.Size = new System.Drawing.Size(44, 38);
|
|
||||||
this.buttonDown.TabIndex = 5;
|
|
||||||
this.buttonDown.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonDown.Click += new System.EventHandler(this.ButtonMove_Click);
|
|
||||||
//
|
|
||||||
// buttonLeft
|
|
||||||
//
|
|
||||||
this.buttonLeft.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonLeft.BackgroundImage")));
|
|
||||||
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
|
||||||
this.buttonLeft.Location = new System.Drawing.Point(629, 395);
|
|
||||||
this.buttonLeft.Name = "buttonLeft";
|
|
||||||
this.buttonLeft.Size = new System.Drawing.Size(44, 38);
|
|
||||||
this.buttonLeft.TabIndex = 6;
|
|
||||||
this.buttonLeft.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonLeft.Click += new System.EventHandler(this.ButtonMove_Click);
|
|
||||||
//
|
|
||||||
// buttonRight
|
|
||||||
//
|
|
||||||
this.buttonRight.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonRight.BackgroundImage")));
|
|
||||||
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
|
||||||
this.buttonRight.Location = new System.Drawing.Point(727, 395);
|
|
||||||
this.buttonRight.Name = "buttonRight";
|
|
||||||
this.buttonRight.Size = new System.Drawing.Size(44, 38);
|
|
||||||
this.buttonRight.TabIndex = 7;
|
|
||||||
this.buttonRight.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonRight.Click += new System.EventHandler(this.ButtonMove_Click);
|
|
||||||
//
|
|
||||||
// pictureBoxCruiser
|
|
||||||
//
|
|
||||||
this.pictureBoxCruiser.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
||||||
this.pictureBoxCruiser.Location = new System.Drawing.Point(0, 0);
|
|
||||||
this.pictureBoxCruiser.Name = "pictureBoxCruiser";
|
|
||||||
this.pictureBoxCruiser.Size = new System.Drawing.Size(800, 450);
|
|
||||||
this.pictureBoxCruiser.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
|
|
||||||
this.pictureBoxCruiser.TabIndex = 8;
|
|
||||||
this.pictureBoxCruiser.TabStop = false;
|
|
||||||
//
|
|
||||||
// ButtonSelectCruiser
|
|
||||||
//
|
|
||||||
this.ButtonSelectCruiser.Location = new System.Drawing.Point(351, 386);
|
|
||||||
this.ButtonSelectCruiser.Name = "ButtonSelectCruiser";
|
|
||||||
this.ButtonSelectCruiser.Size = new System.Drawing.Size(160, 57);
|
|
||||||
this.ButtonSelectCruiser.TabIndex = 9;
|
|
||||||
this.ButtonSelectCruiser.Text = "Выбор";
|
|
||||||
this.ButtonSelectCruiser.UseVisualStyleBackColor = true;
|
|
||||||
this.ButtonSelectCruiser.Click += new System.EventHandler(this.ButtonSelectCruiser_Click);
|
|
||||||
//
|
|
||||||
// FormCruiser
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
|
||||||
this.Controls.Add(this.ButtonSelectCruiser);
|
|
||||||
this.Controls.Add(this.buttonRight);
|
|
||||||
this.Controls.Add(this.buttonLeft);
|
|
||||||
this.Controls.Add(this.buttonDown);
|
|
||||||
this.Controls.Add(this.buttonUp);
|
|
||||||
this.Controls.Add(this.ButtonStep);
|
|
||||||
this.Controls.Add(this.ButtonCreateCruiser);
|
|
||||||
this.Controls.Add(this.ButtonCreateCruiserBat);
|
|
||||||
this.Controls.Add(this.comboBoxStrategy);
|
|
||||||
this.Controls.Add(this.pictureBoxCruiser);
|
|
||||||
this.Name = "FormCruiser";
|
|
||||||
this.Text = "FormCruiser";
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCruiser)).EndInit();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
private ComboBox comboBoxStrategy;
|
|
||||||
private Button ButtonCreateCruiserBat;
|
|
||||||
private Button ButtonCreateCruiser;
|
|
||||||
private Button ButtonStep;
|
|
||||||
private Button buttonUp;
|
|
||||||
private Button buttonDown;
|
|
||||||
private Button buttonLeft;
|
|
||||||
private Button buttonRight;
|
|
||||||
private PictureBox pictureBoxCruiser;
|
|
||||||
private Button ButtonSelectCruiser;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,149 +0,0 @@
|
|||||||
using ProjectCruiser.DrawningObjects;
|
|
||||||
using ProjectCruiser.Drawnings;
|
|
||||||
using ProjectCruiser.MovementStrategy;
|
|
||||||
namespace ProjectCruiser
|
|
||||||
{
|
|
||||||
public partial class FormCruiser : Form
|
|
||||||
{
|
|
||||||
private DrawningCruiser? _drawningCruiser;
|
|
||||||
|
|
||||||
private AbstractStrategy? _abstractStrategy;
|
|
||||||
|
|
||||||
public DrawningCruiser? SelectedCruiser { get; private set; }
|
|
||||||
|
|
||||||
public FormCruiser()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_abstractStrategy = null;
|
|
||||||
SelectedCruiser = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Draw()
|
|
||||||
{
|
|
||||||
if (_drawningCruiser == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Bitmap bmp = new(pictureBoxCruiser.Width,
|
|
||||||
pictureBoxCruiser.Height);
|
|
||||||
Graphics gr = Graphics.FromImage(bmp);
|
|
||||||
_drawningCruiser.DrawTransport(gr);
|
|
||||||
pictureBoxCruiser.Image = bmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonCreateCruiserBat_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Random random = new();
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
Color dopColor = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
|
||||||
|
|
||||||
ColorDialog dialog_dop = new();
|
|
||||||
if (dialog_dop.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
dopColor = dialog_dop.Color;
|
|
||||||
}
|
|
||||||
|
|
||||||
_drawningCruiser = new DrawningCruiserDou(random.Next(100, 300),
|
|
||||||
random.Next(1000, 3000),
|
|
||||||
color,
|
|
||||||
dopColor,
|
|
||||||
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)),
|
|
||||||
pictureBoxCruiser.Width, pictureBoxCruiser.Height);
|
|
||||||
_drawningCruiser.SetPosition(random.Next(10, 100), random.Next(10,100));
|
|
||||||
Draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonCreateCruiser_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Random random = new();
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
_drawningCruiser = new DrawningCruiser(random.Next(100, 300),
|
|
||||||
random.Next(1000, 3000),
|
|
||||||
color,
|
|
||||||
pictureBoxCruiser.Width, pictureBoxCruiser.Height);
|
|
||||||
_drawningCruiser.SetPosition(random.Next(10, 100), random.Next(10,100));
|
|
||||||
Draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonMove_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (_drawningCruiser == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
string name = ((Button)sender)?.Name ?? string.Empty;
|
|
||||||
switch (name)
|
|
||||||
{
|
|
||||||
case "buttonUp":
|
|
||||||
_drawningCruiser.MoveTransport(DirectionType.Up);
|
|
||||||
break;
|
|
||||||
case "buttonDown":
|
|
||||||
_drawningCruiser.MoveTransport(DirectionType.Down);
|
|
||||||
break;
|
|
||||||
case "buttonLeft":
|
|
||||||
_drawningCruiser.MoveTransport(DirectionType.Left);
|
|
||||||
break;
|
|
||||||
case "buttonRight":
|
|
||||||
_drawningCruiser.MoveTransport(DirectionType.Right);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
Draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonStep_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (_drawningCruiser == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (comboBoxStrategy.Enabled)
|
|
||||||
{
|
|
||||||
_abstractStrategy = comboBoxStrategy.SelectedIndex
|
|
||||||
switch
|
|
||||||
{
|
|
||||||
0 => new MoveToCenter(),
|
|
||||||
1 => new MoveToBorder(),
|
|
||||||
_ => null,
|
|
||||||
};
|
|
||||||
if (_abstractStrategy == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_abstractStrategy.SetData(new
|
|
||||||
DrawningObjectCruiser(_drawningCruiser), pictureBoxCruiser.Width,
|
|
||||||
pictureBoxCruiser.Height);
|
|
||||||
comboBoxStrategy.Enabled = false;
|
|
||||||
}
|
|
||||||
if (_abstractStrategy != null)
|
|
||||||
{
|
|
||||||
_abstractStrategy.MakeStep();
|
|
||||||
Draw();
|
|
||||||
|
|
||||||
if (_abstractStrategy.GetStatus() == Status.Finish)
|
|
||||||
{
|
|
||||||
comboBoxStrategy.Enabled = true;
|
|
||||||
_abstractStrategy = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonSelectCruiser_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
SelectedCruiser = _drawningCruiser;
|
|
||||||
DialogResult = DialogResult.OK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
278
Cruiser/Cruiser/FormCruiserCollection.Designer.cs
generated
278
Cruiser/Cruiser/FormCruiserCollection.Designer.cs
generated
@ -1,278 +0,0 @@
|
|||||||
namespace ProjectCruiser
|
|
||||||
{
|
|
||||||
partial class FormCruiserCollection
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
groupBox1 = new GroupBox();
|
|
||||||
ButtonSortByColor = new Button();
|
|
||||||
ButtonSortByType = new Button();
|
|
||||||
groupBox2 = new GroupBox();
|
|
||||||
listBoxStorage = new ListBox();
|
|
||||||
textBoxStorageName = new TextBox();
|
|
||||||
ButtonAddObject = new Button();
|
|
||||||
ButtonDelObject = new Button();
|
|
||||||
maskedTextBoxNumber = new MaskedTextBox();
|
|
||||||
ButtonRefreshCollection = new Button();
|
|
||||||
ButtonRemoveCruiser = new Button();
|
|
||||||
buttonAddCruiser = new Button();
|
|
||||||
menuStrip = new MenuStrip();
|
|
||||||
fileToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
SaveToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
LoadToolStripMenuItem = new ToolStripMenuItem();
|
|
||||||
pictureBoxCollection = new PictureBox();
|
|
||||||
openFileDialog = new OpenFileDialog();
|
|
||||||
saveFileDialog = new SaveFileDialog();
|
|
||||||
groupBox1.SuspendLayout();
|
|
||||||
groupBox2.SuspendLayout();
|
|
||||||
menuStrip.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBoxCollection).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// groupBox1
|
|
||||||
//
|
|
||||||
groupBox1.Controls.Add(ButtonSortByColor);
|
|
||||||
groupBox1.Controls.Add(ButtonSortByType);
|
|
||||||
groupBox1.Controls.Add(groupBox2);
|
|
||||||
groupBox1.Controls.Add(maskedTextBoxNumber);
|
|
||||||
groupBox1.Controls.Add(ButtonRefreshCollection);
|
|
||||||
groupBox1.Controls.Add(ButtonRemoveCruiser);
|
|
||||||
groupBox1.Controls.Add(buttonAddCruiser);
|
|
||||||
groupBox1.Controls.Add(menuStrip);
|
|
||||||
groupBox1.Location = new Point(643, 12);
|
|
||||||
groupBox1.Name = "groupBox1";
|
|
||||||
groupBox1.Size = new Size(196, 519);
|
|
||||||
groupBox1.TabIndex = 0;
|
|
||||||
groupBox1.TabStop = false;
|
|
||||||
groupBox1.Text = "Инструменты";
|
|
||||||
//
|
|
||||||
// ButtonSortByColor
|
|
||||||
//
|
|
||||||
ButtonSortByColor.Location = new Point(14, 359);
|
|
||||||
ButtonSortByColor.Name = "ButtonSortByColor";
|
|
||||||
ButtonSortByColor.Size = new Size(166, 26);
|
|
||||||
ButtonSortByColor.TabIndex = 11;
|
|
||||||
ButtonSortByColor.Text = "Сортировка по цвету";
|
|
||||||
ButtonSortByColor.UseVisualStyleBackColor = true;
|
|
||||||
ButtonSortByColor.Click += ButtonSortByColor_Click;
|
|
||||||
//
|
|
||||||
// ButtonSortByType
|
|
||||||
//
|
|
||||||
ButtonSortByType.Location = new Point(14, 327);
|
|
||||||
ButtonSortByType.Name = "ButtonSortByType";
|
|
||||||
ButtonSortByType.Size = new Size(166, 26);
|
|
||||||
ButtonSortByType.TabIndex = 10;
|
|
||||||
ButtonSortByType.Text = "Сортировка по типу";
|
|
||||||
ButtonSortByType.UseVisualStyleBackColor = true;
|
|
||||||
ButtonSortByType.Click += ButtonSortByType_Click;
|
|
||||||
//
|
|
||||||
// groupBox2
|
|
||||||
//
|
|
||||||
groupBox2.Controls.Add(listBoxStorage);
|
|
||||||
groupBox2.Controls.Add(textBoxStorageName);
|
|
||||||
groupBox2.Controls.Add(ButtonAddObject);
|
|
||||||
groupBox2.Controls.Add(ButtonDelObject);
|
|
||||||
groupBox2.Location = new Point(9, 58);
|
|
||||||
groupBox2.Name = "groupBox2";
|
|
||||||
groupBox2.Size = new Size(179, 256);
|
|
||||||
groupBox2.TabIndex = 4;
|
|
||||||
groupBox2.TabStop = false;
|
|
||||||
groupBox2.Text = "Наборы";
|
|
||||||
//
|
|
||||||
// listBoxStorage
|
|
||||||
//
|
|
||||||
listBoxStorage.FormattingEnabled = true;
|
|
||||||
listBoxStorage.ItemHeight = 15;
|
|
||||||
listBoxStorage.Location = new Point(6, 93);
|
|
||||||
listBoxStorage.Name = "listBoxStorage";
|
|
||||||
listBoxStorage.Size = new Size(167, 109);
|
|
||||||
listBoxStorage.TabIndex = 5;
|
|
||||||
listBoxStorage.SelectedIndexChanged += listBoxStorage_SelectedIndexChanged;
|
|
||||||
//
|
|
||||||
// textBoxStorageName
|
|
||||||
//
|
|
||||||
textBoxStorageName.Font = new Font("Lucida Sans Unicode", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
|
||||||
textBoxStorageName.Location = new Point(6, 22);
|
|
||||||
textBoxStorageName.Name = "textBoxStorageName";
|
|
||||||
textBoxStorageName.Size = new Size(167, 26);
|
|
||||||
textBoxStorageName.TabIndex = 4;
|
|
||||||
//
|
|
||||||
// ButtonAddObject
|
|
||||||
//
|
|
||||||
ButtonAddObject.Location = new Point(6, 54);
|
|
||||||
ButtonAddObject.Name = "ButtonAddObject";
|
|
||||||
ButtonAddObject.Size = new Size(167, 33);
|
|
||||||
ButtonAddObject.TabIndex = 3;
|
|
||||||
ButtonAddObject.Text = "Добавить набор";
|
|
||||||
ButtonAddObject.UseVisualStyleBackColor = true;
|
|
||||||
ButtonAddObject.Click += ButtonAddObject_Click;
|
|
||||||
//
|
|
||||||
// ButtonDelObject
|
|
||||||
//
|
|
||||||
ButtonDelObject.Location = new Point(6, 217);
|
|
||||||
ButtonDelObject.Name = "ButtonDelObject";
|
|
||||||
ButtonDelObject.Size = new Size(167, 33);
|
|
||||||
ButtonDelObject.TabIndex = 2;
|
|
||||||
ButtonDelObject.Text = "Удалить набор";
|
|
||||||
ButtonDelObject.UseVisualStyleBackColor = true;
|
|
||||||
ButtonDelObject.Click += ButtonDelObject_Click;
|
|
||||||
//
|
|
||||||
// maskedTextBoxNumber
|
|
||||||
//
|
|
||||||
maskedTextBoxNumber.Font = new Font("Lucida Sans Unicode", 9F, FontStyle.Regular, GraphicsUnit.Point);
|
|
||||||
maskedTextBoxNumber.Location = new Point(34, 423);
|
|
||||||
maskedTextBoxNumber.Mask = "00";
|
|
||||||
maskedTextBoxNumber.Name = "maskedTextBoxNumber";
|
|
||||||
maskedTextBoxNumber.Size = new Size(130, 26);
|
|
||||||
maskedTextBoxNumber.TabIndex = 3;
|
|
||||||
//
|
|
||||||
// ButtonRefreshCollection
|
|
||||||
//
|
|
||||||
ButtonRefreshCollection.Location = new Point(16, 487);
|
|
||||||
ButtonRefreshCollection.Name = "ButtonRefreshCollection";
|
|
||||||
ButtonRefreshCollection.Size = new Size(166, 26);
|
|
||||||
ButtonRefreshCollection.TabIndex = 2;
|
|
||||||
ButtonRefreshCollection.Text = "Обовить коллекцию";
|
|
||||||
ButtonRefreshCollection.UseVisualStyleBackColor = true;
|
|
||||||
ButtonRefreshCollection.Click += ButtonRefreshCollection_Click;
|
|
||||||
//
|
|
||||||
// ButtonRemoveCruiser
|
|
||||||
//
|
|
||||||
ButtonRemoveCruiser.Location = new Point(14, 455);
|
|
||||||
ButtonRemoveCruiser.Name = "ButtonRemoveCruiser";
|
|
||||||
ButtonRemoveCruiser.Size = new Size(167, 26);
|
|
||||||
ButtonRemoveCruiser.TabIndex = 1;
|
|
||||||
ButtonRemoveCruiser.Text = "Удалить крейсер";
|
|
||||||
ButtonRemoveCruiser.UseVisualStyleBackColor = true;
|
|
||||||
ButtonRemoveCruiser.Click += ButtonRemoveCruiser_Click;
|
|
||||||
//
|
|
||||||
// buttonAddCruiser
|
|
||||||
//
|
|
||||||
buttonAddCruiser.Location = new Point(14, 391);
|
|
||||||
buttonAddCruiser.Name = "buttonAddCruiser";
|
|
||||||
buttonAddCruiser.Size = new Size(167, 26);
|
|
||||||
buttonAddCruiser.TabIndex = 0;
|
|
||||||
buttonAddCruiser.Text = "Добавить крейсер";
|
|
||||||
buttonAddCruiser.UseVisualStyleBackColor = true;
|
|
||||||
buttonAddCruiser.Click += buttonAddCruiser_Click;
|
|
||||||
//
|
|
||||||
// menuStrip
|
|
||||||
//
|
|
||||||
menuStrip.ImageScalingSize = new Size(20, 20);
|
|
||||||
menuStrip.Items.AddRange(new ToolStripItem[] { fileToolStripMenuItem });
|
|
||||||
menuStrip.Location = new Point(3, 19);
|
|
||||||
menuStrip.Name = "menuStrip";
|
|
||||||
menuStrip.Padding = new Padding(7, 3, 0, 3);
|
|
||||||
menuStrip.Size = new Size(190, 25);
|
|
||||||
menuStrip.TabIndex = 5;
|
|
||||||
menuStrip.Text = "menuStrip1";
|
|
||||||
//
|
|
||||||
// fileToolStripMenuItem
|
|
||||||
//
|
|
||||||
fileToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { SaveToolStripMenuItem, LoadToolStripMenuItem });
|
|
||||||
fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
|
||||||
fileToolStripMenuItem.Size = new Size(48, 19);
|
|
||||||
fileToolStripMenuItem.Text = "Файл";
|
|
||||||
//
|
|
||||||
// SaveToolStripMenuItem
|
|
||||||
//
|
|
||||||
SaveToolStripMenuItem.Name = "SaveToolStripMenuItem";
|
|
||||||
SaveToolStripMenuItem.Size = new Size(141, 22);
|
|
||||||
SaveToolStripMenuItem.Text = "Сохранение";
|
|
||||||
SaveToolStripMenuItem.Click += SaveToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// LoadToolStripMenuItem
|
|
||||||
//
|
|
||||||
LoadToolStripMenuItem.Name = "LoadToolStripMenuItem";
|
|
||||||
LoadToolStripMenuItem.Size = new Size(141, 22);
|
|
||||||
LoadToolStripMenuItem.Text = "Загрузка";
|
|
||||||
LoadToolStripMenuItem.Click += LoadToolStripMenuItem_Click;
|
|
||||||
//
|
|
||||||
// pictureBoxCollection
|
|
||||||
//
|
|
||||||
pictureBoxCollection.Location = new Point(1, 4);
|
|
||||||
pictureBoxCollection.Name = "pictureBoxCollection";
|
|
||||||
pictureBoxCollection.Size = new Size(630, 521);
|
|
||||||
pictureBoxCollection.SizeMode = PictureBoxSizeMode.Zoom;
|
|
||||||
pictureBoxCollection.TabIndex = 1;
|
|
||||||
pictureBoxCollection.TabStop = false;
|
|
||||||
//
|
|
||||||
// openFileDialog
|
|
||||||
//
|
|
||||||
openFileDialog.FileName = "openFileDialog1";
|
|
||||||
openFileDialog.Filter = "txt file | *.txt";
|
|
||||||
openFileDialog.Title = "Сохранить текстовый файл";
|
|
||||||
//
|
|
||||||
// saveFileDialog
|
|
||||||
//
|
|
||||||
saveFileDialog.Filter = "txt file | *.txt";
|
|
||||||
saveFileDialog.Title = "Выберите текстовый файл";
|
|
||||||
//
|
|
||||||
// FormCruiserCollection
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(853, 545);
|
|
||||||
Controls.Add(pictureBoxCollection);
|
|
||||||
Controls.Add(groupBox1);
|
|
||||||
MainMenuStrip = menuStrip;
|
|
||||||
Margin = new Padding(3, 4, 3, 4);
|
|
||||||
Name = "FormCruiserCollection";
|
|
||||||
Text = "FormCruiserCollection";
|
|
||||||
groupBox1.ResumeLayout(false);
|
|
||||||
groupBox1.PerformLayout();
|
|
||||||
groupBox2.ResumeLayout(false);
|
|
||||||
groupBox2.PerformLayout();
|
|
||||||
menuStrip.ResumeLayout(false);
|
|
||||||
menuStrip.PerformLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)pictureBoxCollection).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private GroupBox groupBox1;
|
|
||||||
private MaskedTextBox maskedTextBoxNumber;
|
|
||||||
private Button ButtonRefreshCollection;
|
|
||||||
private Button ButtonRemoveCruiser;
|
|
||||||
private Button buttonAddCruiser;
|
|
||||||
private PictureBox pictureBoxCollection;
|
|
||||||
private GroupBox groupBox2;
|
|
||||||
private ListBox listBoxStorage;
|
|
||||||
private TextBox textBoxStorageName;
|
|
||||||
private Button ButtonAddObject;
|
|
||||||
private Button ButtonDelObject;
|
|
||||||
private MenuStrip menuStrip;
|
|
||||||
private ToolStripMenuItem fileToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem SaveToolStripMenuItem;
|
|
||||||
private ToolStripMenuItem LoadToolStripMenuItem;
|
|
||||||
private OpenFileDialog openFileDialog;
|
|
||||||
private SaveFileDialog saveFileDialog;
|
|
||||||
private Button ButtonSortByColor;
|
|
||||||
private Button ButtonSortByType;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,220 +0,0 @@
|
|||||||
using ProjectCruiser.DrawningObjects;
|
|
||||||
using ProjectCruiser.Drawnings;
|
|
||||||
using ProjectCruiser.Generics;
|
|
||||||
using ProjectCruiser.MovementStrategy;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace ProjectCruiser
|
|
||||||
{
|
|
||||||
public partial class FormCruiserCollection : Form
|
|
||||||
{
|
|
||||||
private readonly CruiserGenericStorage _storage;
|
|
||||||
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
|
|
||||||
public FormCruiserCollection(ILogger<FormCruiserCollection> logger)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_storage = new CruiserGenericStorage(pictureBoxCollection.Width,
|
|
||||||
pictureBoxCollection.Height);
|
|
||||||
_logger = logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ReloadObjects()
|
|
||||||
{
|
|
||||||
int index = listBoxStorage.SelectedIndex;
|
|
||||||
listBoxStorage.Items.Clear();
|
|
||||||
for (int i = 0; i < _storage.Keys.Count; i++)
|
|
||||||
{
|
|
||||||
listBoxStorage.Items.Add(_storage.Keys[i].Name);
|
|
||||||
}
|
|
||||||
if (listBoxStorage.Items.Count > 0 && (index == -1 || index
|
|
||||||
>= listBoxStorage.Items.Count))
|
|
||||||
{
|
|
||||||
listBoxStorage.SelectedIndex = 0;
|
|
||||||
}
|
|
||||||
else if (listBoxStorage.Items.Count > 0 && index > -1 &&
|
|
||||||
index < listBoxStorage.Items.Count)
|
|
||||||
{
|
|
||||||
listBoxStorage.SelectedIndex = index;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonAddObject_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(textBoxStorageName.Text))
|
|
||||||
{
|
|
||||||
MessageBox.Show("Не все данные заполнены", "Ошибка",
|
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
_logger.LogWarning("Пустое название набора");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_storage.AddSet(textBoxStorageName.Text);
|
|
||||||
ReloadObjects();
|
|
||||||
_logger.LogInformation($"Добавлен набор:{textBoxStorageName.Text}");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void listBoxStorage_SelectedIndexChanged(object sender,
|
|
||||||
EventArgs e)
|
|
||||||
{
|
|
||||||
pictureBoxCollection.Image =
|
|
||||||
_storage[listBoxStorage.SelectedItem?.ToString() ?? string.Empty]?.ShowCruiser();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonDelObject_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (listBoxStorage.SelectedIndex == -1)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Удаление невыбранного набора");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
string name = listBoxStorage.SelectedItem.ToString() ?? string.Empty;
|
|
||||||
if (MessageBox.Show($"Удалить объект {listBoxStorage.SelectedItem}?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|
||||||
{
|
|
||||||
_storage.DelSet(listBoxStorage.SelectedItem.ToString()
|
|
||||||
?? string.Empty);
|
|
||||||
ReloadObjects();
|
|
||||||
_logger.LogInformation($"Удален набор: {name}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonAddCruiser_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (listBoxStorage.SelectedIndex == -1)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var formCruiserConfig = new FormCruiserConfig();
|
|
||||||
|
|
||||||
formCruiserConfig.AddEvent(cruiser =>
|
|
||||||
{
|
|
||||||
var obj = _storage[listBoxStorage.SelectedItem.ToString() ?? string.Empty];
|
|
||||||
if (obj == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Добавление пустого объекта");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_ = obj + cruiser;
|
|
||||||
|
|
||||||
MessageBox.Show("Объект добавлен");
|
|
||||||
pictureBoxCollection.Image = obj.ShowCruiser();
|
|
||||||
_logger.LogInformation($"Добавлен объект в набор {listBoxStorage.SelectedItem.ToString()}");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Не удалось добавить объект");
|
|
||||||
_logger.LogWarning($"{ex.Message} в наборе {listBoxStorage.SelectedItem.ToString()}");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
formCruiserConfig.Show();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonRemoveCruiser_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (listBoxStorage.SelectedIndex == -1)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("Удаление объекта из несуществующего набора");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var obj = _storage[listBoxStorage.SelectedItem.ToString() ??
|
|
||||||
string.Empty];
|
|
||||||
if (obj == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (MessageBox.Show("Удалить объект?", "Удаление",
|
|
||||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int pos = Convert.ToInt32(maskedTextBoxNumber.Text);
|
|
||||||
if (obj - pos != null)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Объект удален");
|
|
||||||
pictureBoxCollection.Image = obj.ShowCruiser();
|
|
||||||
_logger.LogInformation($"Удален объект из набора {listBoxStorage.SelectedItem.ToString()}");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("Не удалось удалить объект");
|
|
||||||
_logger.LogWarning($"Не удалось удалить объект из набора {listBoxStorage.SelectedItem.ToString()}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonRefreshCollection_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (listBoxStorage.SelectedIndex == -1)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var obj = _storage[listBoxStorage.SelectedItem.ToString() ??
|
|
||||||
string.Empty];
|
|
||||||
if (obj == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
pictureBoxCollection.Image = obj.ShowCruiser();
|
|
||||||
}
|
|
||||||
private void SaveToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_storage.SaveData(saveFileDialog.FileName);
|
|
||||||
MessageBox.Show("Сохранение прошло успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
_logger.LogInformation($"Сохранение наборов в файл {saveFileDialog.FileName}");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show($"Не сохранилось: {ex.Message}", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
_logger.LogWarning($"Не удалось сохранить наборы с ошибкой: {ex.Message}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_storage.LoadData(openFileDialog.FileName);
|
|
||||||
ReloadObjects();
|
|
||||||
MessageBox.Show("Загрузка прошла успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
_logger.LogInformation($"Загрузились наборы из файла {openFileDialog.FileName}");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show($"Не загрузилось: {ex.Message}", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
_logger.LogWarning($"Не удалось загрузить наборы с ошибкой: {ex.Message}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonSortByType_Click(object sender, EventArgs e) => CompareCruiser(new CruiserCompareByType());
|
|
||||||
|
|
||||||
private void ButtonSortByColor_Click(object sender, EventArgs e) => CompareCruiser(new CruiserCompareByColor());
|
|
||||||
|
|
||||||
private void CompareCruiser(IComparer<DrawningCruiser?> comparer)
|
|
||||||
{
|
|
||||||
if (listBoxStorage.SelectedIndex == -1)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var obj = _storage[listBoxStorage.SelectedItem.ToString() ??
|
|
||||||
string.Empty];
|
|
||||||
if (obj == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
obj.Sort(comparer);
|
|
||||||
pictureBoxCollection.Image = obj.ShowCruiser();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,132 +0,0 @@
|
|||||||
<?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>
|
|
||||||
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>17, 17</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>17, 17</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>132, 17</value>
|
|
||||||
</metadata>
|
|
||||||
<metadata name="saveFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>281, 16</value>
|
|
||||||
</metadata>
|
|
||||||
</root>
|
|
371
Cruiser/Cruiser/FormCruiserConfig.Designer.cs
generated
371
Cruiser/Cruiser/FormCruiserConfig.Designer.cs
generated
@ -1,371 +0,0 @@
|
|||||||
namespace ProjectCruiser
|
|
||||||
{
|
|
||||||
partial class FormCruiserConfig
|
|
||||||
{
|
|
||||||
/// <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()
|
|
||||||
{
|
|
||||||
groupBox1 = new System.Windows.Forms.GroupBox();
|
|
||||||
labelModifiedObject = new System.Windows.Forms.Label();
|
|
||||||
labelSimpleObject = new System.Windows.Forms.Label();
|
|
||||||
groupBox2 = new System.Windows.Forms.GroupBox();
|
|
||||||
panelPurple = new System.Windows.Forms.Panel();
|
|
||||||
panelYellow = new System.Windows.Forms.Panel();
|
|
||||||
panelBlack = new System.Windows.Forms.Panel();
|
|
||||||
panelBlue = new System.Windows.Forms.Panel();
|
|
||||||
panelGray = new System.Windows.Forms.Panel();
|
|
||||||
panelGreen = new System.Windows.Forms.Panel();
|
|
||||||
panelWhite = new System.Windows.Forms.Panel();
|
|
||||||
panelRed = new System.Windows.Forms.Panel();
|
|
||||||
checkBoxBodyKit = new System.Windows.Forms.CheckBox();
|
|
||||||
checkBoxPushka = new System.Windows.Forms.CheckBox();
|
|
||||||
numericUpDownWeight = new System.Windows.Forms.NumericUpDown();
|
|
||||||
numericUpDownSpeed = new System.Windows.Forms.NumericUpDown();
|
|
||||||
label2 = new System.Windows.Forms.Label();
|
|
||||||
label1 = new System.Windows.Forms.Label();
|
|
||||||
panelColor = new System.Windows.Forms.Panel();
|
|
||||||
labelDopColor = new System.Windows.Forms.Label();
|
|
||||||
labelBaseColor = new System.Windows.Forms.Label();
|
|
||||||
pictureBoxObject = new System.Windows.Forms.PictureBox();
|
|
||||||
ButtonOk = new System.Windows.Forms.Button();
|
|
||||||
buttonCancel = new System.Windows.Forms.Button();
|
|
||||||
groupBox1.SuspendLayout();
|
|
||||||
groupBox2.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(numericUpDownWeight)).BeginInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(numericUpDownSpeed)).BeginInit();
|
|
||||||
panelColor.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(pictureBoxObject)).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// groupBox1
|
|
||||||
//
|
|
||||||
groupBox1.Controls.Add(labelModifiedObject);
|
|
||||||
groupBox1.Controls.Add(labelSimpleObject);
|
|
||||||
groupBox1.Controls.Add(groupBox2);
|
|
||||||
groupBox1.Controls.Add(checkBoxBodyKit);
|
|
||||||
groupBox1.Controls.Add(checkBoxPushka);
|
|
||||||
groupBox1.Controls.Add(numericUpDownWeight);
|
|
||||||
groupBox1.Controls.Add(numericUpDownSpeed);
|
|
||||||
groupBox1.Controls.Add(label2);
|
|
||||||
groupBox1.Controls.Add(label1);
|
|
||||||
groupBox1.Location = new System.Drawing.Point(12, 12);
|
|
||||||
groupBox1.Name = "groupBox1";
|
|
||||||
groupBox1.Size = new System.Drawing.Size(454, 228);
|
|
||||||
groupBox1.TabIndex = 0;
|
|
||||||
groupBox1.TabStop = false;
|
|
||||||
groupBox1.Text = "Параметры";
|
|
||||||
//
|
|
||||||
// labelModifiedObject
|
|
||||||
//
|
|
||||||
labelModifiedObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
||||||
labelModifiedObject.Location = new System.Drawing.Point(361, 146);
|
|
||||||
labelModifiedObject.Name = "labelModifiedObject";
|
|
||||||
labelModifiedObject.Size = new System.Drawing.Size(87, 27);
|
|
||||||
labelModifiedObject.TabIndex = 8;
|
|
||||||
labelModifiedObject.Text = "Продвинутый";
|
|
||||||
labelModifiedObject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
|
||||||
labelModifiedObject.MouseDown += LabelObject_MouseDown;
|
|
||||||
//
|
|
||||||
// labelSimpleObject
|
|
||||||
//
|
|
||||||
labelSimpleObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
||||||
labelSimpleObject.Location = new System.Drawing.Point(263, 146);
|
|
||||||
labelSimpleObject.Name = "labelSimpleObject";
|
|
||||||
labelSimpleObject.Size = new System.Drawing.Size(87, 27);
|
|
||||||
labelSimpleObject.TabIndex = 7;
|
|
||||||
labelSimpleObject.Text = "Простой";
|
|
||||||
labelSimpleObject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
|
||||||
labelSimpleObject.MouseDown += LabelObject_MouseDown;
|
|
||||||
//
|
|
||||||
// groupBox2
|
|
||||||
//
|
|
||||||
groupBox2.Controls.Add(panelPurple);
|
|
||||||
groupBox2.Controls.Add(panelYellow);
|
|
||||||
groupBox2.Controls.Add(panelBlack);
|
|
||||||
groupBox2.Controls.Add(panelBlue);
|
|
||||||
groupBox2.Controls.Add(panelGray);
|
|
||||||
groupBox2.Controls.Add(panelGreen);
|
|
||||||
groupBox2.Controls.Add(panelWhite);
|
|
||||||
groupBox2.Controls.Add(panelRed);
|
|
||||||
groupBox2.Location = new System.Drawing.Point(263, 32);
|
|
||||||
groupBox2.Name = "groupBox2";
|
|
||||||
groupBox2.Size = new System.Drawing.Size(185, 106);
|
|
||||||
groupBox2.TabIndex = 6;
|
|
||||||
groupBox2.TabStop = false;
|
|
||||||
groupBox2.Text = "Цвета";
|
|
||||||
//
|
|
||||||
// panelPurple
|
|
||||||
//
|
|
||||||
panelPurple.BackColor = System.Drawing.Color.Purple;
|
|
||||||
panelPurple.Location = new System.Drawing.Point(139, 63);
|
|
||||||
panelPurple.Name = "panelPurple";
|
|
||||||
panelPurple.Size = new System.Drawing.Size(35, 30);
|
|
||||||
panelPurple.TabIndex = 7;
|
|
||||||
panelPurple.MouseDown += panelColor_MouseDown;
|
|
||||||
//
|
|
||||||
// panelYellow
|
|
||||||
//
|
|
||||||
panelYellow.BackColor = System.Drawing.Color.Yellow;
|
|
||||||
panelYellow.Location = new System.Drawing.Point(139, 22);
|
|
||||||
panelYellow.Name = "panelYellow";
|
|
||||||
panelYellow.Size = new System.Drawing.Size(35, 30);
|
|
||||||
panelYellow.TabIndex = 3;
|
|
||||||
panelYellow.MouseDown += panelColor_MouseDown;
|
|
||||||
//
|
|
||||||
// panelBlack
|
|
||||||
//
|
|
||||||
panelBlack.BackColor = System.Drawing.Color.Black;
|
|
||||||
panelBlack.Location = new System.Drawing.Point(98, 63);
|
|
||||||
panelBlack.Name = "panelBlack";
|
|
||||||
panelBlack.Size = new System.Drawing.Size(35, 30);
|
|
||||||
panelBlack.TabIndex = 6;
|
|
||||||
panelBlack.MouseDown += panelColor_MouseDown;
|
|
||||||
//
|
|
||||||
// panelBlue
|
|
||||||
//
|
|
||||||
panelBlue.BackColor = System.Drawing.Color.Blue;
|
|
||||||
panelBlue.Location = new System.Drawing.Point(98, 22);
|
|
||||||
panelBlue.Name = "panelBlue";
|
|
||||||
panelBlue.Size = new System.Drawing.Size(35, 30);
|
|
||||||
panelBlue.TabIndex = 2;
|
|
||||||
panelBlue.MouseDown += panelColor_MouseDown;
|
|
||||||
//
|
|
||||||
// panelGray
|
|
||||||
//
|
|
||||||
panelGray.BackColor = System.Drawing.Color.Gray;
|
|
||||||
panelGray.Location = new System.Drawing.Point(57, 63);
|
|
||||||
panelGray.Name = "panelGray";
|
|
||||||
panelGray.Size = new System.Drawing.Size(35, 30);
|
|
||||||
panelGray.TabIndex = 5;
|
|
||||||
panelGray.MouseDown += panelColor_MouseDown;
|
|
||||||
//
|
|
||||||
// panelGreen
|
|
||||||
//
|
|
||||||
panelGreen.BackColor = System.Drawing.Color.Green;
|
|
||||||
panelGreen.Location = new System.Drawing.Point(57, 22);
|
|
||||||
panelGreen.Name = "panelGreen";
|
|
||||||
panelGreen.Size = new System.Drawing.Size(35, 30);
|
|
||||||
panelGreen.TabIndex = 1;
|
|
||||||
panelGreen.MouseDown += panelColor_MouseDown;
|
|
||||||
//
|
|
||||||
// panelWhite
|
|
||||||
//
|
|
||||||
panelWhite.BackColor = System.Drawing.Color.White;
|
|
||||||
panelWhite.Location = new System.Drawing.Point(16, 63);
|
|
||||||
panelWhite.Name = "panelWhite";
|
|
||||||
panelWhite.Size = new System.Drawing.Size(35, 30);
|
|
||||||
panelWhite.TabIndex = 4;
|
|
||||||
panelWhite.MouseDown += panelColor_MouseDown;
|
|
||||||
//
|
|
||||||
// panelRed
|
|
||||||
//
|
|
||||||
panelRed.BackColor = System.Drawing.Color.Red;
|
|
||||||
panelRed.Location = new System.Drawing.Point(16, 22);
|
|
||||||
panelRed.Name = "panelRed";
|
|
||||||
panelRed.Size = new System.Drawing.Size(35, 30);
|
|
||||||
panelRed.TabIndex = 0;
|
|
||||||
panelRed.MouseDown += panelColor_MouseDown;
|
|
||||||
//
|
|
||||||
// checkBoxBodyKit
|
|
||||||
//
|
|
||||||
checkBoxBodyKit.AutoSize = true;
|
|
||||||
checkBoxBodyKit.Location = new System.Drawing.Point(10, 154);
|
|
||||||
checkBoxBodyKit.Name = "checkBoxBodyKit";
|
|
||||||
checkBoxBodyKit.Size = new System.Drawing.Size(256, 19);
|
|
||||||
checkBoxBodyKit.TabIndex = 5;
|
|
||||||
checkBoxBodyKit.Text = "Признак наличия вертолетной площадки";
|
|
||||||
checkBoxBodyKit.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// checkBoxPushka
|
|
||||||
//
|
|
||||||
checkBoxPushka.AutoSize = true;
|
|
||||||
checkBoxPushka.Location = new System.Drawing.Point(10, 119);
|
|
||||||
checkBoxPushka.Name = "checkBoxPushka";
|
|
||||||
checkBoxPushka.Size = new System.Drawing.Size(227, 19);
|
|
||||||
checkBoxPushka.TabIndex = 4;
|
|
||||||
checkBoxPushka.Text = "Признак наличия отсека под ракеты";
|
|
||||||
checkBoxPushka.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// numericUpDownWeight
|
|
||||||
//
|
|
||||||
numericUpDownWeight.Location = new System.Drawing.Point(76, 60);
|
|
||||||
numericUpDownWeight.Name = "numericUpDownWeight";
|
|
||||||
numericUpDownWeight.Size = new System.Drawing.Size(73, 23);
|
|
||||||
numericUpDownWeight.TabIndex = 3;
|
|
||||||
numericUpDownWeight.Value = new decimal(new int[] {
|
|
||||||
100,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
//
|
|
||||||
// numericUpDownSpeed
|
|
||||||
//
|
|
||||||
numericUpDownSpeed.Location = new System.Drawing.Point(76, 31);
|
|
||||||
numericUpDownSpeed.Name = "numericUpDownSpeed";
|
|
||||||
numericUpDownSpeed.Size = new System.Drawing.Size(73, 23);
|
|
||||||
numericUpDownSpeed.TabIndex = 2;
|
|
||||||
numericUpDownSpeed.Value = new decimal(new int[] {
|
|
||||||
100,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0});
|
|
||||||
//
|
|
||||||
// label2
|
|
||||||
//
|
|
||||||
label2.AutoSize = true;
|
|
||||||
label2.Location = new System.Drawing.Point(10, 62);
|
|
||||||
label2.Name = "label2";
|
|
||||||
label2.Size = new System.Drawing.Size(29, 15);
|
|
||||||
label2.TabIndex = 1;
|
|
||||||
label2.Text = "Вес:";
|
|
||||||
//
|
|
||||||
// label1
|
|
||||||
//
|
|
||||||
label1.AutoSize = true;
|
|
||||||
label1.Location = new System.Drawing.Point(10, 33);
|
|
||||||
label1.Name = "label1";
|
|
||||||
label1.Size = new System.Drawing.Size(62, 15);
|
|
||||||
label1.TabIndex = 0;
|
|
||||||
label1.Text = "Скорость:";
|
|
||||||
//
|
|
||||||
// panelColor
|
|
||||||
//
|
|
||||||
panelColor.AllowDrop = true;
|
|
||||||
panelColor.Controls.Add(labelDopColor);
|
|
||||||
panelColor.Controls.Add(labelBaseColor);
|
|
||||||
panelColor.Controls.Add(pictureBoxObject);
|
|
||||||
panelColor.Location = new System.Drawing.Point(472, 12);
|
|
||||||
panelColor.Name = "panelColor";
|
|
||||||
panelColor.Size = new System.Drawing.Size(276, 184);
|
|
||||||
panelColor.TabIndex = 1;
|
|
||||||
panelColor.DragDrop += PanelObject_DragDrop;
|
|
||||||
panelColor.DragEnter += PanelObject_DragEnter;
|
|
||||||
//
|
|
||||||
// labelDopColor
|
|
||||||
//
|
|
||||||
labelDopColor.AllowDrop = true;
|
|
||||||
labelDopColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
||||||
labelDopColor.Location = new System.Drawing.Point(164, 10);
|
|
||||||
labelDopColor.Name = "labelDopColor";
|
|
||||||
labelDopColor.Size = new System.Drawing.Size(100, 29);
|
|
||||||
labelDopColor.TabIndex = 2;
|
|
||||||
labelDopColor.Text = "Доп. цвет";
|
|
||||||
labelDopColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
|
||||||
labelDopColor.DragDrop += LabelDopColor_DragDrop;
|
|
||||||
labelDopColor.DragEnter += LabelColor_DragEnter;
|
|
||||||
labelDopColor.MouseDown += LabelObject_MouseDown;
|
|
||||||
//
|
|
||||||
// labelBaseColor
|
|
||||||
//
|
|
||||||
labelBaseColor.AllowDrop = true;
|
|
||||||
labelBaseColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
||||||
labelBaseColor.Location = new System.Drawing.Point(12, 10);
|
|
||||||
labelBaseColor.Name = "labelBaseColor";
|
|
||||||
labelBaseColor.Size = new System.Drawing.Size(100, 29);
|
|
||||||
labelBaseColor.TabIndex = 2;
|
|
||||||
labelBaseColor.Text = "Цвет";
|
|
||||||
labelBaseColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
|
||||||
labelBaseColor.DragDrop += LabelBaseColor_DragDrop;
|
|
||||||
labelBaseColor.DragEnter += LabelColor_DragEnter;
|
|
||||||
labelBaseColor.MouseDown += LabelObject_MouseDown;
|
|
||||||
//
|
|
||||||
// pictureBoxObject
|
|
||||||
//
|
|
||||||
pictureBoxObject.Location = new System.Drawing.Point(12, 46);
|
|
||||||
pictureBoxObject.Name = "pictureBoxObject";
|
|
||||||
pictureBoxObject.Size = new System.Drawing.Size(252, 127);
|
|
||||||
pictureBoxObject.TabIndex = 0;
|
|
||||||
pictureBoxObject.TabStop = false;
|
|
||||||
//
|
|
||||||
// ButtonOk
|
|
||||||
//
|
|
||||||
ButtonOk.Location = new System.Drawing.Point(484, 208);
|
|
||||||
ButtonOk.Name = "ButtonOk";
|
|
||||||
ButtonOk.Size = new System.Drawing.Size(100, 32);
|
|
||||||
ButtonOk.TabIndex = 2;
|
|
||||||
ButtonOk.Text = "Добавить";
|
|
||||||
ButtonOk.UseVisualStyleBackColor = true;
|
|
||||||
ButtonOk.Click += ButtonOk_Click;
|
|
||||||
//
|
|
||||||
// buttonCancel
|
|
||||||
//
|
|
||||||
buttonCancel.Location = new System.Drawing.Point(636, 208);
|
|
||||||
buttonCancel.Name = "buttonCancel";
|
|
||||||
buttonCancel.Size = new System.Drawing.Size(100, 32);
|
|
||||||
buttonCancel.TabIndex = 3;
|
|
||||||
buttonCancel.Text = "Отмена";
|
|
||||||
buttonCancel.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// FormCruiserConfig
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
|
||||||
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
ClientSize = new System.Drawing.Size(800, 252);
|
|
||||||
Controls.Add(buttonCancel);
|
|
||||||
Controls.Add(ButtonOk);
|
|
||||||
Controls.Add(panelColor);
|
|
||||||
Controls.Add(groupBox1);
|
|
||||||
Name = "FormCruiserConfig";
|
|
||||||
Text = "FormCruiserConfig";
|
|
||||||
groupBox1.ResumeLayout(false);
|
|
||||||
groupBox1.PerformLayout();
|
|
||||||
groupBox2.ResumeLayout(false);
|
|
||||||
((System.ComponentModel.ISupportInitialize)(numericUpDownWeight)).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(numericUpDownSpeed)).EndInit();
|
|
||||||
panelColor.ResumeLayout(false);
|
|
||||||
((System.ComponentModel.ISupportInitialize)(pictureBoxObject)).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private GroupBox groupBox1;
|
|
||||||
private NumericUpDown numericUpDownWeight;
|
|
||||||
private NumericUpDown numericUpDownSpeed;
|
|
||||||
private Label label2;
|
|
||||||
private Label label1;
|
|
||||||
private GroupBox groupBox2;
|
|
||||||
private CheckBox checkBoxBodyKit;
|
|
||||||
private CheckBox checkBoxPushka;
|
|
||||||
private Panel panelPurple;
|
|
||||||
private Panel panelYellow;
|
|
||||||
private Panel panelBlack;
|
|
||||||
private Panel panelBlue;
|
|
||||||
private Panel panelGray;
|
|
||||||
private Panel panelGreen;
|
|
||||||
private Panel panelWhite;
|
|
||||||
private Panel panelRed;
|
|
||||||
private Label labelSimpleObject;
|
|
||||||
private Label labelModifiedObject;
|
|
||||||
private Panel panelColor;
|
|
||||||
private PictureBox pictureBoxObject;
|
|
||||||
private Label labelDopColor;
|
|
||||||
private Label labelBaseColor;
|
|
||||||
private Button ButtonOk;
|
|
||||||
private Button buttonCancel;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,150 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
using ProjectCruiser.Drawnings;
|
|
||||||
using ProjectCruiser.Entities;
|
|
||||||
using ProjectCruiser;
|
|
||||||
using ProjectCruiser.DrawningObjects;
|
|
||||||
|
|
||||||
namespace ProjectCruiser
|
|
||||||
{
|
|
||||||
public partial class FormCruiserConfig : Form
|
|
||||||
{
|
|
||||||
DrawningCruiser? _cruiser = null;
|
|
||||||
|
|
||||||
private event Action<DrawningCruiser> EventAddCruiser;
|
|
||||||
|
|
||||||
public FormCruiserConfig()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
panelBlack.MouseDown += panelColor_MouseDown;
|
|
||||||
panelPurple.MouseDown += panelColor_MouseDown;
|
|
||||||
panelGray.MouseDown += panelColor_MouseDown;
|
|
||||||
panelGreen.MouseDown += panelColor_MouseDown;
|
|
||||||
panelRed.MouseDown += panelColor_MouseDown;
|
|
||||||
panelWhite.MouseDown += panelColor_MouseDown;
|
|
||||||
panelYellow.MouseDown += panelColor_MouseDown;
|
|
||||||
panelBlue.MouseDown += panelColor_MouseDown;
|
|
||||||
|
|
||||||
buttonCancel.Click += (sender, e) => Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DrawCruiser()
|
|
||||||
{
|
|
||||||
Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
|
|
||||||
Graphics gr = Graphics.FromImage(bmp);
|
|
||||||
_cruiser?.SetPosition(5, 5);
|
|
||||||
_cruiser?.DrawTransport(gr);
|
|
||||||
pictureBoxObject.Image = bmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AddEvent(Action<DrawningCruiser> ev)
|
|
||||||
{
|
|
||||||
if (EventAddCruiser == null)
|
|
||||||
{
|
|
||||||
EventAddCruiser = new Action<DrawningCruiser>(ev);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
EventAddCruiser += ev;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LabelObject_MouseDown(object sender, MouseEventArgs e)
|
|
||||||
{
|
|
||||||
(sender as Label)?.DoDragDrop((sender as Label)?.Name, DragDropEffects.Move | DragDropEffects.Copy);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void PanelObject_DragEnter(object sender, DragEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.Data?.GetDataPresent(DataFormats.Text) ?? false)
|
|
||||||
{
|
|
||||||
e.Effect = DragDropEffects.Copy;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
e.Effect = DragDropEffects.None;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void PanelObject_DragDrop(object sender, DragEventArgs e)
|
|
||||||
{
|
|
||||||
switch (e.Data?.GetData(DataFormats.Text).ToString())
|
|
||||||
{
|
|
||||||
case "labelSimpleObject":
|
|
||||||
_cruiser = new DrawningCruiser((int)numericUpDownSpeed.Value,
|
|
||||||
(int)numericUpDownWeight.Value, Color.White, pictureBoxObject.Width,
|
|
||||||
pictureBoxObject.Height);
|
|
||||||
break;
|
|
||||||
case "labelModifiedObject":
|
|
||||||
_cruiser = new DrawningCruiserDou((int)numericUpDownSpeed.Value,
|
|
||||||
(int)numericUpDownWeight.Value, Color.White, Color.Black, checkBoxBodyKit.Checked,
|
|
||||||
checkBoxPushka.Checked, pictureBoxObject.Width, pictureBoxObject.Height);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
DrawCruiser();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void panelColor_MouseDown(object sender, MouseEventArgs e)
|
|
||||||
{
|
|
||||||
(sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor, DragDropEffects.Move | DragDropEffects.Copy);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LabelBaseColor_DragDrop(object sender, DragEventArgs e)
|
|
||||||
{
|
|
||||||
if (_cruiser != null)
|
|
||||||
{
|
|
||||||
if (e.Data.GetDataPresent(typeof(Color)))
|
|
||||||
{
|
|
||||||
_cruiser.EntityCruiser.BodyColor = (Color)e.Data.GetData(typeof(Color));
|
|
||||||
|
|
||||||
}
|
|
||||||
DrawCruiser();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LabelColor_DragEnter(object sender, DragEventArgs e)
|
|
||||||
{
|
|
||||||
if (_cruiser != null && _cruiser.EntityCruiser is EntityCruiserDou entityustabat)
|
|
||||||
{
|
|
||||||
labelDopColor.AllowDrop = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
labelDopColor.AllowDrop = false;
|
|
||||||
|
|
||||||
if (e.Data.GetDataPresent(typeof(Color)))
|
|
||||||
{
|
|
||||||
e.Effect = DragDropEffects.Copy;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
e.Effect = DragDropEffects.None;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LabelDopColor_DragDrop(object sender, DragEventArgs e)
|
|
||||||
{
|
|
||||||
if (_cruiser != null && _cruiser.EntityCruiser is EntityCruiserDou entitycruiserdou)
|
|
||||||
{
|
|
||||||
if (e.Data.GetDataPresent(typeof(Color)))
|
|
||||||
{
|
|
||||||
entitycruiserdou.AdditionalColor = (Color)e.Data.GetData(typeof(Color));
|
|
||||||
}
|
|
||||||
DrawCruiser();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonOk_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
EventAddCruiser?.Invoke(_cruiser);
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
<root>
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
@ -1,25 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
using ProjectCruiser.Drawnings;
|
|
||||||
namespace ProjectCruiser.MovementStrategy
|
|
||||||
{
|
|
||||||
public interface IMoveableObject
|
|
||||||
{
|
|
||||||
ObjectParameters? GetObjectPosition { get; }
|
|
||||||
|
|
||||||
int GetStep { get; }
|
|
||||||
|
|
||||||
bool CheckCanMove(DirectionType direction);
|
|
||||||
|
|
||||||
void MoveObject(DirectionType direction);
|
|
||||||
|
|
||||||
void SetPosition(int x, int y);
|
|
||||||
|
|
||||||
void Draw(Graphics g);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
using ProjectCruiser.DrawningObjects;
|
|
||||||
using ProjectCruiser.Drawnings;
|
|
||||||
|
|
||||||
namespace ProjectCruiser.MovementStrategy
|
|
||||||
{
|
|
||||||
public class DrawningObjectCruiser : IMoveableObject
|
|
||||||
{
|
|
||||||
private readonly DrawningCruiser? _drawningCruiser = null;
|
|
||||||
public DrawningObjectCruiser(DrawningCruiser drawningCruiser)
|
|
||||||
{
|
|
||||||
_drawningCruiser = drawningCruiser;
|
|
||||||
}
|
|
||||||
public ObjectParameters? GetObjectPosition
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (_drawningCruiser == null || _drawningCruiser.EntityCruiser ==
|
|
||||||
null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new ObjectParameters(_drawningCruiser.GetPosX,
|
|
||||||
_drawningCruiser.GetPosY, _drawningCruiser.GetWidth, _drawningCruiser.GetHeight);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public int GetStep => (int)(_drawningCruiser?.EntityCruiser?.Step ?? 0);
|
|
||||||
public bool CheckCanMove(DirectionType direction) =>
|
|
||||||
_drawningCruiser?.CanMove(direction) ?? false;
|
|
||||||
public void MoveObject(DirectionType direction) =>
|
|
||||||
_drawningCruiser?.MoveTransport(direction);
|
|
||||||
public void SetPosition(int x, int y)
|
|
||||||
{
|
|
||||||
if (_drawningCruiser != null)
|
|
||||||
{
|
|
||||||
_drawningCruiser.SetPosition(x, y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Draw(Graphics g)
|
|
||||||
{
|
|
||||||
if (_drawningCruiser != null)
|
|
||||||
{
|
|
||||||
_drawningCruiser.DrawTransport(g);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectCruiser.MovementStrategy
|
|
||||||
{
|
|
||||||
public class MoveToBorder : AbstractStrategy
|
|
||||||
{
|
|
||||||
protected override bool IsTargetDestinaion()
|
|
||||||
{
|
|
||||||
var objParams = GetObjectParameters;
|
|
||||||
if (objParams == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return objParams.RightBorder <= FieldWidth &&
|
|
||||||
objParams.RightBorder + GetStep() >= FieldWidth &&
|
|
||||||
objParams.DownBorder <= FieldHeight &&
|
|
||||||
objParams.DownBorder + GetStep() >= FieldHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void MoveToTarget()
|
|
||||||
{
|
|
||||||
var objParams = GetObjectParameters;
|
|
||||||
if (objParams == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var diffX = objParams.RightBorder - FieldWidth;
|
|
||||||
if (Math.Abs(diffX) > GetStep())
|
|
||||||
{
|
|
||||||
MoveRight();
|
|
||||||
}
|
|
||||||
var diffY = objParams.DownBorder - FieldHeight;
|
|
||||||
if (Math.Abs(diffY) > GetStep())
|
|
||||||
{
|
|
||||||
MoveDown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,63 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectCruiser.MovementStrategy
|
|
||||||
{
|
|
||||||
public class MoveToCenter : AbstractStrategy
|
|
||||||
{
|
|
||||||
protected override bool IsTargetDestinaion()
|
|
||||||
{
|
|
||||||
var objParams = GetObjectParameters;
|
|
||||||
if (objParams == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return objParams.ObjectMiddleHorizontal <= FieldWidth / 2 &&
|
|
||||||
objParams.ObjectMiddleHorizontal + GetStep() >= FieldWidth / 2 &&
|
|
||||||
objParams.ObjectMiddleVertical <= FieldHeight / 2 &&
|
|
||||||
objParams.ObjectMiddleVertical + GetStep() >= FieldHeight / 2;
|
|
||||||
}
|
|
||||||
protected override void MoveToTarget()
|
|
||||||
{
|
|
||||||
var objParams = GetObjectParameters;
|
|
||||||
if (objParams == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var diffX = objParams.ObjectMiddleHorizontal - FieldWidth / 2;
|
|
||||||
var diffY = objParams.ObjectMiddleVertical - FieldHeight / 2;
|
|
||||||
|
|
||||||
if (Math.Abs(diffX) > GetStep() || Math.Abs(diffY) > GetStep())
|
|
||||||
{
|
|
||||||
if (Math.Abs(diffX) > GetStep())
|
|
||||||
{
|
|
||||||
if (diffX > 0)
|
|
||||||
{
|
|
||||||
MoveLeft();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MoveRight();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Math.Abs(diffY) > GetStep())
|
|
||||||
{
|
|
||||||
if (diffY > 0)
|
|
||||||
{
|
|
||||||
MoveUp();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MoveDown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectCruiser.MovementStrategy
|
|
||||||
{
|
|
||||||
public class ObjectParameters
|
|
||||||
{
|
|
||||||
private readonly int _x;
|
|
||||||
private readonly int _y;
|
|
||||||
private readonly int _width;
|
|
||||||
private readonly int _height;
|
|
||||||
|
|
||||||
public int LeftBorder => _x;
|
|
||||||
|
|
||||||
public int TopBorder => _y;
|
|
||||||
|
|
||||||
public int RightBorder => _x + _width;
|
|
||||||
|
|
||||||
public int DownBorder => _y + _height;
|
|
||||||
|
|
||||||
public int ObjectMiddleHorizontal => _x + _width / 2;
|
|
||||||
|
|
||||||
public int ObjectMiddleVertical => _y + _height / 2;
|
|
||||||
|
|
||||||
public ObjectParameters(int x, int y, int width, int height)
|
|
||||||
{
|
|
||||||
_x = x;
|
|
||||||
_y = y;
|
|
||||||
_width = width;
|
|
||||||
_height = height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,41 +1,17 @@
|
|||||||
using ProjectCruiser;
|
namespace Cruiser
|
||||||
using Microsoft.Extensions.Configuration;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using NLog.Extensions.Logging;
|
|
||||||
using Serilog;
|
|
||||||
namespace ProjectCruiser
|
|
||||||
{
|
{
|
||||||
internal static class Program
|
internal static class Program
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The main entry point for the application.
|
||||||
|
/// </summary>
|
||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main()
|
static void Main()
|
||||||
{
|
{
|
||||||
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
var services = new ServiceCollection();
|
Application.Run(new Form1());
|
||||||
ConfigureServices(services);
|
|
||||||
using (ServiceProvider serviceProvider = services.BuildServiceProvider())
|
|
||||||
{
|
|
||||||
Application.Run(serviceProvider.GetRequiredService<FormCruiserCollection>());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void ConfigureServices(ServiceCollection services)
|
|
||||||
{
|
|
||||||
services.AddSingleton<FormCruiserCollection>().AddLogging(option =>
|
|
||||||
{
|
|
||||||
string[] path = Directory.GetCurrentDirectory().Split('\\');
|
|
||||||
string pathNeed = "";
|
|
||||||
for (int i = 0; i < path.Length - 3; i++)
|
|
||||||
{
|
|
||||||
pathNeed += path[i] + "\\";
|
|
||||||
}
|
|
||||||
var configuration = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile(path: $"{pathNeed}appsettings.json", optional: false, reloadOnChange: true).Build();
|
|
||||||
var logger = new LoggerConfiguration().ReadFrom.Configuration(configuration).CreateLogger();
|
|
||||||
|
|
||||||
option.SetMinimumLevel(LogLevel.Information);
|
|
||||||
option.AddSerilog(logger);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
103
Cruiser/Cruiser/Properties/Resources.Designer.cs
generated
103
Cruiser/Cruiser/Properties/Resources.Designer.cs
generated
@ -1,103 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// Этот код создан программой.
|
|
||||||
// Исполняемая версия:4.0.30319.42000
|
|
||||||
//
|
|
||||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
|
||||||
// повторной генерации кода.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace Cruiser.Properties {
|
|
||||||
using System;
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
|
|
||||||
/// </summary>
|
|
||||||
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
|
|
||||||
// с помощью такого средства, как ResGen или Visual Studio.
|
|
||||||
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
|
|
||||||
// с параметром /str или перестройте свой проект VS.
|
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
|
||||||
internal class Resources {
|
|
||||||
|
|
||||||
private static global::System.Resources.ResourceManager resourceMan;
|
|
||||||
|
|
||||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
|
||||||
|
|
||||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
|
||||||
internal Resources() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
|
|
||||||
/// </summary>
|
|
||||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
|
||||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
|
||||||
get {
|
|
||||||
if (object.ReferenceEquals(resourceMan, null)) {
|
|
||||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Cruiser.Properties.Resources", typeof(Resources).Assembly);
|
|
||||||
resourceMan = temp;
|
|
||||||
}
|
|
||||||
return resourceMan;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
|
|
||||||
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
|
|
||||||
/// </summary>
|
|
||||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
|
||||||
internal static global::System.Globalization.CultureInfo Culture {
|
|
||||||
get {
|
|
||||||
return resourceCulture;
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
resourceCulture = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap вверх {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("вверх", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap влево {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("влево", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap вниз {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("вниз", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap вправо {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("вправо", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
Before Width: | Height: | Size: 33 KiB |
Binary file not shown.
Before Width: | Height: | Size: 33 KiB |
Binary file not shown.
Before Width: | Height: | Size: 32 KiB |
Binary file not shown.
Before Width: | Height: | Size: 26 KiB |
@ -1,90 +0,0 @@
|
|||||||
using Cruiser;
|
|
||||||
using Cruiser.Exceptions;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectCruiser.Generics
|
|
||||||
{
|
|
||||||
internal class SetGeneric<T>
|
|
||||||
where T : class
|
|
||||||
{
|
|
||||||
private readonly List<T?> _places;
|
|
||||||
|
|
||||||
public int Count => _places.Count;
|
|
||||||
|
|
||||||
private readonly int _maxCount;
|
|
||||||
|
|
||||||
public SetGeneric(int count)
|
|
||||||
{
|
|
||||||
_maxCount = count;
|
|
||||||
_places = new List<T?>(count);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SortSet(IComparer<T?> comparer) => _places.Sort(comparer);
|
|
||||||
|
|
||||||
public bool Insert(T cruiser, IEqualityComparer<T>? equal = null)
|
|
||||||
{
|
|
||||||
Insert(cruiser, 0, equal);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Insert(T cruiser, int position, IEqualityComparer<T>? equal = null)
|
|
||||||
{
|
|
||||||
if (position < 0 || position >= _maxCount)
|
|
||||||
throw new CruiserNotFoundException(position);
|
|
||||||
|
|
||||||
if (Count >= _maxCount)
|
|
||||||
throw new StorageOverflowException(position);
|
|
||||||
if (equal != null)
|
|
||||||
{
|
|
||||||
if (_places.Contains(cruiser, equal))
|
|
||||||
throw new ArgumentException(nameof(cruiser));
|
|
||||||
}
|
|
||||||
_places.Insert(position, cruiser);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Remove(int position)
|
|
||||||
{
|
|
||||||
if (position < 0 || position > _maxCount || position >= Count)
|
|
||||||
throw new CruiserNotFoundException();
|
|
||||||
if (_places[position] == null)
|
|
||||||
{
|
|
||||||
throw new CruiserNotFoundException();
|
|
||||||
}
|
|
||||||
_places[position] = null;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public T? this[int position]
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (position < 0 || position > _maxCount)
|
|
||||||
return null;
|
|
||||||
return _places[position];
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (position < 0 || position > _maxCount)
|
|
||||||
return;
|
|
||||||
_places[position] = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<T?> GetCruiser(int? maxCruiser = null)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < _places.Count; ++i)
|
|
||||||
{
|
|
||||||
yield return _places[i];
|
|
||||||
if (maxCruiser.HasValue && i == maxCruiser.Value)
|
|
||||||
{
|
|
||||||
yield break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectCruiser.MovementStrategy
|
|
||||||
{
|
|
||||||
public enum Status
|
|
||||||
{
|
|
||||||
NotInit,
|
|
||||||
InProgress,
|
|
||||||
Finish
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.Serialization;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Cruiser.Exceptions
|
|
||||||
{
|
|
||||||
[Serializable] internal class StorageOverflowException : ApplicationException
|
|
||||||
{
|
|
||||||
public StorageOverflowException(int count) : base($"В наборе превышено допустимое количество: {count}") { }
|
|
||||||
public StorageOverflowException() : base() { }
|
|
||||||
public StorageOverflowException(string message) : base(message) { }
|
|
||||||
public StorageOverflowException(string message, Exception exception) : base(message, exception) { }
|
|
||||||
protected StorageOverflowException(SerializationInfo info, StreamingContext contex) : base(info, contex) { }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
{
|
|
||||||
"Serilog": {
|
|
||||||
"Using": [ "Serilog.Sinks.File" ],
|
|
||||||
"MinimumLevel": "Information",
|
|
||||||
"WriteTo": [
|
|
||||||
{
|
|
||||||
"Name": "File",
|
|
||||||
"Args": {
|
|
||||||
"path": "Logs/log_.log",
|
|
||||||
"rollingInterval": "Day",
|
|
||||||
"outputTemplate": "[{Timestamp:HH:mm:ss.fff}]{Level:u4}: {Message:lj}{NewLine}{Exception}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ],
|
|
||||||
"Properties": {
|
|
||||||
"Application": "GasolineTanker"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user