diff --git a/Entity/Trade/Goods.cs b/Entity/Trade/Goods.cs index 17d9f41..8a0d112 100644 --- a/Entity/Trade/Goods.cs +++ b/Entity/Trade/Goods.cs @@ -52,15 +52,15 @@ namespace Milimoe.FunGame.Core.Entity builder.AppendLine($"商品描述:{Description}"); builder.AppendLine($"商品售价:{(Prices.Count > 0 ? string.Join("、", Prices.Select(kv => $"{kv.Value} {kv.Key}")) : "免费")}"); builder.AppendLine($"包含物品:{string.Join("、", Items.Select(i => $"[{ItemSet.GetQualityTypeName(i.QualityType)}|{ItemSet.GetItemTypeName(i.ItemType)}] {i.Name}"))}"); - builder.AppendLine($"剩余库存:{(Stock == -1 ? "不限" : Stock)}"); + int buyCount = 0; + if (user != null) + { + UsersBuyCount.TryGetValue(user.Id, out buyCount); + } + builder.AppendLine($"剩余库存:{(Stock == -1 ? "不限" : Stock)}(已购:{buyCount})"); if (Quota > 0) { - int buyCount = 0; - if (user != null) - { - UsersBuyCount.TryGetValue(user.Id, out buyCount); - } - builder.AppendLine($"限购数量:{Quota}(已购:{buyCount})"); + builder.AppendLine($"限购数量:{Quota}"); } return builder.ToString().Trim(); } diff --git a/Entity/Trade/Store.cs b/Entity/Trade/Store.cs index 37db163..0725926 100644 --- a/Entity/Trade/Store.cs +++ b/Entity/Trade/Store.cs @@ -151,12 +151,13 @@ namespace Milimoe.FunGame.Core.Entity } } - public void CopyGoodsToNextRefreshGoods() + public void CopyGoodsToNextRefreshGoods(Dictionary? goods = null) { + goods ??= Goods; NextRefreshGoods.Clear(); - foreach (long goodsId in Goods.Keys) + foreach (long goodsId in goods.Keys) { - NextRefreshGoods.Add(goodsId, Goods[goodsId]); + NextRefreshGoods.Add(goodsId, goods[goodsId]); } }