2017-09-27 00:13:34 +08:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
|
|
|
|
using OpenTK;
|
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
|
using osu.Game.Rulesets.Osu.Judgements;
|
|
|
|
|
|
2017-09-27 00:21:39 +08:00
|
|
|
|
namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
2017-09-27 00:13:34 +08:00
|
|
|
|
{
|
2017-09-27 23:28:44 +08:00
|
|
|
|
public class DrawableRepeatPoint : DrawableOsuHitObject
|
2017-09-27 00:13:34 +08:00
|
|
|
|
{
|
2017-09-27 23:28:44 +08:00
|
|
|
|
private readonly RepeatPoint repeatPoint;
|
2017-09-27 00:13:34 +08:00
|
|
|
|
private readonly DrawableSlider drawableSlider;
|
|
|
|
|
|
|
|
|
|
public double FadeInTime;
|
|
|
|
|
public double FadeOutTime;
|
|
|
|
|
|
2017-11-03 14:30:46 +08:00
|
|
|
|
public DrawableRepeatPoint(RepeatPoint repeatPoint, DrawableSlider drawableSlider)
|
|
|
|
|
: base(repeatPoint)
|
2017-09-27 00:13:34 +08:00
|
|
|
|
{
|
2017-09-27 23:28:44 +08:00
|
|
|
|
this.repeatPoint = repeatPoint;
|
2017-09-27 00:13:34 +08:00
|
|
|
|
this.drawableSlider = drawableSlider;
|
|
|
|
|
|
2017-12-30 16:05:40 +08:00
|
|
|
|
Size = new Vector2(32 * repeatPoint.Scale);
|
|
|
|
|
|
2017-09-27 00:13:34 +08:00
|
|
|
|
Blending = BlendingMode.Additive;
|
|
|
|
|
Origin = Anchor.Centre;
|
2017-12-30 16:05:40 +08:00
|
|
|
|
|
2017-09-27 00:13:34 +08:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new SpriteIcon
|
|
|
|
|
{
|
2017-12-30 16:05:40 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Icon = FontAwesome.fa_eercast
|
2017-09-27 00:13:34 +08:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void CheckForJudgements(bool userTriggered, double timeOffset)
|
|
|
|
|
{
|
2017-09-27 23:28:44 +08:00
|
|
|
|
if (repeatPoint.StartTime <= Time.Current)
|
2017-09-27 00:13:34 +08:00
|
|
|
|
AddJudgement(new OsuJudgement { Result = drawableSlider.Tracking ? HitResult.Great : HitResult.Miss });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void UpdatePreemptState()
|
|
|
|
|
{
|
2017-09-27 23:28:44 +08:00
|
|
|
|
var animIn = Math.Min(150, repeatPoint.StartTime - FadeInTime);
|
2017-09-27 00:13:34 +08:00
|
|
|
|
|
2017-11-03 14:29:16 +08:00
|
|
|
|
this.FadeIn(animIn).ScaleTo(1.2f, animIn)
|
|
|
|
|
.Then()
|
|
|
|
|
.ScaleTo(1, 150, Easing.Out);
|
2017-09-27 00:13:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void UpdateCurrentState(ArmedState state)
|
|
|
|
|
{
|
|
|
|
|
switch (state)
|
|
|
|
|
{
|
|
|
|
|
case ArmedState.Idle:
|
2017-09-27 23:28:44 +08:00
|
|
|
|
this.Delay(FadeOutTime - repeatPoint.StartTime).FadeOut();
|
2017-09-27 00:13:34 +08:00
|
|
|
|
break;
|
|
|
|
|
case ArmedState.Miss:
|
|
|
|
|
this.FadeOut(160);
|
|
|
|
|
break;
|
|
|
|
|
case ArmedState.Hit:
|
|
|
|
|
this.FadeOut(120, Easing.OutQuint)
|
|
|
|
|
.ScaleTo(Scale * 1.5f, 120, Easing.OutQuint);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|