Esempio n. 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());
            }
        }
Esempio n. 2
0
        public static bool Prepare()
        {
            _thumbsUp ??= LoadSpriteFromResource($"SongPlayHistory.Assets.ThumbsUp.png");
            _thumbsDown ??= LoadSpriteFromResource($"SongPlayHistory.Assets.ThumbsDown.png");

            return(SPHModel.ScanVoteData());
        }
Esempio n. 3
0
        public void OnExit()
        {
            BS_Utils.Utilities.BSEvents.gameSceneLoaded -= OnGameSceneLoaded;
            BS_Utils.Plugin.LevelDidFinishEvent         -= OnLevelFinished;
            BS_Utils.Plugin.MultiLevelDidFinishEvent    -= OnMultilevelFinished;

            SPHModel.BackupRecords();
        }
Esempio n. 4
0
        private void OnPlayResultDismiss(ResultsViewController _)
        {
            // The user may have voted on this map.
            SPHModel.ScanVoteData();
            BeatSaberUI.ReloadSongList();

            Refresh();
        }
Esempio n. 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);
     }
 }
Esempio n. 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();
        }
Esempio n. 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());
            }
        }
Esempio n. 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();
        }
Esempio n. 9
0
 public void OnExit()
 {
     SPHModel.BackupRecords();
 }