public static void RegisterLight(MonoBehaviour lightWithId) { switch (lightWithId) { case LightWithIdMonoBehaviour monoBehaviour: LSEColorManager monomanager = LSEColorManager.GetLSEColorManager((BeatmapEventType)(monoBehaviour.lightId - 1))?.Where(n => n.Lights != null).First(); if (monomanager == null) { break; } LightIDTableManager.RegisterIndex(monoBehaviour.lightId - 1, monomanager.Lights.Count); monomanager.Lights.Add(monoBehaviour); break; case LightWithIds lightWithIds: IEnumerable <ILightWithId> lightsWithId = ((IEnumerable)_lightWithIdsData.GetValue(lightWithId)).Cast <ILightWithId>(); foreach (ILightWithId light in lightsWithId) { LSEColorManager manager = LSEColorManager.GetLSEColorManager((BeatmapEventType)(light.lightId - 1))?.Where(n => n.Lights != null).First(); if (manager == null) { continue; } LightIDTableManager.RegisterIndex(light.lightId - 1, manager.Lights.Count); manager.Lights.Add(light); } break; } }
public static void RegisterLight(MonoBehaviour lightWithId, int?lightId) { LightColorizer lightColorizer; switch (lightWithId) { case LightWithIdMonoBehaviour monoBehaviour: lightColorizer = ((BeatmapEventType)(monoBehaviour.lightId - 1)).GetLightColorizer(); LightIDTableManager.RegisterIndex(monoBehaviour.lightId - 1, lightColorizer.Lights.Count, lightId); lightColorizer.Lights.Add(monoBehaviour); break; case LightWithIds lightWithIds: IEnumerable <ILightWithId> lightsWithId = ((IEnumerable)_lightWithIdsData.GetValue(lightWithId)).Cast <ILightWithId>(); foreach (ILightWithId light in lightsWithId) { lightColorizer = ((BeatmapEventType)(light.lightId - 1)).GetLightColorizer(); LightIDTableManager.RegisterIndex(light.lightId - 1, lightColorizer.Lights.Count, lightId); lightColorizer.Lights.Add(light); } break; } }