TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ NewText() [2/3]

static int Terraria.PopupText.NewText ( PopupTextContext context,
int npcNetID,
Vector2 position,
bool stay5TimesLonger )
inlinestatic

Creates a new T:Terraria.PopupText in F:Terraria.Main.popupText at position bound to a given npcNetID .

Parameters
contextThe T:Terraria.PopupTextContext in which this T:Terraria.PopupText was created.
If context == F:Terraria.PopupTextContext.SonarAlert, then F:Terraria.PopupText.color will be a shade of red.
npcNetIDThe T:Terraria.ID.NPCID this T:Terraria.PopupText represents.
position
stay5TimesLongerIf true, then this T:Terraria.PopupText will spawn with F:Terraria.PopupText.lifeTime == 5 * 60.
Returns

Also returns -1 if npcNetID == 0.

Definition at line 259 of file PopupText.cs.

260 {
261 //IL_004c: Unknown result type (might be due to invalid IL or missing references)
262 //IL_0051: Unknown result type (might be due to invalid IL or missing references)
263 //IL_0068: Unknown result type (might be due to invalid IL or missing references)
264 //IL_0069: Unknown result type (might be due to invalid IL or missing references)
265 //IL_006f: Unknown result type (might be due to invalid IL or missing references)
266 //IL_0074: Unknown result type (might be due to invalid IL or missing references)
267 //IL_0079: Unknown result type (might be due to invalid IL or missing references)
268 //IL_00c5: Unknown result type (might be due to invalid IL or missing references)
269 //IL_00ca: Unknown result type (might be due to invalid IL or missing references)
270 //IL_00d4: Unknown result type (might be due to invalid IL or missing references)
271 //IL_00d9: Unknown result type (might be due to invalid IL or missing references)
272 //IL_00e3: Unknown result type (might be due to invalid IL or missing references)
273 //IL_00e8: Unknown result type (might be due to invalid IL or missing references)
274 if (!Main.showItemText)
275 {
276 return -1;
277 }
278 if (npcNetID == 0)
279 {
280 return -1;
281 }
282 if (Main.netMode == 2)
283 {
284 return -1;
285 }
287 if (num >= 0)
288 {
289 NPC nPC = new NPC();
290 nPC.SetDefaults(npcNetID);
291 string typeName = nPC.TypeName;
292 Vector2 vector = FontAssets.MouseText.Value.MeasureString(typeName);
293 PopupText popupText = Main.popupText[num];
294 ResetText(popupText);
295 popupText.active = true;
296 popupText.position = position - vector / 2f;
297 popupText.name = typeName;
298 popupText.stack = 1L;
299 popupText.velocity.Y = -7f;
300 popupText.lifeTime = 60;
301 popupText.context = context;
303 {
304 popupText.lifeTime *= 5;
305 }
306 popupText.npcNetID = npcNetID;
307 popupText.color = Color.White;
308 if (context == PopupTextContext.SonarAlert)
309 {
310 popupText.color = Color.Lerp(Color.White, Color.Crimson, 0.5f);
311 }
312 }
313 return num;
314 }
static Asset< DynamicSpriteFont > MouseText
Definition FontAssets.cs:10
int npcNetID
The NPC type (F:Terraria.NPC.type) this T:Terraria.PopupText is bound to, or 0 if not bound to an NPC...
Definition PopupText.cs:131
static void ResetText(PopupText text)
Resets a T:Terraria.PopupText to its default values.
Definition PopupText.cs:176
static int FindNextItemTextSlot()
Definition PopupText.cs:649
Vector2 position
The position of this T:Terraria.PopupText in world coordinates.
Definition PopupText.cs:23
PopupTextContext context
The context in which this T:Terraria.PopupText was created.
Definition PopupText.cs:126

References Terraria.PopupText.context, Terraria.PopupText.FindNextItemTextSlot(), Terraria.GameContent.FontAssets.MouseText, Terraria.Main.netMode, Terraria.PopupText.npcNetID, Terraria.Main.popupText, Terraria.PopupText.position, Terraria.PopupText.ResetText(), and Terraria.Main.showItemText.

+ Here is the call graph for this function: