Beispiel #1
0
        public void TestSorted(int[] orders, int[] actualOrders)
        {
            var objects = orders?.Select(x => new TestOrderObject {
                Order = x
            });
            var orderedArray = OrderUtils.Sorted(objects);
            var result       = orderedArray?.Select(x => x.Order).ToArray();

            Assert.AreEqual(result, actualOrders);
        }
Beispiel #2
0
        private void load(EditorBeatmap beatmap)
        {
            // load lyric in here
            var lyrics = OrderUtils.Sorted(beatmap.HitObjects.OfType <Lyric>());

            BindableLyrics.AddRange(lyrics);

            // need to check is there any lyric added or removed.
            beatmap.HitObjectAdded += e =>
            {
                if (e is Lyric lyric)
                {
                    var previousLyric = BindableLyrics.LastOrDefault(x => x.Order < lyric.Order);

                    if (previousLyric != null)
                    {
                        var insertIndex = BindableLyrics.IndexOf(previousLyric) + 1;
                        BindableLyrics.Insert(insertIndex, lyric);
                    }
                    else
                    {
                        // insert to first.
                        BindableLyrics.Insert(0, lyric);
                    }

                    createAlgorithmList();
                }
            };
            beatmap.HitObjectRemoved += e =>
            {
                if (e is Lyric lyric)
                {
                    BindableLyrics.Remove(lyric);
                    createAlgorithmList();
                }
            };

            // create algorithm set
            createAlgorithmList();
        }
Beispiel #3
0
 protected CaretPositionAlgorithm(Lyric[] lyrics)
 {
     Lyrics = LyricsUtils.FindUnlockLyrics(OrderUtils.Sorted(lyrics));
 }