| | 1 | | using DCL; |
| | 2 | | using DCL.SettingsCommon.SettingsControllers.BaseControllers; |
| | 3 | | using UnityEngine; |
| | 4 | |
|
| | 5 | | namespace MainScripts.DCL.Controllers.Settings.SettingsControllers.SpecificControllers |
| | 6 | | { |
| | 7 | | [CreateAssetMenu(menuName = "Settings/Controllers/Controls/Adult Content", fileName = "AdultContentControlController |
| | 8 | | public class AdultContentControlController : ToggleSettingsControlController |
| | 9 | | { |
| | 10 | | public override void Initialize() |
| | 11 | | { |
| 1 | 12 | | base.Initialize(); |
| 1 | 13 | | CommonScriptableObjects.adultContentSettingDeactivated.Set(!DataStore.i.featureFlags.flags.Get().IsFeatureEn |
| 1 | 14 | | DataStore.i.contentModeration.adultContentAgeConfirmationResult.OnChange += OnAdultContentAgeConfirmationRes |
| 1 | 15 | | DataStore.i.contentModeration.adultContentSettingEnabled.Set(currentGeneralSettings.adultContent, false); |
| 1 | 16 | | } |
| | 17 | |
|
| | 18 | | public override void OnDestroy() |
| | 19 | | { |
| 0 | 20 | | DataStore.i.contentModeration.adultContentAgeConfirmationResult.OnChange -= OnAdultContentAgeConfirmationRes |
| 0 | 21 | | base.OnDestroy(); |
| 0 | 22 | | } |
| | 23 | |
|
| | 24 | | public override object GetStoredValue() => |
| 1 | 25 | | currentGeneralSettings.adultContent; |
| | 26 | |
|
| | 27 | | public override void UpdateSetting(object newValue) |
| | 28 | | { |
| 1 | 29 | | var value = (bool) newValue; |
| | 30 | |
|
| 1 | 31 | | if (value) |
| 0 | 32 | | DataStore.i.contentModeration.adultContentAgeConfirmationVisible.Set(true, true); |
| | 33 | | else |
| | 34 | | { |
| 1 | 35 | | currentGeneralSettings.adultContent = false; |
| 1 | 36 | | DataStore.i.contentModeration.adultContentSettingEnabled.Set(false, true); |
| | 37 | | } |
| 1 | 38 | | } |
| | 39 | |
|
| | 40 | | private void OnAdultContentAgeConfirmationResultChanged(DataStore_ContentModeration.AdultContentAgeConfirmationR |
| | 41 | | { |
| 0 | 42 | | if (result == DataStore_ContentModeration.AdultContentAgeConfirmationResult.Accepted) |
| | 43 | | { |
| 0 | 44 | | currentGeneralSettings.adultContent = true; |
| 0 | 45 | | DataStore.i.contentModeration.adultContentSettingEnabled.Set(true, true); |
| 0 | 46 | | ApplySettings(); |
| | 47 | | } |
| | 48 | | else |
| 0 | 49 | | RaiseToggleValueChanged(false); |
| 0 | 50 | | } |
| | 51 | | } |
| | 52 | | } |