Ejemplo n.º 1
0
 private void OnSecondsChanged()
 {
     if (SecondsChanged != null)
     {
         SecondsChanged.Invoke(milliseconds / MILLISECONDS_IN_SECOND);
     }
 }
 private void OnSecondsChanged()
 {
     if (SecondsChanged != null)
     {
         SecondsChanged.Invoke(thousanths / 10);
     }
 }
 private void OnSecondsChanged()
 {
     if (SecondsChanged != null)
     {
         //this line is incorrect.  Fix it! :)
         SecondsChanged.Invoke(milliseconds / MILLISECONDS_IN_SECOND);
     }
 }
Ejemplo n.º 4
0
 private void OnSecondsChanged()
 {
     if (SecondsChanged != null)
     {
         //this line is incorrect.  Fix it! :)
         SecondsChanged.Invoke(seconds);
     }
 }
Ejemplo n.º 5
0
        private void nudSeconds_ValueChanged(object sender, EventArgs e)
        {
            int      seconds = Decimal.ToInt32(nudSeconds.Value);
            TimeSpan ts      = new TimeSpan(this.Delay.Hours, this.Delay.Minutes, seconds);

            this.Delay = ts;

            SecondsChanged.Invoke(this, new EventArgs());
        }
Ejemplo n.º 6
0
        public OfflineTimer(string name, TimeSpan interval)
        {
            this.name     = name;
            this.interval = interval;
            Timer         = new CoroutineTimer().WithLoopTime(Convert.ToInt32(interval.TotalSeconds)).WithInfinityLoop();

            Timer.AllCompleted   += () => AllCompleted?.Invoke();
            Timer.TimesUp        += TimerOnTimesUp;
            Timer.SecondsChanged += (i) => SecondsChanged?.Invoke(i);
        }
Ejemplo n.º 7
0
        void Update(float deltaTime)
        {
            if (RemainTime <= 0)
            {
                return;
            }

            if (IsPaused)
            {
                return;
            }

            if (IsCompleted)
            {
                return;
            }

            RemainTime -= deltaTime;
            RemainTime  = Mathf.Max(0, RemainTime);

            var currentSeconds = Mathf.FloorToInt(RemainTime) + 1;
            var wasSeconds     = Mathf.FloorToInt(lastFrameTime) + 1;

            if (currentSeconds != wasSeconds)
            {
                SecondsChanged?.Invoke(currentSeconds);
            }

            if (RemainTime == 0)
            {
                SecondsChanged?.Invoke(0);
                TimesUp?.Invoke();

                if (LoopCount > 0)
                {
                    LoopCount--;
                }

                if (LoopCount != 0)
                {
                    RemainTime = time;
                }
                else
                {
                    Complete();
                }
            }

            lastFrameTime = RemainTime;
        }
Ejemplo n.º 8
0
 private void DurationControlNumericUpDownSeconds_ValueChanged(object sender, EventArgs e)
 {
     SecondsChanged?.Invoke(this, e);
     DurationChanged?.Invoke(this, e);
 }