Esempio n. 1
0
 private void RainbowLights()
 {
     if (TechnicolorConfig.Instance.TechnicolorLightsGrouping == TechnicolorLightsGrouping.ISOLATED)
     {
         LightColorizer.GlobalColorize(false, _gradientLeftColor, _gradientRightColor, _gradientLeftColor, _gradientRightColor);
         foreach (LightColorizer lightColorizer in LightColorizer.Colorizers.Values)
         {
             foreach (ILightWithId light in lightColorizer.Lights)
             {
                 float seed = Math.Abs(light.GetHashCode()) % 1000;
                 seed *= 0.001f;
                 Color colorLeft  = Color.HSVToRGB(Mathf.Repeat((Time.time * TimeMult) + _mismatchSpeedOffset + seed, 1f), 1f, 1f);
                 Color colorRight = Color.HSVToRGB(Mathf.Repeat((Time.time * TimeMult) + seed, 1f), 1f, 1f);
                 lightColorizer.Colorize(new ILightWithId[] { light }, colorLeft, colorRight, colorLeft, colorRight);
             }
         }
     }
     else
     {
         LightColorizer.GlobalColorize(true, _gradientLeftColor, _gradientRightColor, _gradientLeftColor, _gradientRightColor);
     }
 }
        private static bool Prefix(ChromaLightSwitchEventEffect __instance, BeatmapEventData beatmapEventData, BeatmapEventType ____event)
        {
            if (TechnicolorConfig.Instance.TechnicolorEnabled && beatmapEventData.type == ____event &&
                beatmapEventData.value > 0 && beatmapEventData.value <= 7)
            {
                bool warm = !__instance.IsColor0(beatmapEventData.value);
                if (TechnicolorConfig.Instance.TechnicolorLightsGrouping == TechnicolorLightsGrouping.ISOLATED)
                {
                    LightColorizer lightColorizer = __instance.LightColorizer;
                    foreach (ILightWithId light in lightColorizer.Lights)
                    {
                        Color color = TechnicolorController.GetTechnicolor(warm, beatmapEventData.time + light.GetHashCode(), TechnicolorConfig.Instance.TechnicolorLightsStyle);
                        lightColorizer.Colorize(false, color, color, color, color);
                        __instance.Refresh(true, new ILightWithId[] { light }, beatmapEventData);
                    }

                    return(false);
                }
                else if (TechnicolorController.TechniLightRandom.NextDouble() < TechnicolorConfig.Instance.TechnicolorLightsFrequency)
                {
                    Color color = TechnicolorController.GetTechnicolor(warm, beatmapEventData.time, TechnicolorConfig.Instance.TechnicolorLightsStyle);
                    switch (TechnicolorConfig.Instance.TechnicolorLightsGrouping)
                    {
                    case TechnicolorLightsGrouping.ISOLATED_GROUP:
                        ____event.ColorizeLight(false, color, color, color, color);
                        break;

                    case TechnicolorLightsGrouping.STANDARD:
                    default:
                        LightColorizer.GlobalColorize(false, color, color, color, color);
                        break;
                    }
                }
            }

            return(true);
        }