Impl ShopGoodsExcelConfigData.json parsing

This commit is contained in:
2022-11-07 23:00:57 +08:00
parent 0c003616cb
commit c018b23913
10 changed files with 239 additions and 30 deletions

View File

@@ -16,14 +16,44 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace GrasscutterTools.Game.Shop
{
public class ShopInfo
{
public ShopInfo()
{
}
public ShopInfo(ShopGoodsData sgd)
{
GoodsId = sgd.GoodsId;
GoodsItem = new ItemParamData(sgd.ItemId, sgd.ItemCount);
SCoin = sgd.CostScoin;
MCoin = sgd.CostMcion;
HCoin = sgd.CostHcoin;
BuyLimit = sgd.BuyLimit;
MinLevel = sgd.MinPlayerLevel;
MaxLevel = sgd.MaxPlayerLevel;
CostItemList = sgd.CostItems.Where(it => it.Id != 0).ToList();
SecondarySheetId = sgd.SubTabId;
RefreshType = sgd.RefreshType;
ShopRefreshParam = sgd.RefreshParam;
if (sgd.BeginTime != null && sgd.EndTime != null)
{
BeginTime = (int)new DateTimeOffset(sgd.BeginTime.Value).ToUnixTimeSeconds();
EndTime = (int)new DateTimeOffset(sgd.EndTime.Value).ToUnixTimeSeconds();
}
}
[JsonProperty("goodsId")]
public int GoodsId { get; set; }
@@ -79,7 +109,7 @@ namespace GrasscutterTools.Game.Shop
[JsonProperty("secondarySheetId")]
public int SecondarySheetId { get; set; }
[JsonProperty("refreshType")]
[JsonProperty("refreshType"), JsonConverter(typeof(StringEnumConverter))]
public ShopRefreshType RefreshType { get; set; }
[JsonProperty("shopRefreshParam")]