Compare commits

...

2 Commits

Author SHA1 Message Date
8dd04c6ee1 л5 2024-03-04 18:12:22 +04:00
169edd19f7 л5 2024-03-04 18:06:21 +04:00
41 changed files with 675 additions and 65 deletions

Binary file not shown.

Binary file not shown.

View File

@ -11,8 +11,8 @@ namespace WarmlyShip.DrawingObjects
public class DrawingWarmlyShip public class DrawingWarmlyShip
{ {
public EntityWarmlyShip? EntityWarmlyShip { get; protected set; } public EntityWarmlyShip? EntityWarmlyShip { get; protected set; }
private int _pictureWidth; public int _pictureWidth;
private int _pictureHeight; public int _pictureHeight;
protected int _startPosX; protected int _startPosX;
protected int _startPosY; protected int _startPosY;
protected readonly int _WarmlyShipWidth = 185; protected readonly int _WarmlyShipWidth = 185;
@ -128,6 +128,12 @@ namespace WarmlyShip.DrawingObjects
/// Получение объекта IMoveableObject из объекта DrawingCar /// Получение объекта IMoveableObject из объекта DrawingCar
/// </summary> /// </summary>
public IMoveableObject GetMoveableObject => new DrawingObjectShip(this); public IMoveableObject GetMoveableObject => new DrawingObjectShip(this);
public void ChangePictureBoxSize(int pictureBoxWidth, int pictureBoxHeight)
{
_pictureWidth = pictureBoxWidth;
_pictureHeight = pictureBoxHeight;
}
} }
} }

View File

@ -18,5 +18,9 @@ namespace WarmlyShip.Entities
Weight = weight; Weight = weight;
BodyColor = bodyColor; BodyColor = bodyColor;
} }
public void SetBodyColor(Color color)
{
BodyColor = color;
}
} }
} }

View File

@ -19,5 +19,9 @@ namespace WarmlyShip.Entities
Pipes = pipes; Pipes = pipes;
Section = section; Section = section;
} }
public void SetAdditionalColor(Color color)
{
AdditionalColor = color;
}
} }
} }

View File

@ -30,16 +30,16 @@
{ {
this.pictureBoxCollection = new System.Windows.Forms.PictureBox(); this.pictureBoxCollection = new System.Windows.Forms.PictureBox();
this.panelCollection = new System.Windows.Forms.Panel(); this.panelCollection = new System.Windows.Forms.Panel();
this.groupBoxSets = new System.Windows.Forms.GroupBox();
this.buttonDelObject = new System.Windows.Forms.Button();
this.listBoxStorages = new System.Windows.Forms.ListBox();
this.buttonnAddObject = new System.Windows.Forms.Button();
this.textBoxStorageName = new System.Windows.Forms.TextBox();
this.buttonRefreshCollection = new System.Windows.Forms.Button(); this.buttonRefreshCollection = new System.Windows.Forms.Button();
this.buttonRemoveShip = new System.Windows.Forms.Button(); this.buttonRemoveShip = new System.Windows.Forms.Button();
this.maskedTextBoxNumber = new System.Windows.Forms.MaskedTextBox(); this.maskedTextBoxNumber = new System.Windows.Forms.MaskedTextBox();
this.buttonAddShip = new System.Windows.Forms.Button(); this.buttonAddShip = new System.Windows.Forms.Button();
this.labelCollection = new System.Windows.Forms.Label(); this.labelCollection = new System.Windows.Forms.Label();
this.groupBoxSets = new System.Windows.Forms.GroupBox();
this.textBoxStorageName = new System.Windows.Forms.TextBox();
this.buttonnAddObject = new System.Windows.Forms.Button();
this.listBoxStorages = new System.Windows.Forms.ListBox();
this.buttonDelObject = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxCollection)).BeginInit();
this.panelCollection.SuspendLayout(); this.panelCollection.SuspendLayout();
this.groupBoxSets.SuspendLayout(); this.groupBoxSets.SuspendLayout();
@ -66,6 +66,54 @@
this.panelCollection.Size = new System.Drawing.Size(218, 536); this.panelCollection.Size = new System.Drawing.Size(218, 536);
this.panelCollection.TabIndex = 1; this.panelCollection.TabIndex = 1;
// //
// groupBoxSets
//
this.groupBoxSets.BackColor = System.Drawing.SystemColors.Control;
this.groupBoxSets.Controls.Add(this.buttonDelObject);
this.groupBoxSets.Controls.Add(this.listBoxStorages);
this.groupBoxSets.Controls.Add(this.buttonnAddObject);
this.groupBoxSets.Controls.Add(this.textBoxStorageName);
this.groupBoxSets.Location = new System.Drawing.Point(12, 42);
this.groupBoxSets.Name = "groupBoxSets";
this.groupBoxSets.Size = new System.Drawing.Size(199, 242);
this.groupBoxSets.TabIndex = 5;
this.groupBoxSets.TabStop = false;
this.groupBoxSets.Text = "Наборы";
//
// buttonDelObject
//
this.buttonDelObject.Location = new System.Drawing.Point(6, 207);
this.buttonDelObject.Name = "buttonDelObject";
this.buttonDelObject.Size = new System.Drawing.Size(187, 29);
this.buttonDelObject.TabIndex = 3;
this.buttonDelObject.Text = "Удалить набор";
this.buttonDelObject.UseVisualStyleBackColor = true;
//
// listBoxStorages
//
this.listBoxStorages.FormattingEnabled = true;
this.listBoxStorages.ItemHeight = 20;
this.listBoxStorages.Location = new System.Drawing.Point(6, 117);
this.listBoxStorages.Name = "listBoxStorages";
this.listBoxStorages.Size = new System.Drawing.Size(187, 84);
this.listBoxStorages.TabIndex = 2;
//
// buttonnAddObject
//
this.buttonnAddObject.Location = new System.Drawing.Point(4, 71);
this.buttonnAddObject.Name = "buttonnAddObject";
this.buttonnAddObject.Size = new System.Drawing.Size(189, 29);
this.buttonnAddObject.TabIndex = 1;
this.buttonnAddObject.Text = "Добавить набор";
this.buttonnAddObject.UseVisualStyleBackColor = true;
//
// textBoxStorageName
//
this.textBoxStorageName.Location = new System.Drawing.Point(0, 26);
this.textBoxStorageName.Name = "textBoxStorageName";
this.textBoxStorageName.Size = new System.Drawing.Size(193, 27);
this.textBoxStorageName.TabIndex = 0;
//
// buttonRefreshCollection // buttonRefreshCollection
// //
this.buttonRefreshCollection.Location = new System.Drawing.Point(16, 482); this.buttonRefreshCollection.Location = new System.Drawing.Point(16, 482);
@ -109,53 +157,6 @@
this.labelCollection.TabIndex = 0; this.labelCollection.TabIndex = 0;
this.labelCollection.Text = "Инструменты"; this.labelCollection.Text = "Инструменты";
// //
// groupBoxSets
//
this.groupBoxSets.Controls.Add(this.buttonDelObject);
this.groupBoxSets.Controls.Add(this.listBoxStorages);
this.groupBoxSets.Controls.Add(this.buttonnAddObject);
this.groupBoxSets.Controls.Add(this.textBoxStorageName);
this.groupBoxSets.Location = new System.Drawing.Point(12, 42);
this.groupBoxSets.Name = "groupBoxSets";
this.groupBoxSets.Size = new System.Drawing.Size(199, 242);
this.groupBoxSets.TabIndex = 5;
this.groupBoxSets.TabStop = false;
this.groupBoxSets.Text = "Наборы";
//
// textBoxStorageName
//
this.textBoxStorageName.Location = new System.Drawing.Point(0, 26);
this.textBoxStorageName.Name = "textBoxStorageName";
this.textBoxStorageName.Size = new System.Drawing.Size(193, 27);
this.textBoxStorageName.TabIndex = 0;
//
// buttonnAddObject
//
this.buttonnAddObject.Location = new System.Drawing.Point(4, 71);
this.buttonnAddObject.Name = "buttonnAddObject";
this.buttonnAddObject.Size = new System.Drawing.Size(189, 29);
this.buttonnAddObject.TabIndex = 1;
this.buttonnAddObject.Text = "Добавить набор";
this.buttonnAddObject.UseVisualStyleBackColor = true;
//
// listBoxStorages
//
this.listBoxStorages.FormattingEnabled = true;
this.listBoxStorages.ItemHeight = 20;
this.listBoxStorages.Location = new System.Drawing.Point(6, 117);
this.listBoxStorages.Name = "listBoxStorages";
this.listBoxStorages.Size = new System.Drawing.Size(187, 84);
this.listBoxStorages.TabIndex = 2;
//
// buttonDelObject
//
this.buttonDelObject.Location = new System.Drawing.Point(6, 207);
this.buttonDelObject.Name = "buttonDelObject";
this.buttonDelObject.Size = new System.Drawing.Size(187, 29);
this.buttonDelObject.TabIndex = 3;
this.buttonDelObject.Text = "Удалить набор";
this.buttonDelObject.UseVisualStyleBackColor = true;
//
// FormShipCollection // FormShipCollection
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);

View File

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

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WarmlyShip
{
public partial class FormShipConfig : Form
{
public FormShipConfig()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,60 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -9,14 +9,32 @@ namespace WarmlyShip.Generics
internal class SetGeneric<T> internal class SetGeneric<T>
where T : class where T : class
{ {
/// <summary>
/// Список объектов, которые храним
/// </summary>
private readonly List<T?> _places; private readonly List<T?> _places;
/// Количество объектов в массиве
/// </summary>
public int Count => _places.Count; public int Count => _places.Count;
/// <summary>
/// Максимальное количество объектов в списке
/// </summary>
private readonly int _maxCount; private readonly int _maxCount;
/// <summary>
/// Конструктор
/// </summary>
/// <param name="count"></param>
public SetGeneric(int count) public SetGeneric(int count)
{ {
_maxCount = count; _maxCount = count;
_places = new List<T?>(count); _places = new List<T?>(count);
} }
/// <summary>
/// Добавление объекта в набор
/// </summary>
/// <param name="warmlyship">Добавляемый теплоход</param>
/// <returns></returns>
public bool Insert(T warmlyship) public bool Insert(T warmlyship)
{ {
if (_places.Count == _maxCount) if (_places.Count == _maxCount)
@ -26,7 +44,12 @@ namespace WarmlyShip.Generics
Insert(warmlyship, 0); Insert(warmlyship, 0);
return true; return true;
} }
/// <summary>
/// Добавление объекта в набор на конкретную позицию
/// </summary>
/// <param name="warmlyship">Добавляемый теплоход</param>
/// <param name="position">Позиция</param>
/// <returns></returns>
public bool Insert(T warmlyship, int position) public bool Insert(T warmlyship, int position)
{ {
if (!(position >= 0 && position <= Count && _places.Count < _maxCount)) if (!(position >= 0 && position <= Count && _places.Count < _maxCount))
@ -36,7 +59,11 @@ namespace WarmlyShip.Generics
_places.Insert(position, warmlyship); _places.Insert(position, warmlyship);
return true; return true;
} }
/// <summary>
/// Удаление объекта из набора с конкретной позиции
/// </summary>
/// <param name="position"></param>
/// <returns></returns>
public bool Remove(int position) public bool Remove(int position)
{ {
if (position < 0 || position >= Count) if (position < 0 || position >= Count)
@ -46,7 +73,11 @@ namespace WarmlyShip.Generics
_places.RemoveAt(position); _places.RemoveAt(position);
return true; return true;
} }
/// <summary>
/// Получение объекта из набора по позиции
/// </summary>
/// <param name="position"></param>
/// <returns></returns>
public T? this[int position] public T? this[int position]
{ {
get get
@ -80,4 +111,4 @@ namespace WarmlyShip.Generics
} }
} }
} }
} }

View File

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

View File

@ -6,6 +6,7 @@ using System.Threading.Tasks;
using WarmlyShip.DrawingObjects; using WarmlyShip.DrawingObjects;
using WarmlyShip.MovementStrategy; using WarmlyShip.MovementStrategy;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
namespace WarmlyShip.Generics namespace WarmlyShip.Generics
{ {
@ -13,11 +14,31 @@ namespace WarmlyShip.Generics
where T : DrawingWarmlyShip where T : DrawingWarmlyShip
where U : IMoveableObject where U : IMoveableObject
{ {
/// <summary>
/// Ширина окна прорисовки
/// </summary>
private readonly int _pictureWidth; private readonly int _pictureWidth;
/// <summary>
/// Высота окна прорисовки
/// </summary>
private readonly int _pictureHeight; private readonly int _pictureHeight;
/// <summary>
/// Размер занимаемого объектом места (ширина)
/// </summary>
private readonly int _placeSizeWidth = 185; private readonly int _placeSizeWidth = 185;
/// <summary>
/// Размер занимаемого объектом места (высота)
/// </summary>
private readonly int _placeSizeHeight = 185; private readonly int _placeSizeHeight = 185;
/// <summary>
/// Набор объектов
/// </summary>
private readonly SetGeneric<T> _collection; private readonly SetGeneric<T> _collection;
/// <summary>
/// Конструктор
/// </summary>
/// <param name="picWidth"></param>
/// <param name="picHeight"></param>
public ShipsGenericCollection(int picWidth, int picHeight) public ShipsGenericCollection(int picWidth, int picHeight)
{ {
int width = picWidth / _placeSizeWidth; int width = picWidth / _placeSizeWidth;
@ -26,6 +47,12 @@ namespace WarmlyShip.Generics
_pictureHeight = picHeight; _pictureHeight = picHeight;
_collection = new SetGeneric<T>(width * height); _collection = new SetGeneric<T>(width * height);
} }
/// <summary>
/// Перегрузка оператора сложения
/// </summary>
/// <param name="collect"></param>
/// <param name="obj"></param>
/// <returns></returns>
public static bool operator +(ShipsGenericCollection<T, U> collect, T? public static bool operator +(ShipsGenericCollection<T, U> collect, T?
obj) obj)
{ {
@ -35,6 +62,12 @@ namespace WarmlyShip.Generics
} }
return (bool)collect?._collection.Insert(obj); return (bool)collect?._collection.Insert(obj);
} }
/// <summary>
/// Перегрузка оператора вычитания
/// </summary>
/// <param name="collect"></param>
/// <param name="pos"></param>
/// <returns></returns>
public static T? operator -(ShipsGenericCollection<T, U> collect, int public static T? operator -(ShipsGenericCollection<T, U> collect, int
pos) pos)
{ {
@ -45,10 +78,19 @@ namespace WarmlyShip.Generics
} }
return obj; return obj;
} }
/// <summary>
/// Получение объекта IMoveableObject
/// </summary>
/// <param name="pos"></param>
/// <returns></returns>
public U? GetU(int pos) public U? GetU(int pos)
{ {
return (U?)_collection[pos]?.GetMoveableObject; return (U?)_collection[pos]?.GetMoveableObject;
} }
/// <summary>
/// Вывод всего набора объектов
/// </summary>
/// <returns></returns>
public Bitmap ShowShips() public Bitmap ShowShips()
{ {
Bitmap bmp = new(_pictureWidth, _pictureHeight); Bitmap bmp = new(_pictureWidth, _pictureHeight);
@ -57,6 +99,10 @@ namespace WarmlyShip.Generics
DrawObjects(gr); DrawObjects(gr);
return bmp; return bmp;
} }
/// <summary>
/// Метод отрисовки фона
/// </summary>
/// <param name="g"></param>
private void DrawBackground(Graphics g) private void DrawBackground(Graphics g)
{ {
Pen pen = new(Color.Black, 3); Pen pen = new(Color.Black, 3);
@ -64,7 +110,7 @@ namespace WarmlyShip.Generics
{ {
for (int j = 0; j < _pictureHeight / _placeSizeHeight + for (int j = 0; j < _pictureHeight / _placeSizeHeight +
1; ++j) 1; ++j)
{ {//линия рамзетки места
g.DrawLine(pen, i * _placeSizeWidth, j * g.DrawLine(pen, i * _placeSizeWidth, j *
_placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth / 2, j * _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth / 2, j *
_placeSizeHeight); _placeSizeHeight);
@ -73,6 +119,10 @@ namespace WarmlyShip.Generics
_placeSizeWidth, _pictureHeight / _placeSizeHeight * _placeSizeHeight); _placeSizeWidth, _pictureHeight / _placeSizeHeight * _placeSizeHeight);
} }
} }
/// <summary>
/// /// Метод прорисовки объектов
/// </summary>
/// <param name="g"></param>
private void DrawObjects(Graphics g) private void DrawObjects(Graphics g)
{ {
int i = 0; int i = 0;
@ -81,6 +131,8 @@ namespace WarmlyShip.Generics
if (ship != null) if (ship != null)
{ {
int width = _pictureWidth / _placeSizeWidth; int width = _pictureWidth / _placeSizeWidth;
ship._pictureWidth = _pictureWidth;
ship._pictureHeight = _pictureHeight;
ship.SetPosition((width - 1 - (i % width)) * _placeSizeWidth, i / width * _placeSizeHeight); ship.SetPosition((width - 1 - (i % width)) * _placeSizeWidth, i / width * _placeSizeHeight);
ship.DrawTransport(g); ship.DrawTransport(g);
} }
@ -89,3 +141,4 @@ namespace WarmlyShip.Generics
} }
} }
} }

View File

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

View File

@ -4,6 +4,9 @@
<Compile Update="FormShipCollection.cs"> <Compile Update="FormShipCollection.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Update="FormShipConfig.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="FormWarmlyShip.cs"> <Compile Update="FormWarmlyShip.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>

View File

@ -1 +1 @@
621cbda5ca6541382078a80e2a7b1378f7a5c582 b0cc6ac0be05ffb8fdd9efd25a085f52551f71ce

View File

@ -17,3 +17,4 @@ C:\Users\Екатерина\OneDrive\Desktop\РПП\MotorShip\MotorShip\obj\Debu
C:\Users\Екатерина\OneDrive\Desktop\РПП\MotorShip\MotorShip\obj\Debug\net6.0-windows\WarmlyShip.pdb C:\Users\Екатерина\OneDrive\Desktop\РПП\MotorShip\MotorShip\obj\Debug\net6.0-windows\WarmlyShip.pdb
C:\Users\Екатерина\OneDrive\Desktop\РПП\MotorShip\MotorShip\obj\Debug\net6.0-windows\WarmlyShip.genruntimeconfig.cache C:\Users\Екатерина\OneDrive\Desktop\РПП\MotorShip\MotorShip\obj\Debug\net6.0-windows\WarmlyShip.genruntimeconfig.cache
C:\Users\Екатерина\OneDrive\Desktop\РПП\MotorShip\MotorShip\obj\Debug\net6.0-windows\ref\WarmlyShip.dll C:\Users\Екатерина\OneDrive\Desktop\РПП\MotorShip\MotorShip\obj\Debug\net6.0-windows\ref\WarmlyShip.dll
C:\Users\Екатерина\OneDrive\Desktop\РПП\MotorShip\MotorShip\obj\Debug\net6.0-windows\WarmlyShip.FormShipConfig.resources