Merge branch 'master' into repeat-points

This commit is contained in:
ColdVolcano
2018-01-31 21:30:28 -06:00
67 changed files with 1167 additions and 227 deletions

View File

@ -22,8 +22,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
/// </summary>
private bool isRepeatAtEnd => repeatPoint.RepeatIndex % 2 == 0;
public double FadeInTime;
public double FadeOutTime;
private double animDuration;
public DrawableRepeatPoint(RepeatPoint repeatPoint, DrawableSlider drawableSlider)
: base(repeatPoint)
@ -54,11 +53,11 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
protected override void UpdatePreemptState()
{
var animIn = Math.Min(150, repeatPoint.StartTime - FadeInTime);
animDuration = Math.Min(150, repeatPoint.SpanDuration / 2);
this.FadeIn(animIn).ScaleTo(1.2f, animIn)
this.FadeIn(animDuration).ScaleTo(1.2f, animDuration / 2)
.Then()
.ScaleTo(1, 150, Easing.Out);
.ScaleTo(1, animDuration / 2, Easing.Out);
}
protected override void UpdateCurrentState(ArmedState state)
@ -66,14 +65,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
switch (state)
{
case ArmedState.Idle:
this.Delay(FadeOutTime - repeatPoint.StartTime).FadeOut();
this.Delay(HitObject.TimePreempt).FadeOut();
break;
case ArmedState.Miss:
this.FadeOut(160);
this.FadeOut(animDuration);
break;
case ArmedState.Hit:
this.FadeOut(120, Easing.OutQuint)
.ScaleTo(Scale * 1.5f, 120, Easing.OutQuint);
this.FadeOut(animDuration, Easing.OutQuint)
.ScaleTo(Scale * 1.5f, animDuration, Easing.OutQuint);
break;
}
}

View File

@ -75,12 +75,11 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
AddNested(InitialCircle);
var spanDuration = s.Curve.Distance / s.Velocity;
foreach (var tick in s.NestedHitObjects.OfType<SliderTick>())
{
var spanStartTime = s.StartTime + tick.SpanIndex * spanDuration;
var spanStartTime = s.StartTime + tick.SpanIndex * s.SpanDuration;
var fadeInTime = spanStartTime + (tick.StartTime - spanStartTime) / 2 - (tick.SpanIndex == 0 ? HitObject.TimeFadein : HitObject.TimeFadein / 2);
var fadeOutTime = spanStartTime + spanDuration;
var fadeOutTime = spanStartTime + s.SpanDuration;
var drawableTick = new DrawableSliderTick(tick)
{
@ -95,15 +94,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
foreach (var repeatPoint in s.NestedHitObjects.OfType<RepeatPoint>())
{
var repeatStartTime = s.StartTime + (repeatPoint.RepeatIndex + 1) * spanDuration;
var fadeInTime = repeatStartTime + (repeatPoint.StartTime - repeatStartTime) / 2 - (repeatPoint.RepeatIndex == 0 ? HitObject.TimeFadein : HitObject.TimeFadein / 2);
var fadeOutTime = repeatStartTime + spanDuration;
var drawableRepeatPoint = new DrawableRepeatPoint(repeatPoint, this)
{
FadeInTime = fadeInTime,
FadeOutTime = fadeOutTime,
Position = repeatPoint.Position,
Position = repeatPoint.Position
};
repeatPoints.Add(drawableRepeatPoint);

View File

@ -20,8 +20,8 @@ namespace osu.Game.Rulesets.Osu.Objects
public double HitWindow100 = 80;
public double HitWindow300 = 30;
public float TimePreempt = 600;
public float TimeFadein = 400;
public double TimePreempt = 600;
public double TimeFadein = 400;
public Vector2 Position { get; set; }
public float X => Position.X;

View File

@ -1,10 +1,25 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
namespace osu.Game.Rulesets.Osu.Objects
{
public class RepeatPoint : OsuHitObject
{
public int RepeatIndex { get; set; }
public double SpanDuration { get; set; }
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
{
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
// We want to show the first RepeatPoint as the TimePreempt dictates but on short (and possibly fast) sliders
// we may need to cut down this time on following RepeatPoints to only show up to two RepeatPoints at any given time.
if (RepeatIndex > 0)
TimePreempt = Math.Min(SpanDuration * 2, TimePreempt);
}
}
}

View File

@ -60,6 +60,11 @@ namespace osu.Game.Rulesets.Osu.Objects
public List<List<SampleInfo>> RepeatSamples { get; set; } = new List<List<SampleInfo>>();
public int RepeatCount { get; set; }
/// <summary>
/// The length of one span of this <see cref="Slider"/>.
/// </summary>
public double SpanDuration => Duration / this.SpanCount();
private int stackHeight;
public override int StackHeight
@ -102,13 +107,12 @@ namespace osu.Game.Rulesets.Osu.Objects
var length = Curve.Distance;
var tickDistance = Math.Min(TickDistance, length);
var spanDuration = length / Velocity;
var minDistanceFromEnd = Velocity * 0.01;
for (var span = 0; span < this.SpanCount(); span++)
{
var spanStartTime = StartTime + span * spanDuration;
var spanStartTime = StartTime + span * SpanDuration;
var reversed = span % 2 == 1;
for (var d = tickDistance; d <= length; d += tickDistance)
@ -133,7 +137,7 @@ namespace osu.Game.Rulesets.Osu.Objects
AddNested(new SliderTick
{
SpanIndex = span,
StartTime = spanStartTime + timeProgress * spanDuration,
StartTime = spanStartTime + timeProgress * SpanDuration,
Position = Curve.PositionAt(distanceProgress),
StackHeight = StackHeight,
Scale = Scale,
@ -146,16 +150,13 @@ namespace osu.Game.Rulesets.Osu.Objects
private void createRepeatPoints()
{
var repeatDuration = Distance / Velocity;
for (int repeatIndex = 0, repeat = 1; repeatIndex < RepeatCount; repeatIndex++, repeat++)
{
var repeatStartTime = StartTime + repeat * repeatDuration;
AddNested(new RepeatPoint
{
RepeatIndex = repeatIndex,
StartTime = repeatStartTime,
SpanDuration = SpanDuration,
StartTime = StartTime + repeat * SpanDuration,
Position = Curve.PositionAt(repeat % 2),
StackHeight = StackHeight,
Scale = Scale,