void DrawCurrent(bool isnewLine, Around around, float lineX) { if (sb.Length != 0) { var line = lines[(int)yline]; Rect area_rect = new Rect(pt.x + alignedX, pt.y, x - pt.x + offsetX, node.getHeight()); cache.cacheText(line, node, sb.ToString(), area_rect); sb.Remove(0, sb.Length); } if (isnewLine) { // 再换行 yline++; x = lineX; pt.x = offsetX; pt.y = offsetY; for (int n = 0; n < yline; ++n) { pt.y += lines[n].y; } if (yline >= lines.Count) { --yline; //Debug.LogError("yline >= vLineSize.Count!yline:" + yline + " vLineSize:" + lines.Count); } alignedX = AlignedFormatting(node.owner, xFormatting, maxWidth, lines[(int)(yline)].x, lineX); float newx; if (!around.isContain(pt.x + alignedX, pt.y, 1, node.getHeight(), out newx)) { pt.x = newx - alignedX; x = pt.x; } } }
void DrawCurrent(bool isnewLine, Around around) { if (node.owner.isArabic) { if (sb.Length != 0) { float width = pt.x - x - offsetX; Rect area_rect = new Rect(x - alignedX, pt.y, width, node.getHeight()); cache.cacheText(lines[(int)yline], node, sb.ToString(), area_rect); sb.Remove(0, sb.Length); } if (isnewLine) { // 再换行 yline++; x = maxWidth; pt.x = x - offsetX; pt.y = offsetY; for (int n = 0; n < yline; ++n) { pt.y += lines[n].y; } if (yline >= lines.Count) { --yline; //Debug.LogError("yline >= vLineSize.Count!yline:" + yline + " vLineSize:" + lines.Count); } float curentWidth = lines[(int)(yline)].x; alignedX = AlignedFormatting(node.owner, xFormatting, maxWidth, curentWidth); alignedX = maxWidth - (alignedX + curentWidth); float newx; if (!around.isContain(pt.x + alignedX, pt.y, 1, node.getHeight(), out newx, true)) { pt.x = newx - alignedX; x = pt.x; } } } else { if (sb.Length != 0) { Rect area_rect = new Rect(pt.x + alignedX, pt.y, x - pt.x + offsetX, node.getHeight()); cache.cacheText(lines[(int)yline], node, sb.ToString(), area_rect); sb.Remove(0, sb.Length); } if (isnewLine) { // 再换行 yline++; x = 0.0f; pt.x = offsetX; pt.y = offsetY; for (int n = 0; n < yline; ++n) { pt.y += lines[n].y; } if (yline >= lines.Count) { --yline; //Debug.LogError("yline >= vLineSize.Count!yline:" + yline + " vLineSize:" + lines.Count); } alignedX = AlignedFormatting(node.owner, xFormatting, maxWidth, lines[(int)(yline)].x); float newx; if (!around.isContain(pt.x + alignedX, pt.y, 1, node.getHeight(), out newx)) { pt.x = newx - alignedX; x = pt.x; } } } }