Exemple #1
0
    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);
        }
    }
Exemple #2
0
    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);
        }
    }
Exemple #3
0
 public static int GetInt(string strName, float strDefault)
 {
     return((int)ConVar.GetFloat(strName, strDefault));
 }