Dayz 1.25
Dayz Code Explorer by KGB
Загрузка...
Поиск...
Не найдено
Класс OptionSelector

Защищенные члены

void OptionSelectorMultistate (Widget parent, int current_index, ScriptedWidgetEventHandler parent_c, bool disabled, notnull array< string > options)
 
void LoadNewValues (notnull array< string > options, int current_index)
 
override void SetNextOption ()
 
override void SetPrevOption ()
 
void PerformSetOption (int index)
 
void SetCanSwitch (bool value)
 
bool CanSwitch ()
 
void SetValue (int value, bool fire_event=true)
 
void SetValue (string value, bool fire_event=true)
 
void SetRandomValue ()
 
int GetValue ()
 
override void SetStringOption (string option, bool fire_event=true)
 

Защищенные данные

bool m_CanSwitch
 

Подробное описание

Методы

◆ CanSwitch()

bool CanSwitch ( )
inlineprotected
79 {
80 return m_CanSwitch;
81 }
bool m_CanSwitch
Definition OptionSelectorMultistate.c:3

Перекрестные ссылки m_CanSwitch.

◆ GetValue()

int GetValue ( )
inlineprotected
114 {
115 return m_SelectedOptionIndex;
116 }

◆ LoadNewValues()

void LoadNewValues ( notnull array< string > options,
int current_index )
inlineprotected
29 {
30 m_Options = options;
32 }
void SetValue(int value, bool fire_event=true)
Definition OptionSelectorMultistate.c:83
Definition EntityAI.c:95

Перекрестные ссылки SetValue().

◆ OptionSelectorMultistate()

void OptionSelectorMultistate ( Widget parent,
int current_index,
ScriptedWidgetEventHandler parent_c,
bool disabled,
notnull array< string > options )
inlineprotected
6 {
7 m_CanSwitch = true;
8
9 m_SelectorType = 2;
10 m_Options = options;
11 if (options.Count() == 0)
12 {
13 Error("Invalid OptionSelectorMultistate options");
14 }
15
16 if (current_index < 0 || current_index >= m_Options.Count())
17 {
18 m_SelectedOptionIndex = 0;
19 }
20 else
21 {
22 m_SelectedOptionIndex = current_index;
23 }
24
25 m_SelectedOption.SetText(m_Options.Get(m_SelectedOptionIndex));
26 }
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90

Перекрестные ссылки Error().

◆ PerformSetOption()

void PerformSetOption ( int index)
inlineprotected
67 {
68 m_SelectedOptionIndex = index;
69 m_SelectedOption.SetText(m_Options.Get(index));
70 m_OptionChanged.Invoke(index);
71 }

Используется в SetNextOption() и SetPrevOption().

◆ SetCanSwitch()

void SetCanSwitch ( bool value)
inlineprotected
74 {
76 }

◆ SetNextOption()

override void SetNextOption ( )
inlineprotected
35 {
36 int idx = m_SelectedOptionIndex;
37 idx++;
38 if (idx >= m_Options.Count())
39 {
40 idx = 0;
41 }
42
43 m_AttemptOptionChange.Invoke(idx);
44 if (m_CanSwitch)
45 {
47 }
48 }
void PerformSetOption(int index)
Definition OptionSelectorMultistate.c:66

Перекрестные ссылки PerformSetOption().

Используется в OptionSelectorBase::OnClick() и OptionSelectorBase::OnMouseButtonUp().

◆ SetPrevOption()

override void SetPrevOption ( )
inlineprotected
51 {
52 int idx = m_SelectedOptionIndex;
53 idx--;
54 if (idx < 0)
55 {
56 idx = m_Options.Count() - 1;
57 }
58
59 m_AttemptOptionChange.Invoke(idx);
60 if (m_CanSwitch)
61 {
63 }
64 }

Перекрестные ссылки PerformSetOption().

Используется в OptionSelectorBase::OnMouseButtonUp().

◆ SetRandomValue()

void SetRandomValue ( )
inlineprotected
107 {
108 m_SelectedOptionIndex = Math.RandomInt(0, m_Options.Count());
109 m_SelectedOption.SetText(m_Options.Get(m_SelectedOptionIndex));
110 m_OptionChanged.Invoke(m_SelectedOptionIndex);
111 }
Definition EnMath.c:7
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].

Перекрестные ссылки Math::RandomInt().

◆ SetStringOption()

override void SetStringOption ( string option,
bool fire_event = true )
inlineprotected
119 {
120 int index = m_Options.Find(option);
121 if (index > -1)
122 {
123 m_SelectedOptionIndex = index;
124 m_SelectedOption.SetText(m_Options.Get(m_SelectedOptionIndex));
125
126 if (fire_event)
127 m_OptionChanged.Invoke(m_SelectedOptionIndex);
128 }
129 }

◆ SetValue() [1/2]

void SetValue ( int value,
bool fire_event = true )
inlineprotected
84 {
85 if (value < m_Options.Count() && value >= 0)
86 {
87 m_SelectedOptionIndex = value;
88 m_SelectedOption.SetText(m_Options.Get(m_SelectedOptionIndex));
89 if (fire_event)
90 m_OptionChanged.Invoke(m_SelectedOptionIndex);
91 }
92 }

Используется в LoadNewValues().

◆ SetValue() [2/2]

void SetValue ( string value,
bool fire_event = true )
inlineprotected
95 {
96 int index = m_Options.Find(value);
97 if (index >= 0)
98 {
99 m_SelectedOptionIndex = index;
100 m_SelectedOption.SetText(m_Options.Get(m_SelectedOptionIndex));
101 if (fire_event)
102 m_OptionChanged.Invoke(m_SelectedOptionIndex);
103 }
104 }

Поля

◆ m_CanSwitch

bool m_CanSwitch
protected

Используется в CanSwitch().


Объявления и описания членов класса находятся в файле: