public void ClearHighScores(bool clear) { if (clear) { BeatmapInfo bmi = OszUnpacker.bmds[currentSelectedSong.bmdIndex].mapInfos[currentSelectedBeatmap.bmiIndex]; bmi.scores = new List <ScoreInfo>(); OszUnpacker.bmds[currentSelectedSong.bmdIndex].mapInfos[currentSelectedBeatmap.bmiIndex] = bmi; OszUnpacker.SaveBeatmapData(OszUnpacker.bmds); RepopulateHighscores(bmi); } CloseOpenMenu(1); }
void OnSongEnd() { gameState = GameState.Ended; CalculateGrade(); bool isNewHighscore = false; // Compare with Previous Highscores if (OszUnpacker.bmds[bmdIndex].mapInfos[bmiIndex].scores.Count >= 3) { if ((scoreInfo.score > OszUnpacker.bmds[bmdIndex].mapInfos[bmiIndex].scores[2].score) || (scoreInfo.score == OszUnpacker.bmds[bmdIndex].mapInfos[bmiIndex].scores[2].score && (int)scoreInfo.grade < (int)OszUnpacker.bmds[bmdIndex].mapInfos[bmiIndex].scores[2].grade)) { OszUnpacker.bmds[bmdIndex].mapInfos[bmiIndex].scores[2] = scoreInfo; isNewHighscore = true; } } else { isNewHighscore = true; OszUnpacker.bmds[bmdIndex].mapInfos[bmiIndex].scores.Add(scoreInfo); OszUnpacker.SaveBeatmapData(OszUnpacker.bmds); } if (isNewHighscore) { OszUnpacker.bmds[bmdIndex].mapInfos[bmiIndex].scores.Sort((x, y) => y.score.CompareTo(x.score)); //Sort According to Highest Score UIManager.inst.RepopulateHighscores(OszUnpacker.bmds[bmdIndex].mapInfos[bmiIndex]); OszUnpacker.SaveBeatmapData(OszUnpacker.bmds); } UIManager.inst.PopulateScore(scoreInfo, isNewHighscore); UIManager.inst.ShowEndScore(); ResetScoring(); UIManager.inst.UpdateScores(scoreInfo.score, combo, scoreMult); }