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

◆ NewText() [1/3]

static int Terraria.PopupText.NewText ( AdvancedPopupRequest request,
Vector2 position )
inlinestatic

Creates a new T:Terraria.PopupText in F:Terraria.Main.popupText at position using the settings from request .
The new T:Terraria.PopupText is not bound to a specific T:Terraria.Item or T:Terraria.ID.NPCID.
All T:Terraria.PopupTexts created using this method have F:Terraria.PopupText.context == F:Terraria.PopupTextContext.Advanced and F:Terraria.PopupText.freeAdvanced set to true.

Parameters
requestThe settings for the new T:Terraria.PopupText.
positionThe position of the new T:Terraria.PopupText in world coordinates.
Returns
-1 if a new T:Terraria.PopupText could not be made, if F:Terraria.Main.netMode == F:Terraria.ID.NetmodeID.Server, or if the current player has item text disabled (F:Terraria.Main.showItemText).
Otherwise, return the index in F:Terraria.Main.popupText of the new T:Terraria.PopupText

Definition at line 204 of file PopupText.cs.

205 {
206 //IL_0032: Unknown result type (might be due to invalid IL or missing references)
207 //IL_0037: Unknown result type (might be due to invalid IL or missing references)
208 //IL_004d: Unknown result type (might be due to invalid IL or missing references)
209 //IL_004e: Unknown result type (might be due to invalid IL or missing references)
210 //IL_0054: Unknown result type (might be due to invalid IL or missing references)
211 //IL_0059: Unknown result type (might be due to invalid IL or missing references)
212 //IL_005e: Unknown result type (might be due to invalid IL or missing references)
213 //IL_0074: Unknown result type (might be due to invalid IL or missing references)
214 //IL_0079: Unknown result type (might be due to invalid IL or missing references)
215 //IL_0099: Unknown result type (might be due to invalid IL or missing references)
216 //IL_009e: Unknown result type (might be due to invalid IL or missing references)
217 if (!Main.showItemText)
218 {
219 return -1;
220 }
221 if (Main.netMode == 2)
222 {
223 return -1;
224 }
226 if (num >= 0)
227 {
228 string text = request.Text;
229 Vector2 vector = FontAssets.MouseText.Value.MeasureString(text);
230 PopupText obj = Main.popupText[num];
231 ResetText(obj);
232 obj.active = true;
233 obj.position = position - vector / 2f;
234 obj.name = text;
235 obj.stack = 1L;
236 obj.velocity = request.Velocity;
237 obj.lifeTime = request.DurationInFrames;
238 obj.context = PopupTextContext.Advanced;
239 obj.freeAdvanced = true;
240 obj.color = request.Color;
241 }
242 return num;
243 }
static Asset< DynamicSpriteFont > MouseText
Definition FontAssets.cs:10
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

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

Referenced by Terraria.Projectile.AI_061_FishingBobber_GiveItemToPlayer(), Terraria.Main.CraftItem(), Terraria.Main.DrawInventory(), Terraria.Player.FillAmmo(), Terraria.Projectile.FishingCheck(), Terraria.Player.GetItem_FillEmptyInventorySlot(), Terraria.Player.GetItem_FillEmptyInventorySlot_VoidBag(), Terraria.Player.GetItem_FillIntoOccupiedSlot(), Terraria.Player.GetItem_FillIntoOccupiedSlot_VoidBag(), Terraria.Player.PutItemInInventoryFromItemUsage(), and Terraria.GameContent.LucyAxeMessage.SpawnPopupText().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: