Compare commits
No commits in common. "e3d220f07a07d11e0786a039270a67f09767532a" and "a3450ad3ac24f5107586694edc4ee665e8bd12f5" have entirely different histories.
e3d220f07a
...
a3450ad3ac
@ -1,16 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Artilleries
|
|
||||||
{
|
|
||||||
internal enum Direction
|
|
||||||
{
|
|
||||||
Up = 1,
|
|
||||||
Down = 2,
|
|
||||||
Left = 3,
|
|
||||||
Right = 4
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,118 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Artilleries
|
|
||||||
{
|
|
||||||
internal class DrawingArtillery
|
|
||||||
{
|
|
||||||
public EntityArtillery Artillery { private set; get; }
|
|
||||||
private float _startPosX;
|
|
||||||
private float _startPosY;
|
|
||||||
private int? _pictureWidth = null;
|
|
||||||
private int? _pictureHeight = null;
|
|
||||||
private readonly int _artilleryWidth = 80;
|
|
||||||
private readonly int _artilleryHeight = 50;
|
|
||||||
public void Init(int speed, float weight, Color bodyColor)
|
|
||||||
{
|
|
||||||
Artillery = new EntityArtillery();
|
|
||||||
Artillery.Init(speed, weight, bodyColor);
|
|
||||||
}
|
|
||||||
public void SetPosition(int x, int y, int width, int height)
|
|
||||||
{
|
|
||||||
if (x < 0 || x + _artilleryWidth >= width)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (y < 0 || y + _artilleryHeight >= height)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_startPosX = x;
|
|
||||||
_startPosY = y;
|
|
||||||
_pictureWidth = width;
|
|
||||||
_pictureHeight = height;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void MoveTransport(Direction direction)
|
|
||||||
{
|
|
||||||
if (!_pictureWidth.HasValue || !_pictureHeight.HasValue)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
switch (direction)
|
|
||||||
{
|
|
||||||
case Direction.Right:
|
|
||||||
if (_startPosX + _artilleryWidth + Artillery.Step < _pictureWidth)
|
|
||||||
{
|
|
||||||
_startPosX += Artillery.Step;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Direction.Left:
|
|
||||||
if (_startPosX - Artillery.Step >= 0)
|
|
||||||
{
|
|
||||||
_startPosX -= Artillery.Step;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Direction.Up:
|
|
||||||
if (_startPosY - Artillery.Step >= 0)
|
|
||||||
{
|
|
||||||
_startPosY -= Artillery.Step;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Direction.Down:
|
|
||||||
if (_startPosY + _artilleryHeight + Artillery.Step < _pictureHeight)
|
|
||||||
{
|
|
||||||
_startPosY += Artillery.Step;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DrawTransport(Graphics g)
|
|
||||||
{
|
|
||||||
if (_startPosX < 0 || _startPosY < 0 || !_pictureHeight.HasValue || !_pictureWidth.HasValue)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Brush brush = new SolidBrush(Artillery?.BodyColor ?? Color.Black);
|
|
||||||
g.FillRectangle(brush, _startPosX + _artilleryWidth / 8 * 2, _startPosY, _artilleryWidth / 8 * 4, _artilleryWidth / 5);
|
|
||||||
g.FillRectangle(brush, _startPosX, _startPosY + _artilleryHeight / 5, _artilleryWidth, _artilleryHeight / 3);
|
|
||||||
|
|
||||||
Brush blackBrush = new SolidBrush(Color.Black);
|
|
||||||
Brush grayBrush = new SolidBrush(Color.Gray);
|
|
||||||
g.FillEllipse(grayBrush, _startPosX, _startPosY + _artilleryHeight * 2 / 5, _artilleryWidth, _artilleryHeight * 2 / 5);
|
|
||||||
g.FillEllipse(blackBrush, _startPosX + _artilleryWidth / 20, _startPosY + _artilleryHeight * 7 / 15, _artilleryWidth * 4 / 20, _artilleryHeight * 10 / 32);
|
|
||||||
g.FillEllipse(blackBrush, _startPosX + _artilleryWidth * 5 / 20, _startPosY + _artilleryHeight * 9 / 16, _artilleryWidth * 3 / 20, _artilleryHeight * 8 / 32);
|
|
||||||
g.FillEllipse(blackBrush, _startPosX + _artilleryWidth * 8 / 20, _startPosY + _artilleryHeight * 10 / 16, _artilleryWidth * 2 / 20, _artilleryHeight * 6 / 32);
|
|
||||||
g.FillEllipse(blackBrush, _startPosX + _artilleryWidth * 10 / 20, _startPosY + _artilleryHeight * 10 / 16, _artilleryWidth * 2 / 20, _artilleryHeight * 6 / 32);
|
|
||||||
g.FillEllipse(blackBrush, _startPosX + _artilleryWidth * 12 / 20, _startPosY + _artilleryHeight * 9 / 16, _artilleryWidth * 3 / 20, _artilleryHeight * 8 / 32);
|
|
||||||
g.FillEllipse(blackBrush, _startPosX + _artilleryWidth * 15 / 20, _startPosY + _artilleryHeight * 7 / 15, _artilleryWidth * 4 / 20, _artilleryHeight * 10 / 32);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ChangeBorders(int width, int height)
|
|
||||||
{
|
|
||||||
_pictureWidth = width;
|
|
||||||
_pictureHeight = height;
|
|
||||||
if (_pictureWidth <= _artilleryWidth || _pictureHeight <= _artilleryHeight)
|
|
||||||
{
|
|
||||||
_pictureWidth = null;
|
|
||||||
_pictureHeight = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (_startPosX + _artilleryWidth > _pictureWidth)
|
|
||||||
{
|
|
||||||
_startPosX = _pictureWidth.Value - _artilleryWidth;
|
|
||||||
}
|
|
||||||
if (_startPosY + _artilleryHeight > _pictureHeight)
|
|
||||||
{
|
|
||||||
_startPosY = _pictureHeight.Value - _artilleryHeight;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Artilleries
|
|
||||||
{
|
|
||||||
internal class EntityArtillery
|
|
||||||
{
|
|
||||||
public int Speed { get; private set; }
|
|
||||||
public float Weight { get; private set; }
|
|
||||||
public Color BodyColor { get; private set; }
|
|
||||||
public float Step => Speed * 100 / Weight;
|
|
||||||
public void Init(int speed, float weight, Color bodyColor)
|
|
||||||
{
|
|
||||||
Random rnd = new();
|
|
||||||
Speed = speed <= 0 ? rnd.Next(50, 150) : speed;
|
|
||||||
Weight = weight <= 0 ? rnd.Next(40, 70) : weight;
|
|
||||||
BodyColor = bodyColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
39
SelfPropelledArtilleryUnit/Form1.Designer.cs
generated
Normal file
39
SelfPropelledArtilleryUnit/Form1.Designer.cs
generated
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
namespace SelfPropelledArtilleryUnit
|
||||||
|
{
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
10
SelfPropelledArtilleryUnit/Form1.cs
Normal file
10
SelfPropelledArtilleryUnit/Form1.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
namespace SelfPropelledArtilleryUnit
|
||||||
|
{
|
||||||
|
public partial class Form1 : Form
|
||||||
|
{
|
||||||
|
public Form1()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -117,17 +117,4 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
|
||||||
<data name="ArrowDown" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
|
||||||
<value>..\Resources\ArrowDown.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\ArrowUp.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\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\ArrowRight.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
|
||||||
</data>
|
|
||||||
</root>
|
</root>
|
187
SelfPropelledArtilleryUnit/FormArtillery.Designer.cs
generated
187
SelfPropelledArtilleryUnit/FormArtillery.Designer.cs
generated
@ -1,187 +0,0 @@
|
|||||||
namespace Artilleries
|
|
||||||
{
|
|
||||||
partial class FormArtillery
|
|
||||||
{
|
|
||||||
/// <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.statusStrip1 = new System.Windows.Forms.StatusStrip();
|
|
||||||
this.SpeedStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
|
|
||||||
this.WeightStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
|
|
||||||
this.ColorStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
|
|
||||||
this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
|
|
||||||
this.pictureBoxArtilleries = new System.Windows.Forms.PictureBox();
|
|
||||||
this.buttonCreate = new System.Windows.Forms.Button();
|
|
||||||
this.buttonLeft = new System.Windows.Forms.Button();
|
|
||||||
this.buttonUp = new System.Windows.Forms.Button();
|
|
||||||
this.buttonDown = new System.Windows.Forms.Button();
|
|
||||||
this.buttonRight = new System.Windows.Forms.Button();
|
|
||||||
this.statusStrip1.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxArtilleries)).BeginInit();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// statusStrip1
|
|
||||||
//
|
|
||||||
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
|
||||||
this.SpeedStatusLabel,
|
|
||||||
this.WeightStatusLabel,
|
|
||||||
this.ColorStatusLabel});
|
|
||||||
this.statusStrip1.Location = new System.Drawing.Point(0, 419);
|
|
||||||
this.statusStrip1.Name = "statusStrip1";
|
|
||||||
this.statusStrip1.Size = new System.Drawing.Size(624, 22);
|
|
||||||
this.statusStrip1.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// SpeedStatusLabel
|
|
||||||
//
|
|
||||||
this.SpeedStatusLabel.Name = "SpeedStatusLabel";
|
|
||||||
this.SpeedStatusLabel.Size = new System.Drawing.Size(62, 17);
|
|
||||||
this.SpeedStatusLabel.Text = "Скорость:";
|
|
||||||
//
|
|
||||||
// WeightStatusLabel
|
|
||||||
//
|
|
||||||
this.WeightStatusLabel.Name = "WeightStatusLabel";
|
|
||||||
this.WeightStatusLabel.Size = new System.Drawing.Size(29, 17);
|
|
||||||
this.WeightStatusLabel.Text = "Вес:";
|
|
||||||
//
|
|
||||||
// ColorStatusLabel
|
|
||||||
//
|
|
||||||
this.ColorStatusLabel.Name = "ColorStatusLabel";
|
|
||||||
this.ColorStatusLabel.Size = new System.Drawing.Size(36, 17);
|
|
||||||
this.ColorStatusLabel.Text = "Цвет:";
|
|
||||||
//
|
|
||||||
// toolStripStatusLabel1
|
|
||||||
//
|
|
||||||
this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
|
|
||||||
this.toolStripStatusLabel1.Size = new System.Drawing.Size(23, 23);
|
|
||||||
//
|
|
||||||
// pictureBoxArtilleries
|
|
||||||
//
|
|
||||||
this.pictureBoxArtilleries.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
||||||
this.pictureBoxArtilleries.Location = new System.Drawing.Point(0, 0);
|
|
||||||
this.pictureBoxArtilleries.Name = "pictureBoxArtilleries";
|
|
||||||
this.pictureBoxArtilleries.Size = new System.Drawing.Size(624, 419);
|
|
||||||
this.pictureBoxArtilleries.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
|
|
||||||
this.pictureBoxArtilleries.TabIndex = 1;
|
|
||||||
this.pictureBoxArtilleries.TabStop = false;
|
|
||||||
this.pictureBoxArtilleries.SizeChanged += new System.EventHandler(this.pictureBoxArtilleries_Resize);
|
|
||||||
//
|
|
||||||
// buttonCreate
|
|
||||||
//
|
|
||||||
this.buttonCreate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
|
||||||
this.buttonCreate.Location = new System.Drawing.Point(12, 382);
|
|
||||||
this.buttonCreate.Name = "buttonCreate";
|
|
||||||
this.buttonCreate.Size = new System.Drawing.Size(75, 23);
|
|
||||||
this.buttonCreate.TabIndex = 2;
|
|
||||||
this.buttonCreate.Text = "Создать";
|
|
||||||
this.buttonCreate.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonCreate.Click += new System.EventHandler(this.buttonCreate_Click);
|
|
||||||
//
|
|
||||||
// buttonLeft
|
|
||||||
//
|
|
||||||
this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonLeft.BackgroundImage = global::SelfPropelledArtilleryUnit.Properties.Resources.ArrowLeft;
|
|
||||||
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
|
||||||
this.buttonLeft.Location = new System.Drawing.Point(509, 375);
|
|
||||||
this.buttonLeft.Name = "buttonLeft";
|
|
||||||
this.buttonLeft.Size = new System.Drawing.Size(30, 30);
|
|
||||||
this.buttonLeft.TabIndex = 3;
|
|
||||||
this.buttonLeft.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonLeft.Click += new System.EventHandler(this.buttonMove_Click);
|
|
||||||
//
|
|
||||||
// buttonUp
|
|
||||||
//
|
|
||||||
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonUp.BackgroundImage = global::SelfPropelledArtilleryUnit.Properties.Resources.ArrowUp;
|
|
||||||
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
|
||||||
this.buttonUp.Location = new System.Drawing.Point(543, 342);
|
|
||||||
this.buttonUp.Name = "buttonUp";
|
|
||||||
this.buttonUp.Size = new System.Drawing.Size(30, 30);
|
|
||||||
this.buttonUp.TabIndex = 4;
|
|
||||||
this.buttonUp.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonUp.Click += new System.EventHandler(this.buttonMove_Click);
|
|
||||||
//
|
|
||||||
// buttonDown
|
|
||||||
//
|
|
||||||
this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonDown.BackgroundImage = global::SelfPropelledArtilleryUnit.Properties.Resources.ArrowDown;
|
|
||||||
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
|
||||||
this.buttonDown.Location = new System.Drawing.Point(543, 375);
|
|
||||||
this.buttonDown.Name = "buttonDown";
|
|
||||||
this.buttonDown.Size = new System.Drawing.Size(30, 30);
|
|
||||||
this.buttonDown.TabIndex = 5;
|
|
||||||
this.buttonDown.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonDown.Click += new System.EventHandler(this.buttonMove_Click);
|
|
||||||
//
|
|
||||||
// buttonRight
|
|
||||||
//
|
|
||||||
this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.buttonRight.BackgroundImage = global::SelfPropelledArtilleryUnit.Properties.Resources.ArrowRight;
|
|
||||||
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
|
||||||
this.buttonRight.Location = new System.Drawing.Point(579, 375);
|
|
||||||
this.buttonRight.Name = "buttonRight";
|
|
||||||
this.buttonRight.Size = new System.Drawing.Size(30, 30);
|
|
||||||
this.buttonRight.TabIndex = 6;
|
|
||||||
this.buttonRight.UseVisualStyleBackColor = true;
|
|
||||||
this.buttonRight.Click += new System.EventHandler(this.buttonMove_Click);
|
|
||||||
//
|
|
||||||
// FormArtillery
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(624, 441);
|
|
||||||
this.Controls.Add(this.buttonRight);
|
|
||||||
this.Controls.Add(this.buttonDown);
|
|
||||||
this.Controls.Add(this.buttonUp);
|
|
||||||
this.Controls.Add(this.buttonLeft);
|
|
||||||
this.Controls.Add(this.buttonCreate);
|
|
||||||
this.Controls.Add(this.pictureBoxArtilleries);
|
|
||||||
this.Controls.Add(this.statusStrip1);
|
|
||||||
this.Name = "FormArtillery";
|
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
|
||||||
this.Text = "Artillery";
|
|
||||||
this.statusStrip1.ResumeLayout(false);
|
|
||||||
this.statusStrip1.PerformLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxArtilleries)).EndInit();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private StatusStrip statusStrip1;
|
|
||||||
private ToolStripStatusLabel toolStripStatusLabel1;
|
|
||||||
private ToolStripStatusLabel SpeedStatusLabel;
|
|
||||||
private ToolStripStatusLabel WeightStatusLabel;
|
|
||||||
private ToolStripStatusLabel ColorStatusLabel;
|
|
||||||
private PictureBox pictureBoxArtilleries;
|
|
||||||
private Button buttonCreate;
|
|
||||||
private Button buttonLeft;
|
|
||||||
private Button buttonUp;
|
|
||||||
private Button buttonDown;
|
|
||||||
private Button buttonRight;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,59 +0,0 @@
|
|||||||
namespace Artilleries
|
|
||||||
{
|
|
||||||
public partial class FormArtillery : Form
|
|
||||||
{
|
|
||||||
private DrawingArtillery _artillery;
|
|
||||||
|
|
||||||
public FormArtillery()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Draw()
|
|
||||||
{
|
|
||||||
Bitmap bmp = new(pictureBoxArtilleries.Width, pictureBoxArtilleries.Height);
|
|
||||||
Graphics gr = Graphics.FromImage(bmp);
|
|
||||||
_artillery?.DrawTransport(gr);
|
|
||||||
pictureBoxArtilleries.Image = bmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonCreate_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Random rnd = new();
|
|
||||||
_artillery = new DrawingArtillery();
|
|
||||||
_artillery.Init(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
|
|
||||||
_artillery.SetPosition(rnd.Next(pictureBoxArtilleries.Width - 161, pictureBoxArtilleries.Width - 81), rnd.Next(10, 100), pictureBoxArtilleries.Width, pictureBoxArtilleries.Height);
|
|
||||||
SpeedStatusLabel.Text = $"Скорость: {_artillery.Artillery.Speed}";
|
|
||||||
WeightStatusLabel.Text = $"Вес: {_artillery.Artillery.Weight}";
|
|
||||||
ColorStatusLabel.Text = $"Цвет: {_artillery.Artillery.BodyColor.Name}";
|
|
||||||
Draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonMove_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
string name = ((Button)sender)?.Name ?? string.Empty;
|
|
||||||
switch (name)
|
|
||||||
{
|
|
||||||
case "buttonUp":
|
|
||||||
_artillery?.MoveTransport(Direction.Up);
|
|
||||||
break;
|
|
||||||
case "buttonDown":
|
|
||||||
_artillery?.MoveTransport(Direction.Down);
|
|
||||||
break;
|
|
||||||
case "buttonLeft":
|
|
||||||
_artillery?.MoveTransport(Direction.Left);
|
|
||||||
break;
|
|
||||||
case "buttonRight":
|
|
||||||
_artillery?.MoveTransport(Direction.Right);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
Draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void pictureBoxArtilleries_Resize(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
_artillery?.ChangeBorders(pictureBoxArtilleries.Width, pictureBoxArtilleries.Height);
|
|
||||||
Draw();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,63 +0,0 @@
|
|||||||
<root>
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>17, 17</value>
|
|
||||||
</metadata>
|
|
||||||
</root>
|
|
@ -1,12 +1,17 @@
|
|||||||
namespace Artilleries
|
namespace SelfPropelledArtilleryUnit
|
||||||
{
|
{
|
||||||
internal static class Program
|
internal static class Program
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The main entry point for the application.
|
||||||
|
/// </summary>
|
||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main()
|
static void Main()
|
||||||
{
|
{
|
||||||
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
Application.Run(new FormArtillery());
|
Application.Run(new Form1());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,103 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// Этот код создан программой.
|
|
||||||
// Исполняемая версия:4.0.30319.42000
|
|
||||||
//
|
|
||||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
|
||||||
// повторной генерации кода.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace SelfPropelledArtilleryUnit.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("SelfPropelledArtilleryUnit.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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
Before Width: | Height: | Size: 17 KiB |
Binary file not shown.
Before Width: | Height: | Size: 11 KiB |
Binary file not shown.
Before Width: | Height: | Size: 9.3 KiB |
Binary file not shown.
Before Width: | Height: | Size: 17 KiB |
@ -1,25 +0,0 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
|
||||||
# Visual Studio Version 17
|
|
||||||
VisualStudioVersion = 17.3.32825.248
|
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SelfPropelledArtilleryUnit", "SelfPropelledArtilleryUnit.csproj", "{D1201BA2-52D4-4FD2-BCCE-A7384854E785}"
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
||||||
Debug|Any CPU = Debug|Any CPU
|
|
||||||
Release|Any CPU = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
||||||
{D1201BA2-52D4-4FD2-BCCE-A7384854E785}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{D1201BA2-52D4-4FD2-BCCE-A7384854E785}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{D1201BA2-52D4-4FD2-BCCE-A7384854E785}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{D1201BA2-52D4-4FD2-BCCE-A7384854E785}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
|
||||||
HideSolutionNode = FALSE
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
|
||||||
SolutionGuid = {4AC84756-85D9-4983-96C9-641A2590F78D}
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
Loading…
Reference in New Issue
Block a user