@@ -22,7 +22,8 @@ public Star(Tap inTake): this(inTake.Chart, inTake.Time) // 拷贝构造函数
2222[ DebuggerDisplay ( "{DebuggerDisplay(),nq}" ) ]
2323public class Slide : Note
2424{
25- public Tap ? Head ; // 根据simai语法,星星头既可以是普通的星星形状(1-5),也可以是Tap形状的(1@-5),也可以没有(1?-5或1!-5)
25+ public Tap ? OwnHead ; // 属于自己的星星头。只有在SharedHeadWith=null的那根星星上应该设置此项,否则直接通过SharedHeadWith链过去即可
26+ // PS: 根据simai语法,星星头既可以是普通的星星形状(1-5),也可以是Tap形状的(1@-5),也可以没有(1?-5或1!-5)
2627 public Slide ? SharedHeadWith ;
2728 public List < SlideSegment > segments = new ( ) ;
2829 public Duration WaitTime ;
@@ -34,14 +35,17 @@ public Slide(Chart chart, Rational time) : base(chart, time)
3435
3536 public override int Key
3637 {
37- get => Head ? . Key ?? SharedHeadWith ? . Key ?? _key ;
38+ get => OwnHead ? . Key ?? SharedHeadWith ? . Key ?? _key ;
3839 set
3940 {
40- Utils . Assert ( Head == null && SharedHeadWith ? . Key == null , "尝试为有头星星手动设置星星头" ) ;
41+ Utils . Assert ( OwnHead == null && SharedHeadWith ? . Key == null , "尝试为有头星星手动设置星星头" ) ;
4142 if ( value < 1 || value > 8 ) throw new ArgumentException ( string . Format ( Locale . InvalidKey , value ) ) ;
4243 _key = value ;
4344 }
4445 }
46+
47+ // 所有的SharedHeadWith的连接关系,会构成一棵树,其中只有树根节点有OwnHead且SharedHeadWith为null。
48+ public Slide SharedHeadWithRoot => SharedHeadWith != null ? SharedHeadWith . SharedHeadWithRoot : this ;
4549
4650 public int EndKey => segments . Count > 0 ? segments . Last ( ) . EndKey : Key ;
4751
@@ -75,10 +79,12 @@ private string DebuggerDisplay()
7579 {
7680 string result ;
7781 if ( SharedHeadWith != null ) result = "*" ;
78- else if ( Head != null ) result = Head . DebuggerDisplay ( ) ;
79- else result = Key . ToString ( ) ;
80- if ( Head != null && ! ( Head is Star ) ) result += "@" ; // Tap形状的头
81- else if ( Head == null && SharedHeadWith == null ) result += "?" ; // 无头
82+ else if ( OwnHead != null )
83+ {
84+ result = OwnHead . DebuggerDisplay ( ) ;
85+ if ( ! ( OwnHead is Star ) ) result += "@" ; // Tap形状的头
86+ }
87+ else result = Key + "?" ; // 无头
8288
8389 var segStart = Key ;
8490 foreach ( var s in segments )
0 commit comments