This commit is contained in:
dyakonovr 2023-10-03 13:19:27 +04:00
parent 580db65a13
commit 710ecb435c
26 changed files with 843 additions and 0 deletions

View File

@ -0,0 +1,13 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/contentModel.xml
/projectSettingsUpdater.xml
/modules.xml
/.idea.PIbd-23_Dyakonov_R_R_Tank.iml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@ -0,0 +1,13 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/projectSettingsUpdater.xml
/modules.xml
/contentModel.xml
/.idea.ProjectTank.iml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -0,0 +1 @@
ProjectTank

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

25
ProjectTank.sln Normal file
View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.6.33801.468
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectTank", "ProjectTank\ProjectTank.csproj", "{3813FF33-65D9-4474-8AC9-594C12C365A8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3813FF33-65D9-4474-8AC9-594C12C365A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3813FF33-65D9-4474-8AC9-594C12C365A8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3813FF33-65D9-4474-8AC9-594C12C365A8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3813FF33-65D9-4474-8AC9-594C12C365A8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B481448C-8B20-483C-BA2D-C90D5AACDB69}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectTank
{
public enum DirectionType
{
Up = 0,
Down = 1,
Left = 2,
Right = 3,
}
}

147
ProjectTank/DrawingTank.cs Normal file
View File

@ -0,0 +1,147 @@
using System;
using System.Collections.Generic;
using System.Drawing.Drawing2D;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectTank
{
internal class DrawingTank
{
public Tank? TankEntity { get; private set; }
private int pictureWidth;
private int pictureHeight;
private int startPosX;
private int startPosY;
private readonly int tankWidth = 150;
private readonly int tankHeight = 100;
public bool Init(int speed, double weight, Color bodyColor, Color additionalColor, int width, int height, bool isAntiAircraftGun, bool isTankTower)
{
if (width <= tankWidth || height <= tankHeight) return false;
pictureWidth = width;
pictureHeight = height;
TankEntity = new Tank();
TankEntity.Init(speed, weight, bodyColor, additionalColor, isAntiAircraftGun, isTankTower);
return true;
}
public void SetPosition(int x, int y)
{
if (TankEntity == null) return;
startPosX = x;
startPosX = y;
if (x + tankWidth >= pictureWidth || y + tankHeight >= pictureHeight)
{
startPosX = 1;
startPosY = 1;
}
}
public void MoveTransport(DirectionType direction)
{
if (TankEntity == null) return;
switch (direction)
{
//влево
case DirectionType.Left:
if (startPosX - TankEntity.Step > 0)
{
startPosX -= (int)TankEntity.Step;
}
break;
//вверх
case DirectionType.Up:
if (startPosY - TankEntity.Step > 0)
{
startPosY -= (int)TankEntity.Step;
}
break;
// вправо
case DirectionType.Right:
if (startPosX + TankEntity.Step + tankWidth <= pictureWidth)
{
startPosX += (int)TankEntity.Step;
}
break;
//вниз
case DirectionType.Down:
if (startPosY + TankEntity.Step + tankHeight <= pictureHeight)
{
startPosY += (int)TankEntity.Step;
}
break;
}
}
public void DrawTransport(Graphics g)
{
if (TankEntity == null) return;
Pen pen = new(TankEntity.BodyColor);
// границы
g.DrawRectangle(new Pen(Color.Red), startPosX, startPosY, tankWidth, tankHeight);
// гусеница
GraphicsPath path = new GraphicsPath();
int cornerRadius = 20;
path.AddArc(startPosX, startPosY + 65, cornerRadius, cornerRadius, 180, 90);
path.AddArc(startPosX + tankWidth - cornerRadius, startPosY + 65, cornerRadius, cornerRadius, 270, 90);
path.AddArc(startPosX + tankWidth - cornerRadius, startPosY + tankHeight - cornerRadius, cornerRadius, cornerRadius, 0, 90);
path.AddArc(startPosX, startPosY + tankHeight - cornerRadius, cornerRadius, cornerRadius, 90, 90);
path.CloseFigure();
g.DrawPath(pen, path);
// колеса
g.DrawEllipse(pen, startPosX + 1, startPosY + tankHeight - 5 - 25, 25, 25);
for (int i = 1; i < 5; i++)
{
g.DrawEllipse(pen, startPosX + 30 + (5 * i) + (15 * (i - 1)), startPosY + tankHeight - 5 - 15, 15, 15);
}
g.DrawEllipse(pen, startPosX + tankWidth - 25 - 1, startPosY + tankHeight - 5 - 25, 25, 25);
if (TankEntity.IsTankMuzzle)
{
// дуло
g.DrawRectangle(pen, startPosX + 15, startPosY + 37, 30, 7);
}
// башня
SolidBrush brush = new SolidBrush(TankEntity.AdditionalColor);
g.FillRectangle(brush, startPosX + 45, startPosY + 30, 60, 25);
g.FillRectangle(brush, startPosX + 5, startPosY + 55 + 1, tankWidth - 10, 9);
if (TankEntity.IsAntiAircraftGun)
{
// зенитное орудие
g.DrawRectangle(pen, startPosX + 65, startPosY + 18, 8, 12);
g.DrawRectangle(pen, startPosX + 65 + 8, startPosY + 16, 8, 14);
Point[] leftRectanglePoints =
{
new Point(startPosX + 52, startPosY + 5),
new Point(startPosX + 67, startPosY + 18),
new Point(startPosX + 67 + 5, startPosY + 18),
new Point(startPosX + 57, startPosY + 5),
};
g.DrawPolygon(pen, leftRectanglePoints);
Point[] rightRectanglePoints =
{
new Point(startPosX + 59, startPosY),
new Point(startPosX + 74, startPosY + 16),
new Point(startPosX + 74 + 5, startPosY + 16),
new Point(startPosX + 66, startPosY),
};
g.DrawPolygon(pen, rightRectanglePoints);
}
}
}
}

135
ProjectTank/FormTank.Designer.cs generated Normal file
View File

@ -0,0 +1,135 @@
namespace ProjectTank
{
partial class FormTank
{
/// <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()
{
pictureBoxTank = new PictureBox();
createButton = new Button();
buttonLeft = new Button();
buttonDown = new Button();
buttonRight = new Button();
buttonUp = new Button();
((System.ComponentModel.ISupportInitialize)pictureBoxTank).BeginInit();
SuspendLayout();
//
// pictureBoxTank
//
pictureBoxTank.Dock = DockStyle.Fill;
pictureBoxTank.Location = new Point(0, 0);
pictureBoxTank.Name = "pictureBoxTank";
pictureBoxTank.Size = new Size(991, 458);
pictureBoxTank.SizeMode = PictureBoxSizeMode.AutoSize;
pictureBoxTank.TabIndex = 7;
pictureBoxTank.TabStop = false;
//
// createButton
//
createButton.Location = new Point(885, 405);
createButton.Name = "createButton";
createButton.Size = new Size(94, 41);
createButton.TabIndex = 8;
createButton.Text = "Create";
createButton.UseVisualStyleBackColor = true;
createButton.Click += buttonCreate_Click;
//
// buttonLeft
//
buttonLeft.BackgroundImage = Properties.Resources.icons8_left_arrow_40;
buttonLeft.BackgroundImageLayout = ImageLayout.Zoom;
buttonLeft.Font = new Font("Segoe UI", 15F, FontStyle.Regular, GraphicsUnit.Point);
buttonLeft.Location = new Point(12, 396);
buttonLeft.Name = "buttonLeft";
buttonLeft.Size = new Size(50, 50);
buttonLeft.TabIndex = 9;
buttonLeft.UseVisualStyleBackColor = true;
buttonLeft.Click += moveButton_Click;
//
// buttonDown
//
buttonDown.BackgroundImage = Properties.Resources.arrowDown;
buttonDown.BackgroundImageLayout = ImageLayout.Zoom;
buttonDown.Font = new Font("Segoe UI", 10F, FontStyle.Regular, GraphicsUnit.Point);
buttonDown.Location = new Point(68, 396);
buttonDown.Name = "buttonDown";
buttonDown.Size = new Size(50, 50);
buttonDown.TabIndex = 10;
buttonDown.UseVisualStyleBackColor = true;
buttonDown.Click += moveButton_Click;
//
// buttonRight
//
buttonRight.BackgroundImage = Properties.Resources.icons8_right_arrow_40;
buttonRight.BackgroundImageLayout = ImageLayout.Zoom;
buttonRight.Font = new Font("Segoe UI", 15F, FontStyle.Regular, GraphicsUnit.Point);
buttonRight.Location = new Point(124, 396);
buttonRight.Name = "buttonRight";
buttonRight.Size = new Size(50, 50);
buttonRight.TabIndex = 11;
buttonRight.UseVisualStyleBackColor = true;
buttonRight.Click += moveButton_Click;
//
// buttonUp
//
buttonUp.BackgroundImage = Properties.Resources.icons8_up_arrow_40;
buttonUp.BackgroundImageLayout = ImageLayout.Zoom;
buttonUp.Font = new Font("Segoe UI", 15F, FontStyle.Regular, GraphicsUnit.Point);
buttonUp.Location = new Point(68, 340);
buttonUp.Name = "buttonUp";
buttonUp.Size = new Size(50, 50);
buttonUp.TabIndex = 12;
buttonUp.UseVisualStyleBackColor = true;
buttonUp.Click += moveButton_Click;
//
// FormTank
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(991, 458);
Controls.Add(buttonUp);
Controls.Add(buttonRight);
Controls.Add(buttonDown);
Controls.Add(buttonLeft);
Controls.Add(createButton);
Controls.Add(pictureBoxTank);
Name = "FormTank";
StartPosition = FormStartPosition.CenterScreen;
Text = "Drawing tank";
((System.ComponentModel.ISupportInitialize)pictureBoxTank).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private PictureBox pictureBoxTank;
private Button createButton;
private Button buttonLeft;
private Button buttonDown;
private Button buttonRight;
private Button buttonUp;
}
}

53
ProjectTank/FormTank.cs Normal file
View File

@ -0,0 +1,53 @@
namespace ProjectTank
{
public partial class FormTank : Form
{
private DrawingTank? DrawingTank;
public FormTank()
{
InitializeComponent();
}
private void buttonCreate_Click(object sender, EventArgs e)
{
Random random = new();
DrawingTank = new DrawingTank();
DrawingTank.Init(random.Next(50, 100), random.Next(1700, 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)), pictureBoxTank.Width, pictureBoxTank.Height, true, true);
DrawingTank.SetPosition(random.Next(10, 100), random.Next(10, 100));
Draw();
}
private void Draw()
{
if (DrawingTank == null) return;
Bitmap bmp = new(pictureBoxTank.Width, pictureBoxTank.Height);
Graphics gr = Graphics.FromImage(bmp);
DrawingTank.DrawTransport(gr);
pictureBoxTank.Image = bmp;
}
private void moveButton_Click(object sender, EventArgs e)
{
if (DrawingTank == null) return;
string name = ((Button)sender)?.Name ?? string.Empty;
switch (name)
{
case "buttonUp":
DrawingTank.MoveTransport(DirectionType.Up);
break;
case "buttonDown":
DrawingTank.MoveTransport(DirectionType.Down);
break;
case "buttonLeft":
DrawingTank.MoveTransport(DirectionType.Left);
break;
case "buttonRight":
DrawingTank.MoveTransport(DirectionType.Right);
break;
}
Draw();
}
}
}

120
ProjectTank/FormTank.resx Normal file
View File

@ -0,0 +1,120 @@
<?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>
</root>

17
ProjectTank/Program.cs Normal file
View File

@ -0,0 +1,17 @@
namespace ProjectTank
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new FormTank());
}
}
}

View File

@ -0,0 +1,11 @@
<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>

View File

@ -0,0 +1,103 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ProjectTank.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("ProjectTank.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 icons8_left_arrow_40 {
get {
object obj = ResourceManager.GetObject("icons8-left-arrow-40", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_right_arrow_40 {
get {
object obj = ResourceManager.GetObject("icons8-right-arrow-40", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_up_arrow_40 {
get {
object obj = ResourceManager.GetObject("icons8-up-arrow-40", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View 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\icons8-down-arrow-50.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-left-arrow-40" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-left-arrow-40.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-right-arrow-40" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-right-arrow-40.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icons8-up-arrow-40" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icons8-up-arrow-40.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 263 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 392 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

28
ProjectTank/TankEntity.cs Normal file
View File

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectTank
{
internal class Tank
{
public int Speed { get; private set; }
public double Weight { get; private set; }
public Color BodyColor { get; private set; }
public Color AdditionalColor { get; private set; }
public bool IsAntiAircraftGun { get; private set; }
public bool IsTankMuzzle { get; private set; }
public double Step => (double)Speed * 100 / Weight;
public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool isAntiAircraftGun, bool isTankTower)
{
Speed = speed;
Weight = weight;
BodyColor = bodyColor;
AdditionalColor = additionalColor;
IsAntiAircraftGun = isAntiAircraftGun;
IsTankMuzzle = isTankTower;
}
}
}