|
7 | 7 | using System.Collections.Generic;
|
8 | 8 | using System.Linq;
|
9 | 9 | using System.Runtime.CompilerServices;
|
| 10 | +using System.Windows.Controls; |
10 | 11 |
|
11 | 12 | namespace OngekiFumenEditor.Modules.FumenVisualEditor
|
12 | 13 | {
|
@@ -269,32 +270,38 @@ public static double ConvertAudioTimeToY_PreviewMode(TimeSpan audioTime, FumenVi
|
269 | 270 | var totalGrid = diff.Unit * resT + diff.Grid;
|
270 | 271 | var i = (int)Math.Max(0, totalGrid / lengthPerBeat);
|
271 | 272 |
|
272 |
| - //检测是否可以绘制线 |
273 |
| - var isDrawable = !(double.IsInfinity(lengthPerBeat) || (beatCount == 0)); |
274 |
| - |
275 |
| - while (isDrawable) |
| 273 | + //特殊处理beatCount=0的情况 |
| 274 | + if (beatCount == 0) |
| 275 | + { |
| 276 | + var y = ConvertTGridToY_DesignMode(currentTGridBase, soflans, bpmList, 1); |
| 277 | + yield return (currentTGridBase, y * scale, 0, currentMeter, currentBpm); |
| 278 | + } |
| 279 | + else |
276 | 280 | {
|
277 |
| - var tGrid = currentTGridBase + new GridOffset(0, (int)(lengthPerBeat * i)); |
278 |
| - //因为是不存在跨bpm长度计算,可以直接CalculateBPMLength(...)计算而不是TGridCalculator.ConvertTGridToY(...); |
279 |
| - var y = ConvertTGridToY_DesignMode(tGrid, soflans, bpmList, 1); |
280 |
| - //var y = currentStartY + len; |
281 |
| - |
282 |
| - //超过当前timeSignature范围,切换到下一个timeSignature画新的线 |
283 |
| - if (nextBpm is not null && tGrid >= nextTGridBase) |
284 |
| - break; |
285 |
| - //超过编辑器谱面范围,后面都不用画了 |
286 |
| - if (tGrid > endTGrid) |
287 |
| - yield break; |
288 |
| - //节奏线在最低可见线的后面 |
289 |
| - if (tGrid < currentTGridBaseOffset) |
| 281 | + while (true) |
290 | 282 | {
|
| 283 | + var tGrid = currentTGridBase + new GridOffset(0, (int)(lengthPerBeat * i)); |
| 284 | + //因为是不存在跨bpm长度计算,可以直接CalculateBPMLength(...)计算而不是TGridCalculator.ConvertTGridToY(...); |
| 285 | + var y = ConvertTGridToY_DesignMode(tGrid, soflans, bpmList, 1); |
| 286 | + |
| 287 | + //超过当前timeSignature范围,切换到下一个timeSignature画新的线 |
| 288 | + if (nextBpm is not null && tGrid >= nextTGridBase) |
| 289 | + break; |
| 290 | + //超过编辑器谱面范围,后面都不用画了 |
| 291 | + if (tGrid > endTGrid) |
| 292 | + yield break; |
| 293 | + //节奏线在最低可见线的后面 |
| 294 | + if (tGrid < currentTGridBaseOffset) |
| 295 | + { |
| 296 | + i++; |
| 297 | + continue; |
| 298 | + } |
| 299 | + |
| 300 | + yield return (tGrid, y * scale, i % beatCount, currentMeter, currentBpm); |
291 | 301 | i++;
|
292 |
| - continue; |
293 | 302 | }
|
294 |
| - |
295 |
| - yield return (tGrid, y * scale, i % beatCount, currentMeter, currentBpm); |
296 |
| - i++; |
297 | 303 | }
|
| 304 | + |
298 | 305 | currentTGridBaseOffset = nextTGridBase;
|
299 | 306 | currentTimeSignatureIndex = nextTimeSignatureIndex;
|
300 | 307 | currentTimeSignature = timeSignatures.Count > currentTimeSignatureIndex ? timeSignatures[currentTimeSignatureIndex] : default;
|
|
0 commit comments