8 protected const float DEFAULT_FOV = 10;
11 protected string m_sPreviewItem;
14 protected string m_sItemShadow;
17 protected string m_sFallbackIcon;
20 protected ref Color m_DefaulItemColor;
23 protected ref Color m_MedicalItemColor;
27 protected ImageWidget m_wItemShadow;
28 protected ImageWidget m_wFallbackIcon;
30 protected IEntity m_Item;
34 override void HandlerAttached(Widget w)
36 super.HandlerAttached(w);
39 m_wItemShadow = ImageWidget.Cast(
m_wRoot.FindAnyWidget(m_sItemShadow));
40 m_wFallbackIcon = ImageWidget.Cast(
m_wRoot.FindAnyWidget(m_sFallbackIcon));
45 void SetPreviewItem(IEntity item)
47 if (!m_wPreviewItem || ! m_wFallbackIcon)
49 Print(
"[SCR_SelectionMenuEntryPreviewComponent] - missing widgets!", LogLevel.DEBUG);
54 m_wPreviewItem.SetVisible(item !=
null);
55 m_wItemShadow.SetVisible(item !=
null);
56 m_wFallbackIcon.SetVisible(!item);
69 ItemPreviewManagerEntity manager = world.GetItemPreviewManager();
74 SetupPreviewAttributes(m_PreviewAttributes);
75 manager.SetPreviewItem(m_wPreviewItem, item, m_PreviewAttributes);
76 m_wPreviewItem.SetResolutionScale(1, 1);
100 if (preview && menuPreview)
102 preview.ZoomCamera(10, menuPreview.m_fCustomFov, menuPreview.m_fCustomFov);
105 if (preview && m_wSizeLayout && menuPreview.m_fIconSizeXMultiplier != -1)
107 float size = m_fOriginalSize * menuPreview.m_fIconSizeXMultiplier;
108 FrameSlot.SetSize(m_wSizeLayout, size, size);
110 m_fAdjustedSize = size;
114 if (menuPreview.m_bShowMedicalColor ==
true)
115 m_wItemShadow.SetColor(m_MedicalItemColor);
117 m_wItemShadow.SetColor(m_DefaulItemColor);
121 m_wItemShadow.SetColor(m_DefaulItemColor);