游戏分数用图片显示(NGUI)
Posted MichaelJoker
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了游戏分数用图片显示(NGUI)相关的知识,希望对你有一定的参考价值。
四位数转换
int a, b, c, d, x;
x = (int)sumScore;
a = x / 1000;
b = (x - 1000 * a) / 100;
c = (x - 1000 * a - 100 * b) / 10;
d = (x - 1000 * a - 100 * b - 10 * c);
shuzi1.spriteName = a.ToString() + "k";
shuzi2.spriteName = b.ToString() + "k";
shuzi3.spriteName = c.ToString() + "k";
shuzi4.spriteName = d.ToString() + "k";
shuzi6.spriteName = a.ToString() + "k";
shuzi7.spriteName = b.ToString() + "k";
shuzi8.spriteName = c.ToString() + "k";
shuzi9.spriteName = d.ToString() + "k";
图片名为0k.....9k
以上是关于游戏分数用图片显示(NGUI)的主要内容,如果未能解决你的问题,请参考以下文章