Exemplo n.º 1
0
        IEnumerator FindDifficultyBeatmap()
        {
            yield return(new WaitUntil(() => BS_Utils.Plugin.LevelData.IsSet));

            _difficultyBeatmap = BS_Utils.Plugin.LevelData.GameplayCoreSceneSetupData.difficultyBeatmap;
            _songID            = new SongID(SongDataUtils.GetHash(_difficultyBeatmap.level.levelID), _difficultyBeatmap.difficulty);
            _rawPP             = SongDataUtils.GetRawPP(_songID);

            // modifiers
            var gameplayModifiersModelSO = Resources.FindObjectsOfTypeAll <GameplayModifiersModelSO>().FirstOrDefault();
            var gameplayModifiers        = BS_Utils.Plugin.LevelData.GameplayCoreSceneSetupData.gameplayModifiers;

            _multiplier = gameplayModifiersModelSO.GetTotalMultiplier(gameplayModifiers);
            _multiplier = (Config.ignoreNoFail && gameplayModifiers.noFail) ? _multiplier + 0.5 : _multiplier;

            // Only update for ranked songs
            if (SongDataUtils.IsRankedSong(_songID))
            {
                yield return(new WaitUntil(() => _beatmapObjectManager != null));

                _beatmapObjectManager.noteWasCutEvent    += OnNoteCut;
                _beatmapObjectManager.noteWasMissedEvent += OnNoteMissed;

                yield return(new WaitUntil(() => _scoreController != null));

                _scoreController.scoreDidChangeEvent += OnScoreChange;
                if (!Config.hideOnStart)
                {
                    UpdateCounter();
                }
            }
        }
Exemplo n.º 2
0
        internal void Refresh(string id)
        {
            if (!Config.showInfo)
            {
                _parentObject.SetActive(false);
                return;
            }

            try
            {
                IDifficultyBeatmap difficultyBeatmap = _standardLevelDetailView.selectedDifficultyBeatmap;
                var newId = new ProfileDataLoader.SongID(id, difficultyBeatmap.difficulty);

                if (SongDataUtils.IsRankedSong(newId))
                {
                    _parentObject.SetActive(true);
                    _rawPP = SongDataUtils.GetRawPP(newId);
                    // Only load the acc in when a new song is selected
                    if (_id == null || !newId.Equals(_id))
                    {
                        _id = newId;
                        LoadAcc();
                    }

                    SetPPText(PPUtils.AllowedModifiers(_id.id, _modifiers));
                }
                else
                {
                    _parentObject.SetActive(false);
                }
            }
            catch (Exception)
            {
                Logger.log.Debug($"error with difficulty for song {id}");
                _parentObject.SetActive(false);
            }
        }