1 [
ComponentEditorProps(
category:
"GameScripted/Editor (Editables)", description:
"", icon:
"WBData/ComponentEditorProps/componentEditor.png")]
12 private ref Color m_sColor;
15 private float m_fSizeCoef;
21 private bool m_bItalic;
26 void ApplyTo(TextWidget textWidget)
28 textWidget.SetText(GetDisplayName());
29 textWidget.SetColor(m_sColor);
30 textWidget.SetBold(m_bBold);
31 textWidget.SetItalic(m_bItalic);
34 textWidget.GetTextSize(size, size);
35 textWidget.SetExactFontSize(size * m_fSizeCoef);
43 iconWidget.SetColor(m_sColor);
47 info.SetIconTo(iconWidget);
54 return Color.FromInt(m_sColor.PackToInt());
81 private static const float _WB_DRAW_DISTANCE_SQ = 1500 * 1500;
84 override void _WB_AfterWorldUpdate(IEntity owner,
float timeSlice)
94 WorldEditorAPI api = genericOwner._WB_GetEditorAPI();
98 IEntitySource src = api.EntityToSource(genericOwner);
102 if (!api.IsEntityVisible(src) || !api.IsEntityLayerVisible(src.GetSubScene(), src.GetLayerID()))
105 vector cameraTransform[4];
106 genericOwner.GetWorld().GetCurrentCamera(cameraTransform);
112 int colorBackground = 0x00000000;
113 if (api.IsEntitySelected(src))
115 colorBackground = ARGBF(1, 0, 0, 0);
120 if (vector.DistanceSq(pos, cameraTransform[3]) > _WB_DRAW_DISTANCE_SQ)
124 float testSize = 16 * m_fSizeCoef;
125 int color = m_sColor.PackToInt();
127 string displayName = GetDisplayName();
128 int underscore = displayName.LastIndexOf(
"_");
129 if (underscore != -1)
132 displayName = displayName.Substring(underscore, displayName.Length() - underscore);
135 DebugTextWorldSpace.Create(genericOwner.GetWorld(), displayName, DebugTextFlags.CENTER | DebugTextFlags.FACE_CAMERA | DebugTextFlags.ONCE, pos[0], pos[1], pos[2], testSize, color, colorBackground);