3 protected bool m_CanSwitch;
11 if (options.Count() == 0)
13 Error(
"Invalid OptionSelectorMultistate options");
16 if (current_index < 0 || current_index >= m_Options.Count())
18 m_SelectedOptionIndex = 0;
22 m_SelectedOptionIndex = current_index;
25 m_SelectedOption.SetText(m_Options.Get(m_SelectedOptionIndex));
28 void LoadNewValues(notnull
array<string> options,
int current_index)
36 int idx = m_SelectedOptionIndex;
38 if (idx >= m_Options.Count())
43 m_AttemptOptionChange.Invoke(idx);
46 PerformSetOption(idx);
52 int idx = m_SelectedOptionIndex;
56 idx = m_Options.Count() - 1;
59 m_AttemptOptionChange.Invoke(idx);
62 PerformSetOption(idx);
66 void PerformSetOption(
int index)
68 m_SelectedOptionIndex = index;
69 m_SelectedOption.SetText(m_Options.Get(index));
70 m_OptionChanged.Invoke(index);
73 void SetCanSwitch(
bool value)
83 void SetValue(
int value,
bool fire_event =
true)
85 if (value < m_Options.Count() && value >= 0)
87 m_SelectedOptionIndex = value;
88 m_SelectedOption.SetText(m_Options.Get(m_SelectedOptionIndex));
90 m_OptionChanged.Invoke(m_SelectedOptionIndex);
94 void SetValue(
string value,
bool fire_event =
true)
96 int index = m_Options.Find(value);
99 m_SelectedOptionIndex = index;
100 m_SelectedOption.SetText(m_Options.Get(m_SelectedOptionIndex));
102 m_OptionChanged.Invoke(m_SelectedOptionIndex);
108 m_SelectedOptionIndex =
Math.RandomInt(0, m_Options.Count());
109 m_SelectedOption.SetText(m_Options.Get(m_SelectedOptionIndex));
110 m_OptionChanged.Invoke(m_SelectedOptionIndex);
115 return m_SelectedOptionIndex;
120 int index = m_Options.Find(option);
123 m_SelectedOptionIndex = index;
124 m_SelectedOption.SetText(m_Options.Get(m_SelectedOptionIndex));
127 m_OptionChanged.Invoke(m_SelectedOptionIndex);
149 m_SelectedOption.SetText(
"#str_cfgvehicles_survivorM0");
151 else if (value ==
"Female")
153 m_SelectedOption.SetText(
"#str_cfgvehicles_survivorF0");
155 else if (appendix !=
"")
158 m_SelectedOption.SetText(
"NO ITEM - localization needed!");
160 m_SelectedOption.SetText(
"" +
displayname +
" " + appendix);
170 if (value ==
"Male" || value ==
"Female")
177 int index = m_Options.Find(value);
201 string child = value;
203 while (
GetGame().ConfigGetBaseName(
"cfgVehicles " + child, parent))
205 if (parent == baseclass)
216 super.SetNextOption();
222 super.SetPrevOption();
226 override void SetValue(
int value,
bool fire_event =
true)
228 super.SetValue(value,fire_event);
232 override void SetValue(
string value,
bool fire_event =
true)
234 super.SetValue(value,fire_event);
240 super.SetRandomValue();
246 super.SetStringOption(option, fire_event);