6 [
Attribute(
desc:
"If true will auto set icon, background and outline for the given type as well as colors")]
7 protected bool m_bAutoSetVisuals;
9 [
Attribute(
desc:
"Damage type of visuals. Will be set automatically m_bAutoSetVisuals = true. Will be ignored if custom is set", uiwidget: UIWidgets.ComboBox, enums: ParamEnumArray.FromEnum(
EDamageType))]
13 protected string m_sIconName;
16 protected string m_sOutlineName;
19 protected string m_sBackgroundName;
23 protected Widget m_wRoot;
31 if (!m_DamageStateConfig)
34 m_eDamageType = damageType;
36 SetVisuals(m_DamageStateConfig.GetUiInfo(damageType));
47 m_wRoot.SetVisible(m_UiInfo !=
null);
52 ImageWidget icon = ImageWidget.Cast(
m_wRoot.FindAnyWidget(m_sIconName));
53 ImageWidget outline = ImageWidget.Cast(
m_wRoot.FindAnyWidget(m_sOutlineName));
54 ImageWidget background = ImageWidget.Cast(
m_wRoot.FindAnyWidget(m_sBackgroundName));
61 icon.SetVisible(m_UiInfo.SetIconTo(icon, iconIndex));
62 icon.SetColor(m_UiInfo.GetColor());
67 image = m_UiInfo.GetOutlineImage();
68 quadName = m_UiInfo.GetOutlineQuadName();
70 outline.SetVisible(m_UiInfo.SetImageTo(outline, image, quadName));
71 outline.SetColor(m_UiInfo.GetOutlineColor());
76 image = m_UiInfo.GetBackgroundImage();
77 quadName = m_UiInfo.GetBackgroundQuadName();
79 background.SetVisible(m_UiInfo.SetImageTo(background, image, quadName));
80 background.SetColor(m_UiInfo.GetBackgroundColor());
88 void SetSize(
float size)
90 ImageWidget icon = ImageWidget.Cast(
m_wRoot.FindAnyWidget(m_sIconName));
91 ImageWidget outline = ImageWidget.Cast(
m_wRoot.FindAnyWidget(m_sOutlineName));
92 ImageWidget background = ImageWidget.Cast(
m_wRoot.FindAnyWidget(m_sBackgroundName));
95 icon.SetSize(size, size);
97 outline.SetSize(size, size);
99 background.SetSize(size, size);
111 override void HandlerAttached(Widget w)
115 if (!m_DamageStateConfig)
117 Print(
"'SCR_DamageStateUIComponent' is missing 'SCR_DamageStateConfig'", LogLevel.ERROR);
121 if (m_bAutoSetVisuals)
122 SetVisuals(m_eDamageType);