Show / Hide Table of Contents

Class PomodoroTimer

Our main class / component. Responsible for controlling the main timer logic, configuring settings, initializing, and manipulating our components.

Inheritance
System.Object
UnityEngine.Object
UnityEngine.Component
UnityEngine.Behaviour
UnityEngine.MonoBehaviour
PomodoroTimer
Implements
IColorHook
Namespace: AdrianMiasik
Assembly: Assembly-CSharp.dll
Syntax
public class PomodoroTimer : MonoBehaviour, IColorHook

Fields

| Improve this Doc View Source

CircleColor

Declaration
public static readonly int CircleColor
Field Value
Type Description
System.Int32
| Improve this Doc View Source

m_onRingPulse

A UnityEvent that gets invoked when the ring / timer alarm pulses.

Declaration
public UnityEvent m_onRingPulse
Field Value
Type Description
UnityEngine.Events.UnityEvent
| Improve this Doc View Source

m_onSpawnCompletion

A UnityEvent that gets invoked when the spawn animation is complete.

Declaration
[Header("Unity Events")]
public UnityEvent m_onSpawnCompletion
Field Value
Type Description
UnityEngine.Events.UnityEvent
| Improve this Doc View Source

m_onTimerCompletion

A UnityEvent that gets invoked when the timer finishes. (COMPLETE)

Declaration
public UnityEvent m_onTimerCompletion
Field Value
Type Description
UnityEngine.Events.UnityEvent
| Improve this Doc View Source

m_state

The timer's current state. See enum PomodoroTimer.States

Declaration
public PomodoroTimer.States m_state
Field Value
Type Description
PomodoroTimer.States

Methods

| Improve this Doc View Source

ActivateLongBreak()

Enables long break on our DigitFormat.

Declaration
public void ActivateLongBreak()
| Improve this Doc View Source

ClearSelection()

Removes any digit selection, and selects the background (our default selection).

Declaration
public void ClearSelection()
| Improve this Doc View Source

CloseSidebar()

Declaration
public void CloseSidebar()
| Improve this Doc View Source

ColorUpdate(Theme)

Applies our Theme changes to our referenced components when necessary.

Declaration
public void ColorUpdate(Theme theme)
Parameters
Type Name Description
Theme theme

The theme to apply on our referenced components.

| Improve this Doc View Source

ColorUpdateCreditsBubble()

Triggers a IColorHook ColorUpdate() on our CreditsGhost.

Declaration
public void ColorUpdateCreditsBubble()
| Improve this Doc View Source

ColorUpdateEndTimestampGhost()

Declaration
public void ColorUpdateEndTimestampGhost()
| Improve this Doc View Source

ConformCreditsBubbleToSidebar(Single, Single)

Positions our CreditsGhost to stay within the bounds of the sidebar.

Declaration
public void ConformCreditsBubbleToSidebar(float desiredWidthPercentage, float rightOffsetInPixels = -10F)
Parameters
Type Name Description
System.Single desiredWidthPercentage
System.Single rightOffsetInPixels
| Improve this Doc View Source

DeactivateLongBreak()

Disables long break on our DigitFormat. (Note: DigitFormat could still be in a work / break mode)

Declaration
public void DeactivateLongBreak()
| Improve this Doc View Source

FadeCreditsBubble(Boolean)

Fades in/out our credits bubble.

Declaration
public void FadeCreditsBubble(bool fadeIn)
Parameters
Type Name Description
System.Boolean fadeIn

Do you want the credits bubble to fade in? (Providing False will make the credit's bubble fade out.)

| Improve this Doc View Source

GetConfirmDialogManager()

Declaration
[Obsolete]
public ConfirmationDialogManager GetConfirmDialogManager()
Returns
Type Description
ConfirmationDialogManager
| Improve this Doc View Source

GetCurrentTime()

Declaration
public double GetCurrentTime()
Returns
Type Description
System.Double
| Improve this Doc View Source

GetDigitFormatIndex()

Returns our currently selected DigitFormat.SupportedFormats's index value.

Declaration
public int GetDigitFormatIndex()
Returns
Type Description
System.Int32

A number representing our enum index. See DigitFormat.SupportedFormats

| Improve this Doc View Source

GetSelections()

Returns a list of our current selected element. Will return a list of UnityEngine.UI.Selectable's, not specifically DoubleDigit's.

Declaration
public List<Selectable> GetSelections()
Returns
Type Description
System.Collections.Generic.List<UnityEngine.UI.Selectable>
| Improve this Doc View Source

GetSystemSettings()

Declaration
public SystemSettings GetSystemSettings()
Returns
Type Description
SystemSettings
| Improve this Doc View Source

GetTheme()

Declaration
public Theme GetTheme()
Returns
Type Description
Theme
| Improve this Doc View Source

GetTimerSettings()

Declaration
public TimerSettings GetTimerSettings()
Returns
Type Description
TimerSettings
| Improve this Doc View Source

GetTimerString()

Returns our current timer values in a System.String. Such as "00:24:35" (without the quotation marks)

Declaration
public string GetTimerString()
Returns
Type Description
System.String

Our current timer value.

| Improve this Doc View Source

GetTomatoCount()

Declaration
public int GetTomatoCount()
Returns
Type Description
System.Int32
| Improve this Doc View Source

GetTomatoProgress()

Declaration
public int GetTomatoProgress()
Returns
Type Description
System.Int32
| Improve this Doc View Source

GetTranslucentImageSource()

Declaration
public TranslucentImageSource GetTranslucentImageSource()
Returns
Type Description
LeTai.Asset.TranslucentImage.TranslucentImageSource
| Improve this Doc View Source

HasTomatoProgression()

Does this timer currently have any pomodoro/tomato progression?

Declaration
public bool HasTomatoProgression()
Returns
Type Description
System.Boolean
| Improve this Doc View Source

HaveComponentsBeenInitialized()

Declaration
public bool HaveComponentsBeenInitialized()
Returns
Type Description
System.Boolean
| Improve this Doc View Source

HideOverlay()

Declaration
public void HideOverlay()
| Improve this Doc View Source

IfSetupTriggerRebuild()

Triggers a rebuild of our timer if we are in SETUP mode. Intended when in long break mode and you wipe tomato progress.

Declaration
public void IfSetupTriggerRebuild()
| Improve this Doc View Source

IsAboutPageOpen()

Is our AboutPage currently open and visible?

Declaration
public bool IsAboutPageOpen()
Returns
Type Description
System.Boolean
| Improve this Doc View Source

IsMainContentOpen()

Is our timer / digit format currently open and visible?

Declaration
public bool IsMainContentOpen()
Returns
Type Description
System.Boolean
| Improve this Doc View Source

IsOnBreak()

Is our DigitFormat in break mode?

Declaration
public bool IsOnBreak()
Returns
Type Description
System.Boolean
| Improve this Doc View Source

IsOnLongBreak()

Is our DigitFormat in long break mode?

Declaration
public bool IsOnLongBreak()
Returns
Type Description
System.Boolean
| Improve this Doc View Source

IsSidebarOpen()

Is our Sidebar currently open and visible?

Declaration
public bool IsSidebarOpen()
Returns
Type Description
System.Boolean
| Improve this Doc View Source

OnDestroy()

Unity's OnDestroy(). Deregisters self from Theme on destruction.

Declaration
public void OnDestroy()
| Improve this Doc View Source

Pause()

Transitions timer into States.PAUSED mode

Declaration
public void Pause()
| Improve this Doc View Source

Play()

Transitions timer into States.RUNNING mode

Declaration
public void Play()
| Improve this Doc View Source

PlaySpawnAnimation()

Plays our timer spawning animation. Used as a UnityEvent

Declaration
public void PlaySpawnAnimation()
| Improve this Doc View Source

ResetCreditsBubbleSidebarConformity()

Positions our CreditsGhost back to it's original position. (Not conforming to the sidebar)

Declaration
public void ResetCreditsBubbleSidebarConformity()
| Improve this Doc View Source

Restart(Boolean)

Directly toggles the timer mode to it's opposite mode (break/work) and transitions timer into States.SETUP. Note: If you want to verify this action, TryRestart(Boolean). TryRestart(Boolean) will prompt the user with a confirmation dialog if necessary.

Declaration
public void Restart(bool isCompleted)
Parameters
Type Name Description
System.Boolean isCompleted
| Improve this Doc View Source

SelectAll()

Selects all the digits in our DigitFormat.

Declaration
public void SelectAll()
| Improve this Doc View Source

SetAlarmSound(AudioClip, Boolean)

Declaration
public void SetAlarmSound(AudioClip alarmSound, bool attemptAlarmSoundPreview)
Parameters
Type Name Description
UnityEngine.AudioClip alarmSound
System.Boolean attemptAlarmSoundPreview
| Improve this Doc View Source

SetBackgroundNavigation(Navigation)

Sets our background's selection navigation to the provided UnityEngine.UI.Navigation. Intended to change focus to our digits when attempting to select left / right from the background.

Declaration
public void SetBackgroundNavigation(Navigation backgroundNav)
Parameters
Type Name Description
UnityEngine.UI.Navigation backgroundNav
| Improve this Doc View Source

SetCurrentTime(Single)

Changes the current timer to the provided value. Intended to be used by our Media Creator.

Declaration
public void SetCurrentTime(float currentTimeInSeconds)
Parameters
Type Name Description
System.Single currentTimeInSeconds
| Improve this Doc View Source

SetPomodoroCount(Int32, Int32)

Declaration
public void SetPomodoroCount(int desiredPomodoroCount, int pomodoroProgress)
Parameters
Type Name Description
System.Int32 desiredPomodoroCount
System.Int32 pomodoroProgress
| Improve this Doc View Source

SetSelection(DoubleDigit)

Sets the selection to a single DoubleDigit and calculates text visibility based on new selection data. If you'd like to select multiple digits: See AdrianMiasik.PomodoroTimer.AddSelection(AdrianMiasik.Components.Core.Items.DoubleDigit).

Declaration
public void SetSelection(DoubleDigit currentDigit)
Parameters
Type Name Description
DoubleDigit currentDigit
| Improve this Doc View Source

SetSettingLongBreaks(Boolean)

Sets the users setting preference to enable/disable long breaks.

Declaration
public void SetSettingLongBreaks(bool state = true)
Parameters
Type Name Description
System.Boolean state

Do you want the user to be able to collect tomatoes/pomodoros and unlock the long break mode?

Remarks

Intended to be used as a UnityEvent. Otherwise you can directly do this on the public property in the settings object.

| Improve this Doc View Source

SetTimerValue(String)

Sets our DigitFormat timer to the provided string. Intended to be used when pasting values in from our clipboard. This will only work if the timer is in SETUP mode.

Declaration
public void SetTimerValue(string timeString)
Parameters
Type Name Description
System.String timeString
| Improve this Doc View Source

ShowAbout()

Shows about content, hides main content, and shows credits bubble.

Declaration
public void ShowAbout()
| Improve this Doc View Source

ShowMainContent()

Shows main content, hides info, and hides credits bubble

Declaration
public void ShowMainContent()
| Improve this Doc View Source

ShowOverlay()

Declaration
public void ShowOverlay()
| Improve this Doc View Source

ShowSettings()

Declaration
public void ShowSettings()
| Improve this Doc View Source

ShowTickAnimation()

Declaration
public void ShowTickAnimation()
| Improve this Doc View Source

ShutdownSteamManager()

Declaration
public void ShutdownSteamManager()
| Improve this Doc View Source

Skip()

Completes the current running timer so the user can move on to the next one. Intended to be used as a UnityEvent on the Skip button.

Declaration
public void Skip()
| Improve this Doc View Source

SwitchState(PomodoroTimer.States)

Switches the timer to the provided state and handles all visual changes. Basically handles our transitions between timer states. PomodoroTimer.States

Declaration
public void SwitchState(PomodoroTimer.States desiredState)
Parameters
Type Name Description
PomodoroTimer.States desiredState

The state you want to transition to

| Improve this Doc View Source

SwitchTimer(Boolean)

Declaration
public void SwitchTimer(bool isOnBreak)
Parameters
Type Name Description
System.Boolean isOnBreak
| Improve this Doc View Source

TriggerPlayPause()

Presses the play/pause button.

Declaration
public void TriggerPlayPause()
| Improve this Doc View Source

TriggerThemeSwitch()

Presses the boolean slider to toggle between light/dark themes.

Declaration
public void TriggerThemeSwitch()
| Improve this Doc View Source

TriggerTimerRestart()

Presses the restart button.

Declaration
public void TriggerTimerRestart()
| Improve this Doc View Source

TriggerTimerSwitch()

Presses the boolean slider to toggle between our DigitFormat to work/break mode.

Declaration
public void TriggerTimerSwitch()
| Improve this Doc View Source

TryCancelConfirmationDialog()

Declaration
public void TryCancelConfirmationDialog()
| Improve this Doc View Source

TryChangeFormat(DigitFormat.SupportedFormats)

Attempts to change our DigitFormat to the provided DigitFormat.SupportedFormats, will prompt user with confirmation dialog if necessary.

Declaration
public void TryChangeFormat(DigitFormat.SupportedFormats desiredFormat)
Parameters
Type Name Description
DigitFormat.SupportedFormats desiredFormat
| Improve this Doc View Source

TryRestart(Boolean)

Attempts to restart the timer, will prompt user with confirmation dialog if necessary.

Declaration
public void TryRestart(bool isComplete)
Parameters
Type Name Description
System.Boolean isComplete
| Improve this Doc View Source

TrySubmitConfirmationDialog()

Declaration
public void TrySubmitConfirmationDialog()
| Improve this Doc View Source

TrySwitchToBreakTimer()

Attempts to transition timer into SETUP and sets our DigitFormat to break mode, will prompt user with confirmation dialog if necessary. Used as a UnityEngine.Events.UnityEvent on our timer switch.

Declaration
public void TrySwitchToBreakTimer()
| Improve this Doc View Source

TrySwitchToWorkTimer()

Attempts to transition timer into SETUP and sets our DigitFormat to work mode, will prompt user with confirmation dialog if necessary. Used as a UnityEngine.Events.UnityEvent on our timer switch.

Declaration
public void TrySwitchToWorkTimer()

Implements

IColorHook
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX