Compare commits
6 Commits
master
...
6d052f4d60
Author | SHA1 | Date | |
---|---|---|---|
6d052f4d60 | |||
f0dd67650a | |||
53c32e224f | |||
066f232018 | |||
0e40ea687b | |||
b699fe0553 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -398,3 +398,4 @@ FodyWeavers.xsd
|
||||
# JetBrains Rider
|
||||
*.sln.iml
|
||||
|
||||
/WarmlyShip/WarmlyShip/Properties
|
||||
|
@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.1.32414.318
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WarmlyShip", "WarmlyShip\WarmlyShip.csproj", "{007C3F82-87B9-4701-BE6F-6598A4B1AE7E}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WarmlyShip", "WarmlyShip\WarmlyShip.csproj", "{007C3F82-87B9-4701-BE6F-6598A4B1AE7E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
@ -34,8 +34,8 @@
|
||||
/// Инициализация свойств
|
||||
/// </summary>
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="weight">Вес коробля</param>
|
||||
/// <param name="bodyColor">Цвет основной части</param>
|
||||
/// <param name="weight">Вес корабля</param>
|
||||
/// <param name="bodyColor">Цвет корабля</param>
|
||||
public DrawningShip(int speed, float weight, Color bodyColor)
|
||||
{
|
||||
Ship = new EntityShip(speed, weight, bodyColor);
|
||||
@ -54,7 +54,7 @@
|
||||
{
|
||||
_shipWidth = shipWidth;
|
||||
_shipHeight = shipHeight;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Установка позиции коробля
|
||||
/// </summary>
|
||||
@ -62,6 +62,8 @@
|
||||
/// <param name="y">Координата Y</param>
|
||||
/// <param name="width">Ширина картинки</param>
|
||||
/// <param name="height">Высота картинки</param>
|
||||
///
|
||||
|
||||
public void SetPosition(int x, int y, int width, int height)
|
||||
{
|
||||
if (x < 0 || y < 0 || width < x + _shipWidth || height < y + _shipHeight)
|
||||
@ -87,14 +89,14 @@
|
||||
}
|
||||
switch (direction)
|
||||
{
|
||||
/// вправо
|
||||
// вправо
|
||||
case Direction.Right:
|
||||
if (_startPosX + _shipWidth + Ship.Step < _pictureWidth)
|
||||
{
|
||||
_startPosX += Ship.Step;
|
||||
}
|
||||
break;
|
||||
///влево
|
||||
//влево
|
||||
case Direction.Left:
|
||||
|
||||
if (_startPosX - Ship.Step > 0)
|
||||
@ -102,7 +104,7 @@
|
||||
_startPosX -= Ship.Step;
|
||||
}
|
||||
break;
|
||||
///вверх
|
||||
//вверх
|
||||
case Direction.Up:
|
||||
|
||||
if (_startPosY - Ship.Step > 0)
|
||||
@ -110,7 +112,7 @@
|
||||
_startPosY -= Ship.Step;
|
||||
}
|
||||
break;
|
||||
///вниз
|
||||
//вниз
|
||||
case Direction.Down:
|
||||
if (_startPosY + _shipHeight + Ship.Step < _pictureHeight)
|
||||
{
|
||||
@ -130,7 +132,7 @@
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
///заполнение коробля
|
||||
PointF[] P =
|
||||
@ -150,7 +152,7 @@
|
||||
|
||||
Pen pen = new(Color.Black);
|
||||
///границы коробля
|
||||
g.DrawRectangle(pen, _startPosX + 50, _startPosY + 1 , 100, 34);
|
||||
g.DrawRectangle(pen, _startPosX + 50, _startPosY + 1, 100, 34);
|
||||
g.DrawLine(pen, _startPosX, _startPosY + 35, _startPosX + 170, _startPosY + 35);
|
||||
g.DrawLine(pen, _startPosX, _startPosY + 35, _startPosX + 50, _startPosY + 65);
|
||||
g.DrawLine(pen, _startPosX + 50, _startPosY + 65, _startPosX + 150, _startPosY + 65);
|
||||
|
@ -12,8 +12,8 @@ namespace WarmlyShip
|
||||
/// Инициализация свойств
|
||||
/// </summary>
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="weight">Вес коробля</param>
|
||||
/// <param name="bodyColor">Цвет коробля</param>
|
||||
/// <param name="weight">Вес автомобиля</param>
|
||||
/// <param name="bodyColor">Цвет кузова</param>
|
||||
/// <param name="dopColor">Дополнительный цвет</param>
|
||||
/// <param name="pipes">Признак наличия труб</param>
|
||||
/// <param name="fuelCompartment">Признак наличия топливного отсека</param>
|
||||
@ -44,7 +44,7 @@ namespace WarmlyShip
|
||||
}
|
||||
|
||||
_startPosY += 30;
|
||||
base.DrawTransport(g);
|
||||
base.DrawTransport(g);
|
||||
_startPosY -= 30;
|
||||
|
||||
if (warmlyShip.FuelCompartment)
|
||||
|
@ -24,8 +24,8 @@ namespace WarmlyShip
|
||||
/// Инициализация свойств
|
||||
/// </summary>
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="weight">Вес коробля</param>
|
||||
/// <param name="bodyColor">Цвет коробля</param>
|
||||
/// <param name="weight">Вес автомобиля</param>
|
||||
/// <param name="bodyColor">Цвет кузова</param>
|
||||
/// <param name="dopColor">Дополнительный цвет</param>
|
||||
/// <param name="pipes">Признак наличия труб</param>
|
||||
/// <param name="fuelCompartment">Признак наличия топливного отсека</param>
|
||||
|
8
WarmlyShip/WarmlyShip/FormMap.Designer.cs
generated
8
WarmlyShip/WarmlyShip/FormMap.Designer.cs
generated
@ -3,12 +3,12 @@
|
||||
partial class FormMap
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// 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)
|
||||
@ -23,8 +23,8 @@
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
|
@ -1,13 +1,3 @@
|
||||
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
|
||||
@ -20,20 +10,20 @@ namespace WarmlyShip
|
||||
_abstractMap = new SimpleMap();
|
||||
}
|
||||
/// <summary>
|
||||
/// Заполнение информации по объекту
|
||||
/// Заполнение информации по объекту
|
||||
/// </summary>
|
||||
/// <param name="ship"></param>
|
||||
/// <param name="car"></param>
|
||||
private void SetData(DrawningShip ship)
|
||||
{
|
||||
toolStripStatusLabelSpeed.Text = $"Скорость: {ship.Ship.Speed}";
|
||||
toolStripStatusLabelWeight.Text = $"Вес: {ship.Ship.Weight}";
|
||||
toolStripStatusLabelBodyColor.Text = $"Цвет: {ship.Ship.BodyColor.Name}";
|
||||
toolStripStatusLabelSpeed.Text = $"Скорость: {ship.Ship.Speed}";
|
||||
toolStripStatusLabelWeight.Text = $"Вес: {ship.Ship.Weight}";
|
||||
toolStripStatusLabelBodyColor.Text = $"Цвет: {ship.Ship.BodyColor.Name}";
|
||||
pictureBoxShip.Image = _abstractMap.CreateMap(pictureBoxShip.Width, pictureBoxShip.Height,
|
||||
new DrawningObjectShip(ship));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Обработка нажатия кнопки "Создать"
|
||||
/// Обработка нажатия кнопки "Создать"
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
@ -46,7 +36,7 @@ namespace WarmlyShip
|
||||
|
||||
private void ButtonMove_Click(object sender, EventArgs e)
|
||||
{
|
||||
//получаем имя кнопки
|
||||
//получаем имя кнопки
|
||||
string name = ((Button)sender)?.Name ?? string.Empty;
|
||||
Direction dir = Direction.None;
|
||||
switch (name)
|
||||
@ -68,7 +58,7 @@ namespace WarmlyShip
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Обработка нажатия кнопки "Модификация"
|
||||
/// Обработка нажатия кнопки "Модификация"
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
@ -82,22 +72,22 @@ namespace WarmlyShip
|
||||
SetData(ship);
|
||||
}
|
||||
/// <summary>
|
||||
/// Смена карты
|
||||
/// Смена карты
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ComboBoxSelectorMap_SelectedIndexChanged(object sender, EventArgs e)
|
||||
private void ComboBoxSelectorMap_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
switch (ComboBoxSelectorMap.Text)
|
||||
{
|
||||
case "Простая карта":
|
||||
_abstractMap = new SimpleMap();
|
||||
break;
|
||||
case "Простая карта":
|
||||
_abstractMap = new SimpleMap();
|
||||
break;
|
||||
|
||||
case "Океан":
|
||||
case "Океан":
|
||||
_abstractMap = new OceanMap();
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,64 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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.
|
||||
-->
|
||||
<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">
|
||||
@ -117,4 +57,7 @@
|
||||
<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>
|
24
WarmlyShip/WarmlyShip/FormShip.Designer.cs
generated
24
WarmlyShip/WarmlyShip/FormShip.Designer.cs
generated
@ -38,7 +38,7 @@
|
||||
this.buttonUp = new System.Windows.Forms.Button();
|
||||
this.buttonRight = new System.Windows.Forms.Button();
|
||||
this.buttonLeft = new System.Windows.Forms.Button();
|
||||
this.buttonCreateModif = new System.Windows.Forms.Button();
|
||||
this.ButtonCreateModif = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxShip)).BeginInit();
|
||||
this.statusStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
@ -147,23 +147,23 @@
|
||||
this.buttonLeft.UseVisualStyleBackColor = true;
|
||||
this.buttonLeft.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||
//
|
||||
// buttonCreateModif
|
||||
// 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(112, 367);
|
||||
this.buttonCreateModif.Name = "buttonCreateModif";
|
||||
this.buttonCreateModif.Size = new System.Drawing.Size(125, 29);
|
||||
this.buttonCreateModif.TabIndex = 7;
|
||||
this.buttonCreateModif.Text = "Модификация";
|
||||
this.buttonCreateModif.UseVisualStyleBackColor = true;
|
||||
this.buttonCreateModif.Click += new System.EventHandler(this.ButtonCreateModif_Click);
|
||||
this.ButtonCreateModif.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.ButtonCreateModif.Location = new System.Drawing.Point(124, 369);
|
||||
this.ButtonCreateModif.Name = "ButtonCreateModif";
|
||||
this.ButtonCreateModif.Size = new System.Drawing.Size(120, 29);
|
||||
this.ButtonCreateModif.TabIndex = 7;
|
||||
this.ButtonCreateModif.Text = "Модификация";
|
||||
this.ButtonCreateModif.UseVisualStyleBackColor = true;
|
||||
this.ButtonCreateModif.Click += new System.EventHandler(this.ButtonCreateModif_Click);
|
||||
//
|
||||
// FormShip
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.buttonCreateModif);
|
||||
this.Controls.Add(this.ButtonCreateModif);
|
||||
this.Controls.Add(this.buttonLeft);
|
||||
this.Controls.Add(this.buttonRight);
|
||||
this.Controls.Add(this.buttonUp);
|
||||
@ -193,6 +193,6 @@
|
||||
private Button buttonUp;
|
||||
private Button buttonRight;
|
||||
private Button buttonLeft;
|
||||
private Button buttonCreateModif;
|
||||
private Button ButtonCreateModif;
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ namespace WarmlyShip
|
||||
/// <summary>
|
||||
/// Ìåòîä óñòàíîâêè äàííûõ
|
||||
/// </summary>
|
||||
private void SetData()
|
||||
private void SetData()
|
||||
{
|
||||
Random rnd = new();
|
||||
_ship.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), pictureBoxShip.Width, pictureBoxShip.Height);
|
||||
@ -60,6 +60,7 @@ namespace WarmlyShip
|
||||
}
|
||||
Draw();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Îáðàáîòêà íàæàòèÿ êíîïêè "Ìîäèôèêàöèÿ"
|
||||
/// </summary>
|
||||
|
@ -6,8 +6,8 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace WarmlyShip
|
||||
{
|
||||
internal interface IDrawningObject
|
||||
{
|
||||
internal interface IDrawningObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Шаг перемещения объекта
|
||||
/// </summary>
|
||||
|
@ -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 FormShip());
|
||||
Application.Run(new FormMap());
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
{
|
||||
"profiles": {
|
||||
"WarmlyShip": {
|
||||
"commandName": "Project"
|
||||
}
|
||||
}
|
||||
}
|
@ -9,6 +9,9 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="FormMap.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
|
Loading…
Reference in New Issue
Block a user