private async void ReloadBeatmap() { string filePath = Path.Combine(_currentLevel.customLevelPath, _currentDiffBeatmap.beatmapFilename); string leveljson = File.ReadAllText(filePath); //Load new beatmapdata asynchronously BeatmapData newBeatmap = await _levelLoader.LoadBeatmapDataAsync(_currentLevel.customLevelPath, _currentDiffBeatmap.beatmapFilename, _currentLevel.standardLevelInfoSaveData, _cancelSource.Token); GameplayCoreSceneSetupData gameSetup = BS_Utils.Plugin.LevelData.GameplayCoreSceneSetupData; EnvironmentEffectsFilterPreset environmentEffectsFilterPreset = ((BeatmapDifficulty)(Enum.Parse(typeof(BeatmapDifficulty), _currentDiffBeatmap.difficulty)) == BeatmapDifficulty.ExpertPlus) ? gameSetup.playerSpecificSettings.environmentEffectsFilterExpertPlusPreset : gameSetup.playerSpecificSettings.environmentEffectsFilterDefaultPreset; newBeatmap = (BeatmapData)BeatmapDataTransformHelper.CreateTransformedBeatmapData(newBeatmap, _currentLevel, gameSetup.gameplayModifiers, gameSetup.practiceSettings, gameSetup.playerSpecificSettings.leftHanded, environmentEffectsFilterPreset, gameSetup.environmentInfo.environmentIntensityReductionOptions); //Hotswap Beatmap ResetTimeSync(); DestroyObjects(); ResetNoteCutSoundEffects(); _callbackController.SetField("_spawningStartTime", _songStartTime); _callbackController.SetNewBeatmapData(newBeatmap); //Unpause if (_pauseController.GetField <bool>("_paused")) { CheckPracticePlugin(); _pauseController.HandlePauseMenuManagerDidPressContinueButton(); } _queuedLoad = false; }
public static void Postfix(IDifficultyBeatmap difficultyBeatmap, PlayerSpecificSettings playerSpecificSettings, ref ColorScheme overrideColorScheme) { loadedLights = false; loadError = false; playerLaserErr = false; ringErr = false; isInMultiplayer = true; Plugin.Log.Info("In multiplayer."); EnvironmentEffectsFilterPreset defaultPreset = playerSpecificSettings.environmentEffectsFilterDefaultPreset; EnvironmentEffectsFilterPreset ePlusPreset = playerSpecificSettings.environmentEffectsFilterExpertPlusPreset; if (difficultyBeatmap.difficulty == BeatmapDifficulty.ExpertPlus && ePlusPreset == EnvironmentEffectsFilterPreset.NoEffects) { staticLights = true; } else if (difficultyBeatmap.difficulty != BeatmapDifficulty.ExpertPlus && defaultPreset == EnvironmentEffectsFilterPreset.NoEffects) { staticLights = true; } else { staticLights = false; } EnvironmentInfoSO eiso = difficultyBeatmap.GetEnvironmentInfo(); colours = overrideColorScheme ?? new ColorScheme(eiso.colorScheme); BoostColour b = Plugin.Boost; ColorScheme mapColor = new ColorScheme("CustomColourScheme", "CustomColourScheme", false, colours.saberAColor, colours.saberBColor, colours.environmentColor0, colours.environmentColor1, true, new Color(b.r0, b.g0, b.b0), new Color(b.r1, b.g1, b.b1), colours.obstaclesColor); overrideColorScheme = mapColor; colours = mapColor; colour0 = colours.environmentColor0; colour1 = colours.environmentColor1; ringErr = false; }