From 844cf559aab2cb29f239a03b8636a971e42e9aeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=ED=8C=90=EB=8F=8C?= Date: Wed, 13 Mar 2024 21:54:27 +0900 Subject: [PATCH] =?UTF-8?q?=EC=8B=A0=EA=B7=9C=20=EC=95=84=EC=9D=B4?= =?UTF-8?q?=ED=83=AC=20=EC=83=81=EC=A0=90=20=EC=A0=95=EB=B3=B4=20=EC=97=85?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=8A=B8=20=EC=BF=BC=EB=A6=AC=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Server/Git/AbstractGit.cs | 6 ++++ Server/SQL/ResetShopItem.cs | 39 +++++++++++++++++++++++++ Server/SQL/ResetShopItemData.cs | 50 +++++++++++++++++++++++++++++++++ Server/Service/Login.cs | 1 + Server/System/Statics.cs | 1 + 5 files changed, 97 insertions(+) create mode 100644 Server/SQL/ResetShopItem.cs create mode 100644 Server/SQL/ResetShopItemData.cs diff --git a/Server/Git/AbstractGit.cs b/Server/Git/AbstractGit.cs index ab8d3e3..e17ee6d 100644 --- a/Server/Git/AbstractGit.cs +++ b/Server/Git/AbstractGit.cs @@ -194,6 +194,12 @@ namespace Server.Git Statics.consumableItemExcel.init(sheets[index]); } + index = sheets.FindIndex(n => n.name == Statics.resetShopItemExcel.sheetName); + if (index != 0) + { + Statics.resetShopItemExcel.init(sheets[index]); + } + } } } diff --git a/Server/SQL/ResetShopItem.cs b/Server/SQL/ResetShopItem.cs new file mode 100644 index 0000000..69b5093 --- /dev/null +++ b/Server/SQL/ResetShopItem.cs @@ -0,0 +1,39 @@ +using Microsoft.EntityFrameworkCore; +using Newtonsoft.Json; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Server.SQL +{ + [Table("reset_shop_item", Schema = "gamedb")] + public class ResetShopItem + { + [JsonIgnore] + public long user_id { get; set; } + public long id { get; set; } + public long reset_shop_item_data_id { get; set; } + public string name { get; set; } + public long shop_index { get; set; } + public eBuyType buy_type { get; set; } + public int buy { get; set; } + public long reward { get; set; } + public int buy_count { get; set; } + public int count { get; set; } + public DateTime end_date { get; set; } + } + + public class ResetShopItemSQL : SQL + { + public override DbSet table { get; set; } + + public void Update(ResetShopItem ResetShopItem) + { + table.Update(ResetShopItem); + } + + public override List SelectUid(long user_id) + { + //현재 시간도 비교해서 이전날자가 들어가지 않게 하기 + return table.Where(data => data.user_id == user_id).ToList(); + } + } +} diff --git a/Server/SQL/ResetShopItemData.cs b/Server/SQL/ResetShopItemData.cs new file mode 100644 index 0000000..044d3f2 --- /dev/null +++ b/Server/SQL/ResetShopItemData.cs @@ -0,0 +1,50 @@ +using Server.Git; +using System.ComponentModel.DataAnnotations; + +namespace Server.SQL +{ + public class ResetShopItemData + { + [Key] + public long index { get; set; } + public string name { get; set; } + public long shop_index { get; set; } + public eBuyType buy_type { get; set; } + public int buy { get; set; } + public long reward { get; set; } + public int buy_count { get; set; } + } + + public class ResetShopItemDataExcel + { + private Dictionary resetShopItemData; + + public string sheetName = "ResetShopItemData"; + + public ResetShopItemData getResetShopItemData(long key) + { + return resetShopItemData[key]; + } + + public List getResetShopItemData() + { + return resetShopItemData.Values.ToList(); + } + public void init(Sheet data) + { + this.resetShopItemData = new Dictionary(); + foreach (var item in data.dicViewer) + { + ResetShopItemData resetShopItemData = new ResetShopItemData(); + resetShopItemData.index = item.Key; + resetShopItemData.name = (string)item.Value["name"]; + resetShopItemData.shop_index = (int)item.Value["shop_index"]; + resetShopItemData.buy_type = (eBuyType)item.Value["buy_type"]; + resetShopItemData.buy = (int)item.Value["buy"]; + resetShopItemData.reward = (int)item.Value["reward"]; + resetShopItemData.buy_count = (int)item.Value["buy_count"]; + this.resetShopItemData.Add(item.Key, resetShopItemData); + } + } + } +} diff --git a/Server/Service/Login.cs b/Server/Service/Login.cs index fd2e1ea..f9a0a45 100644 --- a/Server/Service/Login.cs +++ b/Server/Service/Login.cs @@ -57,6 +57,7 @@ namespace Server.Service user.uuid = Guid.NewGuid().ToString(); user.nickname = Statics.dynamicDataSQL.SelectName("defaultNick").value; Statics.userSQL.Insert(user); //저장하고 유닛의 id를 얻어오기 위함. + Statics.userSQL.SaveChanges(); itemManager = new ItemManager(user); #endregion #region 초기 유닛 지급 diff --git a/Server/System/Statics.cs b/Server/System/Statics.cs index 126a2a1..43fa693 100644 --- a/Server/System/Statics.cs +++ b/Server/System/Statics.cs @@ -34,5 +34,6 @@ namespace Server.System public static RewardDataExcel rewardExcel = new RewardDataExcel(); public static ShopItemDataExcel shopItemExcel = new ShopItemDataExcel(); public static ConsumableItemDataExcel consumableItemExcel = new ConsumableItemDataExcel(); + public static ResetShopItemDataExcel resetShopItemExcel = new ResetShopItemDataExcel(); } }