In proof of $|G| = n_1^2 + n_2^2 + \ldots + n_h^2$ how could equality of dimensions concluded from ring isomorphism In Derek Robinson, A Course in the Theory of Groups on page 224 he proves:

Let $G$ be a finite group and let $F$ be an algebraically closed field whose characteristic does not divide the order of $G$.
(i) $FG = I_1 \oplus I_2 \oplus \cdots \oplus I_h$ where $I_i$ is an ideal of $FG$ which is ring isomorphic with the ring $M(n_i, F)$ of all $n_i \times n_i$ matrices over $F$.
(ii) $|G| = n_1^2 + n_2^2 + \ldots + n_h^2$.

I have a question on the proof of (ii), he writes:

The $F$-dimension of $FG$ is certainly $|G|$, while that of $M(n_i, F)$ is $n_i^2$. Taking $F$-dimensions of both sides in (i), we obtain $|G| = n_1^2 + n_2^2 + \ldots + n_h^2$, thus proving (ii).

What I do not understand about this proof is that (i) just claims ring isomorphism, and this does not reserve dimension in general. So how is this conclusion from (i) possible?
For example $\mathbb C$ is a vector space over itself of dimension one, and it is a vector space over $\mathbb R$ of dimension two, but as a ring $\mathbb C$ is obviously isomorph to itself, but both vector structures have different dimension.
Also ring homomorphism and module homomorphism are quite two distinct concepts, as for example $\mathbb Z$ has just the identity as ring homomorphisms, but many more $\mathbb Z$-module homomorphisms like for example $x \mapsto 2x$.
A situation where this does not make a difference is when $R = I \oplus J$ for two ideals $I, J$. Then for example $R / I$ is isomorphic to $J$ as a $R$-module and as a ring by the same map $\overline \pi(x + I) = \pi(x)$ where $\pi : R \to J$ is the projection. But this holds because the projection is a ring homomorphism and a module homomorphism, as if $x = x_I + x_J$ and $y = y_I + y_J$ then $\pi(x) = x_J$ and $xy_J = (x_I + x_J)y_J = x_Iy_J + x_Jy_J = x_J y_J$ as $x_I y_J \in I \cap J = \{0\}$.
$$
 \pi(xy) = \pi(x)\pi(y) = x_J\pi(y) = x\pi(y).
$$
But this does not apply to the ring isomorphism between $I_i$ and $M(n_i, F)$ claimed in the proof.
 A: You're absolutely right that (ii) does not obviously follow from (i) as stated.  What (i) should say is not just that $I_i$ is ring-isomorphic to $M(n_i,F)$ but that it is isomorphic to $M(n_i,F)$ as an $F$-algebra.  Concretely, this means that if you take an element $a\in F$, consider it as an element of $FG$, project it to $I_i$, and then map it to $M(n_i,F)$ via the isomorphism, you get the scalar matrix $a\in M(n_i,F)$.  With this stronger condition, it is clear that the isomorphism preserves the dimension over $F$.  And if you chase through all the steps of the proof of (i), it should not be difficult to see that the isomorphism that is constructed indeed does have this property.  (The key point in verifying this is that the isomorphism $\operatorname{End}_R(S_i)\cong F$ given by 8.1.5 isn't just any isomorphism; it is the isomorphism given by taking an element of $F$ and letting it act on $S_i$ via the inclusion $F\to FG$ and the $FG$-module structure on $S_i$.)
(In fact, however, it turns out that if $I$ is a finite dimensional $F$-algebra which is isomorphic to $M(n,F)$ as a ring for some $n$, then $I$ must automatically be isomorphic to $M(n,F)$ as an $F$-algebra, though original isomorphism might not be $F$-linear.  To prove this, note that the scalar matrices form the center of $M(n,F)$ and are isomorphic to $F$.  The copy of $F$ sitting inside $I$ is a subfield of its center.  But if $F$ is an algebraically closed field and $F'\subseteq F$ is any algebraically closed subfield, $F$ has infinite dimension over $F'$ unless $F'=F$.  Since $I$ is finite-dimensional over $F$, its center must be finite-dimensional over $F$, and hence must be equal to $F$.  It follows that the action of $F$ on $I$ differs from the action of $F$ on $M(n,F)$ only by some automorphism $\varphi:F\to F$.    Composing our isomorphism $I\to M(n,F)$ with the automorphism $M(n,F)\to M(n,F)$ given by applying $\varphi^{-1}$ to each entry, we get a new isomorphism $I\to M(n,F)$ which is also $F$-linear.)
