private void Refresh() { Plugin.Log?.Info("Refreshing data..."); var beatmap = BeatSaberUI.LevelDetailViewController.selectedDifficultyBeatmap; if (beatmap == null) { return; } try { _pluginUI.ShowRecords(beatmap, SPHModel.GetRecords(beatmap)); if (PluginConfig.Instance.ShowPlayCounts) { _pluginUI.ShowPlayCount(SPHModel.GetPlayCount(beatmap)); } else { _pluginUI.UnshowPlayCount(); } } catch (Exception ex) // Any UnityException { Plugin.Log?.Error(ex.ToString()); } }
public static bool Prepare() { _thumbsUp ??= LoadSpriteFromResource($"SongPlayHistory.Assets.ThumbsUp.png"); _thumbsDown ??= LoadSpriteFromResource($"SongPlayHistory.Assets.ThumbsDown.png"); return(SPHModel.ScanVoteData()); }
public void OnExit() { BS_Utils.Utilities.BSEvents.gameSceneLoaded -= OnGameSceneLoaded; BS_Utils.Plugin.LevelDidFinishEvent -= OnLevelFinished; BS_Utils.Plugin.MultiLevelDidFinishEvent -= OnMultilevelFinished; SPHModel.BackupRecords(); }
private void OnPlayResultDismiss(ResultsViewController _) { // The user may have voted on this map. SPHModel.ScanVoteData(); BeatSaberUI.ReloadSongList(); Refresh(); }
private void SaveRecord(IDifficultyBeatmap beatmap, LevelCompletionResults result, bool isMultiplayer) { if (result?.rawScore > 0) { // Actually there's no way to know if any custom modifier was applied if the user failed a map. var submissionDisabled = ScoreSubmission.WasDisabled || ScoreSubmission.Disabled || ScoreSubmission.ProlongedDisabled; SPHModel.SaveRecord(beatmap, result, submissionDisabled, isMultiplayer); } }
public Plugin(Logger logger, Config conf) { Log = logger; _harmony = new Harmony(HarmonyId); PluginConfig.Instance = conf.Generated <PluginConfig>(); BSMLSettings.instance.AddSettingsMenu("Song Play History", $"SongPlayHistory.Views.Settings.bsml", SettingsController.instance); SPHModel.InitializeRecords(); }
private void Refresh() { Plugin.Log?.Info("Refreshing data..."); var beatmap = BeatSaberUI.LevelDetailViewController?.selectedDifficultyBeatmap; if (beatmap == null) { return; } try { _pluginUI.SetRecords(beatmap, SPHModel.GetRecords(beatmap)); _pluginUI.SetStats(beatmap, SPHModel.GetPlayerStats(beatmap)); } catch (Exception ex) // Any UnityException { Plugin.Log?.Error(ex.ToString()); } }
private void OnPlayResultDismiss(ResultsViewController resultsViewController) { if (_isPractice) { return; } var result = resultsViewController.GetPrivateField <LevelCompletionResults>("_levelCompletionResults"); if (result.rawScore > 0) { // Actually there's no way to know if any custom modifier was applied if the user failed a song. var beatmap = BeatSaberUI.LevelDetailViewController.selectedDifficultyBeatmap; var submissionDisabled = ScoreSubmission.WasDisabled || ScoreSubmission.Disabled || ScoreSubmission.ProlongedDisabled; SPHModel.SaveRecord(beatmap, result, submissionDisabled); } Refresh(); // The user may have voted on this song. SPHModel.ScanVoteData(); BeatSaberUI.ReloadSongList(); }
public void OnExit() { SPHModel.BackupRecords(); }