From 8b3d4aa0d7f38822b5b0afc8ce08ac1127b03b64 Mon Sep 17 00:00:00 2001 From: yeziuku Date: Sun, 6 Jul 2025 16:54:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=93=E5=AD=98=E4=BD=BF=E7=94=A8=E7=89=A9?= =?UTF-8?q?=E5=93=81=E6=B7=BB=E5=8A=A0=E4=BD=BF=E7=94=A8=E6=AC=A1=E6=95=B0?= =?UTF-8?q?=E5=8F=82=E6=95=B0=EF=BC=9B=E6=B7=BB=E5=8A=A0=E4=BA=86=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=90=8D=E5=BC=95=E7=94=A8=E5=92=8C=E6=8A=A5=E4=BB=B7?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E5=B8=B8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Entity/Item/Item.cs | 11 ++++++----- Entity/User/User.cs | 1 + Library/Constant/ConstantSet.cs | 19 +++++++++++++++++++ 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/Entity/Item/Item.cs b/Entity/Item/Item.cs index 6b8148d..52bf5f5 100644 --- a/Entity/Item/Item.cs +++ b/Entity/Item/Item.cs @@ -324,11 +324,11 @@ namespace Milimoe.FunGame.Core.Entity /// 局外(库存)使用物品触发 /// /// - public bool UseItem(User user, Dictionary args) + public bool UseItem(User user, int times, Dictionary args) { if (User != null) { - bool result = OnItemUsed(user, args); + bool result = OnItemUsed(user, times, args); if (result) { EntityState = EntityState.Modified; @@ -342,11 +342,11 @@ namespace Milimoe.FunGame.Core.Entity /// /// 使用后减少使用次数或删除物品 /// - public void ReduceTimesAndRemove() + public void ReduceTimesAndRemove(int times = 1) { if (IsReduceTimesAfterUse) { - RemainUseTimes--; + RemainUseTimes -= times; } if (RemainUseTimes < 0) RemainUseTimes = 0; if (IsRemoveAfterUse && RemainUseTimes == 0) @@ -371,9 +371,10 @@ namespace Milimoe.FunGame.Core.Entity /// 当物品被玩家使用时 /// /// + /// /// /// - protected virtual bool OnItemUsed(User user, Dictionary args) + protected virtual bool OnItemUsed(User user, int times, Dictionary args) { return false; } diff --git a/Entity/User/User.cs b/Entity/User/User.cs index 323928c..78342c5 100644 --- a/Entity/User/User.cs +++ b/Entity/User/User.cs @@ -7,6 +7,7 @@ namespace Milimoe.FunGame.Core.Entity public class User : BaseEntity { public static readonly User Empty = new(); + public override string Name => Username; public string Username { get; set; } = ""; public DateTime RegTime { get; set; } public DateTime LastTime { get; set; } diff --git a/Library/Constant/ConstantSet.cs b/Library/Constant/ConstantSet.cs index 8ba1a72..2550f58 100644 --- a/Library/Constant/ConstantSet.cs +++ b/Library/Constant/ConstantSet.cs @@ -43,6 +43,25 @@ namespace Milimoe.FunGame.Core.Library.Constant _ => "已结束" }; } + + public static string GetOfferStatus(OfferState status) + { + return status switch + { + OfferState.Created => "已创建", + OfferState.Cancelled => "已取消", + OfferState.PendingOfferorConfirmation => "等待发起方确认", + OfferState.PendingOffereeConfirmation => "等待接收方确认", + OfferState.OfferorConfirmed => "发起方已确认", + OfferState.OffereeConfirmed => "接收方已确认", + OfferState.Sent => "已发送", + OfferState.Negotiating => "协商中", + OfferState.NegotiationAccepted => "协商已接受", + OfferState.Rejected => "已拒绝", + OfferState.Completed => "已完成", + _ => "已过期" + }; + } } ///