コード例 #1
0
ファイル: ChromaController.cs プロジェクト: Pixelguymm/Chroma
        internal static IEnumerator DelayedStart(BeatmapObjectSpawnController beatmapObjectSpawnController)
        {
            yield return(new WaitForEndOfFrame());

            BeatmapObjectSpawnController = beatmapObjectSpawnController;

            // prone to breaking if anything else implements these interfaces
            BeatmapObjectManager            beatmapObjectManager = _beatmapObjectSpawnAccessor(ref beatmapObjectSpawnController) as BeatmapObjectManager;
            BeatmapObjectCallbackController coreSetup            = _callbackControllerAccessor(ref beatmapObjectSpawnController) as BeatmapObjectCallbackController;

            IAudioTimeSource = _audioTimeSourceAccessor(ref coreSetup);
            IReadonlyBeatmapData beatmapData = _beatmapDataAccessor(ref coreSetup);

            beatmapObjectManager.noteWasCutEvent -= NoteColorizer.ColorizeSaber;
            beatmapObjectManager.noteWasCutEvent += NoteColorizer.ColorizeSaber;

            if (Harmony.HasAnyPatches(HARMONYID))
            {
                if (beatmapData is CustomBeatmapData customBeatmap)
                {
                    if (ChromaConfig.Instance.EnvironmentEnhancementsEnabled)
                    {
                        EnvironmentEnhancementManager.Init(customBeatmap, beatmapObjectSpawnController.noteLinesDistance);
                    }
                }

                // please let me kill legacy
                LegacyLightHelper.Activate(beatmapData.beatmapEventsData);
            }
        }
コード例 #2
0
        public static CustomLightshowController Create(
            CustomLightshowData lightshowData,
            LightEffectController[] lights,
            ColorScheme colorScheme,
            IAudioTimeSource timeSource,
            LightMode restoreMode,
            float restoreDefaultLightsAfter
            )
        {
            CustomLightshowController controller = new GameObject("TwitchFXCustomLightshowController").AddComponent <CustomLightshowController>();

            if (restoreMode == LightMode.CustomLightshow)
            {
                CustomLightshowController prevLightshow = LightController.instance.lightshowController;

                restoreMode = prevLightshow.restoreMode;
                restoreDefaultLightsAfter = prevLightshow.restoreDefaultLightsAfter;

                prevLightshow.skipRestoreMode = true;

                if (lightshowData.colorPreset != null)
                {
                    controller.restoreSaberColorLeft   = prevLightshow.restoreSaberColorLeft;
                    controller.restoreSaberColorRight  = prevLightshow.restoreSaberColorRight;
                    controller.restoreNoteColorLeft    = prevLightshow.restoreNoteColorLeft;
                    controller.restoreNoteColorRight   = prevLightshow.restoreNoteColorRight;
                    controller.restoreWallColor        = prevLightshow.restoreWallColor;
                    controller.restoreSaberColorsAfter = prevLightshow.restoreSaberColorsAfter;
                    controller.restoreNoteColorsAfter  = prevLightshow.restoreNoteColorsAfter;
                    controller.restoreWallColorAfter   = prevLightshow.restoreWallColorAfter;
                    controller.skipSetRestore          = true;

                    prevLightshow.skipRestoreColors = true;
                }

                Destroy(prevLightshow);
                LightController.instance.lightshowController = null;
            }

            controller.lightshowData             = lightshowData;
            controller.lights                    = lights;
            controller.colorScheme               = colorScheme;
            controller.timeSource                = timeSource;
            controller.restoreMode               = restoreMode;
            controller.restoreDefaultLightsAfter = restoreDefaultLightsAfter;

            return(controller);
        }
コード例 #3
0
 public void Inject(
     ColorScheme colorScheme,
     LightWithIdManager lightWithIdManager,
     BeatmapObjectCallbackController bocc,
     BeatEffectSpawner beatEffectSpawner,
     IAudioTimeSource timeSource,
     LightSwitchEventEffect[] defaultLights
     )
 {
     this.colorScheme        = colorScheme;
     this.lightWithIdManager = lightWithIdManager;
     this.bocc = bocc;
     this.beatEffectSpawner = beatEffectSpawner;
     this.timeSource        = timeSource;
     this.defaultLights     = defaultLights;
 }
コード例 #4
0
 protected void Constractor(
     IStatusManager statusManager,
     GameStatus gameStatus,
     RelativeScoreAndImmediateRankCounter relativeScoreAndImmediateRankCounter,
     IAudioTimeSource audioTimeSource,
     GameplayCoreSceneSetupData gameplayCoreSceneSetupData,
     ISongDataUtil songDataUtil,
     IGamePause gamePause)
 {
     this._statusManager = statusManager;
     this._relativeScoreAndImmediateRankCounter = relativeScoreAndImmediateRankCounter;
     this._audioTimeSource            = audioTimeSource;
     this._gameplayCoreSceneSetupData = gameplayCoreSceneSetupData;
     this._songDataUtil = songDataUtil;
     this._gamePause    = gamePause;
     this._gameStatus   = gameStatus;
 }
コード例 #5
0
        public static LightEffectController Create(
            LightWithIdManagerWrapper lightManager,
            LightMode activeOnMode,
            LightSwitchEventEffect baseLight,
            IAudioTimeSource timeSource
            )
        {
            int id = Helper.GetValue <int>(baseLight, "_lightsID");
            BeatmapEventType eventTypeForThisLight = Helper.GetValue <BeatmapEventType>(baseLight, "_event");

            int lastEventValue = Helper.GetValue <int>(baseLight, "_prevLightSwitchBeatmapEventDataValue");

            LightEffectController controller = new GameObject("TwitchFXLightEffectController").AddComponent <LightEffectController>();

            controller.timeSource            = timeSource;
            controller.lightManager          = lightManager;
            controller.activeOnMode          = activeOnMode;
            controller.id                    = id;
            controller.eventTypeForThisLight = eventTypeForThisLight;

            controller.lastEventData = new BeatmapEventData(0f, eventTypeForThisLight, lastEventValue);

            controller.enabled = baseLight.enabled;

            if (baseLight.enabled)
            {
                float highlightValue = Helper.GetValue <float>(baseLight, "_highlightValue");

                controller.transitionValue = highlightValue;

                controller.startColor = offColor;
                controller.endColor   = offColor;
            }

            return(controller);
        }
コード例 #6
0
ファイル: ChromaController.cs プロジェクト: ipoo8/Chroma
        internal static IEnumerator DelayedStart(BeatmapObjectSpawnController beatmapObjectSpawnController)
        {
            yield return(new WaitForEndOfFrame());

            BeatmapObjectSpawnController = beatmapObjectSpawnController;
            BeatmapObjectManager            beatmapObjectManager = _beatmapObjectSpawnAccessor(ref beatmapObjectSpawnController) as BeatmapObjectManager;
            BeatmapObjectCallbackController coreSetup            = _callbackControllerAccessor(ref beatmapObjectSpawnController);

            IAudioTimeSource = _audioTimeSourceAccessor(ref coreSetup);
            IReadonlyBeatmapData beatmapData = _beatmapDataAccessor(ref coreSetup);

            beatmapObjectManager.noteWasCutEvent -= NoteColorizer.ColorizeSaber;
            beatmapObjectManager.noteWasCutEvent += NoteColorizer.ColorizeSaber;

            if (ChromaConfig.Instance.LightshowModifier)
            {
                foreach (BeatmapLineData b in beatmapData.beatmapLinesData)
                {
                    BeatmapLineData refBeatmapLineData = b;
                    _beatmapObjectsDataAccessor(ref refBeatmapLineData) = b.beatmapObjectsData.Where((source, index) => b.beatmapObjectsData[index].beatmapObjectType != BeatmapObjectType.Note).ToList();
                }

                foreach (Saber saber in Resources.FindObjectsOfTypeAll <Saber>())
                {
                    saber.gameObject.SetActive(false);
                }

                BS_Utils.Gameplay.ScoreSubmission.DisableSubmission("Chroma");

                if (ChromaConfig.Instance.PlayersPlace)
                {
                    GameObject.Find("PlayersPlace")?.SetActive(false);
                }

                if (ChromaConfig.Instance.Spectrograms)
                {
                    GameObject.Find("Spectrograms")?.SetActive(false);
                }

                if (ChromaConfig.Instance.BackColumns)
                {
                    GameObject.Find("BackColumns")?.SetActive(false);
                }

                if (ChromaConfig.Instance.Buildings)
                {
                    GameObject.Find("Buildings")?.SetActive(false);
                }
            }

            if (Harmony.HasAnyPatches(HARMONYID))
            {
                if (beatmapData is CustomBeatmapData customBeatmap)
                {
                    if (ChromaConfig.Instance.EnvironmentEnhancementsEnabled)
                    {
                        // Spaghetti code below until I can figure out a better way of doing this
                        dynamic       dynData       = customBeatmap.beatmapCustomData;
                        List <object> objectsToKill = Trees.at(dynData, ENVIRONMENTREMOVAL);
                        if (objectsToKill != null)
                        {
                            IEnumerable <GameObject> gameObjects = Resources.FindObjectsOfTypeAll <GameObject>();
                            foreach (string s in objectsToKill.Cast <string>())
                            {
                                if (s == "TrackLaneRing" || s == "BigTrackLaneRing")
                                {
                                    foreach (GameObject n in gameObjects.Where(obj => obj.name.Contains(s)))
                                    {
                                        if (s == "TrackLaneRing" && n.name.Contains("Big"))
                                        {
                                            continue;
                                        }

                                        n.SetActive(false);
                                    }
                                }
                                else
                                {
                                    foreach (GameObject n in gameObjects
                                             .Where(obj => obj.name.Contains(s) && (obj.scene.name?.Contains("Environment") ?? false) && (!obj.scene.name?.Contains("Menu") ?? false)))
                                    {
                                        n.SetActive(false);
                                    }
                                }
                            }
                        }
                    }
                }

                // please let me kill legacy
                LegacyLightHelper.Activate(beatmapData.beatmapEventsData);
            }
        }
コード例 #7
0
 public void Construct([InjectOptional] IAudioTimeSource audioTimeSource, [InjectOptional] BeatmapCallbacksController beatmapCallbacksController)
 {
     _audioTimeSource            = audioTimeSource;
     _beatmapCallbacksController = beatmapCallbacksController;
 }
コード例 #8
0
ファイル: ChromaController.cs プロジェクト: TheAnnoDog/Chroma
        internal static IEnumerator DelayedStart(BeatmapObjectSpawnController beatmapObjectSpawnController)
        {
            yield return(new WaitForEndOfFrame());

            BeatmapObjectSpawnController = beatmapObjectSpawnController;

            // prone to breaking if anything else implements these interfaces
            BeatmapObjectManager            beatmapObjectManager = _beatmapObjectSpawnAccessor(ref beatmapObjectSpawnController) as BeatmapObjectManager;
            BeatmapObjectCallbackController coreSetup            = _callbackControllerAccessor(ref beatmapObjectSpawnController) as BeatmapObjectCallbackController;

            IAudioTimeSource = _audioTimeSourceAccessor(ref coreSetup);
            IReadonlyBeatmapData beatmapData = _beatmapDataAccessor(ref coreSetup);

            beatmapObjectManager.noteWasCutEvent -= NoteColorizer.ColorizeSaber;
            beatmapObjectManager.noteWasCutEvent += NoteColorizer.ColorizeSaber;

            if (Harmony.HasAnyPatches(HARMONYID))
            {
                if (beatmapData is CustomBeatmapData customBeatmap)
                {
                    if (ChromaConfig.Instance.EnvironmentEnhancementsEnabled)
                    {
                        // Spaghetti code below until I can figure out a better way of doing this
                        dynamic       dynData       = customBeatmap.beatmapCustomData;
                        List <object> objectsToKill = Trees.at(dynData, ENVIRONMENTREMOVAL);

                        // seriously what the f**k beat games
                        // GradientBackground permanently yeeted because it looks awful and can ruin multi-colored chroma maps
                        if (objectsToKill == null)
                        {
                            objectsToKill = new List <object>();
                        }

                        objectsToKill.Add("GradientBackground");

                        if (objectsToKill != null)
                        {
                            IEnumerable <GameObject> gameObjects = Resources.FindObjectsOfTypeAll <GameObject>();
                            foreach (string s in objectsToKill.Cast <string>())
                            {
                                if (s == "TrackLaneRing" || s == "BigTrackLaneRing")
                                {
                                    foreach (GameObject n in gameObjects.Where(obj => obj.name.Contains(s)))
                                    {
                                        if (s == "TrackLaneRing" && n.name.Contains("Big"))
                                        {
                                            continue;
                                        }

                                        n.SetActive(false);
                                    }
                                }
                                else
                                {
                                    foreach (GameObject n in gameObjects
                                             .Where(obj => obj.name.Contains(s) && (obj.scene.name?.Contains("Environment") ?? false) && (!obj.scene.name?.Contains("Menu") ?? false)))
                                    {
                                        n.SetActive(false);
                                    }
                                }
                            }
                        }
                    }
                }

                // please let me kill legacy
                LegacyLightHelper.Activate(beatmapData.beatmapEventsData);
            }
        }
コード例 #9
0
 public void Inject(IAudioTimeSource timeSource)
 {
     this.timeSource = timeSource;
 }