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