private void UpdateChoice()
{
if(_updateStr.Count == 0)
{
return;
}
UpdateVariables(true);
_updateStr.Update();
if(_choiceType == 0)
{
// ChoiceType 0 stores current as an integer in either cvar or gui
// If both cvar and gui are defined then cvar wins, but they are both updated
if(_updateStr[0].NeedsUpdate == true)
{
if(_updateStr[0].ToString() == string.Empty)
{
_currentChoice = 0;
}
else
{
_currentChoice = Int32.Parse(_updateStr[0].ToString());
}
}
ValidateChoice();
}
else
{
// ChoiceType 1 stores current as a cvar string
int count = (_values.Count > 0) ? _values.Count : _choices.Count;
int i;
for(i = 0; i < count; i++)
{
if(_cvarStr.ToString().Equals((_values.Count > 0) ? _values[i] : _choices[i], StringComparison.OrdinalIgnoreCase) == true)
{
break;
}
}
if(i == count)
{
i = 0;
}
_currentChoice = i;
ValidateChoice();
}
}