public void Play() { var songs = from i in Instruments from s in i.Songs where Notes.Any() ? Notes.Contains(s.Note) : true && Octaves.Any() ? Octaves.Contains(s.Octave) : true && Tempos.Any() ? Tempos.Contains(s.Tempo) : true && Intensities.Any() ? Intensities.Contains(s.Intensity) : true && Modes.Any() ? Modes.Contains(s.Mode) : true group s by s.Instrument into grouping select grouping; var songsDict = new Dictionary <string, List <Song> >(); foreach (IGrouping <string, Song> grouping in songs) { var lstSongs = new List <Song>(); foreach (var s in grouping.Take(MaxSongs)) { lstSongs.Add(s); } songsDict.Add(grouping.Key, lstSongs); } foreach (var instrument in songsDict.Keys) { var song = songsDict[instrument].ElementAt(0); song.Play(); songsDict[instrument].RemoveAt(0); } }
public void ApplyTo(AreaData area) { if (!string.IsNullOrEmpty(Icon) && GFX.Gui.Has(Icon)) { area.Icon = Icon; } if (Interlude != null) { area.Interlude = Interlude.Value; } if (CassetteCheckpointIndex != null) { area.CassetteCheckpointIndex = CassetteCheckpointIndex.Value; } if (!string.IsNullOrEmpty(TitleBaseColor)) { area.TitleBaseColor = Calc.HexToColor(TitleBaseColor); } if (!string.IsNullOrEmpty(TitleAccentColor)) { area.TitleAccentColor = Calc.HexToColor(TitleAccentColor); } if (!string.IsNullOrEmpty(TitleTextColor)) { area.TitleTextColor = Calc.HexToColor(TitleTextColor); } if (IntroType != null) { area.IntroType = IntroType.Value; } if (Dreaming != null) { area.Dreaming = Dreaming.Value; } if (!string.IsNullOrEmpty(ColorGrade)) { area.ColorGrade = ColorGrade; } if (!string.IsNullOrEmpty(Wipe)) { Type type = Assembly.GetEntryAssembly().GetType(Wipe); ConstructorInfo ctor = type?.GetConstructor(new Type[] { typeof(Scene), typeof(bool), typeof(Action) }); if (type != null && ctor != null) { area.Wipe = (scene, wipeIn, onComplete) => ctor.Invoke(new object[] { scene, wipeIn, onComplete }); } } if (DarknessAlpha != null) { area.DarknessAlpha = DarknessAlpha.Value; } if (BloomBase != null) { area.BloomBase = BloomBase.Value; } if (BloomStrength != null) { area.BloomStrength = BloomStrength.Value; } if (!string.IsNullOrEmpty(Jumpthru)) { area.Jumpthru = Jumpthru; } if (CoreMode != null) { area.CoreMode = CoreMode.Value; } if (!string.IsNullOrEmpty(CassetteNoteColor)) { area.CassseteNoteColor = Calc.HexToColor(CassetteNoteColor); } if (!string.IsNullOrEmpty(CassetteSong)) { area.CassetteSong = CassetteSong; } area.MountainIdle = Mountain?.Idle?.Convert() ?? area.MountainIdle; area.MountainSelect = Mountain?.Select?.Convert() ?? area.MountainSelect; area.MountainZoom = Mountain?.Zoom?.Convert() ?? area.MountainZoom; area.MountainCursor = Mountain?.Cursor?.ToVector3() ?? area.MountainCursor; area.MountainState = Mountain?.State ?? area.MountainState; ModeProperties[] modes = area.Mode; area.Mode = Convert(Modes) ?? modes; if (modes != null) { for (int i = 0; i < area.Mode.Length && i < modes.Length; i++) { if (area.Mode[i] == null) { area.Mode[i] = modes[i]; } } } MapMeta meta = area.GetMeta(); if (meta == null) { area.SetMeta(this); } else { if (!string.IsNullOrEmpty(Parent)) { meta.Parent = Parent; } if (!string.IsNullOrEmpty(PostcardSoundID)) { meta.PostcardSoundID = PostcardSoundID; } if (!string.IsNullOrEmpty(ForegroundTiles)) { meta.ForegroundTiles = ForegroundTiles; } if (!string.IsNullOrEmpty(BackgroundTiles)) { meta.BackgroundTiles = BackgroundTiles; } if (!string.IsNullOrEmpty(AnimatedTiles)) { meta.AnimatedTiles = AnimatedTiles; } if (!string.IsNullOrEmpty(Sprites)) { meta.Sprites = Sprites; } if (!string.IsNullOrEmpty(Portraits)) { meta.Portraits = Portraits; } if (OverrideASideMeta != null) { meta.OverrideASideMeta = OverrideASideMeta; } if ((Modes?.Length ?? 0) != 0 && Modes.Any(mode => mode != null)) { meta.Modes = Modes; } if (Mountain != null) { meta.Mountain = Mountain; } if (CompleteScreen != null) { meta.CompleteScreen = CompleteScreen; } if (LoadingVignetteScreen != null) { meta.LoadingVignetteScreen = LoadingVignetteScreen; } if (LoadingVignetteText != null) { meta.LoadingVignetteText = LoadingVignetteText; } if (CassetteModifier != null) { meta.CassetteModifier = CassetteModifier; } } }