Esempio n. 1
0
    public static void drawRelBar(
        Graphics g,
        AnimationManager2D am2d,
        int x,
        int y,
        int width,
        int relState,
        int levelF,
        bool big)
    {
        AppEngine   canvas      = AppEngine.getCanvas();
        TextManager textManager = canvas.getTextManager();
        SimData     simData     = canvas.getSimData();

        if (am2d == null)
        {
            int relStateDescString = simData.getRelStateDescString(relState);
            int font = big ? 3 : 3;
            g.Begin();
            textManager.drawString(g, relStateDescString, font, x, y - 3, 18);
            g.End();
        }
        else
        {
            int animLeft  = 208;
            int animMid   = 209;
            int animRight = 210;
            if ((simData.getRelStateFlags(relState) & 1) != 0)
            {
                animLeft  = 211;
                animMid   = 212;
                animRight = 213;
            }
            else if ((simData.getRelStateFlags(relState) & 2) != 0)
            {
                animLeft  = 214;
                animMid   = 215;
                animRight = 216;
            }
            float w       = (float)(width - 25);
            float scaleY1 = big ? 1.33333f : 1f;
            float scaleY2 = big ? 1f : 0.75f;
            am2d.submitAnimHBar(217, 218, 219, (float)x, (float)y, (float)width, 1f, scaleY1);
            if (levelF != 65536)
            {
                am2d.flushAnims(g);
                int clipX      = g.getClipX();
                int clipY      = g.getClipY();
                int clipWidth  = g.getClipWidth();
                int clipHeight = g.getClipHeight();
                int y1         = x - (width >> 1);
                int h          = MathExt.Fmul(width, levelF);
                g.setClip(clipY, y1, clipHeight, h);
                am2d.submitAnimHBar(animLeft, animMid, animRight, (float)x, (float)y, (float)width, 1f, scaleY1);
                am2d.flushAnims(g);
                g.setClip(clipX, clipY, clipWidth, clipHeight);
            }
            else
            {
                am2d.submitAnimHBar(animLeft, animMid, animRight, (float)x, (float)y, (float)width, 1f, scaleY1);
            }
            am2d.submitAnimHBar(220, 221, 222, (float)x, (float)y, w, 1f, scaleY2);
        }
    }