private static void FixSyncNotes(Score score)
 {
     foreach (var bar in score.Bars)
     {
         var gridIndexGroups =
             from n in bar.Notes
             where n.Helper.IsGaming
             group n by n.Basic.IndexInGrid
             into g
             select g;
         foreach (var group in gridIndexGroups)
         {
             var sortedNotesInGroup =
                 from n in @group
                 orderby n.Basic.FinishPosition
                 select n;
             Note prev = null;
             foreach (var note in sortedNotesInGroup)
             {
                 NoteHelper.MakeSync(prev, note);
                 prev = note;
             }
             NoteHelper.MakeSync(prev, null);
         }
     }
 }
示例#2
0
        public static void FixSyncWhenAdded([NotNull] this Note @this)
        {
            // TODO
            if ([email protected])
            {
                return;
            }

            @this.RemoveSync();

            Note prev = null, next = null;

            foreach (var note in @this.Basic.Bar.Notes)
            {
                if (note == @this)
                {
                    continue;
                }

                if (!note.Helper.IsGaming)
                {
                    continue;
                }

                if (note.Basic.IndexInGrid != @this.Basic.IndexInGrid)
                {
                    continue;
                }

                if (note.Basic.FinishPosition < @this.Basic.FinishPosition)
                {
                    if (prev == null || prev.Basic.FinishPosition < note.Basic.FinishPosition)
                    {
                        prev = note;
                    }
                }
                else
                {
                    if (next == null || note.Basic.FinishPosition < next.Basic.FinishPosition)
                    {
                        next = note;
                    }
                }
            }

            NoteHelper.MakeSync(prev, @this);
            NoteHelper.MakeSync(@this, next);
        }