12. In the Cartesian coordinate system, the traffic distance between points $P\left(x_{1}, y_{1}\right)$ and $Q\left(x_{2}, y_{2}\right)$ is defined as
$$
d(P, Q)=\left|x_{1}-x_{2}\right|+\left|y_{1}-y_{2}\right| .
$$

If the traffic distance from $C(x, y)$ to points $A(1,3)$ and $B(6,9)$ is equal, where the real numbers $x$ and $y$ satisfy $0 \leqslant x \leqslant 10$ and $0 \leqslant y \leqslant 10$, then the sum of the lengths of all the loci of points $C$ that satisfy the condition is $\qquad$
$12.5(\sqrt{2}+1)$.
From the condition, we have
$$
|x-1|+|y-3|=|x-6|+|y-9| \text {. }
$$

When $y \geqslant 9$,
$$
|x-1|+y-3=|x-6|+y-9 \text {, }
$$

which simplifies to $|x-1|+6=|x-6|$, with no solution;
When $3 \leqslant y \leqslant 9$,
$$
|x-1|+y-3=|x-6|+9-y \text {, }
$$

which simplifies to $2 y-12=|x-6|-|x-1|$.
When $x \leqslant 1$, $y=8.5$, the length of the line segment is 1.
When $1 \leqslant x \leqslant 6$, $x+y=9.5$, the length of the line segment is $5 \sqrt{2}$.
When $x \geqslant 6$, $y=3.5$, the length of the line segment is 4.
When $y \leqslant 3$,
$$
|x-1|+3-y=|x-6|+9-y,
$$

which simplifies to $|x-1|=6+|x-6|$, with no solution.
In summary, the total length of the line segments formed by the trajectory of point $C$ is $1+5 \sqrt{2}+4=5(\sqrt{2}+1)$.