Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
optionselectorslidersetup.c
Go to the documentation of this file.
1
class
OptionSelectorSliderSetup
extends
OptionSelectorBase
2
{
3
protected
SliderWidget
m_Slider
;
4
protected
float
m_MinValue
;
5
protected
float
m_MaxValue
;
6
7
void
~OptionSelectorSliderSetup
()
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
);
34
ColorHighlight
(w);
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
{
89
SetFocus
(
m_Slider
);
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
float
normalizeValue =
NormalizeInput
(value);
124
float
step =
m_Slider
.GetStep();
125
126
normalizeValue =
Math
.
Round
(normalizeValue / step) * step;
127
m_Slider
.SetCurrent(normalizeValue);
128
if
(update)
129
m_OptionChanged.Invoke(
GetValue
());
130
}
131
132
float
GetValue
()
133
{
134
float
current =
m_Slider
.GetCurrent();
135
float
ret = (current * (
m_MaxValue
-
m_MinValue
)) +
m_MinValue
;
136
return
ret;
137
}
138
139
void
SetMax
(
float
max)
140
{
141
m_MaxValue
= max;
142
}
143
144
override
void
ColorHighlight
(
Widget
w)
145
{
146
if
(!w)
147
return
;
148
149
if
(
m_Slider
)
150
{
151
SetFocus
(
m_Slider
);
152
m_Slider
.SetColor(
ARGB
(255, 200, 0, 0));
153
}
154
155
super.ColorHighlight(w);
156
}
157
158
override
void
ColorNormal
(
Widget
w)
159
{
160
if
(!w)
161
return
;
162
163
if
(
m_Slider
)
164
{
165
m_Slider
.SetColor(
ARGB
(140, 255, 255, 255));
166
}
167
168
super.ColorNormal(w);
169
}
170
}
m_Parent
Entity m_Parent
Definition
cachedequipmentstoragebase.c:15
Math
Definition
enmath.c:7
OptionSelectorBase
Definition
optionselector.c:2
OptionSelectorBase::IsFocusable
override bool IsFocusable(Widget w)
Definition
optionselectorslidersetup.c:75
OptionSelectorBase::OnChange
override bool OnChange(Widget w, int x, int y, bool finished)
Definition
optionselectorslidersetup.c:65
OptionSelectorBase::Disable
override void Disable()
Definition
optionselectorslidersetup.c:19
OptionSelectorBase::m_MaxValue
float m_MaxValue
Definition
optionselectorslidersetup.c:5
OptionSelectorBase::NormalizeInput
float NormalizeInput(float value)
Definition
optionselectorslidersetup.c:110
OptionSelectorBase::OnMouseLeave
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
Definition
optionselectorslidersetup.c:41
OptionSelectorBase::SetMax
void SetMax(float max)
Definition
optionselectorslidersetup.c:139
OptionSelectorBase::SetValue
void SetValue(float value, bool update=true)
Definition
optionselectorslidersetup.c:121
OptionSelectorBase::GetValue
float GetValue()
Definition
optionselectorslidersetup.c:132
OptionSelectorBase::m_Slider
SliderWidget m_Slider
Definition
optionselectorslidersetup.c:3
OptionSelectorBase::m_MinValue
float m_MinValue
Definition
optionselectorslidersetup.c:4
OptionSelectorBase::Enable
override void Enable()
Definition
optionselectorslidersetup.c:12
OptionSelectorBase::ColorNormal
override void ColorNormal(Widget w)
Definition
optionselectorslidersetup.c:158
OptionSelectorBase::~OptionSelectorSliderSetup
void ~OptionSelectorSliderSetup()
Definition
optionselectorslidersetup.c:7
OptionSelectorBase::OnFocusLost
override bool OnFocusLost(Widget w, int x, int y)
Definition
optionselectorslidersetup.c:100
OptionSelectorBase::OnMouseEnter
override bool OnMouseEnter(Widget w, int x, int y)
Definition
optionselectorslidersetup.c:26
OptionSelectorBase::SetStep
void SetStep(float step)
Definition
optionselectorslidersetup.c:116
OptionSelectorBase::OnFocus
override bool OnFocus(Widget w, int x, int y)
Definition
optionselectorslidersetup.c:84
OptionSelectorBase::OnMouseButtonUp
override bool OnMouseButtonUp(Widget w, int x, int y, int button)
Definition
optionselectorslidersetup.c:57
OptionSelectorBase::ColorHighlight
override void ColorHighlight(Widget w)
Definition
optionselectorslidersetup.c:144
OptionSelectorSliderSetup
This Option Selector handles a Slider Marker, which basically has 2 sliders One slider is for selecti...
Definition
optionselectorlevelmarker.c:7
OptionSelectorSliderSetup::OnFocusLost
override bool OnFocusLost(Widget w, int x, int y)
Definition
optionselectorslider.c:176
OptionSelectorSliderSetup::OnFocus
override bool OnFocus(Widget w, int x, int y)
Definition
optionselectorslider.c:161
Widget
Definition
enwidgets.c:190
Math::Round
static proto float Round(float f)
Returns mathematical round of value.
MouseState
MouseState
Definition
ensystem.c:311
WidgetFlags
WidgetFlags
Definition
enwidgets.c:58
GetFocus
proto native Widget GetFocus()
SetFocus
proto native void SetFocus(Widget w)
x
Icon x
y
Icon y
ColorNormal
void ColorNormal(Widget w)
Definition
newscarousel.c:312
ColorHighlight
void ColorHighlight(Widget w)
Definition
newscarousel.c:307
ARGB
int ARGB(int a, int r, int g, int b)
Definition
proto.c:322
m_Root
Widget m_Root
Definition
sizetochild.c:91
GetValue
float GetValue()
Definition
syncedvalue.c:55
Games
Dayz
scripts
5_mission
gui
newui
optionselectorslidersetup.c
Generated by
1.17.0