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

◆ Update()

void Terraria.PopupText.Update ( int whoAmI)
inline

Updates this T:Terraria.PopupText.

Parameters
whoAmIThe index in F:Terraria.Main.popupText of this T:Terraria.PopupText.

Definition at line 805 of file PopupText.cs.

806 {
807 //IL_008c: Unknown result type (might be due to invalid IL or missing references)
808 //IL_0091: Unknown result type (might be due to invalid IL or missing references)
809 //IL_00b8: Unknown result type (might be due to invalid IL or missing references)
810 //IL_00bd: Unknown result type (might be due to invalid IL or missing references)
811 //IL_00e5: Unknown result type (might be due to invalid IL or missing references)
812 //IL_00ea: Unknown result type (might be due to invalid IL or missing references)
813 //IL_00f8: Unknown result type (might be due to invalid IL or missing references)
814 //IL_0111: Unknown result type (might be due to invalid IL or missing references)
815 //IL_011f: Unknown result type (might be due to invalid IL or missing references)
816 //IL_0126: Unknown result type (might be due to invalid IL or missing references)
817 //IL_00d8: Unknown result type (might be due to invalid IL or missing references)
818 //IL_00dd: Unknown result type (might be due to invalid IL or missing references)
819 //IL_015a: Unknown result type (might be due to invalid IL or missing references)
820 //IL_015f: Unknown result type (might be due to invalid IL or missing references)
821 //IL_016f: Unknown result type (might be due to invalid IL or missing references)
822 //IL_018a: Unknown result type (might be due to invalid IL or missing references)
823 //IL_0199: Unknown result type (might be due to invalid IL or missing references)
824 //IL_01a1: Unknown result type (might be due to invalid IL or missing references)
825 //IL_01b0: Unknown result type (might be due to invalid IL or missing references)
826 //IL_02bb: Unknown result type (might be due to invalid IL or missing references)
827 //IL_02c1: Unknown result type (might be due to invalid IL or missing references)
828 //IL_02c6: Unknown result type (might be due to invalid IL or missing references)
829 //IL_02cb: Unknown result type (might be due to invalid IL or missing references)
830 if (!active)
831 {
832 return;
833 }
834 float targetScale = TargetScale;
835 alpha += (float)alphaDir * 0.01f;
836 if ((double)alpha <= 0.7)
837 {
838 alpha = 0.7f;
839 alphaDir = 1;
840 }
841 if (alpha >= 1f)
842 {
843 alpha = 1f;
844 alphaDir = -1;
845 }
846 if (expert)
847 {
848 color = new Color((int)(byte)Main.DiscoR, (int)(byte)Main.DiscoG, (int)(byte)Main.DiscoB, (int)Main.mouseTextColor);
849 }
850 else if (master)
851 {
852 color = new Color(255, (int)(byte)(Main.masterColor * 200f), 0, (int)Main.mouseTextColor);
853 }
854 if (rarity > 11)
855 {
856 color = RarityLoader.GetRarity(rarity).RarityColor;
857 }
858 bool flag = false;
859 Vector2 textHitbox = GetTextHitbox();
860 Rectangle rectangle = default(Rectangle);
861 ((Rectangle)(ref rectangle))._002Ector((int)(position.X - textHitbox.X / 2f), (int)(position.Y - textHitbox.Y / 2f), (int)textHitbox.X, (int)textHitbox.Y);
862 Rectangle value = default(Rectangle);
863 for (int i = 0; i < 20; i++)
864 {
865 PopupText popupText = Main.popupText[i];
866 if (!popupText.active || i == whoAmI)
867 {
868 continue;
869 }
870 Vector2 textHitbox2 = popupText.GetTextHitbox();
871 ((Rectangle)(ref value))._002Ector((int)(popupText.position.X - textHitbox2.X / 2f), (int)(popupText.position.Y - textHitbox2.Y / 2f), (int)textHitbox2.X, (int)textHitbox2.Y);
872 if (((Rectangle)(ref rectangle)).Intersects(value) && (position.Y < popupText.position.Y || (position.Y == popupText.position.Y && whoAmI < i)))
873 {
874 flag = true;
875 int num = numActive;
876 if (num > 3)
877 {
878 num = 3;
879 }
880 popupText.lifeTime = activeTime + 15 * num;
881 lifeTime = activeTime + 15 * num;
882 }
883 }
884 if (!flag)
885 {
886 velocity.Y *= 0.86f;
887 if (scale == targetScale)
888 {
889 velocity.Y *= 0.4f;
890 }
891 }
892 else if (velocity.Y > -6f)
893 {
894 velocity.Y -= 0.2f;
895 }
896 else
897 {
898 velocity.Y *= 0.86f;
899 }
900 velocity.X *= 0.93f;
902 lifeTime--;
903 if (lifeTime <= 0)
904 {
905 scale -= 0.03f * targetScale;
906 if ((double)scale < 0.1 * (double)targetScale)
907 {
908 active = false;
909 if (sonarText == whoAmI)
910 {
911 sonarText = -1;
912 }
913 }
914 lifeTime = 0;
915 }
916 else
917 {
918 if (scale < targetScale)
919 {
920 scale += 0.1f * targetScale;
921 }
922 if (scale > targetScale)
923 {
925 }
926 }
927 }
static ModRarity GetRarity(int type)
float alpha
The opacity of this T:Terraria.PopupText in the range [0f, 1f], where 0f is transparent and 1f is opa...
Definition PopupText.cs:33
static int sonarText
The index in F:Terraria.Main.popupText of the last known sonar text. Assign and clear using M:Terra...
Definition PopupText.cs:106
static float TargetScale
Definition PopupText.cs:158
int rarity
The T:Terraria.ID.ItemRarityID this T:Terraria.PopupText uses for its main color.
Definition PopupText.cs:141
Color color
The color of this T:Terraria.PopupText's text.
Definition PopupText.cs:64
static int numActive
The number of F:Terraria.PopupText.active T:Terraria.PopupTexts in F:Terraria.Main....
Definition PopupText.cs:85
bool expert
If true, this T:Terraria.PopupText will draw in the Expert Mode rarity color.
Definition PopupText.cs:111
bool active
If true, this T:Terraria.PopupText is visible in the world.
Definition PopupText.cs:69
float scale
The scale this T:Terraria.PopupText draws at.
Definition PopupText.cs:54
bool master
If true, this T:Terraria.PopupText will draw in the Master Mode rarity color.
Definition PopupText.cs:116
Vector2 GetTextHitbox()
Definition PopupText.cs:929
int alphaDir
The direction this T:Terraria.PopupText's F:Terraria.PopupText.alpha changes in.
Definition PopupText.cs:38
int lifeTime
The time in ticks this T:Terraria.PopupText will remain for until it starts to disappear.
Definition PopupText.cs:74
static int activeTime
The default F:Terraria.PopupText.lifeTime of a T:Terraria.PopupText.
Definition PopupText.cs:79
Vector2 position
The position of this T:Terraria.PopupText in world coordinates.
Definition PopupText.cs:23
Vector2 velocity
The velocity of this T:Terraria.PopupText in world coordinates per tick.
Definition PopupText.cs:28

References Terraria.PopupText.active, Terraria.PopupText.activeTime, Terraria.PopupText.alpha, Terraria.PopupText.alphaDir, Terraria.PopupText.color, Terraria.Main.DiscoB, Terraria.Main.DiscoG, Terraria.Main.DiscoR, Terraria.PopupText.expert, Terraria.ModLoader.RarityLoader.GetRarity(), Terraria.PopupText.GetTextHitbox(), Terraria.PopupText.lifeTime, Terraria.PopupText.master, Terraria.Main.masterColor, Terraria.Main.mouseTextColor, Terraria.PopupText.numActive, Terraria.Main.popupText, Terraria.PopupText.position, Terraria.PopupText.rarity, Terraria.PopupText.scale, Terraria.PopupText.sonarText, Terraria.PopupText.TargetScale, and Terraria.PopupText.velocity.

+ Here is the call graph for this function: