public void ChangeColor(Color color, float time = 0, TrackLaneRing ring = null) { if (ring is null) { if (colorCoroutine != null) { StopCoroutine(colorCoroutine); } if (time > 0) { colorCoroutine = StartCoroutine(changeColor(color, time)); } else { UpdateColor(color * Mathf.GammaToLinearSpace(HDR_Intensity), true, null); } } else { if (ringColors.TryGetValue(ring, out Coroutine colorR) && colorR != null) { StopCoroutine(colorR); } List <LightingEvent> filteredEvents = ring.gameObject.GetComponentsInChildren <LightingEvent>().ToList(); if (time > 0) { ringColors[ring] = StartCoroutine(changeColor(color, time, filteredEvents)); } else { UpdateColor(color * Mathf.GammaToLinearSpace(HDR_Intensity), true, filteredEvents); } } }
private static bool Prefix( TrackLaneRing __instance, float interpolationFactor, float ____prevRotZ, float ____rotZ, Vector3 ____positionOffset, float ____prevPosZ, float ____posZ, Transform ____transform) { if (!EnvironmentEnhancementManager.RingRotationOffsets.TryGetValue(__instance, out Quaternion rotation)) { rotation = Quaternion.identity; } float interpolatedZPos = ____prevPosZ + ((____posZ - ____prevPosZ) * interpolationFactor); Vector3 positionZOffset = rotation * Vector3.forward * interpolatedZPos; Vector3 pos = ____positionOffset + positionZOffset; float interpolatedZRot = ____prevRotZ + ((____rotZ - ____prevRotZ) * interpolationFactor); Quaternion rotationZOffset = Quaternion.AngleAxis(interpolatedZRot, Vector3.forward); Quaternion rot = rotation * rotationZOffset; ____transform.localRotation = rot; ____transform.localPosition = pos; return(false); }
internal void Init(Track track, float noteLinesDistance, TrackLaneRing trackLaneRing, ParametricBoxController parametricBoxController) { _track = track; _noteLinesDistance = noteLinesDistance; _trackLaneRing = trackLaneRing; _parametricBoxController = parametricBoxController; }
public void CreateTrackRings(GameObject go) { rotationSpawners = new List <TrackLaneRingsRotationEffectSpawner>(); stepSpawners = new List <TrackLaneRingsPositionStepEffectSpawner>(); trackLaneRingsManagers = new List <TrackLaneRingsManager>(); trackRingsDescriptors = new List <TrackRings>(); TrackRings[] ringsDescriptors = go.GetComponentsInChildren <TrackRings>(); foreach (TrackRings trackRingDesc in ringsDescriptors) { trackRingsDescriptors.Add(trackRingDesc); TrackLaneRingsManager ringsManager = trackRingDesc.gameObject.AddComponent <TrackLaneRingsManager>(); trackLaneRingsManagers.Add(ringsManager); PlatformManager.SpawnedComponents.Add(ringsManager); TrackLaneRing ring = trackRingDesc.trackLaneRingPrefab.AddComponent <TrackLaneRing>(); PlatformManager.SpawnedComponents.Add(ring); ReflectionUtil.SetPrivateField(ringsManager, "_trackLaneRingPrefab", ring); ReflectionUtil.SetPrivateField(ringsManager, "_ringCount", trackRingDesc.ringCount); ReflectionUtil.SetPrivateField(ringsManager, "_ringPositionStep", trackRingDesc.ringPositionStep); if (trackRingDesc.useRotationEffect) { TrackLaneRingsRotationEffect rotationEffect = trackRingDesc.gameObject.AddComponent <TrackLaneRingsRotationEffect>(); PlatformManager.SpawnedComponents.Add(rotationEffect); ReflectionUtil.SetPrivateField(rotationEffect, "_trackLaneRingsManager", ringsManager); ReflectionUtil.SetPrivateField(rotationEffect, "_startupRotationAngle", trackRingDesc.startupRotationAngle); ReflectionUtil.SetPrivateField(rotationEffect, "_startupRotationStep", trackRingDesc.startupRotationStep); ReflectionUtil.SetPrivateField(rotationEffect, "_startupRotationPropagationSpeed", (int)Math.Round(trackRingDesc.startupRotationPropagationSpeed)); ReflectionUtil.SetPrivateField(rotationEffect, "_startupRotationFlexySpeed", trackRingDesc.startupRotationFlexySpeed); TrackLaneRingsRotationEffectSpawner rotationEffectSpawner = trackRingDesc.gameObject.AddComponent <TrackLaneRingsRotationEffectSpawner>(); rotationSpawners.Add(rotationEffectSpawner); PlatformManager.SpawnedComponents.Add(rotationEffectSpawner); ReflectionUtil.SetPrivateField(rotationEffectSpawner, "_beatmapObjectCallbackController", Plugin.bocc); ReflectionUtil.SetPrivateField(rotationEffectSpawner, "_beatmapEventType", (BeatmapEventType)trackRingDesc.rotationSongEventType); ReflectionUtil.SetPrivateField(rotationEffectSpawner, "_rotationStep", trackRingDesc.rotationStep); ReflectionUtil.SetPrivateField(rotationEffectSpawner, "_rotationPropagationSpeed", (int)Math.Round(trackRingDesc.rotationPropagationSpeed)); ReflectionUtil.SetPrivateField(rotationEffectSpawner, "_rotationFlexySpeed", trackRingDesc.rotationFlexySpeed); ReflectionUtil.SetPrivateField(rotationEffectSpawner, "_trackLaneRingsRotationEffect", rotationEffect); } if (trackRingDesc.useStepEffect) { TrackLaneRingsPositionStepEffectSpawner stepEffectSpawner = trackRingDesc.gameObject.AddComponent <TrackLaneRingsPositionStepEffectSpawner>(); stepSpawners.Add(stepEffectSpawner); PlatformManager.SpawnedComponents.Add(stepEffectSpawner); ReflectionUtil.SetPrivateField(stepEffectSpawner, "_beatmapObjectCallbackController", Plugin.bocc); ReflectionUtil.SetPrivateField(stepEffectSpawner, "_trackLaneRingsManager", ringsManager); ReflectionUtil.SetPrivateField(stepEffectSpawner, "_beatmapEventType", (BeatmapEventType)trackRingDesc.stepSongEventType); ReflectionUtil.SetPrivateField(stepEffectSpawner, "_minPositionStep", trackRingDesc.minPositionStep); ReflectionUtil.SetPrivateField(stepEffectSpawner, "_maxPositionStep", trackRingDesc.maxPositionStep); ReflectionUtil.SetPrivateField(stepEffectSpawner, "_moveSpeed", trackRingDesc.moveSpeed); } } }
public void Flash(Color color, TrackLaneRing ring = null) { if (ring is null) { if (alphaCoroutine != null) { StopCoroutine(alphaCoroutine); } if (colorCoroutine != null) { StopCoroutine(colorCoroutine); } UpdateColor(color * Mathf.GammaToLinearSpace(Mathf.Ceil(HDR_Intensity)), true, null); UpdateColor(Color.white, false, null); colorCoroutine = StartCoroutine(changeColor(color, FadeTime, null)); } else { if (ringAlphas.TryGetValue(ring, out Coroutine alphaR) && alphaR != null) { StopCoroutine(alphaR); } if (ringColors.TryGetValue(ring, out Coroutine colorR) && colorR != null) { StopCoroutine(colorR); } List <LightingEvent> filteredEvents = ring.gameObject.GetComponentsInChildren <LightingEvent>().ToList(); UpdateColor(color * Mathf.GammaToLinearSpace(Mathf.Ceil(HDR_Intensity)), true, filteredEvents); UpdateColor(Color.white, false, filteredEvents); ringColors[ring] = StartCoroutine(changeColor(color, FadeTime, filteredEvents)); } }
private static bool Prefix(TrackLaneRing __instance) { if (EnvironmentEnhancementManager.SkipRingUpdate != null && EnvironmentEnhancementManager.SkipRingUpdate.TryGetValue(__instance, out bool doSkip)) { return(!doSkip); } return(true); }
internal static void Postfix(TrackLaneRing __instance) { if (Settings.instance.EnableBackgrounds) { Renderer[] renderers = __instance.GetComponentsInChildren <Renderer>(); foreach (Renderer renderer in renderers) { renderer.forceRenderingOff = Settings.instance.HideRings; } } }
internal static void HandleTrackData( GameObject gameObject, dynamic gameObjectData, IReadonlyBeatmapData beatmapData, float noteLinesDistance, TrackLaneRing trackLaneRing, ParametricBoxController parametricBoxController) { if (NoodleController.NoodleExtensionsActive) { Track track = NoodleExtensions.Animation.AnimationHelper.GetTrackPreload(gameObjectData, beatmapData); if (track != null) { GameObjectTrackController trackController = gameObject.AddComponent <GameObjectTrackController>(); trackController.Init(track, noteLinesDistance, trackLaneRing, parametricBoxController); } } }
public void Fade(Color color, TrackLaneRing ring = null) { if (!ControllingLights.Any() || !gameObject.activeInHierarchy) { return; } if (!CanBeTurnedOff) { ChangeColor(color, 0, ring); return; } if (ring is null) { if (alphaCoroutine != null) { StopCoroutine(alphaCoroutine); } if (colorCoroutine != null) { StopCoroutine(colorCoroutine); } UpdateColor(color * Mathf.GammaToLinearSpace(Mathf.Ceil(HDR_Intensity)), true, null); UpdateColor(Color.white, false, null); colorCoroutine = StartCoroutine(changeColor(Color.black, FadeTime, null)); alphaCoroutine = StartCoroutine(changeAlpha(0, FadeTime, null)); } else { if (ringAlphas.TryGetValue(ring, out Coroutine alphaR) && alphaR != null) { StopCoroutine(alphaR); } if (ringColors.TryGetValue(ring, out Coroutine colorR) && colorR != null) { StopCoroutine(colorR); } List <LightingEvent> filteredEvents = ring.gameObject.GetComponentsInChildren <LightingEvent>().ToList(); UpdateColor(color * Mathf.GammaToLinearSpace(Mathf.Ceil(HDR_Intensity)), true, filteredEvents); UpdateColor(Color.white, false, filteredEvents); ringColors[ring] = StartCoroutine(changeColor(Color.black, FadeTime, filteredEvents)); ringAlphas[ring] = StartCoroutine(changeAlpha(0, FadeTime, filteredEvents)); } }
public void ChangeAlpha(float Alpha, float time = 0, TrackLaneRing ring = null) { if (!ControllingLights.Any() || !gameObject.activeInHierarchy) { return; } if (ring is null) { if (alphaCoroutine != null) { StopCoroutine(alphaCoroutine); } if (colorCoroutine != null) { StopCoroutine(colorCoroutine); } if (time > 0) { alphaCoroutine = StartCoroutine(changeAlpha(Alpha, time)); } else { UpdateColor(Color.white * Alpha, false); } } else { if (ringAlphas.TryGetValue(ring, out Coroutine alphaR) && alphaR != null) { StopCoroutine(alphaR); } List <LightingEvent> filteredEvents = ring.gameObject.GetComponentsInChildren <LightingEvent>().ToList(); if (time > 0) { ringAlphas[ring] = StartCoroutine(changeAlpha(Alpha, time, filteredEvents)); } else { UpdateColor(Color.white * Alpha, false, filteredEvents); } } }
// ReSharper disable once CognitiveComplexity public void PlatformEnabled(DiContainer container) { if (trackLaneRingPrefab is null) { return; } container.Inject(this); if (_trackLaneRingsManager is null) { _materialSwapper !.ReplaceMaterials(trackLaneRingPrefab); gameObject.SetActive(false); TrackLaneRing trackLaneRing = trackLaneRingPrefab.AddComponent <TrackLaneRing>(); _trackLaneRingsManager = gameObject.AddComponent <TrackLaneRingsManager>(); _trackLaneRingPrefabAccessor(ref _trackLaneRingsManager) = trackLaneRing; _ringCountAccessor(ref _trackLaneRingsManager) = ringCount; _ringPositionStepAccessor(ref _trackLaneRingsManager) = ringPositionStep; _spawnAsChildrenAccessor(ref _trackLaneRingsManager) = true; gameObject.SetActive(true); foreach (INotifyPlatformEnabled?notifyEnable in GetComponentsInChildren <INotifyPlatformEnabled>(true).Where(x => !ReferenceEquals(x, this))) { notifyEnable?.PlatformEnabled(container); } } if (useRotationEffect) { if (_trackLaneRingsRotationEffectSpawner is null) { TrackLaneRingsRotationEffect trackLaneRingsRotationEffect = gameObject.AddComponent <TrackLaneRingsRotationEffect>(); _rotationEffectTrackLaneRingsManagerAccessor(ref trackLaneRingsRotationEffect) = _trackLaneRingsManager; _startupRotationAngleAccessor(ref trackLaneRingsRotationEffect) = startupRotationAngle; _startupRotationStepAccessor(ref trackLaneRingsRotationEffect) = startupRotationStep; int timePerRing = startupRotationPropagationSpeed / ringCount; float ringsPerFrame = Time.fixedDeltaTime / timePerRing; _startupRotationPropagationSpeedAccessor(ref trackLaneRingsRotationEffect) = Mathf.Max((int)ringsPerFrame, 1); _startupRotationFlexySpeedAccessor(ref trackLaneRingsRotationEffect) = startupRotationFlexySpeed; _trackLaneRingsRotationEffectSpawner = gameObject.AddComponent <TrackLaneRingsRotationEffectSpawner>(); _trackLaneRingsRotationEffectSpawner.enabled = _beatmapCallbacksController is not null; _rotationEffectSpawnerBeatmapCallbacksControllerAccessor(ref _trackLaneRingsRotationEffectSpawner) = _beatmapCallbacksController; _rotationEffectSpawnerBeatmapEventTypeAccessor(ref _trackLaneRingsRotationEffectSpawner) = (BasicBeatmapEventType)rotationSongEventType; _rotationStepAccessor(ref _trackLaneRingsRotationEffectSpawner) = rotationStep; int timePerRing2 = rotationPropagationSpeed / ringCount; float ringsPerFrame2 = Time.fixedDeltaTime / timePerRing2; _rotationPropagationSpeedAccessor(ref _trackLaneRingsRotationEffectSpawner) = Mathf.Max((int)ringsPerFrame2, 1); _rotationFlexySpeedAccessor(ref _trackLaneRingsRotationEffectSpawner) = rotationFlexySpeed; _trackLaneRingsRotationEffectAccessor(ref _trackLaneRingsRotationEffectSpawner) = trackLaneRingsRotationEffect; } else if (_beatmapCallbacksController is not null) { _trackLaneRingsRotationEffectSpawner.enabled = true; _rotationEffectSpawnerBeatmapCallbacksControllerAccessor(ref _trackLaneRingsRotationEffectSpawner) = _beatmapCallbacksController; _trackLaneRingsRotationEffectSpawner.Start(); } } if (useStepEffect) { if (_trackLaneRingsPositionStepEffectSpawner is null) { _trackLaneRingsPositionStepEffectSpawner = gameObject.AddComponent <TrackLaneRingsPositionStepEffectSpawner>(); _trackLaneRingsPositionStepEffectSpawner.enabled = _beatmapCallbacksController is not null; _positionStepEffectSpawnerTrackLaneRingsManagerAccessor(ref _trackLaneRingsPositionStepEffectSpawner) = _trackLaneRingsManager; _positionStepEffectSpawnerBeatmapCallbacksControllerAccessor(ref _trackLaneRingsPositionStepEffectSpawner) = _beatmapCallbacksController; _positionStepEffectSpawnerBeatmapEventTypeAccessor(ref _trackLaneRingsPositionStepEffectSpawner) = (BasicBeatmapEventType)stepSongEventType; _minPositionStepAccessor(ref _trackLaneRingsPositionStepEffectSpawner) = minPositionStep; _maxPositionStepAccessor(ref _trackLaneRingsPositionStepEffectSpawner) = maxPositionStep; _moveSpeedAccessor(ref _trackLaneRingsPositionStepEffectSpawner) = moveSpeed; } else if (_beatmapCallbacksController is not null) { _trackLaneRingsPositionStepEffectSpawner.enabled = true; _positionStepEffectSpawnerBeatmapCallbacksControllerAccessor(ref _trackLaneRingsPositionStepEffectSpawner) = _beatmapCallbacksController; _trackLaneRingsPositionStepEffectSpawner.Start(); } } }
internal static void Init(CustomBeatmapData customBeatmapData, float noteLinesDistance) { List <dynamic> environmentData = Trees.at(customBeatmapData.customData, ENVIRONMENT); GetAllGameObjects(); if (environmentData != null) { RingRotationOffsets.Clear(); ParametricBoxControllerParameters.TransformParameters.Clear(); if (Settings.ChromaConfig.Instance.PrintEnvironmentEnhancementDebug) { ChromaLogger.Log($"====================================="); } foreach (dynamic gameObjectData in environmentData) { string id = Trees.at(gameObjectData, ID); string lookupString = Trees.at(gameObjectData, LOOKUPMETHOD); LookupMethod lookupMethod = (LookupMethod)Enum.Parse(typeof(LookupMethod), lookupString); int?dupeAmount = (int?)Trees.at(gameObjectData, DUPLICATIONAMOUNT); bool?active = (bool?)Trees.at(gameObjectData, ACTIVE); Vector3?scale = GetVectorData(gameObjectData, SCALE); Vector3?position = GetVectorData(gameObjectData, POSITION); Vector3?rotation = GetVectorData(gameObjectData, OBJECTROTATION); Vector3?localPosition = GetVectorData(gameObjectData, LOCALPOSITION); Vector3?localRotation = GetVectorData(gameObjectData, LOCALROTATION); List <GameObjectInfo> foundObjects = LookupID(id, lookupMethod); if (Settings.ChromaConfig.Instance.PrintEnvironmentEnhancementDebug) { ChromaLogger.Log($"ID [\"{id}\"] using method [{lookupMethod:G}] found:"); foundObjects.ForEach(n => ChromaLogger.Log(n.FullID)); } List <GameObjectInfo> gameObjectInfos; if (dupeAmount.HasValue) { gameObjectInfos = new List <GameObjectInfo>(); foreach (GameObjectInfo gameObjectInfo in foundObjects) { if (Settings.ChromaConfig.Instance.PrintEnvironmentEnhancementDebug) { ChromaLogger.Log($"Duplicating [{gameObjectInfo.FullID}]:"); } GameObject gameObject = gameObjectInfo.GameObject; Transform parent = gameObject.transform.parent; Scene scene = gameObject.scene; for (int i = 0; i < dupeAmount.Value; i++) { List <IComponentData> componentDatas = new List <IComponentData>(); ComponentInitializer.PrefillComponentsData(gameObject.transform, componentDatas); GameObject newGameObject = UnityEngine.Object.Instantiate(gameObject); ComponentInitializer.PostfillComponentsData(newGameObject.transform, gameObject.transform, componentDatas); SceneManager.MoveGameObjectToScene(newGameObject, scene); newGameObject.transform.SetParent(parent, true); ComponentInitializer.InitializeComponents(newGameObject.transform, gameObject.transform, _gameObjectInfos, componentDatas); gameObjectInfos.AddRange(_gameObjectInfos.Where(n => n.GameObject == newGameObject)); } } } else { gameObjectInfos = foundObjects; } foreach (GameObjectInfo gameObjectInfo in gameObjectInfos) { GameObject gameObject = gameObjectInfo.GameObject; if (active.HasValue) { gameObjectInfo.GameObject.SetActive(active.Value); } Transform transform = gameObject.transform; if (scale.HasValue) { transform.localScale = scale.Value; } if (position.HasValue) { transform.position = position.Value * noteLinesDistance; } if (rotation.HasValue) { transform.eulerAngles = rotation.Value; } if (localPosition.HasValue) { transform.localPosition = localPosition.Value * noteLinesDistance; } if (localRotation.HasValue) { transform.localEulerAngles = localRotation.Value; } // Handle TrackLaneRing TrackLaneRing trackLaneRing = gameObject.GetComponent <TrackLaneRing>(); if (trackLaneRing != null) { if (position.HasValue || localPosition.HasValue) { _positionOffsetAccessor(ref trackLaneRing) = transform.localPosition; _posZAccessor(ref trackLaneRing) = 0; } if (rotation.HasValue || localRotation.HasValue) { RingRotationOffsets[trackLaneRing] = transform.localRotation; _rotZAccessor(ref trackLaneRing) = 0; } } // Handle ParametricBoxController ParametricBoxController parametricBoxController = gameObject.GetComponent <ParametricBoxController>(); if (parametricBoxController != null) { if (position.HasValue || localPosition.HasValue) { ParametricBoxControllerParameters.SetTransformPosition(parametricBoxController, transform.localPosition); } if (scale.HasValue) { ParametricBoxControllerParameters.SetTransformScale(parametricBoxController, transform.localScale); } } if (NoodleExtensionsInstalled) { GameObjectTrackController.HandleTrackData(gameObject, gameObjectData, customBeatmapData, noteLinesDistance, trackLaneRing, parametricBoxController); } } if (Settings.ChromaConfig.Instance.PrintEnvironmentEnhancementDebug) { ChromaLogger.Log($"====================================="); } } } LegacyEnvironmentRemoval.Init(customBeatmapData); }
internal static void Init(CustomBeatmapData customBeatmapData, float noteLinesDistance) { IEnumerable <Dictionary <string, object?> >?environmentData = customBeatmapData.customData.Get <List <object> >(ENVIRONMENT)?.Cast <Dictionary <string, object?> >(); GetAllGameObjects(); RingRotationOffsets = new Dictionary <TrackLaneRing, Quaternion>(); AvoidancePosition = new Dictionary <BeatmapObjectsAvoidance, Vector3>(); AvoidanceRotation = new Dictionary <BeatmapObjectsAvoidance, Quaternion>(); ParametricBoxControllerParameters.TransformParameters = new Dictionary <ParametricBoxController, ParametricBoxControllerParameters>(); if (environmentData != null) { RingRotationOffsets.Clear(); ParametricBoxControllerParameters.TransformParameters.Clear(); if (Settings.ChromaConfig.Instance !.PrintEnvironmentEnhancementDebug) { Plugin.Logger.Log($"====================================="); } foreach (Dictionary <string, object?> gameObjectData in environmentData) { string id = gameObjectData.Get <string>(ID) ?? throw new InvalidOperationException("Id was not defined."); string lookupString = gameObjectData.Get <string>(LOOKUPMETHOD) ?? throw new InvalidOperationException("Lookup method was not defined."); LookupMethod lookupMethod = (LookupMethod)Enum.Parse(typeof(LookupMethod), lookupString); int?dupeAmount = gameObjectData.Get <int?>(DUPLICATIONAMOUNT); bool?active = gameObjectData.Get <bool?>(ACTIVE); Vector3?scale = GetVectorData(gameObjectData, SCALE); Vector3?position = GetVectorData(gameObjectData, POSITION); Vector3?rotation = GetVectorData(gameObjectData, OBJECTROTATION); Vector3?localPosition = GetVectorData(gameObjectData, LOCALPOSITION); Vector3?localRotation = GetVectorData(gameObjectData, LOCALROTATION); int?lightID = gameObjectData.Get <int?>(LIGHTID); List <GameObjectInfo> foundObjects = LookupID(id, lookupMethod); if (Settings.ChromaConfig.Instance !.PrintEnvironmentEnhancementDebug) { if (foundObjects.Count > 0) { Plugin.Logger.Log($"ID [\"{id}\"] using method [{lookupMethod:G}] found:"); foundObjects.ForEach(n => Plugin.Logger.Log(n.FullID)); } else { Plugin.Logger.Log($"ID [\"{id}\"] using method [{lookupMethod:G}] found nothing.", IPA.Logging.Logger.Level.Error); } } List <GameObjectInfo> gameObjectInfos; if (dupeAmount.HasValue) { gameObjectInfos = new List <GameObjectInfo>(); foreach (GameObjectInfo gameObjectInfo in foundObjects) { if (Settings.ChromaConfig.Instance !.PrintEnvironmentEnhancementDebug) { Plugin.Logger.Log($"Duplicating [{gameObjectInfo.FullID}]:"); } GameObject gameObject = gameObjectInfo.GameObject; Transform parent = gameObject.transform.parent; Scene scene = gameObject.scene; for (int i = 0; i < dupeAmount.Value; i++) { List <IComponentData> componentDatas = new List <IComponentData>(); ComponentInitializer.PrefillComponentsData(gameObject.transform, componentDatas); GameObject newGameObject = UnityEngine.Object.Instantiate(gameObject); ComponentInitializer.PostfillComponentsData(newGameObject.transform, gameObject.transform, componentDatas); SceneManager.MoveGameObjectToScene(newGameObject, scene); newGameObject.transform.SetParent(parent, true); ComponentInitializer.InitializeComponents(newGameObject.transform, gameObject.transform, _gameObjectInfos, componentDatas, lightID); List <GameObjectInfo> gameObjects = _gameObjectInfos.Where(n => n.GameObject == newGameObject).ToList(); gameObjectInfos.AddRange(gameObjects); if (Settings.ChromaConfig.Instance !.PrintEnvironmentEnhancementDebug) { gameObjects.ForEach(n => Plugin.Logger.Log(n.FullID)); } } } } else { if (lightID.HasValue) { Plugin.Logger.Log($"LightID requested but no duplicated object to apply to.", IPA.Logging.Logger.Level.Error); } gameObjectInfos = foundObjects; } foreach (GameObjectInfo gameObjectInfo in gameObjectInfos) { GameObject gameObject = gameObjectInfo.GameObject; if (active.HasValue) { gameObjectInfo.GameObject.SetActive(active.Value); } Transform transform = gameObject.transform; if (scale.HasValue) { transform.localScale = scale.Value; } if (position.HasValue) { transform.position = position.Value * noteLinesDistance; } if (rotation.HasValue) { transform.eulerAngles = rotation.Value; } if (localPosition.HasValue) { transform.localPosition = localPosition.Value * noteLinesDistance; } if (localRotation.HasValue) { transform.localEulerAngles = localRotation.Value; } // Handle TrackLaneRing TrackLaneRing trackLaneRing = gameObject.GetComponent <TrackLaneRing>(); if (trackLaneRing != null) { if (position.HasValue || localPosition.HasValue) { _positionOffsetAccessor(ref trackLaneRing) = transform.localPosition; _posZAccessor(ref trackLaneRing) = 0; } if (rotation.HasValue || localRotation.HasValue) { RingRotationOffsets[trackLaneRing] = transform.localRotation; _rotZAccessor(ref trackLaneRing) = 0; } } // Handle ParametricBoxController ParametricBoxController parametricBoxController = gameObject.GetComponent <ParametricBoxController>(); if (parametricBoxController != null) { if (position.HasValue || localPosition.HasValue) { ParametricBoxControllerParameters.SetTransformPosition(parametricBoxController, transform.localPosition); } if (scale.HasValue) { ParametricBoxControllerParameters.SetTransformScale(parametricBoxController, transform.localScale); } } // Handle BeatmapObjectsAvoidance BeatmapObjectsAvoidance beatmapObjectsAvoidance = gameObject.GetComponent <BeatmapObjectsAvoidance>(); if (beatmapObjectsAvoidance != null) { if (position.HasValue || localPosition.HasValue) { AvoidancePosition[beatmapObjectsAvoidance] = transform.localPosition; } if (rotation.HasValue || localRotation.HasValue) { AvoidanceRotation[beatmapObjectsAvoidance] = transform.localRotation; } } GameObjectTrackController.HandleTrackData(gameObject, gameObjectData, customBeatmapData, noteLinesDistance, trackLaneRing, parametricBoxController, beatmapObjectsAvoidance); } if (Settings.ChromaConfig.Instance !.PrintEnvironmentEnhancementDebug) { Plugin.Logger.Log($"====================================="); } } } try { LegacyEnvironmentRemoval.Init(customBeatmapData); } catch (Exception e) { Plugin.Logger.Log("Could not run Legacy Enviroment Removal"); Plugin.Logger.Log(e); } }
void HandleLights(LightsManager group, int value, MapEvent e) { Color color = Color.white; if (group is null) { return; //Why go through extra processing for shit that dont exist } //Check if its a legacy Chroma RGB event if (value >= ColourManager.RGB_INT_OFFSET) { if (ChromaCustomColors.ContainsKey(group)) { ChromaCustomColors[group] = ColourManager.ColourFromInt(value); } else { ChromaCustomColors.Add(group, ColourManager.ColourFromInt(value)); } return; } else if (value == ColourManager.RGB_RESET) { if (ChromaCustomColors.TryGetValue(group, out Color _)) { ChromaCustomColors.Remove(group); } } //Set initial light values if (value <= 3) { color = BlueColor; } else if (value <= 7) { color = RedColor; } if (ChromaCustomColors.ContainsKey(group)) { color = ChromaCustomColors[group]; } //Grab big ring propogation if any TrackLaneRing ring = null; if (e._type == MapEvent.EVENT_TYPE_RING_LIGHTS && e._customData?["_propID"] != null) { if (BigRingManager is null) { return; } int propID = e._customData["_propID"].AsInt; if (propID < BigRingManager.rings.Count()) { ring = BigRingManager.rings[propID]; } } if (value == MapEvent.LIGHT_VALUE_OFF) { group.ChangeAlpha(0, 0, ring); } else if (value == MapEvent.LIGHT_VALUE_BLUE_ON || value == MapEvent.LIGHT_VALUE_RED_ON) { group.ChangeColor(color, 0, ring); group.ChangeAlpha(1, 0, ring); } else if (value == MapEvent.LIGHT_VALUE_BLUE_FLASH || value == MapEvent.LIGHT_VALUE_RED_FLASH) { group.Flash(color, ring); } else if (value == MapEvent.LIGHT_VALUE_BLUE_FADE || value == MapEvent.LIGHT_VALUE_RED_FADE) { group.Fade(color, ring); } }
/// <summary> /// Creates and stores references to multiple objects (of different types) per <see cref="TrackRings"/> on the <paramref name="gameObject"/> /// </summary> /// <param name="gameObject">What <see cref="GameObject"/> to create TrackRings for</param> internal void CreateTrackRings(GameObject gameObject) { rotationSpawners = new List <TrackLaneRingsRotationEffectSpawner>(); stepSpawners = new List <TrackLaneRingsPositionStepEffectSpawner>(); trackLaneRingsManagers = new List <TrackLaneRingsManager>(); trackRingsDescriptors = new List <TrackRings>(); TrackRings[] ringsDescriptors = gameObject.GetComponentsInChildren <TrackRings>(); foreach (TrackRings trackRingDesc in ringsDescriptors) { trackRingsDescriptors.Add(trackRingDesc); TrackLaneRingsManager ringsManager = trackRingDesc.gameObject.AddComponent <TrackLaneRingsManager>(); trackLaneRingsManagers.Add(ringsManager); PlatformManager.SpawnedComponents.Add(ringsManager); TrackLaneRing ring = trackRingDesc.trackLaneRingPrefab.AddComponent <TrackLaneRing>(); PlatformManager.SpawnedComponents.Add(ring); ringsManager.SetField("_trackLaneRingPrefab", ring); ringsManager.SetField("_ringCount", trackRingDesc.ringCount); ringsManager.SetField("_ringPositionStep", trackRingDesc.ringPositionStep); ringsManager.SetField("_spawnAsChildren", true); if (trackRingDesc.useRotationEffect) { TrackLaneRingsRotationEffect rotationEffect = trackRingDesc.gameObject.AddComponent <TrackLaneRingsRotationEffect>(); PlatformManager.SpawnedComponents.Add(rotationEffect); rotationEffect.SetField("_trackLaneRingsManager", ringsManager); rotationEffect.SetField("_startupRotationAngle", trackRingDesc.startupRotationAngle); rotationEffect.SetField("_startupRotationStep", trackRingDesc.startupRotationStep); int timePerRing = trackRingDesc.startupRotationPropagationSpeed / trackRingDesc.ringCount; float ringsPerFrame = Time.fixedDeltaTime / timePerRing; rotationEffect.SetField("_startupRotationPropagationSpeed", Math.Max((int)ringsPerFrame, 1)); rotationEffect.SetField("_startupRotationFlexySpeed", trackRingDesc.startupRotationFlexySpeed); TrackLaneRingsRotationEffectSpawner rotationEffectSpawner = trackRingDesc.gameObject.AddComponent <TrackLaneRingsRotationEffectSpawner>(); rotationSpawners.Add(rotationEffectSpawner); PlatformManager.SpawnedComponents.Add(rotationEffectSpawner); rotationEffectSpawner.SetField("_beatmapObjectCallbackController", _beatmapObjectCallbackController); rotationEffectSpawner.SetField("_beatmapEventType", (BeatmapEventType)trackRingDesc.rotationSongEventType); rotationEffectSpawner.SetField("_rotationStep", trackRingDesc.rotationStep); int timePerRing2 = trackRingDesc.rotationPropagationSpeed / trackRingDesc.ringCount; float ringsPerFrame2 = Time.fixedDeltaTime / timePerRing2; rotationEffectSpawner.SetField("_rotationPropagationSpeed", Math.Max((int)ringsPerFrame2, 1)); rotationEffectSpawner.SetField("_rotationFlexySpeed", trackRingDesc.rotationFlexySpeed); rotationEffectSpawner.SetField("_trackLaneRingsRotationEffect", rotationEffect); } if (trackRingDesc.useStepEffect) { TrackLaneRingsPositionStepEffectSpawner stepEffectSpawner = trackRingDesc.gameObject.AddComponent <TrackLaneRingsPositionStepEffectSpawner>(); stepSpawners.Add(stepEffectSpawner); PlatformManager.SpawnedComponents.Add(stepEffectSpawner); stepEffectSpawner.SetField("_beatmapObjectCallbackController", _beatmapObjectCallbackController); stepEffectSpawner.SetField("_trackLaneRingsManager", ringsManager); stepEffectSpawner.SetField("_beatmapEventType", (BeatmapEventType)trackRingDesc.stepSongEventType); stepEffectSpawner.SetField("_minPositionStep", trackRingDesc.minPositionStep); stepEffectSpawner.SetField("_maxPositionStep", trackRingDesc.maxPositionStep); stepEffectSpawner.SetField("_moveSpeed", trackRingDesc.moveSpeed); } } }
// ReSharper disable once CognitiveComplexity public async void PlatformEnabled(DiContainer container) { if (trackLaneRingPrefab is null) { return; } container.Inject(this); if (_trackLaneRingsManager is null) { await _materialSwapper !.ReplaceMaterialsAsync(trackLaneRingPrefab); gameObject.SetActive(false); TrackLaneRing trackLaneRing = trackLaneRingPrefab.AddComponent <TrackLaneRing>(); _trackLaneRingsManager = gameObject.AddComponent <TrackLaneRingsManager>(); _trackLaneRingsManager.SetField("_trackLaneRingPrefab", trackLaneRing); _trackLaneRingsManager.SetField("_ringCount", ringCount); _trackLaneRingsManager.SetField("_ringPositionStep", ringPositionStep); _trackLaneRingsManager.SetField("_spawnAsChildren", true); gameObject.SetActive(true); foreach (INotifyPlatformEnabled notifyEnable in GetComponentsInChildren <INotifyPlatformEnabled>(true)) { if (!ReferenceEquals(this, notifyEnable)) { notifyEnable?.PlatformEnabled(container); } } } if (useRotationEffect) { if (_trackLaneRingsRotationEffectSpawner is null) { TrackLaneRingsRotationEffect trackLaneRingsRotationEffect = gameObject.AddComponent <TrackLaneRingsRotationEffect>(); trackLaneRingsRotationEffect.SetField("_trackLaneRingsManager", _trackLaneRingsManager); trackLaneRingsRotationEffect.SetField("_startupRotationAngle", startupRotationAngle); trackLaneRingsRotationEffect.SetField("_startupRotationStep", startupRotationStep); int timePerRing = startupRotationPropagationSpeed / ringCount; float ringsPerFrame = Time.fixedDeltaTime / timePerRing; trackLaneRingsRotationEffect.SetField("_startupRotationPropagationSpeed", Mathf.Max((int)ringsPerFrame, 1)); trackLaneRingsRotationEffect.SetField("_startupRotationFlexySpeed", startupRotationFlexySpeed); _trackLaneRingsRotationEffectSpawner = gameObject.AddComponent <TrackLaneRingsRotationEffectSpawner>(); _trackLaneRingsRotationEffectSpawner.enabled = _beatmapObjectCallbackController is not null; _trackLaneRingsRotationEffectSpawner.SetField("_beatmapObjectCallbackController", _beatmapObjectCallbackController); _trackLaneRingsRotationEffectSpawner.SetField("_beatmapEventType", (BeatmapEventType)rotationSongEventType); _trackLaneRingsRotationEffectSpawner.SetField("_rotationStep", rotationStep); int timePerRing2 = rotationPropagationSpeed / ringCount; float ringsPerFrame2 = Time.fixedDeltaTime / timePerRing2; _trackLaneRingsRotationEffectSpawner.SetField("_rotationPropagationSpeed", Mathf.Max((int)ringsPerFrame2, 1)); _trackLaneRingsRotationEffectSpawner.SetField("_rotationFlexySpeed", rotationFlexySpeed); _trackLaneRingsRotationEffectSpawner.SetField("_trackLaneRingsRotationEffect", trackLaneRingsRotationEffect); } else if (_beatmapObjectCallbackController is not null) { _trackLaneRingsRotationEffectSpawner.enabled = true; _trackLaneRingsRotationEffectSpawner.SetField("_beatmapObjectCallbackController", _beatmapObjectCallbackController); _trackLaneRingsRotationEffectSpawner.Start(); } } if (useStepEffect) { if (_trackLaneRingsPositionStepEffectSpawner is null) { _trackLaneRingsPositionStepEffectSpawner = gameObject.AddComponent <TrackLaneRingsPositionStepEffectSpawner>(); _trackLaneRingsPositionStepEffectSpawner.enabled = _beatmapObjectCallbackController is not null; _trackLaneRingsPositionStepEffectSpawner.SetField("_beatmapObjectCallbackController", _beatmapObjectCallbackController); _trackLaneRingsPositionStepEffectSpawner.SetField("_trackLaneRingsManager", _trackLaneRingsManager); _trackLaneRingsPositionStepEffectSpawner.SetField("_beatmapEventType", (BeatmapEventType)stepSongEventType); _trackLaneRingsPositionStepEffectSpawner.SetField("_minPositionStep", minPositionStep); _trackLaneRingsPositionStepEffectSpawner.SetField("_maxPositionStep", maxPositionStep); _trackLaneRingsPositionStepEffectSpawner.SetField("_moveSpeed", moveSpeed); } else if (_beatmapObjectCallbackController is not null) { _trackLaneRingsPositionStepEffectSpawner.enabled = true; _trackLaneRingsPositionStepEffectSpawner.SetField("_beatmapObjectCallbackController", _beatmapObjectCallbackController); _trackLaneRingsPositionStepEffectSpawner.Start(); } } }
internal void Init(Track track, float noteLinesDistance, TrackLaneRing trackLaneRing) { _track = track; _noteLinesDistance = noteLinesDistance; _trackLaneRing = trackLaneRing; }
private LSEColorManager(MonoBehaviour mono, BeatmapEventType type) { _lse = mono; _type = type; InitializeSOs(mono, "_lightColor0", ref _lightColor0, ref _lightColor0_Original, ref _mLightColor0); InitializeSOs(mono, "_highlightColor0", ref _lightColor0, ref _lightColor0_Original, ref _mHighlightColor0); InitializeSOs(mono, "_lightColor1", ref _lightColor1, ref _lightColor1_Original, ref _mLightColor1); InitializeSOs(mono, "_highlightColor1", ref _lightColor1, ref _lightColor1_Original, ref _mHighlightColor1); if (mono is LightSwitchEventEffect lse) { InitializeSOs(mono, "_lightColor0Boost", ref _lightColor0Boost, ref _lightColor0Boost_Original, ref _mLightColor0Boost); InitializeSOs(mono, "_highlightColor0Boost", ref _lightColor0Boost, ref _lightColor0Boost_Original, ref _mHighlightColor0Boost); InitializeSOs(mono, "_lightColor1Boost", ref _lightColor1Boost, ref _lightColor1Boost_Original, ref _mLightColor1Boost); InitializeSOs(mono, "_highlightColor1Boost", ref _lightColor1Boost, ref _lightColor1Boost_Original, ref _mHighlightColor1Boost); _supportBoostColor = true; LightWithIdManager lightManager = lse.GetField <LightWithIdManager, LightSwitchEventEffect>("_lightManager"); Lights = lightManager.GetField <List <ILightWithId>[], LightWithIdManager>("_lights")[lse.lightsId].ToList(); IDictionary <int, List <ILightWithId> > lightsPreGroup = new Dictionary <int, List <ILightWithId> >(); TrackLaneRingsManager[] managers = Object.FindObjectsOfType <TrackLaneRingsManager>(); foreach (ILightWithId light in Lights) { if (light is MonoBehaviour monoBehaviour) { int z = Mathf.RoundToInt(monoBehaviour.transform.position.z); TrackLaneRing ring = monoBehaviour.GetComponentInParent <TrackLaneRing>(); if (ring != null) { TrackLaneRingsManager mngr = managers.FirstOrDefault(it => it.Rings.IndexOf(ring) >= 0); if (mngr != null) { z = 1000 + mngr.Rings.IndexOf(ring); } } if (lightsPreGroup.TryGetValue(z, out List <ILightWithId> list)) { list.Add(light); } else { list = new List <ILightWithId>() { light }; lightsPreGroup.Add(z, list); } } } LightsPropagationGrouped = new ILightWithId[lightsPreGroup.Count][]; int i = 0; foreach (List <ILightWithId> lightList in lightsPreGroup.Values) { if (lightList is null) { continue; } LightsPropagationGrouped[i] = lightList.ToArray(); i++; } } }
internal LightColorizer(LightSwitchEventEffect lightSwitchEventEffect, BeatmapEventType beatmapEventType) { _lightSwitchEventEffect = lightSwitchEventEffect; _eventType = beatmapEventType; InitializeSO("_lightColor0", 0); InitializeSO("_highlightColor0", 0); InitializeSO("_lightColor1", 1); InitializeSO("_highlightColor1", 1); InitializeSO("_lightColor0Boost", 2); InitializeSO("_highlightColor0Boost", 2); InitializeSO("_lightColor1Boost", 3); InitializeSO("_highlightColor1Boost", 3); // AAAAAA PROPAGATION STUFFF LightWithIdManager lightManager = _lightManagerAccessor(ref lightSwitchEventEffect); Lights = _lightsAccessor(ref lightManager)[lightSwitchEventEffect.lightsId].ToList(); IDictionary <int, List <ILightWithId> > lightsPreGroup = new Dictionary <int, List <ILightWithId> >(); TrackLaneRingsManager[] managers = UnityEngine.Object.FindObjectsOfType <TrackLaneRingsManager>(); foreach (ILightWithId light in Lights) { if (light is MonoBehaviour monoBehaviour) { int z = Mathf.RoundToInt(monoBehaviour.transform.position.z); TrackLaneRing ring = monoBehaviour.GetComponentInParent <TrackLaneRing>(); if (ring != null) { TrackLaneRingsManager mngr = managers.FirstOrDefault(it => it.Rings.IndexOf(ring) >= 0); if (mngr != null) { z = 1000 + mngr.Rings.IndexOf(ring); } } if (lightsPreGroup.TryGetValue(z, out List <ILightWithId> list)) { list.Add(light); } else { list = new List <ILightWithId>() { light }; lightsPreGroup.Add(z, list); } } } LightsPropagationGrouped = new ILightWithId[lightsPreGroup.Count][]; int i = 0; foreach (List <ILightWithId> lightList in lightsPreGroup.Values) { if (lightList is null) { continue; } LightsPropagationGrouped[i] = lightList.ToArray(); i++; } // ok we done Colorizers.Add(beatmapEventType, this); }
private void SetRings(GameObject gameObject, TrackRings trackRings, int ringCount) { TrackLaneRingsManager ringManager; //BigRing if (gameObject.name.ToLower().Contains("big") || gameObject.name.ToLower().Contains("outer") || gameObject.name.ToLower().Equals("rings")) { if (platformDescriptor.BigRingManager != null) { Destroy(platformDescriptor.BigRingManager.rotationEffect); Destroy(platformDescriptor.BigRingManager); } platformDescriptor.BigRingManager = gameObject.AddComponent <TrackLaneRingsManager>(); if (platformDescriptor.RotationController == null) { platformDescriptor.RotationController = gameObject.AddComponent <GridRotationController>(); } ringManager = platformDescriptor.BigRingManager; } else { if (platformDescriptor.SmallRingManager != null) { Destroy(platformDescriptor.SmallRingManager.rotationEffect); Destroy(platformDescriptor.SmallRingManager); } platformDescriptor.SmallRingManager = gameObject.AddComponent <TrackLaneRingsManager>(); if (platformDescriptor.RotationController == null) { platformDescriptor.RotationController = gameObject.AddComponent <GridRotationController>(); } ringManager = platformDescriptor.SmallRingManager; } if (ringManager == null) { return; } //Also overwrite LightsManager if applicable TubeLight[] tubeRingLights = trackRings.trackLaneRingPrefab.GetComponentsInChildren <TubeLight>(); foreach (TubeLight tubeLight in tubeRingLights) { int eventId = -1; switch (tubeLight.lightsID) { case LightsID.Static: eventId = MapEvent.EVENT_TYPE_BACK_LASERS; break; case LightsID.BackLights: eventId = MapEvent.EVENT_TYPE_BACK_LASERS; break; case LightsID.BigRingLights: eventId = MapEvent.EVENT_TYPE_RING_LIGHTS; break; case LightsID.LeftLasers: eventId = MapEvent.EVENT_TYPE_LEFT_LASERS; break; case LightsID.RightLasers: eventId = MapEvent.EVENT_TYPE_RIGHT_LASERS; break; case LightsID.TrackAndBottom: eventId = MapEvent.EVENT_TYPE_ROAD_LIGHTS; break; case LightsID.Unused5: eventId = MapEvent.EVENT_TYPE_CUSTOM_LIGHT_1; break; case LightsID.Unused6: eventId = MapEvent.EVENT_TYPE_CUSTOM_LIGHT_2; break; case LightsID.Unused7: eventId = MapEvent.EVENT_TYPE_CUSTOM_LIGHT_3; break; case LightsID.Unused10: eventId = MapEvent.EVENT_TYPE_CUSTOM_LIGHT_4; break; case LightsID.Unused11: eventId = MapEvent.EVENT_TYPE_CUSTOM_LIGHT_5; break; default: break; } if (eventId > 0) { LightsManager currentLightsManager = platformDescriptor.LightingManagers[eventId]; LightsManager newLightsManager = gameObject.AddComponent <LightsManager>(); newLightsManager.ControllingLights = currentLightsManager.ControllingLights; newLightsManager.RotatingLights = currentLightsManager.RotatingLights; Destroy(currentLightsManager); platformDescriptor.LightingManagers[eventId] = newLightsManager; break; } } if (tubeRingLights.Length == 0) { LightsManager tubeLightsManager = platformDescriptor.LightingManagers[MapEvent.EVENT_TYPE_RING_LIGHTS]; MeshRenderer[] meshRenderers = trackRings.trackLaneRingPrefab.GetComponentsInChildren <MeshRenderer>(); foreach (MeshRenderer renderer in meshRenderers) { SetRendererMaterials(renderer, tubeLightsManager); } LightsManager newLightsManager = gameObject.AddComponent <LightsManager>(); newLightsManager.ControllingLights = tubeLightsManager.ControllingLights; newLightsManager.RotatingLights = tubeLightsManager.RotatingLights; Destroy(tubeLightsManager); platformDescriptor.LightingManagers[MapEvent.EVENT_TYPE_RING_LIGHTS] = newLightsManager; } //LightsManager lm = pd.LightingManagers[MapEvent.EVENT_TYPE_RING_LIGHTS]; ReplaceBetterBlack(trackRings.trackLaneRingPrefab); SetLightingEventsForTubeLights(trackRings.trackLaneRingPrefab); TrackLaneRing tlr = trackRings.trackLaneRingPrefab.gameObject.AddComponent <TrackLaneRing>(); ringManager.prefab = tlr; ringManager.ringCount = trackRings.ringCount; if (trackRings.useStepEffect) { ringManager.minPositionStep = trackRings.minPositionStep; ringManager.maxPositionStep = trackRings.maxPositionStep; } else { ringManager.minPositionStep = ringManager.maxPositionStep = trackRings.ringPositionStep; } ringManager.moveSpeed = trackRings.moveSpeed; ringManager.rotationStep = trackRings.rotationStep; ringManager.propagationSpeed = trackRings.rotationPropagationSpeed; ringManager.flexySpeed = trackRings.rotationFlexySpeed; if (trackRings.useRotationEffect) { TrackLaneRingsRotationEffect rotationEffect = gameObject.AddComponent <TrackLaneRingsRotationEffect>(); ringManager.rotationEffect = rotationEffect; rotationEffect.manager = ringManager; rotationEffect.startupRotationAngle = trackRings.startupRotationAngle; rotationEffect.startupRotationStep = trackRings.startupRotationStep; rotationEffect.startupRotationPropagationSpeed = trackRings.startupRotationPropagationSpeed; rotationEffect.startupRotationFlexySpeed = trackRings.startupRotationFlexySpeed; } }
internal static void Init(CustomBeatmapData customBeatmapData, float noteLinesDistance) { List <dynamic> environmentData = Trees.at(customBeatmapData.customData, "_environment"); GetAllGameObjects(); if (environmentData != null) { SkipRingUpdate = new Dictionary <TrackLaneRing, bool>(); foreach (dynamic gameObjectData in environmentData) { string id = Trees.at(gameObjectData, "_id"); string lookupString = Trees.at(gameObjectData, "_lookupMethod"); LookupMethod lookupMethod = (LookupMethod)Enum.Parse(typeof(LookupMethod), lookupString); bool hide = ((bool?)Trees.at(gameObjectData, "_hide")).GetValueOrDefault(false); Vector3?scale = GetVectorData(gameObjectData, "_scale"); Vector3?position = GetVectorData(gameObjectData, "_position"); Vector3?rotation = GetVectorData(gameObjectData, "_rotation"); Vector3?localPosition = GetVectorData(gameObjectData, "_localPosition"); Vector3?localRotation = GetVectorData(gameObjectData, "_localRotation"); List <GameObjectInfo> foundObjects = LookupID(id, lookupMethod); foreach (GameObjectInfo gameObjectInfo in foundObjects) { GameObject gameObject = gameObjectInfo.GameObject; if (hide) { gameObjectInfo.GameObject.SetActive(false); } Transform transform = gameObject.transform; if (scale.HasValue) { transform.localScale = scale.Value; } if (position.HasValue) { transform.position = position.Value * noteLinesDistance; } if (rotation.HasValue) { transform.eulerAngles = rotation.Value; } if (localPosition.HasValue) { transform.localPosition = localPosition.Value * noteLinesDistance; } if (localRotation.HasValue) { transform.localEulerAngles = localRotation.Value; } // Handle TrackLaneRing TrackLaneRing trackLaneRing = gameObject.GetComponent <TrackLaneRing>(); if (trackLaneRing != null) { if (position.HasValue || localPosition.HasValue) { _positionOffsetAccessor(ref trackLaneRing) = transform.position; float zPosition = transform.position.z; _prevPosZAccessor(ref trackLaneRing) = zPosition; _posZAccessor(ref trackLaneRing) = zPosition; } if (rotation.HasValue || localRotation.HasValue) { float zRotation = transform.rotation.z; _prevRotZAccessor(ref trackLaneRing) = zRotation; _rotZAccessor(ref trackLaneRing) = zRotation; } } if (Plugin.NoodleExtensionsInstalled && NoodleController.NoodleExtensionsActive) { GameObjectTrackController.HandleTrackData(gameObject, gameObjectData, customBeatmapData, noteLinesDistance, trackLaneRing); } } if (Settings.ChromaConfig.Instance.PrintEnvironmentEnhancementDebug) { ChromaLogger.Log($"ID [\"{id}\"] using method [{lookupMethod.ToString("G")}] found:"); foundObjects.ForEach(n => ChromaLogger.Log(n.FullID)); ChromaLogger.Log($"====================================="); } } } LegacyEnvironmentRemoval.Init(customBeatmapData); }