From 629f4919c079c5054e7ae2be20a3f79502e38a58 Mon Sep 17 00:00:00 2001 From: Hells Hound Date: Sat, 17 Sep 2022 11:17:47 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D1=85=D0=BE=D0=B4=20?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BA=D0=BE=D0=BD=D1=81=D1=82=D1=80=D1=83=D0=BA?= =?UTF-8?q?=D1=82=D0=BE=D1=80=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AircraftCarrier/AircraftCarrier/DrawingWarship.cs | 5 ++--- AircraftCarrier/AircraftCarrier/EntityWarship.cs | 2 +- .../AircraftCarrier/FormWarship.Designer.cs | 14 +++++++------- AircraftCarrier/AircraftCarrier/FormWarship.cs | 3 +-- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/AircraftCarrier/AircraftCarrier/DrawingWarship.cs b/AircraftCarrier/AircraftCarrier/DrawingWarship.cs index e5fdddb..a97c5df 100644 --- a/AircraftCarrier/AircraftCarrier/DrawingWarship.cs +++ b/AircraftCarrier/AircraftCarrier/DrawingWarship.cs @@ -45,10 +45,9 @@ namespace AircraftCarrier /// Скорость /// Вес военного корабля /// Цвет главной палубы - public void Init(int speed, float weight, Color bodyColor) + public DrawingWarship(int speed, float weight, Color bodyColor) { - Warship = new EntityWarship(); - Warship.Init(speed, weight, bodyColor); + Warship = new EntityWarship(speed, weight, bodyColor); } /// /// Установка позиции военного корабля diff --git a/AircraftCarrier/AircraftCarrier/EntityWarship.cs b/AircraftCarrier/AircraftCarrier/EntityWarship.cs index 2c0f4f5..88b6a83 100644 --- a/AircraftCarrier/AircraftCarrier/EntityWarship.cs +++ b/AircraftCarrier/AircraftCarrier/EntityWarship.cs @@ -33,7 +33,7 @@ namespace AircraftCarrier /// /// /// - public void Init(int speed, float weight, Color bodyColor) + public EntityWarship(int speed, float weight, Color bodyColor) { Random rnd = new(); Speed = speed <= 0 ? rnd.Next(50, 150) : speed; diff --git a/AircraftCarrier/AircraftCarrier/FormWarship.Designer.cs b/AircraftCarrier/AircraftCarrier/FormWarship.Designer.cs index 4e7f9f8..293e458 100644 --- a/AircraftCarrier/AircraftCarrier/FormWarship.Designer.cs +++ b/AircraftCarrier/AircraftCarrier/FormWarship.Designer.cs @@ -47,7 +47,7 @@ this.pictureBoxWarship.Dock = System.Windows.Forms.DockStyle.Fill; this.pictureBoxWarship.Location = new System.Drawing.Point(0, 0); this.pictureBoxWarship.Name = "pictureBoxWarship"; - this.pictureBoxWarship.Size = new System.Drawing.Size(510, 426); + this.pictureBoxWarship.Size = new System.Drawing.Size(768, 426); this.pictureBoxWarship.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.pictureBoxWarship.TabIndex = 0; this.pictureBoxWarship.TabStop = false; @@ -61,7 +61,7 @@ this.toolStripStatusLabelBodyColor}); this.statusStrip.Location = new System.Drawing.Point(0, 426); this.statusStrip.Name = "statusStrip"; - this.statusStrip.Size = new System.Drawing.Size(510, 22); + this.statusStrip.Size = new System.Drawing.Size(768, 22); this.statusStrip.TabIndex = 1; // // toolStripStatusLabelSpeed @@ -98,7 +98,7 @@ this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonDown.BackgroundImage = global::AircraftCarrier.Properties.Resources.ArrowDown; this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.buttonDown.Location = new System.Drawing.Point(428, 386); + this.buttonDown.Location = new System.Drawing.Point(686, 386); this.buttonDown.Name = "buttonDown"; this.buttonDown.Size = new System.Drawing.Size(30, 30); this.buttonDown.TabIndex = 3; @@ -111,7 +111,7 @@ this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonUp.BackgroundImage = global::AircraftCarrier.Properties.Resources.ArrowUp; this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.buttonUp.Location = new System.Drawing.Point(428, 350); + this.buttonUp.Location = new System.Drawing.Point(686, 350); this.buttonUp.Name = "buttonUp"; this.buttonUp.Size = new System.Drawing.Size(30, 30); this.buttonUp.TabIndex = 4; @@ -124,7 +124,7 @@ this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonLeft.BackgroundImage = global::AircraftCarrier.Properties.Resources.ArrowLeft; this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.buttonLeft.Location = new System.Drawing.Point(392, 386); + this.buttonLeft.Location = new System.Drawing.Point(650, 386); this.buttonLeft.Name = "buttonLeft"; this.buttonLeft.Size = new System.Drawing.Size(30, 30); this.buttonLeft.TabIndex = 5; @@ -137,7 +137,7 @@ this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonRight.BackgroundImage = global::AircraftCarrier.Properties.Resources.ArrowRight; this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.buttonRight.Location = new System.Drawing.Point(464, 386); + this.buttonRight.Location = new System.Drawing.Point(722, 386); this.buttonRight.Name = "buttonRight"; this.buttonRight.Size = new System.Drawing.Size(30, 30); this.buttonRight.TabIndex = 6; @@ -149,7 +149,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(510, 448); + this.ClientSize = new System.Drawing.Size(768, 448); this.Controls.Add(this.buttonRight); this.Controls.Add(this.buttonLeft); this.Controls.Add(this.buttonUp); diff --git a/AircraftCarrier/AircraftCarrier/FormWarship.cs b/AircraftCarrier/AircraftCarrier/FormWarship.cs index 3866bc7..00708c3 100644 --- a/AircraftCarrier/AircraftCarrier/FormWarship.cs +++ b/AircraftCarrier/AircraftCarrier/FormWarship.cs @@ -25,8 +25,7 @@ namespace AircraftCarrier private void ButtonCreate_Click(object sender, EventArgs e) { Random rnd = new(); - _warship = new DrawingWarship(); - _warship.Init(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256))); + _warship = new DrawingWarship(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256))); _warship.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), pictureBoxWarship.Width, pictureBoxWarship.Height); toolStripStatusLabelSpeed.Text = $": {_warship.Warship.Speed}"; toolStripStatusLabelWeight.Text = $": {_warship.Warship.Weight}";