Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd31bcb20c | ||
|
|
03ebc0d612 | ||
|
|
ce753bc8db | ||
|
|
f0cb0ab565 |
@@ -14,6 +14,7 @@ namespace Cruiser.Generics
|
|||||||
where T : DrawningCruiser
|
where T : DrawningCruiser
|
||||||
where U : IMoveableObject
|
where U : IMoveableObject
|
||||||
{
|
{
|
||||||
|
public IEnumerable<T?> GetCruiser => _collection.GetCruiser();
|
||||||
private readonly int _pictureWidth;
|
private readonly int _pictureWidth;
|
||||||
private readonly int _pictureHeight;
|
private readonly int _pictureHeight;
|
||||||
private readonly int _placeSizeWidth = 210;
|
private readonly int _placeSizeWidth = 210;
|
||||||
@@ -27,28 +28,29 @@ namespace Cruiser.Generics
|
|||||||
_pictureHeight = picHeight;
|
_pictureHeight = picHeight;
|
||||||
_collection = new SetGeneric<T>(width * height);
|
_collection = new SetGeneric<T>(width * height);
|
||||||
}
|
}
|
||||||
public static int operator +(CruiserGenericCollection<T, U> collect, T?
|
public static bool operator +(CruiserGenericCollection<T, U> collect, T? obj)
|
||||||
obj)
|
|
||||||
{
|
{
|
||||||
if (obj == null)
|
if (obj == null)
|
||||||
{
|
{
|
||||||
return -1;
|
return false;
|
||||||
}
|
}
|
||||||
return collect._collection.Insert(obj) ;
|
|
||||||
|
return collect?._collection.Insert(obj) ?? false;
|
||||||
}
|
}
|
||||||
public static bool operator -(CruiserGenericCollection<T, U> collect, int
|
public static T? operator -(CruiserGenericCollection<T, U> collect, int pos)
|
||||||
pos)
|
|
||||||
{
|
{
|
||||||
T? obj = collect._collection.Get(pos);
|
T? obj = collect._collection[pos];
|
||||||
if (obj != null)
|
if (obj != null)
|
||||||
{
|
{
|
||||||
collect._collection.Remove(pos);
|
collect._collection.Remove(pos);
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
public U? GetU(int pos)
|
public U? GetU(int pos)
|
||||||
{
|
{
|
||||||
return (U?)_collection.Get(pos)?.GetMoveableObject;
|
return (U?)_collection[pos]?.GetMoveableObject;
|
||||||
}
|
}
|
||||||
public Bitmap ShowCruisers()
|
public Bitmap ShowCruisers()
|
||||||
{
|
{
|
||||||
@@ -76,16 +78,19 @@ namespace Cruiser.Generics
|
|||||||
}
|
}
|
||||||
private void DrawObjects(Graphics g)
|
private void DrawObjects(Graphics g)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _collection.Count; i++)
|
int i = 0;
|
||||||
|
foreach (var cruiser in _collection.GetCruiser())
|
||||||
{
|
{
|
||||||
DrawningCruiser cruiser = _collection.Get(i);
|
|
||||||
if (cruiser != null)
|
if (cruiser != null)
|
||||||
{
|
{
|
||||||
int numPlacesInRow = _pictureWidth / _placeSizeWidth;
|
int inRow = _pictureWidth / _placeSizeWidth;
|
||||||
cruiser.SetPosition((i % numPlacesInRow) * _placeSizeWidth + _placeSizeWidth / 20, _placeSizeHeight * (i / numPlacesInRow) + _placeSizeHeight / 10);
|
cruiser.SetPosition((i % inRow) * _placeSizeWidth + _placeSizeWidth / 20, _placeSizeHeight * (i / inRow) + _placeSizeHeight / 10);
|
||||||
cruiser.DrawTransport(g);
|
cruiser.DrawTransport(g);
|
||||||
}
|
}
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
134
Cruiser/Cruiser/CruiserGenericStorage.cs
Normal file
134
Cruiser/Cruiser/CruiserGenericStorage.cs
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Cruiser.DrawningObjects;
|
||||||
|
using Cruiser.MovementStrategy;
|
||||||
|
|
||||||
|
namespace Cruiser.Generics
|
||||||
|
{
|
||||||
|
internal class CruiserGenericStorage
|
||||||
|
{
|
||||||
|
readonly Dictionary<string, CruiserGenericCollection<DrawningCruiser,
|
||||||
|
DrawningObjectCruiser>> _cruiserStorages;
|
||||||
|
public List<string> 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<string, CruiserGenericCollection<DrawningCruiser, DrawningObjectCruiser>>();
|
||||||
|
_pictureWidth = pictureWidth;
|
||||||
|
_pictureHeight = pictureHeight;
|
||||||
|
}
|
||||||
|
public void AddSet(string name)
|
||||||
|
{
|
||||||
|
_cruiserStorages.Add(name, new CruiserGenericCollection<DrawningCruiser, DrawningObjectCruiser>(_pictureWidth, _pictureHeight));
|
||||||
|
}
|
||||||
|
public void DelSet(string name)
|
||||||
|
{
|
||||||
|
if (!_cruiserStorages.ContainsKey(name))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_cruiserStorages.Remove(name);
|
||||||
|
}
|
||||||
|
public CruiserGenericCollection<DrawningCruiser, DrawningObjectCruiser>? this[string ind]
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_cruiserStorages.ContainsKey(ind))
|
||||||
|
{
|
||||||
|
return _cruiserStorages[ind];
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool SaveData(string filename)
|
||||||
|
{
|
||||||
|
if (File.Exists(filename))
|
||||||
|
{
|
||||||
|
File.Delete(filename);
|
||||||
|
}
|
||||||
|
StringBuilder data = new();
|
||||||
|
foreach (KeyValuePair<string, 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)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
string toWrite = $"CruiserStorage{Environment.NewLine}{data}";
|
||||||
|
var strs = toWrite.Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
|
||||||
|
using (StreamWriter sw = new(filename))
|
||||||
|
{
|
||||||
|
foreach (var str in strs)
|
||||||
|
{
|
||||||
|
sw.WriteLine(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool LoadData(string filename)
|
||||||
|
{
|
||||||
|
if (!File.Exists(filename))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
using (StreamReader sr = new(filename))
|
||||||
|
{
|
||||||
|
string str = sr.ReadLine();
|
||||||
|
var strs = str.Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
if (strs == null || strs.Length == 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!strs[0].StartsWith("CruiserStorage"))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
_cruiserStorages.Clear();
|
||||||
|
do
|
||||||
|
{
|
||||||
|
string[] record = str.Split(_separatorForKeyValue, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
if (record.Length != 2)
|
||||||
|
{
|
||||||
|
str = sr.ReadLine();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
CruiserGenericCollection<DrawningCruiser, DrawningObjectCruiser> collection = new(_pictureWidth, _pictureHeight);
|
||||||
|
string[] set = record[1].Split(_separatorRecords, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
foreach (string elem in set)
|
||||||
|
{
|
||||||
|
DrawningCruiser? cruiser =
|
||||||
|
elem?.CreateDrawningCruiser(_separatorForObject, _pictureWidth, _pictureHeight);
|
||||||
|
if (cruiser != null)
|
||||||
|
{
|
||||||
|
if (!(collection + cruiser))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_cruiserStorages.Add(record[0], collection);
|
||||||
|
|
||||||
|
str = sr.ReadLine();
|
||||||
|
} while (str != null);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,27 +19,38 @@ namespace Cruiser.DrawningObjects
|
|||||||
EntityCruiser = new EntityAdvancedCruiser(speed, weight, bodyColor, additionalColor, helicopterPad, coating);
|
EntityCruiser = new EntityAdvancedCruiser(speed, weight, bodyColor, additionalColor, helicopterPad, coating);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void DrawTransport(Graphics g)
|
public override void DrawTransport(Graphics g)
|
||||||
{
|
{
|
||||||
if (EntityCruiser is not EntityAdvancedCruiser cruiser)
|
if (EntityCruiser is not EntityAdvancedCruiser cruiser)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Pen pen = new Pen(Color.Black);
|
|
||||||
Brush addBrush = new SolidBrush(cruiser.AdditionalColor);
|
Brush addBrush = new SolidBrush(cruiser.AdditionalColor);
|
||||||
Brush brush = new SolidBrush(cruiser.BodyColor);
|
|
||||||
base.DrawTransport(g);
|
base.DrawTransport(g);
|
||||||
if (cruiser.HelicopterPad)
|
if (cruiser.HelicopterPad)
|
||||||
{
|
{
|
||||||
Brush brYellow = new SolidBrush(Color.Yellow);
|
|
||||||
g.FillEllipse(brYellow, _startPosX + 80, _startPosY + 5, 20,
|
Point[] trianglePoints1 =
|
||||||
20);
|
{
|
||||||
g.FillEllipse(brYellow, _startPosX + 80, _startPosY + 35, 20,
|
new Point(_startPosX + 20, _startPosY + 5),
|
||||||
20);
|
new Point(_startPosX + 40, _startPosY + 25),
|
||||||
|
new Point(_startPosX + 60, _startPosY + 5)
|
||||||
|
};
|
||||||
|
|
||||||
|
Point[] trianglePoints2 =
|
||||||
|
{
|
||||||
|
new Point(_startPosX + 20, _startPosY + 55),
|
||||||
|
new Point(_startPosX + 40, _startPosY + 35),
|
||||||
|
new Point(_startPosX + 60, _startPosY + 55)
|
||||||
|
};
|
||||||
|
|
||||||
|
g.FillPolygon(addBrush, trianglePoints1);
|
||||||
|
g.FillPolygon(addBrush, trianglePoints2);
|
||||||
}
|
}
|
||||||
if (cruiser.Coating)
|
if (cruiser.Coating)
|
||||||
{
|
{
|
||||||
g.FillEllipse(Brushes.Green, _startPosX + 90, _startPosY + 20, 20, 20);
|
g.FillEllipse(addBrush, _startPosX + 90, _startPosY + 20, 20, 20);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,6 +95,12 @@ width, int height, int cruiserWidth, int cruiserHeight)
|
|||||||
_ => false,
|
_ => false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ChangePictureBoxSize(int pictureBoxWidth, int pictureBoxHeight)
|
||||||
|
{
|
||||||
|
_pictureWidth = pictureBoxWidth;
|
||||||
|
_pictureHeight = pictureBoxHeight;
|
||||||
|
}
|
||||||
public virtual void DrawTransport(Graphics g)
|
public virtual void DrawTransport(Graphics g)
|
||||||
{
|
{
|
||||||
if (EntityCruiser == null)
|
if (EntityCruiser == null)
|
||||||
@@ -126,4 +132,5 @@ width, int height, int cruiserWidth, int cruiserHeight)
|
|||||||
_startPosY + 19, 30, 25);
|
_startPosY + 19, 30, 25);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -21,5 +21,9 @@ namespace Cruiser.Entities
|
|||||||
HelicopterPad = helicopterPad;
|
HelicopterPad = helicopterPad;
|
||||||
Coating = coating;
|
Coating = coating;
|
||||||
}
|
}
|
||||||
|
public void setAdditionalColor(Color color)
|
||||||
|
{
|
||||||
|
AdditionalColor = color;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -18,6 +18,9 @@ namespace Cruiser.Entities
|
|||||||
Weight = weight;
|
Weight = weight;
|
||||||
BodyColor = bodyColor;
|
BodyColor = bodyColor;
|
||||||
}
|
}
|
||||||
|
public void setBodyColor(Color color)
|
||||||
|
{
|
||||||
|
BodyColor = color;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
43
Cruiser/Cruiser/ExtentionDrawingCruiser.cs
Normal file
43
Cruiser/Cruiser/ExtentionDrawingCruiser.cs
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Cruiser.Entities;
|
||||||
|
|
||||||
|
namespace Cruiser.DrawningObjects
|
||||||
|
{
|
||||||
|
public static class ExtentionDrawingCruiser
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
if (strs.Length == 7)
|
||||||
|
{
|
||||||
|
return new DrawningAdvancedCruiser(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 separatorForObject)
|
||||||
|
{
|
||||||
|
var cruiser = drawningcruiser.EntityCruiser;
|
||||||
|
if (cruiser == null)
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
var str = $"{cruiser.Speed}{separatorForObject}{cruiser.Weight}{separatorForObject}{cruiser.BodyColor.Name}";
|
||||||
|
if (cruiser is not EntityAdvancedCruiser advancedCruiser)
|
||||||
|
{
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
return
|
||||||
|
$"{str}{separatorForObject}{advancedCruiser.AdditionalColor.Name}{separatorForObject}" +
|
||||||
|
$"{separatorForObject}{advancedCruiser.HelicopterPad}{separatorForObject}{advancedCruiser.Coating}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
180
Cruiser/Cruiser/FormCruiserCollection.Designer.cs
generated
180
Cruiser/Cruiser/FormCruiserCollection.Designer.cs
generated
@@ -17,84 +17,195 @@
|
|||||||
{
|
{
|
||||||
this.pictureBoxCruiser = new System.Windows.Forms.PictureBox();
|
this.pictureBoxCruiser = new System.Windows.Forms.PictureBox();
|
||||||
this.panelCruiser = new System.Windows.Forms.Panel();
|
this.panelCruiser = new System.Windows.Forms.Panel();
|
||||||
|
this.ButtonRefreshCollection = new System.Windows.Forms.Button();
|
||||||
this.ButtonRemoveCruiser = new System.Windows.Forms.Button();
|
this.ButtonRemoveCruiser = new System.Windows.Forms.Button();
|
||||||
this.ButtonAddCruiser = new System.Windows.Forms.Button();
|
|
||||||
this.textBoxCruiser = new System.Windows.Forms.TextBox();
|
this.textBoxCruiser = new System.Windows.Forms.TextBox();
|
||||||
this.ButtonRefresh = new System.Windows.Forms.Button();
|
this.ButtonAddCruiser = new System.Windows.Forms.Button();
|
||||||
|
this.panelSet = new System.Windows.Forms.Panel();
|
||||||
|
this.ButtonDelObject = new System.Windows.Forms.Button();
|
||||||
|
this.listBoxStorages = new System.Windows.Forms.ListBox();
|
||||||
|
this.ButtonAddObject = new System.Windows.Forms.Button();
|
||||||
|
this.textBoxSet = new System.Windows.Forms.TextBox();
|
||||||
|
this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
|
||||||
|
this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
|
||||||
|
this.menuStrip = new System.Windows.Forms.MenuStrip();
|
||||||
|
this.FileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.SaveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.LoadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCruiser)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCruiser)).BeginInit();
|
||||||
this.panelCruiser.SuspendLayout();
|
this.panelCruiser.SuspendLayout();
|
||||||
|
this.panelSet.SuspendLayout();
|
||||||
|
this.menuStrip.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// pictureBoxCruiser
|
// pictureBoxCruiser
|
||||||
//
|
//
|
||||||
this.pictureBoxCruiser.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.pictureBoxCruiser.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.pictureBoxCruiser.Location = new System.Drawing.Point(0, 0);
|
this.pictureBoxCruiser.Location = new System.Drawing.Point(0, 33);
|
||||||
this.pictureBoxCruiser.Name = "pictureBoxCruiser";
|
this.pictureBoxCruiser.Name = "pictureBoxCruiser";
|
||||||
this.pictureBoxCruiser.Size = new System.Drawing.Size(800, 450);
|
this.pictureBoxCruiser.Size = new System.Drawing.Size(904, 477);
|
||||||
this.pictureBoxCruiser.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
|
this.pictureBoxCruiser.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
|
||||||
this.pictureBoxCruiser.TabIndex = 0;
|
this.pictureBoxCruiser.TabIndex = 0;
|
||||||
this.pictureBoxCruiser.TabStop = false;
|
this.pictureBoxCruiser.TabStop = false;
|
||||||
//
|
//
|
||||||
// panelCruiser
|
// panelCruiser
|
||||||
//
|
//
|
||||||
this.panelCruiser.Controls.Add(this.ButtonRefresh);
|
this.panelCruiser.Controls.Add(this.ButtonRefreshCollection);
|
||||||
this.panelCruiser.Controls.Add(this.ButtonRemoveCruiser);
|
this.panelCruiser.Controls.Add(this.ButtonRemoveCruiser);
|
||||||
this.panelCruiser.Controls.Add(this.ButtonAddCruiser);
|
|
||||||
this.panelCruiser.Controls.Add(this.textBoxCruiser);
|
this.panelCruiser.Controls.Add(this.textBoxCruiser);
|
||||||
this.panelCruiser.Location = new System.Drawing.Point(589, 12);
|
this.panelCruiser.Controls.Add(this.ButtonAddCruiser);
|
||||||
|
this.panelCruiser.Controls.Add(this.panelSet);
|
||||||
|
this.panelCruiser.Location = new System.Drawing.Point(655, 12);
|
||||||
this.panelCruiser.Name = "panelCruiser";
|
this.panelCruiser.Name = "panelCruiser";
|
||||||
this.panelCruiser.Size = new System.Drawing.Size(211, 438);
|
this.panelCruiser.Size = new System.Drawing.Size(221, 486);
|
||||||
this.panelCruiser.TabIndex = 1;
|
this.panelCruiser.TabIndex = 1;
|
||||||
//
|
//
|
||||||
|
// ButtonRefreshCollection
|
||||||
|
//
|
||||||
|
this.ButtonRefreshCollection.Location = new System.Drawing.Point(45, 435);
|
||||||
|
this.ButtonRefreshCollection.Name = "ButtonRefreshCollection";
|
||||||
|
this.ButtonRefreshCollection.Size = new System.Drawing.Size(138, 41);
|
||||||
|
this.ButtonRefreshCollection.TabIndex = 2;
|
||||||
|
this.ButtonRefreshCollection.Text = "Обновить";
|
||||||
|
this.ButtonRefreshCollection.UseVisualStyleBackColor = true;
|
||||||
|
this.ButtonRefreshCollection.Click += new System.EventHandler(this.ButtonRefreshCollection_Click);
|
||||||
|
//
|
||||||
// ButtonRemoveCruiser
|
// ButtonRemoveCruiser
|
||||||
//
|
//
|
||||||
this.ButtonRemoveCruiser.Location = new System.Drawing.Point(31, 168);
|
this.ButtonRemoveCruiser.Location = new System.Drawing.Point(45, 391);
|
||||||
this.ButtonRemoveCruiser.Name = "ButtonRemoveCruiser";
|
this.ButtonRemoveCruiser.Name = "ButtonRemoveCruiser";
|
||||||
this.ButtonRemoveCruiser.Size = new System.Drawing.Size(150, 34);
|
this.ButtonRemoveCruiser.Size = new System.Drawing.Size(138, 38);
|
||||||
this.ButtonRemoveCruiser.TabIndex = 2;
|
this.ButtonRemoveCruiser.TabIndex = 2;
|
||||||
this.ButtonRemoveCruiser.Text = "Удалить";
|
this.ButtonRemoveCruiser.Text = "Удалить";
|
||||||
this.ButtonRemoveCruiser.UseVisualStyleBackColor = true;
|
this.ButtonRemoveCruiser.UseVisualStyleBackColor = true;
|
||||||
this.ButtonRemoveCruiser.Click += new System.EventHandler(this.ButtonRemoveCruiser_Click);
|
this.ButtonRemoveCruiser.Click += new System.EventHandler(this.ButtonRemoveCruiser_Click);
|
||||||
//
|
//
|
||||||
|
// textBoxCruiser
|
||||||
|
//
|
||||||
|
this.textBoxCruiser.Location = new System.Drawing.Point(45, 330);
|
||||||
|
this.textBoxCruiser.Name = "textBoxCruiser";
|
||||||
|
this.textBoxCruiser.Size = new System.Drawing.Size(133, 31);
|
||||||
|
this.textBoxCruiser.TabIndex = 3;
|
||||||
|
//
|
||||||
// ButtonAddCruiser
|
// ButtonAddCruiser
|
||||||
//
|
//
|
||||||
this.ButtonAddCruiser.Location = new System.Drawing.Point(31, 37);
|
this.ButtonAddCruiser.Location = new System.Drawing.Point(45, 266);
|
||||||
this.ButtonAddCruiser.Name = "ButtonAddCruiser";
|
this.ButtonAddCruiser.Name = "ButtonAddCruiser";
|
||||||
this.ButtonAddCruiser.Size = new System.Drawing.Size(150, 34);
|
this.ButtonAddCruiser.Size = new System.Drawing.Size(133, 38);
|
||||||
this.ButtonAddCruiser.TabIndex = 3;
|
this.ButtonAddCruiser.TabIndex = 2;
|
||||||
this.ButtonAddCruiser.Text = "Добавить";
|
this.ButtonAddCruiser.Text = "Добавить";
|
||||||
this.ButtonAddCruiser.UseVisualStyleBackColor = true;
|
this.ButtonAddCruiser.UseVisualStyleBackColor = true;
|
||||||
this.ButtonAddCruiser.Click += new System.EventHandler(this.ButtonAddCruiser_Click);
|
this.ButtonAddCruiser.Click += new System.EventHandler(this.ButtonAddCruiser_Click);
|
||||||
//
|
//
|
||||||
// textBoxCruiser
|
// panelSet
|
||||||
//
|
//
|
||||||
this.textBoxCruiser.Location = new System.Drawing.Point(31, 104);
|
this.panelSet.Controls.Add(this.ButtonDelObject);
|
||||||
this.textBoxCruiser.Name = "textBoxCruiser";
|
this.panelSet.Controls.Add(this.listBoxStorages);
|
||||||
this.textBoxCruiser.Size = new System.Drawing.Size(150, 31);
|
this.panelSet.Controls.Add(this.ButtonAddObject);
|
||||||
this.textBoxCruiser.TabIndex = 2;
|
this.panelSet.Controls.Add(this.textBoxSet);
|
||||||
|
this.panelSet.Location = new System.Drawing.Point(22, 19);
|
||||||
|
this.panelSet.Name = "panelSet";
|
||||||
|
this.panelSet.Size = new System.Drawing.Size(185, 241);
|
||||||
|
this.panelSet.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// ButtonRefresh
|
// ButtonDelObject
|
||||||
//
|
//
|
||||||
this.ButtonRefresh.Location = new System.Drawing.Point(46, 324);
|
this.ButtonDelObject.Location = new System.Drawing.Point(18, 175);
|
||||||
this.ButtonRefresh.Name = "ButtonRefresh";
|
this.ButtonDelObject.Name = "ButtonDelObject";
|
||||||
this.ButtonRefresh.Size = new System.Drawing.Size(120, 31);
|
this.ButtonDelObject.Size = new System.Drawing.Size(153, 47);
|
||||||
this.ButtonRefresh.TabIndex = 2;
|
this.ButtonDelObject.TabIndex = 2;
|
||||||
this.ButtonRefresh.Text = "Обновить";
|
this.ButtonDelObject.Text = "Удалить набор";
|
||||||
this.ButtonRefresh.UseVisualStyleBackColor = true;
|
this.ButtonDelObject.UseVisualStyleBackColor = true;
|
||||||
this.ButtonRefresh.Click += new System.EventHandler(this.ButtonRefreshCollection_Click);
|
this.ButtonDelObject.Click += new System.EventHandler(this.ButtonDelObject_Click);
|
||||||
|
//
|
||||||
|
// listBoxStorages
|
||||||
|
//
|
||||||
|
this.listBoxStorages.FormattingEnabled = true;
|
||||||
|
this.listBoxStorages.ItemHeight = 25;
|
||||||
|
this.listBoxStorages.Location = new System.Drawing.Point(49, 115);
|
||||||
|
this.listBoxStorages.Name = "listBoxStorages";
|
||||||
|
this.listBoxStorages.Size = new System.Drawing.Size(97, 54);
|
||||||
|
this.listBoxStorages.TabIndex = 3;
|
||||||
|
this.listBoxStorages.SelectedIndexChanged += new System.EventHandler(this.listBoxObjects_SelectedIndexChanged);
|
||||||
|
//
|
||||||
|
// ButtonAddObject
|
||||||
|
//
|
||||||
|
this.ButtonAddObject.Location = new System.Drawing.Point(18, 58);
|
||||||
|
this.ButtonAddObject.Name = "ButtonAddObject";
|
||||||
|
this.ButtonAddObject.Size = new System.Drawing.Size(153, 51);
|
||||||
|
this.ButtonAddObject.TabIndex = 2;
|
||||||
|
this.ButtonAddObject.Text = "Создать набор";
|
||||||
|
this.ButtonAddObject.UseVisualStyleBackColor = true;
|
||||||
|
this.ButtonAddObject.Click += new System.EventHandler(this.ButtonAddObject_Click);
|
||||||
|
//
|
||||||
|
// textBoxSet
|
||||||
|
//
|
||||||
|
this.textBoxSet.Location = new System.Drawing.Point(38, 21);
|
||||||
|
this.textBoxSet.Name = "textBoxSet";
|
||||||
|
this.textBoxSet.Size = new System.Drawing.Size(118, 31);
|
||||||
|
this.textBoxSet.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// openFileDialog
|
||||||
|
//
|
||||||
|
this.openFileDialog.FileName = "openFileDialog";
|
||||||
|
this.openFileDialog.Filter = "txt file | *.txt";
|
||||||
|
//
|
||||||
|
// saveFileDialog
|
||||||
|
//
|
||||||
|
this.saveFileDialog.Filter = "txt file | *.txt";
|
||||||
|
//
|
||||||
|
// menuStrip
|
||||||
|
//
|
||||||
|
this.menuStrip.ImageScalingSize = new System.Drawing.Size(24, 24);
|
||||||
|
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.FileToolStripMenuItem});
|
||||||
|
this.menuStrip.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.menuStrip.Name = "menuStrip";
|
||||||
|
this.menuStrip.Size = new System.Drawing.Size(904, 33);
|
||||||
|
this.menuStrip.TabIndex = 2;
|
||||||
|
this.menuStrip.Text = "menuStrip";
|
||||||
|
//
|
||||||
|
// FileToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.FileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.SaveToolStripMenuItem,
|
||||||
|
this.LoadToolStripMenuItem});
|
||||||
|
this.FileToolStripMenuItem.Name = "FileToolStripMenuItem";
|
||||||
|
this.FileToolStripMenuItem.Size = new System.Drawing.Size(69, 29);
|
||||||
|
this.FileToolStripMenuItem.Text = "Файл";
|
||||||
|
//
|
||||||
|
// SaveToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.SaveToolStripMenuItem.Name = "SaveToolStripMenuItem";
|
||||||
|
this.SaveToolStripMenuItem.Size = new System.Drawing.Size(270, 34);
|
||||||
|
this.SaveToolStripMenuItem.Text = "Сохранить";
|
||||||
|
this.SaveToolStripMenuItem.Click += new System.EventHandler(this.SaveToolStripMenuItem_Click);
|
||||||
|
//
|
||||||
|
// LoadToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.LoadToolStripMenuItem.Name = "LoadToolStripMenuItem";
|
||||||
|
this.LoadToolStripMenuItem.Size = new System.Drawing.Size(270, 34);
|
||||||
|
this.LoadToolStripMenuItem.Text = "Загрузить";
|
||||||
|
this.LoadToolStripMenuItem.Click += new System.EventHandler(this.LoadToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// FormCruiserCollection
|
// FormCruiserCollection
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
this.ClientSize = new System.Drawing.Size(904, 510);
|
||||||
this.Controls.Add(this.panelCruiser);
|
this.Controls.Add(this.panelCruiser);
|
||||||
this.Controls.Add(this.pictureBoxCruiser);
|
this.Controls.Add(this.pictureBoxCruiser);
|
||||||
|
this.Controls.Add(this.menuStrip);
|
||||||
|
this.MainMenuStrip = this.menuStrip;
|
||||||
this.Name = "FormCruiserCollection";
|
this.Name = "FormCruiserCollection";
|
||||||
this.Text = "FormCruiserCollection";
|
this.Text = "FormCruiserCollection";
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCruiser)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCruiser)).EndInit();
|
||||||
this.panelCruiser.ResumeLayout(false);
|
this.panelCruiser.ResumeLayout(false);
|
||||||
this.panelCruiser.PerformLayout();
|
this.panelCruiser.PerformLayout();
|
||||||
|
this.panelSet.ResumeLayout(false);
|
||||||
|
this.panelSet.PerformLayout();
|
||||||
|
this.menuStrip.ResumeLayout(false);
|
||||||
|
this.menuStrip.PerformLayout();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
|
|
||||||
@@ -103,9 +214,20 @@
|
|||||||
|
|
||||||
private PictureBox pictureBoxCruiser;
|
private PictureBox pictureBoxCruiser;
|
||||||
private Panel panelCruiser;
|
private Panel panelCruiser;
|
||||||
private Button ButtonRemoveCruiser;
|
private Panel panelSet;
|
||||||
|
private TextBox textBoxSet;
|
||||||
|
private ListBox listBoxStorages;
|
||||||
|
private Button ButtonAddObject;
|
||||||
|
private Button ButtonDelObject;
|
||||||
private Button ButtonAddCruiser;
|
private Button ButtonAddCruiser;
|
||||||
|
private Button ButtonRemoveCruiser;
|
||||||
private TextBox textBoxCruiser;
|
private TextBox textBoxCruiser;
|
||||||
private Button ButtonRefresh;
|
private Button ButtonRefreshCollection;
|
||||||
|
private OpenFileDialog openFileDialog;
|
||||||
|
private SaveFileDialog saveFileDialog;
|
||||||
|
private MenuStrip menuStrip;
|
||||||
|
private ToolStripMenuItem FileToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem SaveToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem LoadToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using Cruiser.Generics;
|
using Cruiser.Generics;
|
||||||
|
using Cruiser.DrawningObjects;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@@ -8,48 +9,117 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Cruiser.DrawningObjects;
|
|
||||||
using Cruiser.MovementStrategy;
|
|
||||||
|
|
||||||
namespace Cruiser
|
namespace Cruiser
|
||||||
{
|
{
|
||||||
public partial class FormCruiserCollection : Form
|
public partial class FormCruiserCollection : Form
|
||||||
{
|
{
|
||||||
private readonly CruiserGenericCollection<DrawningCruiser, DrawningObjectCruiser> _cruiser;
|
private readonly CruiserGenericStorage _storage;
|
||||||
|
|
||||||
public FormCruiserCollection()
|
public FormCruiserCollection()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_cruiser = new CruiserGenericCollection<DrawningCruiser, DrawningObjectCruiser>(pictureBoxCruiser.Width, pictureBoxCruiser.Height);
|
_storage = new CruiserGenericStorage(pictureBoxCruiser.Width, pictureBoxCruiser.Height);
|
||||||
|
}
|
||||||
|
private void ReloadObjects()
|
||||||
|
{
|
||||||
|
int index = listBoxStorages.SelectedIndex;
|
||||||
|
|
||||||
|
listBoxStorages.Items.Clear();
|
||||||
|
for (int i = 0; i < _storage.Keys.Count; i++)
|
||||||
|
{
|
||||||
|
listBoxStorages.Items.Add(_storage.Keys[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (listBoxStorages.Items.Count > 0 && (index == -1 || index >= listBoxStorages.Items.Count))
|
||||||
|
{
|
||||||
|
listBoxStorages.SelectedIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (listBoxStorages.Items.Count > 0 && index > -1 && index < listBoxStorages.Items.Count)
|
||||||
|
{
|
||||||
|
listBoxStorages.SelectedIndex = index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ButtonAddObject_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(textBoxSet.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не все данные заполнены", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_storage.AddSet(textBoxSet.Text);
|
||||||
|
ReloadObjects();
|
||||||
|
}
|
||||||
|
private void listBoxObjects_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
pictureBoxCruiser.Image = _storage[listBoxStorages.SelectedItem?.ToString() ?? string.Empty]?.ShowCruisers();
|
||||||
|
}
|
||||||
|
private void ButtonDelObject_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (listBoxStorages.SelectedIndex == -1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (MessageBox.Show($"Удалить объект{listBoxStorages.SelectedItem}?", "Удаление", MessageBoxButtons.YesNo,
|
||||||
|
MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
_storage.DelSet(listBoxStorages.SelectedItem.ToString()
|
||||||
|
?? string.Empty);
|
||||||
|
ReloadObjects();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private void ButtonAddCruiser_Click(object sender, EventArgs e)
|
private void ButtonAddCruiser_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
CruiserForm form = new();
|
if (listBoxStorages.SelectedIndex == -1)
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
{
|
||||||
if (_cruiser + form.SelectedCruiser != -1)
|
return;
|
||||||
|
}
|
||||||
|
var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
|
||||||
|
if (obj == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
FormCruiserConfig form = new();
|
||||||
|
form.Show();
|
||||||
|
Action<DrawningCruiser>? cruiserDelegate = new((m) =>
|
||||||
|
{
|
||||||
|
bool isAdditionSuccessful = (obj + m);
|
||||||
|
if (isAdditionSuccessful)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Объект добавлен");
|
MessageBox.Show("Объект добавлен");
|
||||||
pictureBoxCruiser.Image = _cruiser.ShowCruisers();
|
m.ChangePictureBoxSize(pictureBoxCruiser.Width, pictureBoxCruiser.Height);
|
||||||
|
pictureBoxCruiser.Image = obj.ShowCruisers();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageBox.Show("Не удалось добавить объект");
|
MessageBox.Show("Не удалось добавить объект");
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
form.AddEvent(cruiserDelegate);
|
||||||
}
|
}
|
||||||
private void ButtonRemoveCruiser_Click(object sender, EventArgs e)
|
private void ButtonRemoveCruiser_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (listBoxStorages.SelectedIndex == -1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var obj = _storage[listBoxStorages.SelectedItem.ToString() ??
|
||||||
|
string.Empty];
|
||||||
|
if (obj == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (MessageBox.Show("Удалить объект?", "Удаление",
|
if (MessageBox.Show("Удалить объект?", "Удаление",
|
||||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int pos = Convert.ToInt32(textBoxCruiser.Text);
|
int pos = Convert.ToInt32(textBoxCruiser.Text);
|
||||||
|
if (obj - pos != null)
|
||||||
if (_cruiser - pos != true)
|
|
||||||
{
|
{
|
||||||
MessageBox.Show("Объект удален");
|
MessageBox.Show("Объект удален");
|
||||||
pictureBoxCruiser.Image = _cruiser.ShowCruisers();
|
pictureBoxCruiser.Image = obj.ShowCruisers();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -58,7 +128,50 @@ namespace Cruiser
|
|||||||
}
|
}
|
||||||
private void ButtonRefreshCollection_Click(object sender, EventArgs e)
|
private void ButtonRefreshCollection_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
pictureBoxCruiser.Image = _cruiser.ShowCruisers();
|
if (listBoxStorages.SelectedIndex == -1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var obj = _storage[listBoxStorages.SelectedItem.ToString() ??
|
||||||
|
string.Empty];
|
||||||
|
if (obj == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
pictureBoxCruiser.Image = obj.ShowCruisers();
|
||||||
|
}
|
||||||
|
private void SaveToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
if (_storage.SaveData(saveFileDialog.FileName))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Сохранение прошло успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не сохранилось", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
if (_storage.LoadData(openFileDialog.FileName))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Загрузка прошла успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
foreach (var collection in _storage.Keys)
|
||||||
|
{
|
||||||
|
listBoxStorages.Items.Add(collection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Не загрузилось", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -57,4 +57,13 @@
|
|||||||
<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>
|
||||||
|
<metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="saveFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>201, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>379, 17</value>
|
||||||
|
</metadata>
|
||||||
</root>
|
</root>
|
||||||
381
Cruiser/Cruiser/FormCruiserConfig.Designer.cs
generated
Normal file
381
Cruiser/Cruiser/FormCruiserConfig.Designer.cs
generated
Normal file
@@ -0,0 +1,381 @@
|
|||||||
|
namespace Cruiser
|
||||||
|
{
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
this.groupBoxCruiser = new System.Windows.Forms.GroupBox();
|
||||||
|
this.checkBoxMissileSilos = new System.Windows.Forms.CheckBox();
|
||||||
|
this.buttonCancel = new System.Windows.Forms.Button();
|
||||||
|
this.buttonAdd = new System.Windows.Forms.Button();
|
||||||
|
this.panelOrchid = new System.Windows.Forms.Panel();
|
||||||
|
this.label_addit_color = new System.Windows.Forms.Label();
|
||||||
|
this.label_color = new System.Windows.Forms.Label();
|
||||||
|
this.pictureBoxCruiser = new System.Windows.Forms.PictureBox();
|
||||||
|
this.labelAdvanced = new System.Windows.Forms.Label();
|
||||||
|
this.labelBasic = new System.Windows.Forms.Label();
|
||||||
|
this.groupBoxColor = new System.Windows.Forms.GroupBox();
|
||||||
|
this.panelColor = new System.Windows.Forms.Panel();
|
||||||
|
this.panelPink = new System.Windows.Forms.Panel();
|
||||||
|
this.panelViolet = new System.Windows.Forms.Panel();
|
||||||
|
this.panelBlue = new System.Windows.Forms.Panel();
|
||||||
|
this.panelLightBlue = new System.Windows.Forms.Panel();
|
||||||
|
this.panelPurple = new System.Windows.Forms.Panel();
|
||||||
|
this.panelBlack = new System.Windows.Forms.Panel();
|
||||||
|
this.panelWhite = new System.Windows.Forms.Panel();
|
||||||
|
this.checkBoxHelicopterPad = new System.Windows.Forms.CheckBox();
|
||||||
|
this.numericUpDownWeight = new System.Windows.Forms.NumericUpDown();
|
||||||
|
this.numericUpDownSpeed = new System.Windows.Forms.NumericUpDown();
|
||||||
|
this.labelWeight = new System.Windows.Forms.Label();
|
||||||
|
this.labelSpeed = new System.Windows.Forms.Label();
|
||||||
|
this.groupBoxCruiser.SuspendLayout();
|
||||||
|
this.panelOrchid.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCruiser)).BeginInit();
|
||||||
|
this.groupBoxColor.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).BeginInit();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// groupBoxCruiser
|
||||||
|
//
|
||||||
|
this.groupBoxCruiser.Controls.Add(this.checkBoxMissileSilos);
|
||||||
|
this.groupBoxCruiser.Controls.Add(this.buttonCancel);
|
||||||
|
this.groupBoxCruiser.Controls.Add(this.buttonAdd);
|
||||||
|
this.groupBoxCruiser.Controls.Add(this.panelOrchid);
|
||||||
|
this.groupBoxCruiser.Controls.Add(this.labelAdvanced);
|
||||||
|
this.groupBoxCruiser.Controls.Add(this.labelBasic);
|
||||||
|
this.groupBoxCruiser.Controls.Add(this.groupBoxColor);
|
||||||
|
this.groupBoxCruiser.Controls.Add(this.checkBoxHelicopterPad);
|
||||||
|
this.groupBoxCruiser.Controls.Add(this.numericUpDownWeight);
|
||||||
|
this.groupBoxCruiser.Controls.Add(this.numericUpDownSpeed);
|
||||||
|
this.groupBoxCruiser.Controls.Add(this.labelWeight);
|
||||||
|
this.groupBoxCruiser.Controls.Add(this.labelSpeed);
|
||||||
|
this.groupBoxCruiser.Location = new System.Drawing.Point(57, 43);
|
||||||
|
this.groupBoxCruiser.Name = "groupBoxCruiser";
|
||||||
|
this.groupBoxCruiser.Size = new System.Drawing.Size(1163, 391);
|
||||||
|
this.groupBoxCruiser.TabIndex = 0;
|
||||||
|
this.groupBoxCruiser.TabStop = false;
|
||||||
|
this.groupBoxCruiser.Text = "Параметры";
|
||||||
|
//
|
||||||
|
// checkBoxMissileSilos
|
||||||
|
//
|
||||||
|
this.checkBoxMissileSilos.AutoSize = true;
|
||||||
|
this.checkBoxMissileSilos.Location = new System.Drawing.Point(33, 277);
|
||||||
|
this.checkBoxMissileSilos.Name = "checkBoxMissileSilos";
|
||||||
|
this.checkBoxMissileSilos.Size = new System.Drawing.Size(232, 29);
|
||||||
|
this.checkBoxMissileSilos.TabIndex = 12;
|
||||||
|
this.checkBoxMissileSilos.Text = "Наличие ракетных шахт";
|
||||||
|
this.checkBoxMissileSilos.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
this.buttonCancel.Location = new System.Drawing.Point(991, 321);
|
||||||
|
this.buttonCancel.Name = "buttonCancel";
|
||||||
|
this.buttonCancel.Size = new System.Drawing.Size(127, 38);
|
||||||
|
this.buttonCancel.TabIndex = 11;
|
||||||
|
this.buttonCancel.Text = "Отмена";
|
||||||
|
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
this.buttonAdd.Location = new System.Drawing.Point(838, 321);
|
||||||
|
this.buttonAdd.Name = "buttonAdd";
|
||||||
|
this.buttonAdd.Size = new System.Drawing.Size(136, 38);
|
||||||
|
this.buttonAdd.TabIndex = 10;
|
||||||
|
this.buttonAdd.Text = "Добавить";
|
||||||
|
this.buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonAdd.Click += new System.EventHandler(this.ButtonAdd_Click);
|
||||||
|
//
|
||||||
|
// panelOrchid
|
||||||
|
//
|
||||||
|
this.panelOrchid.AllowDrop = true;
|
||||||
|
this.panelOrchid.Controls.Add(this.label_addit_color);
|
||||||
|
this.panelOrchid.Controls.Add(this.label_color);
|
||||||
|
this.panelOrchid.Controls.Add(this.pictureBoxCruiser);
|
||||||
|
this.panelOrchid.Location = new System.Drawing.Point(822, 45);
|
||||||
|
this.panelOrchid.Name = "panelOrchid";
|
||||||
|
this.panelOrchid.Size = new System.Drawing.Size(312, 261);
|
||||||
|
this.panelOrchid.TabIndex = 9;
|
||||||
|
this.panelOrchid.DragDrop += new System.Windows.Forms.DragEventHandler(this.PanelObject_DragDrop);
|
||||||
|
this.panelOrchid.DragEnter += new System.Windows.Forms.DragEventHandler(this.PanelObject_DragEnter);
|
||||||
|
//
|
||||||
|
// label_addit_color
|
||||||
|
//
|
||||||
|
this.label_addit_color.AllowDrop = true;
|
||||||
|
this.label_addit_color.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.label_addit_color.Location = new System.Drawing.Point(169, 23);
|
||||||
|
this.label_addit_color.Name = "label_addit_color";
|
||||||
|
this.label_addit_color.Size = new System.Drawing.Size(117, 38);
|
||||||
|
this.label_addit_color.TabIndex = 10;
|
||||||
|
this.label_addit_color.Text = "Доп.цвет";
|
||||||
|
this.label_addit_color.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
this.label_addit_color.DragDrop += new System.Windows.Forms.DragEventHandler(this.labelColor_DragDrop);
|
||||||
|
this.label_addit_color.DragEnter += new System.Windows.Forms.DragEventHandler(this.labelColor_DragEnter);
|
||||||
|
//
|
||||||
|
// label_color
|
||||||
|
//
|
||||||
|
this.label_color.AllowDrop = true;
|
||||||
|
this.label_color.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.label_color.Location = new System.Drawing.Point(30, 23);
|
||||||
|
this.label_color.Name = "label_color";
|
||||||
|
this.label_color.Size = new System.Drawing.Size(110, 38);
|
||||||
|
this.label_color.TabIndex = 9;
|
||||||
|
this.label_color.Text = "Цвет";
|
||||||
|
this.label_color.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
this.label_color.DragDrop += new System.Windows.Forms.DragEventHandler(this.labelColor_DragDrop);
|
||||||
|
this.label_color.DragEnter += new System.Windows.Forms.DragEventHandler(this.labelColor_DragEnter);
|
||||||
|
//
|
||||||
|
// pictureBoxCruiser
|
||||||
|
//
|
||||||
|
this.pictureBoxCruiser.Location = new System.Drawing.Point(76, 64);
|
||||||
|
this.pictureBoxCruiser.Name = "pictureBoxCruiser";
|
||||||
|
this.pictureBoxCruiser.Size = new System.Drawing.Size(163, 178);
|
||||||
|
this.pictureBoxCruiser.TabIndex = 8;
|
||||||
|
this.pictureBoxCruiser.TabStop = false;
|
||||||
|
//
|
||||||
|
// labelAdvanced
|
||||||
|
//
|
||||||
|
this.labelAdvanced.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.labelAdvanced.Location = new System.Drawing.Point(521, 293);
|
||||||
|
this.labelAdvanced.Name = "labelAdvanced";
|
||||||
|
this.labelAdvanced.Size = new System.Drawing.Size(141, 47);
|
||||||
|
this.labelAdvanced.TabIndex = 7;
|
||||||
|
this.labelAdvanced.Text = "Продвинутый";
|
||||||
|
this.labelAdvanced.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
this.labelAdvanced.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown);
|
||||||
|
//
|
||||||
|
// labelBasic
|
||||||
|
//
|
||||||
|
this.labelBasic.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.labelBasic.Location = new System.Drawing.Point(369, 293);
|
||||||
|
this.labelBasic.Name = "labelBasic";
|
||||||
|
this.labelBasic.Size = new System.Drawing.Size(131, 47);
|
||||||
|
this.labelBasic.TabIndex = 6;
|
||||||
|
this.labelBasic.Text = "Простой";
|
||||||
|
this.labelBasic.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
this.labelBasic.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown);
|
||||||
|
//
|
||||||
|
// groupBoxColor
|
||||||
|
//
|
||||||
|
this.groupBoxColor.Controls.Add(this.panelColor);
|
||||||
|
this.groupBoxColor.Controls.Add(this.panelPink);
|
||||||
|
this.groupBoxColor.Controls.Add(this.panelViolet);
|
||||||
|
this.groupBoxColor.Controls.Add(this.panelBlue);
|
||||||
|
this.groupBoxColor.Controls.Add(this.panelLightBlue);
|
||||||
|
this.groupBoxColor.Controls.Add(this.panelPurple);
|
||||||
|
this.groupBoxColor.Controls.Add(this.panelBlack);
|
||||||
|
this.groupBoxColor.Controls.Add(this.panelWhite);
|
||||||
|
this.groupBoxColor.Location = new System.Drawing.Point(335, 40);
|
||||||
|
this.groupBoxColor.Name = "groupBoxColor";
|
||||||
|
this.groupBoxColor.Size = new System.Drawing.Size(357, 231);
|
||||||
|
this.groupBoxColor.TabIndex = 5;
|
||||||
|
this.groupBoxColor.TabStop = false;
|
||||||
|
this.groupBoxColor.Text = "Цвета";
|
||||||
|
//
|
||||||
|
// panelColor
|
||||||
|
//
|
||||||
|
this.panelColor.BackColor = System.Drawing.Color.Fuchsia;
|
||||||
|
this.panelColor.Location = new System.Drawing.Point(264, 153);
|
||||||
|
this.panelColor.Name = "panelColor";
|
||||||
|
this.panelColor.Size = new System.Drawing.Size(53, 49);
|
||||||
|
this.panelColor.TabIndex = 7;
|
||||||
|
//
|
||||||
|
// panelPink
|
||||||
|
//
|
||||||
|
this.panelPink.BackColor = System.Drawing.Color.Violet;
|
||||||
|
this.panelPink.Location = new System.Drawing.Point(180, 153);
|
||||||
|
this.panelPink.Name = "panelPink";
|
||||||
|
this.panelPink.Size = new System.Drawing.Size(53, 49);
|
||||||
|
this.panelPink.TabIndex = 6;
|
||||||
|
//
|
||||||
|
// panelViolet
|
||||||
|
//
|
||||||
|
this.panelViolet.BackColor = System.Drawing.Color.DarkTurquoise;
|
||||||
|
this.panelViolet.Location = new System.Drawing.Point(108, 153);
|
||||||
|
this.panelViolet.Name = "panelViolet";
|
||||||
|
this.panelViolet.Size = new System.Drawing.Size(53, 49);
|
||||||
|
this.panelViolet.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// panelBlue
|
||||||
|
//
|
||||||
|
this.panelBlue.BackColor = System.Drawing.Color.PaleTurquoise;
|
||||||
|
this.panelBlue.Location = new System.Drawing.Point(34, 153);
|
||||||
|
this.panelBlue.Name = "panelBlue";
|
||||||
|
this.panelBlue.Size = new System.Drawing.Size(53, 49);
|
||||||
|
this.panelBlue.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// panelLightBlue
|
||||||
|
//
|
||||||
|
this.panelLightBlue.BackColor = System.Drawing.Color.Purple;
|
||||||
|
this.panelLightBlue.Location = new System.Drawing.Point(264, 44);
|
||||||
|
this.panelLightBlue.Name = "panelLightBlue";
|
||||||
|
this.panelLightBlue.Size = new System.Drawing.Size(53, 49);
|
||||||
|
this.panelLightBlue.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// panelPurple
|
||||||
|
//
|
||||||
|
this.panelPurple.BackColor = System.Drawing.Color.DarkOrchid;
|
||||||
|
this.panelPurple.Location = new System.Drawing.Point(186, 44);
|
||||||
|
this.panelPurple.Name = "panelPurple";
|
||||||
|
this.panelPurple.Size = new System.Drawing.Size(53, 49);
|
||||||
|
this.panelPurple.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// panelBlack
|
||||||
|
//
|
||||||
|
this.panelBlack.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
|
||||||
|
this.panelBlack.Location = new System.Drawing.Point(108, 44);
|
||||||
|
this.panelBlack.Name = "panelBlack";
|
||||||
|
this.panelBlack.Size = new System.Drawing.Size(53, 49);
|
||||||
|
this.panelBlack.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// panelWhite
|
||||||
|
//
|
||||||
|
this.panelWhite.BackColor = System.Drawing.SystemColors.ButtonHighlight;
|
||||||
|
this.panelWhite.Location = new System.Drawing.Point(32, 44);
|
||||||
|
this.panelWhite.Name = "panelWhite";
|
||||||
|
this.panelWhite.Size = new System.Drawing.Size(55, 49);
|
||||||
|
this.panelWhite.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// checkBoxHelicopterPad
|
||||||
|
//
|
||||||
|
this.checkBoxHelicopterPad.AutoSize = true;
|
||||||
|
this.checkBoxHelicopterPad.Location = new System.Drawing.Point(33, 213);
|
||||||
|
this.checkBoxHelicopterPad.Name = "checkBoxHelicopterPad";
|
||||||
|
this.checkBoxHelicopterPad.Size = new System.Drawing.Size(310, 29);
|
||||||
|
this.checkBoxHelicopterPad.TabIndex = 4;
|
||||||
|
this.checkBoxHelicopterPad.Text = "Наличие площадки под вертолет";
|
||||||
|
this.checkBoxHelicopterPad.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// numericUpDownWeight
|
||||||
|
//
|
||||||
|
this.numericUpDownWeight.Location = new System.Drawing.Point(128, 143);
|
||||||
|
this.numericUpDownWeight.Maximum = new decimal(new int[] {
|
||||||
|
1000,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.numericUpDownWeight.Minimum = new decimal(new int[] {
|
||||||
|
100,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.numericUpDownWeight.Name = "numericUpDownWeight";
|
||||||
|
this.numericUpDownWeight.Size = new System.Drawing.Size(84, 31);
|
||||||
|
this.numericUpDownWeight.TabIndex = 3;
|
||||||
|
this.numericUpDownWeight.Value = new decimal(new int[] {
|
||||||
|
100,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
//
|
||||||
|
// numericUpDownSpeed
|
||||||
|
//
|
||||||
|
this.numericUpDownSpeed.Location = new System.Drawing.Point(128, 75);
|
||||||
|
this.numericUpDownSpeed.Maximum = new decimal(new int[] {
|
||||||
|
1000,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.numericUpDownSpeed.Minimum = new decimal(new int[] {
|
||||||
|
100,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
this.numericUpDownSpeed.Name = "numericUpDownSpeed";
|
||||||
|
this.numericUpDownSpeed.Size = new System.Drawing.Size(74, 31);
|
||||||
|
this.numericUpDownSpeed.TabIndex = 2;
|
||||||
|
this.numericUpDownSpeed.Value = new decimal(new int[] {
|
||||||
|
100,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0});
|
||||||
|
//
|
||||||
|
// labelWeight
|
||||||
|
//
|
||||||
|
this.labelWeight.AutoSize = true;
|
||||||
|
this.labelWeight.Location = new System.Drawing.Point(33, 145);
|
||||||
|
this.labelWeight.Name = "labelWeight";
|
||||||
|
this.labelWeight.Size = new System.Drawing.Size(43, 25);
|
||||||
|
this.labelWeight.TabIndex = 1;
|
||||||
|
this.labelWeight.Text = "Вес:";
|
||||||
|
//
|
||||||
|
// labelSpeed
|
||||||
|
//
|
||||||
|
this.labelSpeed.AutoSize = true;
|
||||||
|
this.labelSpeed.Location = new System.Drawing.Point(33, 75);
|
||||||
|
this.labelSpeed.Name = "labelSpeed";
|
||||||
|
this.labelSpeed.Size = new System.Drawing.Size(93, 25);
|
||||||
|
this.labelSpeed.TabIndex = 0;
|
||||||
|
this.labelSpeed.Text = "Скорость:";
|
||||||
|
//
|
||||||
|
// FormCruiserConfig
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(1279, 552);
|
||||||
|
this.Controls.Add(this.groupBoxCruiser);
|
||||||
|
this.Name = "FormCruiserConfig";
|
||||||
|
this.Text = "Создание объекта";
|
||||||
|
this.groupBoxCruiser.ResumeLayout(false);
|
||||||
|
this.groupBoxCruiser.PerformLayout();
|
||||||
|
this.panelOrchid.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCruiser)).EndInit();
|
||||||
|
this.groupBoxColor.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).EndInit();
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private GroupBox groupBoxCruiser;
|
||||||
|
private Button buttonCancel;
|
||||||
|
private Button buttonAdd;
|
||||||
|
private Panel panelOrchid;
|
||||||
|
private Label label_addit_color;
|
||||||
|
private Label label_color;
|
||||||
|
private PictureBox pictureBoxCruiser;
|
||||||
|
private Label labelAdvanced;
|
||||||
|
private Label labelBasic;
|
||||||
|
private GroupBox groupBoxColor;
|
||||||
|
private Panel panelBlack;
|
||||||
|
private Panel panelWhite;
|
||||||
|
private CheckBox checkBoxHelicopterPad;
|
||||||
|
private NumericUpDown numericUpDownWeight;
|
||||||
|
private NumericUpDown numericUpDownSpeed;
|
||||||
|
private Label labelWeight;
|
||||||
|
private Label labelSpeed;
|
||||||
|
private CheckBox checkBoxMissileSilos;
|
||||||
|
private Panel panelColor;
|
||||||
|
private Panel panelPink;
|
||||||
|
private Panel panelViolet;
|
||||||
|
private Panel panelBlue;
|
||||||
|
private Panel panelLightBlue;
|
||||||
|
private Panel panelPurple;
|
||||||
|
}
|
||||||
|
}
|
||||||
126
Cruiser/Cruiser/FormCruiserConfig.cs
Normal file
126
Cruiser/Cruiser/FormCruiserConfig.cs
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
using Cruiser.DrawningObjects;
|
||||||
|
using Cruiser.Entities;
|
||||||
|
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 static System.Windows.Forms.VisualStyles.VisualStyleElement.Button;
|
||||||
|
|
||||||
|
namespace Cruiser
|
||||||
|
{
|
||||||
|
public partial class FormCruiserConfig : Form
|
||||||
|
{
|
||||||
|
DrawningCruiser? _cruiser = null;
|
||||||
|
public event Action<DrawningCruiser>? EventAddCruiser;
|
||||||
|
public FormCruiserConfig()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
panelWhite.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelBlack.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelLightBlue.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelBlue.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelPink.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelViolet.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelPurple.MouseDown += PanelColor_MouseDown;
|
||||||
|
panelOrchid.MouseDown += PanelColor_MouseDown;
|
||||||
|
buttonCancel.Click += (s, e) => Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawCruiser()
|
||||||
|
{
|
||||||
|
Bitmap bmp = new(pictureBoxCruiser.Width, pictureBoxCruiser.Height);
|
||||||
|
Graphics gr = Graphics.FromImage(bmp);
|
||||||
|
_cruiser?.SetPosition(5, 5);
|
||||||
|
_cruiser?.DrawTransport(gr);
|
||||||
|
pictureBoxCruiser.Image = bmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddEvent(Action<DrawningCruiser> ev)
|
||||||
|
{
|
||||||
|
if (EventAddCruiser == null)
|
||||||
|
{
|
||||||
|
EventAddCruiser = 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 "labelBasic":
|
||||||
|
_cruiser = new DrawningCruiser((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value,
|
||||||
|
Color.White, pictureBoxCruiser.Width, pictureBoxCruiser.Height);
|
||||||
|
break;
|
||||||
|
case "labelAdvanced":
|
||||||
|
_cruiser = new DrawningAdvancedCruiser((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value,
|
||||||
|
Color.White, Color.Black, checkBoxHelicopterPad.Checked, checkBoxMissileSilos.Checked,
|
||||||
|
pictureBoxCruiser.Width, pictureBoxCruiser.Height);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
label_color.BackColor = Color.Empty;
|
||||||
|
label_addit_color.BackColor = Color.Empty;
|
||||||
|
DrawCruiser();
|
||||||
|
}
|
||||||
|
private void PanelColor_MouseDown(object? sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
(sender as Control)?.DoDragDrop((sender as Control)?.BackColor, DragDropEffects.Move | DragDropEffects.Copy);
|
||||||
|
}
|
||||||
|
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
EventAddCruiser?.Invoke(_cruiser);
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
private void labelColor_DragDrop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (_cruiser?.EntityCruiser == null)
|
||||||
|
return;
|
||||||
|
switch (((Label)sender).Name)
|
||||||
|
{
|
||||||
|
case "label_color":
|
||||||
|
_cruiser?.EntityCruiser?.setBodyColor((Color)e.Data.GetData(typeof(Color)));
|
||||||
|
break;
|
||||||
|
case "label_addit_color":
|
||||||
|
if (!(_cruiser is DrawningAdvancedCruiser))
|
||||||
|
return;
|
||||||
|
(_cruiser.EntityCruiser as EntityAdvancedCruiser)?.setAdditionalColor(color: (Color)e.Data.GetData(typeof(Color)));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
DrawCruiser();
|
||||||
|
}
|
||||||
|
private void labelColor_DragEnter(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Data.GetDataPresent(typeof(Color)))
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.Copy;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e.Effect = DragDropEffects.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
60
Cruiser/Cruiser/FormCruiserConfig.resx
Normal file
60
Cruiser/Cruiser/FormCruiserConfig.resx
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
<root>
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
||||||
@@ -9,42 +9,32 @@ namespace Cruiser.Generics
|
|||||||
internal class SetGeneric<T>
|
internal class SetGeneric<T>
|
||||||
where T : class
|
where T : class
|
||||||
{
|
{
|
||||||
private readonly T?[] _places;
|
private readonly List<T?> _places;
|
||||||
public int Count => _places.Length;
|
public int Count => _places.Count;
|
||||||
public int startPointer = 0;
|
private readonly int _maxCount;
|
||||||
public SetGeneric(int count)
|
public SetGeneric(int count)
|
||||||
{
|
{
|
||||||
_places = new T?[count];
|
_maxCount = count;
|
||||||
|
_places = new List<T?>(count);
|
||||||
}
|
}
|
||||||
public int Insert(T cruiser)
|
public bool Insert(T cruiser)
|
||||||
{
|
{
|
||||||
return Insert(cruiser, 0);
|
if (_places.Count == _maxCount)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
public int Insert(T cruiser, int position)
|
|
||||||
{
|
Insert(cruiser, 0);
|
||||||
int nullIndex = -1, i;
|
return true;
|
||||||
if (position < 0 || position >= Count)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
for (i = position; i < Count; i++)
|
public bool Insert(T cruiser, int position)
|
||||||
{
|
{
|
||||||
if (_places[i] == null)
|
if (!(position >= 0 && position <= Count && _places.Count < _maxCount))
|
||||||
{
|
{
|
||||||
nullIndex = i;
|
return false;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
_places.Insert(position, cruiser);
|
||||||
if (nullIndex < 0)
|
return true;
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
for (i = nullIndex; i > position; i--)
|
|
||||||
{
|
|
||||||
_places[i] = _places[i - 1];
|
|
||||||
}
|
|
||||||
_places[position] = cruiser;
|
|
||||||
return position;
|
|
||||||
}
|
}
|
||||||
public bool Remove(int position)
|
public bool Remove(int position)
|
||||||
{
|
{
|
||||||
@@ -52,16 +42,40 @@ namespace Cruiser.Generics
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_places[position] = null;
|
|
||||||
|
_places.RemoveAt(position);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public T? Get(int position)
|
public T? this[int position]
|
||||||
{
|
{
|
||||||
if (position < 0 || position >= Count)
|
get
|
||||||
|
{
|
||||||
|
if (position < 0 || position >= _maxCount)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return _places[position];
|
return _places[position];
|
||||||
}
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (!(position >= 0 && position < Count && _places.Count < _maxCount))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_places.Insert(position, value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public IEnumerable<T?> GetCruiser(int? maxCruisers = null)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _places.Count; ++i)
|
||||||
|
{
|
||||||
|
yield return _places[i];
|
||||||
|
if (maxCruisers.HasValue && i == maxCruisers.Value)
|
||||||
|
{
|
||||||
|
yield break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user