6 protected string m_sContentTextName;
9 protected string m_sIconName;
12 protected string m_sLineName;
15 protected string m_sBackgroundName;
17 protected RichTextWidget m_ContentText;
18 protected ImageWidget m_Icon;
19 protected ImageWidget m_Line;
20 protected Widget m_Background;
22 protected void SetAttributeDescription(
SCR_EditorAttributeUIInfo uiInfo,
string customContent =
string.Empty,
string param1 =
string.Empty,
string param2 =
string.Empty,
string param3 =
string.Empty)
27 m_Background.SetVisible(
false);
28 m_Icon.SetVisible(
false);
29 m_ContentText.SetVisible(
false);
30 m_Line.SetVisible(
false);
36 m_Background.SetVisible(
true);
37 m_ContentText.SetVisible(
true);
38 m_Line.SetVisible(
true);
42 if (customContent.IsEmpty())
44 m_ContentText.SetTextFormat(uiInfo.GetDescription(), param1, param2, param3);
46 if (uiInfo.GetIconPath().IsEmpty())
48 m_Icon.SetVisible(
false);
52 uiInfo.SetIconTo(m_Icon);
54 if (uiInfo.GetDescriptionIconColor())
55 m_Icon.SetColor(uiInfo.GetDescriptionIconColor());
57 m_Icon.SetVisible(
true);
63 m_ContentText.SetTextFormat(customContent, param1, param2, param3);
65 if (uiInfo.GetIconPath().IsEmpty())
67 m_Icon.SetVisible(
false);
71 uiInfo.SetIconTo(m_Icon);
73 if (uiInfo.GetDescriptionIconColor())
74 m_Icon.SetColor(uiInfo.GetDescriptionIconColor());
76 m_Icon.SetVisible(
true);
81 protected void OnCategoryChanged(ResourceName currentCategory)
85 GetGame().GetCallqueue().CallLater(SetAttributeDescription, 1,
false,
null,
string.Empty,
string.Empty,
string.Empty,
string.Empty);
89 override void HandlerAttached(Widget w)
91 SCR_AttributesManagerEditorComponent attributesManager = SCR_AttributesManagerEditorComponent.Cast(SCR_AttributesManagerEditorComponent.GetInstance(SCR_AttributesManagerEditorComponent));
92 if (!attributesManager)
95 m_ContentText = RichTextWidget.Cast(w.FindAnyWidget(m_sContentTextName));
96 m_Icon = ImageWidget.Cast(w.FindAnyWidget(m_sIconName));
97 m_Line = ImageWidget.Cast(w.FindAnyWidget(m_sLineName));
99 if (!m_ContentText || !m_Icon)
102 m_Background = w.FindAnyWidget(m_sBackgroundName);
105 SetAttributeDescription(
null);
107 attributesManager.GetOnAttributeDescriptionChanged().Insert(SetAttributeDescription);
110 override void HandlerDeattached(Widget w)
112 SCR_AttributesManagerEditorComponent attributesManager = SCR_AttributesManagerEditorComponent.Cast(SCR_AttributesManagerEditorComponent.GetInstance(SCR_AttributesManagerEditorComponent));
113 if (!attributesManager || !m_ContentText || !m_Icon)
116 attributesManager.GetOnAttributeDescriptionChanged().Remove(SetAttributeDescription);