Пример #1
0
        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());
            }
        }
Пример #2
0
        public static bool Prepare()
        {
            _thumbsUp ??= LoadSpriteFromResource($"SongPlayHistory.Assets.ThumbsUp.png");
            _thumbsDown ??= LoadSpriteFromResource($"SongPlayHistory.Assets.ThumbsDown.png");

            return(SPHModel.ScanVoteData());
        }
Пример #3
0
        public void OnExit()
        {
            BS_Utils.Utilities.BSEvents.gameSceneLoaded -= OnGameSceneLoaded;
            BS_Utils.Plugin.LevelDidFinishEvent         -= OnLevelFinished;
            BS_Utils.Plugin.MultiLevelDidFinishEvent    -= OnMultilevelFinished;

            SPHModel.BackupRecords();
        }
Пример #4
0
        private void OnPlayResultDismiss(ResultsViewController _)
        {
            // The user may have voted on this map.
            SPHModel.ScanVoteData();
            BeatSaberUI.ReloadSongList();

            Refresh();
        }
Пример #5
0
 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);
     }
 }
Пример #6
0
        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();
        }
Пример #7
0
        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());
            }
        }
Пример #8
0
        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();
        }
Пример #9
0
 public void OnExit()
 {
     SPHModel.BackupRecords();
 }