public void Draw() { if (count < 100) { char1 = FontSpriteFactory.GetX(); char2 = GetInt(count.ToString().Substring(0, 1)); if (count.ToString().Length > 1) { char3 = GetInt(count.ToString().Substring(1, 1)); } } else { char1 = GetInt(count.ToString().Substring(0, 1)); char2 = GetInt(count.ToString().Substring(1, 1)); char3 = GetInt(count.ToString().Substring(2, 1)); } //Get the coordinates of the characters char1.X = xCoord; char2.X = xCoord + 17; char1.Y = char2.Y = offset + yCoord; //Draw the characters char1.Draw(game.spriteBatch); char2.Draw(game.spriteBatch); if (char3 != null && count > 9) { char3.X = xCoord + 30; char3.Y = offset + yCoord; char3.Draw(game.spriteBatch); } }
private static ISprite GetInt(string str) { int integer = Int32.Parse(str); ISprite temp; switch (integer) { case 0: temp = FontSpriteFactory.Get0(); break; case 1: temp = FontSpriteFactory.Get1(); break; case 2: temp = FontSpriteFactory.Get2(); break; case 3: temp = FontSpriteFactory.Get3(); break; case 4: temp = FontSpriteFactory.Get4(); break; case 5: temp = FontSpriteFactory.Get5(); break; case 6: temp = FontSpriteFactory.Get6(); break; case 7: temp = FontSpriteFactory.Get7(); break; case 8: temp = FontSpriteFactory.Get8(); break; case 9: temp = FontSpriteFactory.Get9(); break; default: temp = FontSpriteFactory.GetX(); break; } return(temp); }