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

◆ MouseText_DrawBuffTooltip()

void Terraria.Main.MouseText_DrawBuffTooltip ( string buffString,
ref int X,
ref int Y )
inlineprivate

Definition at line 19866 of file Main.cs.

19867 {
19869 int num = 220;
19870 int num2 = 72;
19871 int num3 = -1;
19872 float num4 = 1f;
19874 Vector2 vector = FontAssets.MouseText.Value.MeasureString(buffString);
19875 list.Add(vector);
19876 int num5 = (int)((float)(screenHeight - Y - 24 - num2) * num4) / 20;
19877 if (num5 < 1)
19878 {
19879 num5 = 1;
19880 }
19881 if (bannerMouseOver)
19882 {
19883 int num6 = 0;
19884 for (int i = 0; i < 290; i++)
19885 {
19886 if (Item.BannerToNPC(i) != 0 && player[myPlayer].HasNPCBannerBuff(i))
19887 {
19888 num6++;
19889 string nPCNameValue = Lang.GetNPCNameValue(Item.BannerToNPC(i));
19890 Vector2 vector2 = FontAssets.MouseText.Value.MeasureString(nPCNameValue);
19891 int num7 = X;
19892 int num8 = Y + (int)vector2.Y + num6 * 20 + 10;
19893 int num9 = 0;
19894 int num10 = num6 / num5;
19895 for (int j = 0; j < num10; j++)
19896 {
19897 num9++;
19898 num7 += num;
19899 num8 -= num5 * 20;
19900 }
19901 if ((float)(num7 - 24 - num) > (float)screenWidth * num4)
19902 {
19903 num3 = num6;
19904 break;
19905 }
19906 list.Add(new Vector2(num7, num8) + vector2 - p.ToVector2());
19907 }
19908 }
19909 }
19911 foreach (Vector2 item in list)
19912 {
19913 if (zero.X < item.X)
19914 {
19915 zero.X = item.X;
19916 }
19917 if (zero.Y < item.Y)
19918 {
19919 zero.Y = item.Y;
19920 }
19921 }
19922 if ((float)X + zero.X + 24f > (float)screenWidth * num4)
19923 {
19924 X = (int)((float)screenWidth * num4 - zero.X - 24f);
19925 }
19926 if ((float)Y + zero.Y + 4f > (float)screenHeight * num4)
19927 {
19928 Y = (int)((float)screenHeight * num4 - zero.Y - 4f);
19929 }
19930 for (int k = 0; k < 5; k++)
19931 {
19932 int num11 = X;
19933 int num12 = Y + (int)FontAssets.MouseText.Value.MeasureString(buffString).Y;
19935 switch (k)
19936 {
19937 case 0:
19938 num11 -= 2;
19939 break;
19940 case 1:
19941 num11 += 2;
19942 break;
19943 case 2:
19944 num12 -= 2;
19945 break;
19946 case 3:
19947 num12 += 2;
19948 break;
19949 default:
19951 break;
19952 }
19954 }
19955 if (!bannerMouseOver)
19956 {
19957 return;
19958 }
19959 int num13 = 0;
19960 for (int l = 0; l < 290; l++)
19961 {
19962 if (Item.BannerToNPC(l) == 0 || !player[myPlayer].HasNPCBannerBuff(l))
19963 {
19964 continue;
19965 }
19966 num13++;
19967 bool flag = false;
19968 for (int m = 0; m < 5; m++)
19969 {
19970 int num14 = X;
19971 int num15 = Y + (int)vector.Y + num13 * 20 + 10;
19972 int num16 = (num13 - 1) / num5;
19973 num14 += num * num16;
19974 num15 -= num5 * 20 * num16;
19975 string text = Lang.GetNPCNameValue(Item.BannerToNPC(l));
19976 if (num3 == num13)
19977 {
19978 text = Language.GetTextValue("UI.Ellipsis");
19979 flag = true;
19980 }
19982 switch (m)
19983 {
19984 case 0:
19985 num14 -= 2;
19986 break;
19987 case 1:
19988 num14 += 2;
19989 break;
19990 case 2:
19991 num15 -= 2;
19992 break;
19993 case 3:
19994 num15 += 2;
19995 break;
19996 default:
19997 {
19998 float num17 = (float)(int)mouseTextColor / 255f;
19999 color2 = new Microsoft.Xna.Framework.Color((byte)(80f * num17), (byte)(255f * num17), (byte)(120f * num17), mouseTextColor);
20000 break;
20001 }
20002 }
20004 }
20005 if (flag)
20006 {
20007 break;
20008 }
20009 }
20010 }
static void DrawString(this SpriteBatch spriteBatch, DynamicSpriteFont spriteFont, string text, Vector2 position, Color color)
void Add(TKey key, TValue value)
static Asset< DynamicSpriteFont > MouseText
Definition FontAssets.cs:10
static string GetTextValue(string key)
Definition Language.cs:15
static Item[] item
Definition Main.cs:1681
static SpriteBatch spriteBatch
Definition Main.cs:974
static bool bannerMouseOver
Definition Main.cs:1244
static int myPlayer
Definition Main.cs:1801
static int screenHeight
Definition Main.cs:1721
static byte mouseTextColor
Definition Main.cs:1751
static string buffString
Definition Main.cs:1246
static int screenWidth
Definition Main.cs:1719
static Player[] player
Definition Main.cs:1803

References System.Collections.Generic.Dictionary< TKey, TValue >.Add(), Terraria.Main.bannerMouseOver, Terraria.Item.BannerToNPC(), Microsoft.Xna.Framework.Color.Black, Terraria.Main.buffString, ReLogic.Graphics.DynamicSpriteFontExtensionMethods.DrawString(), Terraria.Lang.GetNPCNameValue(), Terraria.Localization.Language.GetTextValue(), System.Text.RegularExpressions.i, Terraria.Main.item, System.list, Terraria.GameContent.FontAssets.MouseText, Terraria.Main.mouseTextColor, Terraria.Main.myPlayer, Terraria.Main.player, Terraria.Main.screenHeight, Terraria.Main.screenWidth, Terraria.Main.spriteBatch, System.text, Microsoft.Xna.Framework.Graphics.Vector2, System.X, System.Y, and Microsoft.Xna.Framework.Vector2.Zero.

Referenced by Terraria.Main.MouseTextInner().