static void Postfix(StandardLevelScenesTransitionSetupDataSO __instance, IDifficultyBeatmap difficultyBeatmap, IPreviewBeatmapLevel previewBeatmapLevel,
                            OverrideEnvironmentSettings overrideEnvironmentSettings, GameplayModifiers gameplayModifiers, ColorScheme overrideColorScheme, PlayerSpecificSettings playerSpecificSettings,
                            ref PracticeSettings practiceSettings, bool useTestNoteCutSoundEffects, MainSettingsModelSO ____mainSettingsModel)
        {
            EnvironmentInfoSO environmentInfoSO = difficultyBeatmap.GetEnvironmentInfo();

            if (overrideEnvironmentSettings is { overrideEnvironments : true })
Ejemplo n.º 2
0
        private static void Prefix(IDifficultyBeatmap difficultyBeatmap, ref OverrideEnvironmentSettings overrideEnvironmentSettings)
        {
            if (difficultyBeatmap.beatmapData is CustomBeatmapData customBeatmapData)
            {
                IEnumerable <string> requirements = ((List <object>)Trees.at(customBeatmapData.beatmapCustomData, "_requirements"))?.Cast <string>();
                IEnumerable <string> suggestions  = ((List <object>)Trees.at(customBeatmapData.beatmapCustomData, "_suggestions"))?.Cast <string>();
                bool chromaRequirement            = (requirements?.Contains(Chroma.Plugin.REQUIREMENTNAME) ?? false) || (suggestions?.Contains(Chroma.Plugin.REQUIREMENTNAME) ?? false);

                // please let me remove this shit
                bool legacyOverride = difficultyBeatmap.beatmapData.beatmapEventsData.Any(n => n.value >= LegacyLightHelper.RGB_INT_OFFSET);
                if (legacyOverride)
                {
                    ChromaLogger.Log("Legacy Chroma Detected...", IPA.Logging.Logger.Level.Warning);
                    ChromaLogger.Log("Please do not use Legacy Chroma for new maps as it is deprecated and its functionality in future versions of Chroma cannot be guaranteed", IPA.Logging.Logger.Level.Warning);
                }

                ChromaController.ToggleChromaPatches((chromaRequirement || legacyOverride) && ChromaConfig.Instance.CustomColorEventsEnabled);
                ChromaController.DoColorizerSabers = chromaRequirement && ChromaConfig.Instance.CustomColorEventsEnabled;

                if (chromaRequirement && ChromaConfig.Instance.EnvironmentEnhancementsEnabled && Trees.at(customBeatmapData.beatmapCustomData, "_environmentRemoval") != null)
                {
                    overrideEnvironmentSettings = null;
                }
            }
        }
 public static void Prefix(ref OverrideEnvironmentSettings overrideEnvironmentSettings)
 {
     UI.Settings.UpdatePlayerData();
     if (!UI.Settings.PlayerData.overrideEnvironmentSettings.overrideEnvironments)
     {
         EnvironmentSceneOverrider.OverrideEnvironment(UI.PlatformsListView.EnvOr);
         overrideEnvironmentSettings = UI.Settings.PlayerData.overrideEnvironmentSettings;
     }
 }
Ejemplo n.º 4
0
 internal static void Patch(IDifficultyBeatmap difficultyBeatmap, ref OverrideEnvironmentSettings overrideEnvironmentSettings)
 {
     if (difficultyBeatmap.beatmapData is CustomBeatmapData customBeatmapData)
     {
         bool chromaRequirement = BasicPatch(customBeatmapData);
         if (chromaRequirement && ChromaConfig.Instance.EnvironmentEnhancementsEnabled && Trees.at(customBeatmapData.beatmapCustomData, "_environmentRemoval") != null)
         {
             overrideEnvironmentSettings = null;
         }
     }
 }
 internal static void Patch(IDifficultyBeatmap difficultyBeatmap, ref OverrideEnvironmentSettings overrideEnvironmentSettings)
 {
     if (difficultyBeatmap.beatmapData is CustomBeatmapData customBeatmapData)
     {
         bool chromaRequirement = BasicPatch(customBeatmapData);
         if (chromaRequirement &&
             ChromaConfig.Instance.EnvironmentEnhancementsEnabled &&
             (Trees.at(customBeatmapData.beatmapCustomData, Chroma.Plugin.ENVIRONMENTREMOVAL) != null || Trees.at(customBeatmapData.customData, Chroma.Plugin.ENVIRONMENT) != null))
         {
             overrideEnvironmentSettings = null;
         }
     }
 }
Ejemplo n.º 6
0
        public void StartLevel(IBeatmapLevel level, BeatmapCharacteristicSO characteristic, BeatmapDifficulty difficulty, GameplayModifiers modifiers, float startTime = 0f)
        {
            Client.Instance.playerInfo.updateInfo.playerComboBlocks = 0;
            Client.Instance.playerInfo.updateInfo.playerCutBlocks   = 0;
            Client.Instance.playerInfo.updateInfo.playerEnergy      = 0f;
            Client.Instance.playerInfo.updateInfo.playerScore       = 0;

            MenuTransitionsHelperSO menuSceneSetupData = Resources.FindObjectsOfTypeAll <MenuTransitionsHelperSO>().FirstOrDefault();

            if (menuSceneSetupData != null)
            {
                PlayerData             playerData     = Resources.FindObjectsOfTypeAll <PlayerDataModelSO>().FirstOrDefault().playerData;
                PlayerSpecificSettings playerSettings = playerData.playerSpecificSettings;

                channelInfo.state = ChannelState.InGame;
                Client.Instance.playerInfo.updateInfo.playerState = PlayerState.Game;

                IDifficultyBeatmap difficultyBeatmap = level.GetDifficultyBeatmap(characteristic, difficulty, false);

#if DEBUG
                Plugin.log.Info($"Starting song: name={level.songName}, levelId={level.levelID}, difficulty={difficulty}");
#endif

                PracticeSettings practiceSettings = new PracticeSettings(PracticeSettings.defaultPracticeSettings);

                practiceSettings.startSongTime = startTime + 1.5f;
                practiceSettings.songSpeedMul  = modifiers.songSpeedMul;
                practiceSettings.startInAdvanceAndClearNotes = true;

                Client.Instance.MessageReceived -= MessageReceived;

                try
                {
                    BS_Utils.Gameplay.Gamemode.NextLevelIsIsolated("Beat Saber Multiplayer");
                }
                catch
                {
                }
                OverrideEnvironmentSettings overrideEnvironmentSettings = new OverrideEnvironmentSettings();
                menuSceneSetupData.StartStandardLevel(difficultyBeatmap, overrideEnvironmentSettings, playerData.colorSchemesSettings.GetSelectedColorScheme(), modifiers, playerSettings, (startTime > 1f ? practiceSettings : null), "Lobby", false, () => {}, (StandardLevelScenesTransitionSetupDataSO sender, LevelCompletionResults levelCompletionResults) => { InGameOnlineController.Instance.SongFinished(sender, levelCompletionResults, difficultyBeatmap, modifiers, (startTime > 1f)); });
            }
            else
            {
                Plugin.log.Error("SceneSetupData is null!");
            }
        }
Ejemplo n.º 7
0
        static bool Prefix(Action beforeSceneSwitchCallback, CampaignFlowCoordinator __instance, MissionSelectionNavigationController ____missionSelectionNavigationController, MenuTransitionsHelper ____menuTransitionsHelper, PlayerDataModelSO ____playerDataModel)
        {
            if (____missionSelectionNavigationController.selectedMissionNode.missionData is CustomMissionDataSO)
            {
                CustomMissionDataSO missionData = ____missionSelectionNavigationController.selectedMissionNode.missionData as CustomMissionDataSO;

                IDifficultyBeatmap          difficultyBeatmap           = BeatmapLevelDataExtensions.GetDifficultyBeatmap(Loader.BeatmapLevelsModelSO.GetBeatmapLevelIfLoaded(missionData.customLevel.levelID).beatmapLevelData, missionData.beatmapCharacteristic, missionData.beatmapDifficulty);
                GameplayModifiers           gameplayModifiers           = missionData.gameplayModifiers;
                MissionObjective[]          missionObjectives           = missionData.missionObjectives;
                PlayerSpecificSettings      playerSpecificSettings      = ____playerDataModel.playerData.playerSpecificSettings;
                OverrideEnvironmentSettings overrideEnvironmentSettings = ____playerDataModel.playerData.overrideEnvironmentSettings;
                ColorSchemesSettings        colorSchemesSettings        = ____playerDataModel.playerData.colorSchemesSettings;
                ColorScheme overrideColorScheme = colorSchemesSettings.overrideDefaultColors ? colorSchemesSettings.GetSelectedColorScheme() : null;
                ____menuTransitionsHelper.StartMissionLevel(difficultyBeatmap, overrideEnvironmentSettings, overrideColorScheme, gameplayModifiers, missionObjectives, playerSpecificSettings, beforeSceneSwitchCallback, __instance.HandleMissionLevelSceneDidFinish);
                return(false);
            }
            return(true);
        }
        static void Prefix(string gameMode, IDifficultyBeatmap difficultyBeatmap, OverrideEnvironmentSettings overrideEnvironmentSettings, ref ColorScheme overrideColorScheme, GameplayModifiers gameplayModifiers, PlayerSpecificSettings playerSpecificSettings, PracticeSettings practiceSettings, string backButtonText, bool useTestNoteCutSoundEffects, Action beforeSceneSwitchCallback, Action <DiContainer> afterSceneSwitchCallback, Action <StandardLevelScenesTransitionSetupDataSO, LevelCompletionResults> levelFinishedCallback)
        {
            Plugin.Log.Info($"Starting ({difficultyBeatmap.GetType().FullName}) {difficultyBeatmap.SerializedName()} {gameMode} {difficultyBeatmap.difficulty} {difficultyBeatmap.level.songName}");

            string startingGameModeName = difficultyBeatmap.parentDifficultyBeatmapSet.beatmapCharacteristic.serializedName;

            if (startingGameModeName == GameModeHelper.GENERATED_360DEGREE_MODE || startingGameModeName == GameModeHelper.GENERATED_90DEGREE_MODE)
            {
                Plugin.Log.Info($"Generating rotation events for {startingGameModeName}...");

                // Colors are not copied from standard mode for some reason? Enforce it here
                var mapCustomColors = difficultyBeatmap.level.environmentInfo?.colorScheme?.colorScheme;
                if (mapCustomColors != null && overrideColorScheme == null)
                {
                    Plugin.Log.Info($"Overriding custom colors with {mapCustomColors.environmentColor0} {mapCustomColors.environmentColor1}");
                    overrideColorScheme = mapCustomColors;
                }

                if (!generated.Contains(difficultyBeatmap))
                {
                    generated.Add(difficultyBeatmap);
                    Generator360 gen = new Generator360();
                    gen.WallGenerator = Config.Instance.EnableWallGenerator;
                    gen.OnlyOneSaber  = Config.Instance.OnlyOneSaber;

                    if (startingGameModeName == GameModeHelper.GENERATED_90DEGREE_MODE)
                    {
                        gen.LimitRotations      = Config.Instance.LimitRotations90;
                        gen.BottleneckRotations = Config.Instance.LimitRotations90 / 2;
                    }
                    else if (startingGameModeName == GameModeHelper.GENERATED_360DEGREE_MODE)
                    {
                        gen.LimitRotations      = Config.Instance.LimitRotations360;
                        gen.BottleneckRotations = Config.Instance.LimitRotations360 / 2;
                    }

                    gen.Generate(difficultyBeatmap);
                }
                else
                {
                    Plugin.Log.Info("Already generated rotation events");
                }
            }
        }
 protected virtual void Client_PlaySong(IPreviewBeatmapLevel level, BeatmapCharacteristicSO characteristic, BeatmapDifficulty difficulty, GameplayModifiers gameOptions, PlayerSpecificSettings playerOptions, OverrideEnvironmentSettings environmentSettings, ColorScheme colors, bool floatingScoreboard, bool streamSync, bool disableFail, bool disablePause)
 {
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Play a loaded song
        /// </summary>
        /// <param name="p_Level">Loaded level</param>
        /// <param name="p_Characteristic">Beatmap game mode</param>
        /// <param name="p_Difficulty">Beatmap difficulty</param>
        /// <param name="p_OverrideEnvironmentSettings">Environment settings</param>
        /// <param name="p_ColorScheme">Color scheme</param>
        /// <param name="p_GameplayModifiers">Modifiers</param>
        /// <param name="p_PlayerSettings">Player settings</param>
        /// <param name="p_SongFinishedCallback">Callback when the song is finished</param>
        public static async void PlaySong(IPreviewBeatmapLevel p_Level,
                                          BeatmapCharacteristicSO p_Characteristic,
                                          BeatmapDifficulty p_Difficulty,
                                          OverrideEnvironmentSettings p_OverrideEnvironmentSettings = null,
                                          ColorScheme p_ColorScheme               = null,
                                          GameplayModifiers p_GameplayModifiers   = null,
                                          PlayerSpecificSettings p_PlayerSettings = null,
                                          Action <StandardLevelScenesTransitionSetupDataSO, LevelCompletionResults, IDifficultyBeatmap> p_SongFinishedCallback = null)
        {
            /*
             * Code from https://github.com/MatrikMoon/TournamentAssistant
             *
             * MIT License
             *
             * Permission is hereby granted, free of charge, to any person obtaining a copy
             * of this software and associated documentation files (the "Software"), to deal
             * in the Software without restriction, including without limitation the rights
             * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
             * copies of the Software, and to permit persons to whom the Software is
             * furnished to do so, subject to the following conditions:
             *
             * The above copyright notice and this permission notice shall be included in all
             * copies or substantial portions of the Software.
             *
             * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
             * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
             * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
             * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
             * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
             * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
             * SOFTWARE.
             */

            Action <IBeatmapLevel> l_SongLoaded = (p_LoadedLevel) =>
            {
                MenuTransitionsHelper l_MenuSceneSetupData = Resources.FindObjectsOfTypeAll <MenuTransitionsHelper>().First();

                var l_DifficultyBeatmap = p_LoadedLevel.beatmapLevelData.GetDifficultyBeatmap(p_Characteristic, p_Difficulty);

                l_MenuSceneSetupData.StartStandardLevel(
                    p_Characteristic.name,
                    l_DifficultyBeatmap,
                    p_OverrideEnvironmentSettings,
                    p_ColorScheme,
                    p_GameplayModifiers ?? new GameplayModifiers(),
                    p_PlayerSettings ?? new PlayerSpecificSettings(),
                    null,
                    "Menu",
                    false,
                    null,
                    (p_StandardLevelScenesTransitionSetupData, p_Results) => p_SongFinishedCallback?.Invoke(p_StandardLevelScenesTransitionSetupData, p_Results, l_DifficultyBeatmap)
                    );
            };

            if ((p_Level is PreviewBeatmapLevelSO && await HasDLCLevel(p_Level.levelID)) || p_Level is CustomPreviewBeatmapLevel)
            {
                Logger.Instance?.Debug("[SDK.Game][Level.PlaySong] Loading DLC/Custom level...");

                var l_Result = await GetLevelFromPreview(p_Level);

                if (l_Result != null && !(l_Result?.isError == true))
                {
                    /// HTTPstatus requires cover texture to be applied in here, and due to a fluke
                    var l_LoadedLevel = l_Result?.beatmapLevel;
                    //l_LoadedLevel.SetField("_coverImageTexture2D", p_Level.GetField<Texture2D>("_coverImageTexture2D"));

                    l_SongLoaded(l_LoadedLevel);
                }
            }
            else if (p_Level is BeatmapLevelSO)
            {
                Logger.Instance?.Debug("[SDK.Game][Level.PlaySong] Reading OST data without songloader...");
                l_SongLoaded(p_Level as IBeatmapLevel);
            }
            else
            {
                Logger.Instance?.Debug($"[SDK.Game][Level.PlaySong] Skipping unowned DLC ({p_Level.songName})");
            }
        }
Ejemplo n.º 11
0
        static void Prefix(StandardLevelScenesTransitionSetupDataSO __instance, string gameMode, IDifficultyBeatmap difficultyBeatmap, OverrideEnvironmentSettings overrideEnvironmentSettings,
                           GameplayModifiers gameplayModifiers, PlayerSpecificSettings playerSpecificSettings, PracticeSettings practiceSettings, string backButtonText, bool useTestNoteCutSoundEffects)
        {
            EnvironmentInfoSO environmentInfoSO = difficultyBeatmap.GetEnvironmentInfo();

            if (overrideEnvironmentSettings != null && overrideEnvironmentSettings.overrideEnvironments)
            {
                environmentInfoSO = overrideEnvironmentSettings.GetOverrideEnvironmentInfoForType(environmentInfoSO.environmentType);
            }

            ScoreSubmission._wasDisabled  = false;
            ScoreSubmission.LastDisablers = Array.Empty <string>();
            Plugin.LevelData.GameplayCoreSceneSetupData = new GameplayCoreSceneSetupData(difficultyBeatmap, gameplayModifiers, playerSpecificSettings, practiceSettings, useTestNoteCutSoundEffects, environmentInfoSO);
            Plugin.LevelData.IsSet = true;
            Plugin.LevelData.Mode  = Mode.Standard;
            Utilities.Logger.log.Debug("Level Data set");
            __instance.didFinishEvent -= __instance_didFinishEvent;
            __instance.didFinishEvent += __instance_didFinishEvent;
        }
Ejemplo n.º 12
0
 static void Prefix(MissionLevelScenesTransitionSetupDataSO __instance, IDifficultyBeatmap difficultyBeatmap, OverrideEnvironmentSettings overrideEnvironmentSettings,
                    MissionObjective[] missionObjectives, GameplayModifiers gameplayModifiers, PlayerSpecificSettings playerSpecificSettings)
 {
     Plugin.LevelData.GameplayCoreSceneSetupData = new GameplayCoreSceneSetupData(difficultyBeatmap, gameplayModifiers, playerSpecificSettings, PracticeSettings.defaultPracticeSettings, false);
     Plugin.LevelData.IsSet     = true;
     __instance.didFinishEvent -= __instance_didFinishEvent;
     __instance.didFinishEvent += __instance_didFinishEvent;
 }
Ejemplo n.º 13
0
 static void Prefix(StandardLevelScenesTransitionSetupDataSO __instance, IDifficultyBeatmap difficultyBeatmap, OverrideEnvironmentSettings overrideEnvironmentSettings, ColorScheme overrideColorScheme,
                    GameplayModifiers gameplayModifiers, PlayerSpecificSettings playerSpecificSettings, PracticeSettings practiceSettings, string backButtonText, bool useTestNoteCutSoundEffects)
 {
     Plugin.LevelData.GameplayCoreSceneSetupData = new GameplayCoreSceneSetupData(difficultyBeatmap, gameplayModifiers, playerSpecificSettings, practiceSettings, useTestNoteCutSoundEffects);
     Plugin.LevelData.IsSet     = true;
     __instance.didFinishEvent -= __instance_didFinishEvent;
     __instance.didFinishEvent += __instance_didFinishEvent;
 }
        static void Prefix(MissionLevelScenesTransitionSetupDataSO __instance, IDifficultyBeatmap difficultyBeatmap, OverrideEnvironmentSettings overrideColorScheme,
                           MissionObjective[] missionObjectives, GameplayModifiers gameplayModifiers, PlayerSpecificSettings playerSpecificSettings)
        {
            EnvironmentInfoSO environmentInfoSO = difficultyBeatmap.GetEnvironmentInfo();

            if (overrideColorScheme != null && overrideColorScheme.overrideEnvironments)
            {
                environmentInfoSO = overrideColorScheme.GetOverrideEnvironmentInfoForType(environmentInfoSO.environmentType);
            }
            ScoreSubmission._wasDisabled  = false;
            ScoreSubmission.LastDisablers = Array.Empty <string>();
            Plugin.LevelData.GameplayCoreSceneSetupData = new GameplayCoreSceneSetupData(difficultyBeatmap, gameplayModifiers, playerSpecificSettings, PracticeSettings.defaultPracticeSettings, false, environmentInfoSO);
            Plugin.LevelData.IsSet = true;
            Plugin.LevelData.Mode  = Mode.Mission;
            Utilities.Logger.log.Debug("Level Data set");
            __instance.didFinishEvent -= __instance_didFinishEvent;
            __instance.didFinishEvent += __instance_didFinishEvent;
        }
 private static void Prefix(IDifficultyBeatmap difficultyBeatmap, ref OverrideEnvironmentSettings overrideEnvironmentSettings)
 {
     SceneTransitionHelper.Patch(difficultyBeatmap, ref overrideEnvironmentSettings);
 }
Ejemplo n.º 16
0
        protected override void Client_PlaySong(IPreviewBeatmapLevel desiredLevel, BeatmapCharacteristicSO desiredCharacteristic, BeatmapDifficulty desiredDifficulty, GameplayModifiers gameplayModifiers, PlayerSpecificSettings playerSpecificSettings, OverrideEnvironmentSettings overrideEnvironmentSettings, ColorScheme colorScheme, bool useFloatingScoreboard = false, bool useSync = false, bool disablePause = false, bool disableFail = false)
        {
            base.Client_PlaySong(desiredLevel, desiredCharacteristic, desiredDifficulty, gameplayModifiers, playerSpecificSettings, overrideEnvironmentSettings, colorScheme, useFloatingScoreboard, useSync, disablePause, disableFail);

            //Set up per-play settings
            Plugin.UseSync = useSync;
            Plugin.UseFloatingScoreboard = useFloatingScoreboard;
            Plugin.DisablePause          = disablePause;
            Plugin.DisableFail           = disableFail;

            //Reset score
            (Plugin.client.Self as Player).Score    = 0;
            (Plugin.client.Self as Player).Accuracy = 0;
            var playerUpdate = new Event();

            playerUpdate.Type          = Event.EventType.PlayerUpdated;
            playerUpdate.ChangedObject = Plugin.client.Self;
            Plugin.client.Send(new Packet(playerUpdate));

            UnityMainThreadDispatcher.Instance().Enqueue(() =>
            {
                //If the player is still on the results screen, go ahead and boot them out
                if (_resultsViewController.isInViewControllerHierarchy)
                {
                    resultsViewController_continueButtonPressedEvent(null);
                }

                SongUtils.PlaySong(desiredLevel, desiredCharacteristic, desiredDifficulty, overrideEnvironmentSettings, colorScheme, gameplayModifiers, playerSpecificSettings, SongFinished);
            });
        }
        public static void Prefix(IDifficultyBeatmap difficultyBeatmap, ref OverrideEnvironmentSettings overrideEnvironmentSettings)
        {
            //Wrap all of it in try/catch so an exception would not prevent the player from playing songs
            try
            {
                PlaybackController.Instance.SceneTransitionInitCalled();
                VideoMenu.instance.SetSelectedLevel(difficultyBeatmap.level);

                if (!SettingsStore.Instance.PluginEnabled || SettingsStore.Instance.ForceDisableEnvironmentOverrides)
                {
                    Log.Info($"Cinema disabled: {!SettingsStore.Instance.PluginEnabled}, environment override force disabled: {SettingsStore.Instance.ForceDisableEnvironmentOverrides}");
                    return;
                }

                var video = PlaybackController.Instance.VideoConfig;
                if (video == null || (!video.IsPlayable && video.forceEnvironmentModifications != true))
                {
                    Log.Debug($"No video or not playable, DownloadState: {video?.DownloadState}");
                    return;
                }

                if (video.environmentName != null)
                {
                    var overrideSettings = GetOverrideEnvironmentSettingsFor(video.environmentName);
                    if (overrideSettings != null)
                    {
                        overrideEnvironmentSettings = overrideSettings;
                        Log.Debug($"Overriding environment to {video.environmentName} as configured");
                        return;
                    }
                }

                if (video.EnvironmentModified)
                {
                    Log.Debug("Environment is modified, disabling environment override");
                    overrideEnvironmentSettings = null !;
                    return;
                }

                var overrideEnvironmentEnabled = SettingsStore.Instance.OverrideEnvironment;
                if (!overrideEnvironmentEnabled)
                {
                    Log.Debug("Cinema's environment override disallowed by user");
                    return;
                }

                var environmentWhitelist = new[]
                {
                    "BigMirrorEnvironment",
                    "OriginsEnvironment",
                    "BTSEnvironment",
                    "KDAEnvironment",
                    "RocketEnvironment",
                    "DragonsEnvironment",
                    "LinkinParkEnvironment",
                    "KaleidoscopeEnvironment",
                    "GlassDesertEnvironment",
                    "MonstercatEnvironment",
                    "CrabRaveEnvironment",
                    "SkrillexEnvironment",
                    "WeaveEnvironment",
                    "PyroEnvironment"
                };

                var mapEnvironmentInfoSo = difficultyBeatmap.GetEnvironmentInfo();
                if (overrideEnvironmentSettings is { overrideEnvironments : true })
                {
                    var overrideEnvironmentInfo = overrideEnvironmentSettings.GetOverrideEnvironmentInfoForType(mapEnvironmentInfoSo.environmentType);
                    if (environmentWhitelist.Contains(overrideEnvironmentInfo.serializedName))
                    {
                        Log.Debug("Environment override by user is in whitelist, allowing override");
                        return;
                    }
                }

                if (environmentWhitelist.Contains(mapEnvironmentInfoSo.serializedName))
                {
                    Log.Debug("Environment chosen by mapper is in whitelist");
                    overrideEnvironmentSettings = null !;
                    return;
                }

                var bigMirrorOverrideSettings = GetOverrideEnvironmentSettingsFor("BigMirrorEnvironment");
                if (bigMirrorOverrideSettings == null)
                {
                    return;
                }

                overrideEnvironmentSettings = bigMirrorOverrideSettings;
                Log.Info("Overwriting environment to Big Mirror");
            }
Ejemplo n.º 18
0
        public static async void PlaySong(IPreviewBeatmapLevel level, BeatmapCharacteristicSO characteristic, BeatmapDifficulty difficulty, OverrideEnvironmentSettings overrideEnvironmentSettings = null, ColorScheme colorScheme = null, GameplayModifiers gameplayModifiers = null, PlayerSpecificSettings playerSettings = null, Action <StandardLevelScenesTransitionSetupDataSO, LevelCompletionResults> songFinishedCallback = null)
        {
            Action <IBeatmapLevel> SongLoaded = (loadedLevel) =>
            {
                MenuTransitionsHelper _menuSceneSetupData = Resources.FindObjectsOfTypeAll <MenuTransitionsHelper>().First();
                _menuSceneSetupData.StartStandardLevel(
                    loadedLevel.beatmapLevelData.GetDifficultyBeatmap(characteristic, difficulty),
                    overrideEnvironmentSettings,
                    colorScheme,
                    gameplayModifiers ?? new GameplayModifiers(),
                    playerSettings ?? new PlayerSpecificSettings(),
                    null,
                    "Menu",
                    false,
                    null,
                    (standardLevelScenesTransitionSetupData, results) => songFinishedCallback?.Invoke(standardLevelScenesTransitionSetupData, results)
                    );
            };

            if ((level is PreviewBeatmapLevelSO && await HasDLCLevel(level.levelID)) ||
                level is CustomPreviewBeatmapLevel)
            {
                Logger.Debug("Loading DLC/Custom level...");
                var result = await GetLevelFromPreview(level);

                if (result != null && !(result?.isError == true))
                {
                    //HTTPstatus requires cover texture to be applied in here, and due to a fluke
                    //of beat saber, it's not applied when the level is loaded, but it *is*
                    //applied to the previewlevel it's loaded from
                    var loadedLevel = result?.beatmapLevel;
                    loadedLevel.SetField("_coverImageTexture2D", level.GetField <Texture2D>("_coverImageTexture2D"));
                    SongLoaded(loadedLevel);
                }
            }
            else if (level is BeatmapLevelSO)
            {
                Logger.Debug("Reading OST data without songloader...");
                SongLoaded(level as IBeatmapLevel);
            }
            else
            {
                Logger.Debug($"Skipping unowned DLC ({level.songName})");
            }
        }
Ejemplo n.º 19
0
        public static async void PlaySong(IPreviewBeatmapLevel level, BeatmapCharacteristicSO characteristic, BeatmapDifficulty difficulty, PlaySong packet)
        {
            flow = (SoloFreePlayFlowCoordinator)Resources.FindObjectsOfTypeAll <MainFlowCoordinator>().First().GetField("_soloFreePlayFlowCoordinator");
            Action <IBeatmapLevel> SongLoaded = (loadedLevel) =>
            {
                Logger.Debug("G");
                MenuTransitionsHelper _menuSceneSetupData = Resources.FindObjectsOfTypeAll <MenuTransitionsHelper>().First();
                IDifficultyBeatmap    diffbeatmap         = loadedLevel.beatmapLevelData.GetDifficultyBeatmap(characteristic, difficulty);
                Logger.Debug("L");
                GameplaySetupViewController gameplaySetupViewController = (GameplaySetupViewController)typeof(SinglePlayerLevelSelectionFlowCoordinator).GetField("_gameplaySetupViewController", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(flow);
                Logger.Debug("D");
                OverrideEnvironmentSettings environmentSettings = gameplaySetupViewController.environmentOverrideSettings;
                ColorScheme scheme = gameplaySetupViewController.colorSchemesSettings.GetSelectedColorScheme();
                //GameplayModifiers modifiers = gameplaySetupViewController.gameplayModifiers;
                PlayerSpecificSettings settings = gameplaySetupViewController.playerSettings;
                //TODO: re add modifier customizability

                PracticeSettings  practiceSettings = ConvertPractice(packet.practiceSettings);
                GameplayModifiers modifiers        = ConvertModifiers(packet.gameplayModifiers, gameplaySetupViewController.gameplayModifiers);
                Logger.Debug(diffbeatmap.level.levelID + " " + scheme.colorSchemeId);
                _menuSceneSetupData.StartStandardLevel(
                    "Solo",
                    diffbeatmap,
                    diffbeatmap.level,
                    environmentSettings,
                    scheme,
                    modifiers,
                    settings,
                    practiceSettings,
                    "Menu",
                    false,
                    null,
                    new Action <StandardLevelScenesTransitionSetupDataSO, LevelCompletionResults>((StandardLevelScenesTransitionSetupDataSO q, LevelCompletionResults r) => { })
                    );
            };

            if (flow == null || flow.gameObject == null || !flow.gameObject.activeInHierarchy)
            {
                Button button = Resources.FindObjectsOfTypeAll <Button>().Where(x => x != null && x.name == "SoloButton").First();
                button.onClick.Invoke();
            }
            if ((level is PreviewBeatmapLevelSO && await HasDLCLevel(level.levelID)) ||
                level is CustomPreviewBeatmapLevel)
            {
                Logger.Debug("Loading DLC/Custom level...");
                var result = await GetLevelFromPreview(level);

                if (!(result?.isError == true))
                {
                    SongLoaded(result?.beatmapLevel);
                    return;
                }
                Logger.Debug("You Suck Idiot");
            }
            else if (level is BeatmapLevelSO)
            {
                Logger.Debug("Reading OST data without songloader...");
                SongLoaded(level as IBeatmapLevel);
            }
            else
            {
                Logger.Debug($"Skipping unowned DLC ({level.songName})");
            }
        }