5 protected string m_sSlotName;
7 protected float m_fWidth, m_fHeight;
8 protected Widget m_wSlot;
9 protected Widget m_wContent;
12 protected WorkspaceWidget m_wWorkspace;
13 protected bool m_bIsVisible;
15 [
Attribute(
"0.1",
desc:
"When a difference in size equivalent to this value is detected, the slot will be resized.")]
16 protected float m_fResizeSensitivity;
28 return m_SlotComponent;
32 Widget GetSlotWidget()
37 return m_SlotComponent.GetRootWidget();
50 Widget groupWidget = slotWidget.GetParent();
55 return m_GroupComponent;
65 m_SlotComponent = slot;
70 m_GroupComponent = group;
74 protected override void OnStart(notnull SCR_InfoDisplay display)
78 Print(
"SCR_InfoDisplaySlotHandler requires CanUpdate to be set to true!", LogLevel.WARNING);
85 if (!GrabHudComponents(m_GroupComponent, m_SlotComponent, hudManager, owningLayout))
87 Print(
"Failed To Create A Slot: " + m_sSlotName +
". One of the properties of the Info Dispaly is not defined properly, witch is preventing the initialization.", LogLevel.ERROR);
94 Print(
"Failed to obtain SCR_HUDManagerLayoutHandler for InfoDisplay: " + m_OwnerDisplay.Type().ToString(), LogLevel.ERROR);
98 m_wSlot = m_SlotComponent.GetRootWidget();
104 Print(
"Slot Already Taken: " + m_sSlotName +
". The Slot an Info Display is trying to occupy is already occupied!", LogLevel.ERROR);
114 hudElement.SetWidget(displayWidget);
115 hudElement.SetParentWidgetName(m_sSlotName);
116 hudElement.SetParentLayout(owningLayout);
117 owningLayout.AddHudElement(hudElement,
false);
119 display.SetRootWidget(displayWidget);
120 display.SetContentWidget(displayWidget);
121 display.RegisterToHudManager();
125 m_SlotComponent.Initialize();
126 m_SlotComponent.GetOnResize().Insert(OnSlotResize);
128 m_GroupComponent.ResizeGroup();
132 protected override void OnStop(notnull SCR_InfoDisplay display)
135 m_SlotComponent.GetOnResize().Remove(OnSlotResize);
149 slotComponent = layoutHandler.FindSlotComponentFromAnyLayout(m_sSlotName, owningLayout);
153 Widget slotWidget = slotComponent.GetRootWidget();
157 Widget groupWidget = slotWidget.GetParent();
171 m_fWidth = slot.GetWidth();
176 override void OnUpdate(
float timeSlice)
189 if (!
float.AlmostEqual(width, m_fWidth, m_fResizeSensitivity) || !
float.AlmostEqual(height,
m_fHeight, m_fResizeSensitivity) ||
m_bIsVisible != isVisible)
191 m_GroupComponent.ResizeGroup();