mirror of
https://github.com/project-redbud/FunGame-Core.git
synced 2025-12-05 08:09:02 +00:00
库存使用物品添加使用次数参数;添加了用户名引用和报价状态常量
This commit is contained in:
parent
d4aa6adf97
commit
8b3d4aa0d7
@ -324,11 +324,11 @@ namespace Milimoe.FunGame.Core.Entity
|
||||
/// 局外(库存)使用物品触发
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool UseItem(User user, Dictionary<string, object> args)
|
||||
public bool UseItem(User user, int times, Dictionary<string, object> 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
|
||||
/// <summary>
|
||||
/// 使用后减少使用次数或删除物品
|
||||
/// </summary>
|
||||
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
|
||||
/// 当物品被玩家使用时
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <param name="times"></param>
|
||||
/// <param name="args"></param>
|
||||
/// <returns></returns>
|
||||
protected virtual bool OnItemUsed(User user, Dictionary<string, object> args)
|
||||
protected virtual bool OnItemUsed(User user, int times, Dictionary<string, object> args)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -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; }
|
||||
|
||||
@ -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 => "已完成",
|
||||
_ => "已过期"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user