Ejemplo n.º 1
0
        private void MouseText_DrawBuffString(ref int X, ref int Y, int buffNameHeight)
        {
            Microsoft.Xna.Framework.Point p = new Microsoft.Xna.Framework.Point(X, Y);
            int            num    = 220;
            int            num2   = -1;
            float          num3   = 1f / Main.UIScale;
            List <Vector2> list   = new List <Vector2>();
            Vector2        vector = Main.fontMouseText.MeasureString(Main.buffString);

            list.Add(vector);
            int num4 = (int)((float)(Main.screenHeight - 250) * num3) / 20;

            if (num4 < 1)
            {
                num4 = 1;
            }
            if (Main.bannerMouseOver)
            {
                int num5 = 0;
                for (int i = 0; i < NPCLoader.NPCCount; i++)
                {
                    if (Item.BannerToNPC(i) != 0 && Main.player[Main.myPlayer].NPCBannerBuff[i])
                    {
                        num5++;
                        string  npcnameValue = Lang.GetNPCNameValue(Item.BannerToNPC(i));
                        Vector2 vector2      = Main.fontMouseText.MeasureString(npcnameValue);
                        int     num6         = X;
                        int     num7         = Y + (int)vector2.Y + num5 * 20 + 10;
                        int     num8         = 0;
                        int     num9         = (num5 - 1) / num4;
                        for (int j = 0; j < num9; j++)
                        {
                            num8++;
                            num6 += num;
                            num7 -= num4 * 20;
                        }
                        if ((float)num6 + vector2.X > (float)Main.screenWidth * num3 && num2 == -1)
                        {
                            num2 = num5;
                        }
                        list.Add(new Vector2((float)(num6 - num * num8), (float)num7) + vector2 - p.ToVector2());
                    }
                }
            }
            BuffLoader.CustomBuffTipSize(Main.buffString, list);
            Vector2 zero = Vector2.Zero;

            foreach (Vector2 vector3 in list)
            {
                if (zero.X < vector3.X)
                {
                    zero.X = vector3.X;
                }
                if (zero.Y < vector3.Y)
                {
                    zero.Y = vector3.Y;
                }
            }
            if ((float)X + zero.X + 24f > (float)Main.screenWidth * num3)
            {
                X = (int)((float)Main.screenWidth * num3 - zero.X - 24f);
            }
            if ((float)Y + zero.Y + 4f > (float)Main.screenHeight * num3)
            {
                Y = (int)((float)Main.screenHeight * num3 - zero.Y - 4f);
            }
            if (num2 != -1)
            {
                num2--;
            }
            for (int k = 0; k < 5; k++)
            {
                int num10 = X;
                int num11 = Y + buffNameHeight;
                Microsoft.Xna.Framework.Color black = Microsoft.Xna.Framework.Color.Black;
                if (k == 0)
                {
                    num10 -= 2;
                }
                else if (k == 1)
                {
                    num10 += 2;
                }
                else if (k == 2)
                {
                    num11 -= 2;
                }
                else if (k == 3)
                {
                    num11 += 2;
                }
                else
                {
                    black = new Microsoft.Xna.Framework.Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor);
                }
                DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, Main.buffString, new Vector2((float)num10, (float)num11), black, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
            }
            if (Main.bannerMouseOver)
            {
                int num12 = 0;
                for (int l = 0; l < NPCLoader.NPCCount; l++)
                {
                    if (Item.BannerToNPC(l) != 0 && Main.player[Main.myPlayer].NPCBannerBuff[l])
                    {
                        num12++;
                        bool flag = false;
                        for (int m = 0; m < 5; m++)
                        {
                            int num13 = X;
                            int num14 = Y + (int)vector.Y + num12 * 20 + 10;
                            int num15 = (num12 - 1) / num4;
                            num13 += num * num15;
                            num14 -= num4 * 20 * num15;
                            string text = Lang.GetNPCNameValue(Item.BannerToNPC(l));
                            if (num2 == num12)
                            {
                                text = Language.GetTextValue("UI.Ellipsis");
                                flag = true;
                            }
                            Microsoft.Xna.Framework.Color black2 = Microsoft.Xna.Framework.Color.Black;
                            if (m == 0)
                            {
                                num13 -= 2;
                            }
                            else if (m == 1)
                            {
                                num13 += 2;
                            }
                            else if (m == 2)
                            {
                                num14 -= 2;
                            }
                            else if (m == 3)
                            {
                                num14 += 2;
                            }
                            else
                            {
                                float num16 = (float)Main.mouseTextColor / 255f;
                                black2 = new Microsoft.Xna.Framework.Color((int)((byte)(80f * num16)), (int)((byte)(255f * num16)), (int)((byte)(120f * num16)), (int)Main.mouseTextColor);
                            }
                            DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, text, new Vector2((float)num13, (float)num14), black2, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
                        }
                        if (flag)
                        {
                            return;
                        }
                    }
                }
            }
            BuffLoader.DrawCustomBuffTip(Main.buffString, Main.spriteBatch, X, Y + (int)Main.fontMouseText.MeasureString(Main.buffString).Y);
        }