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); } }
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); } }