| | 1 | | using DCL.Components; |
| | 2 | | using System.Collections; |
| | 3 | | using System.Collections.Generic; |
| | 4 | | using UnityEngine; |
| | 5 | | using UnityEngine.UI; |
| | 6 | |
|
| | 7 | | public class SmartItemBooleanParameterAdapter : SmartItemUIParameterAdapter |
| | 8 | | { |
| | 9 | | public Toggle boolParameterToggle; |
| | 10 | |
|
| 0 | 11 | | private void Start() { boolParameterToggle.onValueChanged.AddListener(OnValueChange); } |
| | 12 | |
|
| | 13 | | public override void SetInfo() |
| | 14 | | { |
| 0 | 15 | | base.SetInfo(); |
| | 16 | |
|
| 0 | 17 | | boolParameterToggle.gameObject.SetActive(true); |
| | 18 | |
|
| 0 | 19 | | if (bool.TryParse(GetParameterValue().ToString(), out bool defaultParameter)) |
| 0 | 20 | | boolParameterToggle.isOn = defaultParameter; |
| 0 | 21 | | } |
| | 22 | |
|
| 0 | 23 | | public void OnValueChange(bool value) { SetParameterValue(value); } |
| | 24 | | } |