7 protected float m_fMaxSliderValue;
8 protected float m_fDefaultValue =
float.MAX;
10 protected bool m_bIsTimeSlider;
14 protected bool m_bAlwaysHideSeconds;
19 Widget sliderWidgetLibary = w.FindAnyWidget(m_sUiComponentName);
20 if (!sliderWidgetLibary)
return;
23 if (!m_SliderWidgetComponent)
29 array<ref SCR_BaseEditorAttributeEntry> entries =
new array<ref SCR_BaseEditorAttributeEntry>;
30 attribute.GetEntries(entries);
32 foreach (SCR_BaseEditorAttributeEntry entry: entries)
37 m_bIsTimeSlider =
true;
38 timeSlider.GetTimeSliderValues(m_eHideIfZero, m_bAlwaysHideSeconds);
46 SetSliderSettings(var, m_SliderData);
53 m_fDefaultValue = defaultValue.GetDefaultFloatValue();
58 super.Init(w, attribute);
64 m_SliderData = sliderData;
67 m_SliderData.GetSliderMinMaxStep(min, m_fMaxSliderValue, step);
68 m_SliderWidgetComponent.SetSliderSettings(min, m_fMaxSliderValue, step, m_SliderData.GetSliderValueFormating());
70 if (m_fDefaultValue ==
float.MAX)
71 m_fDefaultValue = m_fMaxSliderValue;
77 m_SliderWidgetComponent.SetValue(m_fDefaultValue);
78 m_SliderWidgetComponent.ShowCustomValue(GetSliderValueText(m_fDefaultValue));
81 var.SetFloat(m_fDefaultValue);
86 super.SetFromVar(var);
91 float value = var.GetFloat();
93 m_SliderWidgetComponent.SetValue(value);
94 m_SliderWidgetComponent.ShowCustomValue(GetSliderValueText(value));
95 OnChange(
null, 0, 0,
false);
97 if (value > m_fMaxSliderValue)
98 PrintFormat(
"%1 attribute slider is set to '%2' but can only support up to '%3'", GetAttribute().
GetUIInfo().
GetName(), value.ToString(), m_fMaxSliderValue.ToString());
102 override bool OnChange(Widget w,
int x,
int y,
bool finished)
112 float value = m_SliderWidgetComponent.GetValue();
113 m_SliderWidgetComponent.ShowCustomValue(GetSliderValueText(value));
115 if (var.GetFloat() == value)
119 super.OnChange(w, x, y, finished);
124 protected string GetSliderValueText(
float value)
128 if (!m_bIsTimeSlider)
130 return m_SliderData.GetText(value);
135 if (!m_bAlwaysHideSeconds)
142 return "MISSING m_SliderData!";