Skip to content

Commit 90c19e2

Browse files
committed
fixup! [R] 将SflList和ClockCount移动到BaseChart内,从而方便音击复用。
1 parent 309b4f1 commit 90c19e2

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

chart/BaseChart.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ public virtual void Sort()
106106
BpmList.AddRange(sortedBpms);
107107

108108
MetList = MetList.OrderBy(x => x.Time).ToList();
109+
SflList = SflList.OrderBy(x => x.Time).ToList();
110+
if (ExplicitClocks != null) ExplicitClocks = ExplicitClocks.Order().ToList();
111+
109112
Notes = SortNotes().ToList(); // LINQ OrderBy 是稳定排序
110113
}
111114

@@ -136,6 +139,12 @@ public virtual void Shift(Rational offset, decimal? bpm = null)
136139
.Skip(MetList.Count(x => x.Time <= 0) - 1)
137140
.Select((x, i) => i == 0 ? x with { Time = 0 } : x).ToList();
138141

142+
// 对SflList和ExplicitClocks的处理:加上offset后,只保留>=0的项
143+
SflList = SflList.Select(x => x with { Time = x.Time + offset })
144+
.Where(x => x.Time >= 0).ToList();
145+
if (ExplicitClocks != null)
146+
ExplicitClocks = ExplicitClocks.Select(x => x + offset).Where(x => x >= 0).ToList();
147+
139148
// Notes,时间加上offset,但注意需要对children进行递归操作
140149
HashSet<BaseNote> processed = [];
141150
Notes = Notes.Where(x => addOffset(x).Time >= 0).ToList();

0 commit comments

Comments
 (0)