-
Notifications
You must be signed in to change notification settings - Fork 2
v0.3.0:大重构:预留chunithm转谱引入的空间 #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
472d8be
2c5fd50
e7802d3
1ef2837
7c860ed
c4d5e12
462a414
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| namespace MuConvert.chart; | ||
|
|
||
| public interface IBaseChart; | ||
|
|
||
| /** | ||
| * 所有的谱面均应该继承自此类。 | ||
| * 此类中提供了Notes列表,作为存储音符的核心列表;存储的音符类型是特定于谱面的(继承时传入泛型) | ||
| * 此外,应当重写以下四个抽象的getter。 | ||
| */ | ||
| public abstract class BaseChart<TNote> : IBaseChart | ||
| { | ||
| /** | ||
| * 所有音符构成的列表 | ||
| */ | ||
| public List<TNote> Notes = []; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| /** | ||
| * 谱面开头的BPM | ||
| */ | ||
| public abstract decimal StartBpm { get; } | ||
|
|
||
| /** | ||
| * 获得谱面开始的时刻(即谱面中第一个音符的开始时刻)。单位为秒 | ||
| */ | ||
| public abstract decimal StartTime { get; } | ||
|
|
||
| /** | ||
| * 获得谱面结束的时刻(即谱面中最后一个音符的完成时刻)。单位为秒 | ||
| */ | ||
| public abstract decimal EndTime { get; } | ||
|
|
||
| /** | ||
| * 总音符数量(物量) | ||
| */ | ||
| public abstract int TotalNotes { get; } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,12 +1,12 @@ | ||||||
| using MuConvert.chart; | ||||||
| using MuConvert.utils; | ||||||
| using Rationals; | ||||||
|
|
||||||
| namespace MuConvert.chart; | ||||||
| namespace MuConvert.mai; | ||||||
|
|
||||||
| public class Chart | ||||||
| public class MaiChart: BaseChart<Note> | ||||||
| { | ||||||
| public BPMList BpmList = []; | ||||||
| public List<Note> Notes = []; | ||||||
|
|
||||||
| public string DefaultTouchSize = "M1"; | ||||||
|
|
||||||
|
|
@@ -33,13 +33,16 @@ public void Sort() | |||||
| } | ||||||
|
|
||||||
| // 谱面开头的BPM | ||||||
| public decimal StartBpm { | ||||||
| public override decimal StartBpm { | ||||||
| get | ||||||
| { | ||||||
| Utils.Assert(BpmList[0].Time == 0, "BPM列表的开头必须为0时刻"); | ||||||
| return BpmList[0].Bpm; | ||||||
| } | ||||||
| } | ||||||
| public override decimal StartTime => (decimal)FirstNoteTime.Seconds; | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Prompt for AI agents
Suggested change
|
||||||
| public override decimal EndTime => (decimal)ToSecond(Notes.Select(x=>x.EndTime).Max()); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This property has two issues:
public override decimal EndTime => Notes.Count == 0 ? 0 : (decimal)ToSecond(Notes.Max(x => x.EndTime));There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Prompt for AI agents
Suggested change
|
||||||
| public override int TotalNotes => Statistics.Total; | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The public override int TotalNotes => Notes.Count; |
||||||
|
|
||||||
| /** | ||||||
| * 获得“谱面中第一个音符的时刻”,或者返回的Duration也可以理解成“从谱面开头到出现第一个音符所经过的时长”。 | ||||||
|
|
@@ -81,14 +84,11 @@ public void Shift(Rational offset, decimal? bpm = null) | |||||
|
|
||||||
| public Statistics Statistics => new(this); | ||||||
|
|
||||||
| // 总音符数量(物量) | ||||||
| public int TotalNotes => Statistics.Total; | ||||||
|
|
||||||
| /** | ||||||
| * 这是MA2语句中,通过CLK指令所显式指定的哒哒哒哒的时刻。 | ||||||
| * 一般来说极少会用到,这里只是忠实地记录一下;一方面符合我们“0信息损失”的原则、忠实地记录铺面中的信息; | ||||||
| * 另一方面,可以用作ClockCount自动推导的来源之一。 | ||||||
| * 普通用户理论上极少会用到这个东西。 | ||||||
| */ | ||||||
| public List<Rational>? ExplicitClocks = null; | ||||||
| public List<Rational>? ExplicitClocks; | ||||||
| } | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,11 +2,11 @@ | |
| using MuConvert.utils; | ||
| using Rationals; | ||
|
|
||
| namespace MuConvert.chart; | ||
| namespace MuConvert.mai; | ||
|
|
||
| public abstract class Note | ||
| { | ||
| public readonly Chart Chart; | ||
| public readonly MaiChart Chart; | ||
| public Rational Time { get; set => field = value.CanonicalForm; } | ||
| protected int _key; | ||
|
|
||
|
|
@@ -33,7 +33,7 @@ public virtual int Key | |
| } | ||
| } | ||
|
|
||
| protected Note(Chart chart, Rational time) | ||
| protected Note(MaiChart chart, Rational time) | ||
| { | ||
| Chart = chart; | ||
| Time = time; | ||
|
|
@@ -64,10 +64,12 @@ protected Note(Chart chart, Rational time) | |
| } | ||
|
|
||
| internal virtual string DebuggerDisplay() => ""; | ||
|
|
||
| public virtual Rational EndTime => Time + Duration.Bar; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will throw a public virtual Rational EndTime => Time + (Duration?.Bar ?? 0); |
||
| } | ||
|
|
||
| [DebuggerDisplay("{DebuggerDisplay(),nq}")] | ||
| public class Tap(Chart chart, Rational time) : Note(chart, time) | ||
| public class Tap(MaiChart chart, Rational time) : Note(chart, time) | ||
| { | ||
| public Tap(Tap inTake): this(inTake.Chart, inTake.Time) // 拷贝构造函数 | ||
| { | ||
|
|
@@ -85,13 +87,13 @@ public class Hold : Tap | |
| { | ||
| public override Duration Duration { get; set; } | ||
|
|
||
| public Hold(Chart chart, Rational time) : base(chart, time) { Duration = new Duration(this); } | ||
| public Hold(MaiChart chart, Rational time) : base(chart, time) { Duration = new Duration(this); } | ||
|
|
||
| internal override string DebuggerDisplay() => $"{Key}h{Modifiers}{Duration.DebuggerDisplay()}"; | ||
| } | ||
|
|
||
| [DebuggerDisplay("{DebuggerDisplay(),nq}")] | ||
| public class Touch(Chart chart, Rational time) : Note(chart, time) | ||
| public class Touch(MaiChart chart, Rational time) : Note(chart, time) | ||
| { | ||
| private TouchSeries _touchSeries; | ||
|
|
||
|
|
@@ -130,10 +132,10 @@ public class TouchHold : Touch | |
| { | ||
| public override Duration Duration { get; set; } | ||
|
|
||
| public TouchHold(Chart chart, Rational time) : base(chart, time) { Duration = new Duration(this); } | ||
| public TouchHold(MaiChart chart, Rational time) : base(chart, time) { Duration = new Duration(this); } | ||
|
|
||
| internal override string DebuggerDisplay() => $"{TouchArea}h{Modifiers}{Duration.DebuggerDisplay()}"; | ||
| } | ||
|
|
||
| // 仅用于内部实现某些trick时使用的“伪音符”。用户在正常的谱面中是不会看到这个的。 | ||
| internal class PseudoNote(Chart chart) : Note(chart, 0); | ||
| internal class PseudoNote(MaiChart chart) : Note(chart, 0); | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In C#, interfaces must have a body enclosed in braces
{ }, even if they are empty. The semicolon-only syntax;is not valid for interface declarations and will cause a compilation error.