示例#1
0
    public override void draw(SpriteBatch b)
    {
        if (UsingKB && Game1.textEntry == null)
        {
            exitThisMenu();
            return;
        }

        // Dim the Background
        b.Draw(Game1.fadeToBlackRect, new Rectangle(0, 0, Game1.uiViewport.Width, Game1.uiViewport.Height), Color.Black * 0.5f);

        // Tip
        bool kb_open = Game1.textEntry != null;

        if (!kb_open)
        {
            SimpleHelper.Builder()
            .FormatText(
                I18n.Tooltip_Search_Tip(I18n.Search_IngredientPrefix()),
                wrapText: true,
                minWidth: width
                )
            .GetLayout()
            .DrawHover(
                b,
                Game1.smallFont,
                overrideX: xPositionOnScreen,
                overrideY: yPositionOnScreen + height + 16
                );
        }

        // Background
        RenderHelper.DrawBox(
            b,
            texture: Game1.menuTexture,
            sourceRect: new Rectangle(0, 256, 60, 60),
            x: xPositionOnScreen,
            y: yPositionOnScreen,
            width: width,
            height: height,
            color: Color.White,
            scale: 1f
            );

        txtInput.Draw(b);
        btnSearch.draw(b);

        base.draw(b);

        // Mouse
        Game1.mouseCursorTransparency = 1f;
        drawMouse(b);
    }
    protected override void DrawUI(SpriteBatch batch)
    {
        base.DrawUI(batch);

        if (!MenuActive)
        {
            return;
        }

        btnAlmanac.draw(batch);
        Menu.drawMouse(batch);

        if (Tip != null)
        {
            SimpleHelper.DrawHover(Tip, batch, Game1.smallFont);
        }
    }
    protected override bool ReceiveCursorHover(int x, int y)
    {
        if (!MenuActive)
        {
            return(false);
        }

        btnAlmanac.tryHover(x, y, 0.25f);

        Hovering = btnAlmanac.containsPoint(x, y);
        if (Hovering && Tip == null)
        {
            Tip = SimpleHelper.Builder().Text(I18n.Almanac_Open()).GetLayout();
        }
        else if (!Hovering && Tip != null)
        {
            Tip = null;
        }

        return(Hovering);
    }