public void PlatformEnabled(DiContainer container) { container.Inject(this); List <ILightWithId>?[] lights = _lightWithIdManager.GetField <List <ILightWithId>?[], LightWithIdManager>("_lights"); if (_lightSwitchEventEffects is null) { Color normalColor = new(1f, 1f, 1f, 0.7490196f); Color boostColor = new(1f, 1f, 1f, 0.8f); Color highlightColor = new(1f, 1f, 1f, 1f); _lightSwitchEventEffects = new LightSwitchEventEffect[5]; for (int i = 0; i < _lightSwitchEventEffects.Length; i++) { lights[i] ??= new List <ILightWithId>(); _lightSwitchEventEffects[i] = container.InstantiateComponent <LightSwitchEventEffect>(gameObject); _lightSwitchEventEffects[i].SetField("_lightsID", i + 1); _lightSwitchEventEffects[i].SetField("_event", (BeatmapEventType)i); _lightSwitchEventEffects[i].SetField("_colorBoostEvent", BeatmapEventType.Event5); _lightSwitchEventEffects[i].SetField("_lightColor0", (ColorSO)CreateMultipliedColorSO(_simpleLightColor0, normalColor)); _lightSwitchEventEffects[i].SetField("_lightColor1", (ColorSO)CreateMultipliedColorSO(_simpleLightColor1, normalColor)); _lightSwitchEventEffects[i].SetField("_highlightColor0", (ColorSO)CreateMultipliedColorSO(_simpleHighlightColor0, highlightColor)); _lightSwitchEventEffects[i].SetField("_highlightColor1", (ColorSO)CreateMultipliedColorSO(_simpleHighlightColor1, highlightColor)); _lightSwitchEventEffects[i].SetField("_lightColor0Boost", (ColorSO)CreateMultipliedColorSO(_simpleLightColor0Boost, boostColor)); _lightSwitchEventEffects[i].SetField("_lightColor1Boost", (ColorSO)CreateMultipliedColorSO(_simpleLightColor1Boost, boostColor)); _lightSwitchEventEffects[i].SetField("_highlightColor0Boost", (ColorSO)CreateMultipliedColorSO(_simpleHighlightColor0Boost, highlightColor)); _lightSwitchEventEffects[i].SetField("_highlightColor1Boost", (ColorSO)CreateMultipliedColorSO(_simpleHighlightColor1Boost, highlightColor)); } } else { foreach (LightSwitchEventEffect lse in _lightSwitchEventEffects) { lights[lse.lightsId] ??= new List <ILightWithId>(); lse.SetField("_initialized", false); lse.SetField("_beatmapObjectCallbackController", _beatmapObjectCallbackController); lse.SetField("_lightManager", _lightWithIdManager); lse.SetColor(Color.clear); gameObject.SetActive(true); lse.Start(); } } _simpleLightColor0.SetColor(_colorScheme.environmentColor0); _simpleLightColor1.SetColor(_colorScheme.environmentColor1); _simpleHighlightColor0.SetColor(_colorScheme.environmentColor0); _simpleHighlightColor1.SetColor(_colorScheme.environmentColor1); _simpleLightColor0Boost.SetColor(_colorScheme.environmentColor0Boost); _simpleLightColor1Boost.SetColor(_colorScheme.environmentColor1Boost); _simpleHighlightColor0Boost.SetColor(_colorScheme.environmentColor0Boost); _simpleHighlightColor1Boost.SetColor(_colorScheme.environmentColor1Boost); }
#pragma warning restore IDE0051 #endregion private void CreateLights() { List <ILightWithId>[] lightsWithId = _lightManager.GetField <List <ILightWithId>[], LightWithIdManager>("_lights"); int maxLightId = _lightManager.GetStaticField <int, LightWithIdManager>("kMaxLightId"); _lights = new List <DynamicTubeBloomPrePassLight> [maxLightId + 1]; for (int id = 0; id < lightsWithId.Length; id++) { if (lightsWithId[id] == null) { continue; } foreach (ILightWithId lightWithId in lightsWithId[id]) { if (lightWithId is TubeBloomPrePassLightWithId tubeLightWithId) { TubeBloomPrePassLight tubeLight = tubeLightWithId.GetField <TubeBloomPrePassLight, TubeBloomPrePassLightWithId>("_tubeBloomPrePassLight"); DynamicTubeBloomPrePassLight light = _container.InstantiateComponent <DynamicTubeBloomPrePassLight>(new GameObject($"DynamicTubeBloomPrePassLight({tubeLight.name})"), new[] { tubeLight }); if (_lights[id] == null) { _lights[id] = new List <DynamicTubeBloomPrePassLight>(10); } _lights[id].Add(light); light.transform.parent = transform; light.transform.position = Vector3.zero; light.transform.rotation = Quaternion.identity; } } } _logger.Trace($"Created {_lights.Sum(l => l?.Count)} DynamicTubeBloomPrePassLights"); }
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++; } } }