修复停止工作工作时间显示错误的问题

This commit is contained in:
ZouJin 2024-05-11 12:57:30 +08:00
parent b734966a35
commit 52e9695b93

View File

@ -68,6 +68,17 @@ namespace VPet_Simulator.Core
this.count = count * (1 + work.FinishBonus); this.count = count * (1 + work.FinishBonus);
this.spendtime = work.Time; this.spendtime = work.Time;
} }
/// <summary>
/// 完成工作信息
/// </summary>
/// <param name="work">当前工作</param>
/// <param name="count">当前盈利(自动计算附加)</param>
public FinishWorkInfo(Work work, double count, DateTime starttime)
{
this.work = work;
this.count = count * (1 + work.FinishBonus);
this.spendtime = DateTime.Now.Subtract(starttime).TotalMinutes;
}
} }
/// <summary> /// <summary>
/// UI相关显示 /// UI相关显示
@ -202,7 +213,7 @@ namespace VPet_Simulator.Core
{ {
if (m.State == Main.WorkingState.Work && m.NowWork != null) if (m.State == Main.WorkingState.Work && m.NowWork != null)
{ {
FinishWorkInfo fwi = new FinishWorkInfo(m.NowWork, GetCount); FinishWorkInfo fwi = new FinishWorkInfo(m.NowWork, GetCount, StartTime);
E_FinishWork?.Invoke(fwi); E_FinishWork?.Invoke(fwi);
} }
Visibility = Visibility.Collapsed; Visibility = Visibility.Collapsed;