//To fix the bug explained in CustomLevelStaticData.cs private void OnDidSelectSongEvent(SongListViewController songListViewController) { var song = CustomLevelStaticDatas.FirstOrDefault(x => x.levelId == songListViewController.levelId); if (song == null) { return; } if (song.difficultyLevels.All(x => x.difficulty != _songSelectionView.difficulty)) { var isDiffSelected = ReflectionUtil.GetPrivateField <bool>(_difficultyView, "_difficultySelected"); if (!isDiffSelected) { return; } //The new selected song does not have the current difficulty selected var firstDiff = song.difficultyLevels.FirstOrDefault(); if (firstDiff == null) { return; } ReflectionUtil.SetPrivateField(_songSelectionView, "_difficulty", firstDiff.difficulty); } }
private void RemoveCustomScores() { if (PlayerPrefs.HasKey("lbPatched")) { return; } _leaderboardScoreUploader = FindObjectOfType <LeaderboardScoreUploader>(); if (_leaderboardScoreUploader == null) { return; } var scores = ReflectionUtil.GetPrivateField <List <LeaderboardScoreUploader.ScoreData> >(_leaderboardScoreUploader, "_scoresToUploadForCurrentPlayer"); var scoresToRemove = new List <LeaderboardScoreUploader.ScoreData>(); foreach (var scoreData in scores) { var split = scoreData._leaderboardId.Split('_'); var levelID = split[0]; if (CustomSongInfos.Any(x => x.levelId == levelID)) { Log("Removing a custom score here"); scoresToRemove.Add(scoreData); } } scores.RemoveAll(x => scoresToRemove.Contains(x)); }
void FixedUpdate() { SongDetailViewController SDVC = Resources.FindObjectsOfTypeAll <SongDetailViewController>().FirstOrDefault(); if (SDVC != null) { var diff_selected = ReflectionUtil.GetPrivateField <LevelStaticData.Difficulty>(SDVC, "_difficulty"); var diff_info = ReflectionUtil.GetPrivateField <LevelStaticData>(SDVC, "_levelStaticData"); var diff = diff_info.GetDifficultyLevel(diff_selected); _timeMesh.text = "Diff: " + (float)(diff.difficultyRank) / 100.0f; // can only store ranks as int so we mult by 100 to keep two decimal points, bring them back here } }
private void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene) { StartCoroutine(WaitRemoveScores()); //We need to enable No Energy mode if playing custom song, so game doesn't ping leaderboards. var sceneSetup = FindObjectOfType <MainGameSceneSetup>(); if (sceneSetup != null) { //We're in the main game _sceneSetupData = ReflectionUtil.GetPrivateField <MainGameSceneSetupData>(sceneSetup, "_mainGameSceneSetupData"); var currentCustomSong = CustomSongs.FirstOrDefault(x => x.levelId == _sceneSetupData.levelId); if (currentCustomSong == null) { return; } } else { //We're probably in menu } }
//To fix the bug explained in CustomLevelStaticData.cs private void OnDidSelectSongEvent(SongListViewController songListViewController) { try { CustomLevelStaticData song = CustomLevelStaticDatas.FirstOrDefault(x => x.levelId == songListViewController.levelId); if (song == null) { return; } if (!LoadIfNotLoaded(song)) { Logger.Log("Song was modified, updated leaderboard ID to " + song.levelId); songListViewController.SelectSong(_levels.FirstIndexWhere(data => data.levelId == song.levelId)); return; } if (song.difficultyLevels.All(x => x.difficulty != _songSelectionView.difficulty)) { bool isDiffSelected = ReflectionUtil.GetPrivateField <bool>(_difficultyView, "_difficultySelected"); if (!isDiffSelected) { return; } //The new selected song does not have the current difficulty selected LevelStaticData.DifficultyLevel firstDiff = song.difficultyLevels.FirstOrDefault(); if (firstDiff == null) { return; } ReflectionUtil.SetPrivateField(_songSelectionView, "_difficulty", firstDiff.difficulty); } } catch (Exception e) { Logger.Log(e.ToString()); } }