Class PomodoroTimer
Our main class / component. Responsible for controlling the main timer logic, configuring settings, initializing, and manipulating our components.
Inheritance
Implements
Namespace: AdrianMiasik
Assembly: Assembly-CSharp.dll
Syntax
public class PomodoroTimer : MonoBehaviour, IColorHook
Fields
| Improve this Doc View SourceCircleColor
Declaration
public static readonly int CircleColor
Field Value
| Type | Description |
|---|---|
| System.Int32 |
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 |
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 |
m_onTimerCompletion
A UnityEvent that gets invoked when the timer finishes. (COMPLETE)
Declaration
public UnityEvent m_onTimerCompletion
Field Value
| Type | Description |
|---|---|
| UnityEngine.Events.UnityEvent |
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 SourceActivateLongBreak()
Enables long break on our DigitFormat.
Declaration
public void ActivateLongBreak()
ClearSelection()
Removes any digit selection, and selects the background (our default selection).
Declaration
public void ClearSelection()
CloseSidebar()
Declaration
public void CloseSidebar()
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. |
ColorUpdateCreditsBubble()
Triggers a IColorHook ColorUpdate() on our CreditsGhost.
Declaration
public void ColorUpdateCreditsBubble()
ColorUpdateEndTimestampGhost()
Declaration
public void ColorUpdateEndTimestampGhost()
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 |
DeactivateLongBreak()
Disables long break on our DigitFormat. (Note: DigitFormat could still be in a work / break mode)
Declaration
public void DeactivateLongBreak()
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 |
GetConfirmDialogManager()
Declaration
[Obsolete]
public ConfirmationDialogManager GetConfirmDialogManager()
Returns
| Type | Description |
|---|---|
| ConfirmationDialogManager |
GetCurrentTime()
Declaration
public double GetCurrentTime()
Returns
| Type | Description |
|---|---|
| System.Double |
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 |
GetSelections()
Returns a list of our current selected element.
Declaration
public List<Selectable> GetSelections()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.List<UnityEngine.UI.Selectable> |
GetSystemSettings()
Declaration
public SystemSettings GetSystemSettings()
Returns
| Type | Description |
|---|---|
| SystemSettings |
GetTheme()
Declaration
public Theme GetTheme()
Returns
| Type | Description |
|---|---|
| Theme |
GetTimerSettings()
Declaration
public TimerSettings GetTimerSettings()
Returns
| Type | Description |
|---|---|
| TimerSettings |
GetTimerString()
Returns our current timer values in a System.String.
Declaration
public string GetTimerString()
Returns
| Type | Description |
|---|---|
| System.String | Our current timer value. |
GetTomatoCount()
Declaration
public int GetTomatoCount()
Returns
| Type | Description |
|---|---|
| System.Int32 |
GetTomatoProgress()
Declaration
public int GetTomatoProgress()
Returns
| Type | Description |
|---|---|
| System.Int32 |
GetTranslucentImageSource()
Declaration
public TranslucentImageSource GetTranslucentImageSource()
Returns
| Type | Description |
|---|---|
| LeTai.Asset.TranslucentImage.TranslucentImageSource |
HasTomatoProgression()
Does this timer currently have any pomodoro/tomato progression?
Declaration
public bool HasTomatoProgression()
Returns
| Type | Description |
|---|---|
| System.Boolean |
HaveComponentsBeenInitialized()
Declaration
public bool HaveComponentsBeenInitialized()
Returns
| Type | Description |
|---|---|
| System.Boolean |
HideOverlay()
Declaration
public void HideOverlay()
IfSetupTriggerRebuild()
Triggers a rebuild of our timer if we are in SETUP mode.
Declaration
public void IfSetupTriggerRebuild()
IsAboutPageOpen()
Is our AboutPage currently open and visible?
Declaration
public bool IsAboutPageOpen()
Returns
| Type | Description |
|---|---|
| System.Boolean |
IsMainContentOpen()
Is our timer / digit format currently open and visible?
Declaration
public bool IsMainContentOpen()
Returns
| Type | Description |
|---|---|
| System.Boolean |
IsOnBreak()
Is our DigitFormat in break mode?
Declaration
public bool IsOnBreak()
Returns
| Type | Description |
|---|---|
| System.Boolean |
IsOnLongBreak()
Is our DigitFormat in long break mode?
Declaration
public bool IsOnLongBreak()
Returns
| Type | Description |
|---|---|
| System.Boolean |
IsSidebarOpen()
Is our Sidebar currently open and visible?
Declaration
public bool IsSidebarOpen()
Returns
| Type | Description |
|---|---|
| System.Boolean |
OnDestroy()
Unity's OnDestroy(). Deregisters self from Theme on destruction.
Declaration
public void OnDestroy()
Pause()
Transitions timer into States.PAUSED mode
Declaration
public void Pause()
Play()
Transitions timer into States.RUNNING mode
Declaration
public void Play()
PlaySpawnAnimation()
Plays our timer spawning animation.
Declaration
public void PlaySpawnAnimation()
ResetCreditsBubbleSidebarConformity()
Positions our CreditsGhost back to it's original position. (Not conforming to the sidebar)
Declaration
public void ResetCreditsBubbleSidebarConformity()
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 |
SelectAll()
Selects all the digits in our DigitFormat.
Declaration
public void SelectAll()
SetAlarmSound(AudioClip, Boolean)
Declaration
public void SetAlarmSound(AudioClip alarmSound, bool attemptAlarmSoundPreview)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityEngine.AudioClip | alarmSound | |
| System.Boolean | attemptAlarmSoundPreview |
SetBackgroundNavigation(Navigation)
Sets our background's selection navigation to the provided UnityEngine.UI.Navigation.
Declaration
public void SetBackgroundNavigation(Navigation backgroundNav)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityEngine.UI.Navigation | backgroundNav |
SetCurrentTime(Single)
Changes the current timer to the provided value.
Declaration
public void SetCurrentTime(float currentTimeInSeconds)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | currentTimeInSeconds |
SetPomodoroCount(Int32, Int32)
Declaration
public void SetPomodoroCount(int desiredPomodoroCount, int pomodoroProgress)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | desiredPomodoroCount | |
| System.Int32 | pomodoroProgress |
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 |
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.
SetTimerValue(String)
Sets our DigitFormat timer to the provided string. Intended to be used when pasting
values in from our clipboard.
Declaration
public void SetTimerValue(string timeString)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | timeString |
ShowAbout()
Shows about content, hides main content, and shows credits bubble.
Declaration
public void ShowAbout()
ShowMainContent()
Shows main content, hides info, and hides credits bubble
Declaration
public void ShowMainContent()
ShowOverlay()
Declaration
public void ShowOverlay()
ShowSettings()
Declaration
public void ShowSettings()
ShowTickAnimation()
Declaration
public void ShowTickAnimation()
ShutdownSteamManager()
Declaration
public void ShutdownSteamManager()
Skip()
Completes the current running timer so the user can move on to the next one.
Declaration
public void Skip()
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 |
SwitchTimer(Boolean)
Declaration
public void SwitchTimer(bool isOnBreak)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | isOnBreak |
TriggerPlayPause()
Presses the play/pause button.
Declaration
public void TriggerPlayPause()
TriggerThemeSwitch()
Presses the boolean slider to toggle between light/dark themes.
Declaration
public void TriggerThemeSwitch()
TriggerTimerRestart()
Presses the restart button.
Declaration
public void TriggerTimerRestart()
TriggerTimerSwitch()
Presses the boolean slider to toggle between our DigitFormat to work/break mode.
Declaration
public void TriggerTimerSwitch()
TryCancelConfirmationDialog()
Declaration
public void TryCancelConfirmationDialog()
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 |
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 |
TrySubmitConfirmationDialog()
Declaration
public void TrySubmitConfirmationDialog()
TrySwitchToBreakTimer()
Attempts to transition timer into SETUP and sets our DigitFormat to break
mode, will prompt user with confirmation dialog if necessary.
Declaration
public void TrySwitchToBreakTimer()
TrySwitchToWorkTimer()
Attempts to transition timer into SETUP and sets our DigitFormat to work
mode, will prompt user with confirmation dialog if necessary.
Declaration
public void TrySwitchToWorkTimer()