Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
98dc9e75f3 | |||
51f0767cc1 |
39
ProjectSportCar/Form1.Designer.cs
generated
39
ProjectSportCar/Form1.Designer.cs
generated
@ -1,39 +0,0 @@
|
|||||||
namespace ProjectSportCar
|
|
||||||
{
|
|
||||||
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 ProjectSportCar
|
|
||||||
{
|
|
||||||
public partial class Form1 : Form
|
|
||||||
{
|
|
||||||
public Form1()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
142
ProjectSportCar/FormMonorail.Designer.cs
generated
Normal file
142
ProjectSportCar/FormMonorail.Designer.cs
generated
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
namespace ProjectMonorail
|
||||||
|
{
|
||||||
|
partial class FormMonorail
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
buttonMove_Right = new Button();
|
||||||
|
buttonMove_Down = new Button();
|
||||||
|
buttonMove_Left = new Button();
|
||||||
|
buttonMove_Up = new Button();
|
||||||
|
pictureBoxMonorail = new PictureBox();
|
||||||
|
buttonCreateMonorail = new Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBoxMonorail).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// buttonMove_Right
|
||||||
|
//
|
||||||
|
buttonMove_Right.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
buttonMove_Right.BackgroundImage = Properties.Resources.ArrowRight;
|
||||||
|
buttonMove_Right.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonMove_Right.Location = new Point(875, 569);
|
||||||
|
buttonMove_Right.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
buttonMove_Right.Name = "buttonMove_Right";
|
||||||
|
buttonMove_Right.Size = new Size(40, 47);
|
||||||
|
buttonMove_Right.TabIndex = 0;
|
||||||
|
buttonMove_Right.UseVisualStyleBackColor = true;
|
||||||
|
buttonMove_Right.Click += ButtonMove_Click;
|
||||||
|
//
|
||||||
|
// buttonMove_Down
|
||||||
|
//
|
||||||
|
buttonMove_Down.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
buttonMove_Down.BackgroundImage = Properties.Resources.ArrowDown;
|
||||||
|
buttonMove_Down.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonMove_Down.Location = new Point(829, 569);
|
||||||
|
buttonMove_Down.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
buttonMove_Down.Name = "buttonMove_Down";
|
||||||
|
buttonMove_Down.Size = new Size(40, 47);
|
||||||
|
buttonMove_Down.TabIndex = 1;
|
||||||
|
buttonMove_Down.UseVisualStyleBackColor = true;
|
||||||
|
buttonMove_Down.Click += ButtonMove_Click;
|
||||||
|
//
|
||||||
|
// buttonMove_Left
|
||||||
|
//
|
||||||
|
buttonMove_Left.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
buttonMove_Left.BackgroundImage = Properties.Resources.ArrowLeft;
|
||||||
|
buttonMove_Left.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonMove_Left.Location = new Point(782, 569);
|
||||||
|
buttonMove_Left.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
buttonMove_Left.Name = "buttonMove_Left";
|
||||||
|
buttonMove_Left.Size = new Size(40, 47);
|
||||||
|
buttonMove_Left.TabIndex = 2;
|
||||||
|
buttonMove_Left.UseVisualStyleBackColor = true;
|
||||||
|
buttonMove_Left.Click += ButtonMove_Click;
|
||||||
|
//
|
||||||
|
// buttonMove_Up
|
||||||
|
//
|
||||||
|
buttonMove_Up.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
buttonMove_Up.BackgroundImage = Properties.Resources.ArrowUp;
|
||||||
|
buttonMove_Up.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
buttonMove_Up.Location = new Point(829, 515);
|
||||||
|
buttonMove_Up.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
buttonMove_Up.Name = "buttonMove_Up";
|
||||||
|
buttonMove_Up.Size = new Size(40, 47);
|
||||||
|
buttonMove_Up.TabIndex = 3;
|
||||||
|
buttonMove_Up.UseVisualStyleBackColor = true;
|
||||||
|
buttonMove_Up.Click += ButtonMove_Click;
|
||||||
|
//
|
||||||
|
// pictureBoxMonorail
|
||||||
|
//
|
||||||
|
pictureBoxMonorail.Dock = DockStyle.Fill;
|
||||||
|
pictureBoxMonorail.ImageLocation = "";
|
||||||
|
pictureBoxMonorail.Location = new Point(0, 0);
|
||||||
|
pictureBoxMonorail.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
pictureBoxMonorail.Name = "pictureBoxMonorail";
|
||||||
|
pictureBoxMonorail.Size = new Size(929, 632);
|
||||||
|
pictureBoxMonorail.TabIndex = 4;
|
||||||
|
pictureBoxMonorail.TabStop = false;
|
||||||
|
//
|
||||||
|
// buttonCreateMonorail
|
||||||
|
//
|
||||||
|
buttonCreateMonorail.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||||
|
buttonCreateMonorail.Location = new Point(14, 585);
|
||||||
|
buttonCreateMonorail.Margin = new Padding(3, 4, 3, 4);
|
||||||
|
buttonCreateMonorail.Name = "buttonCreateMonorail";
|
||||||
|
buttonCreateMonorail.Size = new Size(86, 31);
|
||||||
|
buttonCreateMonorail.TabIndex = 5;
|
||||||
|
buttonCreateMonorail.Text = "Создать";
|
||||||
|
buttonCreateMonorail.UseVisualStyleBackColor = true;
|
||||||
|
buttonCreateMonorail.Click += ButtonCreateMonorail_Click;
|
||||||
|
//
|
||||||
|
// FormMonorail
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(929, 632);
|
||||||
|
Controls.Add(buttonCreateMonorail);
|
||||||
|
Controls.Add(buttonMove_Up);
|
||||||
|
Controls.Add(buttonMove_Left);
|
||||||
|
Controls.Add(buttonMove_Down);
|
||||||
|
Controls.Add(buttonMove_Right);
|
||||||
|
Controls.Add(pictureBoxMonorail);
|
||||||
|
Margin = new Padding(3, 4, 3, 4);
|
||||||
|
Name = "FormMonorail";
|
||||||
|
Text = "Монорельс";
|
||||||
|
((System.ComponentModel.ISupportInitialize)pictureBoxMonorail).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Button buttonMove_Right;
|
||||||
|
private Button buttonMove_Down;
|
||||||
|
private Button buttonMove_Left;
|
||||||
|
private Button buttonMove_Up;
|
||||||
|
private PictureBox pictureBoxMonorail;
|
||||||
|
private Button buttonCreateMonorail;
|
||||||
|
}
|
||||||
|
}
|
75
ProjectSportCar/FormMonorail.cs
Normal file
75
ProjectSportCar/FormMonorail.cs
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
using ProjectMonorail.Scripts.Locomative;
|
||||||
|
|
||||||
|
namespace ProjectMonorail
|
||||||
|
{
|
||||||
|
public partial class FormMonorail : Form
|
||||||
|
{
|
||||||
|
private DrawMonorail? _drawningMonorail;
|
||||||
|
|
||||||
|
public FormMonorail()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Метод для прорисовки автомобиля
|
||||||
|
/// </summary>
|
||||||
|
private void Draw ()
|
||||||
|
{
|
||||||
|
if (_drawningMonorail == null) return;
|
||||||
|
|
||||||
|
Bitmap bmp = new(pictureBoxMonorail.Width, pictureBoxMonorail.Height);
|
||||||
|
Graphics gr = Graphics.FromImage(bmp);
|
||||||
|
_drawningMonorail.DrawTransport(gr);
|
||||||
|
pictureBoxMonorail.Image = bmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Обработка нажатия кнопки "Создать"
|
||||||
|
/// </summary>
|
||||||
|
private void ButtonCreateMonorail_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Random random = new();
|
||||||
|
_drawningMonorail = new DrawMonorail();
|
||||||
|
|
||||||
|
_drawningMonorail.Initialization(random.Next(100, 300), random.Next(1000, 3000),
|
||||||
|
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
||||||
|
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
||||||
|
Convert.ToBoolean(random.Next(0, 2)),
|
||||||
|
Convert.ToBoolean(random.Next(0, 2)));
|
||||||
|
|
||||||
|
_drawningMonorail.SetPictureSize(pictureBoxMonorail.Width, pictureBoxMonorail.Height);
|
||||||
|
_drawningMonorail.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||||
|
|
||||||
|
Draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Обработка кнопок перемешения
|
||||||
|
/// </summary>
|
||||||
|
private void ButtonMove_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_drawningMonorail == null) return;
|
||||||
|
|
||||||
|
string name = ((Button)sender).Name ?? string.Empty;
|
||||||
|
bool result = false;
|
||||||
|
switch(name)
|
||||||
|
{
|
||||||
|
case "buttonMove_Up":
|
||||||
|
result = _drawningMonorail.MoveTransport(Scripts.DirectionType.Up);
|
||||||
|
break;
|
||||||
|
case "buttonMove_Down":
|
||||||
|
result = _drawningMonorail.MoveTransport(Scripts.DirectionType.Down);
|
||||||
|
break;
|
||||||
|
case "buttonMove_Right":
|
||||||
|
result = _drawningMonorail.MoveTransport(Scripts.DirectionType.Right);
|
||||||
|
break;
|
||||||
|
case "buttonMove_Left":
|
||||||
|
result = _drawningMonorail.MoveTransport(Scripts.DirectionType.Left);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result) Draw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,17 +1,17 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<root>
|
<root>
|
||||||
<!--
|
<!--
|
||||||
Microsoft ResX Schema
|
Microsoft ResX Schema
|
||||||
|
|
||||||
Version 2.0
|
Version 2.0
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
The primary goals of this format is to allow a simple XML format
|
||||||
that is mostly human readable. The generation and parsing of the
|
that is mostly human readable. The generation and parsing of the
|
||||||
various data types are done through the TypeConverter classes
|
various data types are done through the TypeConverter classes
|
||||||
associated with the data types.
|
associated with the data types.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
... ado.net/XML headers & schema ...
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
<resheader name="version">2.0</resheader>
|
<resheader name="version">2.0</resheader>
|
||||||
@ -26,36 +26,36 @@
|
|||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
<comment>This is a comment</comment>
|
<comment>This is a comment</comment>
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
There are any number of "resheader" rows that contain simple
|
||||||
name/value pairs.
|
name/value pairs.
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
Each data row contains a name, and value. The row also contains a
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
text/value conversion through the TypeConverter architecture.
|
text/value conversion through the TypeConverter architecture.
|
||||||
Classes that don't support this are serialized and stored with the
|
Classes that don't support this are serialized and stored with the
|
||||||
mimetype set.
|
mimetype set.
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
The mimetype is used for serialized objects, and tells the
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
read any of the formats listed below.
|
read any of the formats listed below.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
value : The object must be serialized into a byte array
|
value : The object must be serialized into a byte array
|
||||||
: using a System.ComponentModel.TypeConverter
|
: using a System.ComponentModel.TypeConverter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
-->
|
-->
|
@ -1,4 +1,4 @@
|
|||||||
namespace ProjectSportCar
|
namespace ProjectMonorail
|
||||||
{
|
{
|
||||||
internal static class Program
|
internal static class Program
|
||||||
{
|
{
|
||||||
@ -11,7 +11,7 @@ namespace ProjectSportCar
|
|||||||
// 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 FormMonorail());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
22
ProjectSportCar/ProjectMonorail.csproj
Normal file
22
ProjectSportCar/ProjectMonorail.csproj
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Update="Properties\Resources.Designer.cs">
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Update="Properties\Resources.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
@ -1,9 +1,8 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.0.32002.185
|
VisualStudioVersion = 17.0.32002.185
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectSportCar", "ProjectSportCar.csproj", "{C1C061F8-FA8C-4805-AE55-2DABEB1E86B7}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProjectMonorail", "ProjectMonorail.csproj", "{C1C061F8-FA8C-4805-AE55-2DABEB1E86B7}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
@ -1,11 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutputType>WinExe</OutputType>
|
|
||||||
<TargetFramework>net6.0-windows</TargetFramework>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
103
ProjectSportCar/Properties/Resources.Designer.cs
generated
Normal file
103
ProjectSportCar/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// Этот код создан программой.
|
||||||
|
// Исполняемая версия:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||||
|
// повторной генерации кода.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace ProjectMonorail.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("ProjectMonorail.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 ArrowDown {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("ArrowDown", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap ArrowLeft {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("ArrowLeft", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap ArrowRight {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("ArrowRight", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap ArrowUp {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("ArrowUp", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
133
ProjectSportCar/Properties/Resources.resx
Normal file
133
ProjectSportCar/Properties/Resources.resx
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<data name="ArrowDown" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\Arrows\ArrowDown.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="ArrowLeft" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\Arrows\ArrowLeft.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="ArrowRight" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\Arrows\ArrowRight.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="ArrowUp" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\Arrows\ArrowUp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
</root>
|
BIN
ProjectSportCar/Resources/Arrows/ArrowDown.png
Normal file
BIN
ProjectSportCar/Resources/Arrows/ArrowDown.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
BIN
ProjectSportCar/Resources/Arrows/ArrowLeft.png
Normal file
BIN
ProjectSportCar/Resources/Arrows/ArrowLeft.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
BIN
ProjectSportCar/Resources/Arrows/ArrowRight.png
Normal file
BIN
ProjectSportCar/Resources/Arrows/ArrowRight.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
BIN
ProjectSportCar/Resources/Arrows/ArrowUp.png
Normal file
BIN
ProjectSportCar/Resources/Arrows/ArrowUp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
BIN
ProjectSportCar/Resources/Reference/Monorail.png
Normal file
BIN
ProjectSportCar/Resources/Reference/Monorail.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 77 KiB |
28
ProjectSportCar/Scripts/DirectionType.cs
Normal file
28
ProjectSportCar/Scripts/DirectionType.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
namespace ProjectMonorail.Scripts
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Направление перемещения
|
||||||
|
/// </summary>
|
||||||
|
public enum DirectionType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Вверх
|
||||||
|
/// </summary>
|
||||||
|
Up = 1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Вниз
|
||||||
|
/// </summary>
|
||||||
|
Down = 2,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Влево
|
||||||
|
/// </summary>
|
||||||
|
Left = 3,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Вправо
|
||||||
|
/// </summary>
|
||||||
|
Right = 4
|
||||||
|
}
|
||||||
|
}
|
314
ProjectSportCar/Scripts/Monorail/DrawMonorail.cs
Normal file
314
ProjectSportCar/Scripts/Monorail/DrawMonorail.cs
Normal file
@ -0,0 +1,314 @@
|
|||||||
|
using System.Drawing.Drawing2D;
|
||||||
|
|
||||||
|
namespace ProjectMonorail.Scripts.Locomative
|
||||||
|
{
|
||||||
|
public class DrawMonorail
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Класс-сущность
|
||||||
|
/// </summary>
|
||||||
|
public EntityMonorail? EntityMonorail { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ширина окна
|
||||||
|
/// </summary>
|
||||||
|
private int? _pictureWidth;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Высота окна
|
||||||
|
/// </summary>
|
||||||
|
private int? _pictureHeight;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Левая координата прорисовки автомобиля
|
||||||
|
/// </summary>
|
||||||
|
private int? _startPositionX;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Верхняя кооридната прорисовки автомобиля
|
||||||
|
/// </summary>
|
||||||
|
private int? _startPositionY;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ширина прорисовки автомобиля
|
||||||
|
/// </summary>
|
||||||
|
private int _drawningMonorailWidth = 110;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Высота прорисовки автомобиля
|
||||||
|
/// </summary>
|
||||||
|
private readonly int _drawningMonorailHeight = 40;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Инициализация свойств
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="speed">Скорость</param>
|
||||||
|
/// <param name="weight">Вес</param>
|
||||||
|
/// <param name="bodyColor">Основной цвет</param>
|
||||||
|
/// <param name="additionalColor">Дополнительный цвет</param>
|
||||||
|
/// <param name="monorailTrack">Признак наличия монорельсового пути</param>
|
||||||
|
/// <param name="cabin">Признак наличия кабиныы</param>
|
||||||
|
public void Initialization(int speed, double weight, Color bodyColor, Color additionalColor, bool monorailTrack, bool cabin)
|
||||||
|
{
|
||||||
|
EntityMonorail = new EntityMonorail();
|
||||||
|
EntityMonorail.Initialization(speed, weight, bodyColor, additionalColor, monorailTrack, cabin);
|
||||||
|
_drawningMonorailWidth = cabin ? 170 : 90;
|
||||||
|
_pictureWidth = null;
|
||||||
|
_pictureHeight = null;
|
||||||
|
_startPositionX = null;
|
||||||
|
_startPositionY = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Установка границ поля
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="width">Ширина поля</param>
|
||||||
|
/// <param name="height">Высота поля</param>
|
||||||
|
/// <returns> true - границы заданы, false - проверка не пройдена, нельзя разместить объект в этих размерах</returns>
|
||||||
|
public bool SetPictureSize(int width, int height)
|
||||||
|
{
|
||||||
|
// TODO проверка, что объект "влезает" в размеры поля
|
||||||
|
// если влезает, сохраняем границы и корректируем позицию объекта, если она была уже установлена
|
||||||
|
if (_drawningMonorailWidth > width || _drawningMonorailHeight > height) return false;
|
||||||
|
|
||||||
|
if (_startPositionX.HasValue && _startPositionY.HasValue)
|
||||||
|
{
|
||||||
|
if (_startPositionX.Value + _drawningMonorailWidth > width)
|
||||||
|
{
|
||||||
|
_startPositionX = width - _drawningMonorailWidth;
|
||||||
|
}
|
||||||
|
if (_startPositionY.Value + _drawningMonorailHeight > height)
|
||||||
|
{
|
||||||
|
_startPositionY = height - _drawningMonorailHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_pictureWidth = width;
|
||||||
|
_pictureHeight = height;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Установка позиции
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="x">Координата X</param>
|
||||||
|
/// <param name="y">Координата Y</param>
|
||||||
|
public void SetPosition(int x, int y)
|
||||||
|
{
|
||||||
|
if (!_pictureHeight.HasValue || !_pictureWidth.HasValue) return;
|
||||||
|
|
||||||
|
// TODO если при установке объекта в эти координаты, он будет "выходить" за границы формы
|
||||||
|
// то надо изменить координаты, чтобы он оставался в этих границах
|
||||||
|
|
||||||
|
if (x + _drawningMonorailWidth > _pictureWidth.Value || x < 0)
|
||||||
|
{
|
||||||
|
Random random = new();
|
||||||
|
_startPositionX = random.Next(0, _pictureWidth.Value - _drawningMonorailWidth);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_startPositionX = x;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (y + _drawningMonorailHeight > _pictureHeight.Value || y < 0)
|
||||||
|
{
|
||||||
|
Random random = new();
|
||||||
|
_startPositionY = random.Next(0, _pictureHeight.Value - _drawningMonorailHeight);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_startPositionY = y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Изменение направления перемещения
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="direction">Направление</param>
|
||||||
|
/// <returns>true - перемещене выполнено, false - перемещение невозможно</returns>
|
||||||
|
public bool MoveTransport(DirectionType direction)
|
||||||
|
{
|
||||||
|
if (EntityMonorail == null || !_startPositionX.HasValue || !_startPositionY.HasValue) return false;
|
||||||
|
|
||||||
|
switch (direction)
|
||||||
|
{
|
||||||
|
case DirectionType.Left:
|
||||||
|
if (_startPositionX.Value - EntityMonorail.Step > 0)
|
||||||
|
{
|
||||||
|
_startPositionX -= (int)EntityMonorail.Step;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
case DirectionType.Up:
|
||||||
|
if (_startPositionY.Value - EntityMonorail.Step > 0)
|
||||||
|
{
|
||||||
|
_startPositionY -= (int)EntityMonorail.Step;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
case DirectionType.Right:
|
||||||
|
if (_startPositionX.Value + EntityMonorail.Step + _drawningMonorailWidth < _pictureWidth)
|
||||||
|
{
|
||||||
|
_startPositionX += (int)EntityMonorail.Step;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
case DirectionType.Down:
|
||||||
|
if (_startPositionY.Value + EntityMonorail.Step + _drawningMonorailHeight < _pictureHeight)
|
||||||
|
{
|
||||||
|
_startPositionY += (int)EntityMonorail.Step;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Прорисовка объекта
|
||||||
|
/// </summary>
|
||||||
|
public void DrawTransport(Graphics g)
|
||||||
|
{
|
||||||
|
if (EntityMonorail == null || !_startPositionX.HasValue || !_startPositionY.HasValue) return;
|
||||||
|
|
||||||
|
Pen pen_Body = new Pen(EntityMonorail.BodyColor, 1.5f);
|
||||||
|
Pen pen_Additional = new Pen(EntityMonorail.AdditionalColor, 1.5f);
|
||||||
|
|
||||||
|
Brush brush_Body = new SolidBrush(EntityMonorail.BodyColor);
|
||||||
|
Brush brush_Additional = new SolidBrush(EntityMonorail.AdditionalColor);
|
||||||
|
|
||||||
|
|
||||||
|
//Кузов монорельса
|
||||||
|
GraphicsPath pointsMonorailBody_LeftBody = new GraphicsPath();
|
||||||
|
pointsMonorailBody_LeftBody.AddLine(_startPositionX.Value + 8, _startPositionY.Value + 10, _startPositionX.Value + 13, _startPositionY.Value);
|
||||||
|
pointsMonorailBody_LeftBody.AddLine(_startPositionX.Value + 13, _startPositionY.Value, _startPositionX.Value + 80, _startPositionY.Value);
|
||||||
|
pointsMonorailBody_LeftBody.AddLine(_startPositionX.Value + 80, _startPositionY.Value, _startPositionX.Value + 80, _startPositionY.Value + 25);
|
||||||
|
pointsMonorailBody_LeftBody.AddLine(_startPositionX.Value + 80, _startPositionY.Value + 25, _startPositionX.Value + 8, _startPositionY.Value + 25);
|
||||||
|
pointsMonorailBody_LeftBody.AddLine(_startPositionX.Value + 8, _startPositionY.Value + 25, _startPositionX.Value + 8, _startPositionY.Value + 10);
|
||||||
|
g.DrawLine(pen_Body, _startPositionX.Value + 8, _startPositionY.Value + 10, _startPositionX.Value + 30, _startPositionY.Value + 10);
|
||||||
|
g.DrawLine(pen_Body, _startPositionX.Value + 39, _startPositionY.Value + 10, _startPositionX.Value + 80, _startPositionY.Value + 10);
|
||||||
|
g.DrawPath(pen_Body, pointsMonorailBody_LeftBody);
|
||||||
|
|
||||||
|
//Дверь
|
||||||
|
g.DrawRectangle(pen_Body, _startPositionX.Value + 30, _startPositionY.Value + 5, 9, 15);
|
||||||
|
|
||||||
|
//Окна
|
||||||
|
g.DrawRectangle(pen_Additional, _startPositionX.Value + 14, _startPositionY.Value + 2, 5, 6);
|
||||||
|
g.DrawRectangle(pen_Additional, _startPositionX.Value + 21, _startPositionY.Value + 2, 5, 6);
|
||||||
|
g.DrawRectangle(pen_Additional, _startPositionX.Value + 70, _startPositionY.Value + 2, 5, 6);
|
||||||
|
|
||||||
|
//Связка монорельса
|
||||||
|
g.FillRectangle(brush_Body, _startPositionX.Value + 80, _startPositionY.Value + 2, 7, 22);
|
||||||
|
|
||||||
|
//Нижняя часть монорельса
|
||||||
|
PointF[] pointsLowerPartMonorail_LeftSide = new PointF[8];
|
||||||
|
pointsLowerPartMonorail_LeftSide[0] = new PointF(_startPositionX.Value, _startPositionY.Value + 30);
|
||||||
|
pointsLowerPartMonorail_LeftSide[1] = new PointF(_startPositionX.Value + 8, _startPositionY.Value + 25);
|
||||||
|
pointsLowerPartMonorail_LeftSide[2] = new PointF(_startPositionX.Value + 72, _startPositionY.Value + 25);
|
||||||
|
pointsLowerPartMonorail_LeftSide[3] = new PointF(_startPositionX.Value + 36, _startPositionY.Value + 25);
|
||||||
|
pointsLowerPartMonorail_LeftSide[4] = new PointF(_startPositionX.Value + 36, _startPositionY.Value + 32);
|
||||||
|
pointsLowerPartMonorail_LeftSide[5] = new PointF(_startPositionX.Value + 15, _startPositionY.Value + 32);
|
||||||
|
pointsLowerPartMonorail_LeftSide[6] = new PointF(_startPositionX.Value + 15, _startPositionY.Value + 35);
|
||||||
|
pointsLowerPartMonorail_LeftSide[7] = new PointF(_startPositionX.Value, _startPositionY.Value + 32);
|
||||||
|
g.FillPolygon(brush_Body, pointsLowerPartMonorail_LeftSide);
|
||||||
|
|
||||||
|
PointF[] pointsLowerPartMonorail_RightSide = new PointF[7];
|
||||||
|
pointsLowerPartMonorail_RightSide[0] = new PointF(_startPositionX.Value + 86, _startPositionY.Value + 30);
|
||||||
|
pointsLowerPartMonorail_RightSide[1] = new PointF(_startPositionX.Value + 80, _startPositionY.Value + 25);
|
||||||
|
pointsLowerPartMonorail_RightSide[2] = new PointF(_startPositionX.Value + 50, _startPositionY.Value + 25);
|
||||||
|
pointsLowerPartMonorail_RightSide[3] = new PointF(_startPositionX.Value + 50, _startPositionY.Value + 32);
|
||||||
|
pointsLowerPartMonorail_RightSide[4] = new PointF(_startPositionX.Value + 69, _startPositionY.Value + 32);
|
||||||
|
pointsLowerPartMonorail_RightSide[5] = new PointF(_startPositionX.Value + 79, _startPositionY.Value + 35);
|
||||||
|
pointsLowerPartMonorail_RightSide[6] = new PointF(_startPositionX.Value + 86, _startPositionY.Value + 32);
|
||||||
|
g.FillPolygon(brush_Body, pointsLowerPartMonorail_RightSide);
|
||||||
|
g.FillRectangle(brush_Body, _startPositionX.Value + 8, _startPositionY.Value + 25, 70, 3);
|
||||||
|
|
||||||
|
if (EntityMonorail.MonorailTrack)
|
||||||
|
{
|
||||||
|
if (EntityMonorail.Cabin)
|
||||||
|
{
|
||||||
|
g.FillRectangle(brush_Additional, _startPositionX.Value, _startPositionY.Value + 35, 170, 5);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g.FillRectangle(brush_Additional, _startPositionX.Value, _startPositionY.Value + 35, 86, 5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Колеса
|
||||||
|
Brush brush_White = new SolidBrush(Color.White);
|
||||||
|
g.FillEllipse(brush_White, _startPositionX.Value + 10, _startPositionY.Value + 30, 10, 10);
|
||||||
|
g.DrawEllipse(pen_Body, _startPositionX.Value + 10, _startPositionY.Value + 30, 10, 10);
|
||||||
|
|
||||||
|
g.FillEllipse(brush_White, _startPositionX.Value + 25, _startPositionY.Value + 30, 10, 10);
|
||||||
|
g.DrawEllipse(pen_Body, _startPositionX.Value + 25, _startPositionY.Value + 30, 10, 10);
|
||||||
|
|
||||||
|
g.FillEllipse(brush_White, _startPositionX.Value + 65, _startPositionY.Value + 30, 10, 10);
|
||||||
|
g.DrawEllipse(pen_Body, _startPositionX.Value + 65, _startPositionY.Value + 30, 10, 10);
|
||||||
|
|
||||||
|
g.FillEllipse(brush_White, _startPositionX.Value + 50, _startPositionY.Value + 30, 10, 10);
|
||||||
|
g.DrawEllipse(pen_Body, _startPositionX.Value + 50, _startPositionY.Value + 30, 10, 10);
|
||||||
|
|
||||||
|
|
||||||
|
if (EntityMonorail.Cabin)
|
||||||
|
{
|
||||||
|
int offset = 170;
|
||||||
|
//Кузов монорельса
|
||||||
|
GraphicsPath pointsMonorailBody_RightBody = new GraphicsPath();
|
||||||
|
pointsMonorailBody_RightBody.AddLine(_startPositionX.Value - 8 + offset, _startPositionY.Value + 10, _startPositionX.Value - 13 + offset, _startPositionY.Value);
|
||||||
|
pointsMonorailBody_RightBody.AddLine(_startPositionX.Value - 13 + offset, _startPositionY.Value, _startPositionX.Value - 80 + offset, _startPositionY.Value);
|
||||||
|
pointsMonorailBody_RightBody.AddLine(_startPositionX.Value - 80 + offset, _startPositionY.Value, _startPositionX.Value - 80 + offset, _startPositionY.Value + 25);
|
||||||
|
pointsMonorailBody_RightBody.AddLine(_startPositionX.Value - 80 + offset, _startPositionY.Value + 25, _startPositionX.Value - 8 + offset, _startPositionY.Value + 25);
|
||||||
|
pointsMonorailBody_RightBody.AddLine(_startPositionX.Value - 8 + offset, _startPositionY.Value + 25, _startPositionX.Value - 8 + offset, _startPositionY.Value + 10);
|
||||||
|
g.DrawLine(pen_Body, _startPositionX.Value - 8 + offset, _startPositionY.Value + 10, _startPositionX.Value - 30 + offset, _startPositionY.Value + 10);
|
||||||
|
g.DrawLine(pen_Body, _startPositionX.Value - 39 + offset, _startPositionY.Value + 10, _startPositionX.Value - 80 + offset, _startPositionY.Value + 10);
|
||||||
|
g.DrawPath(pen_Body, pointsMonorailBody_RightBody);
|
||||||
|
|
||||||
|
//Дверь
|
||||||
|
g.DrawRectangle(pen_Body, _startPositionX.Value - 39 + offset, _startPositionY.Value + 5, 9, 15);
|
||||||
|
|
||||||
|
//Окна
|
||||||
|
g.DrawRectangle(pen_Additional, _startPositionX.Value - 20 + offset, _startPositionY.Value + 2, 5, 6);
|
||||||
|
g.DrawRectangle(pen_Additional, _startPositionX.Value - 27 + offset, _startPositionY.Value + 2, 5, 6);
|
||||||
|
g.DrawRectangle(pen_Additional, _startPositionX.Value - 76 + offset, _startPositionY.Value + 2, 5, 6);
|
||||||
|
|
||||||
|
//Связка монорельса
|
||||||
|
g.FillRectangle(brush_Body, _startPositionX.Value - 87 + offset, _startPositionY.Value + 2, 7, 22);
|
||||||
|
|
||||||
|
//Нижняя часть монорельса
|
||||||
|
PointF[] pointsLowerPartMonorail_2_LeftSide = new PointF[8];
|
||||||
|
pointsLowerPartMonorail_2_LeftSide[0] = new PointF(_startPositionX.Value + offset, _startPositionY.Value + 30);
|
||||||
|
pointsLowerPartMonorail_2_LeftSide[1] = new PointF(_startPositionX.Value - 8 + offset, _startPositionY.Value + 25);
|
||||||
|
pointsLowerPartMonorail_2_LeftSide[2] = new PointF(_startPositionX.Value - 72 + offset, _startPositionY.Value + 25);
|
||||||
|
pointsLowerPartMonorail_2_LeftSide[3] = new PointF(_startPositionX.Value - 36 + offset, _startPositionY.Value + 25);
|
||||||
|
pointsLowerPartMonorail_2_LeftSide[4] = new PointF(_startPositionX.Value - 36 + offset, _startPositionY.Value + 32);
|
||||||
|
pointsLowerPartMonorail_2_LeftSide[5] = new PointF(_startPositionX.Value - 15 + offset, _startPositionY.Value + 32);
|
||||||
|
pointsLowerPartMonorail_2_LeftSide[6] = new PointF(_startPositionX.Value - 15 + offset, _startPositionY.Value + 35);
|
||||||
|
pointsLowerPartMonorail_2_LeftSide[7] = new PointF(_startPositionX.Value + offset, _startPositionY.Value + 32);
|
||||||
|
g.FillPolygon(brush_Body, pointsLowerPartMonorail_2_LeftSide);
|
||||||
|
|
||||||
|
PointF[] pointsLowerPartMonorail_2_RightSide = new PointF[7];
|
||||||
|
pointsLowerPartMonorail_2_RightSide[0] = new PointF(_startPositionX.Value - 86 + offset, _startPositionY.Value + 30);
|
||||||
|
pointsLowerPartMonorail_2_RightSide[1] = new PointF(_startPositionX.Value - 80 + offset, _startPositionY.Value + 25);
|
||||||
|
pointsLowerPartMonorail_2_RightSide[2] = new PointF(_startPositionX.Value - 50 + offset, _startPositionY.Value + 25);
|
||||||
|
pointsLowerPartMonorail_2_RightSide[3] = new PointF(_startPositionX.Value - 50 + offset, _startPositionY.Value + 32);
|
||||||
|
pointsLowerPartMonorail_2_RightSide[4] = new PointF(_startPositionX.Value - 69 + offset, _startPositionY.Value + 32);
|
||||||
|
pointsLowerPartMonorail_2_RightSide[5] = new PointF(_startPositionX.Value - 79 + offset, _startPositionY.Value + 35);
|
||||||
|
pointsLowerPartMonorail_2_RightSide[6] = new PointF(_startPositionX.Value - 86 + offset, _startPositionY.Value + 32);
|
||||||
|
g.FillPolygon(brush_Body, pointsLowerPartMonorail_2_RightSide);
|
||||||
|
g.FillRectangle(brush_Body, _startPositionX.Value - 80 + offset, _startPositionY.Value + 25, 70, 3);
|
||||||
|
|
||||||
|
|
||||||
|
//Колеса
|
||||||
|
g.FillEllipse(brush_White, _startPositionX.Value - 20 + offset, _startPositionY.Value + 30, 10, 10);
|
||||||
|
g.DrawEllipse(pen_Body, _startPositionX.Value - 20 + offset, _startPositionY.Value + 30, 10, 10);
|
||||||
|
|
||||||
|
g.FillEllipse(brush_White, _startPositionX.Value - 35 + offset, _startPositionY.Value + 30, 10, 10);
|
||||||
|
g.DrawEllipse(pen_Body, _startPositionX.Value - 35 + offset, _startPositionY.Value + 30, 10, 10);
|
||||||
|
|
||||||
|
g.FillEllipse(brush_White, _startPositionX.Value - 75 + offset, _startPositionY.Value + 30, 10, 10);
|
||||||
|
g.DrawEllipse(pen_Body, _startPositionX.Value - 75 + offset, _startPositionY.Value + 30, 10, 10);
|
||||||
|
|
||||||
|
g.FillEllipse(brush_White, _startPositionX.Value - 60 + offset, _startPositionY.Value + 30, 10, 10);
|
||||||
|
g.DrawEllipse(pen_Body, _startPositionX.Value - 60 + offset, _startPositionY.Value + 30, 10, 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
59
ProjectSportCar/Scripts/Monorail/EntityMonorail.cs
Normal file
59
ProjectSportCar/Scripts/Monorail/EntityMonorail.cs
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
namespace ProjectMonorail
|
||||||
|
{
|
||||||
|
public class EntityMonorail
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Скорость
|
||||||
|
/// </summary>
|
||||||
|
public int Speed { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Вес
|
||||||
|
/// </summary>
|
||||||
|
public double Weight { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Основной цвет
|
||||||
|
/// </summary>
|
||||||
|
public Color BodyColor { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Дополнительный цвет (для опциональных элементов)
|
||||||
|
/// </summary>
|
||||||
|
public Color AdditionalColor { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Признак (опция) наличия монорельсового пути
|
||||||
|
/// </summary>
|
||||||
|
public bool MonorailTrack { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Признак (опция) наличия кабины
|
||||||
|
/// </summary>
|
||||||
|
public bool Cabin { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Шаг перемещения автомобиля
|
||||||
|
/// </summary>
|
||||||
|
public double Step => Speed * 100 / Weight;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Инициальзация полей объекта-класса спортивного автомобиля
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="speed">Скорость</param>
|
||||||
|
/// <param name="weight">Вес автомобиля</param>
|
||||||
|
/// <param name="bodyColor">Основной цвет</param>
|
||||||
|
/// <param name="additionalColor">Дополнительный цвет</param>
|
||||||
|
/// <param name="monorailTrack">Признак наличия монорельсового пути</param>
|
||||||
|
/// <param name="cabin">Признак наличия кабины</param>
|
||||||
|
public void Initialization(int speed, double weight, Color bodyColor, Color additionalColor, bool monorailTrack, bool cabin)
|
||||||
|
{
|
||||||
|
Speed = speed;
|
||||||
|
Weight = weight;
|
||||||
|
BodyColor = bodyColor;
|
||||||
|
AdditionalColor = additionalColor;
|
||||||
|
MonorailTrack = monorailTrack;
|
||||||
|
Cabin = cabin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user