mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-15 17:30:27 +08:00
refactor: 优化鱼人节判断方法
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// <copyright file="DateTimeExtension.cs" company="MaaAssistantArknights">
|
||||
// <copyright file="DateTimeExtension.cs" company="MaaAssistantArknights">
|
||||
// MaaWpfGui - A part of the MaaCoreArknights project
|
||||
// Copyright (C) 2021 MistEO and Contributors
|
||||
//
|
||||
@@ -50,5 +50,10 @@ namespace MaaWpfGui.Extensions
|
||||
{
|
||||
return dt.ToString("yyyy/MM/dd HH:mm:ss", DateTimeFormatInfo.InvariantInfo);
|
||||
}
|
||||
|
||||
public static bool IsAprilFoolsDay(this DateTime dt)
|
||||
{
|
||||
return dt.Month == 4 && dt.Day == 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2633,19 +2633,13 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
}
|
||||
}
|
||||
|
||||
public static bool AprilFoolsDay()
|
||||
{
|
||||
var yjDate = DateTime.UtcNow.ToYJDate();
|
||||
return yjDate.Month == 4 && yjDate.Day == 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Did you buy wine?
|
||||
/// </summary>
|
||||
/// <returns>The answer.</returns>
|
||||
public bool DidYouBuyWine()
|
||||
{
|
||||
if (AprilFoolsDay())
|
||||
if (DateTime.UtcNow.ToYJDate().IsAprilFoolsDay())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
UpdateStageList(true);
|
||||
RefreshCustonInfrastPlan();
|
||||
|
||||
if (SettingsViewModel.AprilFoolsDay())
|
||||
if (DateTime.UtcNow.ToYJDate().IsAprilFoolsDay())
|
||||
{
|
||||
AddLog(LocalizationHelper.GetString("BuyWineOnAprilFoolsDay"), UiLogColor.Info);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user