Пример #1
0
        public override void CounterInit()
        {
            var id = SongDataUtils.GetHash(difficultyBeatmap.level.levelID);

            songID = new SongID(id, difficultyBeatmap.difficulty);

            // Don't show anything for unranked songs or if data not initialized
            if (!ppUtils.DataInitialized() || !ppUtils.IsRanked(songID))
            {
                return;
            }

            var gameplayModifiersModelSO = IPA.Utilities.FieldAccessor <RelativeScoreAndImmediateRankCounter, GameplayModifiersModelSO> .Get(relativeScoreAndImmediateRank, "_gameplayModifiersModel");

            GameplayModifiers updatedModifiers = ppUtils.AllowedPositiveModifiers(songID) ?
                                                 gameplayModifiers : GameplayModifierUtils.RemovePositiveModifiers(gameplayModifiers);

            _multiplier = GameplayModifierUtils.CalculateMultiplier(gameplayModifiersModelSO, updatedModifiers);

            counter          = CanvasUtility.CreateTextFromSettings(Settings);
            counter.fontSize = 3;

            relativeScoreAndImmediateRank.relativeScoreOrImmediateRankDidChangeEvent += ScoreUpdated;
            UpdateCounterText(ppUtils.CalculatePP(songID, _multiplier, ppUtils.AllowedPositiveModifiers(songID)));

            if (PluginSettings.Instance.relativeGain)
            {
                var highScore = playerDataModel.playerData.GetPlayerLevelStatsData(difficultyBeatmap).highScore;
                if (highScore == 0)
                {
                    _pbPP = 0;
                    return;
                }

                var maxScore = ScoreModel.ComputeMaxMultipliedScoreForBeatmap(beatmapData);
                var acc      = (float)highScore / maxScore;
                _pbPP = ppUtils.CalculatePP(songID, acc, ppUtils.AllowedPositiveModifiers(songID));
            }
        }