// Set a social stat combobox's index based on retrieved protagonist stat value private void RetrieveSocialStat(Protagonist.Stat stat, short[] levelValues, ComboBox statbox) { short value = Protagonist.GetStat(stat); // Protagonist's value int index = 0; // Index of the selected combobox item // Iterate through each entry in the values array for (int i = 0; i < levelValues.Length; i++) { // If the protagonist's value is more than or equal to the current entry, increment the combobox index if (value >= levelValues[i]) { index++; } else // If not, then it is safe to exit the loop prematurely { break; } } // Set the combobox's item to index statbox.SelectedIndex = (index > 0) ? index - 1 : index; }
private void kindnessSet_Click(object sender, EventArgs e) { Protagonist.SetStat(Protagonist.Stat.Kindness, kindnessValues[kindnessInput.SelectedIndex]); }
private void gutsSet_Click(object sender, EventArgs e) { Protagonist.SetStat(Protagonist.Stat.Guts, gutsValues[gutsInput.SelectedIndex]); }
private void proficiencySet_Click(object sender, EventArgs e) { Protagonist.SetStat(Protagonist.Stat.Proficiency, proficiencyValues[proficiencyInput.SelectedIndex]); }
private void charmSet_Click(object sender, EventArgs e) { Protagonist.SetStat(Protagonist.Stat.Charm, charmValues[charmInput.SelectedIndex]); }
private void knowledgeSet_Click(object sender, EventArgs e) { Protagonist.SetStat(Protagonist.Stat.Knowledge, knowledgeValues[knowledgeInput.SelectedIndex]); }