using System;
using System.Collections.Generic;
using asap.core;
using cfg;
using game;
using GameCore;
namespace Activity.Condition
{
///
/// 时间条件检查器
///
public class TimeConditionChecker : IConditionChecker
{
public int Priority => 10;
public List CareDataChangeWithType => null;
public bool NeedContinueListenAfterSatisfied => true;
public bool CanOpen(FishingEvent fishingEvent)
{
var now = ZZTimeHelper.UtcNow();
return fishingEvent.TimeDefinition switch
{
LimitedTime limitedTime =>
GlobalUtils.TryParseDateTime(limitedTime.StartTime, now) <= now &&
now < GlobalUtils.TryParseDateTime(limitedTime.EndTime, now),
UserRegistration userReg =>
GContext.container.Resolve().CreateTotalSeconds() >= userReg.StartTime &&
GContext.container.Resolve().CreateTotalSeconds() < userReg.EndTime,
FixedTime =>
GContext.container.Resolve().FixedTimeEventExpired(fishingEvent.ID),
_ => true
};
}
}
}