public static void ReadUserScore(int value) { NewFont("maven_pro_regular", "maven_pro_regular.ttf", 14); const int fromleft = 325; const int inputtop = 500; if (_Scores.Count == 0) { LoadScores(); } //GameController.GameState = GameState.ViewingHighScore; if (value > _Scores [_Scores.Count - 1].score) { Score s = new Score(); s.score = value; int x = 0; x = fromleft + SwinGame.TextWidth(_Fonts ["maven_pro_regular"], "Name: "); SwinGame.StartReadingText(Color.White, namesize, _Fonts ["maven_pro_regular"], x, inputtop); while (SwinGame.ReadingText()) { SwinGame.ProcessEvents(); UIController.DrawEndGame(); DrawHighScores(); SwinGame.DrawText("Name: ", Color.White, fromleft, inputtop); SwinGame.RefreshScreen(60); } s.Name = SwinGame.TextReadAsASCII(); if (s.Name.Length == 3) { s.Name = s.Name + new string (Convert.ToChar(" "), 3 - s.Name.Length); _Scores.RemoveAt(_Scores.Count - 1); _Scores.Add(s); _Scores.Sort(); SaveScores(); GameController.GameState = GameState.EndingRanking; } else { while (s.Name.Length != 3) { if (value > _Scores [_Scores.Count - 1].score) { s.score = value; x = fromleft + SwinGame.TextWidth(_Fonts ["maven_pro_regular"], "Name: "); SwinGame.StartReadingText(Color.White, namesize, _Fonts ["maven_pro_regular"], x, inputtop); while (SwinGame.ReadingText()) { SwinGame.ProcessEvents(); DrawHighScores(); SwinGame.DrawText("Name: ", Color.White, fromleft - 5, inputtop); SwinGame.DrawText("Your name must be at least 3 characters!", Color.White, fromleft - 5, inputtop + 15); SwinGame.RefreshScreen(60); } s.Name = SwinGame.TextReadAsASCII(); if (s.Name.Length == 3) { s.Name = s.Name + new string (Convert.ToChar(" "), 3 - s.Name.Length); _Scores.RemoveAt(_Scores.Count - 1); _Scores.Add(s); _Scores.Sort(); SaveScores(); } } } } } else { DrawHighScores(); GameController.GameState = GameState.EndingRanking; } }