mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 11:35:35 +08:00
Merge branch 'master' into revert-hiding-visual-settings
This commit is contained in:
commit
666b85d392
@ -2,6 +2,7 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
@ -24,7 +25,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
this.repeatPoint = repeatPoint;
|
this.repeatPoint = repeatPoint;
|
||||||
this.drawableSlider = drawableSlider;
|
this.drawableSlider = drawableSlider;
|
||||||
|
|
||||||
Size = new Vector2(32 * repeatPoint.Scale);
|
Size = new Vector2(45 * repeatPoint.Scale);
|
||||||
|
|
||||||
Blending = BlendingMode.Additive;
|
Blending = BlendingMode.Additive;
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
@ -34,7 +35,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
new SpriteIcon
|
new SpriteIcon
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
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);
|
animDuration = Math.Min(150, repeatPoint.SpanDuration / 2);
|
||||||
|
|
||||||
this.FadeIn(animDuration).ScaleTo(1.2f, animDuration / 2)
|
this.Animate(
|
||||||
.Then()
|
d => d.FadeIn(animDuration),
|
||||||
.ScaleTo(1, animDuration / 2, Easing.Out);
|
d => d.ScaleTo(0.5f).ScaleTo(1f, animDuration * 4, Easing.OutElasticHalf)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateCurrentState(ArmedState state)
|
protected override void UpdateCurrentState(ArmedState state)
|
||||||
@ -66,11 +68,33 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
break;
|
break;
|
||||||
case ArmedState.Hit:
|
case ArmedState.Hit:
|
||||||
this.FadeOut(animDuration, Easing.OutQuint)
|
this.FadeOut(animDuration, Easing.OutQuint)
|
||||||
.ScaleTo(Scale * 1.5f, animDuration, Easing.OutQuint);
|
.ScaleTo(Scale * 1.5f, animDuration, Easing.Out);
|
||||||
break;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,9 +52,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
{
|
{
|
||||||
this.Animate(
|
this.Animate(
|
||||||
d => d.FadeIn(anim_duration),
|
d => d.FadeIn(anim_duration),
|
||||||
d => d.ScaleTo(0.5f).ScaleTo(1.2f, anim_duration / 2)
|
d => d.ScaleTo(0.5f).ScaleTo(1f, anim_duration * 4, Easing.OutElasticHalf)
|
||||||
).Then(
|
|
||||||
d => d.ScaleTo(1, anim_duration / 2, Easing.Out)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +69,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
break;
|
break;
|
||||||
case ArmedState.Hit:
|
case ArmedState.Hit:
|
||||||
this.FadeOut(anim_duration, Easing.OutQuint)
|
this.FadeOut(anim_duration, Easing.OutQuint)
|
||||||
.ScaleTo(Scale * 1.5f, anim_duration, Easing.OutQuint);
|
.ScaleTo(Scale * 1.5f, anim_duration, Easing.Out);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
// We want the container to have the same size as the slider,
|
// 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).
|
// and to be positioned such that the slider head is at (0,0).
|
||||||
container.Size = path.Size;
|
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();
|
container.ForceRedraw();
|
||||||
}
|
}
|
||||||
@ -148,7 +148,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
path.Texture = texture;
|
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)
|
private bool updateSnaking(double p0, double p1)
|
||||||
{
|
{
|
||||||
if (SnakedStart == p0 && SnakedEnd == p1) return false;
|
if (SnakedStart == p0 && SnakedEnd == p1) return false;
|
||||||
@ -156,11 +156,11 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
SnakedStart = p0;
|
SnakedStart = p0;
|
||||||
SnakedEnd = p1;
|
SnakedEnd = p1;
|
||||||
|
|
||||||
slider.Curve.GetPathToProgress(currentCurve, p0, p1);
|
slider.Curve.GetPathToProgress(CurrentCurve, p0, p1);
|
||||||
|
|
||||||
path.ClearVertices();
|
path.ClearVertices();
|
||||||
foreach (Vector2 p in currentCurve)
|
foreach (Vector2 p in CurrentCurve)
|
||||||
path.AddVertex(p - currentCurve[0]);
|
path.AddVertex(p - CurrentCurve[0]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -71,12 +71,25 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
AddStep("Fast Short Slider 2 Repeats", () => testShortHighSpeed(2));
|
AddStep("Fast Short Slider 2 Repeats", () => testShortHighSpeed(2));
|
||||||
AddStep("Fast Short Slider 6 Repeats", () => testShortHighSpeed(6));
|
AddStep("Fast Short Slider 6 Repeats", () => testShortHighSpeed(6));
|
||||||
|
|
||||||
AddStep("Perfect Curve", testCurve);
|
AddStep("Perfect Curve", () => testPerfect());
|
||||||
|
AddStep("Perfect Curve 1 Repeat", () => testPerfect(1));
|
||||||
|
AddStep("Perfect Curve 2 Repeats", () => testPerfect(2));
|
||||||
|
|
||||||
AddStep("Catmull", () => testCatmull());
|
AddStep("Linear Slider", () => testLinear());
|
||||||
AddStep("Catmull 1 Repeat", () => testCatmull(1));
|
AddStep("Linear Slider 1 Repeat", () => testLinear(1));
|
||||||
|
AddStep("Linear Slider 2 Repeats", () => testLinear(2));
|
||||||
|
|
||||||
// TODO more curve types?
|
AddStep("Bezier Slider", () => testBezier());
|
||||||
|
AddStep("Bezier Slider 1 Repeat", () => testBezier(1));
|
||||||
|
AddStep("Bezier Slider 2 Repeats", () => testBezier(2));
|
||||||
|
|
||||||
|
AddStep("Linear Overlapping", () => testLinearOverlapping());
|
||||||
|
AddStep("Linear Overlapping 1 Repeat", () => testLinearOverlapping(1));
|
||||||
|
AddStep("Linear Overlapping 2 Repeats", () => testLinearOverlapping(2));
|
||||||
|
|
||||||
|
AddStep("Catmull Slider", () => testCatmull());
|
||||||
|
AddStep("Catmull Slider 1 Repeat", () => testCatmull(1));
|
||||||
|
AddStep("Catmull Slider 2 Repeats", () => testCatmull(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testSimpleBig(int repeats = 0) => createSlider(2, repeats: repeats);
|
private void testSimpleBig(int repeats = 0) => createSlider(2, repeats: repeats);
|
||||||
@ -95,10 +108,6 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
|
|
||||||
private void createSlider(float circleSize = 2, float distance = 400, int repeats = 0, double speedMultiplier = 2)
|
private void createSlider(float circleSize = 2, float distance = 400, int repeats = 0, double speedMultiplier = 2)
|
||||||
{
|
{
|
||||||
var repeatSamples = new List<List<SampleInfo>>();
|
|
||||||
for (int i = 0; i < repeats; i++)
|
|
||||||
repeatSamples.Add(new List<SampleInfo>());
|
|
||||||
|
|
||||||
var slider = new Slider
|
var slider = new Slider
|
||||||
{
|
{
|
||||||
StartTime = Time.Current + 1000,
|
StartTime = Time.Current + 1000,
|
||||||
@ -111,13 +120,13 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
},
|
},
|
||||||
Distance = distance,
|
Distance = distance,
|
||||||
RepeatCount = repeats,
|
RepeatCount = repeats,
|
||||||
RepeatSamples = repeatSamples
|
RepeatSamples = createEmptySamples(repeats)
|
||||||
};
|
};
|
||||||
|
|
||||||
addSlider(slider, circleSize, speedMultiplier);
|
addSlider(slider, circleSize, speedMultiplier);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testCurve()
|
private void testPerfect(int repeats = 0)
|
||||||
{
|
{
|
||||||
var slider = new Slider
|
var slider = new Slider
|
||||||
{
|
{
|
||||||
@ -130,7 +139,89 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
new Vector2(0, 200),
|
new Vector2(0, 200),
|
||||||
new Vector2(200, 0)
|
new Vector2(200, 0)
|
||||||
},
|
},
|
||||||
Distance = 600
|
Distance = 600,
|
||||||
|
RepeatCount = repeats,
|
||||||
|
RepeatSamples = createEmptySamples(repeats)
|
||||||
|
};
|
||||||
|
|
||||||
|
addSlider(slider, 2, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void testLinear(int repeats = 0) => createLinear(repeats);
|
||||||
|
|
||||||
|
private void createLinear(int repeats)
|
||||||
|
{
|
||||||
|
var slider = new Slider
|
||||||
|
{
|
||||||
|
CurveType = CurveType.Linear,
|
||||||
|
StartTime = Time.Current + 1000,
|
||||||
|
Position = new Vector2(-200, 0),
|
||||||
|
ComboColour = Color4.LightSeaGreen,
|
||||||
|
ControlPoints = new List<Vector2>
|
||||||
|
{
|
||||||
|
new Vector2(-200, 0),
|
||||||
|
new Vector2(-50, 75),
|
||||||
|
new Vector2(0, 100),
|
||||||
|
new Vector2(100, -200),
|
||||||
|
new Vector2(200, 0),
|
||||||
|
new Vector2(230, 0)
|
||||||
|
},
|
||||||
|
Distance = 793.4417,
|
||||||
|
RepeatCount = repeats,
|
||||||
|
RepeatSamples = createEmptySamples(repeats)
|
||||||
|
};
|
||||||
|
|
||||||
|
addSlider(slider, 2, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void testBezier(int repeats = 0) => createBezier(repeats);
|
||||||
|
|
||||||
|
private void createBezier(int repeats)
|
||||||
|
{
|
||||||
|
var slider = new Slider
|
||||||
|
{
|
||||||
|
CurveType = CurveType.Bezier,
|
||||||
|
StartTime = Time.Current + 1000,
|
||||||
|
Position = new Vector2(-200, 0),
|
||||||
|
ComboColour = Color4.LightSeaGreen,
|
||||||
|
ControlPoints = new List<Vector2>
|
||||||
|
{
|
||||||
|
new Vector2(-200, 0),
|
||||||
|
new Vector2(-50, 75),
|
||||||
|
new Vector2(0, 100),
|
||||||
|
new Vector2(100, -200),
|
||||||
|
new Vector2(230, 0)
|
||||||
|
},
|
||||||
|
Distance = 480,
|
||||||
|
RepeatCount = repeats,
|
||||||
|
RepeatSamples = createEmptySamples(repeats)
|
||||||
|
};
|
||||||
|
|
||||||
|
addSlider(slider, 2, 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void testLinearOverlapping(int repeats = 0) => createOverlapping(repeats);
|
||||||
|
|
||||||
|
private void createOverlapping(int repeats)
|
||||||
|
{
|
||||||
|
var slider = new Slider
|
||||||
|
{
|
||||||
|
CurveType = CurveType.Linear,
|
||||||
|
StartTime = Time.Current + 1000,
|
||||||
|
Position = new Vector2(0, 0),
|
||||||
|
ComboColour = Color4.LightSeaGreen,
|
||||||
|
ControlPoints = new List<Vector2>
|
||||||
|
{
|
||||||
|
new Vector2(0, 0),
|
||||||
|
new Vector2(-200, 0),
|
||||||
|
new Vector2(0, 0),
|
||||||
|
new Vector2(0, -200),
|
||||||
|
new Vector2(-200, -200),
|
||||||
|
new Vector2(0, -200)
|
||||||
|
},
|
||||||
|
Distance = 1000,
|
||||||
|
RepeatCount = repeats,
|
||||||
|
RepeatSamples = createEmptySamples(repeats)
|
||||||
};
|
};
|
||||||
|
|
||||||
addSlider(slider, 2, 3);
|
addSlider(slider, 2, 3);
|
||||||
@ -165,6 +256,14 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
addSlider(slider, 3, 1);
|
addSlider(slider, 3, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<List<SampleInfo>> createEmptySamples(int repeats)
|
||||||
|
{
|
||||||
|
var repeatSamples = new List<List<SampleInfo>>();
|
||||||
|
for (int i = 0; i < repeats; i++)
|
||||||
|
repeatSamples.Add(new List<SampleInfo>());
|
||||||
|
return repeatSamples;
|
||||||
|
}
|
||||||
|
|
||||||
private void addSlider(Slider slider, float circleSize, double speedMultiplier)
|
private void addSlider(Slider slider, float circleSize, double speedMultiplier)
|
||||||
{
|
{
|
||||||
var cpi = new ControlPointInfo();
|
var cpi = new ControlPointInfo();
|
||||||
|
Loading…
Reference in New Issue
Block a user