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))]
31 private bool m_bShowWhenCreated;
33 [
Attribute(
"0",
UIWidgets.EditBox,
"Override the hierarchy to show display in front or behind other displays.")]
34 int m_iOverrideZOrder;
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.")]
51 private bool m_bAdaptiveOpacity;
53 [
Attribute(
"",
UIWidgets.EditBox,
"Name of the widget in the layout the adaptive opacity is applied to. If empty, layout root is used.")]
59 private Widget m_wAdaptiveOpacity;
60 private float m_fAdaptiveOpacity = 1;
84 if (handler.Type() == handlerType)
140 #ifdef DEBUG_ADAPTIVE_OPACITY
141 if (this.
Type() == SCR_AvailableActionsDisplay)
156 float targetOpacity = show;
158 if (show && m_wAdaptiveOpacity && m_wAdaptiveOpacity == w)
159 targetOpacity = m_fAdaptiveOpacity;
163 #ifdef DEBUG_ADAPTIVE_OPACITY
164 if (this.
Type() == SCR_AvailableActionsDisplay)
165 PrintFormat(
"%1 [Show] Opacity animation started: %2 -> %3",
this, w.GetOpacity(), targetOpacity);
172 anim.SetCurve(curve);
173 anim.GetOnCompleted().Insert(OnShownFinishedPrivate);
177 w.SetOpacity(targetOpacity);
184 #ifdef DEBUG_ADAPTIVE_OPACITY
185 if (this.
Type() == SCR_AvailableActionsDisplay)
186 PrintFormat(
"%1 [Show] Opacity insta-changed: %2 -> %3",
this, w.GetOpacity(), targetOpacity);
189 w.SetOpacity(targetOpacity);
196 private void OnShownFinishedPrivate(WidgetAnimationOpacity anim)
202 Widget w = anim.GetWidget();
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)
246 width = workspace.DPIUnscale(width);
247 height = workspace.DPIUnscale(height);
352 private void CreateDisplayLegacy(
IEntity owner)
373 WorkspaceWidget wWorkspace =
GetGame().GetWorkspace();
400 AdaptiveOpacity_Initialize();
402 #ifdef DEBUG_INFO_DISPLAY
414 if (handler.m_bCanUpdate)
416 handler.Initialize(
this);
421 handler.OnStart(
this);
427 CreateDisplayLegacy(owner);
432 AdaptiveOpacity_Initialize();
433 Show(m_bShowWhenCreated);
437 private void AdaptiveOpacity_Initialize()
439 #ifdef DEBUG_ADAPTIVE_OPACITY
440 if (this.
Type() == SCR_AvailableActionsDisplay)
441 PrintFormat(
">> %1 >> AdaptiveOpacity_Initialize",
this);
447 m_bAdaptiveOpacity =
false;
448 PrintFormat(
"[AdaptiveOpacity] Duplicate AO disabled on info display %1. Parent display %2 already has AO enabled.",
this,
m_pParentDisplay);
452 if (m_bAdaptiveOpacity)
457 if (!m_wAdaptiveOpacity)
466 private void AdaptiveOpacity_OnScreenBrightnessChange(
float opacity,
float sceneBrightness)
474 if (!m_bAdaptiveOpacity)
477 #ifdef DEBUG_ADAPTIVE_OPACITY
478 if (this.
Type() == SCR_AvailableActionsDisplay)
479 PrintFormat(
"%1 [AdaptiveOpacity_Update] opacity: %2 | sceneBrightness: %3",
this, opacity, sceneBrightness);
483 m_fAdaptiveOpacity = opacity;
497 if (targetOpacity < 0.01)
500 #ifdef DEBUG_ADAPTIVE_OPACITY
501 if (this.
Type() == SCR_AvailableActionsDisplay)
502 PrintFormat(
"%1 [AdaptiveOpacity_Update] Updated running opacity animation; target opacity %2 -> %3",
this, targetOpacity, opacity);
509 #ifdef DEBUG_ADAPTIVE_OPACITY
510 if (this.
Type() == SCR_AvailableActionsDisplay)
511 PrintFormat(
"%1 [AdaptiveOpacity_Update] %2 -> %3",
this, m_wAdaptiveOpacity.GetOpacity(), opacity);
514 if (m_wAdaptiveOpacity && m_wAdaptiveOpacity.GetOpacity())
515 m_wAdaptiveOpacity.SetOpacity(opacity);
524 handler.OnStop(
this);
531 m_HUDManager.GetSceneBrightnessChangedInvoker().Remove(AdaptiveOpacity_OnScreenBrightnessChange);
539 #ifdef DEBUG_INFO_DISPLAY
551 if (handler.IsEnabled())
552 handler.OnUpdate(timeSlice);
566 SCR_InfoDisplay pInfoDisplay = SCR_InfoDisplay.Cast(pDisplay);
569 pInfoDisplay.m_pParentDisplay =
this;
class RestAPIHelper< JsonApiStruct T > content
ArmaReforgerScripted GetGame()
SCR_HUDManagerComponent m_HUDManager
SCR_AIUtilityComponentClass m_OwnerEntity
SCR_InfoDisplayInvoker GetOnStop()
int m_iContentHeightAdjustment
SCR_InfoDisplayHandler GetHandler(typename handlerType)
string m_sAdaptiveOpacityWidgetName
SCR_InfoDisplay m_pParentDisplay
ref SCR_InfoDisplayInvoker m_OnStart
void AdaptiveOpacity_Update(float opacity, float sceneBrightness, bool init=false)
override event void UpdateValues(IEntity owner, float timeSlice)
void SetRootWidget(notnull Widget root)
ScriptInvokerBase< SCR_InfoDisplayStartStopCallback > SCR_InfoDisplayInvoker
string GetContentWidgetName()
void RegisterToHudManager()
func SCR_InfoDisplayStartStopCallback
ref SCR_InfoDisplayInvoker m_OnStop
override event void OnStartDraw(IEntity owner)
void SetContentWidget(notnull Widget content)
override event void OnStopDraw(IEntity owner)
ref array< BaseInfoDisplay > m_aChildDisplays
SCR_InfoDisplayInvoker GetOnStart()
Widget GetContentWidget()
int m_iContentWidthAdjustment
ref array< ref SCR_InfoDisplayHandler > m_aUpdatableHandlers
bool GetAnchorPosition(out float x, out float y, EWidgetAnchor anchor=EWidgetAnchor.TOPLEFT, bool addSafezones=true)
bool GetDimensions(out float width, out float height, bool addSafezones=true)
void OnShownFinished(Widget w, float targetOpacity, WidgetAnimationOpacity anim=null)
ref array< ref SCR_InfoDisplayHandler > m_aHandlers
enum EVehicleType IEntity
float GetSceneBrightness()
ScriptInvokerBase< OnScreenBrightnessChanged > GetSceneBrightnessChangedInvoker()
static SCR_HUDManagerComponent GetHUDManager()
float GetAdaptiveOpacity()
Widget CreateLayout(ResourceName path, EHudLayers layer, int zOrder=0)
proto void PrintFormat(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL, LogLevel level=LogLevel.NORMAL)
@ CENTER
Text will be centered.
SCR_FieldOfViewSettings Attribute
BaseHUDComponentClass GameComponentClass GetInfoDisplays(out notnull array< BaseInfoDisplay > outInfoDisplays)