Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
d4ada468ee |
9
ProjectLiner/ProjectLiner/DirectionType.cs
Normal file
9
ProjectLiner/ProjectLiner/DirectionType.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
namespace ProjectLiner;
|
||||||
|
|
||||||
|
public enum DirectionType
|
||||||
|
{
|
||||||
|
Up = 1,
|
||||||
|
Down = 2,
|
||||||
|
Left = 3,
|
||||||
|
Right = 4,
|
||||||
|
}
|
157
ProjectLiner/ProjectLiner/DrawingLiner.cs
Normal file
157
ProjectLiner/ProjectLiner/DrawingLiner.cs
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
namespace ProjectLiner;
|
||||||
|
public class DrawingLiner
|
||||||
|
{
|
||||||
|
public LinerEntity? LinerEntity { get; set; }
|
||||||
|
|
||||||
|
private int? _pictureWidth;
|
||||||
|
|
||||||
|
private int? _pictureHeight;
|
||||||
|
|
||||||
|
private int? _startPosX;
|
||||||
|
|
||||||
|
private int? _startPosY;
|
||||||
|
|
||||||
|
private readonly int _drawingLinerWidth = 140;
|
||||||
|
|
||||||
|
private readonly int _drawingLinerHeight = 50;
|
||||||
|
public void Init(
|
||||||
|
int speed, double weight, Color primaryColor, Color secondaryColor,
|
||||||
|
LinerEntityType type, int capacity, int maxPassengers,
|
||||||
|
bool hasExtraDeck, bool hasPool
|
||||||
|
)
|
||||||
|
{
|
||||||
|
LinerEntity = new LinerEntity();
|
||||||
|
LinerEntity.Init(speed, weight, primaryColor, secondaryColor,
|
||||||
|
type, capacity, maxPassengers, hasExtraDeck, hasPool);
|
||||||
|
_pictureWidth = null;
|
||||||
|
_pictureHeight = null;
|
||||||
|
_startPosX = null;
|
||||||
|
_startPosY = null;
|
||||||
|
}
|
||||||
|
public bool SetPictureSize(int width, int height)
|
||||||
|
{
|
||||||
|
if (_drawingLinerWidth <= width && _drawingLinerHeight <= height)
|
||||||
|
{
|
||||||
|
_pictureWidth = width;
|
||||||
|
_pictureHeight = height;
|
||||||
|
return true;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void SetPosition(int x, int y)
|
||||||
|
{
|
||||||
|
if (!_pictureHeight.HasValue || !_pictureWidth.HasValue)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (x < 0)
|
||||||
|
{
|
||||||
|
x = 0;
|
||||||
|
}
|
||||||
|
else if (x > _pictureWidth.Value - _drawingLinerWidth)
|
||||||
|
{
|
||||||
|
x = _pictureWidth.Value - _drawingLinerWidth;
|
||||||
|
}
|
||||||
|
if (y < 0)
|
||||||
|
{
|
||||||
|
y = 0;
|
||||||
|
}
|
||||||
|
else if (y > _pictureHeight.Value - _drawingLinerHeight)
|
||||||
|
{
|
||||||
|
y = _pictureHeight.Value - _drawingLinerHeight;
|
||||||
|
}
|
||||||
|
_startPosX = x;
|
||||||
|
_startPosY = y;
|
||||||
|
}
|
||||||
|
public bool MoveTransport(DirectionType direction)
|
||||||
|
{
|
||||||
|
if (LinerEntity == null ||
|
||||||
|
!_startPosX.HasValue || !_startPosY.HasValue ||
|
||||||
|
!_pictureWidth.HasValue || !_pictureHeight.HasValue)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
switch (direction)
|
||||||
|
{
|
||||||
|
//left
|
||||||
|
case DirectionType.Left:
|
||||||
|
if (_startPosX.Value - LinerEntity.Step > 0)
|
||||||
|
{
|
||||||
|
_startPosX -= (int)LinerEntity.Step;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
//up
|
||||||
|
case DirectionType.Up:
|
||||||
|
if (_startPosY.Value - LinerEntity.Step > 0)
|
||||||
|
{
|
||||||
|
_startPosY -= (int)LinerEntity.Step;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
//right
|
||||||
|
case DirectionType.Right:
|
||||||
|
if (_startPosX.Value + LinerEntity.Step <
|
||||||
|
_pictureWidth.Value - _drawingLinerWidth)
|
||||||
|
{
|
||||||
|
_startPosX += (int)LinerEntity.Step;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
//down
|
||||||
|
case DirectionType.Down:
|
||||||
|
if (_startPosY.Value + LinerEntity.Step <
|
||||||
|
_pictureHeight.Value - _drawingLinerHeight)
|
||||||
|
{
|
||||||
|
_startPosY += (int)LinerEntity.Step;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public void DrawTransport(Graphics g)
|
||||||
|
{
|
||||||
|
if (LinerEntity == null ||
|
||||||
|
!_startPosX.HasValue || !_startPosY.HasValue)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int x = _startPosX.Value;
|
||||||
|
int y = _startPosY.Value;
|
||||||
|
|
||||||
|
Pen borderPen = new(Color.Black);
|
||||||
|
Brush bodyBrush = new SolidBrush(LinerEntity.PrimaryColor); // Hull
|
||||||
|
Brush additionalBrush = new SolidBrush(LinerEntity.SecondaryColor);
|
||||||
|
Brush deckBrush = new SolidBrush(Color.White); // Deck
|
||||||
|
Brush poolBrush = new SolidBrush(Color.Cyan); // Pool
|
||||||
|
|
||||||
|
// body (hull)
|
||||||
|
Point[] hullPoints = {
|
||||||
|
new Point(x + 20, y + 50), // bottom Left
|
||||||
|
new Point(x + 120, y + 50), // bottom right
|
||||||
|
new Point(x + 140, y + 20), // Top left
|
||||||
|
new Point(x , y + 20) // Top right
|
||||||
|
};
|
||||||
|
|
||||||
|
g.FillPolygon(bodyBrush, hullPoints);
|
||||||
|
g.DrawPolygon(borderPen, hullPoints);
|
||||||
|
|
||||||
|
// first deck
|
||||||
|
g.FillRectangle(deckBrush, x + 30, y + 10, 100, 10);
|
||||||
|
g.DrawRectangle(borderPen, x + 30, y + 10, 100, 10);
|
||||||
|
|
||||||
|
if (LinerEntity.HasPool)
|
||||||
|
{
|
||||||
|
// pool on the deck
|
||||||
|
g.FillEllipse(poolBrush, x + 35, y + 5, 30, 10);
|
||||||
|
g.DrawEllipse(borderPen, x + 35, y + 5, 30, 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (LinerEntity.HasExtraDeck)
|
||||||
|
{
|
||||||
|
// optional deck
|
||||||
|
g.FillRectangle(additionalBrush, x + 70, y, 50, 10);
|
||||||
|
g.DrawRectangle(borderPen, x + 70, y, 50, 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
39
ProjectLiner/ProjectLiner/Form1.Designer.cs
generated
39
ProjectLiner/ProjectLiner/Form1.Designer.cs
generated
@ -1,39 +0,0 @@
|
|||||||
namespace ProjectLiner
|
|
||||||
{
|
|
||||||
partial class Form1
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.components = new System.ComponentModel.Container();
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
|
||||||
this.Text = "Form1";
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
namespace ProjectLiner
|
|
||||||
{
|
|
||||||
public partial class Form1 : Form
|
|
||||||
{
|
|
||||||
public Form1()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
143
ProjectLiner/ProjectLiner/FormLiner.Designer.cs
generated
Normal file
143
ProjectLiner/ProjectLiner/FormLiner.Designer.cs
generated
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
namespace ProjectLiner
|
||||||
|
{
|
||||||
|
partial class FormLiner
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormLiner));
|
||||||
|
pictureBoxLiner = new PictureBox();
|
||||||
|
buttonCreateLiner = new Button();
|
||||||
|
buttonMoveLeft = new Button();
|
||||||
|
buttonMoveUp = new Button();
|
||||||
|
buttonMoveDown = new Button();
|
||||||
|
buttonMoveRight = new Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBoxLiner).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// pictureBoxLiner
|
||||||
|
//
|
||||||
|
pictureBoxLiner.Dock = DockStyle.Fill;
|
||||||
|
pictureBoxLiner.Location = new Point(0, 0);
|
||||||
|
pictureBoxLiner.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
pictureBoxLiner.Name = "pictureBoxLiner";
|
||||||
|
pictureBoxLiner.Size = new Size(995, 620);
|
||||||
|
pictureBoxLiner.TabIndex = 0;
|
||||||
|
pictureBoxLiner.TabStop = false;
|
||||||
|
//
|
||||||
|
// buttonCreateLiner
|
||||||
|
//
|
||||||
|
buttonCreateLiner.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||||
|
buttonCreateLiner.Location = new Point(10, 589);
|
||||||
|
buttonCreateLiner.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
buttonCreateLiner.Name = "buttonCreateLiner";
|
||||||
|
buttonCreateLiner.Size = new Size(82, 22);
|
||||||
|
buttonCreateLiner.TabIndex = 1;
|
||||||
|
buttonCreateLiner.Text = "Create";
|
||||||
|
buttonCreateLiner.UseVisualStyleBackColor = true;
|
||||||
|
buttonCreateLiner.Click += ButtonCreateLiner_Click;
|
||||||
|
//
|
||||||
|
// buttonMoveLeft
|
||||||
|
//
|
||||||
|
buttonMoveLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
buttonMoveLeft.BackgroundImage = Properties.Resources.icons8_arrow_left_60;
|
||||||
|
buttonMoveLeft.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonMoveLeft.Location = new Point(889, 585);
|
||||||
|
buttonMoveLeft.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
buttonMoveLeft.Name = "buttonMoveLeft";
|
||||||
|
buttonMoveLeft.Size = new Size(31, 26);
|
||||||
|
buttonMoveLeft.TabIndex = 2;
|
||||||
|
buttonMoveLeft.UseVisualStyleBackColor = true;
|
||||||
|
buttonMoveLeft.Click += ButtonMove_Click;
|
||||||
|
//
|
||||||
|
// buttonMoveUp
|
||||||
|
//
|
||||||
|
buttonMoveUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
buttonMoveUp.BackgroundImage = Properties.Resources.icons8_arrow_up_60;
|
||||||
|
buttonMoveUp.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonMoveUp.Location = new Point(925, 554);
|
||||||
|
buttonMoveUp.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
buttonMoveUp.Name = "buttonMoveUp";
|
||||||
|
buttonMoveUp.Size = new Size(31, 26);
|
||||||
|
buttonMoveUp.TabIndex = 3;
|
||||||
|
buttonMoveUp.UseVisualStyleBackColor = true;
|
||||||
|
buttonMoveUp.Click += ButtonMove_Click;
|
||||||
|
//
|
||||||
|
// buttonMoveDown
|
||||||
|
//
|
||||||
|
buttonMoveDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
buttonMoveDown.BackgroundImage = Properties.Resources.icons8_arrow_down_60;
|
||||||
|
buttonMoveDown.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonMoveDown.Location = new Point(925, 585);
|
||||||
|
buttonMoveDown.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
buttonMoveDown.Name = "buttonMoveDown";
|
||||||
|
buttonMoveDown.Size = new Size(31, 26);
|
||||||
|
buttonMoveDown.TabIndex = 4;
|
||||||
|
buttonMoveDown.UseVisualStyleBackColor = true;
|
||||||
|
buttonMoveDown.Click += ButtonMove_Click;
|
||||||
|
//
|
||||||
|
// buttonMoveRight
|
||||||
|
//
|
||||||
|
buttonMoveRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
buttonMoveRight.BackgroundImage = (Image)resources.GetObject("buttonMoveRight.BackgroundImage");
|
||||||
|
buttonMoveRight.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonMoveRight.Location = new Point(961, 585);
|
||||||
|
buttonMoveRight.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
buttonMoveRight.Name = "buttonMoveRight";
|
||||||
|
buttonMoveRight.Size = new Size(31, 26);
|
||||||
|
buttonMoveRight.TabIndex = 5;
|
||||||
|
buttonMoveRight.UseVisualStyleBackColor = true;
|
||||||
|
buttonMoveRight.Click += ButtonMove_Click;
|
||||||
|
//
|
||||||
|
// FormLiner
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(995, 620);
|
||||||
|
Controls.Add(buttonMoveRight);
|
||||||
|
Controls.Add(buttonMoveDown);
|
||||||
|
Controls.Add(buttonMoveUp);
|
||||||
|
Controls.Add(buttonMoveLeft);
|
||||||
|
Controls.Add(buttonCreateLiner);
|
||||||
|
Controls.Add(pictureBoxLiner);
|
||||||
|
Margin = new Padding(3, 2, 3, 2);
|
||||||
|
Name = "FormLiner";
|
||||||
|
StartPosition = FormStartPosition.CenterScreen;
|
||||||
|
Text = "Liner";
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBoxLiner).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private PictureBox pictureBoxLiner;
|
||||||
|
private Button buttonCreateLiner;
|
||||||
|
private Button buttonMoveLeft;
|
||||||
|
private Button buttonMoveUp;
|
||||||
|
private Button buttonMoveDown;
|
||||||
|
private Button buttonMoveRight;
|
||||||
|
}
|
||||||
|
}
|
69
ProjectLiner/ProjectLiner/FormLiner.cs
Normal file
69
ProjectLiner/ProjectLiner/FormLiner.cs
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
namespace ProjectLiner
|
||||||
|
{
|
||||||
|
public partial class FormLiner : Form
|
||||||
|
{
|
||||||
|
public DrawingLiner? _drawingLiner;
|
||||||
|
public FormLiner()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawTransoprt()
|
||||||
|
{
|
||||||
|
if (_drawingLiner == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Bitmap bitmap = new(pictureBoxLiner.Width, pictureBoxLiner.Height);
|
||||||
|
Graphics graphics = Graphics.FromImage(bitmap);
|
||||||
|
_drawingLiner?.DrawTransport(graphics);
|
||||||
|
pictureBoxLiner.Image = bitmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonCreateLiner_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Random random = new();
|
||||||
|
_drawingLiner = new DrawingLiner();
|
||||||
|
_drawingLiner.Init(random.Next(100, 300), random.Next(1000, 3000),
|
||||||
|
Color.FromArgb(random.Next(0, 255), random.Next(0, 255), random.Next(0, 255)),
|
||||||
|
Color.FromArgb(random.Next(0, 255), random.Next(0, 255), random.Next(0, 255)),
|
||||||
|
LinerEntityType.Cargo, random.Next(1000, 10000), random.Next(10, 100),
|
||||||
|
random.Next(0, 2) == 1, random.Next(0, 2) == 1);
|
||||||
|
_drawingLiner.SetPictureSize(pictureBoxLiner.Width, pictureBoxLiner.Height);
|
||||||
|
_drawingLiner.SetPosition(random.Next(0, pictureBoxLiner.Width), random.Next(0, pictureBoxLiner.Height));
|
||||||
|
|
||||||
|
DrawTransoprt();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonMove_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_drawingLiner == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string name = ((Button)sender)?.Name ?? string.Empty;
|
||||||
|
bool result = false;
|
||||||
|
switch (name)
|
||||||
|
{
|
||||||
|
case "buttonMoveUp":
|
||||||
|
result = _drawingLiner.MoveTransport(DirectionType.Up);
|
||||||
|
break;
|
||||||
|
case "buttonMoveDown":
|
||||||
|
result = _drawingLiner.MoveTransport(DirectionType.Down);
|
||||||
|
break;
|
||||||
|
case "buttonMoveLeft":
|
||||||
|
result = _drawingLiner.MoveTransport(DirectionType.Left);
|
||||||
|
break;
|
||||||
|
case "buttonMoveRight":
|
||||||
|
result = _drawingLiner.MoveTransport(DirectionType.Right);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
DrawTransoprt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
132
ProjectLiner/ProjectLiner/FormLiner.resx
Normal file
132
ProjectLiner/ProjectLiner/FormLiner.resx
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
<data name="buttonMoveRight.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>
|
||||||
|
iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL
|
||||||
|
DAAACwwBP0AiyAAAARZJREFUaEPtmTsKwlAQRbMBcQNi69IEG7VS0A1Z6M78V9roHUgghJuvIJnJPXCa
|
||||||
|
wAwc0ryXJEIIIYQQQggRgVHqIFjAd+raHkTnCj85tzA0+djMPQwLCzbDRrPYzJDRLDRvuGgWWTRUNAtk
|
||||||
|
holmcWWGiGZhVf4UPYVH+IRseV/tdDix2AtkCz3YOtreLFvkyVbRD8iWeLNxNBv26grWwga9+oK192k2
|
||||||
|
6NXBBS9hLXfIhr25gY04QbbAk41jjRk8Q7bIg61iMybwAG+QLe2rnWL7Aguqcgddw6LKdB9rsDBmiFiD
|
||||||
|
xRUNE2uwwLyhYg0WmRku1mChZshYY1CxRvEzk+tDRRPmcFC/S41xqhBCCCGEEEL8kyT5Avbp6yDpsmlv
|
||||||
|
AAAAAElFTkSuQmCC
|
||||||
|
</value>
|
||||||
|
</data>
|
||||||
|
</root>
|
39
ProjectLiner/ProjectLiner/LinerEntity.cs
Normal file
39
ProjectLiner/ProjectLiner/LinerEntity.cs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
namespace ProjectLiner;
|
||||||
|
public enum LinerEntityType
|
||||||
|
{
|
||||||
|
Passenger,
|
||||||
|
Cargo,
|
||||||
|
Military,
|
||||||
|
Mixed
|
||||||
|
}
|
||||||
|
|
||||||
|
public class LinerEntity
|
||||||
|
{
|
||||||
|
public int Speed { get; private set; }
|
||||||
|
public double Weight { get; private set; }
|
||||||
|
public Color PrimaryColor { get; private set; }
|
||||||
|
public Color SecondaryColor { get; private set; }
|
||||||
|
public LinerEntityType Type { get; private set; }
|
||||||
|
public int Capacity { get; private set; }
|
||||||
|
public int MaxPassengers { get; private set; }
|
||||||
|
public bool HasExtraDeck { get; private set; }
|
||||||
|
public bool HasPool { get; private set; }
|
||||||
|
public double Step => Speed / (Weight / 100);
|
||||||
|
|
||||||
|
public void Init(
|
||||||
|
int speed, double weight, Color primaryColor, Color secondaryColor,
|
||||||
|
LinerEntityType type, int capacity, int maxPassengers,
|
||||||
|
bool hasExtraDeck, bool hasPool
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Speed = speed;
|
||||||
|
Weight = weight;
|
||||||
|
PrimaryColor = primaryColor;
|
||||||
|
SecondaryColor = secondaryColor;
|
||||||
|
Type = type;
|
||||||
|
Capacity = capacity;
|
||||||
|
MaxPassengers = maxPassengers;
|
||||||
|
HasExtraDeck = hasExtraDeck;
|
||||||
|
HasPool = hasPool;
|
||||||
|
}
|
||||||
|
}
|
@ -11,7 +11,7 @@ namespace ProjectLiner
|
|||||||
// To customize application configuration such as set high DPI settings or default font,
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
// see https://aka.ms/applicationconfiguration.
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
Application.Run(new Form1());
|
Application.Run(new FormLiner());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,4 +8,19 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Update="Properties\Resources.Designer.cs">
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Update="Properties\Resources.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
103
ProjectLiner/ProjectLiner/Properties/Resources.Designer.cs
generated
Normal file
103
ProjectLiner/ProjectLiner/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// Этот код создан программой.
|
||||||
|
// Исполняемая версия:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||||
|
// повторной генерации кода.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace ProjectLiner.Properties {
|
||||||
|
using System;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
|
||||||
|
/// </summary>
|
||||||
|
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
|
||||||
|
// с помощью такого средства, как ResGen или Visual Studio.
|
||||||
|
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
|
||||||
|
// с параметром /str или перестройте свой проект VS.
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
internal class Resources {
|
||||||
|
|
||||||
|
private static global::System.Resources.ResourceManager resourceMan;
|
||||||
|
|
||||||
|
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||||
|
|
||||||
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||||
|
internal Resources() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||||
|
get {
|
||||||
|
if (object.ReferenceEquals(resourceMan, null)) {
|
||||||
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ProjectLiner.Properties.Resources", typeof(Resources).Assembly);
|
||||||
|
resourceMan = temp;
|
||||||
|
}
|
||||||
|
return resourceMan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
|
||||||
|
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Globalization.CultureInfo Culture {
|
||||||
|
get {
|
||||||
|
return resourceCulture;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
resourceCulture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap icons8_arrow_down_60 {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("icons8-arrow-down-60", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap icons8_arrow_left_60 {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("icons8-arrow-left-60", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap icons8_arrow_right_60 {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("icons8-arrow-right-60", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap icons8_arrow_up_60 {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("icons8-arrow-up-60", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -117,4 +117,17 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
|
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<data name="icons8-arrow-down-60" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\icons8-arrow-down-60.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="icons8-arrow-up-60" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\icons8-arrow-up-60.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="icons8-arrow-right-60" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\icons8-arrow-right-60.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="icons8-arrow-left-60" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\icons8-arrow-left-60.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
BIN
ProjectLiner/ProjectLiner/Resources/icons8-arrow-down-60.png
Normal file
BIN
ProjectLiner/ProjectLiner/Resources/icons8-arrow-down-60.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 387 B |
BIN
ProjectLiner/ProjectLiner/Resources/icons8-arrow-left-60.png
Normal file
BIN
ProjectLiner/ProjectLiner/Resources/icons8-arrow-left-60.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 332 B |
BIN
ProjectLiner/ProjectLiner/Resources/icons8-arrow-right-60.png
Normal file
BIN
ProjectLiner/ProjectLiner/Resources/icons8-arrow-right-60.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 294 B |
BIN
ProjectLiner/ProjectLiner/Resources/icons8-arrow-up-60.png
Normal file
BIN
ProjectLiner/ProjectLiner/Resources/icons8-arrow-up-60.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 372 B |
Loading…
x
Reference in New Issue
Block a user