コード例 #1
0
 private Drawable[] createContent(Lyric lyric, TimeTag timeTag, TimeTagInvalid invalid) => new Drawable[]
 {
     new RightTriangle
     {
         Origin = Anchor.Centre,
         Size   = new Vector2(10),
         Colour = getInvalidColour(invalid),
         Margin = new MarginPadding {
             Left = 10
         },
     },
     new OsuSpriteText
     {
         Text   = $"#{lyric.Order}",
         Font   = OsuFont.GetFont(size: TEXT_SIZE, weight: FontWeight.Bold),
         Margin = new MarginPadding {
             Right = 10
         },
     },
     new OsuSpriteText
     {
         Text   = TextIndexUtils.PositionFormattedString(timeTag.Index),
         Font   = OsuFont.GetFont(size: TEXT_SIZE, weight: FontWeight.Bold),
         Margin = new MarginPadding {
             Right = 10
         },
     },
     new OsuSpriteText
     {
         Text             = getInvalidReason(invalid),
         Truncate         = true,
         RelativeSizeAxes = Axes.X,
         Font             = OsuFont.GetFont(size: TEXT_SIZE, weight: FontWeight.Medium)
     },
 };
コード例 #2
0
            private string getInvalidReason(TimeTagInvalid invalid)
            {
                switch (invalid)
                {
                case TimeTagInvalid.OutOfRange:
                    return("Time-tag out of range.");

                case TimeTagInvalid.Overlapping:
                    return("Time-tag overlapping.");

                case TimeTagInvalid.EmptyTime:
                    return("Time-tag has no time.");

                default:
                    throw new IndexOutOfRangeException(nameof(invalid));
                }
            }
コード例 #3
0
            private Color4 getInvalidColour(TimeTagInvalid invalid)
            {
                switch (invalid)
                {
                case TimeTagInvalid.OutOfRange:
                    return(colour.Red);

                case TimeTagInvalid.Overlapping:
                    return(colour.Red);

                case TimeTagInvalid.EmptyTime:
                    return(colour.Yellow);

                default:
                    throw new IndexOutOfRangeException(nameof(invalid));
                }
            }