- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
string num = number.ToString();
num = num.Replace(',', '.');
string num2 = number2.ToString();
num2 = num2.Replace(',', '.');
int displace = 0;
int i = 0;
for (i = 0; i <= num.Length - 1; i++)
{
if (num.Substring(i, 1) != ".")
{
int curNum = Convert.ToInt16(num.Substring(i, 1));
Microsoft.Xna.Framework.Rectangle source = new Microsoft.Xna.Framework.Rectangle(curNum * 46, 0, 46, 64);
sb.Draw(numbers, new Microsoft.Xna.Framework.Rectangle((int)position.X + (i * 24), (int)position.Y - 5, (int)(46.0f * scale), (int)(64.0f * scale)), source, color);
}
else
{
Microsoft.Xna.Framework.Rectangle source = new Microsoft.Xna.Framework.Rectangle(10 * 46, 0, 46, 64);
sb.Draw(numbers, new Microsoft.Xna.Framework.Rectangle((int)position.X + (i * 24), (int)position.Y - 5, (int)(46.0f * scale), (int)(64.0f * scale)), source, color);
}
displace += (int)(46.0f * scale);
}
Microsoft.Xna.Framework.Rectangle src = new Microsoft.Xna.Framework.Rectangle(11 * 46, 0, 46, 64);
sb.Draw(numbers, new Microsoft.Xna.Framework.Rectangle((int)position.X + displace, (int)position.Y - 5, (int)(46.0f * scale), (int)(64.0f * scale)), src, color);
displace += (int)(46.0f * scale);
for (i = 0; i <= num2.Length - 1; i++)
{
if (num2.Substring(i, 1) != ".")
{
int curNum = Convert.ToInt16(num2.Substring(i, 1));
Microsoft.Xna.Framework.Rectangle source = new Microsoft.Xna.Framework.Rectangle(curNum * 46, 0, 46, 64);
sb.Draw(numbers, new Microsoft.Xna.Framework.Rectangle((int)position.X + (i * 24) + displace, (int)position.Y - 5, (int)(46.0f * scale), (int)(64.0f * scale)), source, color);
}
else
{
Microsoft.Xna.Framework.Rectangle source = new Microsoft.Xna.Framework.Rectangle(10 * 46, 0, 46, 64);
sb.Draw(numbers, new Microsoft.Xna.Framework.Rectangle((int)position.X + (i * 24) + displace, (int)position.Y - 5, (int)(46.0f * scale), (int)(64.0f * scale)), source, color);
}
}
Nuff said.
Как я тогда давным давно поленился импортировать неймспейс XNA - чёрт его знает.