From b5fa935cf28dbd9d42090e97aadee83c45efa8c0 Mon Sep 17 00:00:00 2001 From: devil_1nc Date: Tue, 27 Feb 2024 10:07:13 +0400 Subject: [PATCH] 123321 --- WarmlyShip/WarmlyShip/DrawningWarmlyShip.cs | 36 ++++++++++--------- .../Properties/Resources.Designer.cs | 32 ++++++++--------- 2 files changed, 36 insertions(+), 32 deletions(-) diff --git a/WarmlyShip/WarmlyShip/DrawningWarmlyShip.cs b/WarmlyShip/WarmlyShip/DrawningWarmlyShip.cs index 74e6655..98fe142 100644 --- a/WarmlyShip/WarmlyShip/DrawningWarmlyShip.cs +++ b/WarmlyShip/WarmlyShip/DrawningWarmlyShip.cs @@ -21,6 +21,8 @@ namespace WarmlyShip private readonly int _drawningWarmlyShipHeight = 80; + + public void Init(int speed, double weight, Color bodyColor, Color seckondColor, bool fuelHole, bool pipes) { EntityWarmlyShip = new EntityWarmlyShip(); @@ -32,13 +34,24 @@ namespace WarmlyShip } public bool SetPictureSize(int width, int height) { - + if (width > _drawningWarmlyShipWidth && height > _drawningWarmlyShipHeight) + { + _pictureWidth = width; + _pictureHeight = height; - _pictureHeight = height; - _pictureWidth = width; + if (_startPosX != null && _startPosY != null) + { + if (_startPosX.Value + _drawningWarmlyShipWidth > _pictureWidth || _startPosY.Value + _drawningWarmlyShipHeight > _pictureHeight) + { + EntityWarmlyShip = null; + } + + } + return true; + } + return false; - return true; } public void SetPosition(int x, int y) { @@ -46,24 +59,15 @@ namespace WarmlyShip return; } - // корректировка координат ессли не влазит + _startPosX = x; _startPosY = y; - - if (_pictureHeight < _drawningWarmlyShipHeight || _pictureWidth < _drawningWarmlyShipWidth) - { - EntityWarmlyShip = null; - } - else if (_pictureHeight < _drawningWarmlyShipHeight + _startPosY.Value || _pictureWidth < _drawningWarmlyShipWidth + _startPosX.Value) + if (_drawningWarmlyShipHeight + _startPosY.Value > _pictureHeight || _drawningWarmlyShipWidth + _startPosX > _pictureWidth) { _startPosX = 0; _startPosY = 0; } - - - - } public bool MoveTransport(DirectionType direction) { @@ -75,7 +79,7 @@ namespace WarmlyShip switch (direction) { case DirectionType.Left: - if (_startPosY.Value - EntityWarmlyShip.Step > 0) + if (_startPosX.Value - EntityWarmlyShip.Step > 0) { _startPosX -= (int)EntityWarmlyShip.Step; } diff --git a/WarmlyShip/WarmlyShip/Properties/Resources.Designer.cs b/WarmlyShip/WarmlyShip/Properties/Resources.Designer.cs index cbaee59..b783bc0 100644 --- a/WarmlyShip/WarmlyShip/Properties/Resources.Designer.cs +++ b/WarmlyShip/WarmlyShip/Properties/Resources.Designer.cs @@ -1,10 +1,10 @@ //------------------------------------------------------------------------------ // -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 // -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. // //------------------------------------------------------------------------------ @@ -13,12 +13,12 @@ namespace WarmlyShip.Properties { /// - /// A strongly-typed resource class, for looking up localized strings, etc. + /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д. /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. + // Этот класс создан автоматически классом 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()] @@ -33,7 +33,7 @@ namespace WarmlyShip.Properties { } /// - /// Returns the cached ResourceManager instance used by this class. + /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { @@ -47,8 +47,8 @@ namespace WarmlyShip.Properties { } /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. + /// Перезаписывает свойство CurrentUICulture текущего потока для всех + /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { @@ -61,7 +61,7 @@ namespace WarmlyShip.Properties { } /// - /// Looks up a localized resource of type System.Drawing.Bitmap. + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap arrowDown { get { @@ -71,7 +71,7 @@ namespace WarmlyShip.Properties { } /// - /// Looks up a localized resource of type System.Drawing.Bitmap. + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap arrowLeft { get { @@ -81,7 +81,7 @@ namespace WarmlyShip.Properties { } /// - /// Looks up a localized resource of type System.Drawing.Bitmap. + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap arrowRight { get { @@ -91,7 +91,7 @@ namespace WarmlyShip.Properties { } /// - /// Looks up a localized resource of type System.Drawing.Bitmap. + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. /// internal static System.Drawing.Bitmap arrowUp { get {