private void knumRedChannelValue_ValueChanged(object sender, EventArgs e) { pbxColourPreview.BackColor = ColourManager.ChangeColour(255, knumRedChannelValue.Value, knumGreenChannelValue.Value, knumBlueChannelValue.Value); }
void HandleLights(LightsManager group, int value, MapEvent e) { Color mainColor = Color.white; Color invertedColor = 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 && Settings.Instance.EmulateChromaLite) { if (ChromaCustomColors.ContainsKey(group)) { ChromaCustomColors[group] = ColourManager.ColourFromInt(value); } else { ChromaCustomColors.Add(group, ColourManager.ColourFromInt(value)); } return; } else if (value == ColourManager.RGB_RESET && Settings.Instance.EmulateChromaLite) { if (ChromaCustomColors.ContainsKey(group)) { ChromaCustomColors.Remove(group); } } if (ChromaGradients.ContainsKey(group)) { MapEvent gradientEvent = ChromaGradients[group].GradientEvent; if (atsc.CurrentBeat >= gradientEvent._lightGradient.Duration + gradientEvent._time) { StopCoroutine(ChromaGradients[group].Routine); ChromaGradients.Remove(group); ChromaCustomColors.Remove(group); } } if (e._lightGradient != null) { if (ChromaGradients.ContainsKey(group)) { StopCoroutine(ChromaGradients[group].Routine); ChromaGradients.Remove(group); } Gradient gradient = new Gradient(); gradient.GradientEvent = e; gradient.Routine = StartCoroutine(GradientRoutine(e, group)); ChromaGradients.Add(group, gradient); } //Set initial light values if (value <= 3) { mainColor = BlueColor; invertedColor = RedColor; } else if (value <= 7) { mainColor = RedColor; invertedColor = BlueColor; } //Check if it is a PogU new Chroma event if (e._customData?.HasKey("_color") ?? false) { mainColor = invertedColor = e._customData["_color"]; ChromaCustomColors.Remove(group); if (ChromaGradients.ContainsKey(group)) { StopCoroutine(ChromaGradients[group].Routine); ChromaGradients.Remove(group); } } if (ChromaCustomColors.ContainsKey(group)) { mainColor = invertedColor = ChromaCustomColors[group]; } //Check to see if we're soloing any particular event if (SoloAnEventType && e._type != SoloEventType) { mainColor = invertedColor = Color.black; } IEnumerable <LightingEvent> allLights = group.ControllingLights; if (e._customData?.HasKey("_propID") ?? false && Settings.Instance.EmulateChromaAdvanced) { int propID = e._customData["_propID"].AsInt; allLights = group.LightsGroupedByZ[propID]; } IEnumerable <LightingEvent> lights = allLights.Where(x => !x.UseInvertedPlatformColors); IEnumerable <LightingEvent> invertedLights = allLights.Where(x => x.UseInvertedPlatformColors); if (value == MapEvent.LIGHT_VALUE_OFF) { group.ChangeAlpha(0, 0, allLights); } else if (value == MapEvent.LIGHT_VALUE_BLUE_ON || value == MapEvent.LIGHT_VALUE_RED_ON) { group.ChangeColor(mainColor, 0, lights); group.ChangeColor(invertedColor, 0, invertedLights); group.ChangeAlpha(1, 0, lights); group.ChangeAlpha(1, 0, invertedLights); } else if (value == MapEvent.LIGHT_VALUE_BLUE_FLASH || value == MapEvent.LIGHT_VALUE_RED_FLASH) { group.Flash(mainColor, lights); group.Flash(invertedColor, invertedLights); } else if (value == MapEvent.LIGHT_VALUE_BLUE_FADE || value == MapEvent.LIGHT_VALUE_RED_FADE) { group.Fade(mainColor, lights); group.Fade(invertedColor, invertedLights); } }
void HandleLights(LightsManager group, int value, MapEvent e) { Color mainColor = Color.white; Color invertedColor = 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 && Settings.Instance.EmulateChromaLite) { if (ChromaCustomColors.ContainsKey(group)) { ChromaCustomColors[group] = ColourManager.ColourFromInt(value); } else { ChromaCustomColors.Add(group, ColourManager.ColourFromInt(value)); } return; } else if (value == ColourManager.RGB_RESET && Settings.Instance.EmulateChromaLite) { if (ChromaCustomColors.ContainsKey(group)) { ChromaCustomColors.Remove(group); } } if (ChromaGradients.ContainsKey(group)) { MapEvent gradientEvent = ChromaGradients[group].GradientEvent; if (atsc.CurrentBeat >= gradientEvent._lightGradient.Duration + gradientEvent._time || !Settings.Instance.EmulateChromaLite) { StopCoroutine(ChromaGradients[group].Routine); ChromaGradients.Remove(group); ChromaCustomColors.Remove(group); } } if (e._lightGradient != null && Settings.Instance.EmulateChromaLite) { if (ChromaGradients.ContainsKey(group)) { StopCoroutine(ChromaGradients[group].Routine); ChromaGradients.Remove(group); } var gradient = new Gradient { GradientEvent = e, Routine = StartCoroutine(GradientRoutine(e, group)) }; // If the gradient is over already then null is returned due to coroutine never yielding if (gradient.Routine != null) { ChromaGradients.Add(group, gradient); } } //Set initial light values if (value <= 3) { mainColor = ColorBoost ? colors.BlueBoostColor : colors.BlueColor; invertedColor = colors.RedColor; } else if (value <= 7) { mainColor = ColorBoost ? colors.RedBoostColor : colors.RedColor; invertedColor = colors.BlueColor; } //Check if it is a PogU new Chroma event if (e._customData?.HasKey("_color") ?? false && Settings.Instance.EmulateChromaLite) { mainColor = invertedColor = e._customData["_color"]; ChromaCustomColors.Remove(group); if (ChromaGradients.ContainsKey(group)) { StopCoroutine(ChromaGradients[group].Routine); ChromaGradients.Remove(group); } } if (ChromaCustomColors.ContainsKey(group) && Settings.Instance.EmulateChromaLite) { mainColor = invertedColor = ChromaCustomColors[group]; group.ChangeMultiplierAlpha(mainColor.a, group.ControllingLights); } //Check to see if we're soloing any particular event if (SoloAnEventType && e._type != SoloEventType) { mainColor = invertedColor = Color.black.WithAlpha(0); } IEnumerable <LightingEvent> allLights = group.ControllingLights; if (e.IsLightIdEvent && Settings.Instance.EmulateChromaAdvanced) { var lightIDArr = e.LightId; allLights = group.ControllingLights.FindAll(x => lightIDArr.Contains(x.lightID)); // Temporarily(?) commented as Debug.LogWarning is expensive //if (allLights.Count() < lightIDArr.Length) //{ // Debug.LogWarning($"Missing lights for {lightIDArr} in event type {e._type}!"); //} } foreach (var light in allLights) { var color = light.UseInvertedPlatformColors ? invertedColor : mainColor; switch (value) { case MapEvent.LIGHT_VALUE_OFF: light.UpdateTargetAlpha(0, 0); light.UpdateMultiplyAlpha(1); break; case MapEvent.LIGHT_VALUE_BLUE_ON: case MapEvent.LIGHT_VALUE_RED_ON: light.UpdateMultiplyAlpha(color.a); light.UpdateTargetColor(color.Multiply(LightsManager.HDR_Intensity), 0); light.UpdateTargetAlpha(1, 0); break; case MapEvent.LIGHT_VALUE_BLUE_FLASH: case MapEvent.LIGHT_VALUE_RED_FLASH: light.UpdateTargetAlpha(1, 0); light.UpdateMultiplyAlpha(color.a); light.UpdateTargetColor(color.Multiply(LightsManager.HDR_Flash_Intensity), 0); light.UpdateTargetColor(color.Multiply(LightsManager.HDR_Intensity), LightsManager.FadeTime); break; case MapEvent.LIGHT_VALUE_BLUE_FADE: case MapEvent.LIGHT_VALUE_RED_FADE: light.UpdateTargetAlpha(1, 0); light.UpdateMultiplyAlpha(color.a); light.UpdateTargetColor(color.Multiply(LightsManager.HDR_Flash_Intensity), 0); if (light.CanBeTurnedOff) { light.UpdateTargetAlpha(0, LightsManager.FadeTime); light.UpdateTargetColor(Color.black, LightsManager.FadeTime); } else { light.UpdateTargetColor(color.Multiply(LightsManager.HDR_Intensity), LightsManager.FadeTime); } break; } } group.SetValue(value); }
public void SetEventAppearance(BeatmapEventContainer e, bool final = true, PlatformDescriptor platform = null) { if (platform != null) { RedColor = platform.RedColor; BlueColor = platform.BlueColor; } Color color = Color.white; e.UpdateAlpha(final ? 1.0f : 0.6f); e.UpdateScale(final ? 0.75f : 0.6f); if (e.eventData.IsRotationEvent || e.eventData.IsLaserSpeedEvent) { if (e.eventData.IsRotationEvent) { int?rotation = e.eventData.GetRotationDegreeFromValue(); e.UpdateTextDisplay(true, rotation != null ? $"{rotation}°" : "Invalid Rotation"); } else { e.UpdateTextDisplay(true, e.eventData._value.ToString()); } } else { e.UpdateTextDisplay(false); } if (e.eventData.IsUtilityEvent) { if (e.eventData.IsRingEvent) { e.ChangeColor(RingEventsColor); } else { e.ChangeColor(OtherColor); } e.UpdateOffset(Vector3.zero); return; } else { if (e.eventData._value >= ColourManager.RGB_INT_OFFSET) { color = ColourManager.ColourFromInt(e.eventData._value); e.UpdateAlpha(final ? 0.9f : 0.6f); } else if (e.eventData._value <= 3) { if (BeatSaberSongContainer.Instance.difficultyData.envColorRight != BeatSaberSong.DEFAULT_RIGHTCOLOR) { color = BeatSaberSongContainer.Instance.difficultyData.envColorRight; } else { color = BlueColor; } } else if (e.eventData._value <= 7 && e.eventData._value >= 5) { if (BeatSaberSongContainer.Instance.difficultyData.envColorLeft != BeatSaberSong.DEFAULT_LEFTCOLOR) { color = BeatSaberSongContainer.Instance.difficultyData.envColorLeft; } else { color = RedColor; } } else if (e.eventData._value == 4) { color = OffColor; } } e.ChangeColor(color); switch (e.eventData._value) { case MapEvent.LIGHT_VALUE_OFF: e.ChangeColor(OffColor); e.UpdateOffset(Vector3.zero); break; case MapEvent.LIGHT_VALUE_BLUE_ON: e.UpdateOffset(Vector3.zero); break; case MapEvent.LIGHT_VALUE_BLUE_FLASH: e.UpdateOffset(FlashShaderOffset); break; case MapEvent.LIGHT_VALUE_BLUE_FADE: e.UpdateOffset(FadeShaderOffset); break; case MapEvent.LIGHT_VALUE_RED_ON: e.UpdateOffset(Vector3.zero); break; case MapEvent.LIGHT_VALUE_RED_FLASH: e.UpdateOffset(FlashShaderOffset); break; case MapEvent.LIGHT_VALUE_RED_FADE: e.UpdateOffset(FadeShaderOffset); break; } if (e.eventData._customData?["_color"] != null && e.eventData._value > 0) { e.ChangeColor(e.eventData._customData["_color"]); } }