Class DigitFormat
A ThemeElement used primarily for generating and managing our DoubleDigit's and DigitSeparator's components. Includes support for multiple layouts: See DigitFormat.SupportedFormats.
Inheritance
Implements
Namespace: AdrianMiasik.Components.Core.Containers
Assembly: Assembly-CSharp.dll
Syntax
public class DigitFormat : ThemeElement, IColorHook
Fields
| Improve this Doc View Sourcem_isOnBreak
Is this digit format on break?
False
then this digit format is in work mode. If True
this digit format is either
on break / or on a long break.
Declaration
public bool m_isOnBreak
Field Value
Type | Description |
---|---|
System.Boolean |
m_isOnLongBreak
Is this digit format on a long break?
Declaration
public bool m_isOnLongBreak
Field Value
Type | Description |
---|---|
System.Boolean |
Methods
| Improve this Doc View SourceActivateLongBreak()
Sets this digit format to be using the long break dataset. (work / break / long break)
Declaration
public void ActivateLongBreak()
CanDecrementOne(DigitFormat.Digits)
Returns True
if you can subtract one from this digit without hitting it's floor, otherwise returns
False
.
Declaration
public bool CanDecrementOne(DigitFormat.Digits digit)
Parameters
Type | Name | Description |
---|---|---|
DigitFormat.Digits | digit | The DigitFormat.Digits you want to check if it can be decremented by one. |
Returns
Type | Description |
---|---|
System.Boolean |
CanIncrementOne(DigitFormat.Digits)
Returns True
if you can add one to this digit without hitting it's ceiling, otherwise returns False
.
Declaration
public bool CanIncrementOne(DigitFormat.Digits digit)
Parameters
Type | Name | Description |
---|---|---|
DigitFormat.Digits | digit | The DigitFormat.Digits you want to check if it can be decremented by one. |
Returns
Type | Description |
---|---|
System.Boolean |
ClearTimerSelection()
Clears our digit selection and sets the selection to the Background (our default).
Declaration
public void ClearTimerSelection()
ColorUpdate(Theme)
Applies our Theme changes to our components when necessary.
Declaration
public override void ColorUpdate(Theme theme)
Parameters
Type | Name | Description |
---|---|---|
Theme | theme |
Overrides
| Improve this Doc View SourceCorrectTickAnimVisuals()
Prevents all our digits tick animation from holding, especially useful for when the gameobjects are no longer active and need to be re-enabled (Such as switching between pages).
Declaration
[ContextMenu("Correct Tick Animation")]
public void CorrectTickAnimVisuals()
DeactivateLongBreak()
Sets this digit to be using the break dataset. (work / break / long break)
Declaration
public void DeactivateLongBreak()
DecrementOne(DigitFormat.Digits)
Decrements the provided digit by one. (-1)
Declaration
public void DecrementOne(DigitFormat.Digits digits)
Parameters
Type | Name | Description |
---|---|---|
DigitFormat.Digits | digits |
FlipIsOnBreakBool()
Flips our break boolean from True to False and vice versa.
Declaration
public void FlipIsOnBreakBool()
GenerateFormat()
Generates/creates our digit format using DoubleDigit's and DigitSeparator's. See SwitchFormat(DigitFormat.SupportedFormats) if you'd like to change your preferred DigitFormat.SupportedFormats, then invoke this function again to generate your new preferred format.
Declaration
[ContextMenu("Generate Format")]
public void GenerateFormat()
GetDigits()
Returns our list of generated DoubleDigit's
Declaration
public List<DoubleDigit> GetDigits()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<DoubleDigit> |
GetDigitValue(DigitFormat.Digits)
Returns the provided DigitFormat.Digits value.
Declaration
public int GetDigitValue(DigitFormat.Digits digit)
Parameters
Type | Name | Description |
---|---|---|
DigitFormat.Digits | digit |
Returns
Type | Description |
---|---|
System.Int32 |
GetFormatIndex()
Return the current format index
Declaration
public int GetFormatIndex()
Returns
Type | Description |
---|---|
System.Int32 |
GetPreviousFormatSelection()
Returns the previously selected format index
Declaration
public int GetPreviousFormatSelection()
Returns
Type | Description |
---|---|
System.Int32 |
GetTime()
Returns the users own set times (depending on the state, you could get one of three datasets: work / break / long break)
Declaration
public TimeSpan GetTime()
Returns
Type | Description |
---|---|
System.TimeSpan |
GetTimerState()
Returns PomodoroTimer's current state. (See: PomodoroTimer.States)
Declaration
public PomodoroTimer.States GetTimerState()
Returns
Type | Description |
---|---|
PomodoroTimer.States |
GetTimerString()
Returns our current timer values in a System.String.
Declaration
public string GetTimerString()
Returns
Type | Description |
---|---|
System.String | Our current timer value. |
Hide()
Disables this gameobject.
Declaration
public void Hide()
IncrementOne(DigitFormat.Digits)
Increments the provided digit by one. (+1)
Declaration
public void IncrementOne(DigitFormat.Digits digits)
Parameters
Type | Name | Description |
---|---|---|
DigitFormat.Digits | digits |
Initialize(PomodoroTimer, DigitFormat.SupportedFormats, Boolean)
Switches then generates the provided digit format and updates all relevant ThemeElement components.
Declaration
public void Initialize(PomodoroTimer pomodoroTimer, DigitFormat.SupportedFormats startingFormat, bool updateColors = true)
Parameters
Type | Name | Description |
---|---|---|
PomodoroTimer | pomodoroTimer | |
DigitFormat.SupportedFormats | startingFormat | |
System.Boolean | updateColors |
Initialize(PomodoroTimer, Boolean)
Switches then generates our preferred digit format and updating the relevant components using the current active Theme.
Declaration
public override void Initialize(PomodoroTimer pomodoroTimer, bool updateColors = true)
Parameters
Type | Name | Description |
---|---|---|
PomodoroTimer | pomodoroTimer | |
System.Boolean | updateColors |
Overrides
| Improve this Doc View SourceInitializeRuntimeCaret()
Declaration
public void InitializeRuntimeCaret()
Lock()
Prevents our generated DoubleDigit's to be interacted with.
Declaration
public void Lock()
RefreshDigitVisuals()
Updates our generated DoubleDigit's using our cached values and hides our increment and decrement arrows.
Declaration
public void RefreshDigitVisuals()
ResetTextPositions()
Moves all our generated DoubleDigit's into their default viewport positions and anchors.
Declaration
public void ResetTextPositions()
SetDigit(DigitFormat.Digits, Int32)
Sets the provided digit to it's provided new value.
Declaration
public void SetDigit(DigitFormat.Digits digit, int newValue)
Parameters
Type | Name | Description |
---|---|---|
DigitFormat.Digits | digit | |
System.Int32 | newValue |
SetDigitColor(Color)
Sets the color of our generated DoubleDigit's to the provided color.
Declaration
public void SetDigitColor(Color newColor)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.Color | newColor | The color you want to set all our DoubleDigit's to. |
SetTime(TimeSpan)
Sets the generated DoubleDigit's to the provided System.TimeSpan.
Declaration
public void SetTime(TimeSpan ts)
Parameters
Type | Name | Description |
---|---|---|
System.TimeSpan | ts |
SetTimerSelection(DoubleDigit)
Sets the PomodoroTimer's selection to the provided DoubleDigit.
Declaration
public void SetTimerSelection(DoubleDigit digitToSelect)
Parameters
Type | Name | Description |
---|---|---|
DoubleDigit | digitToSelect |
SetTimerValue(String)
Sets the value of the timer using the provided formatted string.
Declaration
public void SetTimerValue(string formattedString)
Parameters
Type | Name | Description |
---|---|---|
System.String | formattedString | Expected format of "00:25:00" (Without the quotation marks). |
Show()
Enables this gameobject.
Declaration
public void Show()
ShowTickAnimation()
Declaration
public void ShowTickAnimation()
ShowTime(TimeSpan)
Sets the generated DoubleDigit's text label to the provided System.TimeSpan.
Declaration
public void ShowTime(TimeSpan ts)
Parameters
Type | Name | Description |
---|---|---|
System.TimeSpan | ts | The System.TimeSpan you want to display to the user. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException |
SwitchFormat(DigitFormat.SupportedFormats)
Switches your format to the provided format.
Declaration
public void SwitchFormat(DigitFormat.SupportedFormats desiredFormat)
Parameters
Type | Name | Description |
---|---|---|
DigitFormat.SupportedFormats | desiredFormat |
Unlock()
Allows our generated DoubleDigit's to be interacted with.
Declaration
public void Unlock()