mirror of
https://github.com/project-redbud/FunGame-Core.git
synced 2025-04-21 11:39:35 +08:00
修复商品的物品列表无限叠加问题
This commit is contained in:
parent
7dea8032c2
commit
a520f7e9b6
@ -89,17 +89,19 @@ namespace Milimoe.FunGame.Core.Entity
|
|||||||
|
|
||||||
public class Goods
|
public class Goods
|
||||||
{
|
{
|
||||||
public long Id { get; set; }
|
public long Id { get; set; } = 0;
|
||||||
public List<Item> Items { get; }
|
public List<Item> Items { get; } = [];
|
||||||
public string Name { get; set; }
|
public string Name { get; set; } = "";
|
||||||
public string Description { get; set; }
|
public string Description { get; set; } = "";
|
||||||
public Dictionary<string, double> Prices { get; } = [];
|
public Dictionary<string, double> Prices { get; } = [];
|
||||||
public int Stock { get; set; }
|
public int Stock { get; set; }
|
||||||
|
|
||||||
|
public Goods() { }
|
||||||
|
|
||||||
public Goods(long id, Item item, int stock, string name, string description, Dictionary<string, double>? prices = null)
|
public Goods(long id, Item item, int stock, string name, string description, Dictionary<string, double>? prices = null)
|
||||||
{
|
{
|
||||||
Id = id;
|
Id = id;
|
||||||
Items = [item];
|
Items.Add(item);
|
||||||
Stock = stock;
|
Stock = stock;
|
||||||
Name = name;
|
Name = name;
|
||||||
Description = description;
|
Description = description;
|
||||||
|
@ -9,7 +9,7 @@ namespace Milimoe.FunGame.Core.Library.Common.JsonConverter
|
|||||||
{
|
{
|
||||||
public override Goods NewInstance()
|
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<string, object> convertingContext)
|
public override void ReadPropertyName(ref Utf8JsonReader reader, string propertyName, JsonSerializerOptions options, ref Goods result, Dictionary<string, object> convertingContext)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user