private void NewTick(Timer _timer) { countdownDisplayValue = TimeManager.Instance.GetCountdownDisplayValue(DateTime.Now, endDate); UpdateUI(); if (DateTime.Compare(DateTime.Now, endDate) > 0) { timer.Stop(); OnCountdownEnded?.Invoke(); if (saveThisCountdown) { BinaryPrefs.SetString(buttonKey, endDate.ToString()); } } }
/// <summary> /// Reset the countdown, set the End Date to Now, trigger the OnEndWait event /// </summary> public void ResetCountdown() { SetEndDate(DateTime.Now); if (saveThisCountdown) { BinaryPrefs.SetString(buttonKey, endDate.ToString()); } timer.Stop(); waitForDelayExpired = false; if (saveThisCountdown) { BinaryPrefs.SetBool(buttonKey + waitForDelayExpiredKey, waitForDelayExpired); } OnCountdownEnded?.Invoke(); }