示例#1
0
        public void DrawRecursive(
            float offsetX,
            float offsetY,
            Renderer2D renderer)
        {
            if (!enabled)
            {
                return;
            }

            // まず自分描画
            if (BackgroundEnabled)
            {
                renderer.Color = BackgroundColor;
                renderer.AddRectangle(
                    offsetX + LocalLeftX,
                    offsetY + LocalTopY,
                    Width,
                    Height);
            }
            if (BorderEnabled)
            {
                renderer.Color = BorderColor;
                renderer.AddRectangleFrame(
                    offsetX + LocalLeftX,
                    offsetY + LocalTopY,
                    Width,
                    Height,
                    BorderWidth);
            }
            Draw(offsetX, offsetY, renderer);

            // グローバル座標を計算して子を描画
            float globalLeftX = offsetX + LocalLeftX;
            float globalTopY  = offsetY + LocalTopY;

            DrawChildren(globalLeftX, globalTopY, renderer);
            DrawPostChild(offsetX, offsetY, renderer);
        }