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);
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// Ctor for <see cref="KaraokeSkinConfiguration.LyricStyle"/> and <see cref="KaraokeSkinConfiguration.NoteStyle"/>
 /// </summary>
 /// <param name="config"></param>
 /// <param name="singers"></param>
 public KaraokeSkinLookup(KaraokeSkinConfiguration config, int[] singers)
     : this(config, SingerUtils.GetShiftingStyleIndex(singers))
 {
     if (config != KaraokeSkinConfiguration.LyricStyle && config != KaraokeSkinConfiguration.NoteStyle)
     {
         throw new InvalidDataException($"Only {KaraokeSkinConfiguration.LyricStyle} and {KaraokeSkinConfiguration.NoteStyle} can call this ctor.");
     }
 }
Beispiel #3
0
        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);
        }
Beispiel #4
0
 public void TestGetSingersIndex(int styleIndex, int[] singerIndexes)
 {
     Assert.AreEqual(SingerUtils.GetSingersIndex(styleIndex), singerIndexes);
 }
Beispiel #5
0
 public void TestGetShiftingStyleIndex(int[] singerIndexes, int styleIndex)
 {
     Assert.AreEqual(SingerUtils.GetShiftingStyleIndex(singerIndexes), styleIndex);
 }