public void UpdateFromConVar() { dfSlider component = base.GetComponent <dfSlider>(); if (component != null) { component.Value = ConVar.GetFloat(this.convarName, component.Value); } dfDropdown _dfDropdown = base.GetComponent <dfDropdown>(); if (_dfDropdown != null) { if (!this.useValuesNotNumbers) { int num = ConVar.GetInt(this.convarName, -1f); if (num != -1) { _dfDropdown.SelectedIndex = num; } } else { string str = ConVar.GetString(this.convarName, string.Empty); if (!string.IsNullOrEmpty(str)) { int selectedIndex = _dfDropdown.SelectedIndex; _dfDropdown.SelectedValue = str; if (_dfDropdown.SelectedIndex == -1) { _dfDropdown.SelectedIndex = selectedIndex; } } } } dfCheckbox flag = base.GetComponent <dfCheckbox>(); if (flag != null) { flag.IsChecked = ConVar.GetBool(this.convarName, flag.IsChecked); } }
public void UpdateFromConVar() { dfSlider component = base.GetComponent <dfSlider>(); if (component != null) { component.Value = ConVar.GetFloat(this.convarName, component.Value); } dfDropdown dropdown = base.GetComponent <dfDropdown>(); if (dropdown != null) { if (this.useValuesNotNumbers) { string str = ConVar.GetString(this.convarName, string.Empty); if (!string.IsNullOrEmpty(str)) { int selectedIndex = dropdown.SelectedIndex; dropdown.SelectedValue = str; if (dropdown.SelectedIndex == -1) { dropdown.SelectedIndex = selectedIndex; } } } else { int @int = ConVar.GetInt(this.convarName, -1f); if (@int != -1) { dropdown.SelectedIndex = @int; } } } dfCheckbox checkbox = base.GetComponent <dfCheckbox>(); if (checkbox != null) { checkbox.IsChecked = ConVar.GetBool(this.convarName, checkbox.IsChecked); } }
protected internal override void OnClick(dfMouseEventArgs args) { if (this.@group != null) { dfCheckbox[] componentsInChildren = base.transform.parent.GetComponentsInChildren <dfCheckbox>(); for (int i = 0; i < (int)componentsInChildren.Length; i++) { dfCheckbox _dfCheckbox = componentsInChildren[i]; if (_dfCheckbox != this && _dfCheckbox.GroupContainer == this.GroupContainer && _dfCheckbox.IsChecked) { _dfCheckbox.IsChecked = false; } } this.IsChecked = true; } else { this.IsChecked = !this.IsChecked; } args.Use(); base.OnClick(args); }
public bool GetStringValueFromControl(out string value) { dfSlider component = base.GetComponent <dfSlider>(); if (component != null) { value = component.Value.ToString(); return(true); } dfDropdown _dfDropdown = base.GetComponent <dfDropdown>(); if (!_dfDropdown) { dfCheckbox _dfCheckbox = base.GetComponent <dfCheckbox>(); if (!_dfCheckbox) { value = string.Empty; return(false); } value = (!_dfCheckbox.IsChecked ? bool.FalseString : bool.TrueString); return(true); } int selectedIndex = _dfDropdown.SelectedIndex; if (selectedIndex == -1) { value = string.Empty; return(false); } if (!this.useValuesNotNumbers) { value = selectedIndex.ToString(); } else { value = _dfDropdown.SelectedValue; } return(true); }
private void Awake() { audio = this; cb = GetComponent<dfCheckbox>(); }
void Start() { cb = GetComponent<dfCheckbox>(); }