Создание модификации
This commit is contained in:
parent
ace0650476
commit
ba856b7880
@ -12,15 +12,15 @@ namespace Stormtrooper
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Класс-сущность
|
/// Класс-сущность
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public EntityMilitaryAirplane Airplane { get; private set; }
|
public EntityMilitaryAirplane Airplane { get; protected set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Левая координата отрисовки автомобиля
|
/// Левая координата отрисовки автомобиля
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private float _startPosX;
|
protected float _startPosX;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Верхняя кооридната отрисовки автомобиля
|
/// Верхняя кооридната отрисовки автомобиля
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private float _startPosY;
|
protected float _startPosY;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ширина окна отрисовки
|
/// Ширина окна отрисовки
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -32,15 +32,16 @@ namespace Stormtrooper
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ширина отрисовки самолёта
|
/// Ширина отрисовки самолёта
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly int _airplaneWidth = 80;
|
protected readonly int _airplaneWidth;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Высота отрисовки самолёта
|
/// Высота отрисовки самолёта
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly int _airplaneHeight = 100;
|
protected readonly int _airplaneHeight;
|
||||||
public void Init(int speed, int weight)
|
public DrawningMilitaryAirplane(int speed, int weight, int wight = 80, int height = 100)
|
||||||
{
|
{
|
||||||
Airplane = new EntityMilitaryAirplane();
|
Airplane = new EntityMilitaryAirplane(speed, weight);
|
||||||
Airplane.Init(speed, weight);
|
_airplaneWidth = wight;
|
||||||
|
_airplaneHeight = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetPosition(int x, int y, int width, int height)
|
public void SetPosition(int x, int y, int width, int height)
|
||||||
@ -99,7 +100,7 @@ namespace Stormtrooper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawAirplane(Graphics g)
|
public virtual void DrawAirplane(Graphics g)
|
||||||
{
|
{
|
||||||
if (_startPosX < 0 || _startPosY < 0
|
if (_startPosX < 0 || _startPosY < 0
|
||||||
|| !_pictureHeight.HasValue || !_pictureWidth.HasValue)
|
|| !_pictureHeight.HasValue || !_pictureWidth.HasValue)
|
||||||
@ -109,23 +110,24 @@ namespace Stormtrooper
|
|||||||
Pen pen = new Pen(Color.Black);
|
Pen pen = new Pen(Color.Black);
|
||||||
|
|
||||||
|
|
||||||
Brush brush = new SolidBrush(Color.Black);
|
Brush brush = new SolidBrush(Color.DarkGreen);
|
||||||
g.FillPolygon(brush, new PointF[3] {new PointF(_startPosX, _startPosY + _airplaneHeight / 2),
|
g.FillPolygon(brush, new PointF[3] {new PointF(_startPosX, _startPosY + _airplaneHeight / 2),
|
||||||
new PointF(_startPosX + _airplaneWidth * 0.1f, _startPosY + _airplaneHeight * 0.45f),
|
new PointF(_startPosX + _airplaneWidth * 0.1f, _startPosY + _airplaneHeight * 0.45f),
|
||||||
new PointF(_startPosX + _airplaneWidth * 0.1f, _startPosY + _airplaneHeight * 0.55f)});
|
new PointF(_startPosX + _airplaneWidth * 0.1f, _startPosY + _airplaneHeight * 0.55f)});
|
||||||
g.DrawPolygon(pen, new PointF[6] { new PointF(_startPosX + _airplaneWidth*0.45f,_startPosY),
|
g.FillPolygon(brush, new PointF[6] { new PointF(_startPosX + _airplaneWidth*0.45f,_startPosY),
|
||||||
new PointF(_startPosX + _airplaneWidth*0.50f,_startPosY),
|
new PointF(_startPosX + _airplaneWidth * 0.50f,_startPosY),
|
||||||
new PointF(_startPosX + _airplaneWidth * 0.60f, _startPosY+_airplaneHeight*0.45f) ,
|
new PointF(_startPosX + _airplaneWidth * 0.60f, _startPosY+_airplaneHeight*0.45f) ,
|
||||||
new PointF(_startPosX + _airplaneWidth * 0.60f, _startPosY+ _airplaneHeight*0.55f),
|
new PointF(_startPosX + _airplaneWidth * 0.60f, _startPosY+ _airplaneHeight*0.55f),
|
||||||
new PointF(_startPosX + _airplaneWidth * 0.50f,_startPosY + _airplaneHeight),
|
new PointF(_startPosX + _airplaneWidth * 0.50f,_startPosY + _airplaneHeight),
|
||||||
new PointF(_startPosX + _airplaneWidth * 0.45f,_startPosY + _airplaneHeight)});
|
new PointF(_startPosX + _airplaneWidth * 0.45f,_startPosY + _airplaneHeight)});
|
||||||
g.DrawPolygon(pen, new PointF[4] {
|
g.FillPolygon(brush, new PointF[4] {
|
||||||
new PointF(_startPosX + _airplaneWidth, _startPosY + _airplaneHeight*0.20f),
|
new PointF(_startPosX + _airplaneWidth, _startPosY + _airplaneHeight*0.20f),
|
||||||
new PointF(_startPosX + _airplaneWidth*0.85f,_startPosY+_airplaneHeight*0.35f),
|
new PointF(_startPosX + _airplaneWidth*0.85f,_startPosY+_airplaneHeight*0.35f),
|
||||||
new PointF(_startPosX + _airplaneWidth * 0.85f,_startPosY + _airplaneHeight*0.65f),
|
new PointF(_startPosX + _airplaneWidth * 0.85f,_startPosY + _airplaneHeight*0.65f),
|
||||||
new PointF(_startPosX + _airplaneWidth, _startPosY + _airplaneHeight*0.80f)
|
new PointF(_startPosX + _airplaneWidth, _startPosY + _airplaneHeight*0.80f)
|
||||||
});
|
});
|
||||||
g.FillRectangle(new SolidBrush(Color.White), _startPosX + _airplaneWidth * 0.1f, _startPosY + _airplaneHeight * 0.45f, _airplaneWidth * 0.9f, _airplaneHeight * 0.1f);
|
g.FillRectangle(brush, _startPosX + _airplaneWidth * 0.1f, _startPosY + _airplaneHeight * 0.45f, _airplaneWidth * 0.9f, _airplaneHeight * 0.1f);
|
||||||
|
|
||||||
g.DrawRectangle(pen, _startPosX + _airplaneWidth * 0.1f, _startPosY + _airplaneHeight * 0.45f, _airplaneWidth * 0.9f, _airplaneHeight * 0.1f);
|
g.DrawRectangle(pen, _startPosX + _airplaneWidth * 0.1f, _startPosY + _airplaneHeight * 0.45f, _airplaneWidth * 0.9f, _airplaneHeight * 0.1f);
|
||||||
}
|
}
|
||||||
public void ChangeBorders(int width, int height)
|
public void ChangeBorders(int width, int height)
|
||||||
|
48
Stormtrooper/Stormtrooper/DrawningStormtrooper.cs
Normal file
48
Stormtrooper/Stormtrooper/DrawningStormtrooper.cs
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Stormtrooper
|
||||||
|
{
|
||||||
|
internal class DrawningStormtrooper : DrawningMilitaryAirplane
|
||||||
|
{
|
||||||
|
public DrawningStormtrooper(int speed, int weight, int crew, Color advColor, bool rockets, bool boosters, bool radar) : base(speed, weight)
|
||||||
|
{
|
||||||
|
Airplane = new EntityStormtrooper(speed, weight,crew, advColor, rockets, boosters, radar);
|
||||||
|
}
|
||||||
|
public override void DrawAirplane(Graphics g)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (Airplane is not EntityStormtrooper stormtrooper)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Pen pen = new Pen(stormtrooper.AdvColor);
|
||||||
|
Brush brush = new SolidBrush(stormtrooper.AdvColor);
|
||||||
|
if (stormtrooper.Rockets)
|
||||||
|
{
|
||||||
|
g.FillEllipse(brush,_startPosX + _airplaneWidth * 0.3f,_startPosY + _airplaneHeight * 0.2f,_airplaneWidth * 0.3f,_airplaneHeight * 0.03f);
|
||||||
|
g.FillEllipse(brush,_startPosX + _airplaneWidth * 0.3f,_startPosY + _airplaneHeight * 0.3f, _airplaneWidth * 0.3f, _airplaneHeight * 0.03f);
|
||||||
|
g.FillEllipse(brush,_startPosX + _airplaneWidth * 0.3f,_startPosY + _airplaneHeight * 0.7f, _airplaneWidth * 0.3f, _airplaneHeight * 0.03f);
|
||||||
|
g.FillEllipse(brush,_startPosX + _airplaneWidth * 0.3f,_startPosY + _airplaneHeight * 0.8f, _airplaneWidth * 0.3f, _airplaneHeight * 0.03f);
|
||||||
|
|
||||||
|
}
|
||||||
|
base.DrawAirplane(g);
|
||||||
|
|
||||||
|
if (stormtrooper.Booster)
|
||||||
|
{
|
||||||
|
g.FillRectangle(brush, _startPosX + _airplaneWidth * 0.95f, _startPosY + _airplaneHeight * 0.35f, _airplaneWidth * 0.055f, _airplaneHeight * 0.03f);
|
||||||
|
g.FillRectangle(brush, _startPosX + _airplaneWidth * 0.95f, _startPosY + _airplaneHeight * 0.63f, _airplaneWidth * 0.055f, _airplaneHeight * 0.03f);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stormtrooper.Radar)
|
||||||
|
{
|
||||||
|
g.FillEllipse(brush, _startPosX + _airplaneWidth * 0.1f, _startPosY + _airplaneHeight * 0.45f, _airplaneWidth*0.125f, _airplaneHeight * 0.1f);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -14,7 +14,7 @@ namespace Stormtrooper
|
|||||||
|
|
||||||
public float Step => Speed * 25 / Weight;
|
public float Step => Speed * 25 / Weight;
|
||||||
|
|
||||||
public void Init(int speed, int weight, int crew = 10)
|
public EntityMilitaryAirplane(int speed, int weight, int crew = 10)
|
||||||
{
|
{
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
Speed = speed <= 0 ? random.Next(10, 100) : speed;
|
Speed = speed <= 0 ? random.Next(10, 100) : speed;
|
||||||
|
39
Stormtrooper/Stormtrooper/EntityStormtrooper.cs
Normal file
39
Stormtrooper/Stormtrooper/EntityStormtrooper.cs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Stormtrooper
|
||||||
|
{
|
||||||
|
internal class EntityStormtrooper : EntityMilitaryAirplane
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Доп цвет
|
||||||
|
/// </summary>
|
||||||
|
public Color AdvColor { get;private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Наличие рокет
|
||||||
|
/// </summary>
|
||||||
|
public bool Rockets { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Наличие ускорителей
|
||||||
|
/// </summary>
|
||||||
|
public bool Booster { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Наличие радара
|
||||||
|
/// </summary>
|
||||||
|
public bool Radar { get; private set; }
|
||||||
|
|
||||||
|
public EntityStormtrooper(int speed, int weight, int crew, Color advColor, bool rockets, bool boosters, bool radar)
|
||||||
|
: base(speed, weight, crew)
|
||||||
|
{
|
||||||
|
Rockets = rockets;
|
||||||
|
Booster = boosters;
|
||||||
|
Radar = radar;
|
||||||
|
AdvColor = advColor;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
50
Stormtrooper/Stormtrooper/MainForm.Designer.cs
generated
50
Stormtrooper/Stormtrooper/MainForm.Designer.cs
generated
@ -39,6 +39,7 @@ namespace Stormtrooper
|
|||||||
this.buttonDown = new System.Windows.Forms.Button();
|
this.buttonDown = new System.Windows.Forms.Button();
|
||||||
this.buttonLeft = new System.Windows.Forms.Button();
|
this.buttonLeft = new System.Windows.Forms.Button();
|
||||||
this.buttonRight = new System.Windows.Forms.Button();
|
this.buttonRight = new System.Windows.Forms.Button();
|
||||||
|
this.buttonCreateMod = new System.Windows.Forms.Button();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxAirplane)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxAirplane)).BeginInit();
|
||||||
this.toolStripStatus.SuspendLayout();
|
this.toolStripStatus.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
@ -49,7 +50,8 @@ namespace Stormtrooper
|
|||||||
| System.Windows.Forms.AnchorStyles.Left)
|
| System.Windows.Forms.AnchorStyles.Left)
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.pictureBoxAirplane.BackColor = System.Drawing.Color.White;
|
this.pictureBoxAirplane.BackColor = System.Drawing.Color.White;
|
||||||
this.pictureBoxAirplane.Location = new System.Drawing.Point(12, 12);
|
this.pictureBoxAirplane.Location = new System.Drawing.Point(14, 14);
|
||||||
|
this.pictureBoxAirplane.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||||
this.pictureBoxAirplane.Name = "pictureBoxAirplane";
|
this.pictureBoxAirplane.Name = "pictureBoxAirplane";
|
||||||
this.pictureBoxAirplane.Size = new System.Drawing.Size(1127, 558);
|
this.pictureBoxAirplane.Size = new System.Drawing.Size(1127, 558);
|
||||||
this.pictureBoxAirplane.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
|
this.pictureBoxAirplane.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
|
||||||
@ -61,9 +63,10 @@ namespace Stormtrooper
|
|||||||
//
|
//
|
||||||
this.buttonCreate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.buttonCreate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.buttonCreate.Cursor = System.Windows.Forms.Cursors.Hand;
|
this.buttonCreate.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
this.buttonCreate.Location = new System.Drawing.Point(27, 518);
|
this.buttonCreate.Location = new System.Drawing.Point(31, 598);
|
||||||
|
this.buttonCreate.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||||
this.buttonCreate.Name = "buttonCreate";
|
this.buttonCreate.Name = "buttonCreate";
|
||||||
this.buttonCreate.Size = new System.Drawing.Size(75, 23);
|
this.buttonCreate.Size = new System.Drawing.Size(88, 27);
|
||||||
this.buttonCreate.TabIndex = 1;
|
this.buttonCreate.TabIndex = 1;
|
||||||
this.buttonCreate.Text = "Создать";
|
this.buttonCreate.Text = "Создать";
|
||||||
this.buttonCreate.UseVisualStyleBackColor = true;
|
this.buttonCreate.UseVisualStyleBackColor = true;
|
||||||
@ -76,9 +79,9 @@ namespace Stormtrooper
|
|||||||
this.toolStripLabelSpeed,
|
this.toolStripLabelSpeed,
|
||||||
this.toolStripLabelWeight,
|
this.toolStripLabelWeight,
|
||||||
this.toolStripLabelCrew});
|
this.toolStripLabelCrew});
|
||||||
this.toolStripStatus.Location = new System.Drawing.Point(0, 584);
|
this.toolStripStatus.Location = new System.Drawing.Point(0, 678);
|
||||||
this.toolStripStatus.Name = "toolStripStatus";
|
this.toolStripStatus.Name = "toolStripStatus";
|
||||||
this.toolStripStatus.Size = new System.Drawing.Size(1151, 25);
|
this.toolStripStatus.Size = new System.Drawing.Size(1343, 25);
|
||||||
this.toolStripStatus.TabIndex = 2;
|
this.toolStripStatus.TabIndex = 2;
|
||||||
this.toolStripStatus.Text = "toolStrip1";
|
this.toolStripStatus.Text = "toolStrip1";
|
||||||
//
|
//
|
||||||
@ -103,9 +106,10 @@ namespace Stormtrooper
|
|||||||
// buttonUp
|
// buttonUp
|
||||||
//
|
//
|
||||||
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.buttonUp.Location = new System.Drawing.Point(1031, 482);
|
this.buttonUp.Location = new System.Drawing.Point(1203, 556);
|
||||||
|
this.buttonUp.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||||
this.buttonUp.Name = "buttonUp";
|
this.buttonUp.Name = "buttonUp";
|
||||||
this.buttonUp.Size = new System.Drawing.Size(30, 30);
|
this.buttonUp.Size = new System.Drawing.Size(35, 35);
|
||||||
this.buttonUp.TabIndex = 3;
|
this.buttonUp.TabIndex = 3;
|
||||||
this.buttonUp.UseVisualStyleBackColor = true;
|
this.buttonUp.UseVisualStyleBackColor = true;
|
||||||
this.buttonUp.Click += new System.EventHandler(this.buttonMove_Click);
|
this.buttonUp.Click += new System.EventHandler(this.buttonMove_Click);
|
||||||
@ -113,9 +117,10 @@ namespace Stormtrooper
|
|||||||
// buttonDown
|
// buttonDown
|
||||||
//
|
//
|
||||||
this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.buttonDown.Location = new System.Drawing.Point(1031, 518);
|
this.buttonDown.Location = new System.Drawing.Point(1203, 598);
|
||||||
|
this.buttonDown.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||||
this.buttonDown.Name = "buttonDown";
|
this.buttonDown.Name = "buttonDown";
|
||||||
this.buttonDown.Size = new System.Drawing.Size(30, 30);
|
this.buttonDown.Size = new System.Drawing.Size(35, 35);
|
||||||
this.buttonDown.TabIndex = 4;
|
this.buttonDown.TabIndex = 4;
|
||||||
this.buttonDown.UseVisualStyleBackColor = true;
|
this.buttonDown.UseVisualStyleBackColor = true;
|
||||||
this.buttonDown.Click += new System.EventHandler(this.buttonMove_Click);
|
this.buttonDown.Click += new System.EventHandler(this.buttonMove_Click);
|
||||||
@ -123,9 +128,10 @@ namespace Stormtrooper
|
|||||||
// buttonLeft
|
// buttonLeft
|
||||||
//
|
//
|
||||||
this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.buttonLeft.Location = new System.Drawing.Point(995, 517);
|
this.buttonLeft.Location = new System.Drawing.Point(1161, 597);
|
||||||
|
this.buttonLeft.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||||
this.buttonLeft.Name = "buttonLeft";
|
this.buttonLeft.Name = "buttonLeft";
|
||||||
this.buttonLeft.Size = new System.Drawing.Size(30, 30);
|
this.buttonLeft.Size = new System.Drawing.Size(35, 35);
|
||||||
this.buttonLeft.TabIndex = 5;
|
this.buttonLeft.TabIndex = 5;
|
||||||
this.buttonLeft.UseVisualStyleBackColor = true;
|
this.buttonLeft.UseVisualStyleBackColor = true;
|
||||||
this.buttonLeft.Click += new System.EventHandler(this.buttonMove_Click);
|
this.buttonLeft.Click += new System.EventHandler(this.buttonMove_Click);
|
||||||
@ -133,18 +139,30 @@ namespace Stormtrooper
|
|||||||
// buttonRight
|
// buttonRight
|
||||||
//
|
//
|
||||||
this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.buttonRight.Location = new System.Drawing.Point(1067, 517);
|
this.buttonRight.Location = new System.Drawing.Point(1245, 597);
|
||||||
|
this.buttonRight.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||||
this.buttonRight.Name = "buttonRight";
|
this.buttonRight.Name = "buttonRight";
|
||||||
this.buttonRight.Size = new System.Drawing.Size(30, 30);
|
this.buttonRight.Size = new System.Drawing.Size(35, 35);
|
||||||
this.buttonRight.TabIndex = 6;
|
this.buttonRight.TabIndex = 6;
|
||||||
this.buttonRight.UseVisualStyleBackColor = true;
|
this.buttonRight.UseVisualStyleBackColor = true;
|
||||||
this.buttonRight.Click += new System.EventHandler(this.buttonMove_Click);
|
this.buttonRight.Click += new System.EventHandler(this.buttonMove_Click);
|
||||||
//
|
//
|
||||||
|
// buttonCreateMod
|
||||||
|
//
|
||||||
|
this.buttonCreateMod.Location = new System.Drawing.Point(162, 598);
|
||||||
|
this.buttonCreateMod.Name = "buttonCreateMod";
|
||||||
|
this.buttonCreateMod.Size = new System.Drawing.Size(104, 27);
|
||||||
|
this.buttonCreateMod.TabIndex = 7;
|
||||||
|
this.buttonCreateMod.Text = "Модификация";
|
||||||
|
this.buttonCreateMod.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonCreateMod.Click += new System.EventHandler(this.buttonCreateMod_Click);
|
||||||
|
//
|
||||||
// MainForm
|
// MainForm
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(1151, 609);
|
this.ClientSize = new System.Drawing.Size(1343, 703);
|
||||||
|
this.Controls.Add(this.buttonCreateMod);
|
||||||
this.Controls.Add(this.buttonRight);
|
this.Controls.Add(this.buttonRight);
|
||||||
this.Controls.Add(this.buttonLeft);
|
this.Controls.Add(this.buttonLeft);
|
||||||
this.Controls.Add(this.buttonDown);
|
this.Controls.Add(this.buttonDown);
|
||||||
@ -152,6 +170,7 @@ namespace Stormtrooper
|
|||||||
this.Controls.Add(this.toolStripStatus);
|
this.Controls.Add(this.toolStripStatus);
|
||||||
this.Controls.Add(this.buttonCreate);
|
this.Controls.Add(this.buttonCreate);
|
||||||
this.Controls.Add(this.pictureBoxAirplane);
|
this.Controls.Add(this.pictureBoxAirplane);
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||||
this.Name = "MainForm";
|
this.Name = "MainForm";
|
||||||
this.Text = "Form1";
|
this.Text = "Form1";
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxAirplane)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxAirplane)).EndInit();
|
||||||
@ -174,6 +193,7 @@ namespace Stormtrooper
|
|||||||
private System.Windows.Forms.Button buttonDown;
|
private System.Windows.Forms.Button buttonDown;
|
||||||
private System.Windows.Forms.Button buttonLeft;
|
private System.Windows.Forms.Button buttonLeft;
|
||||||
private System.Windows.Forms.Button buttonRight;
|
private System.Windows.Forms.Button buttonRight;
|
||||||
|
private Button buttonCreateMod;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,12 +29,9 @@ namespace Stormtrooper
|
|||||||
private void buttonCreate_Click(object sender, EventArgs e)
|
private void buttonCreate_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
_airplane = new DrawningMilitaryAirplane();
|
_airplane = new DrawningMilitaryAirplane(10, 50);
|
||||||
_airplane.Init(10, 50);
|
|
||||||
_airplane.SetPosition(random.Next(100,150), random.Next(100,150), pictureBoxAirplane.Width, pictureBoxAirplane.Height);
|
_airplane.SetPosition(random.Next(100,150), random.Next(100,150), pictureBoxAirplane.Width, pictureBoxAirplane.Height);
|
||||||
toolStripLabelSpeed.Text = $"Скорость: {_airplane.Airplane.Speed}";
|
SetData();
|
||||||
toolStripLabelWeight.Text = $"Вес: {_airplane.Airplane.Weight}";
|
|
||||||
toolStripLabelCrew.Text = $"Экипаж: {_airplane.Airplane.Crew}";
|
|
||||||
Draw();
|
Draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,5 +62,23 @@ namespace Stormtrooper
|
|||||||
}
|
}
|
||||||
Draw();
|
Draw();
|
||||||
}
|
}
|
||||||
|
private void SetData()
|
||||||
|
{
|
||||||
|
toolStripLabelSpeed.Text = $"Скорость: {_airplane.Airplane.Speed}";
|
||||||
|
toolStripLabelWeight.Text = $"Вес: {_airplane.Airplane.Weight}";
|
||||||
|
toolStripLabelCrew.Text = $"Экипаж: {_airplane.Airplane.Crew}";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonCreateMod_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
Random random = new Random();
|
||||||
|
_airplane = new DrawningStormtrooper(random.Next(10,100),random.Next(50,250),random.Next(1,100),
|
||||||
|
Color.FromArgb(random.Next(0,256), random.Next(0, 256), random.Next(0, 256)),
|
||||||
|
Convert.ToBoolean(random.Next(0,2)), Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
|
||||||
|
_airplane.SetPosition(random.Next(100, 150), random.Next(100, 150), pictureBoxAirplane.Width, pictureBoxAirplane.Height);
|
||||||
|
SetData();
|
||||||
|
Draw();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,64 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<root>
|
||||||
<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: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:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
Loading…
Reference in New Issue
Block a user