From 489153579a7b8a15d5406485005b9d7ee80c2d7a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 11 Mar 2019 14:36:29 +0900 Subject: [PATCH] Add xmldoc and clarify struct variables --- .../Objects/JuiceStream.cs | 8 ++--- osu.Game.Rulesets.Osu/Objects/Slider.cs | 6 ++-- .../Rulesets/Objects/SliderEventGenerator.cs | 33 +++++++++++++++---- 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs b/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs index 9a5bad01fe..2adc156efd 100644 --- a/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs +++ b/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs @@ -60,7 +60,7 @@ protected override void CreateNestedHitObjects() // generate tiny droplets since the last point if (lastEvent != null) { - double sinceLastTick = e.StartTime - lastEvent.Value.StartTime; + double sinceLastTick = e.Time - lastEvent.Value.Time; if (sinceLastTick > 80) { @@ -73,7 +73,7 @@ protected override void CreateNestedHitObjects() AddNested(new TinyDroplet { Samples = tickSamples, - StartTime = t + lastEvent.Value.StartTime, + StartTime = t + lastEvent.Value.Time, X = X + Path.PositionAt( lastEvent.Value.PathProgress + (t / sinceLastTick) * (e.PathProgress - lastEvent.Value.PathProgress)).X / CatchPlayfield.BASE_WIDTH, }); @@ -91,7 +91,7 @@ protected override void CreateNestedHitObjects() AddNested(new Droplet { Samples = tickSamples, - StartTime = e.StartTime, + StartTime = e.Time, X = X + Path.PositionAt(e.PathProgress).X / CatchPlayfield.BASE_WIDTH, }); break; @@ -101,7 +101,7 @@ protected override void CreateNestedHitObjects() AddNested(new Fruit { Samples = Samples, - StartTime = e.StartTime, + StartTime = e.Time, X = X + Path.PositionAt(e.PathProgress).X / CatchPlayfield.BASE_WIDTH, }); break; diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index 1efd92987d..4a2b3ecb2d 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -176,7 +176,7 @@ protected override void CreateNestedHitObjects() { SpanIndex = e.SpanIndex, SpanStartTime = e.SpanStartTime, - StartTime = e.StartTime, + StartTime = e.Time, Position = Position + Path.PositionAt(e.PathProgress), StackHeight = StackHeight, Scale = Scale, @@ -186,7 +186,7 @@ protected override void CreateNestedHitObjects() case SliderEventType.Head: AddNested(HeadCircle = new SliderCircle { - StartTime = e.StartTime, + StartTime = e.Time, Position = Position, Samples = getNodeSamples(0), SampleControlPoint = SampleControlPoint, @@ -200,7 +200,7 @@ protected override void CreateNestedHitObjects() // if this is to change, we should revisit this. AddNested(TailCircle = new SliderTailCircle(this) { - StartTime = e.StartTime, + StartTime = e.Time, Position = EndPosition, IndexInCurrentCombo = IndexInCurrentCombo, ComboIndex = ComboIndex, diff --git a/osu.Game/Rulesets/Objects/SliderEventGenerator.cs b/osu.Game/Rulesets/Objects/SliderEventGenerator.cs index 84621ba7a3..99ad78eed1 100644 --- a/osu.Game/Rulesets/Objects/SliderEventGenerator.cs +++ b/osu.Game/Rulesets/Objects/SliderEventGenerator.cs @@ -25,7 +25,7 @@ public static IEnumerable Generate(double startTime, doub Type = SliderEventType.Head, SpanIndex = 0, SpanStartTime = startTime, - StartTime = startTime, + Time = startTime, PathProgress = 0, }; @@ -49,7 +49,7 @@ public static IEnumerable Generate(double startTime, doub Type = SliderEventType.Tick, SpanIndex = span, SpanStartTime = spanStartTime, - StartTime = spanStartTime + timeProgress * spanDuration, + Time = spanStartTime + timeProgress * spanDuration, PathProgress = pathProgress, }; } @@ -61,7 +61,7 @@ public static IEnumerable Generate(double startTime, doub Type = SliderEventType.Repeat, SpanIndex = span, SpanStartTime = startTime + span * spanDuration, - StartTime = spanStartTime + spanDuration, + Time = spanStartTime + spanDuration, PathProgress = (span + 1) % 2, }; } @@ -90,7 +90,7 @@ public static IEnumerable Generate(double startTime, doub Type = SliderEventType.LegacyLastTick, SpanIndex = finalSpanIndex, SpanStartTime = finalSpanStartTime, - StartTime = finalSpanEndTime, + Time = finalSpanEndTime, PathProgress = finalProgress, }; @@ -99,22 +99,41 @@ public static IEnumerable Generate(double startTime, doub Type = SliderEventType.Tail, SpanIndex = finalSpanIndex, SpanStartTime = startTime + (spanCount - 1) * spanDuration, - StartTime = startTime + totalDuration, + Time = startTime + totalDuration, PathProgress = spanCount % 2, }; } } + /// + /// Describes a point in time on a slider given special meaning. + /// Should be used by rulesets to visualise the slider. + /// public struct SliderEventDescriptor { + /// + /// The type of event. + /// public SliderEventType Type; + /// + /// The time of this event. + /// + public double Time; + + /// + /// The zero-based index of the span. In the case of repeat sliders, this will increase each repeat. + /// public int SpanIndex; + /// + /// The time at which the contained begins. + /// public double SpanStartTime; - public double StartTime; - + /// + /// The progress along the slider's at which this event occurs. + /// public double PathProgress; }