Merge branch 'master' into unified-hitwindows

This commit is contained in:
smoogipoo
2018-02-08 13:22:44 +09:00
36 changed files with 356 additions and 141 deletions

View File

@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Objects.Drawables;
using OpenTK;
@ -24,7 +25,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
this.repeatPoint = repeatPoint;
this.drawableSlider = drawableSlider;
Size = new Vector2(32 * repeatPoint.Scale);
Size = new Vector2(45 * repeatPoint.Scale);
Blending = BlendingMode.Additive;
Origin = Anchor.Centre;
@ -34,7 +35,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
new SpriteIcon
{
RelativeSizeAxes = Axes.Both,
Icon = FontAwesome.fa_eercast
Icon = FontAwesome.fa_chevron_right
}
};
}
@ -49,9 +50,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
animDuration = Math.Min(150, repeatPoint.SpanDuration / 2);
this.FadeIn(animDuration).ScaleTo(1.2f, animDuration / 2)
.Then()
.ScaleTo(1, animDuration / 2, Easing.Out);
this.Animate(
d => d.FadeIn(animDuration),
d => d.ScaleTo(0.5f).ScaleTo(1f, animDuration * 4, Easing.OutElasticHalf)
);
}
protected override void UpdateCurrentState(ArmedState state)
@ -66,11 +68,33 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
break;
case ArmedState.Hit:
this.FadeOut(animDuration, Easing.OutQuint)
.ScaleTo(Scale * 1.5f, animDuration, Easing.OutQuint);
.ScaleTo(Scale * 1.5f, animDuration, Easing.Out);
break;
}
}
public void UpdateSnakingPosition(Vector2 start, Vector2 end) => Position = repeatPoint.RepeatIndex % 2 == 0 ? end : start;
public void UpdateSnakingPosition(Vector2 start, Vector2 end)
{
bool isRepeatAtEnd = repeatPoint.RepeatIndex % 2 == 0;
List<Vector2> curve = drawableSlider.Body.CurrentCurve;
Position = isRepeatAtEnd ? end : start;
if (curve.Count < 2)
return;
int searchStart = isRepeatAtEnd ? curve.Count - 1 : 0;
int direction = isRepeatAtEnd ? -1 : 1;
// find the next vector2 in the curve which is not equal to our current position to infer a rotation.
for (int i = searchStart; i >= 0 && i < curve.Count; i += direction)
{
if (curve[i] == Position)
continue;
Rotation = MathHelper.RadiansToDegrees((float)Math.Atan2(curve[i].Y - Position.Y, curve[i].X - Position.X));
break;
}
}
}
}

View File

@ -52,9 +52,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
this.Animate(
d => d.FadeIn(anim_duration),
d => d.ScaleTo(0.5f).ScaleTo(1.2f, anim_duration / 2)
).Then(
d => d.ScaleTo(1, anim_duration / 2, Easing.Out)
d => d.ScaleTo(0.5f).ScaleTo(1f, anim_duration * 4, Easing.OutElasticHalf)
);
}
@ -71,7 +69,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
break;
case ArmedState.Hit:
this.FadeOut(anim_duration, Easing.OutQuint)
.ScaleTo(Scale * 1.5f, anim_duration, Easing.OutQuint);
.ScaleTo(Scale * 1.5f, anim_duration, Easing.Out);
break;
}
}

View File

@ -89,7 +89,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
// We want the container to have the same size as the slider,
// and to be positioned such that the slider head is at (0,0).
container.Size = path.Size;
container.Position = -path.PositionInBoundingBox(slider.Curve.PositionAt(0) - currentCurve[0]);
container.Position = -path.PositionInBoundingBox(slider.Curve.PositionAt(0) - CurrentCurve[0]);
container.ForceRedraw();
}
@ -148,7 +148,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
path.Texture = texture;
}
private readonly List<Vector2> currentCurve = new List<Vector2>();
public readonly List<Vector2> CurrentCurve = new List<Vector2>();
private bool updateSnaking(double p0, double p1)
{
if (SnakedStart == p0 && SnakedEnd == p1) return false;
@ -156,11 +156,11 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
SnakedStart = p0;
SnakedEnd = p1;
slider.Curve.GetPathToProgress(currentCurve, p0, p1);
slider.Curve.GetPathToProgress(CurrentCurve, p0, p1);
path.ClearVertices();
foreach (Vector2 p in currentCurve)
path.AddVertex(p - currentCurve[0]);
foreach (Vector2 p in CurrentCurve)
path.AddVertex(p - CurrentCurve[0]);
return true;
}