private void processStyle(Beatmap beatmap, IList <string> styleLines) { var lyrics = beatmap.HitObjects.OfType <Lyric>().ToList(); for (int l = 0; l < lyrics.Count; l++) { var lyric = lyrics[l]; var line = styleLines.ElementAtOrDefault(l)?.Split('=').Last(); // TODO : maybe create default layer and style index here? if (string.IsNullOrEmpty(line)) { return; } var layoutIndexStr = line.Split(',').FirstOrDefault(); var styleIndexStr = line.Split(',').ElementAtOrDefault(1); if (int.TryParse(layoutIndexStr, out int layoutIndex)) { lyric.LayoutIndex = layoutIndex; } if (int.TryParse(styleIndexStr, out int styleIndex)) { lyric.Singers = SingerUtils.GetSingersIndex(styleIndex); } } }
private void load(LayoutManager manager) { Children = new Drawable[] { previewRatioDropdown = new LabelledDropdown <PreviewRatio> { Label = "Ratio", Description = "Adjust to see different preview ratio.", Items = EnumUtils.GetValues <PreviewRatio>(), }, previewSampleDropdown = new LabelledDropdown <PreviewSample> { Label = "Lyric", Description = "Select different lyric to check layout is valid.", Items = EnumUtils.GetValues <PreviewSample>(), }, previewStyleDropdown = new StyleLabelledDropdown { Label = "Style", Description = "Select different style to check layout is valid.", Items = manager.PreviewFontSelections, }, }; previewRatioDropdown.Current.BindValueChanged(e => { switch (e.NewValue) { case PreviewRatio.WideScreen: manager.PreviewScreenRatio.Value = new DisplayRatio { Width = 16, Height = 9 }; break; case PreviewRatio.LegacyScreen: manager.PreviewScreenRatio.Value = new DisplayRatio { Width = 4, Height = 3 }; break; } }, true); previewSampleDropdown.Current.BindValueChanged(e => { manager.PreviewLyric.Value = getLyricSampleBySelection(e.NewValue); }, true); previewStyleDropdown.Current.BindValueChanged(e => { // todo : might use dropdown to assign singer, not style. var singer = SingerUtils.GetSingersIndex(e.NewValue.Key); manager.ChangePreviewSinger(singer); }, true); }
public void TestGetSingersIndex(int styleIndex, int[] singerIndexes) { Assert.AreEqual(SingerUtils.GetSingersIndex(styleIndex), singerIndexes); }