From f119cc66d7d3d38624e39d4c656da5a942ed48f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=B9=D0=B4=D0=B0=D1=80?= Date: Sat, 1 Oct 2022 12:50:08 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B2=D0=B0=D1=8F=20=D0=BB?= =?UTF-8?q?=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82=D0=BE=D1=80=D0=BD=D0=B0?= =?UTF-8?q?=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Battleship/Battleship/Battleship.csproj | 15 ++ Battleship/Battleship/Direction.cs | 20 ++ Battleship/Battleship/DrawningBattleship.cs | 194 ++++++++++++++++++ Battleship/Battleship/EntityBattleship.cs | 45 ++++ Battleship/Battleship/Form1.Designer.cs | 39 ---- Battleship/Battleship/Form1.cs | 10 - .../Battleship/FormBattleship.Designer.cs | 177 ++++++++++++++++ Battleship/Battleship/FormBattleship.cs | 76 +++++++ Battleship/Battleship/FormBattleship.resx | 63 ++++++ Battleship/Battleship/Program.cs | 2 +- .../Properties/Resources.Designer.cs | 103 ++++++++++ .../{Form1.resx => Properties/Resources.resx} | 13 ++ .../Battleship/Resources/BatteleshipDown.png | Bin 0 -> 393 bytes .../Battleship/Resources/BattleshipLeft.png | Bin 0 -> 334 bytes .../Battleship/Resources/BattleshipRight.png | Bin 0 -> 332 bytes .../Battleship/Resources/BattleshipUp.png | Bin 0 -> 330 bytes 16 files changed, 707 insertions(+), 50 deletions(-) create mode 100644 Battleship/Battleship/Direction.cs create mode 100644 Battleship/Battleship/DrawningBattleship.cs create mode 100644 Battleship/Battleship/EntityBattleship.cs delete mode 100644 Battleship/Battleship/Form1.Designer.cs delete mode 100644 Battleship/Battleship/Form1.cs create mode 100644 Battleship/Battleship/FormBattleship.Designer.cs create mode 100644 Battleship/Battleship/FormBattleship.cs create mode 100644 Battleship/Battleship/FormBattleship.resx create mode 100644 Battleship/Battleship/Properties/Resources.Designer.cs rename Battleship/Battleship/{Form1.resx => Properties/Resources.resx} (82%) create mode 100644 Battleship/Battleship/Resources/BatteleshipDown.png create mode 100644 Battleship/Battleship/Resources/BattleshipLeft.png create mode 100644 Battleship/Battleship/Resources/BattleshipRight.png create mode 100644 Battleship/Battleship/Resources/BattleshipUp.png diff --git a/Battleship/Battleship/Battleship.csproj b/Battleship/Battleship/Battleship.csproj index b57c89e..13ee123 100644 --- a/Battleship/Battleship/Battleship.csproj +++ b/Battleship/Battleship/Battleship.csproj @@ -8,4 +8,19 @@ enable + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + \ No newline at end of file diff --git a/Battleship/Battleship/Direction.cs b/Battleship/Battleship/Direction.cs new file mode 100644 index 0000000..ddbac72 --- /dev/null +++ b/Battleship/Battleship/Direction.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Battleship +{ + /// + /// Направление перемещения + /// + internal enum Direction + { + Up = 1, + Down = 2, + Left = 3, + Right = 4 + } + +} diff --git a/Battleship/Battleship/DrawningBattleship.cs b/Battleship/Battleship/DrawningBattleship.cs new file mode 100644 index 0000000..2217080 --- /dev/null +++ b/Battleship/Battleship/DrawningBattleship.cs @@ -0,0 +1,194 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Battleship +{ + /// + /// Класс, отвечающий за прорисовку и перемещение объекта-сущности + /// + internal class DrawningBattleship + { + /// + /// Класс-сущность + /// + public EntityBattleship Battleship { get; private set; } + /// + /// Левая координата отрисовки боевого корабля + /// + private float _startPosX; + /// + /// Верхняя кооридната отрисовки боевого корабля + /// + private float _startPosY; + /// + /// Ширина окна отрисовки + /// + private int? _pictureWidth = null; + /// + /// Высота окна отрисовки + /// + private int? _pictureHeight = null; + /// + /// Ширина отрисовки боевого корабля + /// + private readonly int _battleshipWidth = 80; + /// + /// Высота отрисовки боевого корабля + /// + private readonly int _battleshipHeight = 50; + /// + /// Инициализация свойств + /// + /// Скорость + /// Вес боевого корабля + /// Цвет корпуса + public void Init(int speed, float weight, Color bodyColor) + { + Battleship = new EntityBattleship(); + Battleship.Init(speed, weight, bodyColor); + } + /// + /// Установка позиции боевого корабля + /// + /// Координата X + /// Координата Y + /// Ширина картинки + /// Высота картинки + public void SetPosition(int x, int y, int width, int height) + { + // TODO checks + if (x < 0 || y < 0 || width < x + _battleshipWidth || height < y + _battleshipHeight) + { + _pictureHeight = null; + _pictureWidth = null; + 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 + _battleshipWidth + Battleship.Step < _pictureWidth) + { + _startPosX += Battleship.Step; + } + break; + //влево + case Direction.Left: + if (_startPosX - Battleship.Step > 0) + { + _startPosX -= Battleship.Step; + } + break; + //вверх + case Direction.Up: + if (_startPosY - Battleship.Step > 0) + { + _startPosY -= Battleship.Step; + } + break; + //вниз + case Direction.Down: + if (_startPosY + _battleshipHeight + Battleship.Step < _pictureHeight) + { + _startPosY += Battleship.Step; + } + break; + } + } + /// + /// Отрисовка боевого корабля + /// + /// + public void DrawTransport(Graphics g) + { + if (_startPosX < 0 || _startPosY < 0 + || !_pictureHeight.HasValue || !_pictureWidth.HasValue) + { + return; + } + Pen pen = new(Color.Black); + //границы боевого корабля + g.DrawEllipse(pen, _startPosX + 60, _startPosY + 10, 10, 10); + g.DrawRectangle(pen, _startPosX + 20, _startPosY + 10, 20, 10); + g.DrawRectangle(pen, _startPosX - 4, _startPosY + 4, 4, 10); + g.DrawRectangle(pen, _startPosX - 4, _startPosY + 16 , 4, 10); + g.DrawRectangle(pen, _startPosX + 40, _startPosY + 4, 10, 20); + g.DrawRectangle(pen, _startPosX , _startPosY, 70, 30); + PointF point_triangle_1 = new PointF(_startPosX + 70, _startPosY); + PointF point_triangle_2 = new PointF(_startPosX + 90, _startPosY + 15); + PointF point_triangle_3 = new PointF(_startPosX + 70, _startPosY + 30); + PointF[] assembled_triangle = + { + point_triangle_1, + point_triangle_2, + point_triangle_3, + point_triangle_1 + }; + g.DrawPolygon(pen, assembled_triangle); + + //задние балки + Brush brBlack = new SolidBrush(Color.Black); + g.FillRectangle(brBlack, _startPosX -4, _startPosY + 4, 4, 10); + g.FillRectangle(brBlack, _startPosX - 4, _startPosY + 16, 4, 10); + + //палуба корабля + Brush br = new SolidBrush(Battleship?.BodyColor ?? Color.Black); + g.FillRectangle(br, _startPosX, _startPosY, 70, 30); + g.FillPolygon(br, assembled_triangle); + + //отсек корабля + Brush brGray = new SolidBrush(Color.Gray); + g.FillEllipse(brGray, _startPosX + 60, _startPosY + 10, 10, 10); + g.FillRectangle(brGray, _startPosX + 20, _startPosY + 10, 20, 10); + g.FillRectangle(brGray, _startPosX + 40, _startPosY + 4, 10, 20); + + //выделяем рамкой палубу + g.DrawEllipse(pen, _startPosX + 60, _startPosY + 10, 10, 10); + g.DrawRectangle(pen, _startPosX + 20, _startPosY + 10, 20, 10); + g.DrawRectangle(pen, _startPosX + 40, _startPosY + 4, 10, 20); + + } + /// + /// Смена границ формы отрисовки + /// + /// Ширина картинки + /// Высота картинки + public void ChangeBorders(int width, int height) + { + _pictureWidth = width; + _pictureHeight = height; + if (_pictureWidth <= _battleshipWidth || _pictureHeight <= _battleshipHeight) + { + _pictureWidth = null; + _pictureHeight = null; + return; + } + if (_startPosX + _battleshipWidth > _pictureWidth) + { + _startPosX = _pictureWidth.Value - _battleshipWidth; + } + if (_startPosY + _battleshipHeight > _pictureHeight) + { + _startPosY = _pictureHeight.Value - _battleshipHeight; + } + } + } +} diff --git a/Battleship/Battleship/EntityBattleship.cs b/Battleship/Battleship/EntityBattleship.cs new file mode 100644 index 0000000..ddcb788 --- /dev/null +++ b/Battleship/Battleship/EntityBattleship.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Battleship +{ + /// + /// Класс-сущность "Боевой корабль" + /// + internal class EntityBattleship + { + /// + /// Скорость + /// + 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; + } + } +} diff --git a/Battleship/Battleship/Form1.Designer.cs b/Battleship/Battleship/Form1.Designer.cs deleted file mode 100644 index 2ac1a17..0000000 --- a/Battleship/Battleship/Form1.Designer.cs +++ /dev/null @@ -1,39 +0,0 @@ -namespace Battleship -{ - partial class Form1 - { - /// - /// 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.components = new System.ComponentModel.Container(); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); - this.Text = "Form1"; - } - - #endregion - } -} \ No newline at end of file diff --git a/Battleship/Battleship/Form1.cs b/Battleship/Battleship/Form1.cs deleted file mode 100644 index 9338bc7..0000000 --- a/Battleship/Battleship/Form1.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Battleship -{ - public partial class Form1 : Form - { - public Form1() - { - InitializeComponent(); - } - } -} \ No newline at end of file diff --git a/Battleship/Battleship/FormBattleship.Designer.cs b/Battleship/Battleship/FormBattleship.Designer.cs new file mode 100644 index 0000000..299bcfd --- /dev/null +++ b/Battleship/Battleship/FormBattleship.Designer.cs @@ -0,0 +1,177 @@ +namespace Battleship +{ + partial class FormBattleship + { + /// + /// 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.pictureBoxBattleship = new System.Windows.Forms.PictureBox(); + this.statusStripBattleship = new System.Windows.Forms.StatusStrip(); + this.toolStripStatusLabelSpeed = new System.Windows.Forms.ToolStripStatusLabel(); + this.toolStripStatusLabelWeight = new System.Windows.Forms.ToolStripStatusLabel(); + this.toolStripStatusLabeBodylColor = new System.Windows.Forms.ToolStripStatusLabel(); + this.buttonCreate = new System.Windows.Forms.Button(); + this.buttonDown = new System.Windows.Forms.Button(); + this.buttonUp = new System.Windows.Forms.Button(); + this.buttonRight = new System.Windows.Forms.Button(); + this.buttonLeft = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxBattleship)).BeginInit(); + this.statusStripBattleship.SuspendLayout(); + this.SuspendLayout(); + // + // pictureBoxBattleship + // + this.pictureBoxBattleship.Dock = System.Windows.Forms.DockStyle.Fill; + this.pictureBoxBattleship.Location = new System.Drawing.Point(0, 0); + this.pictureBoxBattleship.Name = "pictureBoxBattleship"; + this.pictureBoxBattleship.Size = new System.Drawing.Size(800, 450); + this.pictureBoxBattleship.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; + this.pictureBoxBattleship.TabIndex = 0; + this.pictureBoxBattleship.TabStop = false; + this.pictureBoxBattleship.Resize += new System.EventHandler(this.PictureBoxBattleship_Resize); + // + // statusStripBattleship + // + this.statusStripBattleship.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripStatusLabelSpeed, + this.toolStripStatusLabelWeight, + this.toolStripStatusLabeBodylColor}); + this.statusStripBattleship.Location = new System.Drawing.Point(0, 428); + this.statusStripBattleship.Name = "statusStripBattleship"; + this.statusStripBattleship.Size = new System.Drawing.Size(800, 22); + this.statusStripBattleship.TabIndex = 1; + this.statusStripBattleship.Text = "statusStrip1"; + // + // toolStripStatusLabelSpeed + // + this.toolStripStatusLabelSpeed.Name = "toolStripStatusLabelSpeed"; + this.toolStripStatusLabelSpeed.Size = new System.Drawing.Size(65, 17); + this.toolStripStatusLabelSpeed.Text = "Скорость: "; + // + // toolStripStatusLabelWeight + // + this.toolStripStatusLabelWeight.Name = "toolStripStatusLabelWeight"; + this.toolStripStatusLabelWeight.Size = new System.Drawing.Size(32, 17); + this.toolStripStatusLabelWeight.Text = "Вес: "; + // + // toolStripStatusLabeBodylColor + // + this.toolStripStatusLabeBodylColor.Name = "toolStripStatusLabeBodylColor"; + this.toolStripStatusLabeBodylColor.Size = new System.Drawing.Size(36, 17); + this.toolStripStatusLabeBodylColor.Text = "Цвет:"; + // + // 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, 397); + 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); + // + // buttonDown + // + this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonDown.BackgroundImage = global::Battleship.Properties.Resources.BatteleshipDown; + this.buttonDown.Location = new System.Drawing.Point(731, 390); + this.buttonDown.Name = "buttonDown"; + this.buttonDown.Size = new System.Drawing.Size(30, 30); + this.buttonDown.TabIndex = 3; + this.buttonDown.UseVisualStyleBackColor = true; + this.buttonDown.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::Battleship.Properties.Resources.BattleshipUp; + this.buttonUp.Location = new System.Drawing.Point(732, 361); + 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); + // + // buttonRight + // + this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonRight.BackgroundImage = global::Battleship.Properties.Resources.BattleshipRight; + this.buttonRight.Location = new System.Drawing.Point(758, 390); + this.buttonRight.Name = "buttonRight"; + this.buttonRight.Size = new System.Drawing.Size(30, 30); + this.buttonRight.TabIndex = 5; + this.buttonRight.UseVisualStyleBackColor = true; + this.buttonRight.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::Battleship.Properties.Resources.BattleshipLeft; + this.buttonLeft.Location = new System.Drawing.Point(706, 390); + this.buttonLeft.Name = "buttonLeft"; + this.buttonLeft.Size = new System.Drawing.Size(30, 30); + this.buttonLeft.TabIndex = 6; + this.buttonLeft.UseVisualStyleBackColor = true; + this.buttonLeft.Click += new System.EventHandler(this.ButtonMove_Click); + // + // FormBattleship + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoSize = true; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.buttonLeft); + this.Controls.Add(this.buttonRight); + this.Controls.Add(this.buttonUp); + this.Controls.Add(this.buttonDown); + this.Controls.Add(this.buttonCreate); + this.Controls.Add(this.statusStripBattleship); + this.Controls.Add(this.pictureBoxBattleship); + this.Name = "FormBattleship"; + this.Text = "Военный корабль "; + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxBattleship)).EndInit(); + this.statusStripBattleship.ResumeLayout(false); + this.statusStripBattleship.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private PictureBox pictureBoxBattleship; + private StatusStrip statusStripBattleship; + private ToolStripStatusLabel toolStripStatusLabelSpeed; + private ToolStripStatusLabel toolStripStatusLabelWeight; + private ToolStripStatusLabel toolStripStatusLabeBodylColor; + private Button buttonCreate; + private Button buttonDown; + private Button buttonUp; + private Button buttonRight; + private Button buttonLeft; + } +} \ No newline at end of file diff --git a/Battleship/Battleship/FormBattleship.cs b/Battleship/Battleship/FormBattleship.cs new file mode 100644 index 0000000..00d8b54 --- /dev/null +++ b/Battleship/Battleship/FormBattleship.cs @@ -0,0 +1,76 @@ +namespace Battleship +{ + public partial class FormBattleship : Form + { + private DrawningBattleship _battleship; + + public FormBattleship() + { + InitializeComponent(); + } + + /// + /// + /// + private void Draw() + { + Bitmap bmp = new(pictureBoxBattleship.Width, pictureBoxBattleship.Height); + Graphics gr = Graphics.FromImage(bmp); + _battleship?.DrawTransport(gr); + pictureBoxBattleship.Image = bmp; + } + /// + /// "" + /// + /// + /// + + private void ButtonCreate_Click(object sender, EventArgs e) + { + Random rnd = new(); + _battleship = new DrawningBattleship(); + _battleship.Init(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256))); + _battleship.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), pictureBoxBattleship.Width, pictureBoxBattleship.Height); + toolStripStatusLabelSpeed.Text = $": {_battleship.Battleship.Speed}"; + toolStripStatusLabelWeight.Text = $": {_battleship.Battleship.Weight}"; + toolStripStatusLabeBodylColor.Text = $": {_battleship.Battleship.BodyColor.Name}"; + Draw(); + } + /// + /// + /// + /// + /// + private void ButtonMove_Click(object sender, EventArgs e) + { + // + string name = ((Button)sender)?.Name ?? string.Empty; + switch (name) + { + case "buttonUp": + _battleship?.MoveTransport(Direction.Up); + break; + case "buttonDown": + _battleship?.MoveTransport(Direction.Down); + break; + case "buttonLeft": + _battleship?.MoveTransport(Direction.Left); + break; + case "buttonRight": + _battleship?.MoveTransport(Direction.Right); + break; + } + Draw(); + } + /// + /// + /// + /// + /// + private void PictureBoxBattleship_Resize(object sender, EventArgs e) + { + _battleship?.ChangeBorders(pictureBoxBattleship.Width, pictureBoxBattleship.Height); + Draw(); + } + } +} \ No newline at end of file diff --git a/Battleship/Battleship/FormBattleship.resx b/Battleship/Battleship/FormBattleship.resx new file mode 100644 index 0000000..dd36fec --- /dev/null +++ b/Battleship/Battleship/FormBattleship.resx @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/Battleship/Battleship/Program.cs b/Battleship/Battleship/Program.cs index 48b33ea..4d0e539 100644 --- a/Battleship/Battleship/Program.cs +++ b/Battleship/Battleship/Program.cs @@ -11,7 +11,7 @@ namespace Battleship // To customize application configuration such as set high DPI settings or default font, // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); - Application.Run(new Form1()); + Application.Run(new FormBattleship()); } } } \ No newline at end of file diff --git a/Battleship/Battleship/Properties/Resources.Designer.cs b/Battleship/Battleship/Properties/Resources.Designer.cs new file mode 100644 index 0000000..1d42706 --- /dev/null +++ b/Battleship/Battleship/Properties/Resources.Designer.cs @@ -0,0 +1,103 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. +// +//------------------------------------------------------------------------------ + +namespace Battleship.Properties { + using System; + + + /// + /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д. + /// + // Этот класс создан автоматически классом 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() { + } + + /// + /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом. + /// + [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("Battleship.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Перезаписывает свойство CurrentUICulture текущего потока для всех + /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap BatteleshipDown { + get { + object obj = ResourceManager.GetObject("BatteleshipDown", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap BattleshipLeft { + get { + object obj = ResourceManager.GetObject("BattleshipLeft", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap BattleshipRight { + get { + object obj = ResourceManager.GetObject("BattleshipRight", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap BattleshipUp { + get { + object obj = ResourceManager.GetObject("BattleshipUp", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/Battleship/Battleship/Form1.resx b/Battleship/Battleship/Properties/Resources.resx similarity index 82% rename from Battleship/Battleship/Form1.resx rename to Battleship/Battleship/Properties/Resources.resx index 1af7de1..87749b4 100644 --- a/Battleship/Battleship/Form1.resx +++ b/Battleship/Battleship/Properties/Resources.resx @@ -117,4 +117,17 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\BatteleshipDown.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\BattleshipLeft.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\BattleshipRight.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\BattleshipUp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/Battleship/Battleship/Resources/BatteleshipDown.png b/Battleship/Battleship/Resources/BatteleshipDown.png new file mode 100644 index 0000000000000000000000000000000000000000..cfe2d6ccc9d83703e4fcbebbff0238e48862fa3c GIT binary patch literal 393 zcmV;40e1e0P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0Uk+2K~zXf?Uli5 z!axv)XS4`?l-_E@UXs>JpTT!16>5~eL$858PoW^CP>?>4n4JzX)^#1nLC8VKcga6w z`FHrUJ3%6XX6VSX0WQ zR-zpAN0Scn(NEE>hYzpL-gz04et)d22l-Ug5eE5Ol!j$ZNZiygS90WC`4wq7{G(Vu zj&4M4s4-A2dQ0G4MY089`81Xy;^=tl7c+#^Qsa8LcoVsgHTgVWa=EBP9dKf(X7|rP zS5h2c_%f&FHE}W}Vvur62&><(cK~Z_yM6_1l|}dM`=jdhL>pL#FJf<*$Cq(h?_#y{ njd2EY4&JWMptVkD%o^Yikjz!2Wm0l-00000NkvXXu0mjf{(Yrj literal 0 HcmV?d00001 diff --git a/Battleship/Battleship/Resources/BattleshipLeft.png b/Battleship/Battleship/Resources/BattleshipLeft.png new file mode 100644 index 0000000000000000000000000000000000000000..e13f4487b30482f2852bc9085020390c2715405d GIT binary patch literal 334 zcmeAS@N?(olHy`uVBq!ia0vp^av;pX1SGcvS$+jljKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1quc!N;C1jv*f2Z?6P$H8}`0Jj`2?y?4v&#zjiH z9Sgd@$dydYOMPpVYj9%6x^wFS0)80#FaG^g!K%66^rGK?FZuK03(HDAFp2vIhs@^M z&S+S&>f4lKxe?ALuEvoM%y!7_Vw<>Lv-kImKP6h;uk=zn#gjf=YTL!n>;GW+Z0}%` ztPeITU9HRAd4-nbUo?B}@Z&+{r01q#p|2UEq}Mji&6B$|O(#4={^Q;oe@q&dZIO*R ze#L$N;u1Cf9lUuR+c--X@gK;I;K`kRdeOqmHOy?^b8Kq&-gVuVs}{KMzwkV{yDrv$ dm3Tie?OWq=#b(33cR=qlc)I$ztaD0e0svvihW7vf literal 0 HcmV?d00001 diff --git a/Battleship/Battleship/Resources/BattleshipRight.png b/Battleship/Battleship/Resources/BattleshipRight.png new file mode 100644 index 0000000000000000000000000000000000000000..ff11d26faf0b7ccc0b511cbd6267a69e6242e0ca GIT binary patch literal 332 zcmeAS@N?(olHy`uVBq!ia0vp^av;pX1SGcvS$+jljKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1quc!H1qMjv*f2Zzub59WoGT-5Xe6l6;G~vukY= zN8FLU4_xA)b3TY8ie| z3=Ynpq<@xquXy9FpYa#I39njq$>R1RSrw19ue(-VEc%e8mAlD)p233&wu?Ig-+nOO bYUtnaz~#!U$dK1S&oX$r`njxgN@xNAYi)>S literal 0 HcmV?d00001 diff --git a/Battleship/Battleship/Resources/BattleshipUp.png b/Battleship/Battleship/Resources/BattleshipUp.png new file mode 100644 index 0000000000000000000000000000000000000000..79b43d104d5b085783e4a99df5c3b458c903a94c GIT binary patch literal 330 zcmeAS@N?(olHy`uVBq!ia0vp^av;pX1SGcvS$+jljKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1quc!TX*rjv*f2Z!i0DF)4~1_?TxRzt!`(L*PXp zN0!(nwHI7>U7eCPso(Mbk1I`$V*e_o<9~IFoxPHhD)p7UDx!PFWMIze7;NMfu{)G~VeiJfx!cHLiB4+x19&NyYLf)fEr8FJHf1 zdoJqtUV%$?b}auKkAG&B+nu;8YumTYv$h`EI?qctB0c}hfn@VZ>uw&*Ikv^K{`H2I zsnVW@XD%x}EOahUZdZ<3!4HuIrB2^gmK?PHQqFyOS4dUNlx3$(v@Wl(_**>F&DTx) aE8F$iE>}{v&O8nDDubu1pUXO@geCx?){V{p literal 0 HcmV?d00001