public static void GetHighScoreString() { //#if(XBOX360) if (SaveManager.MyDevice.IsConnected) { //#endif HighScoreData data = GameCore.LoadHighScores(GameCore.HighScoresFilename); highScores[0] = "Score: " + data.Score[0].ToString() + " on " + data.Times[0].ToString(); highScores[1] = "Score: " + data.Score[1].ToString() + " on " + data.Times[1].ToString(); highScores[2] = "Score: " + data.Score[2].ToString() + " on " + data.Times[2].ToString(); highScores[3] = "Score: " + data.Score[3].ToString() + " on " + data.Times[3].ToString(); highScores[4] = "Score: " + data.Score[4].ToString() + " on " + data.Times[4].ToString(); highScores[5] = "Score: " + data.Score[5].ToString() + " on " + data.Times[5].ToString(); highScores[6] = "Score: " + data.Score[6].ToString() + " on " + data.Times[6].ToString(); highScores[7] = "Score: " + data.Score[7].ToString() + " on " + data.Times[7].ToString(); highScores[8] = "Score: " + data.Score[8].ToString() + " on " + data.Times[8].ToString(); highScores[9] = "Score: " + data.Score[9].ToString() + " on " + data.Times[9].ToString(); //#if(XBOX360) } //#endif }
private void SaveHighScore() { // Create the data to save HighScoreData data = GameCore.LoadHighScores(GameCore.HighScoresFilename); int scoreIndex = -1; for (int i = 0; i < data.Count; i++) { if (ActionState.Score > data.Score[i]) { scoreIndex = i; break; } } if (scoreIndex > -1) { //New high score found ... do swaps for (int i = data.Count - 1; i > scoreIndex; i--) { data.Times[i] = data.Times[i - 1]; data.Score[i] = data.Score[i - 1]; } data.Times[scoreIndex] = System.DateTime.Now; data.Score[scoreIndex] = ActionState.Score; GameCore.SaveHighScores(data, GameCore.HighScoresFilename); bNewHighScore = true; HighScoreState.GetHighScoreString(); } else { bNewHighScore = false; } }