Пример #1
0
        public void ModifiersChanged()
        {
            var gameplayModifiersPanelController = Resources.FindObjectsOfTypeAll <GameplayModifiersPanelController>().FirstOrDefault();

            _modifiers = gameplayModifiersPanelController.GetPrivateField <GameplayModifiers>("_gameplayModifiers");
            if (SongDataUtils.IsRankedSong(_id))
            {
                SetPPText(PPUtils.AllowedModifiers(_id.id, _modifiers));
            }
        }
Пример #2
0
        public void LevelCleared(StandardLevelScenesTransitionSetupDataSO standardLevelScenesTransitionSetupDataSO, LevelCompletionResults levelCompletionResults)
        {
            Logger.log.Debug("Level cleared");
            // Score submission disabled or using practice mode
            if (BS_Utils.Gameplay.ScoreSubmission.WasDisabled || BS_Utils.Gameplay.ScoreSubmission.ProlongedDisabled ||
                ((GameplayCoreSceneSetupData)standardLevelScenesTransitionSetupDataSO.sceneSetupDataArray.First(x => x.GetType().Equals(typeof(GameplayCoreSceneSetupData)))).practiceSettings != null)
            {
                Logger.log.Debug("Practice mode or score disabled");
                return;
            }

            var gameplayCoreSceneSetupData = ((GameplayCoreSceneSetupData)standardLevelScenesTransitionSetupDataSO.sceneSetupDataArray[1]);
            var difficultyBeatmap          = gameplayCoreSceneSetupData.difficultyBeatmap;

            SongID songID = SongDataUtils.GetSongID(difficultyBeatmap);

            // I don't like putting play history here but until I do a refactor I'm gonna keep it here
            if (SongDataUtils.IsRankedSong(songID) || Config.playHistory)
            {
                Logger.log.Debug("Beat song");
                GameplayModifiers modifiers = new GameplayModifiers(levelCompletionResults.gameplayModifiers);
                // Remove positive modifiers if not allowed
                if (!PPUtils.AllowedModifiers(songID.id, modifiers))
                {
                    Logger.log.Debug("Using invalid modifiers, removing from score");
                    modifiers = BeatSaberUtils.RemovePositiveModifiers(modifiers);
                }

                var    multiplier = levelCompletionResults.gameplayModifiersModel.GetTotalMultiplier(modifiers);
                var    score      = levelCompletionResults.rawScore * multiplier;
                var    maxScore   = ScoreModel.MaxRawScoreForNumberOfNotes(difficultyBeatmap.beatmapData.notesCount);
                double acc        = (double)score / (double)maxScore;
                Logger.log.Debug($"acc: {acc}");

                if (SongDataUtils.IsRankedSong(songID))
                {
                    SubmitPlay(songID, acc);
                }
                else
                {
                    PlayHistoryTracker.UpdatePlayHistory(songID, acc);
                }
            }
        }
Пример #3
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);
            }
        }
Пример #4
0
 private void ChangedAcc(float value)
 {
     value     = (float)Math.Round(value, 2);
     _accuracy = value;
     SetPPText(PPUtils.AllowedModifiers(_id.id, _modifiers));
 }