From a520f7e9b6accbbcf2f151a1e13ff10970066494 Mon Sep 17 00:00:00 2001 From: milimoe Date: Tue, 21 Jan 2025 02:09:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=95=86=E5=93=81=E7=9A=84?= =?UTF-8?q?=E7=89=A9=E5=93=81=E5=88=97=E8=A1=A8=E6=97=A0=E9=99=90=E5=8F=A0?= =?UTF-8?q?=E5=8A=A0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Entity/System/Store.cs | 12 +++++++----- Library/Common/JsonConverter/GoodsConverter.cs | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) 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)