override public void Draw(Color[] outbuf)
    {
        Color pageColor = new Color(192, 192, 192);

        Clear(outbuf, pageColor);
        for (int x = 0; x < charWidth; ++x)
        {
            for (int y = 0; y < charHeight; ++y)
            {
                int     sx = charX + x;
                int     sy = y;
                Color32 px = pixels[charWidth * y + x];
                if (px.a > 128)
                {
                    Color noAlpha = px;
                    outbuf[64 * sy + sx] = noAlpha;
                }
            }
        }

        TextRender.DrawString(outbuf, font, 1 - stringScrollPosition, 56, Color.black, lines[lineIndex].text);

        if (IsLineDone())
        {
            TextRender.DrawString(outbuf, font, 20, 48, Color.black, "[OK]");
        }
    }
示例#2
0
    public void Draw(Color[] pixels, float cityScale)
    {
        DrawHitPoints(pixels);
        // always assumes Jack's in the center of the frame

        Color jackColor = Color.white;

        if (myState == JackState.REELING)
        {
            float blinkFrac = reelingTimeRemaining % REEL_BLINK_DURATION;
            if (blinkFrac < (REEL_BLINK_DURATION / 2.0f))
            {
                jackColor = Color.red;
            }
            else
            {
                jackColor = Color.black;
            }
        }

        float sizeSqr = DrawRadius * DrawRadius * cityScale * cityScale;

        Quaternion rot = Quaternion.AngleAxis(this.Angle * 180.0f / Mathf.PI, new Vector3(0, 0, 1));

        for (int x = 0; x < 64; ++x)
        {
            float dx  = x - 32;
            float dx2 = dx * dx;
            for (int y = 0; y < 64; ++y)
            {
                float dy  = y - 32;
                float dy2 = dy * dy;
                if (sizeSqr > (dx2 + dy2))
                {
                    //pixels[x + y * 64] = jackColor;
                }

                foreach (JackParticle jp in particles)
                {
                    Vector2 wpp = myCity.ScreenToWorld(new Vector2Int(x, y));
                    Vector2 rp  = rot * jp.Pos;
                    Vector2 pp  = rp + Position;
                    if ((pp - wpp).magnitude <= jp.Radius)
                    {
                        pixels[x + y * 64] = jp.Color;
                        break;
                    }
                }
            }
        }

        if (myState != JackState.DEAD)
        {
            foreach (SwordFrame f in recordedFrames)
            {
                float elapsedTime = Time.realtimeSinceStartup - f.frameTime;
                float alpha       = 1.0f - elapsedTime / SwordFade;
                DrawSwordFrame(f, pixels, cityScale, alpha);
            }
        }

        TextRender.DrawString(pixels, Globals.FontTex, 1 - textDisplayScrollPosition, 1, Color.white, textDisplayString);
    }