예제 #1
0
        public override void Draw(
            float offsetX,
            float offsetY,
            DebugPrimitiveRenderer2D renderer)
        {
            float margin    = borderEnabled ? (2f * borderWidth) : 0f;
            float x         = offsetX + localLeftX + margin;
            float y         = offsetY + localTopY + this.height - margin;     // 下端から上へ向かって描画する
            float textWidth = width - (2f * margin);
            int   lineCount = _lines.Length;
            int   lineIndex = 0;

            while (lineIndex < lineCount)
            {
                int index = _nextLinePos - 1 - lineIndex;
                if (index < 0)
                {
                    index += lineCount;
                }
                else if (index >= lineCount)
                {
                    index -= lineCount;
                }
                if (_lines[index] != null)
                {
                    renderer.color = _colors[index];
                    var lines = renderer.AddText(
                        _lines[index],
                        x,
                        y,
                        _fontSize,
                        width - (2f * margin),
                        y - margin - (offsetY + localTopY),
                        DebugPrimitiveRenderer.AlignX.Left,
                        DebugPrimitiveRenderer.AlignY.Bottom);
                    y -= renderer.CalcLineHeight(_fontSize) * lines;
                }
                lineIndex++;
            }
        }