diff --git a/Entity/System/Store.cs b/Entity/System/Store.cs index 3b918d6..7b41926 100644 --- a/Entity/System/Store.cs +++ b/Entity/System/Store.cs @@ -89,17 +89,19 @@ namespace Milimoe.FunGame.Core.Entity public class Goods { - public long Id { get; set; } - public List Items { get; } - public string Name { get; set; } - public string Description { get; set; } + public long Id { get; set; } = 0; + public List Items { get; } = []; + public string Name { get; set; } = ""; + public string Description { get; set; } = ""; public Dictionary Prices { get; } = []; public int Stock { get; set; } + public Goods() { } + public Goods(long id, Item item, int stock, string name, string description, Dictionary? prices = null) { Id = id; - Items = [item]; + Items.Add(item); Stock = stock; Name = name; Description = description; diff --git a/Library/Common/JsonConverter/GoodsConverter.cs b/Library/Common/JsonConverter/GoodsConverter.cs index 205d8f7..6666c64 100644 --- a/Library/Common/JsonConverter/GoodsConverter.cs +++ b/Library/Common/JsonConverter/GoodsConverter.cs @@ -9,7 +9,7 @@ namespace Milimoe.FunGame.Core.Library.Common.JsonConverter { public override Goods NewInstance() { - return new Goods(0, Factory.GetItem(), 0, "", ""); + return new Goods(); } public override void ReadPropertyName(ref Utf8JsonReader reader, string propertyName, JsonSerializerOptions options, ref Goods result, Dictionary convertingContext)