24 [
Attribute(
"", UIWidgets.ResourceNamePicker,
"Layout",
"layout")]
25 ResourceName m_LayoutPath;
27 [
Attribute(
"2", UIWidgets.ComboBox,
"HUD Layer for the UI element to be placed in. Ignored when InfoDisplay is nested under another InfoDisplay.",
"", ParamEnumArray.FromEnum(
EHudLayers))]
30 [
Attribute(
"1", UIWidgets.CheckBox,
"Make UI element visible when it is created.")]
33 [
Attribute(
"0", UIWidgets.EditBox,
"Override the hierarchy to show display in front or behind other displays.")]
36 [
Attribute(
"", UIWidgets.EditBox,
"Name of slot in parent widget, the UI element is going to be placed in. Used when InfoDisplay is nested under another InfoDisplay.")]
40 [
Attribute(
"", UIWidgets.EditBox,
"Name of widget containing the GUI element content. Uses the root widget, if empty.")]
43 [
Attribute(
"0", UIWidgets.Slider,
"Adjustment to the content widget width. Can be used to provide a widget-specific padding.",
"-200 200 1")]
46 [
Attribute(
"0", UIWidgets.Slider,
"Adjustment to the content height width. Can be used to provide a widget-specific padding.",
"-200 200 1")]
50 [
Attribute(
"1", UIWidgets.CheckBox,
"Adjusts opacity of the widget based on level of ambient light.")]
53 [
Attribute(
"", UIWidgets.EditBox,
"Name of the widget in the layout the adaptive opacity is applied to. If empty, layout root is used.")]
84 if (handler.Type() == handlerType)
138 void Show(
bool show,
float speed =
UIConstants.FADE_RATE_INSTANT, EAnimationCurve curve = EAnimationCurve.LINEAR)
140 #ifdef DEBUG_ADAPTIVE_OPACITY
142 PrintFormat(
"%1 [Show] show: %2 | m_bShown: %3 | m_wSlot: %4",
this, show,
m_bShown,
m_wSlot);
156 float targetOpacity = show;
163 #ifdef DEBUG_ADAPTIVE_OPACITY
165 PrintFormat(
"%1 [Show] Opacity animation started: %2 -> %3",
this, w.GetOpacity(), targetOpacity);
168 WidgetAnimationOpacity anim = AnimateWidget.Opacity(w, targetOpacity, speed,
true);
172 anim.SetCurve(curve);
177 w.SetOpacity(targetOpacity);
184 #ifdef DEBUG_ADAPTIVE_OPACITY
186 PrintFormat(
"%1 [Show] Opacity insta-changed: %2 -> %3",
this, w.GetOpacity(), targetOpacity);
189 w.SetOpacity(targetOpacity);
201 float targetOpacity = anim.GetTargetValue();
202 Widget w = anim.GetWidget();
209 protected void OnShownFinished(Widget w,
float targetOpacity, WidgetAnimationOpacity anim =
null)
211 #ifdef DEBUG_INFO_DISPLAY
212 PrintFormat(
"[OnShownFinished] %1 | desired opacity: %2 (real opacity: %4) | shown: %3",
this, targetOpacity,
m_bShown, w.GetOpacity());
234 bool GetDimensions(out
float width, out
float height,
bool addSafezones =
true)
245 WorkspaceWidget workspace =
m_wContent.GetWorkspace();
246 width = workspace.DPIUnscale(width);
247 height = workspace.DPIUnscale(height);
280 WorkspaceWidget workspace =
m_wContent.GetWorkspace();
373 WorkspaceWidget wWorkspace =
GetGame().GetWorkspace();
402 #ifdef DEBUG_INFO_DISPLAY
403 PrintFormat(
"%1 [OnStartDraw] m_wRoot: %2",
this,
m_wRoot);
414 if (handler.m_bCanUpdate)
416 handler.Initialize(
this);
421 handler.OnStart(
this);
439 #ifdef DEBUG_ADAPTIVE_OPACITY
441 PrintFormat(
">> %1 >> AdaptiveOpacity_Initialize",
this);
448 PrintFormat(
"[AdaptiveOpacity] Duplicate AO disabled on info display %1. Parent display %2 already has AO enabled.",
this,
m_pParentDisplay);
477 #ifdef DEBUG_ADAPTIVE_OPACITY
479 PrintFormat(
"%1 [AdaptiveOpacity_Update] opacity: %2 | sceneBrightness: %3",
this, opacity, sceneBrightness);
490 WidgetAnimationOpacity animation = WidgetAnimationOpacity.Cast(AnimateWidget.GetAnimation(
m_wAdaptiveOpacity, WidgetAnimationOpacity));
494 float targetOpacity = animation.GetTargetValue();
497 if (targetOpacity < 0.01)
500 #ifdef DEBUG_ADAPTIVE_OPACITY
502 PrintFormat(
"%1 [AdaptiveOpacity_Update] Updated running opacity animation; target opacity %2 -> %3",
this, targetOpacity, opacity);
505 animation.SetTargetValue(opacity);
509 #ifdef DEBUG_ADAPTIVE_OPACITY
511 PrintFormat(
"%1 [AdaptiveOpacity_Update] %2 -> %3",
this,
m_wAdaptiveOpacity.GetOpacity(), opacity);
524 handler.OnStop(
this);
539 #ifdef DEBUG_INFO_DISPLAY
540 PrintFormat(
"%1 [OnStopDraw] m_wRoot: %2",
this,
m_wRoot);
547 protected override event void UpdateValues(IEntity owner,
float timeSlice)
551 if (handler.IsEnabled())
552 handler.OnUpdate(timeSlice);
557 protected override event void OnInit(IEntity owner)
566 SCR_InfoDisplay pInfoDisplay = SCR_InfoDisplay.Cast(pDisplay);
569 pInfoDisplay.m_pParentDisplay =
this;