From 482f281d36ac158d8220dd764322c7166eafc310 Mon Sep 17 00:00:00 2001 From: milimoe Date: Sat, 26 Jul 2025 02:35:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E5=88=B7=E6=96=B0=E4=BC=98?= =?UTF-8?q?=E5=8C=96=EF=BC=9B=E6=96=87=E6=9C=AC=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Entity/Trade/Goods.cs | 14 +++++++------- Entity/Trade/Store.cs | 7 ++++--- 2 files changed, 11 insertions(+), 10 deletions(-) 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]); } }