/// <summary> /// 创建一个RepeatedTimer /// </summary> /// <param name="time"></param> /// <param name="action"></param> /// <returns></returns> public long NewRepeatedTimer(long time, Action <bool> action) { if (time < 30) { throw new Exception($"repeated time < 30"); } long tillTime = TimeHelper.Now() + time; RepeatedTimer timer = TimerFactory.Create <RepeatedTimer, long, Action <bool> >(time, action); this.timers[timer.InstanceId] = timer; AddToTimeId(tillTime, timer.InstanceId); return(timer.InstanceId); }
/// <summary> /// 创建一个RepeatedTimer /// </summary> /// <param name="time"></param> /// <param name="action"></param> /// <returns></returns> public long NewRepeatedTimer(long time, Action action) { if (time < 30) { throw new Exception($"repeated time < 30"); } long tillTime = TimeHelper.Now() + time; RepeatedTimer timer = EntityFactory.CreateWithParent <RepeatedTimer, long, Action>(this, time, action); this.timers[timer.Id] = timer; AddToTimeId(tillTime, timer.Id); return(timer.Id); }
public override void Awake(RepeatedTimer self, long repeatedTime, Action <bool> callback) { self.Awake(repeatedTime, callback); }