Compare commits
21 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
ff4377225e | ||
|
8ad67381f7 | ||
|
4bd133b3b6 | ||
|
55ad12fe67 | ||
|
d7da54c10d | ||
|
4c29fdde60 | ||
|
d480439f7b | ||
|
18cfa60a37 | ||
|
850db9bf71 | ||
|
2c4b38c0c3 | ||
|
7fba21da0d | ||
|
f0bfd7e353 | ||
|
568f6fe9ed | ||
|
b15bf7d2c0 | ||
|
2645b2aa47 | ||
|
a7591f9928 | ||
|
29068866e1 | ||
|
bad8d47c56 | ||
|
bd494d4f70 | ||
|
2f8114f6f8 | ||
|
b314ff775d |
400
.gitignore
vendored
Normal file
400
.gitignore
vendored
Normal file
@ -0,0 +1,400 @@
|
||||
# ---> VisualStudio
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Mono auto generated files
|
||||
mono_crash.*
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
[Ww][Ii][Nn]32/
|
||||
[Aa][Rr][Mm]/
|
||||
[Aa][Rr][Mm]64/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
[Ll]ogs/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUnit
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
nunit-*.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# Benchmark Results
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# .NET Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
# ASP.NET Scaffolding
|
||||
ScaffoldingReadMe.txt
|
||||
|
||||
# StyleCop
|
||||
StyleCopReport.xml
|
||||
|
||||
# Files built by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_h.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.iobj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*_wpftmp.csproj
|
||||
*.log
|
||||
*.tlog
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Coverlet is a free, cross platform Code Coverage Tool
|
||||
coverage*.json
|
||||
coverage*.xml
|
||||
coverage*.info
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# NuGet Symbol Packages
|
||||
*.snupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/[Pp]ackages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/[Pp]ackages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/[Pp]ackages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignorable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
*.appx
|
||||
*.appxbundle
|
||||
*.appxupload
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!?*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
*- [Bb]ackup.rdl
|
||||
*- [Bb]ackup ([0-9]).rdl
|
||||
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
|
||||
*.vbp
|
||||
|
||||
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
|
||||
*.dsw
|
||||
*.dsp
|
||||
|
||||
# Visual Studio 6 technical files
|
||||
*.ncb
|
||||
*.aps
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# CodeRush personal settings
|
||||
.cr/personal
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# Tabs Studio
|
||||
*.tss
|
||||
|
||||
# Telerik's JustMock configuration file
|
||||
*.jmconfig
|
||||
|
||||
# BizTalk build output
|
||||
*.btp.cs
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
*.binlog
|
||||
|
||||
# NVidia Nsight GPU debugger configuration file
|
||||
*.nvuser
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
|
||||
# Local History for Visual Studio
|
||||
.localhistory/
|
||||
|
||||
# Visual Studio History (VSHistory) files
|
||||
.vshistory/
|
||||
|
||||
# BeatPulse healthcheck temp database
|
||||
healthchecksdb
|
||||
|
||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||
MigrationBackup/
|
||||
|
||||
# Ionide (cross platform F# VS Code tools) working folder
|
||||
.ionide/
|
||||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
||||
|
||||
# VS Code files for those working on multiple tools
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
*.code-workspace
|
||||
|
||||
# Local History for Visual Studio Code
|
||||
.history/
|
||||
|
||||
# Windows Installer files from build outputs
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# JetBrains Rider
|
||||
*.sln.iml
|
||||
|
15
ProjectBoat_base/ProjectBoat_bae/BoatDelegate.cs
Normal file
15
ProjectBoat_base/ProjectBoat_bae/BoatDelegate.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using ProjectBoat_bae.DrawningObjects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectBoat_bae
|
||||
{
|
||||
internal class BoatDelegate
|
||||
{
|
||||
// Делегат для передачи объекта-автомобиля
|
||||
public delegate void boatDelegate(Drawningboat boat);
|
||||
}
|
||||
}
|
20
ProjectBoat_base/ProjectBoat_bae/Direction.cs
Normal file
20
ProjectBoat_base/ProjectBoat_bae/Direction.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectBoat_bae
|
||||
{
|
||||
public enum DiretionType
|
||||
{
|
||||
Up = 1,
|
||||
|
||||
Down = 2,
|
||||
|
||||
Left = 3,
|
||||
|
||||
Right = 4
|
||||
|
||||
}
|
||||
}
|
171
ProjectBoat_base/ProjectBoat_bae/DrawningObjects/DrawningBoat.cs
Normal file
171
ProjectBoat_base/ProjectBoat_bae/DrawningObjects/DrawningBoat.cs
Normal file
@ -0,0 +1,171 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using ProjectBoat_bae.Entities;
|
||||
using ProjectBoat_bae.MovementStrategy;
|
||||
|
||||
namespace ProjectBoat_bae.DrawningObjects
|
||||
{
|
||||
public class Drawningboat
|
||||
{
|
||||
// Получение объекта IMoveableObject из объекта DrawningCar
|
||||
public IMoveableObject GetMoveableObject => new
|
||||
DrawningObjectBoat(this);
|
||||
|
||||
// Класс-сущность
|
||||
public EntityBoat? EntityBoat { get; protected set; }
|
||||
|
||||
// Ширина окна
|
||||
public int _pictureWidth;
|
||||
|
||||
// Высота окна
|
||||
public int _pictureHeight;
|
||||
|
||||
// Левая координата прорисовки
|
||||
protected int _startPosX;
|
||||
|
||||
// Верхняя кооридната прорисовки
|
||||
protected int _startPosY;
|
||||
|
||||
// Ширина прорисовки
|
||||
protected readonly int _boatWidth = 80;
|
||||
|
||||
// Высота прорисовки
|
||||
protected readonly int _boatHeight = 50;
|
||||
|
||||
public int GetPosX => _startPosX;
|
||||
public int GetPosY => _startPosY;
|
||||
public int GetWidth => _boatWidth;
|
||||
public int GetHeight => _boatHeight;
|
||||
|
||||
// Конструктор
|
||||
public Drawningboat(int speed, double weight, Color bodyColor, int
|
||||
width, int height)
|
||||
{
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
if (width < _pictureWidth || height < _pictureHeight)
|
||||
{
|
||||
return;
|
||||
}
|
||||
EntityBoat = new EntityBoat(speed, weight, bodyColor);
|
||||
}
|
||||
|
||||
protected Drawningboat(int speed, double weight, Color bodyColor, int
|
||||
width, int height, int boatWidth, int boatHeight)
|
||||
{
|
||||
if (width < _boatWidth || height < _boatHeight)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
_boatWidth = boatWidth;
|
||||
_boatHeight = boatHeight;
|
||||
EntityBoat = new EntityBoat(speed, weight, bodyColor);
|
||||
}
|
||||
|
||||
// Установка позиции
|
||||
public void SetPosition(int x, int y)
|
||||
{
|
||||
_startPosX = Math.Min(x, _pictureWidth - _boatWidth);
|
||||
_startPosY = Math.Min(y, _pictureHeight - _boatHeight);
|
||||
}
|
||||
|
||||
// Прорисовка объекта
|
||||
public virtual void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityBoat == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Pen pen = new(Color.Black);
|
||||
//корпус
|
||||
Brush br = new SolidBrush(EntityBoat.BodyColor);
|
||||
g.FillRectangle(br, _startPosX + 20, _startPosY + 65, 80, 50);
|
||||
|
||||
//мотор
|
||||
Brush brRed = new SolidBrush(EntityBoat.BodyColor);
|
||||
g.FillEllipse(brRed, _startPosX + 7, _startPosY + 72, 35, 35);
|
||||
|
||||
//стекла
|
||||
Brush brBlue = new SolidBrush(Color.LightBlue);
|
||||
g.FillRectangle(brBlue, _startPosX + 95, _startPosY + 67, 5, 45);
|
||||
g.FillRectangle(brBlue, _startPosX + 45, _startPosY + 67, 55, 2);
|
||||
g.FillRectangle(brBlue, _startPosX + 45, _startPosY + 111, 55, 2);
|
||||
}
|
||||
|
||||
// Проверка, что объект может переместится по указанному направлению
|
||||
public bool CanMove(DiretionType direction)
|
||||
{
|
||||
if (EntityBoat == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return direction switch
|
||||
{
|
||||
//влево
|
||||
DiretionType.Left => _startPosX - EntityBoat.Step > 0,
|
||||
//вверх
|
||||
DiretionType.Up => _startPosY - EntityBoat.Step > 0,
|
||||
// вправо
|
||||
DiretionType.Right => _startPosX + EntityBoat.Step < _pictureWidth,
|
||||
//вниз
|
||||
DiretionType.Down => _startPosY + EntityBoat.Step < _pictureHeight,
|
||||
_ => false
|
||||
};
|
||||
}
|
||||
|
||||
// Изменение направления перемещения
|
||||
public void MoveTransport(DiretionType direction)
|
||||
{
|
||||
if (!CanMove(direction) || EntityBoat == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (direction)
|
||||
{
|
||||
//влево
|
||||
case DiretionType.Left:
|
||||
if (_startPosX - EntityBoat.Step > 0)
|
||||
{
|
||||
_startPosX -= (int)EntityBoat.Step;
|
||||
}
|
||||
break;
|
||||
//вверх
|
||||
case DiretionType.Up:
|
||||
if (_startPosY - EntityBoat.Step > 0)
|
||||
{
|
||||
_startPosY -= (int)EntityBoat.Step;
|
||||
}
|
||||
break;
|
||||
// вправо
|
||||
case DiretionType.Right:
|
||||
if (_startPosX + EntityBoat.Step + _boatWidth < _pictureWidth)
|
||||
{
|
||||
_startPosX += (int)EntityBoat.Step;
|
||||
}
|
||||
break;
|
||||
//вниз
|
||||
case DiretionType.Down:
|
||||
if (_startPosY + EntityBoat.Step + _boatHeight < _pictureHeight)
|
||||
{
|
||||
_startPosY += (int)EntityBoat.Step;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangePictureSize(int width, int height)
|
||||
{
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
using ProjectBoat_bae.Entities;
|
||||
namespace ProjectBoat_bae.DrawningObjects
|
||||
{
|
||||
public class DrawningMotorBoat : Drawningboat
|
||||
{
|
||||
|
||||
public DrawningMotorBoat(int speed, double weight, Color bodyColor, Color
|
||||
additionalColor, bool body, bool wing,
|
||||
int width, int height) : base(speed, weight, bodyColor, width, height, 110, 60)
|
||||
|
||||
{
|
||||
if (EntityBoat != null)
|
||||
{
|
||||
EntityBoat = new EntityMotorBoat(speed, weight, bodyColor,
|
||||
additionalColor, body, wing);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public override void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityBoat is not EntityMotorBoat Boat)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Pen pen = new(Color.Black);
|
||||
Brush additionalBrush = new SolidBrush(Boat.AdditionalColor);
|
||||
Brush brr = new SolidBrush(EntityBoat.BodyColor);
|
||||
|
||||
if (Boat.Wing)
|
||||
{
|
||||
//вёсла
|
||||
g.FillRectangle(additionalBrush, _startPosX + 35, _startPosY + 40, 5, 100);
|
||||
g.FillRectangle(additionalBrush, _startPosX + 28, _startPosY + 40, 12, 8);
|
||||
g.FillRectangle(additionalBrush, _startPosX + 28, _startPosY + 135, 12, 8);
|
||||
}
|
||||
|
||||
base.DrawTransport(g);
|
||||
|
||||
//кресла
|
||||
if (Boat.Body)
|
||||
{
|
||||
g.FillRectangle(additionalBrush, _startPosX + 58, _startPosY + 70, 25, 40);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
28
ProjectBoat_base/ProjectBoat_bae/Entities/EntityBoat.cs
Normal file
28
ProjectBoat_base/ProjectBoat_bae/Entities/EntityBoat.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectBoat_bae.Entities
|
||||
{
|
||||
public class EntityBoat
|
||||
{
|
||||
public void SetBodyColor(Color color)
|
||||
{
|
||||
BodyColor = color;
|
||||
}
|
||||
|
||||
public int Speed { get; private set; }
|
||||
public double Weight { get; private set; }
|
||||
public Color BodyColor { get; private set; }
|
||||
public double Step => (double)Speed * 100 / Weight;
|
||||
|
||||
public EntityBoat(int speed, double weight, Color bodyColor)
|
||||
{
|
||||
Speed = speed;
|
||||
Weight = weight;
|
||||
BodyColor = bodyColor;
|
||||
}
|
||||
}
|
||||
}
|
27
ProjectBoat_base/ProjectBoat_bae/Entities/EntityMotorBoat.cs
Normal file
27
ProjectBoat_base/ProjectBoat_bae/Entities/EntityMotorBoat.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectBoat_bae.Entities
|
||||
{
|
||||
public class EntityMotorBoat : EntityBoat
|
||||
{
|
||||
public void setAdditionalColor(Color color)
|
||||
{
|
||||
AdditionalColor = color;
|
||||
}
|
||||
|
||||
public Color AdditionalColor { get; private set; }
|
||||
public bool Body { get; private set; }
|
||||
public bool Wing { get; private set; }
|
||||
public EntityMotorBoat(int speed, double weight, Color bodyColor, Color
|
||||
additionalColor, bool body, bool wing) : base(speed, weight, bodyColor)
|
||||
{
|
||||
AdditionalColor = additionalColor;
|
||||
Body = body;
|
||||
Wing = wing;
|
||||
}
|
||||
}
|
||||
}
|
194
ProjectBoat_base/ProjectBoat_bae/Form1.Designer.cs
generated
Normal file
194
ProjectBoat_base/ProjectBoat_bae/Form1.Designer.cs
generated
Normal file
@ -0,0 +1,194 @@
|
||||
namespace ProjectBoat_bae
|
||||
{
|
||||
partial class FormBoat
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 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)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormBoat));
|
||||
pictureBoxBoat = new PictureBox();
|
||||
button_bottom = new Button();
|
||||
button_top = new Button();
|
||||
button_right = new Button();
|
||||
button_left = new Button();
|
||||
buttonClick = new Button();
|
||||
buttonClickMotorBoat = new Button();
|
||||
buttonStep = new Button();
|
||||
comboBoxStrategy = new ComboBox();
|
||||
buttonSelectBoat_Click = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxBoat).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// pictureBoxBoat
|
||||
//
|
||||
pictureBoxBoat.Dock = DockStyle.Fill;
|
||||
pictureBoxBoat.Location = new Point(0, 0);
|
||||
pictureBoxBoat.Name = "pictureBoxBoat";
|
||||
pictureBoxBoat.Size = new Size(1178, 644);
|
||||
pictureBoxBoat.SizeMode = PictureBoxSizeMode.AutoSize;
|
||||
pictureBoxBoat.TabIndex = 0;
|
||||
pictureBoxBoat.TabStop = false;
|
||||
//
|
||||
// button_bottom
|
||||
//
|
||||
button_bottom.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
button_bottom.BackColor = SystemColors.ButtonHighlight;
|
||||
button_bottom.BackgroundImage = (Image)resources.GetObject("button_bottom.BackgroundImage");
|
||||
button_bottom.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
button_bottom.Location = new Point(1082, 591);
|
||||
button_bottom.Name = "button_bottom";
|
||||
button_bottom.Size = new Size(30, 30);
|
||||
button_bottom.TabIndex = 2;
|
||||
button_bottom.UseVisualStyleBackColor = false;
|
||||
button_bottom.Click += buttonMove_Click;
|
||||
//
|
||||
// button_top
|
||||
//
|
||||
button_top.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
button_top.BackColor = SystemColors.ButtonHighlight;
|
||||
button_top.BackgroundImage = (Image)resources.GetObject("button_top.BackgroundImage");
|
||||
button_top.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
button_top.Location = new Point(1082, 549);
|
||||
button_top.Name = "button_top";
|
||||
button_top.Size = new Size(30, 30);
|
||||
button_top.TabIndex = 3;
|
||||
button_top.UseVisualStyleBackColor = false;
|
||||
button_top.Click += buttonMove_Click;
|
||||
//
|
||||
// button_right
|
||||
//
|
||||
button_right.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
button_right.BackColor = SystemColors.ButtonHighlight;
|
||||
button_right.BackgroundImage = (Image)resources.GetObject("button_right.BackgroundImage");
|
||||
button_right.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
button_right.Location = new Point(1114, 573);
|
||||
button_right.Name = "button_right";
|
||||
button_right.Size = new Size(30, 30);
|
||||
button_right.TabIndex = 4;
|
||||
button_right.UseVisualStyleBackColor = false;
|
||||
button_right.Click += buttonMove_Click;
|
||||
//
|
||||
// button_left
|
||||
//
|
||||
button_left.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
button_left.BackColor = SystemColors.ButtonHighlight;
|
||||
button_left.BackgroundImage = (Image)resources.GetObject("button_left.BackgroundImage");
|
||||
button_left.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
button_left.Location = new Point(1051, 572);
|
||||
button_left.Name = "button_left";
|
||||
button_left.Size = new Size(30, 30);
|
||||
button_left.TabIndex = 5;
|
||||
button_left.UseVisualStyleBackColor = false;
|
||||
button_left.Click += buttonMove_Click;
|
||||
//
|
||||
// buttonClick
|
||||
//
|
||||
buttonClick.Location = new Point(12, 598);
|
||||
buttonClick.Name = "buttonClick";
|
||||
buttonClick.Size = new Size(233, 34);
|
||||
buttonClick.TabIndex = 6;
|
||||
buttonClick.Text = "Создать лодку";
|
||||
buttonClick.UseVisualStyleBackColor = true;
|
||||
buttonClick.Click += buttonClick_Click;
|
||||
//
|
||||
// buttonClickMotorBoat
|
||||
//
|
||||
buttonClickMotorBoat.Location = new Point(261, 598);
|
||||
buttonClickMotorBoat.Name = "buttonClickMotorBoat";
|
||||
buttonClickMotorBoat.Size = new Size(233, 34);
|
||||
buttonClickMotorBoat.TabIndex = 7;
|
||||
buttonClickMotorBoat.Text = "Создать моторную лодку";
|
||||
buttonClickMotorBoat.UseVisualStyleBackColor = true;
|
||||
buttonClickMotorBoat.Click += buttonClickMotorBoat_Click;
|
||||
//
|
||||
// buttonStep
|
||||
//
|
||||
buttonStep.Location = new Point(1093, 45);
|
||||
buttonStep.Name = "buttonStep";
|
||||
buttonStep.Size = new Size(73, 36);
|
||||
buttonStep.TabIndex = 8;
|
||||
buttonStep.Text = "шаг";
|
||||
buttonStep.UseVisualStyleBackColor = true;
|
||||
buttonStep.Click += buttonStep_Click;
|
||||
//
|
||||
// comboBoxStrategy
|
||||
//
|
||||
comboBoxStrategy.BackColor = SystemColors.ControlLight;
|
||||
comboBoxStrategy.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxStrategy.FormattingEnabled = true;
|
||||
comboBoxStrategy.Items.AddRange(new object[] { "MoveToCenter", "MoveToBorder" });
|
||||
comboBoxStrategy.Location = new Point(984, 6);
|
||||
comboBoxStrategy.Name = "comboBoxStrategy";
|
||||
comboBoxStrategy.Size = new Size(182, 33);
|
||||
comboBoxStrategy.TabIndex = 9;
|
||||
//
|
||||
// buttonSelectBoat_Click
|
||||
//
|
||||
buttonSelectBoat_Click.Location = new Point(517, 598);
|
||||
buttonSelectBoat_Click.Name = "buttonSelectBoat_Click";
|
||||
buttonSelectBoat_Click.Size = new Size(233, 34);
|
||||
buttonSelectBoat_Click.TabIndex = 10;
|
||||
buttonSelectBoat_Click.Text = "Выбранная лодка";
|
||||
buttonSelectBoat_Click.UseVisualStyleBackColor = true;
|
||||
buttonSelectBoat_Click.Click += buttonSelectBoat_Click_Click;
|
||||
//
|
||||
// FormBoat
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1178, 644);
|
||||
Controls.Add(buttonSelectBoat_Click);
|
||||
Controls.Add(comboBoxStrategy);
|
||||
Controls.Add(buttonStep);
|
||||
Controls.Add(buttonClickMotorBoat);
|
||||
Controls.Add(buttonClick);
|
||||
Controls.Add(button_left);
|
||||
Controls.Add(button_right);
|
||||
Controls.Add(button_top);
|
||||
Controls.Add(button_bottom);
|
||||
Controls.Add(pictureBoxBoat);
|
||||
Name = "FormBoat";
|
||||
Text = "FormBoat";
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxBoat).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private PictureBox pictureBoxBoat;
|
||||
private Button button_bottom;
|
||||
private Button button_top;
|
||||
private Button button_right;
|
||||
private Button button_left;
|
||||
private Button buttonClick;
|
||||
private Button buttonClickMotorBoat;
|
||||
private Button buttonStep;
|
||||
private ComboBox comboBoxStrategy;
|
||||
private Button button1;
|
||||
private Button buttonSelectBoat_Click;
|
||||
}
|
||||
}
|
152
ProjectBoat_base/ProjectBoat_bae/Form1.cs
Normal file
152
ProjectBoat_base/ProjectBoat_bae/Form1.cs
Normal file
@ -0,0 +1,152 @@
|
||||
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;
|
||||
|
||||
using ProjectBoat_bae.Entities;
|
||||
using ProjectBoat_bae.MovementStrategy;
|
||||
using ProjectBoat_bae.DrawningObjects;
|
||||
|
||||
namespace ProjectBoat_bae
|
||||
{
|
||||
public partial class FormBoat : Form
|
||||
{
|
||||
// Ïîëå-îáúåêò äëÿ ïðîðèñîâêè îáúåêòà
|
||||
|
||||
private Drawningboat? _drawingBoat;
|
||||
private AbstractStrategy? _abstractStrategy;
|
||||
/// Âûáðàííûé àâòîìîáèëü
|
||||
public Drawningboat? SelectedBoat { get; private set; }
|
||||
|
||||
public FormBoat()
|
||||
{
|
||||
InitializeComponent();
|
||||
_abstractStrategy = null;
|
||||
SelectedBoat = null;
|
||||
}
|
||||
|
||||
// Ìåòîä ïðîðèñîâêè
|
||||
private void Draw()
|
||||
{
|
||||
if (_drawingBoat == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Bitmap bmp = new(pictureBoxBoat.Width,
|
||||
pictureBoxBoat.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_drawingBoat.DrawTransport(gr);
|
||||
pictureBoxBoat.Image = bmp;
|
||||
}
|
||||
|
||||
// Èçìåíåíèå ðàçìåðîâ ôîðìû
|
||||
private void buttonMove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawingBoat == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
string name = ((Button)sender)?.Name ?? string.Empty;
|
||||
switch (name)
|
||||
{
|
||||
case "button_top":
|
||||
_drawingBoat.MoveTransport(DiretionType.Up);
|
||||
break;
|
||||
case "button_bottom":
|
||||
_drawingBoat.MoveTransport(DiretionType.Down);
|
||||
break;
|
||||
case "button_left":
|
||||
_drawingBoat.MoveTransport(DiretionType.Left);
|
||||
break;
|
||||
case "button_right":
|
||||
_drawingBoat.MoveTransport(DiretionType.Right);
|
||||
break;
|
||||
}
|
||||
Draw();
|
||||
}
|
||||
private void buttonClickMotorBoat_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new();
|
||||
Color color = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
||||
ColorDialog dialog = new();
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
color = dialog.Color;
|
||||
}
|
||||
|
||||
Color dopColor = Color.FromArgb(random.Next(0, 256),
|
||||
random.Next(0, 256), random.Next(0, 256));
|
||||
ColorDialog dialogAddColor = new();
|
||||
if (dialogAddColor.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
dopColor = dialogAddColor.Color;
|
||||
}
|
||||
|
||||
_drawingBoat = new DrawningMotorBoat(random.Next(100, 300),
|
||||
random.Next(1000, 3000), color, dopColor, Convert.ToBoolean(random.Next(0, 2)),
|
||||
Convert.ToBoolean(random.Next(0, 2)),
|
||||
pictureBoxBoat.Width, pictureBoxBoat.Height);
|
||||
_drawingBoat.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
Draw();
|
||||
}
|
||||
private void buttonClick_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new();
|
||||
Color color = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
||||
ColorDialog dialog = new();
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
color = dialog.Color;
|
||||
}
|
||||
_drawingBoat = new Drawningboat(random.Next(100, 300), random.Next(1000, 3000), color, pictureBoxBoat.Width, pictureBoxBoat.Height);
|
||||
_drawingBoat.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
Draw();
|
||||
}
|
||||
|
||||
private void buttonStep_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawingBoat == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (comboBoxStrategy.Enabled)
|
||||
{
|
||||
_abstractStrategy = comboBoxStrategy.SelectedIndex
|
||||
switch
|
||||
{
|
||||
0 => new MoveToCenter(),
|
||||
1 => new MoveToBorder(),
|
||||
_ => null,
|
||||
};
|
||||
if (_abstractStrategy == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_abstractStrategy.SetData(new DrawningObjectBoat(_drawingBoat), pictureBoxBoat.Width, pictureBoxBoat.Height);
|
||||
comboBoxStrategy.Enabled = false;
|
||||
}
|
||||
if (_abstractStrategy == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_abstractStrategy.MakeStep();
|
||||
Draw();
|
||||
if (_abstractStrategy.GetStatus() == Status.Finish)
|
||||
{
|
||||
comboBoxStrategy.Enabled = true;
|
||||
_abstractStrategy = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonSelectBoat_Click_Click(object sender, EventArgs e)
|
||||
{
|
||||
SelectedBoat = _drawingBoat;
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
}
|
||||
}
|
2583
ProjectBoat_base/ProjectBoat_bae/Form1.resx
Normal file
2583
ProjectBoat_base/ProjectBoat_bae/Form1.resx
Normal file
File diff suppressed because it is too large
Load Diff
163
ProjectBoat_base/ProjectBoat_bae/FormBoatCollection.Designer.cs
generated
Normal file
163
ProjectBoat_base/ProjectBoat_bae/FormBoatCollection.Designer.cs
generated
Normal file
@ -0,0 +1,163 @@
|
||||
namespace ProjectBoat_bae
|
||||
{
|
||||
partial class FormBoatCollection
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 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)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
pictureBoxCollection = new PictureBox();
|
||||
listBoxStorages = new ListBox();
|
||||
ButtonAddObject = new Button();
|
||||
textBoxStorageName = new TextBox();
|
||||
ButtonDelObject = new Button();
|
||||
ButtonAddBoat = new Button();
|
||||
ButtonRemoveBoat = new Button();
|
||||
ButtonRefreshCollection = new Button();
|
||||
textBoxBoat = new TextBox();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxCollection).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// pictureBoxCollection
|
||||
//
|
||||
pictureBoxCollection.Location = new Point(0, 0);
|
||||
pictureBoxCollection.Name = "pictureBoxCollection";
|
||||
pictureBoxCollection.Size = new Size(929, 647);
|
||||
pictureBoxCollection.TabIndex = 0;
|
||||
pictureBoxCollection.TabStop = false;
|
||||
//
|
||||
// listBoxStorages
|
||||
//
|
||||
listBoxStorages.FormattingEnabled = true;
|
||||
listBoxStorages.ItemHeight = 25;
|
||||
listBoxStorages.Location = new Point(935, 146);
|
||||
listBoxStorages.Name = "listBoxStorages";
|
||||
listBoxStorages.Size = new Size(231, 129);
|
||||
listBoxStorages.TabIndex = 1;
|
||||
listBoxStorages.SelectedIndexChanged += listBoxStorages_SelectedIndexChanged;
|
||||
//
|
||||
// ButtonAddObject
|
||||
//
|
||||
ButtonAddObject.BackColor = SystemColors.ButtonHighlight;
|
||||
ButtonAddObject.Location = new Point(935, 102);
|
||||
ButtonAddObject.Name = "ButtonAddObject";
|
||||
ButtonAddObject.Size = new Size(231, 38);
|
||||
ButtonAddObject.TabIndex = 2;
|
||||
ButtonAddObject.Text = "Добавить в набор";
|
||||
ButtonAddObject.UseVisualStyleBackColor = false;
|
||||
ButtonAddObject.Click += ButtonAddObject_Click_1;
|
||||
//
|
||||
// textBoxStorageName
|
||||
//
|
||||
textBoxStorageName.Location = new Point(935, 65);
|
||||
textBoxStorageName.Name = "textBoxStorageName";
|
||||
textBoxStorageName.Size = new Size(231, 31);
|
||||
textBoxStorageName.TabIndex = 3;
|
||||
//
|
||||
// ButtonDelObject
|
||||
//
|
||||
ButtonDelObject.BackColor = SystemColors.ButtonHighlight;
|
||||
ButtonDelObject.Location = new Point(935, 281);
|
||||
ButtonDelObject.Name = "ButtonDelObject";
|
||||
ButtonDelObject.Size = new Size(231, 34);
|
||||
ButtonDelObject.TabIndex = 4;
|
||||
ButtonDelObject.Text = "Удалить набор";
|
||||
ButtonDelObject.UseVisualStyleBackColor = false;
|
||||
ButtonDelObject.Click += ButtonDelObject_Click;
|
||||
//
|
||||
// ButtonAddBoat
|
||||
//
|
||||
ButtonAddBoat.BackColor = SystemColors.ButtonHighlight;
|
||||
ButtonAddBoat.Location = new Point(935, 401);
|
||||
ButtonAddBoat.Name = "ButtonAddBoat";
|
||||
ButtonAddBoat.Size = new Size(231, 34);
|
||||
ButtonAddBoat.TabIndex = 5;
|
||||
ButtonAddBoat.Text = "Добавить лодку";
|
||||
ButtonAddBoat.UseVisualStyleBackColor = false;
|
||||
ButtonAddBoat.Click += ButtonAddBoat_Click;
|
||||
//
|
||||
// ButtonRemoveBoat
|
||||
//
|
||||
ButtonRemoveBoat.BackColor = SystemColors.ButtonHighlight;
|
||||
ButtonRemoveBoat.Location = new Point(935, 479);
|
||||
ButtonRemoveBoat.Name = "ButtonRemoveBoat";
|
||||
ButtonRemoveBoat.Size = new Size(231, 34);
|
||||
ButtonRemoveBoat.TabIndex = 6;
|
||||
ButtonRemoveBoat.Text = "Удалить лодку";
|
||||
ButtonRemoveBoat.UseVisualStyleBackColor = false;
|
||||
ButtonRemoveBoat.Click += ButtonRemoveBoat_Click;
|
||||
//
|
||||
// ButtonRefreshCollection
|
||||
//
|
||||
ButtonRefreshCollection.BackColor = SystemColors.ButtonHighlight;
|
||||
ButtonRefreshCollection.Location = new Point(935, 575);
|
||||
ButtonRefreshCollection.Name = "ButtonRefreshCollection";
|
||||
ButtonRefreshCollection.Size = new Size(231, 34);
|
||||
ButtonRefreshCollection.TabIndex = 7;
|
||||
ButtonRefreshCollection.Text = "Обновить коллекцию";
|
||||
ButtonRefreshCollection.UseVisualStyleBackColor = false;
|
||||
ButtonRefreshCollection.Click += ButtonRefreshCollection_Click;
|
||||
//
|
||||
// textBoxBoat
|
||||
//
|
||||
textBoxBoat.Location = new Point(958, 441);
|
||||
textBoxBoat.Name = "textBoxBoat";
|
||||
textBoxBoat.Size = new Size(173, 31);
|
||||
textBoxBoat.TabIndex = 8;
|
||||
//
|
||||
// FormBoatCollection
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1178, 644);
|
||||
Controls.Add(textBoxBoat);
|
||||
Controls.Add(ButtonRefreshCollection);
|
||||
Controls.Add(ButtonRemoveBoat);
|
||||
Controls.Add(ButtonAddBoat);
|
||||
Controls.Add(ButtonDelObject);
|
||||
Controls.Add(textBoxStorageName);
|
||||
Controls.Add(ButtonAddObject);
|
||||
Controls.Add(listBoxStorages);
|
||||
Controls.Add(pictureBoxCollection);
|
||||
Name = "FormBoatCollection";
|
||||
Text = "FormBoatCollection";
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxCollection).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private PictureBox pictureBoxCollection;
|
||||
private ListBox listBoxStorages;
|
||||
private Button ButtonAddObject;
|
||||
private TextBox textBoxStorageName;
|
||||
private Button ButtonDelObject;
|
||||
private Button ButtonAddBoat;
|
||||
private Button ButtonRemoveBoat;
|
||||
private Button ButtonRefreshCollection;
|
||||
private TextBox textBoxBoat;
|
||||
}
|
||||
}
|
165
ProjectBoat_base/ProjectBoat_bae/FormBoatCollection.cs
Normal file
165
ProjectBoat_base/ProjectBoat_bae/FormBoatCollection.cs
Normal file
@ -0,0 +1,165 @@
|
||||
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;
|
||||
|
||||
using ProjectBoat_bae.DrawningObjects;
|
||||
using ProjectBoat_bae.Generics;
|
||||
using ProjectBoat_bae.MovementStrategy;
|
||||
|
||||
namespace ProjectBoat_bae
|
||||
{
|
||||
public partial class FormBoatCollection : Form
|
||||
{
|
||||
// Набор объектов
|
||||
private readonly BoatsGenericStorage _storage;
|
||||
|
||||
public FormBoatCollection()
|
||||
{
|
||||
InitializeComponent();
|
||||
_storage = new BoatsGenericStorage(pictureBoxCollection.Width, pictureBoxCollection.Height);
|
||||
}
|
||||
|
||||
// Заполнение listBoxObjects
|
||||
private void ReloadObjects()
|
||||
{
|
||||
int index = listBoxStorages.SelectedIndex;
|
||||
listBoxStorages.Items.Clear();
|
||||
for (int i = 0; i < _storage.Keys.Count; i++)
|
||||
{
|
||||
listBoxStorages.Items.Add(_storage.Keys[i]);
|
||||
}
|
||||
if (listBoxStorages.Items.Count > 0 && (index == -1 || index
|
||||
>= listBoxStorages.Items.Count))
|
||||
{
|
||||
listBoxStorages.SelectedIndex = 0;
|
||||
}
|
||||
else if (listBoxStorages.Items.Count > 0 && index > -1 &&
|
||||
index < listBoxStorages.Items.Count)
|
||||
{
|
||||
listBoxStorages.SelectedIndex = index;
|
||||
}
|
||||
}
|
||||
|
||||
// Добавление набора в коллекцию
|
||||
private void ButtonAddObject_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(textBoxStorageName.Text))
|
||||
{
|
||||
MessageBox.Show("Не все данные заполнены", "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_storage.AddSet(textBoxStorageName.Text);
|
||||
ReloadObjects();
|
||||
}
|
||||
|
||||
// Удаление набора
|
||||
private void ButtonDelObject_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listBoxStorages.SelectedIndex == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show($"Удалить объект {listBoxStorages.SelectedItem}?", "Удаление", MessageBoxButtons.YesNo,
|
||||
MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
_storage.DelSet(listBoxStorages.SelectedItem.ToString()
|
||||
?? string.Empty);
|
||||
ReloadObjects();
|
||||
}
|
||||
}
|
||||
|
||||
// Добавление объекта в набор
|
||||
private void ButtonAddBoat_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listBoxStorages.SelectedIndex == -1) return;
|
||||
var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
|
||||
if (obj == null) return;
|
||||
|
||||
FormBoatConfig form = new FormBoatConfig();
|
||||
|
||||
form.AddEvent(AddBoat);
|
||||
form.Show();
|
||||
}
|
||||
|
||||
private void AddBoat(Drawningboat boat)
|
||||
{
|
||||
boat._pictureWidth = pictureBoxCollection.Width;
|
||||
boat._pictureHeight = pictureBoxCollection.Height;
|
||||
if (listBoxStorages.SelectedIndex == -1) return;
|
||||
var obj = _storage[listBoxStorages.SelectedItem.ToString() ?? string.Empty];
|
||||
if (obj == null) return;
|
||||
|
||||
if (obj + boat)
|
||||
{
|
||||
MessageBox.Show("Объект добавлен");
|
||||
pictureBoxCollection.Image = obj.ShowBoats();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось добавить объект");
|
||||
}
|
||||
}
|
||||
|
||||
//удаление объекта
|
||||
private void ButtonRemoveBoat_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listBoxStorages.SelectedIndex == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var obj = _storage[listBoxStorages.SelectedItem.ToString() ??
|
||||
string.Empty];
|
||||
if (obj == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show("Удалить объект?", "Удаление",
|
||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int pos = 0;
|
||||
if (textBoxBoat != null)
|
||||
pos = Convert.ToInt32(textBoxBoat.Text);
|
||||
if (obj - pos != null)
|
||||
{
|
||||
MessageBox.Show("Объект удален");
|
||||
pictureBoxCollection.Image = obj.ShowBoats();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось удалить объект");
|
||||
}
|
||||
}
|
||||
|
||||
// Обновление
|
||||
private void ButtonRefreshCollection_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listBoxStorages.SelectedIndex == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var obj = _storage[listBoxStorages.SelectedItem.ToString() ??
|
||||
string.Empty];
|
||||
if (obj == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
pictureBoxCollection.Image = obj.ShowBoats();
|
||||
}
|
||||
|
||||
//Выбор набора
|
||||
private void listBoxStorages_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
pictureBoxCollection.Image =
|
||||
_storage[listBoxStorages.SelectedItem?.ToString() ?? string.Empty]?.ShowBoats();
|
||||
}
|
||||
}
|
||||
}
|
120
ProjectBoat_base/ProjectBoat_bae/FormBoatCollection.resx
Normal file
120
ProjectBoat_base/ProjectBoat_bae/FormBoatCollection.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?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.
|
||||
-->
|
||||
<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">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
374
ProjectBoat_base/ProjectBoat_bae/FormBoatConfig.Designer.cs
generated
Normal file
374
ProjectBoat_base/ProjectBoat_bae/FormBoatConfig.Designer.cs
generated
Normal file
@ -0,0 +1,374 @@
|
||||
namespace ProjectBoat_bae
|
||||
{
|
||||
partial class FormBoatConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 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)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
pictureBoxObject = new PictureBox();
|
||||
groupBoxBoat = new GroupBox();
|
||||
checkBoxBoat2 = new CheckBox();
|
||||
labelModifiedObject = new Label();
|
||||
labelSimpleObject = new Label();
|
||||
groupBoxColors = new GroupBox();
|
||||
panelPurple = new Panel();
|
||||
panelGray = new Panel();
|
||||
panelWhite = new Panel();
|
||||
panelBlack = new Panel();
|
||||
panelYellow = new Panel();
|
||||
panelBlue = new Panel();
|
||||
panelGreen = new Panel();
|
||||
panelRed = new Panel();
|
||||
numericUpDownSpeed = new NumericUpDown();
|
||||
numericUpDownWeight = new NumericUpDown();
|
||||
Speed = new Label();
|
||||
checkBoxBoat = new CheckBox();
|
||||
Weight = new Label();
|
||||
pictureBox1 = new PictureBox();
|
||||
PanelObject = new Panel();
|
||||
LabelAdditionalColor = new Label();
|
||||
LabelColor = new Label();
|
||||
buttonOk = new Button();
|
||||
buttonCancel = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxObject).BeginInit();
|
||||
groupBoxBoat.SuspendLayout();
|
||||
groupBoxColors.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
|
||||
PanelObject.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// pictureBoxObject
|
||||
//
|
||||
pictureBoxObject.Location = new Point(38, 76);
|
||||
pictureBoxObject.Name = "pictureBoxObject";
|
||||
pictureBoxObject.Size = new Size(388, 282);
|
||||
pictureBoxObject.TabIndex = 0;
|
||||
pictureBoxObject.TabStop = false;
|
||||
//
|
||||
// groupBoxBoat
|
||||
//
|
||||
groupBoxBoat.Controls.Add(checkBoxBoat2);
|
||||
groupBoxBoat.Controls.Add(labelModifiedObject);
|
||||
groupBoxBoat.Controls.Add(labelSimpleObject);
|
||||
groupBoxBoat.Controls.Add(groupBoxColors);
|
||||
groupBoxBoat.Controls.Add(numericUpDownSpeed);
|
||||
groupBoxBoat.Controls.Add(numericUpDownWeight);
|
||||
groupBoxBoat.Controls.Add(Speed);
|
||||
groupBoxBoat.Controls.Add(checkBoxBoat);
|
||||
groupBoxBoat.Controls.Add(Weight);
|
||||
groupBoxBoat.Controls.Add(pictureBox1);
|
||||
groupBoxBoat.Location = new Point(12, 12);
|
||||
groupBoxBoat.Name = "groupBoxBoat";
|
||||
groupBoxBoat.Size = new Size(668, 449);
|
||||
groupBoxBoat.TabIndex = 1;
|
||||
groupBoxBoat.TabStop = false;
|
||||
groupBoxBoat.Text = "Параметры";
|
||||
//
|
||||
// checkBoxBoat2
|
||||
//
|
||||
checkBoxBoat2.AutoSize = true;
|
||||
checkBoxBoat2.Location = new Point(21, 227);
|
||||
checkBoxBoat2.Name = "checkBoxBoat2";
|
||||
checkBoxBoat2.Size = new Size(230, 29);
|
||||
checkBoxBoat2.TabIndex = 12;
|
||||
checkBoxBoat2.Text = "Признак наличия вёсел";
|
||||
checkBoxBoat2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// labelModifiedObject
|
||||
//
|
||||
labelModifiedObject.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelModifiedObject.Location = new Point(464, 227);
|
||||
labelModifiedObject.Name = "labelModifiedObject";
|
||||
labelModifiedObject.Size = new Size(138, 38);
|
||||
labelModifiedObject.TabIndex = 11;
|
||||
labelModifiedObject.Text = "Продвинутый";
|
||||
labelModifiedObject.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelModifiedObject.MouseDown += LabelObject_MouseDown;
|
||||
//
|
||||
// labelSimpleObject
|
||||
//
|
||||
labelSimpleObject.BorderStyle = BorderStyle.FixedSingle;
|
||||
labelSimpleObject.Location = new Point(334, 227);
|
||||
labelSimpleObject.Name = "labelSimpleObject";
|
||||
labelSimpleObject.Size = new Size(124, 38);
|
||||
labelSimpleObject.TabIndex = 10;
|
||||
labelSimpleObject.Text = "Простой";
|
||||
labelSimpleObject.TextAlign = ContentAlignment.MiddleCenter;
|
||||
labelSimpleObject.MouseDown += LabelObject_MouseDown;
|
||||
//
|
||||
// groupBoxColors
|
||||
//
|
||||
groupBoxColors.Controls.Add(panelPurple);
|
||||
groupBoxColors.Controls.Add(panelGray);
|
||||
groupBoxColors.Controls.Add(panelWhite);
|
||||
groupBoxColors.Controls.Add(panelBlack);
|
||||
groupBoxColors.Controls.Add(panelYellow);
|
||||
groupBoxColors.Controls.Add(panelBlue);
|
||||
groupBoxColors.Controls.Add(panelGreen);
|
||||
groupBoxColors.Controls.Add(panelRed);
|
||||
groupBoxColors.Location = new Point(334, 30);
|
||||
groupBoxColors.Name = "groupBoxColors";
|
||||
groupBoxColors.Size = new Size(268, 175);
|
||||
groupBoxColors.TabIndex = 9;
|
||||
groupBoxColors.TabStop = false;
|
||||
groupBoxColors.Text = "Цвета";
|
||||
//
|
||||
// panelPurple
|
||||
//
|
||||
panelPurple.BackColor = Color.FromArgb(192, 0, 192);
|
||||
panelPurple.Location = new Point(205, 109);
|
||||
panelPurple.Name = "panelPurple";
|
||||
panelPurple.Size = new Size(45, 45);
|
||||
panelPurple.TabIndex = 11;
|
||||
//
|
||||
// panelGray
|
||||
//
|
||||
panelGray.BackColor = Color.Gray;
|
||||
panelGray.Location = new Point(144, 109);
|
||||
panelGray.Name = "panelGray";
|
||||
panelGray.Size = new Size(45, 45);
|
||||
panelGray.TabIndex = 11;
|
||||
//
|
||||
// panelWhite
|
||||
//
|
||||
panelWhite.BackColor = Color.White;
|
||||
panelWhite.Location = new Point(79, 109);
|
||||
panelWhite.Name = "panelWhite";
|
||||
panelWhite.Size = new Size(45, 45);
|
||||
panelWhite.TabIndex = 11;
|
||||
//
|
||||
// panelBlack
|
||||
//
|
||||
panelBlack.BackColor = Color.Black;
|
||||
panelBlack.Location = new Point(17, 109);
|
||||
panelBlack.Name = "panelBlack";
|
||||
panelBlack.Size = new Size(45, 45);
|
||||
panelBlack.TabIndex = 11;
|
||||
//
|
||||
// panelYellow
|
||||
//
|
||||
panelYellow.BackColor = Color.Yellow;
|
||||
panelYellow.Location = new Point(205, 45);
|
||||
panelYellow.Name = "panelYellow";
|
||||
panelYellow.Size = new Size(45, 45);
|
||||
panelYellow.TabIndex = 11;
|
||||
//
|
||||
// panelBlue
|
||||
//
|
||||
panelBlue.BackColor = Color.Navy;
|
||||
panelBlue.Location = new Point(144, 45);
|
||||
panelBlue.Name = "panelBlue";
|
||||
panelBlue.Size = new Size(45, 45);
|
||||
panelBlue.TabIndex = 11;
|
||||
//
|
||||
// panelGreen
|
||||
//
|
||||
panelGreen.BackColor = Color.FromArgb(0, 64, 0);
|
||||
panelGreen.Location = new Point(79, 45);
|
||||
panelGreen.Name = "panelGreen";
|
||||
panelGreen.Size = new Size(45, 45);
|
||||
panelGreen.TabIndex = 11;
|
||||
//
|
||||
// panelRed
|
||||
//
|
||||
panelRed.AllowDrop = true;
|
||||
panelRed.BackColor = Color.FromArgb(192, 0, 0);
|
||||
panelRed.Location = new Point(17, 45);
|
||||
panelRed.Name = "panelRed";
|
||||
panelRed.Size = new Size(45, 45);
|
||||
panelRed.TabIndex = 10;
|
||||
//
|
||||
// numericUpDownSpeed
|
||||
//
|
||||
numericUpDownSpeed.Location = new Point(148, 61);
|
||||
numericUpDownSpeed.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
|
||||
numericUpDownSpeed.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
numericUpDownSpeed.Name = "numericUpDownSpeed";
|
||||
numericUpDownSpeed.Size = new Size(90, 31);
|
||||
numericUpDownSpeed.TabIndex = 4;
|
||||
numericUpDownSpeed.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
//
|
||||
// numericUpDownWeight
|
||||
//
|
||||
numericUpDownWeight.Location = new Point(148, 104);
|
||||
numericUpDownWeight.Maximum = new decimal(new int[] { 1000, 0, 0, 0 });
|
||||
numericUpDownWeight.Minimum = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
numericUpDownWeight.Name = "numericUpDownWeight";
|
||||
numericUpDownWeight.Size = new Size(90, 31);
|
||||
numericUpDownWeight.TabIndex = 5;
|
||||
numericUpDownWeight.Value = new decimal(new int[] { 100, 0, 0, 0 });
|
||||
//
|
||||
// Speed
|
||||
//
|
||||
Speed.AutoSize = true;
|
||||
Speed.Location = new Point(21, 61);
|
||||
Speed.Name = "Speed";
|
||||
Speed.Size = new Size(89, 25);
|
||||
Speed.TabIndex = 2;
|
||||
Speed.Text = "Скорость";
|
||||
//
|
||||
// checkBoxBoat
|
||||
//
|
||||
checkBoxBoat.AutoSize = true;
|
||||
checkBoxBoat.Location = new Point(21, 176);
|
||||
checkBoxBoat.Name = "checkBoxBoat";
|
||||
checkBoxBoat.Size = new Size(240, 29);
|
||||
checkBoxBoat.TabIndex = 6;
|
||||
checkBoxBoat.Text = "Признак наличия кресел";
|
||||
checkBoxBoat.UseVisualStyleBackColor = true;
|
||||
//checkBoxBoat.CheckedChanged += checkBoxBoat_CheckedChanged;
|
||||
//
|
||||
// Weight
|
||||
//
|
||||
Weight.AutoSize = true;
|
||||
Weight.Location = new Point(21, 104);
|
||||
Weight.Name = "Weight";
|
||||
Weight.Size = new Size(39, 25);
|
||||
Weight.TabIndex = 3;
|
||||
Weight.Text = "Вес";
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
pictureBox1.Location = new Point(0, 0);
|
||||
pictureBox1.Name = "pictureBox1";
|
||||
pictureBox1.Size = new Size(668, 449);
|
||||
pictureBox1.TabIndex = 2;
|
||||
pictureBox1.TabStop = false;
|
||||
//
|
||||
// PanelObject
|
||||
//
|
||||
PanelObject.AllowDrop = true;
|
||||
PanelObject.BorderStyle = BorderStyle.FixedSingle;
|
||||
PanelObject.Controls.Add(LabelAdditionalColor);
|
||||
PanelObject.Controls.Add(LabelColor);
|
||||
PanelObject.Controls.Add(pictureBoxObject);
|
||||
PanelObject.Location = new Point(696, 23);
|
||||
PanelObject.Name = "PanelObject";
|
||||
PanelObject.Size = new Size(460, 378);
|
||||
PanelObject.TabIndex = 2;
|
||||
PanelObject.DragDrop += PanelObject_DragDrop;
|
||||
PanelObject.DragEnter += PanelObject_DragEnter;
|
||||
PanelObject.MouseDown += PanelColor_MouseDown;
|
||||
//
|
||||
// LabelAdditionalColor
|
||||
//
|
||||
LabelAdditionalColor.AllowDrop = true;
|
||||
LabelAdditionalColor.AutoSize = true;
|
||||
LabelAdditionalColor.BorderStyle = BorderStyle.FixedSingle;
|
||||
LabelAdditionalColor.Location = new Point(333, 38);
|
||||
LabelAdditionalColor.Name = "LabelAdditionalColor";
|
||||
LabelAdditionalColor.Size = new Size(93, 27);
|
||||
LabelAdditionalColor.TabIndex = 1;
|
||||
LabelAdditionalColor.Text = "Доп. цвет";
|
||||
LabelAdditionalColor.DragDrop += LabelAdditionalColor_DragDrop;
|
||||
LabelAdditionalColor.DragEnter += LabelAdditionalColor_DragEnter;
|
||||
//
|
||||
// LabelColor
|
||||
//
|
||||
LabelColor.AllowDrop = true;
|
||||
LabelColor.AutoSize = true;
|
||||
LabelColor.BorderStyle = BorderStyle.FixedSingle;
|
||||
LabelColor.Location = new Point(38, 38);
|
||||
LabelColor.Name = "LabelColor";
|
||||
LabelColor.Size = new Size(53, 27);
|
||||
LabelColor.TabIndex = 0;
|
||||
LabelColor.Text = "Цвет";
|
||||
LabelColor.DragDrop += LabelColor_DragDrop;
|
||||
LabelColor.DragEnter += LabelColor_DragEnter;
|
||||
//
|
||||
// buttonOk
|
||||
//
|
||||
buttonOk.Location = new Point(696, 418);
|
||||
buttonOk.Name = "buttonOk";
|
||||
buttonOk.Size = new Size(216, 43);
|
||||
buttonOk.TabIndex = 0;
|
||||
buttonOk.Text = "Добавить";
|
||||
buttonOk.UseVisualStyleBackColor = true;
|
||||
buttonOk.Click += buttonOk_Click_1;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(940, 418);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(216, 43);
|
||||
buttonCancel.TabIndex = 3;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// FormBoatConfig
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1178, 498);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonOk);
|
||||
Controls.Add(PanelObject);
|
||||
Controls.Add(groupBoxBoat);
|
||||
Name = "FormBoatConfig";
|
||||
Text = "FormBoatConfig";
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxObject).EndInit();
|
||||
groupBoxBoat.ResumeLayout(false);
|
||||
groupBoxBoat.PerformLayout();
|
||||
groupBoxColors.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownSpeed).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownWeight).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
|
||||
PanelObject.ResumeLayout(false);
|
||||
PanelObject.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private PictureBox pictureBoxObject;
|
||||
private GroupBox groupBoxBoat;
|
||||
private Label Speed;
|
||||
private Label Weight;
|
||||
private NumericUpDown numericUpDownSpeed;
|
||||
private NumericUpDown numericUpDownWeight;
|
||||
private GroupBox groupBoxColors;
|
||||
private CheckBox checkBoxBoat;
|
||||
private Label labelSimpleObject;
|
||||
private Panel panelPurple;
|
||||
private Panel panelGray;
|
||||
private Panel panelWhite;
|
||||
private Panel panelBlack;
|
||||
private Panel panelYellow;
|
||||
private Panel panelBlue;
|
||||
private Panel panelGreen;
|
||||
private Panel panelRed;
|
||||
private Label labelModifiedObject;
|
||||
private Panel PanelObject;
|
||||
private Button buttonOk;
|
||||
private Button buttonCancel;
|
||||
private Label LabelAdditionalColor;
|
||||
private Label LabelColor;
|
||||
private PictureBox pictureBox1;
|
||||
private CheckBox checkBoxBoat2;
|
||||
}
|
||||
}
|
165
ProjectBoat_base/ProjectBoat_bae/FormBoatConfig.cs
Normal file
165
ProjectBoat_base/ProjectBoat_bae/FormBoatConfig.cs
Normal file
@ -0,0 +1,165 @@
|
||||
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;
|
||||
|
||||
using ProjectBoat_bae.DrawningObjects;
|
||||
using ProjectBoat_bae.Entities;
|
||||
namespace ProjectBoat_bae
|
||||
{
|
||||
public partial class FormBoatConfig : Form
|
||||
{
|
||||
|
||||
// Переменная-выбранная лодка
|
||||
public Drawningboat? _boat = null;
|
||||
|
||||
// Событие
|
||||
private event Action<Drawningboat>? EventAddBoat;
|
||||
|
||||
// Добавление события
|
||||
public void AddEvent(Action<Drawningboat> ev)
|
||||
{
|
||||
if (EventAddBoat == null)
|
||||
{
|
||||
EventAddBoat = ev;
|
||||
}
|
||||
else
|
||||
{
|
||||
EventAddBoat += ev;
|
||||
}
|
||||
}
|
||||
|
||||
// Конструктор
|
||||
public FormBoatConfig()
|
||||
{
|
||||
InitializeComponent();
|
||||
panelBlack.MouseDown += PanelColor_MouseDown;
|
||||
panelPurple.MouseDown += PanelColor_MouseDown;
|
||||
panelGray.MouseDown += PanelColor_MouseDown;
|
||||
panelGreen.MouseDown += PanelColor_MouseDown;
|
||||
panelRed.MouseDown += PanelColor_MouseDown;
|
||||
panelWhite.MouseDown += PanelColor_MouseDown;
|
||||
panelYellow.MouseDown += PanelColor_MouseDown;
|
||||
panelBlue.MouseDown += PanelColor_MouseDown;
|
||||
labelSimpleObject.MouseDown += LabelObject_MouseDown;
|
||||
labelModifiedObject.MouseDown += LabelObject_MouseDown;
|
||||
buttonCancel.Click += (s, e) => Close();
|
||||
}
|
||||
|
||||
// Метод прорисовки
|
||||
private void DrawBoat()
|
||||
{
|
||||
Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_boat?.SetPosition(5, 5);
|
||||
_boat?.DrawTransport(gr);
|
||||
pictureBoxObject.Image = bmp;
|
||||
}
|
||||
|
||||
// Передаем информацию при нажатии на Label
|
||||
private void LabelObject_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
(sender as Label)?.DoDragDrop((sender as Label)?.Name, DragDropEffects.Move | DragDropEffects.Copy);
|
||||
}
|
||||
|
||||
// Проверка получаемой информации (ее типа на соответствие требуемому)
|
||||
private void PanelObject_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data?.GetDataPresent(DataFormats.Text) ?? false)
|
||||
{
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Effect = DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
|
||||
// Действия при приеме перетаскиваемой информации
|
||||
private void PanelObject_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
switch (e.Data?.GetData(DataFormats.Text).ToString())
|
||||
{
|
||||
case "labelSimpleObject":
|
||||
_boat = new Drawningboat((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, Color.White, pictureBoxObject.Width, pictureBoxObject.Height);
|
||||
break;
|
||||
case "labelModifiedObject":
|
||||
_boat = new DrawningMotorBoat((int)numericUpDownSpeed.Value, (int)numericUpDownWeight.Value, Color.White, Color.Black,
|
||||
checkBoxBoat.Checked, checkBoxBoat2.Checked, pictureBoxObject.Width, pictureBoxObject.Height);
|
||||
break;
|
||||
}
|
||||
LabelColor.BackColor = Color.Empty;
|
||||
LabelAdditionalColor.BackColor = Color.Empty;
|
||||
DrawBoat();
|
||||
}
|
||||
|
||||
// Отправляем цвет с панели
|
||||
private void PanelColor_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
(sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor,
|
||||
DragDropEffects.Move | DragDropEffects.Copy);
|
||||
}
|
||||
//действия при приеме перетаскиваемой информации
|
||||
private void LabelColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (_boat == null)
|
||||
return;
|
||||
switch (((Label)sender).Name)
|
||||
{
|
||||
case "LabelColor":
|
||||
_boat?.EntityBoat?.SetBodyColor((Color)e.Data.GetData(typeof(Color)));
|
||||
break;
|
||||
case "LabelAdditionalColor":
|
||||
if (!(_boat is ProjectBoat_bae))
|
||||
return;
|
||||
(_boat.EntityBoat as EntityMotorBoat)?.setAdditionalColor(color:
|
||||
(Color)e.Data.GetData(typeof(Color)));
|
||||
break;
|
||||
}
|
||||
DrawBoat();
|
||||
}
|
||||
//проверка информации
|
||||
private void LabelColor_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data?.GetDataPresent(typeof(Color)) ?? false)
|
||||
{
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Effect = DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
|
||||
private void LabelAdditionalColor_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(typeof(Color)) && _boat != null && _boat is Drawningboat)
|
||||
{
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Effect = DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
private void LabelAdditionalColor_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
var color = (Color)e.Data.GetData(typeof(Color));
|
||||
//Приведение для замены доп. цвета
|
||||
EntityMotorBoat? _motorboat = _boat.EntityBoat as EntityMotorBoat;
|
||||
_motorboat.setAdditionalColor(color);
|
||||
DrawBoat();
|
||||
}
|
||||
|
||||
private void buttonOk_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
EventAddBoat?.Invoke(_boat);
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
120
ProjectBoat_base/ProjectBoat_bae/FormBoatConfig.resx
Normal file
120
ProjectBoat_base/ProjectBoat_bae/FormBoatConfig.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?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.
|
||||
-->
|
||||
<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">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -0,0 +1,112 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ProjectBoat_bae.MovementStrategy;
|
||||
using ProjectBoat_bae.DrawningObjects;
|
||||
|
||||
namespace ProjectBoat_bae.Generics
|
||||
{
|
||||
internal class BoatsGenericCollection <T, U>
|
||||
where T : Drawningboat
|
||||
where U : IMoveableObject
|
||||
{
|
||||
// Ширина окна прорисовки
|
||||
private readonly int _pictureWidth;
|
||||
|
||||
// Высота окна прорисовки
|
||||
private readonly int _pictureHeight;
|
||||
/// <summary>
|
||||
/// Размер занимаемого объектом места (ширина)
|
||||
/// </summary>
|
||||
private readonly int _placeSizeWidth = 150;
|
||||
|
||||
// Размер занимаемого объектом места (высота)
|
||||
private readonly int _placeSizeHeight = 150;
|
||||
|
||||
// Набор объектов
|
||||
private readonly SetGeneric<T> _collection;
|
||||
|
||||
// Конструктор
|
||||
public BoatsGenericCollection(int picWidth, int picHeight)
|
||||
{
|
||||
int width = picWidth / _placeSizeWidth;
|
||||
int height = picHeight / _placeSizeHeight;
|
||||
_pictureWidth = picWidth;
|
||||
_pictureHeight = picHeight;
|
||||
_collection = new SetGeneric<T>(width * height);
|
||||
}
|
||||
|
||||
// Перегрузка оператора сложения
|
||||
public static bool operator +(BoatsGenericCollection<T, U> collect, T obj)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (bool)collect._collection.Insert(obj);
|
||||
}
|
||||
|
||||
// Перегрузка оператора вычитания
|
||||
public static T? operator -(BoatsGenericCollection<T, U> collect, int
|
||||
pos)
|
||||
{
|
||||
T? obj = collect._collection[pos];
|
||||
if (obj != null)
|
||||
{
|
||||
collect._collection.Remove(pos);
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
// Получение объекта IMoveableObject
|
||||
public U? GetU(int pos)
|
||||
{
|
||||
return (U?)_collection[pos]?.GetMoveableObject;
|
||||
}
|
||||
|
||||
// Вывод всего набора объектов
|
||||
public Bitmap ShowBoats()
|
||||
{
|
||||
Bitmap bmp = new(_pictureWidth, _pictureHeight);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
DrawBackground(gr);
|
||||
DrawObjects(gr);
|
||||
return bmp;
|
||||
}
|
||||
|
||||
// Метод отрисовки фона
|
||||
private void DrawBackground(Graphics g)
|
||||
{
|
||||
Pen pen = new(Color.Black, 3);
|
||||
for (int i = 0; i < _pictureWidth / _placeSizeWidth; i++)
|
||||
{
|
||||
for (int j = 0; j < _pictureHeight / _placeSizeHeight +
|
||||
1; ++j)
|
||||
{//линия рамзетки места
|
||||
g.DrawLine(pen, i * _placeSizeWidth, j *
|
||||
_placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth / 2, j *
|
||||
_placeSizeHeight);
|
||||
}
|
||||
g.DrawLine(pen, i * _placeSizeWidth, 0, i *
|
||||
_placeSizeWidth, _pictureHeight / _placeSizeHeight * _placeSizeHeight);
|
||||
}
|
||||
}
|
||||
|
||||
// Метод прорисовки объектов
|
||||
private void DrawObjects(Graphics g)
|
||||
{
|
||||
for (int i = 0; i < _collection.Count; i++)
|
||||
{
|
||||
T? t = _collection[i];
|
||||
if (t != null)
|
||||
{
|
||||
t.SetPosition((i % (_pictureWidth / _placeSizeWidth)) * _placeSizeWidth, (i / (_pictureWidth / _placeSizeWidth)) * _placeSizeHeight);
|
||||
if (t is Drawningboat) (t as Drawningboat).DrawTransport(g);
|
||||
else t.DrawTransport(g);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using ProjectBoat_bae.DrawningObjects;
|
||||
using ProjectBoat_bae.MovementStrategy;
|
||||
|
||||
namespace ProjectBoat_bae.Generics
|
||||
{
|
||||
internal class BoatsGenericStorage
|
||||
{
|
||||
readonly Dictionary<string, BoatsGenericCollection<Drawningboat, DrawningObjectBoat>> _boatStorages;
|
||||
public List<string> Keys => _boatStorages.Keys.ToList();
|
||||
|
||||
private readonly int _pictureWidth;
|
||||
private readonly int _pictureHeight;
|
||||
public BoatsGenericStorage(int pictureWidth, int pictureHeight)
|
||||
{
|
||||
_boatStorages = new Dictionary<string, BoatsGenericCollection<Drawningboat, DrawningObjectBoat>>();
|
||||
_pictureWidth = pictureWidth;
|
||||
_pictureHeight = pictureHeight;
|
||||
}
|
||||
public void AddSet(string name)
|
||||
{
|
||||
if (_boatStorages.ContainsKey(name)) return;
|
||||
_boatStorages[name] = new BoatsGenericCollection<Drawningboat, DrawningObjectBoat>(_pictureWidth, _pictureHeight);
|
||||
}
|
||||
|
||||
public void DelSet(string name)
|
||||
{
|
||||
if (!_boatStorages.ContainsKey(name)) return;
|
||||
_boatStorages.Remove(name);
|
||||
}
|
||||
|
||||
public BoatsGenericCollection<Drawningboat, DrawningObjectBoat>?
|
||||
this[string ind]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_boatStorages.ContainsKey(ind)) return _boatStorages[ind];
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
77
ProjectBoat_base/ProjectBoat_bae/Generics/SetGeneric.cs
Normal file
77
ProjectBoat_base/ProjectBoat_bae/Generics/SetGeneric.cs
Normal file
@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectBoat_bae.Generics
|
||||
{
|
||||
internal class SetGeneric<T> where T : class
|
||||
{
|
||||
private readonly List<T?> _places;
|
||||
public int Count => _places.Count;
|
||||
|
||||
// Максимальное количество объектов в списке
|
||||
private readonly int _maxCount;
|
||||
|
||||
// Конструктор
|
||||
public SetGeneric(int count)
|
||||
{
|
||||
_maxCount = count;
|
||||
_places = new List<T?>(_maxCount);
|
||||
}
|
||||
|
||||
public bool Insert(T boat)
|
||||
{
|
||||
return Insert(boat, 0);
|
||||
}
|
||||
public bool Insert(T boat, int position)
|
||||
{
|
||||
if (position < 0 || position >= _maxCount)
|
||||
return false;
|
||||
|
||||
if (Count >= _maxCount)
|
||||
return false;
|
||||
_places.Insert(0, boat);
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Remove(int position)
|
||||
{
|
||||
if (position < 0 || position > _maxCount)
|
||||
return false;
|
||||
if (position >= Count)
|
||||
return false;
|
||||
_places.RemoveAt(position);
|
||||
return true;
|
||||
}
|
||||
public T? this[int position]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (position < 0 || position > _maxCount)
|
||||
return null;
|
||||
return _places[position];
|
||||
}
|
||||
set
|
||||
{
|
||||
if (position < 0 || position > _maxCount)
|
||||
return;
|
||||
_places[position] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<T?> GetBoats(int? maxBoats = null)
|
||||
{
|
||||
for (int i = 0; i < _places.Count; ++i)
|
||||
{
|
||||
yield return _places[i];
|
||||
if (maxBoats.HasValue && i == maxBoats.Value)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,99 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
|
||||
namespace ProjectBoat_bae.MovementStrategy
|
||||
{
|
||||
public abstract class AbstractStrategy
|
||||
{
|
||||
|
||||
// Перемещаемый объект
|
||||
|
||||
private IMoveableObject? _moveableObject;
|
||||
|
||||
// Статус перемещения
|
||||
private Status _state = Status.NotInit;
|
||||
// Ширина поля
|
||||
protected int FieldWidth { get; private set; }
|
||||
// Высота поля
|
||||
protected int FieldHeight { get; private set; }
|
||||
// Статус перемещения
|
||||
public Status GetStatus() { return _state; }
|
||||
|
||||
public void SetData(IMoveableObject moveableObject, int width, int
|
||||
height)
|
||||
{
|
||||
if (moveableObject == null)
|
||||
{
|
||||
_state = Status.NotInit;
|
||||
return;
|
||||
}
|
||||
_state = Status.InProgress;
|
||||
_moveableObject = moveableObject;
|
||||
FieldWidth = width;
|
||||
FieldHeight = height;
|
||||
}
|
||||
|
||||
// Шаг перемещения
|
||||
public void MakeStep()
|
||||
{
|
||||
if (_state != Status.InProgress)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (IsTargetDestinaion())
|
||||
{
|
||||
_state = Status.Finish;
|
||||
return;
|
||||
}
|
||||
MoveToTarget();
|
||||
}
|
||||
|
||||
// Перемещение влево
|
||||
protected bool MoveLeft() => MoveTo(DiretionType.Left);
|
||||
|
||||
// Перемещение вправо
|
||||
protected bool MoveRight() => MoveTo(DiretionType.Right);
|
||||
|
||||
// Перемещение вверх
|
||||
protected bool MoveUp() => MoveTo(DiretionType.Up);
|
||||
|
||||
// Перемещение вниз
|
||||
protected bool MoveDown() => MoveTo(DiretionType.Down);
|
||||
|
||||
// Параметры объекта
|
||||
protected ObjectParameters? GetObjectParameters =>
|
||||
_moveableObject?.GetObjectPosition;
|
||||
|
||||
// Шаг объекта
|
||||
protected int? GetStep()
|
||||
{
|
||||
if (_state != Status.InProgress)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return _moveableObject?.GetStep;
|
||||
}
|
||||
// Перемещение к цели
|
||||
protected abstract void MoveToTarget();
|
||||
// Достигнута ли цель
|
||||
protected abstract bool IsTargetDestinaion();
|
||||
// Попытка перемещения в требуемом направлении
|
||||
private bool MoveTo(DiretionType directionType)
|
||||
{
|
||||
if (_state != Status.InProgress)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (_moveableObject?.CheckCanMove(directionType) ?? false)
|
||||
{
|
||||
_moveableObject.MoveObject(directionType);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using ProjectBoat_bae;
|
||||
using ProjectBoat_bae.Entities;
|
||||
using ProjectBoat_bae.DrawningObjects;
|
||||
namespace ProjectBoat_bae.MovementStrategy
|
||||
{
|
||||
// Реализация интерфейса для работы с объектом DrawningBoat!
|
||||
public class DrawningObjectBoat : IMoveableObject
|
||||
{
|
||||
private readonly Drawningboat? _drawingBoat = null;
|
||||
|
||||
public DrawningObjectBoat(Drawningboat drawingBoat)
|
||||
{
|
||||
_drawingBoat = drawingBoat;
|
||||
}
|
||||
//!
|
||||
public ObjectParameters? GetObjectPosition
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_drawingBoat == null || _drawingBoat.EntityBoat == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new ObjectParameters(_drawingBoat.GetPosX,
|
||||
_drawingBoat.GetPosY, _drawingBoat.GetWidth, _drawingBoat.GetHeight);
|
||||
}
|
||||
}
|
||||
public int GetStep => (int)(_drawingBoat?.EntityBoat?.Step ?? 0);
|
||||
public bool CheckCanMove(DiretionType direction) => _drawingBoat?.CanMove(direction) ?? false;
|
||||
public void MoveObject(DiretionType direction) => _drawingBoat?.MoveTransport(direction);
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectBoat_bae.MovementStrategy
|
||||
{
|
||||
public interface IMoveableObject
|
||||
{
|
||||
// Получение координаты X объекта
|
||||
ObjectParameters? GetObjectPosition { get; }
|
||||
|
||||
// Шаг объектa
|
||||
int GetStep { get; }
|
||||
|
||||
// Проверка, можно ли переместиться по нужному направлению
|
||||
bool CheckCanMove(DiretionType direction);
|
||||
|
||||
// Изменение направления пермещения объекта
|
||||
void MoveObject(DiretionType direction);
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectBoat_bae.MovementStrategy
|
||||
{
|
||||
public class MoveToBorder : AbstractStrategy
|
||||
{
|
||||
protected override bool IsTargetDestinaion()
|
||||
{
|
||||
var objParams = GetObjectParameters;
|
||||
if (objParams == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return objParams.RightBorder <= FieldWidth &&
|
||||
objParams.RightBorder + GetStep() >= FieldWidth &&
|
||||
objParams.DownBorder <= FieldHeight &&
|
||||
objParams.DownBorder + GetStep() >= FieldHeight;
|
||||
|
||||
}
|
||||
protected override void MoveToTarget()
|
||||
{
|
||||
var objParams = GetObjectParameters;
|
||||
if (objParams == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var diffX = FieldWidth - objParams.RightBorder;
|
||||
if (Math.Abs(diffX) > GetStep())
|
||||
{
|
||||
MoveRight();
|
||||
}
|
||||
var diffY = FieldHeight - objParams.DownBorder;
|
||||
if (Math.Abs(diffY) > GetStep())
|
||||
{
|
||||
MoveDown();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectBoat_bae.MovementStrategy
|
||||
{
|
||||
// Стратегия перемещения объекта в центр экрана
|
||||
public class MoveToCenter : AbstractStrategy
|
||||
{
|
||||
protected override bool IsTargetDestinaion()
|
||||
{
|
||||
var objParams = GetObjectParameters;
|
||||
if (objParams == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return objParams.ObjectMiddleHorizontal <= FieldWidth / 2 &&
|
||||
objParams.ObjectMiddleHorizontal + GetStep() >= FieldWidth / 2 &&
|
||||
objParams.ObjectMiddleVertical <= FieldHeight / 2 &&
|
||||
objParams.ObjectMiddleVertical + GetStep() >= FieldHeight / 2;
|
||||
}
|
||||
|
||||
protected override void MoveToTarget()
|
||||
{
|
||||
var objParams = GetObjectParameters;
|
||||
if (objParams == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var diffX = objParams.ObjectMiddleHorizontal - FieldWidth / 2;
|
||||
if (Math.Abs(diffX) > GetStep())
|
||||
{
|
||||
if (diffX > 0)
|
||||
{
|
||||
MoveLeft();
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveRight();
|
||||
}
|
||||
}
|
||||
var diffY = objParams.ObjectMiddleVertical - FieldHeight / 2;
|
||||
if (Math.Abs(diffY) > GetStep())
|
||||
{
|
||||
if (diffY > 0)
|
||||
{
|
||||
MoveUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveDown();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectBoat_bae.MovementStrategy
|
||||
{
|
||||
// Параметры-координаты объекта
|
||||
public class ObjectParameters
|
||||
{
|
||||
private readonly int _x;
|
||||
private readonly int _y;
|
||||
private readonly int _width;
|
||||
private readonly int _height;
|
||||
/// <summary>
|
||||
/// Левая граница
|
||||
/// </summary>
|
||||
public int LeftBorder => _x;
|
||||
/// <summary>
|
||||
/// Верхняя граница
|
||||
/// </summary>
|
||||
public int TopBorder => _y;
|
||||
/// <summary>
|
||||
/// Правая граница
|
||||
/// </summary>
|
||||
public int RightBorder => _x + _width;
|
||||
/// <summary>
|
||||
/// Нижняя граница
|
||||
/// </summary>
|
||||
public int DownBorder => _y + _height;
|
||||
/// <summary>
|
||||
/// Середина объекта
|
||||
/// </summary>
|
||||
public int ObjectMiddleHorizontal => _x + _width / 2;
|
||||
/// <summary>
|
||||
/// Середина объекта
|
||||
/// </summary>
|
||||
public int ObjectMiddleVertical => _y + _height / 2;
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="x">Координата X</param>
|
||||
/// <param name="y">Координата Y</param>
|
||||
/// <param name="width">Ширина</param>
|
||||
/// <param name="height">Высота</param>
|
||||
public ObjectParameters(int x, int y, int width, int height)
|
||||
{
|
||||
_x = x;
|
||||
_y = y;
|
||||
_width = width;
|
||||
_height = height;
|
||||
}
|
||||
}
|
||||
}
|
15
ProjectBoat_base/ProjectBoat_bae/MovementStrategy/Status.cs
Normal file
15
ProjectBoat_base/ProjectBoat_bae/MovementStrategy/Status.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectBoat_bae.MovementStrategy
|
||||
{
|
||||
public enum Status
|
||||
{
|
||||
NotInit,
|
||||
InProgress,
|
||||
Finish
|
||||
}
|
||||
}
|
17
ProjectBoat_base/ProjectBoat_bae/Program.cs
Normal file
17
ProjectBoat_base/ProjectBoat_bae/Program.cs
Normal file
@ -0,0 +1,17 @@
|
||||
namespace ProjectBoat_bae
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new FormBoatCollection());
|
||||
}
|
||||
}
|
||||
}
|
52
ProjectBoat_base/ProjectBoat_bae/ProjectBoat_bae.cs
Normal file
52
ProjectBoat_base/ProjectBoat_bae/ProjectBoat_bae.cs
Normal file
@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectBoat_bae
|
||||
{
|
||||
public class ProjectBoat_bae
|
||||
{
|
||||
public int Speed { get; private set; }
|
||||
|
||||
public double Weight { get; private set; }
|
||||
|
||||
// Основной цвет
|
||||
public Color BodyColor { get; private set; }
|
||||
|
||||
// Дополнительный цвет (для опциональных элементов)
|
||||
public Color AdditionalColor { get; private set; }
|
||||
|
||||
public bool body { get; private set; }
|
||||
|
||||
public bool Wing { get; private set; }
|
||||
|
||||
public bool SportLine { get; private set; }
|
||||
|
||||
public double Step => (double)Speed * 100 / Weight;
|
||||
/// <summary>
|
||||
/// Инициализация полей объекта-класса
|
||||
/// </summary>
|
||||
/// <param name="speed"
|
||||
/// <param name="weight"
|
||||
/// <param name="bodyColor"
|
||||
/// <param name="additionalColor"
|
||||
/// <param name="bodyKit"
|
||||
/// <param name="wing"
|
||||
/// <param name="sportLine"
|
||||
|
||||
//объект
|
||||
public void Init(int speed, double weight, Color bodyColor, Color
|
||||
additionalColor, bool bodyKit, bool wing, bool sportLine)
|
||||
{
|
||||
Speed = speed;
|
||||
Weight = weight;
|
||||
BodyColor = bodyColor;
|
||||
AdditionalColor = additionalColor;
|
||||
body = bodyKit;
|
||||
Wing = wing;
|
||||
SportLine = sportLine;
|
||||
}
|
||||
}
|
||||
}
|
26
ProjectBoat_base/ProjectBoat_bae/ProjectBoat_bae.csproj
Normal file
26
ProjectBoat_base/ProjectBoat_bae/ProjectBoat_bae.csproj
Normal file
@ -0,0 +1,26 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
63
ProjectBoat_base/ProjectBoat_bae/Properties/Resources.Designer.cs
generated
Normal file
63
ProjectBoat_base/ProjectBoat_bae/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ProjectBoat_bae.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
|
||||
/// </summary>
|
||||
// Этот класс создан автоматически классом 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() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
|
||||
/// </summary>
|
||||
[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("ProjectBoat_bae.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
|
||||
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
120
ProjectBoat_base/ProjectBoat_bae/Properties/Resources.resx
Normal file
120
ProjectBoat_base/ProjectBoat_bae/Properties/Resources.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?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.
|
||||
-->
|
||||
<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">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
25
ProjectBoat_base/ProjectBoat_base.sln
Normal file
25
ProjectBoat_base/ProjectBoat_base.sln
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.7.34031.279
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectBoat_bae", "ProjectBoat_bae\ProjectBoat_bae.csproj", "{D8469CDA-6475-44BF-BCDE-A69B80397FE3}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{D8469CDA-6475-44BF-BCDE-A69B80397FE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D8469CDA-6475-44BF-BCDE-A69B80397FE3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D8469CDA-6475-44BF-BCDE-A69B80397FE3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D8469CDA-6475-44BF-BCDE-A69B80397FE3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {13897BDF-00CA-4062-A354-314E6E63DC45}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
Loading…
Reference in New Issue
Block a user