Пример #1
0
        private void OnConfigChanged(VideoConfig?config)
        {
            var previousVideoPath = VideoConfig?.VideoPath;

            VideoConfig = config;

            if (config == null)
            {
                VideoPlayer.Hide();
                return;
            }

            if (!config.IsPlayable && (config.forceEnvironmentModifications == null || config.forceEnvironmentModifications == false))
            {
                return;
            }

            if (_activeScene == Scene.Menu)
            {
                StopPreview(true);
            }
            else
            {
                VideoPlayer.SetPlacement(Placement.CreatePlacementForConfig(config, _activeScene, VideoPlayer.GetVideoAspectRatio()));
            }

            if (previousVideoPath != config.VideoPath)
            {
                VideoPlayer.Player.prepareCompleted += ConfigChangedPrepareHandler;
                PrepareVideo(config);
            }
            else
            {
                VideoPlayer.LoopVideo(config.loop == true);
                VideoPlayer.screenController.SetShaderParameters(config);
                VideoPlayer.SetBloomIntensity(config.bloom);
            }

            if (config.TransparencyEnabled)
            {
                VideoPlayer.ShowScreenBody();
            }
            else
            {
                VideoPlayer.HideScreenBody();
            }

            if (_activeScene == Scene.SoloGameplay)
            {
                EnvironmentController.VideoConfigSceneModifications(VideoConfig);
            }
        }
Пример #2
0
        private static IEnumerator WaitThenStart()
        {
            //Have to wait two frames, since Chroma waits for one and we have to make sure we run after Chroma without directly interacting with it.
            //Chroma probably waits a frame to make sure the lights are all registered before accessing the LightManager.
            //If we run before Chroma, the prop groups will get different IDs than usual due to the changed z-positions.
            yield return(new WaitForEndOfFrame());

            yield return(new WaitForEndOfFrame());

            //Turns out CustomPlatforms runs even later and undoes some of the scene modifications Cinema does. Waiting for a specific duration is more of a temporary fix.
            //TODO Find a better way to implement this. The problematic coroutine in CustomPlatforms is CustomFloorPlugin.EnvironmentHider+<InternalHideObjectsForPlatform>
            yield return(new WaitForSeconds(0.1f));

            EnvironmentController.ModifyGameScene(PlaybackController.Instance.VideoConfig);
        }