| | 1 | | using DCL.SettingsCommon.SettingsControllers.BaseControllers; |
| | 2 | | using UnityEngine; |
| | 3 | |
|
| | 4 | | namespace DCL.SettingsCommon.SettingsControllers.SpecificControllers |
| | 5 | | { |
| | 6 | | [CreateAssetMenu(menuName = "Settings/Controllers/Controls/Hide UI", fileName = "HideUIControlController")] |
| | 7 | | public class HideUIControlController : ToggleSettingsControlController |
| | 8 | | { |
| | 9 | | public override void Initialize() |
| | 10 | | { |
| 2 | 11 | | base.Initialize(); |
| | 12 | |
|
| 2 | 13 | | CommonScriptableObjects.allUIHidden.OnChange += AllUIHiddenChanged; |
| 2 | 14 | | AllUIHiddenChanged(CommonScriptableObjects.allUIHidden.Get(), false); |
| 2 | 15 | | } |
| | 16 | |
|
| 2 | 17 | | public override object GetStoredValue() { return currentGeneralSettings.hideUI; } |
| | 18 | |
|
| | 19 | | public override void UpdateSetting(object newValue) |
| | 20 | | { |
| 2 | 21 | | currentGeneralSettings.hideUI = (bool)newValue; |
| 2 | 22 | | CommonScriptableObjects.allUIHidden.Set(currentGeneralSettings.hideUI); |
| 2 | 23 | | } |
| | 24 | |
|
| | 25 | | public override void OnDestroy() |
| | 26 | | { |
| 0 | 27 | | base.OnDestroy(); |
| | 28 | |
|
| 0 | 29 | | CommonScriptableObjects.allUIHidden.OnChange -= AllUIHiddenChanged; |
| 0 | 30 | | } |
| | 31 | |
|
| | 32 | | private void AllUIHiddenChanged(bool current, bool previous) |
| | 33 | | { |
| 10 | 34 | | currentGeneralSettings.hideUI = current; |
| 10 | 35 | | ApplySettings(); |
| 10 | 36 | | } |
| | 37 | | } |
| | 38 | | } |