DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
OptionSelectorSliderSetup.c
См. документацию.
2{
3 protected SliderWidget m_Slider;
4 protected float m_MinValue;
5 protected float m_MaxValue;
6
8 {
9 delete m_Root;
10 }
11
12 override void Enable()
13 {
14 super.Enable();
15
16 m_Slider.ClearFlags(WidgetFlags.IGNOREPOINTER);
17 }
18
19 override void Disable()
20 {
21 super.Disable();
22
23 m_Slider.SetFlags(WidgetFlags.IGNOREPOINTER);
24 }
25
26 override bool OnMouseEnter(Widget w, int x, int y)
27 {
28 if (m_ParentClass)
29 {
30 OnFocus(w, x, y);
31 m_ParentClass.OnFocus(m_Root.GetParent(), -1, m_SelectorType);
32 #ifdef PLATFORM_WINDOWS
33 m_ParentClass.OnMouseEnter(m_Root.GetParent().GetParent(), x, y);
35 #endif
36 }
37
38 return true;
39 }
40
41 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
42 {
43 if (m_ParentClass)
44 {
45 m_ParentClass.OnFocus(null, x, y);
46 #ifdef PLATFORM_WINDOWS
47 m_ParentClass.OnMouseLeave(m_Root.GetParent().GetParent(), enterW, x, y);
48 ColorNormal(w);
49 #endif
50 OnFocusLost(w, x, y);
51 SetFocus(null);
52 }
53
54 return true;
55 }
56
57 override bool OnMouseButtonUp(Widget w, int x, int y, int button)
58 {
59 if (button == MouseState.LEFT && w == m_Slider)
60 {
61 }
62 return false;
63 }
64
65 override bool OnChange(Widget w, int x, int y, bool finished)
66 {
67 if (w == m_Slider)
68 {
69 m_OptionChanged.Invoke(GetValue());
70 return true;
71 }
72 return false;
73 }
74
75 override bool IsFocusable(Widget w)
76 {
77 if (w)
78 {
79 return (w == m_Parent || w == m_Slider);
80 }
81 return false;
82 }
83
84 override bool OnFocus(Widget w, int x, int y)
85 {
86 #ifdef PLATFORM_CONSOLE
87 if (GetFocus() != m_Slider)
88 {
90 m_Parent.Enable(false);
91 }
92
93 return super.OnFocus(m_Parent, x, y);
94
95 #else
96 return false;
97 #endif
98 }
99
100 override bool OnFocusLost(Widget w, int x, int y)
101 {
102 if (w == m_Slider)
103 {
104 m_Parent.Enable(true);
105 return super.OnFocusLost(m_Parent, x, y);
106 }
107 return false;
108 }
109
110 float NormalizeInput(float value)
111 {
112 float ret = (value - m_MinValue) / (m_MaxValue - m_MinValue);
113 return ret;
114 }
115
116 void SetStep(float step)
117 {
118 m_Slider.SetStep(step);
119 }
120
121 void SetValue(float value, bool update = true)
122 {
123 value = Math.Round(value * 100) * 0.01;
124 m_Slider.SetCurrent(NormalizeInput(value));
125 if (update)
126 m_OptionChanged.Invoke(GetValue());
127 }
128
129 float GetValue()
130 {
131 float current = Math.Round(m_Slider.GetCurrent() * 100) * 0.01;
132 float ret = (current * (m_MaxValue - m_MinValue)) + m_MinValue;
133 return ret;
134 }
135
136 void SetMax(float max)
137 {
138 m_MaxValue = max;
139 }
140
141 override void ColorHighlight(Widget w)
142 {
143 if (!w)
144 return;
145
146 if (m_Slider)
147 {
149 m_Slider.SetColor(ARGB(255, 200, 0, 0));
150 }
151
152 super.ColorHighlight(w);
153 }
154
155 override void ColorNormal(Widget w)
156 {
157 if (!w)
158 return;
159
160 if (m_Slider)
161 {
162 m_Slider.SetColor(ARGB(140, 255, 255, 255));
163 }
164
165 super.ColorNormal(w);
166 }
167}
Icon x
Icon y
void ColorNormal(Widget w)
Определения ServerBrowserTab.c:681
void ColorHighlight(Widget w)
Определения ServerBrowserTab.c:632
Widget m_Root
Определения SizeToChild.c:91
Widget m_Parent
Определения SizeToChild.c:92
float GetValue()
Определения SyncedValue.c:55
Определения EnMath.c:7
void SetStep(float step)
Определения OptionSelectorSliderSetup.c:116
override bool OnFocus(Widget w, int x, int y)
Определения OptionSelectorSliderSetup.c:84
override bool OnChange(Widget w, int x, int y, bool finished)
Определения OptionSelectorSliderSetup.c:65
override bool IsFocusable(Widget w)
Определения OptionSelectorSliderSetup.c:75
override bool OnFocusLost(Widget w, int x, int y)
Определения OptionSelectorSliderSetup.c:100
override void ColorHighlight(Widget w)
Определения OptionSelectorSliderSetup.c:141
SliderWidget m_Slider
Определения OptionSelectorSliderSetup.c:3
override bool OnMouseEnter(Widget w, int x, int y)
Определения OptionSelectorSliderSetup.c:26
float NormalizeInput(float value)
Определения OptionSelectorSliderSetup.c:110
void SetValue(float value, bool update=true)
Определения OptionSelectorSliderSetup.c:121
override void Enable()
Определения OptionSelectorSliderSetup.c:12
override void ColorNormal(Widget w)
Определения OptionSelectorSliderSetup.c:155
override void Disable()
Определения OptionSelectorSliderSetup.c:19
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
Определения OptionSelectorSliderSetup.c:41
override bool OnMouseButtonUp(Widget w, int x, int y, int button)
Определения OptionSelectorSliderSetup.c:57
void SetMax(float max)
Определения OptionSelectorSliderSetup.c:136
void ~OptionSelectorSliderSetup()
Определения OptionSelectorSliderSetup.c:7
override bool OnFocusLost(Widget w, int x, int y)
Определения OptionSelectorSlider.c:176
override bool OnFocus(Widget w, int x, int y)
Определения OptionSelectorSlider.c:161
This Option Selector handles a Slider Marker, which basically has 2 sliders One slider is for selecti...
Определения OptionSelectorLevelMarker.c:7
Определения EnWidgets.c:190
static proto float Round(float f)
Returns mathematical round of value.
MouseState
Определения EnSystem.c:311
WidgetFlags
Определения EnWidgets.c:58
proto native Widget GetFocus()
proto native void SetFocus(Widget w)
int ARGB(int a, int r, int g, int b)
Определения proto.c:322