示例#1
0
    void FixedUpdate()
    {
        // Calculate the top left coordinates.
        sizeX   = victoriaBold.lineHeight * cols;
        sizeY   = victoriaBold.lineHeight * rows;
        originX = (Screen.width / 2 / mLayer.scale) - sizeX / 2;
        originY = (Screen.height / 2 / mLayer.scale) - sizeY / 2;

        // Figure out how many quads the background, two lines of text and the flashing cursor will use.
        int quadLength = 0;

        quadLength += victoriaBold.Estimate(line1);
        quadLength += victoriaBold.Estimate(line2);
        quadLength += 2; // 1 for the background and 1 for the cursor.

        mLayer.Begin(quadLength + 2);

        // Draw the Background in the background colour
        mLayer.SetColour(backgroundColour);
        mLayer.Add(originX, originY, sizeX, sizeY, mWhite);

        // Draw both lines Lines of text colour
        mLayer.SetColour(textColour); // Note: We only need to change the colour when necessary, not every quad or line of text.
        victoriaBold.AddTo(mLayer, originX, originY + victoriaBold.lineHeight, line1);
        victoriaBold.AddTo(mLayer, originX, originY + victoriaBold.lineHeight * 2, line2);

        // Draw the flashing Cursor, but alternative colours every other second.
        mLayer.SetColour(((int)Time.time % 2 == 0) ? textColour : backgroundColour);
        mLayer.Add(originX, originY + victoriaBold.lineHeight * 3, victoriaBold.lineHeight, victoriaBold.lineHeight, mWhite);

        mLayer.End();
    }
示例#2
0
    void DrawHitbox(Hitbox hb, bool isChecked = false)
    {
        Layer.SetColour(new Color32(0xFF, 0xFF, 0xFF, 0xFF));
        Layer.Add(hb.x0 + 1, hb.y0, hb.w - 2, 13, Button_Up);

        Layer.SetColour(new Color32(0xFF, 0xFF, 0xFF, 0xFF));
        Layer.Add(hb.x0, hb.y0, 1, 13, Button_Light);

        Layer.SetColour(new Color32(0xFF, 0xFF, 0xFF, 0xFF));
        Layer.Add(hb.x0 + hb.w - 1, hb.y0, 1, 13, Button_Dark);

        Layer.SetColour(new Color32(0x29, 0x2c, 0x2e, 0xFF));
        Font.AddTo(Layer, hb.tx, hb.ty, hb.text);

        if (hb.gadget == Gadget.Check)
        {
            if (isChecked)
            {
                Layer.Add(hb.x0 + 1, hb.y0 + 1, 11, 11, Checkbox);
            }
            else
            {
                Layer.Add(-10, -10, 0, 0, Checkbox);
            }
        }
    }