| | 1 | | using DCL.SettingsCommon.SettingsControllers.BaseControllers; |
| | 2 | | using UnityEngine; |
| | 3 | |
|
| | 4 | | namespace DCL.SettingsControls |
| | 5 | | { |
| | 6 | | [CreateAssetMenu(menuName = "Settings/Controllers/Controls/Skybox Time", fileName = "SkyboxTime")] |
| | 7 | | public class SkyboxTimeControlController : SliderSettingsControlController |
| | 8 | | { |
| | 9 | | public override void Initialize() |
| | 10 | | { |
| 1 | 11 | | base.Initialize(); |
| 1 | 12 | | UpdateSetting(currentGeneralSettings.skyboxTime); |
| 1 | 13 | | } |
| | 14 | |
|
| 1 | 15 | | public override object GetStoredValue() { return currentGeneralSettings.skyboxTime; } |
| | 16 | |
|
| | 17 | | public override void UpdateSetting(object newValue) |
| | 18 | | { |
| 2 | 19 | | float valueAsFloat = (float)newValue; |
| | 20 | |
|
| 2 | 21 | | valueAsFloat = Mathf.Clamp(valueAsFloat, 0, 23.998f); |
| | 22 | |
|
| 2 | 23 | | currentGeneralSettings.skyboxTime = valueAsFloat; |
| 2 | 24 | | DataStore.i.skyboxConfig.fixedTime.Set(valueAsFloat); |
| 2 | 25 | | int hourSection = (int)valueAsFloat; |
| 2 | 26 | | float minuteSection = valueAsFloat - hourSection; |
| 2 | 27 | | minuteSection = minuteSection * 60; |
| 2 | 28 | | minuteSection = (int)minuteSection; |
| | 29 | |
|
| 2 | 30 | | string sliderTxt = hourSection.ToString("00") + ":" + minuteSection.ToString("00"); |
| | 31 | |
|
| 2 | 32 | | RaiseOnIndicatorLabelChange(sliderTxt); |
| 2 | 33 | | } |
| | 34 | | } |
| | 35 | | } |