From 53bc2289564c26737023dbfe65a5835b137e43bd Mon Sep 17 00:00:00 2001 From: Garifullin-Farid <95081032+Garifullin-Farid@users.noreply.github.com> Date: Mon, 6 May 2024 22:56:32 +0400 Subject: [PATCH] fix --- .../.CollectionType.cs.swp | Bin 12288 -> 0 bytes .../.CollectionType_BASE_1418.cs.swp | Bin 12288 -> 0 bytes .../.CollectionType_LOCAL_1418.cs.swp | Bin 12288 -> 0 bytes .../.CollectionType_REMOTE_1418.cs.swp | Bin 12288 -> 0 bytes .../CollectionType_BACKUP_1418.cs | 25 ------ .../CollectionType_BASE_1418.cs | 17 ---- .../CollectionType_LOCAL_1418.cs | 21 ----- .../CollectionType_REMOTE_1418.cs | 17 ---- .../StorageCollection.cs | 3 + .../StorageCollection_BACKUP_1588.cs | 83 ------------------ .../StorageCollection_BASE_1588.cs | 75 ---------------- .../StorageCollection_LOCAL_1588.cs | 73 --------------- .../StorageCollection_REMOTE_1588.cs | 79 ----------------- .../Drawning/DrawningBattleTank.cs.orig | 73 --------------- .../ProjectTank/Entities/EntityTank.cs.orig | 56 ------------ .../Entities/EntiyBattleTank.cs.orig | 52 ----------- .../ProjectTank/FormBattleTankCollection.cs | 51 ++++++++--- .../MovementStrategy/MoveableTank.cs.orig | 64 -------------- 18 files changed, 43 insertions(+), 646 deletions(-) delete mode 100644 ProjectTank/ProjectTank/CollectionGenericObjects/.CollectionType.cs.swp delete mode 100644 ProjectTank/ProjectTank/CollectionGenericObjects/.CollectionType_BASE_1418.cs.swp delete mode 100644 ProjectTank/ProjectTank/CollectionGenericObjects/.CollectionType_LOCAL_1418.cs.swp delete mode 100644 ProjectTank/ProjectTank/CollectionGenericObjects/.CollectionType_REMOTE_1418.cs.swp delete mode 100644 ProjectTank/ProjectTank/CollectionGenericObjects/CollectionType_BACKUP_1418.cs delete mode 100644 ProjectTank/ProjectTank/CollectionGenericObjects/CollectionType_BASE_1418.cs delete mode 100644 ProjectTank/ProjectTank/CollectionGenericObjects/CollectionType_LOCAL_1418.cs delete mode 100644 ProjectTank/ProjectTank/CollectionGenericObjects/CollectionType_REMOTE_1418.cs delete mode 100644 ProjectTank/ProjectTank/CollectionGenericObjects/StorageCollection_BACKUP_1588.cs delete mode 100644 ProjectTank/ProjectTank/CollectionGenericObjects/StorageCollection_BASE_1588.cs delete mode 100644 ProjectTank/ProjectTank/CollectionGenericObjects/StorageCollection_LOCAL_1588.cs delete mode 100644 ProjectTank/ProjectTank/CollectionGenericObjects/StorageCollection_REMOTE_1588.cs delete mode 100644 ProjectTank/ProjectTank/Drawning/DrawningBattleTank.cs.orig delete mode 100644 ProjectTank/ProjectTank/Entities/EntityTank.cs.orig delete mode 100644 ProjectTank/ProjectTank/Entities/EntiyBattleTank.cs.orig delete mode 100644 ProjectTank/ProjectTank/MovementStrategy/MoveableTank.cs.orig diff --git a/ProjectTank/ProjectTank/CollectionGenericObjects/.CollectionType.cs.swp b/ProjectTank/ProjectTank/CollectionGenericObjects/.CollectionType.cs.swp deleted file mode 100644 index a66b1897763edaddaf74816b6e5b50fc91419e3a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI2OK%cU6vuB}bXPUHa$&scR+$%%A*D^4wqm1wBqIBHT#`{32m>ah(Sjz%WnH<^ zh5ZD^NJ6NEg$ol`clP=T{0_$d0D?5Ft{cuFzg*_b;mp0i9hqaR`Hf9(#&m|b$XMg5 zR!Hv8GcnIt!K!+0l>bkxtv|Sz+upgI%4b(~J$-7m;wa$@c_cfstLQvz$+r9~+hHqw z9yS%(!>6w+JJs?d;nZ@L|9I;AYPncM-YffA;ft#0Y}-*?piFM$8Wj<9f>WPQH^{(j z8(3h5uBnlOn>ViW%afDDiUGC&5%02!Du1GUN=+ryd9jm~{#w9Xw{ zN0+pa0Wv@a$N(8217v^BX^ zAn=|Dw9;-(YEJ0&R(`|$q!gB^9lmq>Mn#p7dUhQaTyudFfODv6+CIfDN+NFSSQb9#7wk^Khz C2Ioc6tCW#?0tyAu08;AJwr?s)F7a+UAcQ|V}5Agec0#hjY|`D12i-uP;CC+y(G zUxFJDs6~MW>NJgHbn^DLR?*TtTZ;%dGXx+20SG_<0uX=z1Zq|wpR1z{KK+M^KvQL| zdooupF+l(V5P$##AOHafKmY;|fB*y_@E;0T{DOa}k?4{Wz5jps|9|t5=$f<7+2ibR z);Y_ZUz|}+7pINW#QDq5-*Ij^SDdKc1qTBH5P$##AOHafKmY;|fB*y_@SXzeBzTNF zL0do4QJv)Lb+)+`p1a?}O`Z=pC!8}~ex~LcD0_=*|ClR7UGjGuc(JVihEoBBrKb?6qvx39KfYkWIuWVx!bV`56H=aSzn53}>`yDu}(ZP~YwUcSDlW>c|B zcZ#X6(_*GYie4?alf?fsuFc=NkAs$r11rwTD;O7cSUZh74^3AGQ$>uUwvn$Sd zXExj?3Z({lTHpkbLylzdgS&5I^dCMfCgxQ255i=Xn+Q2U~&!At5fm> z$KN+laBMJ7ZJP&6PBcIRG(ZD1Km#;D12jMbG(ZD1Km&WwfQKLaCk}|b1j+yZKi~iM zpvY(N9=rw*!2?hP^S}kC!3;PIe&YQf;5+yRzJPVG23~=r{tLiC12jMbG(ZD1Km#;D z12jMbG(ZC)k40f*gQ%`9E4RPUTB|u7HOghL*1R$d*|)Z5+vp+h+RiXIH%#k?7QHA6 z?i-YH&Wv()sP)FKqYJ%-#`F)PyzyE$D`8S7{qI6+XlX|md%TMIBiIC6w!1^oM^bGR zN`bFT*eI*<9(LJw=45H#VRt=cJE*_euiJ^ABh>z#Jlt&Pl}%Lje53wqq)(0Nk2lX> Fl3%w%*7^Vd diff --git a/ProjectTank/ProjectTank/CollectionGenericObjects/.CollectionType_REMOTE_1418.cs.swp b/ProjectTank/ProjectTank/CollectionGenericObjects/.CollectionType_REMOTE_1418.cs.swp deleted file mode 100644 index 92fd60296ca27fc1cdb0569e728f9413df3f5d92..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI&&q^Cn6bA4U7w-JO7H+Le&CQGjEowJ0h}0OV(Pd>ay~4y~5;BQki)id?DCirA zD2Ud$RS~?i>^t}no++tu#OTJ2f;vw&Zlu?XYWZ6tnMx;?jZel{)b^VG z7Tkb9>j`wwh-t)v=l(eGLG<-5wjKeV7y=N000bZa0SG_<0xc|1E=FjRpTDhc&{N+d zPxksHHV8lf0uX=z1Rwwb2tWV=5P$##-l2fSFZi>aMAw|){r~^}|GJClmUF~8BHefs4QuDp0lR7lQGmNd8XBlKHvfN zD$leZHtIsH<_d1mC-!omT^@$#`FDSd_an|3=UmsG>G_L_l}ygDg>ox-5uSc0a;?1b Sik7X!qe1#;qbfW+KTh{Z%( -/// Тип коллекции -/// -======= - ->>>>>>> d84f98706403d56e8dae185838815e23bb91f4d7 -public enum CollectionType -{ - /// - /// Неопределено - /// - None = 0, - - /// - /// Массив - /// - Massive = 1, - - /// - /// Список - /// - List = 2 -} \ No newline at end of file diff --git a/ProjectTank/ProjectTank/CollectionGenericObjects/CollectionType_BASE_1418.cs b/ProjectTank/ProjectTank/CollectionGenericObjects/CollectionType_BASE_1418.cs deleted file mode 100644 index 75d6067..0000000 --- a/ProjectTank/ProjectTank/CollectionGenericObjects/CollectionType_BASE_1418.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace ProjectLinkor.CollectionGenericObjects; - -public enum CollectionType -{ - /// - /// Неопределено - /// - None = 0, - /// - /// Массив - /// - Massive = 1, - /// - /// Список - /// - List = 2 -} \ No newline at end of file diff --git a/ProjectTank/ProjectTank/CollectionGenericObjects/CollectionType_LOCAL_1418.cs b/ProjectTank/ProjectTank/CollectionGenericObjects/CollectionType_LOCAL_1418.cs deleted file mode 100644 index 93d9dff..0000000 --- a/ProjectTank/ProjectTank/CollectionGenericObjects/CollectionType_LOCAL_1418.cs +++ /dev/null @@ -1,21 +0,0 @@ -namespace ProjectTank.CollectionGenericObjects; -/// -/// Тип коллекции -/// -public enum CollectionType -{ - /// - /// Неопределено - /// - None = 0, - - /// - /// Массив - /// - Massive = 1, - - /// - /// Список - /// - List = 2 -} \ No newline at end of file diff --git a/ProjectTank/ProjectTank/CollectionGenericObjects/CollectionType_REMOTE_1418.cs b/ProjectTank/ProjectTank/CollectionGenericObjects/CollectionType_REMOTE_1418.cs deleted file mode 100644 index f4bf31f..0000000 --- a/ProjectTank/ProjectTank/CollectionGenericObjects/CollectionType_REMOTE_1418.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace ProjectTank.CollectionGenericObjects; - -public enum CollectionType -{ - /// - /// Неопределено - /// - None = 0, - /// - /// Массив - /// - Massive = 1, - /// - /// Список - /// - List = 2 -} \ No newline at end of file diff --git a/ProjectTank/ProjectTank/CollectionGenericObjects/StorageCollection.cs b/ProjectTank/ProjectTank/CollectionGenericObjects/StorageCollection.cs index 360b6d3..983b5a6 100644 --- a/ProjectTank/ProjectTank/CollectionGenericObjects/StorageCollection.cs +++ b/ProjectTank/ProjectTank/CollectionGenericObjects/StorageCollection.cs @@ -1,4 +1,7 @@ +using ProjectTank.Drawning; +using System.Text; + namespace ProjectTank.CollectionGenericObjects { /// diff --git a/ProjectTank/ProjectTank/CollectionGenericObjects/StorageCollection_BACKUP_1588.cs b/ProjectTank/ProjectTank/CollectionGenericObjects/StorageCollection_BACKUP_1588.cs deleted file mode 100644 index 24dd440..0000000 --- a/ProjectTank/ProjectTank/CollectionGenericObjects/StorageCollection_BACKUP_1588.cs +++ /dev/null @@ -1,83 +0,0 @@ -<<<<<<< HEAD - -======= -using ProjectLinkor.CollectionGenericObjects; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - ->>>>>>> parent of 5665ee3 (fix) -namespace ProjectTank.CollectionGenericObjects -{ - public class StorageCollection - where T : class - { - /// - /// Словарь (хранилище) с коллекциями - /// - readonly Dictionary> _storages; - /// - /// Возвращение списка названий коллекций - /// - public List Keys => _storages.Keys.ToList(); - /// - /// Конструктор - /// - public StorageCollection() - { - _storages = new Dictionary>(); - } - /// - /// Добавление коллекции в хранилище - /// - /// Название коллекции - /// тип коллекции - public void AddCollection(string name, CollectionType collectionType) - { - // TODO проверка, что name не пустой и нет в словаре записи с таким ключом - // TODO Прописать логику для добавления - if (name == null || _storages.ContainsKey(name)) - return; - switch (collectionType) - { - case CollectionType.None: - return; - case CollectionType.Massive: - _storages[name] = new MassiveGenericObjects(); - return; - case CollectionType.List: - _storages[name] = new ListGenericObjects(); - return; - } - - } - /// - /// Удаление коллекции - /// - /// Название коллекции - public void DelCollection(string name) - { - // TODO Прописать логику для удаления коллекции - if (_storages.ContainsKey(name)) - _storages.Remove(name); - } - /// - /// Доступ к коллекции - /// - /// Название коллекции - /// - public ICollectionGenericObjects? this[string name] - { - get - { - // TODO Продумать логику получения объекта - if (name == null || !_storages.ContainsKey(name)) - return null; - return _storages[name]; - } - } - - } -} diff --git a/ProjectTank/ProjectTank/CollectionGenericObjects/StorageCollection_BASE_1588.cs b/ProjectTank/ProjectTank/CollectionGenericObjects/StorageCollection_BASE_1588.cs deleted file mode 100644 index 4345763..0000000 --- a/ProjectTank/ProjectTank/CollectionGenericObjects/StorageCollection_BASE_1588.cs +++ /dev/null @@ -1,75 +0,0 @@ -using ProjectLinkor.CollectionGenericObjects; - - -namespace ProjectTank.CollectionGenericObjects -{ - public class StorageCollection - where T : class - { - /// - /// Словарь (хранилище) с коллекциями - /// - readonly Dictionary> _storages; - /// - /// Возвращение списка названий коллекций - /// - public List Keys => _storages.Keys.ToList(); - /// - /// Конструктор - /// - public StorageCollection() - { - _storages = new Dictionary>(); - } - /// - /// Добавление коллекции в хранилище - /// - /// Название коллекции - /// тип коллекции - public void AddCollection(string name, CollectionType collectionType) - { - // TODO проверка, что name не пустой и нет в словаре записи с таким ключом - // TODO Прописать логику для добавления - if (name == null || _storages.ContainsKey(name)) - return; - switch (collectionType) - { - case CollectionType.None: - return; - case CollectionType.Massive: - _storages[name] = new MassiveGenericObjects(); - return; - case CollectionType.List: - _storages[name] = new ListGenericObjects(); - return; - } - - } - /// - /// Удаление коллекции - /// - /// Название коллекции - public void DelCollection(string name) - { - // TODO Прописать логику для удаления коллекции - if (_storages.ContainsKey(name)) - _storages.Remove(name); - } - /// - /// Доступ к коллекции - /// - /// Название коллекции - /// - public ICollectionGenericObjects? this[string name] - { - get - { - // TODO Продумать логику получения объекта - if (name == null || !_storages.ContainsKey(name)) - return null; - return _storages[name]; - } - } - - } -} diff --git a/ProjectTank/ProjectTank/CollectionGenericObjects/StorageCollection_LOCAL_1588.cs b/ProjectTank/ProjectTank/CollectionGenericObjects/StorageCollection_LOCAL_1588.cs deleted file mode 100644 index 6b0bc15..0000000 --- a/ProjectTank/ProjectTank/CollectionGenericObjects/StorageCollection_LOCAL_1588.cs +++ /dev/null @@ -1,73 +0,0 @@ - -namespace ProjectTank.CollectionGenericObjects -{ - public class StorageCollection - where T : class - { - /// - /// Словарь (хранилище) с коллекциями - /// - readonly Dictionary> _storages; - /// - /// Возвращение списка названий коллекций - /// - public List Keys => _storages.Keys.ToList(); - /// - /// Конструктор - /// - public StorageCollection() - { - _storages = new Dictionary>(); - } - /// - /// Добавление коллекции в хранилище - /// - /// Название коллекции - /// тип коллекции - public void AddCollection(string name, CollectionType collectionType) - { - // TODO проверка, что name не пустой и нет в словаре записи с таким ключом - // TODO Прописать логику для добавления - if (name == null || _storages.ContainsKey(name)) - return; - switch (collectionType) - { - case CollectionType.None: - return; - case CollectionType.Massive: - _storages[name] = new MassiveGenericObjects(); - return; - case CollectionType.List: - _storages[name] = new ListGenericObjects(); - return; - } - - } - /// - /// Удаление коллекции - /// - /// Название коллекции - public void DelCollection(string name) - { - // TODO Прописать логику для удаления коллекции - if (_storages.ContainsKey(name)) - _storages.Remove(name); - } - /// - /// Доступ к коллекции - /// - /// Название коллекции - /// - public ICollectionGenericObjects? this[string name] - { - get - { - // TODO Продумать логику получения объекта - if (name == null || !_storages.ContainsKey(name)) - return null; - return _storages[name]; - } - } - - } -} diff --git a/ProjectTank/ProjectTank/CollectionGenericObjects/StorageCollection_REMOTE_1588.cs b/ProjectTank/ProjectTank/CollectionGenericObjects/StorageCollection_REMOTE_1588.cs deleted file mode 100644 index 368bdcb..0000000 --- a/ProjectTank/ProjectTank/CollectionGenericObjects/StorageCollection_REMOTE_1588.cs +++ /dev/null @@ -1,79 +0,0 @@ -using ProjectLinkor.CollectionGenericObjects; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ProjectTank.CollectionGenericObjects -{ - public class StorageCollection - where T : class - { - /// - /// Словарь (хранилище) с коллекциями - /// - readonly Dictionary> _storages; - /// - /// Возвращение списка названий коллекций - /// - public List Keys => _storages.Keys.ToList(); - /// - /// Конструктор - /// - public StorageCollection() - { - _storages = new Dictionary>(); - } - /// - /// Добавление коллекции в хранилище - /// - /// Название коллекции - /// тип коллекции - public void AddCollection(string name, CollectionType collectionType) - { - // TODO проверка, что name не пустой и нет в словаре записи с таким ключом - // TODO Прописать логику для добавления - if (name == null || _storages.ContainsKey(name)) - return; - switch (collectionType) - { - case CollectionType.None: - return; - case CollectionType.Massive: - _storages[name] = new MassiveGenericObjects(); - return; - case CollectionType.List: - _storages[name] = new ListGenericObjects(); - return; - } - - } - /// - /// Удаление коллекции - /// - /// Название коллекции - public void DelCollection(string name) - { - // TODO Прописать логику для удаления коллекции - if (_storages.ContainsKey(name)) - _storages.Remove(name); - } - /// - /// Доступ к коллекции - /// - /// Название коллекции - /// - public ICollectionGenericObjects? this[string name] - { - get - { - // TODO Продумать логику получения объекта - if (name == null || !_storages.ContainsKey(name)) - return null; - return _storages[name]; - } - } - - } -} diff --git a/ProjectTank/ProjectTank/Drawning/DrawningBattleTank.cs.orig b/ProjectTank/ProjectTank/Drawning/DrawningBattleTank.cs.orig deleted file mode 100644 index 86f6e79..0000000 --- a/ProjectTank/ProjectTank/Drawning/DrawningBattleTank.cs.orig +++ /dev/null @@ -1,73 +0,0 @@ -<<<<<<< HEAD -======= -using ProjectTank.Entities; ->>>>>>> 6b2dbf2 (LabWork_2) - -namespace ProjectTank.Drawning; -/// -/// Класс, отвечающий за прорисовку и перемещение объекта-сущности -/// -public class DrawningBattleTank :DrawningTank -{ - /// - /// Конструктор - /// - /// Скорость -<<<<<<< HEAD - /// Вес -======= - /// Вес автомобиля ->>>>>>> 6b2dbf2 (LabWork_2) - /// Основной цвет - /// Дополнительный цвет - /// Признак наличия пушки - /// признак наличия пулемета - /// - public DrawningBattleTank(int speed, double weight, Color bodyColor, Color additionalColor, bool gun, bool machinGun) : base(150, 87) - { - EntityTank = new EntityBattleTank(speed, weight, bodyColor, additionalColor, gun, machinGun); - } - - /// - /// Прорисовка объекта - /// - /// - public override void DrawTransport(Graphics g) - { - if (EntityTank == null || EntityTank is not EntityBattleTank battleTank || !_startPosX.HasValue || !_startPosY.HasValue) - { - return; - } - Pen pen = new(Color.Black); - Brush additionalBrush = new SolidBrush(battleTank.AdditionalColor); - - if (battleTank.Gun) - { - g.DrawRectangle(pen, _startPosX.Value, _startPosY.Value + 30, 45, 5); - - g.FillRectangle(additionalBrush, _startPosX.Value, _startPosY.Value + 30, 45, 5); - } - - //пулемет - if (battleTank.MachinGun) - { - g.DrawRectangle(pen, _startPosX.Value + 65, _startPosY.Value + 15, 16, 5); - g.DrawRectangle(pen, _startPosX.Value + 72, _startPosY.Value + 10, 5, 5); - g.DrawRectangle(pen, _startPosX.Value + 71, _startPosY.Value + 3, 7, 7); - g.DrawRectangle(pen, _startPosX.Value + 55, _startPosY.Value + 5, 15, 3); - - g.FillRectangle(additionalBrush, _startPosX.Value + 65, _startPosY.Value + 15, 16, 5); - g.FillRectangle(additionalBrush, _startPosX.Value + 72, _startPosY.Value + 10, 5, 5); - g.FillRectangle(additionalBrush, _startPosX.Value + 71, _startPosY.Value + 3, 7, 7); - g.FillRectangle(additionalBrush, _startPosX.Value + 55, _startPosY.Value + 5, 15, 3); - } - _startPosY += 20; - base.DrawTransport(g); - _startPosY -= 20; - - } - -} - - - diff --git a/ProjectTank/ProjectTank/Entities/EntityTank.cs.orig b/ProjectTank/ProjectTank/Entities/EntityTank.cs.orig deleted file mode 100644 index 9803d29..0000000 --- a/ProjectTank/ProjectTank/Entities/EntityTank.cs.orig +++ /dev/null @@ -1,56 +0,0 @@ -<<<<<<< HEAD -namespace ProjectTank.Entities -======= -namespace ProjectTank.Entities ->>>>>>> 6b2dbf2 (LabWork_2) -{ - public class EntityTank - { - - /// - /// Скорость - /// - public int Speed { get; private set; } - - /// - /// Вес - /// - public double Weight { get; private set; } - - /// - /// Основной цвет - /// - public Color BodyColor { get; private set; } - - /// - /// Шаг перемещения танка - /// - public double Step => Speed * 100 / Weight; -<<<<<<< HEAD - public void SetBodyColor(Color color) - { - BodyColor = color; - } -======= ->>>>>>> 6b2dbf2 (LabWork_2) - - /// - /// Конструктор сущности - /// - /// Скорость -<<<<<<< HEAD - /// Веc -======= - /// Вес автомобиля ->>>>>>> 6b2dbf2 (LabWork_2) - /// Основной цвет - - public EntityTank(int speed, double weight, Color bodyColor) - { - Speed = speed; - Weight = weight; - BodyColor = bodyColor; - - } - } -} diff --git a/ProjectTank/ProjectTank/Entities/EntiyBattleTank.cs.orig b/ProjectTank/ProjectTank/Entities/EntiyBattleTank.cs.orig deleted file mode 100644 index 7aae8d2..0000000 --- a/ProjectTank/ProjectTank/Entities/EntiyBattleTank.cs.orig +++ /dev/null @@ -1,52 +0,0 @@ -using ProjectTank.Entities; - -namespace ProjectTank -{ - /// - /// Класс-сущность танк - /// - public class EntityBattleTank : EntityTank - - { - /// - /// Дополнительный цвет (для опциональных элементов) - /// - public Color AdditionalColor { get; private set; } - - /// - /// Признак (опция) наличия пушки - /// - public bool Gun { get; private set; } - - - /// - /// Признак (опция) наличия Пулемета на башне - /// /// - public bool MachinGun { get; private set; } - -<<<<<<< HEAD - public void SetAdditionalColor(Color addColor) - { - AdditionalColor = addColor; - } - -======= ->>>>>>> 6b2dbf2 (LabWork_2) - /// - /// Конструктор объекта-класса Боевого Танка - /// - /// Скорость - /// Вес - /// Основной цвет - /// Дополнительный цвет - /// Пушка танка - /// Пклемет на башне - public EntityBattleTank(int speed, double weight, Color bodyColor, Color additionalColor, bool gun, bool machinGun) : base(speed, weight, bodyColor) - { - AdditionalColor = additionalColor; - MachinGun= machinGun; - Gun = gun; - } - - } -} diff --git a/ProjectTank/ProjectTank/FormBattleTankCollection.cs b/ProjectTank/ProjectTank/FormBattleTankCollection.cs index d81e1d2..689201b 100644 --- a/ProjectTank/ProjectTank/FormBattleTankCollection.cs +++ b/ProjectTank/ProjectTank/FormBattleTankCollection.cs @@ -68,19 +68,12 @@ namespace ProjectTank return; } - return color; - } - - private void ButtonAddTank_Click(object sender, EventArgs e) - { - CreateObject(nameof(DrawningTank)); - } - - private void ButtonAddBattleTank_Click(object sender, EventArgs e) - { - CreateObject(nameof(DrawningBattleTank)); + FormTankConfig form = new(); + form.AddEvent(SetTank); + form.Show(); } + private void buttonRemoveTank_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(maskedTextBox.Text) || _company == null) return; @@ -228,5 +221,41 @@ namespace ProjectTank panelCompanyTools.Enabled = true; RerfreshListBoxItems(); } + private void SaveToolStripMenuItem_Click(object sender, EventArgs e) + { + if (saveFileDialog.ShowDialog() == DialogResult.OK) + { + if (_storageCollection.SaveData(saveFileDialog.FileName)) + { + MessageBox.Show("Сохранение прошло успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + else + { + MessageBox.Show("Не сохранилось", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + + /// + /// Обработка нажатия "Загрузка" + /// + /// + /// + private void LoadToolStripMenuItem_Click(object sender, EventArgs e) + { + if (openFileDialog.ShowDialog() == DialogResult.OK) + { + if (_storageCollection.LoadData(openFileDialog.FileName)) + { + MessageBox.Show("Загрузка прошла успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information); + RerfreshListBoxItems(); + } + else + { + MessageBox.Show("не загрузилось", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error); + + } + } + } } } \ No newline at end of file diff --git a/ProjectTank/ProjectTank/MovementStrategy/MoveableTank.cs.orig b/ProjectTank/ProjectTank/MovementStrategy/MoveableTank.cs.orig deleted file mode 100644 index a9b935d..0000000 --- a/ProjectTank/ProjectTank/MovementStrategy/MoveableTank.cs.orig +++ /dev/null @@ -1,64 +0,0 @@ -using ProjectTank.Drawning; - -namespace ProjectTank.MovementStrategy -{ - public class MoveableTank : IMoveableObject - { - /// - /// Поле-объект класса или его DrawningTank наследника - /// - private readonly DrawningTank? _tank = null; - /// -<<<<<<< HEAD - /// конструктор - /// - /// Объект класса DrawningTank -======= - /// Конструктор - /// - /// Объект класса DrawningBoat ->>>>>>> 6b2dbf2 (LabWork_2) - public MoveableTank(DrawningTank tank) - { - _tank = tank; - } - public ObjectParameters? GetObjectPosition - { - get - { - if (_tank == null || _tank.EntityTank == null || - !_tank.GetPosX.HasValue || !_tank.GetPosY.HasValue) - { - return null; - } - return new ObjectParameters(_tank.GetPosX.Value, - _tank.GetPosY.Value, _tank.GetWidth, _tank.GetHeight); - } - } - public int GetStep => (int)(_tank?.EntityTank?.Step ?? 0); - public bool TryMoveObject(MovementDirection direction) - { - if (_tank == null || _tank.EntityTank == null) - { - return false; - } - return _tank.MoveTransport(GetDirectionType(direction)); - } - /// - /// Конвертация из MovementDirection в DirectionType - /// - /// MovementDirection - /// DirectionType - private static DirectionType GetDirectionType(MovementDirection direction) - { - return direction switch - { - MovementDirection.Left => DirectionType.Left, - MovementDirection.Right => DirectionType.Right, - MovementDirection.Up => DirectionType.Up, - MovementDirection.Down => DirectionType.Down, - _ => DirectionType.Unknow, - }; - } - } -}