From a23ecbf81c252425eafdf7923edfdcb596048c5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=20=D0=91=D0=BE=D0=BD=D0=B4=D0=B0?= =?UTF-8?q?=D1=80=D0=B5=D0=BD=D0=BA=D0=BE?= Date: Wed, 19 Oct 2022 10:37:57 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B0=D0=BB=D0=BE=D0=B6=D0=B8=D0=BB=20?= =?UTF-8?q?=D1=88=D1=82=D0=B0=D0=BD=D1=8B=20=D0=BF=D0=BE=D0=BB=D0=BE=D0=BD?= =?UTF-8?q?=D0=BE=D0=B3=D0=BE=20=D0=BA=D0=BE=D0=B4=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WarmlyShip/WarmlyShip/FormMap.Designer.cs | 210 ---------------------- WarmlyShip/WarmlyShip/FormMap.cs | 88 --------- WarmlyShip/WarmlyShip/FormMap.resx | 63 ------- WarmlyShip/WarmlyShip/Program.cs | 2 +- 4 files changed, 1 insertion(+), 362 deletions(-) delete mode 100644 WarmlyShip/WarmlyShip/FormMap.Designer.cs delete mode 100644 WarmlyShip/WarmlyShip/FormMap.cs delete mode 100644 WarmlyShip/WarmlyShip/FormMap.resx diff --git a/WarmlyShip/WarmlyShip/FormMap.Designer.cs b/WarmlyShip/WarmlyShip/FormMap.Designer.cs deleted file mode 100644 index f89a930..0000000 --- a/WarmlyShip/WarmlyShip/FormMap.Designer.cs +++ /dev/null @@ -1,210 +0,0 @@ -namespace WarmlyShip -{ - partial class FormMap - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.pictureBox = new System.Windows.Forms.PictureBox(); - this.statusStrip = new System.Windows.Forms.StatusStrip(); - this.toolStripStatusSpeed = new System.Windows.Forms.ToolStripStatusLabel(); - this.toolStripStatusWeight = new System.Windows.Forms.ToolStripStatusLabel(); - this.toolStripStatusLabelBodyColor = new System.Windows.Forms.ToolStripStatusLabel(); - this.buttonRight = new System.Windows.Forms.Button(); - this.buttonUp = new System.Windows.Forms.Button(); - this.buttonLeft = new System.Windows.Forms.Button(); - this.buttonDown = new System.Windows.Forms.Button(); - this.ButtonCreate = new System.Windows.Forms.Button(); - this.buttonCreateModif = new System.Windows.Forms.Button(); - this.comboBoxSelectorMap = new System.Windows.Forms.ComboBox(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); - this.statusStrip.SuspendLayout(); - this.SuspendLayout(); - // - // pictureBox - // - this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill; - this.pictureBox.Location = new System.Drawing.Point(0, 0); - this.pictureBox.Name = "pictureBox"; - this.pictureBox.Size = new System.Drawing.Size(800, 428); - this.pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; - this.pictureBox.TabIndex = 0; - this.pictureBox.TabStop = false; - // - // statusStrip - // - this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.toolStripStatusSpeed, - this.toolStripStatusWeight, - this.toolStripStatusLabelBodyColor}); - this.statusStrip.Location = new System.Drawing.Point(0, 428); - this.statusStrip.Name = "statusStrip"; - this.statusStrip.Size = new System.Drawing.Size(800, 22); - this.statusStrip.TabIndex = 1; - this.statusStrip.Text = "statusStrip1"; - // - // toolStripStatusSpeed - // - this.toolStripStatusSpeed.Name = "toolStripStatusSpeed"; - this.toolStripStatusSpeed.Size = new System.Drawing.Size(62, 17); - this.toolStripStatusSpeed.Text = "Скорость:"; - // - // toolStripStatusWeight - // - this.toolStripStatusWeight.Name = "toolStripStatusWeight"; - this.toolStripStatusWeight.Size = new System.Drawing.Size(29, 17); - this.toolStripStatusWeight.Text = "Вес:"; - // - // toolStripStatusLabelBodyColor - // - this.toolStripStatusLabelBodyColor.Name = "toolStripStatusLabelBodyColor"; - this.toolStripStatusLabelBodyColor.Size = new System.Drawing.Size(36, 17); - this.toolStripStatusLabelBodyColor.Text = "Цвет:"; - // - // buttonRight - // - this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonRight.BackgroundImage = global::WarmlyShip.Properties.Resources.toright; - this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.buttonRight.Location = new System.Drawing.Point(738, 375); - this.buttonRight.Name = "buttonRight"; - this.buttonRight.Size = new System.Drawing.Size(50, 50); - this.buttonRight.TabIndex = 3; - this.buttonRight.UseVisualStyleBackColor = true; - this.buttonRight.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::WarmlyShip.Properties.Resources.totop; - this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.buttonUp.Location = new System.Drawing.Point(682, 319); - this.buttonUp.Name = "buttonUp"; - this.buttonUp.Size = new System.Drawing.Size(50, 50); - this.buttonUp.TabIndex = 4; - this.buttonUp.UseVisualStyleBackColor = true; - this.buttonUp.Click += new System.EventHandler(this.ButtonMove_Click); - // - // buttonLeft - // - this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonLeft.BackgroundImage = global::WarmlyShip.Properties.Resources.toleft; - this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.buttonLeft.Location = new System.Drawing.Point(626, 375); - this.buttonLeft.Name = "buttonLeft"; - this.buttonLeft.Size = new System.Drawing.Size(50, 50); - this.buttonLeft.TabIndex = 5; - this.buttonLeft.UseVisualStyleBackColor = true; - this.buttonLeft.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::WarmlyShip.Properties.Resources.todown; - this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.buttonDown.Location = new System.Drawing.Point(682, 375); - this.buttonDown.Name = "buttonDown"; - this.buttonDown.Size = new System.Drawing.Size(50, 50); - this.buttonDown.TabIndex = 6; - this.buttonDown.UseVisualStyleBackColor = true; - this.buttonDown.Click += new System.EventHandler(this.ButtonMove_Click); - // - // 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, 402); - this.ButtonCreate.Name = "ButtonCreate"; - this.ButtonCreate.Size = new System.Drawing.Size(75, 23); - this.ButtonCreate.TabIndex = 7; - this.ButtonCreate.Text = "Создать"; - this.ButtonCreate.UseVisualStyleBackColor = true; - this.ButtonCreate.Click += new System.EventHandler(this.ButtonCreate_Click); - // - // buttonCreateModif - // - this.buttonCreateModif.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.buttonCreateModif.Location = new System.Drawing.Point(93, 402); - this.buttonCreateModif.Name = "buttonCreateModif"; - this.buttonCreateModif.Size = new System.Drawing.Size(100, 23); - this.buttonCreateModif.TabIndex = 8; - this.buttonCreateModif.Text = "Модификация "; - this.buttonCreateModif.UseVisualStyleBackColor = true; - this.buttonCreateModif.Click += new System.EventHandler(this.ButtonCreateModif_Click); - // - // comboBoxSelectorMap - // - this.comboBoxSelectorMap.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.comboBoxSelectorMap.FormattingEnabled = true; - this.comboBoxSelectorMap.Items.AddRange(new object[] { - "Простая карта", - "Вторая карта", - "Последняя карта"}); - this.comboBoxSelectorMap.Location = new System.Drawing.Point(12, 12); - this.comboBoxSelectorMap.Name = "comboBoxSelectorMap"; - this.comboBoxSelectorMap.Size = new System.Drawing.Size(121, 23); - this.comboBoxSelectorMap.TabIndex = 9; - this.comboBoxSelectorMap.SelectedIndexChanged += new System.EventHandler(this.СomboBoxSelectorMap_SelectedIndexChanged); - // - // FormMap - // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); - this.Controls.Add(this.comboBoxSelectorMap); - this.Controls.Add(this.buttonCreateModif); - this.Controls.Add(this.ButtonCreate); - this.Controls.Add(this.buttonDown); - this.Controls.Add(this.buttonLeft); - this.Controls.Add(this.buttonUp); - this.Controls.Add(this.buttonRight); - this.Controls.Add(this.pictureBox); - this.Controls.Add(this.statusStrip); - this.Name = "FormMap"; - this.Text = "FormMap"; - ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); - this.statusStrip.ResumeLayout(false); - this.statusStrip.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private PictureBox pictureBox; - private StatusStrip statusStrip; - private ToolStripStatusLabel toolStripStatusSpeed; - private ToolStripStatusLabel toolStripStatusWeight; - private ToolStripStatusLabel toolStripStatusLabelBodyColor; - private Button buttonRight; - private Button buttonUp; - private Button buttonLeft; - private Button buttonDown; - private Button ButtonCreate; - private Button buttonCreateModif; - private ComboBox comboBoxSelectorMap; - } -} \ No newline at end of file diff --git a/WarmlyShip/WarmlyShip/FormMap.cs b/WarmlyShip/WarmlyShip/FormMap.cs deleted file mode 100644 index 3d6c502..0000000 --- a/WarmlyShip/WarmlyShip/FormMap.cs +++ /dev/null @@ -1,88 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace WarmlyShip -{ - public partial class FormMap : Form - { - private AbstractMap _abstractMap; - - public FormMap() - { - InitializeComponent(); - _abstractMap = new SimpleMap(); - } - - private void SetData(DrawingWarmlyShip warmlyShip) - { - toolStripStatusSpeed.Text = $"Скорость: {warmlyShip.warmlyShip?.Speed}"; - toolStripStatusWeight.Text = $"Вес: {warmlyShip.warmlyShip?.Weight}"; - toolStripStatusLabelBodyColor.Text = $"Цвет: {warmlyShip.warmlyShip?.BodyColor}"; - pictureBox.Image = _abstractMap.CreateMap(pictureBox.Width, pictureBox.Height, new DrawningObjectShip(warmlyShip)); - } - - - private void ButtonCreate_Click(object sender, EventArgs e) - { - Random random = new Random(); - var warmlyShip = new DrawingWarmlyShip(random.Next(100, 300), random.Next(1000, 3000), Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256))); - SetData(warmlyShip); - } - - private void ButtonMove_Click(object sender, EventArgs e) - { - string name = ((Button)sender)?.Name ?? string.Empty; - Direction direction = Direction.None; - switch (name) - { - case "buttonLeft": - direction = Direction.Left; - break; - case "buttonUp": - direction = Direction.Up; - break; - case "buttonRight": - direction = Direction.Right; - break; - case "buttonDown": - direction = Direction.Down; - break; - } - pictureBox.Image = _abstractMap?.MoveObject(direction); - } - - private void ButtonCreateModif_Click(object sender, EventArgs e) - { - Random random = new Random(); - var warmlyShip = new DrawningMotorShip(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)), - Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2))); - SetData(warmlyShip); - } - - private void СomboBoxSelectorMap_SelectedIndexChanged(object sender, EventArgs e) - { - switch (comboBoxSelectorMap.Text) - { - case "Простая карта": - _abstractMap = new SimpleMap(); - break; - case "Вторая карта": - _abstractMap = new SecondMap(); - break; - case "Последняя карта": - _abstractMap = new LastMap(); - break; - } - - } - } -} diff --git a/WarmlyShip/WarmlyShip/FormMap.resx b/WarmlyShip/WarmlyShip/FormMap.resx deleted file mode 100644 index 2c0949d..0000000 --- a/WarmlyShip/WarmlyShip/FormMap.resx +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - \ No newline at end of file diff --git a/WarmlyShip/WarmlyShip/Program.cs b/WarmlyShip/WarmlyShip/Program.cs index 9bf5de7..de3a3a8 100644 --- a/WarmlyShip/WarmlyShip/Program.cs +++ b/WarmlyShip/WarmlyShip/Program.cs @@ -11,7 +11,7 @@ namespace WarmlyShip // To customize application configuration such as set high DPI settings or default font, // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); - Application.Run(new FormMap()); + Application.Run(new FormMapWithSetShip()); } } } \ No newline at end of file