DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ProfileOptionsUI.c
См. документацию.
1class ProfileOptionsUI extends ScriptedWidgetEventHandler
2{
4 {
5 Deattach();
6 }
7
8 void Attach(int profileOption, array<Widget> widget_array)
9 {
10 m_profileOption = profileOption;
12 m_widget_array = widget_array;
13
14 for (int i = 0; i < m_widget_array.Count(); i++)
15 {
16 m_widget = m_widget_array.Get(i);
17 if (m_widget)
18 {
19 m_widget.SetHandler(this);
20
21 Init();
22 }
23 }
24 }
25
26 void Deattach()
27 {
28 //m_profileOption = NULL;
29 if (m_widget_array && m_widget_array.Count() > 0)
30 {
31 for (int i = 0; i < m_widget_array.Count(); i++)
32 {
33 m_widget = m_widget_array.Get(i);
34 if (m_widget)
35 {
36 m_widget.SetHandler(NULL);
37 m_widget = NULL;
38 }
39 }
40 }
41 }
42
43 void Init()
44 {
45 int state;
46 ButtonWidget button;
47
48 if ( Class.CastTo(button, m_widget) )
49 {
50 state = m_widget_array.Find(m_widget);
51 button.SetState( g_Game.GetProfileOption(m_profileOption) == state ); //works for bool values only!!!
52 }
53 }
54
55 void SetValue()
56 {
57 int state;
58 ButtonWidget button;
59
60 if ( Class.CastTo(button, m_widget) )
61 {
62 state = m_widget_array.Find(m_widget);
63 SetButtonStates( state );
64 }
65 }
66
67 override bool OnClick(Widget w, int x, int y, int button)
68 {
69 super.OnClick(w, x, y, button);
70 m_widget = w;
71 SetValue();
72 return false;
73 }
74
75 //TODO check for unnescessary duplicate methods
76 void SetButtonStates(int index)
77 {
78 ButtonWidget button;
79 for (int i = 0; i < m_widget_array.Count(); i++)
80 {
81 button = ButtonWidget.Cast( m_widget_array.Get(i) );
82 if (button)
83 {
84 button.SetState( i == index );
85 }
86 }
87 }
88
93
95 {
96 return m_profileOption;
97 }
98
102}
DayZGame g_Game
Определения DayZGame.c:3868
Icon x
Icon y
Super root of all classes in Enforce script.
Определения EnScript.c:11
void SetButtonStates(int index)
Определения ProfileOptionsUI.c:76
void SetValue()
Определения ProfileOptionsUI.c:55
void Attach(int profileOption, array< Widget > widget_array)
Определения ProfileOptionsUI.c:8
ref array< Widget > m_widget_array
Определения ProfileOptionsUI.c:101
int GetProfileOption()
Определения ProfileOptionsUI.c:94
override bool OnClick(Widget w, int x, int y, int button)
Определения ProfileOptionsUI.c:67
void Init()
Определения MainMenuPromo.c:48
void ~ProfileOptionsUI()
Определения ProfileOptionsUI.c:3
array< Widget > GetWidgetArray()
Определения ProfileOptionsUI.c:89
void Deattach()
Определения ProfileOptionsUI.c:26
map: item x vector(index, width, height)
Определения EnWidgets.c:651
Определения EnWidgets.c:190
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.