Пример #1
0
        private static bool IsMouseOver(int x, int y, int width, int height)
        {
            Rectangle rect = InterfaceHelper.GetFullRectangle(x, y, width, height);

            return(curMouse.X > rect.Left && curMouse.X < rect.Right && curMouse.Y > rect.Top && curMouse.Y < rect.Bottom);
        }
Пример #2
0
        private static void DrawPanelExtras()
        {
            Mod mod = Bluemagic.Instance;

            if (IsMouseOver(panel))
            {
                Main.player[Main.myPlayer].mouseInterface = true;
                Main.player[Main.myPlayer].showItemIcon   = false;
                InterfaceHelper.HideItemIconCache();
            }
            string text;

            if (selected == 1)
            {
                curStats = GetCataclysmStats();
                text     = "Cataclysm Boosts";
            }
            else
            {
                curStats = GetChaosStats();
                text     = "Chaos Boosts";
            }
            CalculatedStyle   dim      = panel.GetDimensions();
            DynamicSpriteFont font     = Main.fontMouseText;
            Vector2           textSize = font.MeasureString(text);
            Vector2           drawPos  = dim.Position() + new Vector2((dim.Width - textSize.X) / 2f, 10f);

            Utils.DrawBorderString(Main.spriteBatch, text, drawPos, Color.White);
            if (selected == 1)
            {
                text     = "Expert Only";
                textSize = font.MeasureString(text);
                drawPos  = dim.Position() + new Vector2((dim.Width - textSize.X) / 2f, 32f);
                Utils.DrawBorderString(Main.spriteBatch, text, drawPos, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB));
            }
            text     = curStats.Points + " Point(s) Available";
            textSize = font.MeasureString(text);
            drawPos  = dim.Position() + new Vector2((dim.Width - textSize.X) / 2f, 54f);
            Utils.DrawBorderString(Main.spriteBatch, text, drawPos, Color.White);

            for (int k = 0; k < visibleStats.Length; k++)
            {
                int index = scroll * visibleStats.Length + k;
                if (index >= curStats.Stats.Count)
                {
                    break;
                }
                visibleStats[k] = curStats.Stats[index];
                DrawStat(visibleStats[k], GetStatOffset(k));
            }

            Vector2   arrowPos            = dim.Position() + new Vector2(dim.Width / 2f, 278f);
            float     arrowOffset         = 16f;
            Texture2D texture             = LeftArrowActive() ? mod.GetTexture("Interface/ArrowLeftActive") : mod.GetTexture("Interface/ArrowLeftInactive");
            Vector2   leftArrowPos        = arrowPos + new Vector2(-arrowOffset - texture.Width, 0f);
            Vector2   rightArrowPos       = arrowPos + new Vector2(arrowOffset, 0f);
            bool      mouseOverLeftArrow  = IsMouseOver(leftArrowPos, texture.Width, texture.Height);
            bool      mouseOverRightArrow = IsMouseOver(rightArrowPos, texture.Width, texture.Height);

            Main.spriteBatch.Draw(texture, leftArrowPos, mouseOverLeftArrow ? Color.Silver : Color.White);
            texture = RightArrowActive() ? mod.GetTexture("Interface/ArrowRightActive") : mod.GetTexture("Interface/ArrowRightInactive");
            Main.spriteBatch.Draw(texture, rightArrowPos, mouseOverRightArrow ? Color.Silver : Color.White);
            if (LeftArrowActive() && mouseOverLeftArrow && Clicking())
            {
                scroll--;
                Main.PlaySound(12, -1, -1, 1);
            }
            else if (RightArrowActive() && mouseOverRightArrow && Clicking())
            {
                scroll++;
                Main.PlaySound(12, -1, -1, 1);
            }
        }