thewar_server/Server/SQL/ShopItemData.cs

54 lines
1.4 KiB
C#

using Server.Git;
using System.ComponentModel.DataAnnotations;
namespace Server.SQL
{
public class ShopItemData
{
[Key]
public long 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 enum eBuyType
{
gold = 1,
cash,
money
}
public class ShopItemDataExcel
{
private Dictionary<long, ShopItemData> shopItemData;
public string sheetName = "ShopItemData";
public ShopItemData getShopItemData(long key)
{
return shopItemData[key];
}
public List<ShopItemData> getShopItemData()
{
return shopItemData.Values.ToList();
}
public void init(Sheet data)
{
this.shopItemData = new Dictionary<long, ShopItemData>();
foreach (var item in data.dicViewer)
{
ShopItemData shopItemData = new ShopItemData();
shopItemData.index = item.Key;
shopItemData.buy_type = (eBuyType)item.Value["buy_type"];
shopItemData.buy = (int)item.Value["buy"];
shopItemData.reward = (int)item.Value["reward"];
shopItemData.buy_count = (int)item.Value["buy_count"];
this.shopItemData.Add(item.Key, shopItemData);
}
}
}
}