示例#1
0
        private void TimerOnTimesUp()
        {
            TimesUp?.Invoke();
            TimesUpAtTime?.Invoke(DateTime.Now);

            PlayerPrefsX.SetDateTime(name, DateTime.Now);
            PlayerPrefs.Save();
        }
示例#2
0
        public void Start()
        {
            var lastActionTime = PlayerPrefsX.GetDateTime(name);

            var intervalCounter = new IntervalCounter(
                lastActionTime,
                DateTime.Now,
                interval
                );

            PlayerPrefsX.SetDateTime(name, intervalCounter.LastIntervalTime);
            PlayerPrefs.Save();

            foreach (var time in intervalCounter.AsTimeCollection())
            {
                TimesUpAtTime?.Invoke(time);
            }

            Timer.MoveToTime(Convert.ToInt32(intervalCounter.TimeToNextInterval.TotalSeconds));
            Timer.Start();
        }