6 [
Attribute(
"14", UIWidgets.CheckBox,
"Scaled text size at the beginning of the zone \n pixels")]
7 protected int m_fTextSizeMax;
9 [
Attribute(
"14", UIWidgets.CheckBox,
"Scaled text size at the end of the zone \n pixels")]
10 protected int m_fTextSizeMin;
12 [
Attribute(
"{E2CBA6F76AAA42AF}UI/Fonts/Roboto/Roboto_Regular.fnt", UIWidgets.ResourceNamePicker,
desc:
"Font type",
params:
"fnt")]
13 protected ResourceName m_FontResource;
20 protected void GetText(
SCR_NameTagData data, out
string name, out notnull array<string> nameParams)
33 int paramsCount = nameParams.Count();
36 TextWidget.Cast(
data.m_aNametagElements[
index] ).SetText(text);
37 else if (paramsCount == 3)
38 TextWidget.Cast(
data.m_aNametagElements[
index] ).SetTextFormat(text, nameParams[0], nameParams[1], nameParams[2]);
41 Print(
string.Format(
"'SCR_NTTextBase' does not support nameParams of count '%1'!", paramsCount), LogLevel.ERROR);
42 TextWidget.Cast(
data.m_aNametagElements[
index] ).SetText(text);
50 Widget widget =
data.m_aNametagElements[
index];
59 float diff = m_fTextSizeMax - m_fTextSizeMin;
62 int zoneStart = zone.GetZoneStart();
66 float lerp = Math.InverseLerp(zoneStart, zone.m_iZoneEnd,
data.m_fDistance);
69 float x = FrameSlot.GetSizeX(widget);
70 float y = FrameSlot.GetSizeY(widget);
73 float scaledY = m_fTextSizeMax - diff;
75 FrameSlot.SetSizeY(widget, scaledY);
76 FrameSlot.SetSizeX(widget, scaledY * ratio);
82 TextWidget tWidget = TextWidget.Cast(
data.m_aNametagElements[
index] );
90 tWidget.SetFont(m_FontResource);
93 tWidget.SetExactFontSize(m_fTextSizeMax);
95 tWidget.SetColor(stateConf.m_vColor);
96 tWidget.SetShadow( stateConf.m_fShadowSize, stateConf.m_vShadowColor.PackToInt(), stateConf.m_fShadowOpacity, 0, 0);
98 data.SetVisibility(tWidget, stateConf.m_fOpacityDefault != 0, stateConf.m_fOpacityDefault, stateConf.m_bAnimateTransition);
108 override void GetText(
SCR_NameTagData data, out
string name, out notnull array<string> nameParams)
110 data.GetName(name, nameParams);
122 data.UpdateEntityType();
127 array<string> nameParams = {};
129 GetText(
data, name, nameParams);
131 if (name ==
string.Empty)
148 override void GetText(
SCR_NameTagData data, out
string name, out notnull array<string> nameParams)
150 name = Math.Round(Math.Sqrt(
data.m_fDistance)).ToString();
159 array<string> nameParams = {};
161 GetText(
data, name, nameParams);