mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-18 10:10:45 +08:00
chore: 自定义基建配置时间仍在有效期内时不检查其他时间段
This commit is contained in:
@@ -605,6 +605,22 @@ public class InfrastSettingsUserControlModel : TaskViewModel
|
||||
}
|
||||
|
||||
var now = DateTime.Now;
|
||||
|
||||
if (CustomInfrastPlanIndex >= CustomInfrastPlanInfoList.Count || CustomInfrastPlanIndex < 0)
|
||||
{
|
||||
CustomInfrastPlanIndex = 0;
|
||||
}
|
||||
|
||||
var currentPlan = CustomInfrastPlanInfoList.First(p => p.Index == CustomInfrastPlanIndex);
|
||||
foreach (var period in currentPlan.PeriodList)
|
||||
{
|
||||
if (TimeLess(period.BeginHour, period.BeginMinute, now.Hour, now.Minute) &&
|
||||
TimeLess(now.Hour, now.Minute, period.EndHour, period.EndMinute))
|
||||
{
|
||||
return; // 当前 index 仍在有效时间内,不需要切换
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var plan in CustomInfrastPlanInfoList.Where(
|
||||
plan => plan.PeriodList.Any(
|
||||
period => TimeLess(period.BeginHour, period.BeginMinute, now.Hour, now.Minute) &&
|
||||
@@ -614,11 +630,6 @@ public class InfrastSettingsUserControlModel : TaskViewModel
|
||||
return;
|
||||
}
|
||||
|
||||
if (CustomInfrastPlanIndex >= CustomInfrastPlanList.Count || CustomInfrastPlanList.Count < 0)
|
||||
{
|
||||
CustomInfrastPlanIndex = 0;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
static bool TimeLess(int lHour, int lMin, int rHour, int rMin) => (lHour != rHour) ? (lHour < rHour) : (lMin <= rMin);
|
||||
|
||||
Reference in New Issue
Block a user