Skip to content

Commit 8f5c0d4

Browse files
committed
refactor: ParseTapNote可以拒绝生成note
1 parent 8855ad7 commit 8f5c0d4

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

‎generator/chu/UgcGenerator.cs‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,13 @@ private string Serialize(ChuChart ugc)
200200
sb.AppendLine($"#{endTicks}>{SlideFollowerMarker(seg.Type)}");
201201
}
202202
}
203-
continue;
204203
}
205-
206-
var durTicks = Utils.Tick(n.Duration, RSL);
207-
if (n.Type is "HLD" or "HXD" && durTicks > 0)
208-
sb.AppendLine($"#{durTicks}>s");
204+
else
205+
{
206+
var durTicks = Utils.Tick(n.Duration, RSL);
207+
if (n.Type is "HLD" or "HXD" && durTicks > 0)
208+
sb.AppendLine($"#{durTicks}>s");
209+
}
209210
}
210211
return sb.ToString();
211212
}

‎parser/chu/UgcParser.cs‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,10 +310,10 @@ private int ParseNoteLine(string[] lines, int idx, ChuChart chart, List<Alert> a
310310
switch (typeChar)
311311
{
312312
case 't':
313-
ParseTapNote(code, note, alerts, lineNum, chart, false);
313+
note = ParseTapNote(code, note, alerts, lineNum, chart, false);
314314
break;
315315
case 'x':
316-
ParseTapNote(code, note, alerts, lineNum, chart, true);
316+
note = ParseTapNote(code, note, alerts, lineNum, chart, true);
317317
break;
318318

319319
case 'h':
@@ -367,7 +367,7 @@ private int ParseNoteLine(string[] lines, int idx, ChuChart chart, List<Alert> a
367367
return idx;
368368
}
369369

370-
private void ParseTapNote(string code, ChuNote note, List<Alert> alerts, int lineNum, ChuChart chart, bool isCHR)
370+
private ChuNote? ParseTapNote(string code, ChuNote note, List<Alert> alerts, int lineNum, ChuChart chart, bool isCHR)
371371
{
372372
note.Type = "TAP";
373373
ParseCellWidth(code, 1, note, alerts, lineNum, chart);
@@ -377,6 +377,7 @@ private void ParseTapNote(string code, ChuNote note, List<Alert> alerts, int lin
377377
var extraRaw = code.Length > 3 ? code[3..] : "";
378378
note.Tag = U2C_ChrExtras.GetValueOrDefault(extraRaw, extraRaw);
379379
}
380+
return note;
380381
}
381382

382383
private const int CrushInterval_Dollar_Value = 100;

0 commit comments

Comments
 (0)