diff --git a/Entity/System/Quest.cs b/Entity/System/Quest.cs index fa6a174..08be89c 100644 --- a/Entity/System/Quest.cs +++ b/Entity/System/Quest.cs @@ -1,22 +1,36 @@ -namespace Milimoe.FunGame.Core.Entity +using Milimoe.FunGame.Core.Interface.Entity; +using Milimoe.FunGame.Core.Library.Constant; + +namespace Milimoe.FunGame.Core.Entity { - public class Quest() + public class Quest : BaseEntity { - public int Id { get; set; } = 0; - public string Name { get; set; } = ""; public string Description { get; set; } = ""; public int EstimatedMinutes { get; set; } = 0; public int Status { get; set; } = 0; public int CharacterIndex { get; set; } = 0; public Dictionary Awards { get; set; } = []; + public DateTime? StartTime { get; set; } = null; + public DateTime? SettleTime { get; set; } = null; public override string ToString() { return $"{Id}. {Name}\r\n" + $"{Description}\r\n" + $"需要时间:{EstimatedMinutes} 分钟\r\n" + - $"奖励:{string.Join(",", Awards.Select(kv=> kv.Key + " * " + kv.Value))}\r\n" + - $"是否完成:{GetStatus()}"; + (StartTime.HasValue ? $"开始时间:{StartTime.Value.ToString(General.GeneralDateTimeFormatChinese)}" + + (Status == 1 ? + $"\r\n预计在 {Math.Max(Math.Round((StartTime.Value.AddMinutes(EstimatedMinutes) - DateTime.Now).TotalMinutes, MidpointRounding.ToPositiveInfinity), 1)} 分钟后完成" : "") + + "\r\n" + : "") + + $"完成奖励:{string.Join(",", Awards.Select(kv=> kv.Key + " * " + kv.Value))}\r\n" + + $"任务状态:{GetStatus()}" + + (SettleTime.HasValue ? $"\r\n结算时间:{SettleTime.Value.ToString(General.GeneralDateTimeFormatChinese)}" : ""); + } + + public string GetIdName() + { + return Id + "." + Name; } private string GetStatus() @@ -29,5 +43,10 @@ _ => "未开始" }; } + + public override bool Equals(IBaseEntity? other) + { + return other is Quest && other.Id == Id; + } } }