From 6336fee8f1867c6dfe04aa37f0203772b83e34ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=ED=8C=90=EB=8F=8C?= Date: Sat, 24 Feb 2024 15:40:14 +0900 Subject: [PATCH] =?UTF-8?q?=EB=8D=B1=20=EC=A0=80=EC=9E=A5=20=EB=A7=88?= =?UTF-8?q?=EB=AC=B4=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Server/NLog.config | 2 +- Server/Program.cs | 6 ----- Server/Service/DeckChange.cs | 44 ++++++++++++++++++++++-------------- 3 files changed, 28 insertions(+), 24 deletions(-) diff --git a/Server/NLog.config b/Server/NLog.config index aabf35e..a4dd140 100644 --- a/Server/NLog.config +++ b/Server/NLog.config @@ -21,6 +21,6 @@ - + diff --git a/Server/Program.cs b/Server/Program.cs index 964765e..ab5d358 100644 --- a/Server/Program.cs +++ b/Server/Program.cs @@ -3,12 +3,6 @@ using Server.System; var builder = WebApplication.CreateBuilder(args); var app = builder.Build(); -//α -#if DEBUG -NLog.GlobalDiagnosticsContext.Set("logLevel", "Trace"); -#elif LIVE -NLog.GlobalDiagnosticsContext.Set("logLevel", "Info"); -#endif // ʱȭ ProtocolProcessor.Init(); // ʱȭ diff --git a/Server/Service/DeckChange.cs b/Server/Service/DeckChange.cs index 702b344..719d310 100644 --- a/Server/Service/DeckChange.cs +++ b/Server/Service/DeckChange.cs @@ -25,7 +25,7 @@ namespace Server.Service if (req.deck_unit[n] == 0) continue; long unit_id = req.deck_unit[n]; - if( deckUnitInfo.FindIndex(data => data.unit_id == unit_id) == -1) + if( deckUnitInfo.FindIndex(data => data.id == unit_id) == -1) throw new RuntimeException("Not Unit", Error.nodata); } @@ -44,25 +44,35 @@ namespace Server.Service if(deckindex == -1) throw new RuntimeException("Not Deck", Error.nodata); + //덱 검사 + if (deckInfo[deckindex].deck_unit0_id == req.deck_unit[0] && + deckInfo[deckindex].deck_unit1_id == req.deck_unit[1] && + deckInfo[deckindex].deck_unit2_id == req.deck_unit[2] && + deckInfo[deckindex].deck_unit3_id == req.deck_unit[3] && + deckInfo[deckindex].deck_unit4_id == req.deck_unit[4] && + deckInfo[deckindex].deck_unit5_id == req.deck_unit[5] && + deckInfo[deckindex].deck_unit6_id == req.deck_unit[6] && + deckInfo[deckindex].deck_unit7_id == req.deck_unit[7] && + deckInfo[deckindex].deck_unit8_id == req.deck_unit[8]) + { + //모든 정보가 같으면 업데이트 하지않음 + return makeResp(deckInfo[deckindex]); + } + //덱 유닛 저장 - DeckInfo changeDeck = new DeckInfo(); + deckInfo[deckindex].deck_unit0_id = req.deck_unit[0]; + deckInfo[deckindex].deck_unit1_id = req.deck_unit[1]; + deckInfo[deckindex].deck_unit2_id = req.deck_unit[2]; + deckInfo[deckindex].deck_unit3_id = req.deck_unit[3]; + deckInfo[deckindex].deck_unit4_id = req.deck_unit[4]; + deckInfo[deckindex].deck_unit5_id = req.deck_unit[5]; + deckInfo[deckindex].deck_unit6_id = req.deck_unit[6]; + deckInfo[deckindex].deck_unit7_id = req.deck_unit[7]; + deckInfo[deckindex].deck_unit8_id = req.deck_unit[8]; - changeDeck.id = deckInfo[deckindex].id; - changeDeck.deck_type = deckInfo[deckindex].deck_type; - changeDeck.user_id = deckInfo[deckindex].user_id; - changeDeck.deck_unit0_id = req.deck_unit[0]; - changeDeck.deck_unit1_id = req.deck_unit[1]; - changeDeck.deck_unit2_id = req.deck_unit[2]; - changeDeck.deck_unit3_id = req.deck_unit[3]; - changeDeck.deck_unit4_id = req.deck_unit[4]; - changeDeck.deck_unit5_id = req.deck_unit[5]; - changeDeck.deck_unit6_id = req.deck_unit[6]; - changeDeck.deck_unit7_id = req.deck_unit[7]; - changeDeck.deck_unit8_id = req.deck_unit[8]; - - Statics.deckInfoSQL.Update(changeDeck); - return makeResp(changeDeck); + Statics.deckInfoSQL.Update(deckInfo[deckindex]); + return makeResp(deckInfo[deckindex]); } public override Protocol ProtocolValue() => Protocol.DeckChange;