示例#1
0
        void Increment()
        {
            int amount;

            if (timerMode == TimerMode.Countdown)
            {
                amount = NEG_INCREMENT;
            }
            else
            {
                amount = POS_INCREMENT;
            }
            if (CheckSeconds())
            {
                ResetSeconds();
                minutes += amount;
            }
            if (CheckMinutes())
            {
                ResetMinutes();
                hours += amount;
            }
            if (CheckHours())
            {
                ResetHours();
                tmrUpdateTimer.Stop();
            }
            seconds += amount;
            if (CheckTimeLeft())
            {
                TimeExpired?.Invoke(this, new EventArgs());
            }
            UpdateLabel();
        }
示例#2
0
    void DecreaseBar()
    {
        timeLeftSeconds -= refreshUpdateSeconds;

        if (timeLeftSeconds <= 0)
        {
            CancelInvoke(nameof(DecreaseBar));
            TimeExpired?.Invoke();
        }

        timeBar.fillAmount = timeLeftSeconds / totalTimeSeconds;
        timeBar.color      = gradient.Evaluate(timeBar.fillAmount);
    }
示例#3
0
 public static void RaiseTimerExpired(TimerEventArgs e)
 {
     TimeExpired?.Invoke(null, e);
 }