thewar_server/Server/SQL/ResetShopItemData.cs

52 lines
1.8 KiB
C#

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<long, ResetShopItemData> resetShopItemData;
public string sheetName = "ResetShopItemData";
public ResetShopItemData getResetShopItemData(long key)
{
return resetShopItemData[key];
}
public List<ResetShopItemData> getResetShopItemData()
{
return resetShopItemData.Values.ToList();
}
public void init(Sheet data)
{
this.resetShopItemData = new Dictionary<long, ResetShopItemData>();
Console.WriteLine($"----------------------------{sheetName}----------------------------");
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);
}
}
}
}