1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-21 18:42:56 +08:00

address review

This commit is contained in:
Shawdooow 2017-09-27 11:28:44 -04:00
parent 4e8944de04
commit cfb1804aa1
6 changed files with 27 additions and 29 deletions

View File

@ -10,9 +10,9 @@ using osu.Game.Rulesets.Osu.Judgements;
namespace osu.Game.Rulesets.Osu.Objects.Drawables namespace osu.Game.Rulesets.Osu.Objects.Drawables
{ {
public class DrawableSliderBouncer : DrawableOsuHitObject public class DrawableRepeatPoint : DrawableOsuHitObject
{ {
private readonly SliderBouncer sliderBouncer; private readonly RepeatPoint repeatPoint;
private readonly DrawableSlider drawableSlider; private readonly DrawableSlider drawableSlider;
public double FadeInTime; public double FadeInTime;
@ -20,9 +20,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
public override bool RemoveWhenNotAlive => false; public override bool RemoveWhenNotAlive => false;
public DrawableSliderBouncer(SliderBouncer sliderBouncer, DrawableSlider drawableSlider) : base(sliderBouncer) public DrawableRepeatPoint(RepeatPoint repeatPoint, DrawableSlider drawableSlider) : base(repeatPoint)
{ {
this.sliderBouncer = sliderBouncer; this.repeatPoint = repeatPoint;
this.drawableSlider = drawableSlider; this.drawableSlider = drawableSlider;
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
@ -43,13 +43,13 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
protected override void CheckForJudgements(bool userTriggered, double timeOffset) protected override void CheckForJudgements(bool userTriggered, double timeOffset)
{ {
if (sliderBouncer.StartTime <= Time.Current) if (repeatPoint.StartTime <= Time.Current)
AddJudgement(new OsuJudgement { Result = drawableSlider.Tracking ? HitResult.Great : HitResult.Miss }); AddJudgement(new OsuJudgement { Result = drawableSlider.Tracking ? HitResult.Great : HitResult.Miss });
} }
protected override void UpdatePreemptState() protected override void UpdatePreemptState()
{ {
var animIn = Math.Min(150, sliderBouncer.StartTime - FadeInTime); var animIn = Math.Min(150, repeatPoint.StartTime - FadeInTime);
this.Animate( this.Animate(
d => d.FadeIn(animIn), d => d.FadeIn(animIn),
@ -64,7 +64,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
switch (state) switch (state)
{ {
case ArmedState.Idle: case ArmedState.Idle:
this.Delay(FadeOutTime - sliderBouncer.StartTime).FadeOut(); this.Delay(FadeOutTime - repeatPoint.StartTime).FadeOut();
break; break;
case ArmedState.Miss: case ArmedState.Miss:
this.FadeOut(160); this.FadeOut(160);

View File

@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
private readonly List<ISliderProgress> components = new List<ISliderProgress>(); private readonly List<ISliderProgress> components = new List<ISliderProgress>();
private readonly Container<DrawableSliderTick> ticks; private readonly Container<DrawableSliderTick> ticks;
private readonly Container<DrawableSliderBouncer> bouncers; private readonly Container<DrawableRepeatPoint> repeatPoints;
private readonly SliderBody body; private readonly SliderBody body;
private readonly SliderBall ball; private readonly SliderBall ball;
@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
PathWidth = s.Scale * 64, PathWidth = s.Scale * 64,
}, },
ticks = new Container<DrawableSliderTick>(), ticks = new Container<DrawableSliderTick>(),
bouncers = new Container<DrawableSliderBouncer>(), repeatPoints = new Container<DrawableRepeatPoint>(),
ball = new SliderBall(s) ball = new SliderBall(s)
{ {
Scale = new Vector2(s.Scale), Scale = new Vector2(s.Scale),
@ -80,21 +80,21 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
AddNested(drawableTick); AddNested(drawableTick);
} }
foreach (var bouncer in s.Bouncers) foreach (var repeatPoint in s.RepeatPoints)
{ {
var repeatStartTime = s.StartTime + bouncer.RepeatIndex * repeatDuration; var repeatStartTime = s.StartTime + repeatPoint.RepeatIndex * repeatDuration;
var fadeInTime = repeatStartTime + (bouncer.StartTime - repeatStartTime) / 2 - (bouncer.RepeatIndex == 0 ? TIME_FADEIN : TIME_FADEIN / 2); var fadeInTime = repeatStartTime + (repeatPoint.StartTime - repeatStartTime) / 2 - (repeatPoint.RepeatIndex == 0 ? TIME_FADEIN : TIME_FADEIN / 2);
var fadeOutTime = repeatStartTime + repeatDuration; var fadeOutTime = repeatStartTime + repeatDuration;
var drawableBouncer = new DrawableSliderBouncer(bouncer, this) var drawableRepeatPoint = new DrawableRepeatPoint(repeatPoint, this)
{ {
FadeInTime = fadeInTime, FadeInTime = fadeInTime,
FadeOutTime = fadeOutTime, FadeOutTime = fadeOutTime,
Position = bouncer.Position, Position = repeatPoint.Position,
}; };
bouncers.Add(drawableBouncer); repeatPoints.Add(drawableRepeatPoint);
AddNested(drawableBouncer); AddNested(drawableRepeatPoint);
} }
} }
@ -131,8 +131,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{ {
if (!userTriggered && Time.Current >= slider.EndTime) if (!userTriggered && Time.Current >= slider.EndTime)
{ {
var judgementsCount = ticks.Children.Count + bouncers.Children.Count + 1; var judgementsCount = ticks.Children.Count + repeatPoints.Children.Count + 1;
var judgementsHit = ticks.Children.Count(t => t.Judgements.Any(j => j.IsHit)) + bouncers.Children.Count(t => t.Judgements.Any(j => j.IsHit)); var judgementsHit = ticks.Children.Count(t => t.Judgements.Any(j => j.IsHit)) + repeatPoints.Children.Count(t => t.Judgements.Any(j => j.IsHit));
if (initialCircle.Judgements.Any(j => j.IsHit)) if (initialCircle.Judgements.Any(j => j.IsHit))
judgementsHit++; judgementsHit++;

View File

@ -3,7 +3,7 @@
namespace osu.Game.Rulesets.Osu.Objects namespace osu.Game.Rulesets.Osu.Objects
{ {
public class SliderBouncer : OsuHitObject public class RepeatPoint : OsuHitObject
{ {
public int RepeatIndex { get; set; } public int RepeatIndex { get; set; }
} }

View File

@ -61,7 +61,6 @@ namespace osu.Game.Rulesets.Osu.Objects
public double Velocity; public double Velocity;
public double TickDistance; public double TickDistance;
public double BouncerDistance;
public override void ApplyDefaults(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty) public override void ApplyDefaults(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
{ {
@ -74,7 +73,6 @@ namespace osu.Game.Rulesets.Osu.Objects
Velocity = scoringDistance / timingPoint.BeatLength; Velocity = scoringDistance / timingPoint.BeatLength;
TickDistance = scoringDistance / difficulty.SliderTickRate; TickDistance = scoringDistance / difficulty.SliderTickRate;
BouncerDistance = Distance;
} }
public Vector2 PositionAt(double progress) => Curve.PositionAt(ProgressAt(progress)); public Vector2 PositionAt(double progress) => Curve.PositionAt(ProgressAt(progress));
@ -133,23 +131,23 @@ namespace osu.Game.Rulesets.Osu.Objects
} }
} }
} }
public IEnumerable<SliderBouncer> Bouncers public IEnumerable<RepeatPoint> RepeatPoints
{ {
get get
{ {
var length = Curve.Distance; var length = Curve.Distance;
var bouncerDistance = Math.Min(BouncerDistance, length); var repeatPointDistance = Math.Min(Distance, length);
var repeatDuration = length / Velocity; var repeatDuration = length / Velocity;
for (var repeat = 0; repeat < RepeatCount; repeat++) for (var repeat = 0; repeat < RepeatCount; repeat++)
{ {
if (repeat > 0) if (repeat > 0)
for (var d = bouncerDistance; d <= length; d += bouncerDistance) for (var d = repeatPointDistance; d <= length; d += repeatPointDistance)
{ {
var repeatStartTime = StartTime + repeat * repeatDuration; var repeatStartTime = StartTime + repeat * repeatDuration;
var distanceProgress = d / length; var distanceProgress = d / length;
yield return new SliderBouncer yield return new RepeatPoint
{ {
RepeatIndex = repeat, RepeatIndex = repeat,
StartTime = repeatStartTime, StartTime = repeatStartTime,

View File

@ -42,8 +42,8 @@ namespace osu.Game.Rulesets.Osu.Scoring
foreach (var unused in slider.Ticks) foreach (var unused in slider.Ticks)
AddJudgement(new OsuJudgement { Result = HitResult.Great }); AddJudgement(new OsuJudgement { Result = HitResult.Great });
//Bouncers //Repeats
foreach (var unused in slider.Bouncers) foreach (var unused in slider.RepeatPoints)
AddJudgement(new OsuJudgement { Result = HitResult.Great }); AddJudgement(new OsuJudgement { Result = HitResult.Great });
} }

View File

@ -53,7 +53,7 @@
<Compile Include="Objects\Drawables\Connections\ConnectionRenderer.cs" /> <Compile Include="Objects\Drawables\Connections\ConnectionRenderer.cs" />
<Compile Include="Objects\Drawables\Connections\FollowPointRenderer.cs" /> <Compile Include="Objects\Drawables\Connections\FollowPointRenderer.cs" />
<Compile Include="Judgements\OsuJudgement.cs" /> <Compile Include="Judgements\OsuJudgement.cs" />
<Compile Include="Objects\Drawables\DrawableSliderBouncer.cs" /> <Compile Include="Objects\Drawables\DrawableRepeatPoint.cs" />
<Compile Include="Objects\Drawables\Pieces\ApproachCircle.cs" /> <Compile Include="Objects\Drawables\Pieces\ApproachCircle.cs" />
<Compile Include="Objects\Drawables\Pieces\SpinnerBackground.cs" /> <Compile Include="Objects\Drawables\Pieces\SpinnerBackground.cs" />
<Compile Include="Objects\Drawables\Pieces\CirclePiece.cs" /> <Compile Include="Objects\Drawables\Pieces\CirclePiece.cs" />
@ -72,7 +72,7 @@
<Compile Include="Objects\Drawables\Pieces\TrianglesPiece.cs" /> <Compile Include="Objects\Drawables\Pieces\TrianglesPiece.cs" />
<Compile Include="Objects\Drawables\Pieces\SliderBall.cs" /> <Compile Include="Objects\Drawables\Pieces\SliderBall.cs" />
<Compile Include="Objects\Drawables\Pieces\SliderBody.cs" /> <Compile Include="Objects\Drawables\Pieces\SliderBody.cs" />
<Compile Include="Objects\SliderBouncer.cs" /> <Compile Include="Objects\RepeatPoint.cs" />
<Compile Include="Objects\SliderTick.cs" /> <Compile Include="Objects\SliderTick.cs" />
<Compile Include="OsuDifficulty\OsuDifficultyCalculator.cs" /> <Compile Include="OsuDifficulty\OsuDifficultyCalculator.cs" />
<Compile Include="OsuDifficulty\Preprocessing\OsuDifficultyBeatmap.cs" /> <Compile Include="OsuDifficulty\Preprocessing\OsuDifficultyBeatmap.cs" />