From fa6ac61b639c3fd4441894fd5c167ec9328b24e6 Mon Sep 17 00:00:00 2001 From: foxkerik6 Date: Tue, 29 Nov 2022 00:26:24 +0400 Subject: [PATCH] =?UTF-8?q?=D1=84=D0=B8=D0=BD=D0=B0=D0=BB=D1=8C=D0=BD?= =?UTF-8?q?=D1=8B=D0=B5=20=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Stormtrooper/MapWithSetAirplaneGeneric.cs | 17 ++++++++++++----- Stormtrooper/Stormtrooper/SetAirplaneGeneric.cs | 8 ++++---- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/Stormtrooper/Stormtrooper/MapWithSetAirplaneGeneric.cs b/Stormtrooper/Stormtrooper/MapWithSetAirplaneGeneric.cs index d3ed604..12424a2 100644 --- a/Stormtrooper/Stormtrooper/MapWithSetAirplaneGeneric.cs +++ b/Stormtrooper/Stormtrooper/MapWithSetAirplaneGeneric.cs @@ -88,7 +88,7 @@ namespace Stormtrooper /// public Bitmap ShowOnMap() { - foreach (var air in _setAirs.GetBoats()) + foreach (var air in _setAirs.GetAirs()) { return _map.CreateMap(_pictureWidth, _pictureHeight, air); } @@ -168,15 +168,22 @@ namespace Stormtrooper int currentHeight = 0; int i = 0; - foreach (var air in _setAirs.GetBoats()) + foreach (var air in _setAirs.GetAirs()) { - air.SetObject(currentWidth * _placeSizeWidth, + air?.SetObject(currentWidth * _placeSizeWidth, currentHeight * _placeSizeHeight, _pictureWidth, _pictureHeight); - air.DrawningObject(g); + air?.DrawningObject(g); - i++; + if (currentWidth > 0) + currentWidth--; + else + { + currentWidth = width - 1; + currentHeight++; + } + if (currentHeight > height) return; } } } diff --git a/Stormtrooper/Stormtrooper/SetAirplaneGeneric.cs b/Stormtrooper/Stormtrooper/SetAirplaneGeneric.cs index 1ef7e87..bd13158 100644 --- a/Stormtrooper/Stormtrooper/SetAirplaneGeneric.cs +++ b/Stormtrooper/Stormtrooper/SetAirplaneGeneric.cs @@ -90,13 +90,13 @@ namespace Stormtrooper } } - public IEnumerable GetBoats() + public IEnumerable GetAirs() { - foreach (var boat in _places) + foreach (var air in _places) { - if (boat != null) + if (air != null) { - yield return boat; + yield return air; } else {