Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
feac50420c | ||
|
6a949caa88 | ||
|
710ecb435c |
2
.gitignore
vendored
@ -2,6 +2,8 @@
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
.idea
|
||||
|
||||
# User-specific stuff
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
|
25
ProjectTank.sln
Normal 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
|
16
ProjectTank/DirectionType.cs
Normal 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,
|
||||
}
|
||||
}
|
63
ProjectTank/DrawningObjects/DrawningTank.cs
Normal file
@ -0,0 +1,63 @@
|
||||
using ProjectTank.Entities;
|
||||
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.DrawningObjects
|
||||
{
|
||||
public class DrawningTank : DrawningTankBase
|
||||
{
|
||||
public DrawningTank(int speed, int weight, Color bodyColor, Color additionalColor, bool isTankTower, bool isAntiAirforceGun, int width, int height) : base(speed, weight, bodyColor, width, height)
|
||||
{
|
||||
if (EntityTankBase == null) return;
|
||||
|
||||
EntityTankBase = new EntityTank(speed, weight, bodyColor, additionalColor, isTankTower, isAntiAirforceGun);
|
||||
}
|
||||
|
||||
public override void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityTankBase is not EntityTank tank) return;
|
||||
|
||||
Pen pen = new(tank.BodyColor);
|
||||
|
||||
if (tank.TankTower)
|
||||
{
|
||||
// дуло
|
||||
g.DrawRectangle(pen, startPosX + 15, startPosY + 37, 30, 7);
|
||||
}
|
||||
|
||||
base.DrawTransport(g);
|
||||
|
||||
if (tank.AntiAirforceGun)
|
||||
{
|
||||
// зенитное орудие
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
127
ProjectTank/DrawningObjects/DrawningTankBase.cs
Normal file
@ -0,0 +1,127 @@
|
||||
using ProjectTank.Entities;
|
||||
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.DrawningObjects
|
||||
{
|
||||
public class DrawningTankBase
|
||||
{
|
||||
public EntityTankBase? EntityTankBase { get; protected set; }
|
||||
private int pictureWidth;
|
||||
private int pictureHeight;
|
||||
protected int startPosX;
|
||||
protected int startPosY;
|
||||
protected readonly int tankWidth = 150;
|
||||
protected readonly int tankHeight = 100;
|
||||
|
||||
public int GetPosX => startPosX;
|
||||
public int GetPosY => startPosY;
|
||||
public int GetWidth => tankWidth;
|
||||
public int GetHeight => tankHeight;
|
||||
public DrawningTankBase(int speed, int weight, Color bodyColor, int width, int height)
|
||||
{
|
||||
if (width <= tankWidth || height <= tankHeight) return;
|
||||
|
||||
pictureWidth = width;
|
||||
pictureHeight = height;
|
||||
EntityTankBase = new EntityTankBase(speed, weight, bodyColor);
|
||||
}
|
||||
protected DrawningTankBase(int speed, int weight, Color bodyColor, int width, int height, int _tankWidth, int _tankHeight)
|
||||
{
|
||||
if (width <= tankWidth || height <= tankHeight) return;
|
||||
|
||||
pictureWidth = width;
|
||||
pictureHeight = height;
|
||||
tankWidth = _tankWidth;
|
||||
tankHeight = _tankHeight;
|
||||
EntityTankBase = new EntityTankBase(speed, weight, bodyColor);
|
||||
}
|
||||
public bool CanMove(DirectionType direction)
|
||||
{
|
||||
if (EntityTankBase == null) return false;
|
||||
|
||||
return direction switch
|
||||
{
|
||||
DirectionType.Left => startPosX - EntityTankBase.Step > 0,
|
||||
DirectionType.Up => startPosY - EntityTankBase.Step > 0,
|
||||
DirectionType.Right => startPosX + tankWidth + EntityTankBase.Step < pictureWidth,
|
||||
DirectionType.Down => startPosY + tankHeight + EntityTankBase.Step < pictureHeight,
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
public void SetPosition(int x, int y)
|
||||
{
|
||||
if (EntityTankBase == null) return;
|
||||
startPosX = x;
|
||||
startPosX = y;
|
||||
|
||||
if (x + tankWidth >= pictureWidth || y + tankHeight >= pictureHeight)
|
||||
{
|
||||
startPosX = 1;
|
||||
startPosY = 1;
|
||||
}
|
||||
}
|
||||
public void MoveTransport(DirectionType direction)
|
||||
{
|
||||
if (!CanMove(direction) || EntityTankBase == null) return;
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
//влево
|
||||
case DirectionType.Left:
|
||||
startPosX -= (int)EntityTankBase.Step;
|
||||
break;
|
||||
//вверх
|
||||
case DirectionType.Up:
|
||||
startPosY -= (int)EntityTankBase.Step;
|
||||
break;
|
||||
// вправо
|
||||
case DirectionType.Right:
|
||||
startPosX += (int)EntityTankBase.Step;
|
||||
break;
|
||||
//вниз
|
||||
case DirectionType.Down:
|
||||
startPosY += (int)EntityTankBase.Step;
|
||||
break;
|
||||
}
|
||||
}
|
||||
public virtual void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityTankBase == null) return;
|
||||
|
||||
Pen pen = new(EntityTankBase.BodyColor);
|
||||
|
||||
// гусеница
|
||||
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);
|
||||
|
||||
// башня
|
||||
SolidBrush brush = new SolidBrush(EntityTankBase.BodyColor);
|
||||
g.FillRectangle(brush, startPosX + 45, startPosY + 30, 60, 25);
|
||||
|
||||
g.FillRectangle(brush, startPosX + 5, startPosY + 55 + 1, tankWidth - 10, 9);
|
||||
}
|
||||
}
|
||||
}
|
23
ProjectTank/Entities/EntityTank.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTank.Entities
|
||||
{
|
||||
public class EntityTank : EntityTankBase
|
||||
{
|
||||
public Color AdditionalColor { get; private set; }
|
||||
public bool TankTower { get; private set; }
|
||||
public bool AntiAirforceGun { get; private set; }
|
||||
public EntityTank(int speed, double weight, Color bodyColor, Color
|
||||
additionalColor, bool tankTower, bool antiAirforceGun) : base(speed, weight, bodyColor)
|
||||
{
|
||||
AdditionalColor = additionalColor;
|
||||
TankTower = tankTower;
|
||||
AntiAirforceGun = antiAirforceGun;
|
||||
}
|
||||
}
|
||||
}
|
22
ProjectTank/Entities/EntityTankBase.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTank.Entities
|
||||
{
|
||||
public class EntityTankBase
|
||||
{
|
||||
public int Speed { get; private set; }
|
||||
public double Weight { get; private set; }
|
||||
public Color BodyColor { get; private set; }
|
||||
public double Step => (double)Speed * 100 / Weight;
|
||||
public EntityTankBase(int speed, double weight, Color bodyColor)
|
||||
{
|
||||
Speed = speed;
|
||||
Weight = weight;
|
||||
BodyColor = bodyColor;
|
||||
}
|
||||
}
|
||||
}
|
175
ProjectTank/FormTank.Designer.cs
generated
Normal file
@ -0,0 +1,175 @@
|
||||
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();
|
||||
comboBoxStrategy = new ComboBox();
|
||||
button1 = new Button();
|
||||
button2 = 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(700, 406);
|
||||
createButton.Name = "createButton";
|
||||
createButton.Size = new Size(130, 41);
|
||||
createButton.TabIndex = 8;
|
||||
createButton.Text = "Create tank base";
|
||||
createButton.UseVisualStyleBackColor = true;
|
||||
createButton.Click += ButtonCreateTankBase_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;
|
||||
//
|
||||
// comboBoxStrategy
|
||||
//
|
||||
comboBoxStrategy.AutoCompleteCustomSource.AddRange(new string[] { "Move to center", "Move to border" });
|
||||
comboBoxStrategy.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxStrategy.FormattingEnabled = true;
|
||||
comboBoxStrategy.Items.AddRange(new object[] { "Move to center", "Move to right bottom corner" });
|
||||
comboBoxStrategy.Location = new Point(757, 0);
|
||||
comboBoxStrategy.Name = "comboBoxStrategy";
|
||||
comboBoxStrategy.Size = new Size(234, 28);
|
||||
comboBoxStrategy.TabIndex = 13;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
button1.Location = new Point(840, 406);
|
||||
button1.Name = "button1";
|
||||
button1.Size = new Size(139, 41);
|
||||
button1.TabIndex = 14;
|
||||
button1.Text = "Create full tank";
|
||||
button1.UseVisualStyleBackColor = true;
|
||||
button1.Click += ButtonCreateTank_Click;
|
||||
//
|
||||
// button2
|
||||
//
|
||||
button2.Location = new Point(897, 34);
|
||||
button2.Name = "button2";
|
||||
button2.Size = new Size(94, 29);
|
||||
button2.TabIndex = 15;
|
||||
button2.Text = "Step";
|
||||
button2.UseVisualStyleBackColor = true;
|
||||
button2.Click += ButtonStep_Click;
|
||||
//
|
||||
// FormTank
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(991, 458);
|
||||
Controls.Add(button2);
|
||||
Controls.Add(button1);
|
||||
Controls.Add(comboBoxStrategy);
|
||||
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;
|
||||
private ComboBox comboBoxStrategy;
|
||||
private Button button1;
|
||||
private Button button2;
|
||||
}
|
||||
}
|
90
ProjectTank/FormTank.cs
Normal file
@ -0,0 +1,90 @@
|
||||
using ProjectTank.DrawningObjects;
|
||||
using ProjectTank.Entities;
|
||||
using ProjectTank.MovementStrategy;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
|
||||
namespace ProjectTank
|
||||
{
|
||||
public partial class FormTank : Form
|
||||
{
|
||||
private DrawningTankBase? DrawningTank;
|
||||
private AbstractStrategy? AbstractStrategy;
|
||||
|
||||
public FormTank()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
private void Draw()
|
||||
{
|
||||
if (DrawningTank == null) return;
|
||||
Bitmap bmp = new(pictureBoxTank.Width, pictureBoxTank.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
DrawningTank.DrawTransport(gr);
|
||||
pictureBoxTank.Image = bmp;
|
||||
}
|
||||
private void ButtonCreateTank_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new();
|
||||
DrawningTank = new DrawningTank(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)), true, true, pictureBoxTank.Width, pictureBoxTank.Height);
|
||||
DrawningTank.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
Draw();
|
||||
}
|
||||
private void ButtonCreateTankBase_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new();
|
||||
DrawningTank = new DrawningTankBase(random.Next(100, 300), random.Next(1000, 3000), Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)), pictureBoxTank.Width, pictureBoxTank.Height);
|
||||
DrawningTank.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
Draw();
|
||||
}
|
||||
private void moveButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (DrawningTank == null) return;
|
||||
|
||||
string name = ((System.Windows.Forms.Button)sender)?.Name ?? string.Empty;
|
||||
|
||||
switch (name)
|
||||
{
|
||||
case "buttonUp":
|
||||
DrawningTank.MoveTransport(DirectionType.Up);
|
||||
break;
|
||||
case "buttonDown":
|
||||
DrawningTank.MoveTransport(DirectionType.Down);
|
||||
break;
|
||||
case "buttonLeft":
|
||||
DrawningTank.MoveTransport(DirectionType.Left);
|
||||
break;
|
||||
case "buttonRight":
|
||||
DrawningTank.MoveTransport(DirectionType.Right);
|
||||
break;
|
||||
}
|
||||
Draw();
|
||||
}
|
||||
private void ButtonStep_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (DrawningTank == null) return;
|
||||
|
||||
if (comboBoxStrategy.Enabled)
|
||||
{
|
||||
AbstractStrategy = comboBoxStrategy.SelectedIndex
|
||||
switch
|
||||
{
|
||||
0 => new MoveToCenter(),
|
||||
1 => new MoveToRightBottomCorner(),
|
||||
_ => null,
|
||||
};
|
||||
if (AbstractStrategy == null) return;
|
||||
AbstractStrategy.SetData(new DrawningObjectTank(DrawningTank), pictureBoxTank.Width, pictureBoxTank.Height);
|
||||
comboBoxStrategy.Enabled = false;
|
||||
}
|
||||
if (AbstractStrategy == null) return;
|
||||
|
||||
AbstractStrategy.MakeStep();
|
||||
Draw();
|
||||
if (AbstractStrategy.GetStatus() == MovementStrategy.Status.Finish)
|
||||
{
|
||||
comboBoxStrategy.Enabled = true;
|
||||
AbstractStrategy = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
ProjectTank/FormTank.resx
Normal 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>
|
129
ProjectTank/MovementStrategy/AbstractStrategy.cs
Normal file
@ -0,0 +1,129 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
|
||||
namespace ProjectTank.MovementStrategy
|
||||
{
|
||||
public abstract class AbstractStrategy
|
||||
{
|
||||
/// <summary>
|
||||
/// Перемещаемый объект
|
||||
/// </summary>
|
||||
private IMoveableObject? _moveableObject;
|
||||
/// <summary>
|
||||
/// Статус перемещения
|
||||
/// </summary>
|
||||
private Status _state = Status.NotInit;
|
||||
/// <summary>
|
||||
/// Ширина поля
|
||||
/// </summary>
|
||||
protected int FieldWidth { get; private set; }
|
||||
/// <summary>
|
||||
/// Высота поля
|
||||
/// </summary>
|
||||
protected int FieldHeight { get; private set; }
|
||||
/// <summary>
|
||||
/// Статус перемещения
|
||||
/// </summary>
|
||||
public Status GetStatus() { return _state; }
|
||||
/// <summary>
|
||||
/// Установка данных
|
||||
/// </summary>
|
||||
/// <param name="moveableObject">Перемещаемый объект</param>
|
||||
/// <param name="width">Ширина поля</param>
|
||||
/// <param name="height">Высота поля</param>
|
||||
public void SetData(IMoveableObject moveableObject, int width, int
|
||||
height)
|
||||
{
|
||||
if (moveableObject == null)
|
||||
{
|
||||
_state = Status.NotInit;
|
||||
return;
|
||||
}
|
||||
_state = Status.InProgress;
|
||||
_moveableObject = moveableObject;
|
||||
FieldWidth = width;
|
||||
FieldHeight = height;
|
||||
}
|
||||
/// <summary>
|
||||
/// Шаг перемещения
|
||||
/// </summary>
|
||||
public void MakeStep()
|
||||
{
|
||||
if (_state != Status.InProgress) return;
|
||||
if (IsTargetDestination())
|
||||
{
|
||||
_state = Status.Finish;
|
||||
return;
|
||||
}
|
||||
MoveToTarget();
|
||||
}
|
||||
/// <summary>
|
||||
/// Перемещение влево
|
||||
/// </summary>
|
||||
/// <returns>Результат перемещения (true - удалось переместиться, false - неудача)</returns>
|
||||
protected bool MoveLeft() => MoveTo(DirectionType.Left);
|
||||
/// <summary>
|
||||
/// Перемещение вправо
|
||||
/// </summary>
|
||||
/// <returns>Результат перемещения (true - удалось переместиться, false - неудача)</returns>
|
||||
protected bool MoveRight() => MoveTo(DirectionType.Right);
|
||||
/// <summary>
|
||||
/// Перемещение вверх
|
||||
/// </summary>
|
||||
/// <returns>Результат перемещения (true - удалось переместиться, false - неудача)</returns>
|
||||
protected bool MoveUp() => MoveTo(DirectionType.Up);
|
||||
/// <summary>
|
||||
/// Перемещение вниз
|
||||
/// </summary>
|
||||
/// <returns>Результат перемещения (true - удалось переместиться,false - неудача)</returns>
|
||||
protected bool MoveDown() => MoveTo(DirectionType.Down);
|
||||
/// <summary>
|
||||
/// Параметры объекта
|
||||
/// </summary>
|
||||
protected ObjectParameters? GetObjectParameters => _moveableObject?.GetObjectPosition;
|
||||
/// <summary>
|
||||
/// Шаг объекта
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected int? GetStep()
|
||||
{
|
||||
if (_state != Status.InProgress)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return _moveableObject?.GetStep;
|
||||
}
|
||||
/// <summary>
|
||||
/// Перемещение к цели
|
||||
/// </summary>
|
||||
protected abstract void MoveToTarget();
|
||||
/// <summary>
|
||||
/// Достигнута ли цель
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected abstract bool IsTargetDestination();
|
||||
/// <summary>
|
||||
/// Попытка перемещения в требуемом направлении
|
||||
/// </summary>
|
||||
/// <param name="directionType">Направление</param>
|
||||
/// <returns>Результат попытки (true - удалось переместиться, false - неудача)
|
||||
/// </returns>
|
||||
private bool MoveTo(DirectionType directionType)
|
||||
{
|
||||
if (_state != Status.InProgress)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (_moveableObject?.CheckCanMove(directionType) ?? false)
|
||||
{
|
||||
_moveableObject.MoveObject(directionType);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
31
ProjectTank/MovementStrategy/DrawningObjectTank.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using ProjectTank.DrawningObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTank.MovementStrategy
|
||||
{
|
||||
public class DrawningObjectTank : IMoveableObject
|
||||
{
|
||||
private readonly DrawningTankBase? DrawningTankBase = null;
|
||||
public DrawningObjectTank(DrawningTankBase drawningTankBase)
|
||||
{
|
||||
DrawningTankBase = drawningTankBase;
|
||||
}
|
||||
public ObjectParameters? GetObjectPosition
|
||||
{
|
||||
get
|
||||
{
|
||||
if (DrawningTankBase == null || DrawningTankBase.EntityTankBase == null) return null;
|
||||
|
||||
return new ObjectParameters(DrawningTankBase.GetPosX,
|
||||
DrawningTankBase.GetPosY, DrawningTankBase.GetWidth, DrawningTankBase.GetHeight);
|
||||
}
|
||||
}
|
||||
public int GetStep => (int)(DrawningTankBase?.EntityTankBase?.Step ?? 0);
|
||||
public bool CheckCanMove(DirectionType direction) => DrawningTankBase?.CanMove(direction) ?? false;
|
||||
public void MoveObject(DirectionType direction) => DrawningTankBase?.MoveTransport(direction);
|
||||
}
|
||||
}
|
33
ProjectTank/MovementStrategy/IMoveableObject.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using ProjectTank.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTank.MovementStrategy
|
||||
{
|
||||
public interface IMoveableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Получение координаты X объекта
|
||||
/// </summary>
|
||||
ObjectParameters? GetObjectPosition { get; }
|
||||
/// <summary>
|
||||
/// Шаг объекта
|
||||
/// </summary>
|
||||
int GetStep { get; }
|
||||
/// <summary>
|
||||
/// Проверка, можно ли переместиться по нужному направлению
|
||||
/// </summary>
|
||||
/// <param name="direction"></param>
|
||||
/// <returns></returns>
|
||||
bool CheckCanMove(DirectionType direction);
|
||||
/// <summary>
|
||||
/// Изменение направления пермещения объекта
|
||||
/// </summary>
|
||||
/// <param name="direction">Направление</param>
|
||||
void MoveObject(DirectionType direction);
|
||||
}
|
||||
|
||||
}
|
40
ProjectTank/MovementStrategy/MoveToCenter.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTank.MovementStrategy
|
||||
{
|
||||
public class MoveToCenter : AbstractStrategy
|
||||
{
|
||||
protected override bool IsTargetDestination()
|
||||
{
|
||||
var objParams = GetObjectParameters;
|
||||
if (objParams == null) return false;
|
||||
|
||||
return objParams.ObjectMiddleHorizontal <= FieldWidth / 2 &&
|
||||
objParams.ObjectMiddleHorizontal + GetStep() >= FieldWidth / 2 &&
|
||||
objParams.ObjectMiddleVertical <= FieldHeight / 2 &&
|
||||
objParams.ObjectMiddleVertical + GetStep() >= FieldHeight / 2;
|
||||
}
|
||||
protected override void MoveToTarget()
|
||||
{
|
||||
var objParams = GetObjectParameters;
|
||||
if (objParams == null) return;
|
||||
|
||||
var diffX = objParams.ObjectMiddleHorizontal - FieldWidth / 2;
|
||||
if (Math.Abs(diffX) > GetStep())
|
||||
{
|
||||
if (diffX > 0) MoveLeft();
|
||||
else MoveRight();
|
||||
}
|
||||
var diffY = objParams.ObjectMiddleVertical - FieldHeight / 2;
|
||||
if (Math.Abs(diffY) > GetStep())
|
||||
{
|
||||
if (diffY > 0) MoveUp();
|
||||
else MoveDown();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
40
ProjectTank/MovementStrategy/MoveToRightBottomCorner.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTank.MovementStrategy
|
||||
{
|
||||
public class MoveToRightBottomCorner : AbstractStrategy
|
||||
{
|
||||
protected override bool IsTargetDestination()
|
||||
{
|
||||
var objParams = GetObjectParameters;
|
||||
if (objParams == null) return false;
|
||||
|
||||
return objParams.RightBorder <= FieldWidth && objParams.RightBorder + GetStep() > FieldWidth &&
|
||||
objParams.DownBorder <= FieldHeight && objParams.DownBorder + GetStep() > FieldHeight;
|
||||
}
|
||||
|
||||
protected override void MoveToTarget()
|
||||
{
|
||||
var objParams = GetObjectParameters;
|
||||
if (objParams == null) return;
|
||||
|
||||
var diffX = objParams.ObjectMiddleHorizontal - FieldWidth;
|
||||
if (Math.Abs(diffX) > GetStep())
|
||||
{
|
||||
if (diffX > 0) MoveLeft();
|
||||
else MoveRight();
|
||||
}
|
||||
|
||||
var diffY = objParams.ObjectMiddleVertical - FieldHeight;
|
||||
if (Math.Abs(diffY) > GetStep())
|
||||
{
|
||||
if (diffY > 0) MoveUp();
|
||||
else MoveDown();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
56
ProjectTank/MovementStrategy/ObjectParameters.cs
Normal file
@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTank.MovementStrategy
|
||||
{
|
||||
/// </summary>
|
||||
public class ObjectParameters
|
||||
{
|
||||
private readonly int _x;
|
||||
private readonly int _y;
|
||||
private readonly int _width;
|
||||
private readonly int _height;
|
||||
/// <summary>
|
||||
/// Левая граница
|
||||
/// </summary>
|
||||
public int LeftBorder => _x;
|
||||
/// <summary>
|
||||
/// Верхняя граница
|
||||
/// </summary>
|
||||
public int TopBorder => _y;
|
||||
/// <summary>
|
||||
/// Правая граница
|
||||
/// </summary>
|
||||
public int RightBorder => _x + _width;
|
||||
/// <summary>
|
||||
/// Нижняя граница
|
||||
/// </summary>
|
||||
public int DownBorder => _y + _height;
|
||||
/// <summary>
|
||||
/// Середина объекта
|
||||
/// </summary>
|
||||
public int ObjectMiddleHorizontal => _x + _width / 2;
|
||||
/// <summary>
|
||||
/// Середина объекта
|
||||
/// </summary>
|
||||
public int ObjectMiddleVertical => _y + _height / 2;
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="x">Координата X</param>
|
||||
/// <param name="y">Координата Y</param>
|
||||
/// <param name="width">Ширина</param>
|
||||
/// <param name="height">Высота</param>
|
||||
public ObjectParameters(int x, int y, int width, int height)
|
||||
{
|
||||
_x = x;
|
||||
_y = y;
|
||||
_width = width;
|
||||
_height = height;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
15
ProjectTank/MovementStrategy/Status.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTank.MovementStrategy
|
||||
{
|
||||
public enum Status
|
||||
{
|
||||
NotInit = 1,
|
||||
InProgress = 2,
|
||||
Finish = 3
|
||||
}
|
||||
}
|
17
ProjectTank/Program.cs
Normal 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());
|
||||
}
|
||||
}
|
||||
}
|
11
ProjectTank/ProjectTank.csproj
Normal 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>
|
103
ProjectTank/Properties/Resources.Designer.cs
generated
Normal 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
133
ProjectTank/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\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>
|
BIN
ProjectTank/Resources/icons8-down-arrow-30.png
Normal file
After Width: | Height: | Size: 263 B |
BIN
ProjectTank/Resources/icons8-down-arrow-40.png
Normal file
After Width: | Height: | Size: 334 B |
BIN
ProjectTank/Resources/icons8-down-arrow-50.png
Normal file
After Width: | Height: | Size: 392 B |
BIN
ProjectTank/Resources/icons8-left-arrow-40.png
Normal file
After Width: | Height: | Size: 235 B |
BIN
ProjectTank/Resources/icons8-right-arrow-40.png
Normal file
After Width: | Height: | Size: 245 B |
BIN
ProjectTank/Resources/icons8-up-40.png
Normal file
After Width: | Height: | Size: 262 B |
BIN
ProjectTank/Resources/icons8-up-arrow-40.png
Normal file
After Width: | Height: | Size: 363 B |
BIN
ProjectTank/Resources/pngwing.com.png
Normal file
After Width: | Height: | Size: 33 KiB |