public override void Load(SessionIdleCheckerComponent self)
        {
            RepeatedTimer repeatedTimer = TimerComponent.Instance.GetRepeatedTimer(self.RepeatedTimer);

            if (repeatedTimer != null)
            {
                repeatedTimer.Callback = self.Check;
            }
        }
Beispiel #2
0
        /// <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    = EntityFactory.CreateWithParent <RepeatedTimer, long, Action <bool> >(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);
 }