4 protected bool m_bEnableDebugFont;
8 private int m_iDebugFontSize;
10 protected float m_fWidth;
11 protected float m_fHeight;
13 protected Widget m_wRoot;
16 protected ref array<SCR_HUDSlotUIComponent> m_aSlots = {};
22 Widget GetRootWidget()
28 int GetSlotComponents(notnull out array<SCR_HUDSlotUIComponent> slotComponents)
30 slotComponents.Clear();
34 slotComponents.Insert(slot);
37 return slotComponents.Count();
45 Widget slotWidget = slot.GetRootWidget();
49 if (slotWidget.GetName() == slotName)
76 WorkspaceWidget workspace =
GetGame().GetWorkspace();
79 m_fWidth = workspace.DPIUnscale(m_fWidth);
86 override void HandlerAttached(Widget w)
90 Widget iteratedWidget = w.GetChildren();
91 while (iteratedWidget)
96 iteratedWidget = iteratedWidget.GetSibling();
102 iteratedWidget = iteratedWidget.GetSibling();
109 WorkspaceWidget workspace =
GetGame().GetWorkspace();
112 FrameWidget slotFrame = FrameWidget.Cast(slot.GetRootWidget());
115 Debug.Error2(
"Wrong Slot Widget Type",
"SCR_HUDSlotUIComponent Requires to be attached to a FrameWidget!");
119 slot.m_wDebugOverlay = OverlayWidget.Cast(workspace.CreateWidget(WidgetType.OverlayWidgetTypeID, WidgetFlags.VISIBLE, Color.FromInt(Color.BLACK), 0, slot.GetRootWidget()));
120 if (!slot.m_wDebugOverlay || !m_bEnableDebugFont)
123 slot.m_wDebugImg = ImageWidget.Cast(workspace.CreateWidget(WidgetType.ImageWidgetTypeID, WidgetFlags.VISIBLE,
new Color(Math.RandomFloat(0, 0.1), Math.RandomFloat(0, 0.1), Math.RandomFloat(0, 0.1), 1), 0, slot.m_wDebugOverlay));
124 LayoutSlot.SetHorizontalAlign(slot.m_wDebugImg, LayoutHorizontalAlign.Stretch);
125 LayoutSlot.SetVerticalAlign(slot.m_wDebugImg, LayoutVerticalAlign.Stretch);
127 slot.m_wDebugVertical = workspace.CreateWidget(WidgetType.VerticalLayoutWidgetTypeID, WidgetFlags.VISIBLE, Color.FromInt(Color.BLACK), 0, slot.m_wDebugOverlay);
128 OverlaySlot.SetHorizontalAlign(slot.m_wDebugVertical, LayoutHorizontalAlign.Stretch);
129 OverlaySlot.SetVerticalAlign(slot.m_wDebugVertical, LayoutVerticalAlign.Stretch);
131 slot.m_wDebugNameText = TextWidget.Cast(workspace.CreateWidget(WidgetType.TextWidgetTypeID, WidgetFlags.VISIBLE, Color.FromInt(Color.WHITE), 0, slot.m_wDebugVertical));
132 OverlaySlot.SetHorizontalAlign(slot.m_wDebugNameText, LayoutHorizontalAlign.Center);
133 slot.m_wDebugNameText.SetText(slot.GetRootWidget().GetName());
134 slot.m_wDebugNameText.SetExactFontSize(m_iDebugFontSize);
136 slot.m_wDebugPriorityText = TextWidget.Cast(workspace.CreateWidget(WidgetType.TextWidgetTypeID, WidgetFlags.VISIBLE, Color.FromInt(Color.WHITE), 0, slot.m_wDebugVertical));
137 OverlaySlot.SetHorizontalAlign(slot.m_wDebugPriorityText, LayoutHorizontalAlign.Center);
138 slot.SetPriority(slot.GetPriority());
139 slot.m_wDebugPriorityText.SetExactFontSize(m_iDebugFontSize);
141 slot.m_wDebugHeightText = RichTextWidget.Cast(workspace.CreateWidget(WidgetType.RichTextWidgetTypeID, WidgetFlags.VISIBLE, Color.FromInt(Color.WHITE), 0, slot.m_wDebugVertical));
142 OverlaySlot.SetHorizontalAlign(slot.m_wDebugHeightText, LayoutHorizontalAlign.Center);
143 slot.m_wDebugHeightText.SetExactFontSize(m_iDebugFontSize);
145 slot.m_wDebugWidthText = RichTextWidget.Cast(workspace.CreateWidget(WidgetType.RichTextWidgetTypeID, WidgetFlags.VISIBLE, Color.FromInt(Color.WHITE), 0, slot.m_wDebugVertical));
146 OverlaySlot.SetHorizontalAlign(slot.m_wDebugWidthText, LayoutHorizontalAlign.Center);
147 slot.m_wDebugWidthText.SetExactFontSize(m_iDebugFontSize);