static void Postfix(bool firstActivation, VRUI.VRUIViewController.ActivationType activationType, ref ResultsViewController __instance, ref bool ____newHighScore, ref GameObject ____newHighScoreText) { if (GMPUI.disableFireworks) { ____newHighScoreText.SetActive(initialNewHighScore); } }
static void Prefix(bool firstActivation, VRUI.VRUIViewController.ActivationType activationType, ref ResultsViewController __instance, ref bool ____newHighScore) { if (activationType == VRUI.VRUIViewController.ActivationType.AddedToHierarchy) { if (GMPUI.disableFireworks) { Plugin.Log("Disabling fireworks"); initialNewHighScore = ____newHighScore; ____newHighScore = false; } } }
/// <summary> /// Event triggered when the ResultViewController has been activated /// </summary> /// <param name="firstActivation">Is it the first it has been called ?</param> /// <param name="activationType">The kind of activation</param> private void _ResultViewController_didActivateEvent(bool firstActivation, VRUI.VRUIViewController.ActivationType activationType) { if (Initialized || IsInitializing) { return; } IDifficultyBeatmap diffBeatmap = _ResultViewController.GetPrivateField <IDifficultyBeatmap>("_difficultyBeatmap"); if (diffBeatmap.level.levelID.Length >= 32) { IsInitializing = true; StartCoroutine(_SetupUI()); } else { Initialized = true; } }
private void _standardLevelResultsViewController_didActivateEvent(bool firstActivation, VRUI.VRUIViewController.ActivationType activationType) { IDifficultyBeatmap diffBeatmap = _standardLevelResultsViewController.GetPrivateField <IDifficultyBeatmap>("_difficultyBeatmap"); _lastLevel = diffBeatmap.level; if (!(_lastLevel is CustomPreviewBeatmapLevel)) { _upvoteButton.gameObject.SetActive(false); _downvoteButton.gameObject.SetActive(false); _ratingText.gameObject.SetActive(false); // _reviewButton.gameObject.SetActive(false); } else { _upvoteButton.gameObject.SetActive(true); _downvoteButton.gameObject.SetActive(true); _ratingText.gameObject.SetActive(true); _ratingText.alignment = TextAlignmentOptions.Center; // _reviewButton.gameObject.SetActive(true); _upvoteButton.interactable = false; _downvoteButton.interactable = false; // _reviewButton.interactable = false; _ratingText.text = "LOADING..."; StartCoroutine(GetRatingForSong(_lastLevel)); } }
private void _standardLevelResultsViewController_didActivateEvent(bool firstActivation, VRUI.VRUIViewController.ActivationType activationType) { try { var profilesData = Resources.FindObjectsOfTypeAll <LocalProfilesData>().FirstOrDefault(); IDifficultyBeatmap diffBeatmap = _standardLevelResultsViewController.GetPrivateField <IDifficultyBeatmap>("_difficultyBeatmap"); _lastLevel = diffBeatmap.level; var bestScore = -1; var bestRank = -1f; var completed = -1f; Score bestScoreO = null; foreach (var score in profilesData.lastProfile.Scores) { if (score.score > bestScore) { bestScoreO = score; bestScore = score.score; var acc = score.hitNotes / (score.passedNotes == 0 ? 1 : score.passedNotes); var rankPercent = 1.0f * score.score / profilesData.lastDiff.MaxScore; bestRank = rankPercent; completed = 1.0f * score.timePlayed / profilesData.lastSong.Length; } } //_resultText.SetText($"profile: {profilesData.CurrentProfile}\r\nPlayed: {profilesData.lastProfile.Scores.Count} times"); var resultText = $"Profile: {profilesData.CurrentProfile}\n"; resultText += $"Played: {profilesData.lastProfile.Scores.Count} times\n"; resultText += $"Best score: {bestScore} ({GetRank(bestRank)} {(bestRank * 100f).ToString("0.0")}%) "; var mods = GetMods(bestScoreO); if (mods != null) { resultText += mods; } if (completed < 1) { resultText += $"\nCompleted: {(completed * 100f).ToString("0.0")}%"; } string bestPlayer = null; var bestPlayerScore = -1; var bestPlayerRank = -1f; var bestPlayerCompleted = -1f; string bestPlayerMods = null; foreach (var prof in profilesData.lastDiff.Profiles) { var bestSc = -1; var bestRn = -1f; var bestComp = -1f; string bestMod = null; foreach (var sc in prof.Scores) { if (sc.score > bestSc) { bestSc = sc.score; bestRn = 1.0f * sc.hitNotes / (sc.passedNotes == 0 ? 1 : sc.passedNotes); bestComp = 1.0f * sc.timePlayed / profilesData.lastSong.Length; bestMod = GetMods(sc); } } if (bestSc > bestPlayerScore) { bestPlayerScore = bestSc; bestPlayer = prof.Name; bestPlayerRank = bestRn; bestPlayerCompleted = bestComp; bestPlayerMods = bestMod; } } if (bestPlayer != null) { resultText += $"\n\nBest result for song: {bestPlayer}: {bestPlayerScore} ({GetRank(bestPlayerRank)} {(bestPlayerRank* 100f).ToString("0.0")}%) "; if (bestPlayerMods != null) { resultText += " " + bestPlayerMods; } } _resultText.text = resultText; }catch (Exception ex) { Plugin.Log("Error setting up result display: " + ex); } }