From 8dfd9434a914e56d9daa18ca5d16d6edeb5d2c93 Mon Sep 17 00:00:00 2001 From: marusya Date: Sun, 5 Nov 2023 21:25:34 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B8=D0=B7=D0=BC2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DrawningUsta.cs | 30 +++++++++---------- .../DrawningUstaBat.cs | 8 ++--- .../FormSelfPropelledArtilleryUnitConfig.cs | 6 ++-- .../IMoveableObject_Realise.cs | 4 +-- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/DrawningUsta.cs b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/DrawningUsta.cs index 568e7af..ee9ed89 100644 --- a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/DrawningUsta.cs +++ b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/DrawningUsta.cs @@ -19,7 +19,7 @@ namespace SelfPropelledArtilleryUnit.DrawningObjects /// /// Класс-сущность /// - public EntityUsta? EntityUsta_ { get; set; } + public EntityUsta? EntityUsta { get; set; } /// /// Ширина окна /// @@ -58,7 +58,7 @@ namespace SelfPropelledArtilleryUnit.DrawningObjects // TODO: Продумать проверки _pictureWidth = width; _pictureHeight = height; - EntityUsta_ = new EntityUsta(speed, weight, bodyColor); + EntityUsta = new EntityUsta(speed, weight, bodyColor); } /// /// Конструктор @@ -83,7 +83,7 @@ namespace SelfPropelledArtilleryUnit.DrawningObjects _pictureHeight = height; _ustaWidth = ustaWidth; _ustaHeight = ustaHeight; - EntityUsta_ = new EntityUsta(speed, weight, bodyColor); + EntityUsta = new EntityUsta(speed, weight, bodyColor); } @@ -143,20 +143,20 @@ namespace SelfPropelledArtilleryUnit.DrawningObjects /// true - можно переместится по указанному направлению public virtual bool CanMove(DirectionType direction) { - if (EntityUsta_ == null) + if (EntityUsta == null) { return false; } return direction switch { //влево - DirectionType.Left => _startPosX - EntityUsta_.Step > 0, + DirectionType.Left => _startPosX - EntityUsta.Step > 0, //вверх - DirectionType.Up => _startPosY - EntityUsta_.Step > 7, + DirectionType.Up => _startPosY - EntityUsta.Step > 7, // вправо - DirectionType.Right => _startPosX + EntityUsta_.Step + _ustaWidth < _pictureWidth,// TODO: Продумать логику + DirectionType.Right => _startPosX + EntityUsta.Step + _ustaWidth < _pictureWidth,// TODO: Продумать логику //вниз - DirectionType.Down => _startPosY + EntityUsta_.Step + _ustaHeight < _pictureHeight,// TODO: Продумать логику + DirectionType.Down => _startPosY + EntityUsta.Step + _ustaHeight < _pictureHeight,// TODO: Продумать логику _ => false, }; } @@ -167,37 +167,37 @@ namespace SelfPropelledArtilleryUnit.DrawningObjects public virtual void MoveTransport(DirectionType direction) { - if (!CanMove(direction) || EntityUsta_ == null) + if (!CanMove(direction) || EntityUsta == null) { return; } switch (direction) { case DirectionType.Left: - _startPosX -= (int)EntityUsta_.Step; + _startPosX -= (int)EntityUsta.Step; break; case DirectionType.Up: - _startPosY -= (int)EntityUsta_.Step; + _startPosY -= (int)EntityUsta.Step; break; case DirectionType.Right: - _startPosX += (int)EntityUsta_.Step; + _startPosX += (int)EntityUsta.Step; break; case DirectionType.Down: - _startPosY += (int)EntityUsta_.Step; + _startPosY += (int)EntityUsta.Step; break; } } public virtual void DrawTransport(Graphics g) { - if (EntityUsta_ == null) + if (EntityUsta == null) { return; } Pen pen = new(Color.Black); - Brush BodyColor = new SolidBrush(EntityUsta_.BodyColor); + Brush BodyColor = new SolidBrush(EntityUsta.BodyColor); //зеленый темнее int lineWidth = 10; diff --git a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/DrawningUstaBat.cs b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/DrawningUstaBat.cs index 82e76cc..4d54cea 100644 --- a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/DrawningUstaBat.cs +++ b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/DrawningUstaBat.cs @@ -29,9 +29,9 @@ namespace SelfPropelledArtilleryUnit.DrawningObjects additionalColor, bool bodyKit, bool pushka, int width, int height) : base(speed, weight, bodyColor, width, height, 140, 90) { - if (EntityUsta_ != null) + if (EntityUsta != null) { - EntityUsta_ = new EntityUstaBat(speed, weight, bodyColor, + EntityUsta = new EntityUstaBat(speed, weight, bodyColor, additionalColor, bodyKit, pushka); } } @@ -39,14 +39,14 @@ namespace SelfPropelledArtilleryUnit.DrawningObjects public override void DrawTransport(Graphics g) { - if (EntityUsta_ is not EntityUstaBat ustaBat) + if (EntityUsta is not EntityUstaBat ustaBat) { return; } Pen pen = new(Color.Black); Brush additionalBrush = new SolidBrush(ustaBat.AdditionalColor); - Brush BodyColor = new SolidBrush(EntityUsta_.BodyColor); + Brush BodyColor = new SolidBrush(EntityUsta.BodyColor); //зеленый темнее Color color1 = Color.FromArgb(65, 72, 51); diff --git a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/FormSelfPropelledArtilleryUnitConfig.cs b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/FormSelfPropelledArtilleryUnitConfig.cs index 52ba0b6..2754219 100644 --- a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/FormSelfPropelledArtilleryUnitConfig.cs +++ b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/FormSelfPropelledArtilleryUnitConfig.cs @@ -127,7 +127,7 @@ namespace SelfPropelledArtilleryUnit { if (e.Data.GetDataPresent(typeof(Color))) { - _usta.EntityUsta_.BodyColor = (Color)e.Data.GetData(typeof(Color)); + _usta.EntityUsta.BodyColor = (Color)e.Data.GetData(typeof(Color)); } DrawUsta(); @@ -136,7 +136,7 @@ namespace SelfPropelledArtilleryUnit private void LabelColor_DragEnter(object sender, DragEventArgs e) { - if (_usta != null && _usta.EntityUsta_ is EntityUstaBat entityustabat) + if (_usta != null && _usta.EntityUsta is EntityUstaBat entityustabat) { labelDopColor.AllowDrop = true; } @@ -155,7 +155,7 @@ namespace SelfPropelledArtilleryUnit private void LabelDopColor_DragDrop(object sender, DragEventArgs e) { - if (_usta != null && _usta.EntityUsta_ is EntityUstaBat entityustabat) + if (_usta != null && _usta.EntityUsta is EntityUstaBat entityustabat) { if (e.Data.GetDataPresent(typeof(Color))) { diff --git a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/IMoveableObject_Realise.cs b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/IMoveableObject_Realise.cs index 7c4b94d..ae028f3 100644 --- a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/IMoveableObject_Realise.cs +++ b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/IMoveableObject_Realise.cs @@ -23,7 +23,7 @@ namespace SelfPropelledArtilleryUnit.MovementStrategy { get { - if (_drawningUsta == null || _drawningUsta.EntityUsta_ == + if (_drawningUsta == null || _drawningUsta.EntityUsta == null) { return null; @@ -32,7 +32,7 @@ namespace SelfPropelledArtilleryUnit.MovementStrategy _drawningUsta.GetPosY, _drawningUsta.GetWidth, _drawningUsta.GetHeight); } } - public int GetStep => (int)(_drawningUsta?.EntityUsta_?.Step ?? 0); + public int GetStep => (int)(_drawningUsta?.EntityUsta?.Step ?? 0); public bool CheckCanMove(DirectionType direction) => _drawningUsta?.CanMove(direction) ?? false; public void MoveObject(DirectionType direction) =>