private static bool Prefix(LightSwitchEventEffect __instance, BeatmapEventType ____event, Color color) { if (LightColorManager.LightIDOverride != null) { List <ILightWithId> lights = __instance.GetLights(); int type = (int)____event; IEnumerable <int> newIds = LightColorManager.LightIDOverride.Select(n => LightIDTableManager.GetActiveTableValue(type, n) ?? n); foreach (int id in newIds) { ILightWithId lightWithId = lights.ElementAtOrDefault(id); if (lightWithId != null) { if (lightWithId.isRegistered) { lightWithId.ColorWasSet(color); } } else { ChromaLogger.Log($"Type [{type}] does not contain id [{id}].", IPA.Logging.Logger.Level.Warning); } } LightColorManager.LightIDOverride = null; return(false); } // Legacy Prop Id stuff if (LightSwitchEventEffectHandleBeatmapObjectCallbackControllerBeatmapEventDidTrigger.LegacyLightOverride != null) { ILightWithId[] lights = LightSwitchEventEffectHandleBeatmapObjectCallbackControllerBeatmapEventDidTrigger.LegacyLightOverride; for (int i = 0; i < lights.Length; i++) { lights[i].ColorWasSet(color); } LightSwitchEventEffectHandleBeatmapObjectCallbackControllerBeatmapEventDidTrigger.LegacyLightOverride = null; return(false); } return(true); }
private static bool Prefix(LightSwitchEventEffect __instance, BeatmapEventType ____event, Color color) { if (LightColorManager.LightIDOverride != null) { List <ILightWithId> lights = __instance.GetLights(); int type = (int)____event; IEnumerable <int> newIds = LightColorManager.LightIDOverride.Select(n => LightIDTableManager.GetActiveTableValue(type, n) ?? n); foreach (int id in newIds) { if (lights[id].isRegistered) { lights[id].ColorWasSet(color); } } LightColorManager.LightIDOverride = null; return(false); } // Legacy Prop Id stuff if (LightSwitchEventEffectHandleBeatmapObjectCallbackControllerBeatmapEventDidTrigger.LegacyLightOverride != null) { ILightWithId[] lights = LightSwitchEventEffectHandleBeatmapObjectCallbackControllerBeatmapEventDidTrigger.LegacyLightOverride; for (int i = 0; i < lights.Length; i++) { lights[i].ColorWasSet(color); } LightSwitchEventEffectHandleBeatmapObjectCallbackControllerBeatmapEventDidTrigger.LegacyLightOverride = null; return(false); } return(true); }