private static void Prefix(ParticleSystemEventEffect __instance, BeatmapEventData beatmapEventData, BeatmapEventType ____colorEvent) { if (beatmapEventData.type == ____colorEvent) { __instance.SetLastValue(beatmapEventData.value); } }
private static bool Prefix(ParticleSystemEventEffect __instance, BeatmapEventData beatmapEventData, BeatmapEventType ____colorEvent) { if (TechnicolorConfig.Instance.TechnicolorEnabled && beatmapEventData.type == ____colorEvent && beatmapEventData.value > 0 && beatmapEventData.value <= 7) { if (TechnicolorConfig.Instance.TechnicolorLightsGrouping == TechnicolorLightsGrouping.ISOLATED && TechnicolorController.TechniLightRandom.NextDouble() < TechnicolorConfig.Instance !.TechnicolorLightsFrequency) { ParticleSystem.MainModule mainmodule = _mainModuleAccessor(ref __instance); ParticleSystem.Particle[] particles = _particlesAccessor(ref __instance); ParticleSystem particleSystem = _particleSystemAccessor(ref __instance); mainmodule.startColor = TechnicolorController.GetTechnicolor(beatmapEventData.value > 3, beatmapEventData.time, TechnicolorConfig.Instance.TechnicolorLightsStyle); particleSystem.GetParticles(particles, particles.Length); for (int i = 0; i < particleSystem.particleCount; i++) { particles[i].startColor = TechnicolorController.GetTechnicolor(beatmapEventData.value > 3, beatmapEventData.time + particles[i].randomSeed, TechnicolorConfig.Instance.TechnicolorLightsStyle); } particleSystem.SetParticles(particles, particleSystem.particleCount); return(false); } } return(true); }
private static void Prefix(ParticleSystemEventEffect __instance, BeatmapEventData beatmapEventData, BeatmapEventType ____colorEvent) { if (beatmapEventData.type == ____colorEvent) { LightColorManager.ColorLightSwitch(__instance, beatmapEventData); } }
private bool Colorize(ParticleSystemEventEffect __instance, BasicBeatmapEventData basicBeatmapEventData) { if (!TechnicolorConfig.Instance.TechnicolorEnabled) { return(true); } if (TechnicolorConfig.Instance.TechnicolorLightsGrouping != TechnicolorLightsGrouping.ISOLATED || !(TechnicolorController.TechniLightRandom.NextDouble() < TechnicolorConfig.Instance.TechnicolorLightsFrequency)) { return(true); } ParticleSystem.MainModule mainmodule = _mainModuleAccessor(ref __instance); ParticleSystem.Particle[] particles = _particlesAccessor(ref __instance); ParticleSystem particleSystem = _particleSystemAccessor(ref __instance); mainmodule.startColor = TechnicolorController.GetTechnicolor( basicBeatmapEventData.value > 3, basicBeatmapEventData.time, TechnicolorConfig.Instance.TechnicolorLightsStyle); particleSystem.GetParticles(particles, particles.Length); for (int i = 0; i < particleSystem.particleCount; i++) { particles[i].startColor = TechnicolorController.GetTechnicolor( basicBeatmapEventData.value > 3, basicBeatmapEventData.time + particles[i].randomSeed, TechnicolorConfig.Instance.TechnicolorLightsStyle); } particleSystem.SetParticles(particles, particleSystem.particleCount); return(false); }
#pragma warning disable SA1313 // Parameter names should begin with lower-case letter private static void Prefix(ParticleSystemEventEffect __instance, BeatmapEventData beatmapEventData, BeatmapEventType ____colorEvent) #pragma warning restore SA1313 // Parameter names should begin with lower-case letter { if (beatmapEventData.type == ____colorEvent) { LightColorManager.ColorLightSwitch(__instance, beatmapEventData); } }
private void OnLightColorChanged(BeatmapEventType eventType, Color[] colors) { if (eventType == _eventType) { for (int i = 0; i < COLOR_FIELDS; i++) { _simpleColorSOs[i].SetColor(colors[i]); } ParticleSystemEventEffect particleSystemEventEffect = _particleSystemEventEffect; Color color; Color afterHighlightColor; switch (PreviousValue) { case 0: _particleColorAccessor(ref particleSystemEventEffect) = _offColorAccessor(ref particleSystemEventEffect); particleSystemEventEffect.RefreshParticles(); break; case 1: case 5: color = (PreviousValue == 1) ? _multipliedColorSOs[0] : _multipliedColorSOs[1]; _particleColorAccessor(ref particleSystemEventEffect) = color; _offColorAccessor(ref particleSystemEventEffect) = color.ColorWithAlpha(0); particleSystemEventEffect.RefreshParticles(); break; case 2: case 6: color = (PreviousValue == 2) ? _multipliedHighlightColorSOs[0] : _multipliedHighlightColorSOs[1]; _highlightColorAccessor(ref particleSystemEventEffect) = color; _offColorAccessor(ref particleSystemEventEffect) = color.ColorWithAlpha(0); afterHighlightColor = (PreviousValue == 2) ? _multipliedColorSOs[0] : _multipliedColorSOs[1]; _afterHighlightColorAccessor(ref particleSystemEventEffect) = afterHighlightColor; _particleColorAccessor(ref particleSystemEventEffect) = Color.Lerp(afterHighlightColor, color, _highlightValueAccessor(ref particleSystemEventEffect)); particleSystemEventEffect.RefreshParticles(); break; case 3: case 7: case -1: color = (PreviousValue == 3) ? _multipliedHighlightColorSOs[0] : _multipliedHighlightColorSOs[1]; _highlightColorAccessor(ref particleSystemEventEffect) = color; _offColorAccessor(ref particleSystemEventEffect) = color.ColorWithAlpha(0); _particleColorAccessor(ref particleSystemEventEffect) = color; afterHighlightColor = _offColorAccessor(ref particleSystemEventEffect); _afterHighlightColorAccessor(ref particleSystemEventEffect) = afterHighlightColor; _particleColorAccessor(ref particleSystemEventEffect) = Color.Lerp(afterHighlightColor, color, _highlightValueAccessor(ref particleSystemEventEffect)); particleSystemEventEffect.RefreshParticles(); break; } } }
private static void Postfix(ParticleSystemEventEffect __instance, BeatmapEventType ____colorEvent) { // If duplicated, clean up before duping ChromaParticleEventController oldController = __instance.GetComponent <ChromaParticleEventController>(); if (oldController != null) { Object.Destroy(oldController); } __instance.StartCoroutine(WaitThenStart(__instance, ____colorEvent)); }
internal ParticleColorizer(ParticleSystemEventEffect particleSystemEventEffect, BeatmapEventType beatmapEventType) { _particleSystemEventEffect = particleSystemEventEffect; _eventType = beatmapEventType; InitializeSO("_lightColor0", 0); InitializeSO("_highlightColor0", 0, true); InitializeSO("_lightColor1", 1); InitializeSO("_highlightColor1", 1, true); GetOrCreateColorizerList(beatmapEventType).Add(this); LightColorizer.LightColorChanged += OnLightColorChanged; }
static bool Prefix(ParticleSystemEventEffect __instance, ref BeatmapEventData beatmapEventData, ref BeatmapEventType ____colorEvent) { if (beatmapEventData.type == ____colorEvent) { //CustomLightBehaviour customLight = CustomLightBehaviour.GetCustomLightColour(beatmapEventData); ChromaEvent customEvent = ChromaEvent.GetChromaEvent(beatmapEventData); if (customEvent != null) { MonoBehaviour __monobehaviour = __instance; customEvent.Activate(ref __monobehaviour, ref beatmapEventData, ref ____colorEvent); return(false); } } return(true); }
private void InitializeSO(string id, int index, bool highlight = false) { ParticleSystemEventEffect particleSystemEventEffect = _particleSystemEventEffect; FieldAccessor <ParticleSystemEventEffect, ColorSO> .Accessor colorSOAcessor = FieldAccessor <ParticleSystemEventEffect, ColorSO> .GetAccessor(id); MultipliedColorSO lightMultSO = (MultipliedColorSO)colorSOAcessor(ref particleSystemEventEffect); Color multiplierColor = _multiplierColorAccessor(ref lightMultSO); SimpleColorSO lightSO = _baseColorAccessor(ref lightMultSO); MultipliedColorSO mColorSO = ScriptableObject.CreateInstance <MultipliedColorSO>(); _multiplierColorAccessor(ref mColorSO) = multiplierColor; SimpleColorSO sColorSO; if (_simpleColorSOs[index] == null) { sColorSO = ScriptableObject.CreateInstance <SimpleColorSO>(); sColorSO.SetColor(lightSO.color); _simpleColorSOs[index] = sColorSO; } else { sColorSO = _simpleColorSOs[index]; } _baseColorAccessor(ref mColorSO) = sColorSO; if (highlight) { _multipliedHighlightColorSOs[index] = mColorSO; } else { _multipliedColorSOs[index] = mColorSO; } colorSOAcessor(ref particleSystemEventEffect) = mColorSO; }
private static IEnumerator WaitThenStart(ParticleSystemEventEffect instance, BeatmapEventType eventType) { yield return(new WaitForEndOfFrame()); LightColorizer.LSEStart(instance, eventType); }
#pragma warning disable SA1313 // Parameter names should begin with lower-case letter private static void Postfix(ParticleSystemEventEffect __instance, BeatmapEventType ____colorEvent) #pragma warning restore SA1313 { __instance.StartCoroutine(WaitThenStart(__instance, ____colorEvent)); }
private static IEnumerator WaitThenStart(ParticleSystemEventEffect instance, BeatmapEventType eventType) { yield return(new WaitForEndOfFrame()); instance.gameObject.AddComponent <ChromaParticleEventController>().Init(instance, eventType); }
private static void Postfix(ParticleSystemEventEffect __instance, BeatmapEventType ____colorEvent) { __instance.StartCoroutine(WaitThenStart(__instance, ____colorEvent)); }
internal void Init(ParticleSystemEventEffect particleSystemEventEffect, BeatmapEventType eventType) { _eventType = eventType; _colorizer = new ParticleColorizer(particleSystemEventEffect, eventType); }