From 1168f5dd7b4a97ce7afc9d729fb061dfbe601e67 Mon Sep 17 00:00:00 2001 From: milimoe Date: Wed, 8 Jan 2025 01:48:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BB=BB=E5=8A=A1=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Entity/System/Quest.cs | 29 +++++++++++++++++++---------- Library/Constant/TypeEnum.cs | 7 +++++++ 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/Entity/System/Quest.cs b/Entity/System/Quest.cs index e65bcd0..3c57a3a 100644 --- a/Entity/System/Quest.cs +++ b/Entity/System/Quest.cs @@ -12,20 +12,29 @@ namespace Milimoe.FunGame.Core.Entity public Dictionary Awards { get; set; } = []; public DateTime? StartTime { get; set; } = null; public DateTime? SettleTime { get; set; } = null; + public QuestType QuestType { get; set; } = QuestType.Continuous; + public int Progress { get; set; } = 0; + public int MaxProgress { get; set; } = 100; public override string ToString() { + string progressString = ""; + if (QuestType == QuestType.Progressive) + { + progressString = $"\r\n当前进度:{Progress}/{MaxProgress}"; + } + return $"{Id}. {Name}\r\n" + - $"{Description}\r\n" + - $"需要时间:{EstimatedMinutes} 分钟\r\n" + - (StartTime.HasValue ? $"开始时间:{StartTime.Value.ToString(General.GeneralDateTimeFormatChinese)}" + - (Status == QuestState.InProgress ? - $"\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)}" : ""); + $"{Description}\r\n" + + (QuestType == QuestType.Continuous ? $"需要时间:{EstimatedMinutes} 分钟\r\n" : "") + + (StartTime.HasValue ? $"开始时间:{StartTime.Value.ToString(General.GeneralDateTimeFormatChinese)}" + + (Status == QuestState.InProgress && QuestType == QuestType.Continuous ? + $"\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()}" + progressString + + (SettleTime.HasValue ? $"\r\n结算时间:{SettleTime.Value.ToString(General.GeneralDateTimeFormatChinese)}" : ""); } private string GetStatus() diff --git a/Library/Constant/TypeEnum.cs b/Library/Constant/TypeEnum.cs index 84f7bdd..403fe17 100644 --- a/Library/Constant/TypeEnum.cs +++ b/Library/Constant/TypeEnum.cs @@ -802,4 +802,11 @@ namespace Milimoe.FunGame.Core.Library.Constant MySQL, SQLite } + + public enum QuestType + { + Continuous, + Immediate, + Progressive + } }