2017-02-07 12:59:30 +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
|
2016-12-06 23:02:27 +08:00
|
|
|
|
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2016-12-07 16:21:59 +08:00
|
|
|
|
using osu.Game.Graphics;
|
2017-08-03 13:36:21 +08:00
|
|
|
|
using OpenTK;
|
2016-12-06 23:02:27 +08:00
|
|
|
|
|
2017-04-18 15:05:58 +08:00
|
|
|
|
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
2016-12-06 23:02:27 +08:00
|
|
|
|
{
|
|
|
|
|
public class SliderBouncer : Container, ISliderProgress
|
|
|
|
|
{
|
|
|
|
|
private readonly Slider slider;
|
|
|
|
|
private readonly bool isEnd;
|
2017-08-03 13:36:21 +08:00
|
|
|
|
private readonly SpriteIcon icon;
|
2016-12-06 23:02:27 +08:00
|
|
|
|
|
|
|
|
|
public SliderBouncer(Slider slider, bool isEnd)
|
|
|
|
|
{
|
|
|
|
|
this.slider = slider;
|
|
|
|
|
this.isEnd = isEnd;
|
|
|
|
|
|
|
|
|
|
AutoSizeAxes = Axes.Both;
|
|
|
|
|
BlendingMode = BlendingMode.Additive;
|
|
|
|
|
Origin = Anchor.Centre;
|
|
|
|
|
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2017-08-03 13:36:21 +08:00
|
|
|
|
icon = new SpriteIcon
|
2016-12-07 16:21:59 +08:00
|
|
|
|
{
|
|
|
|
|
Icon = FontAwesome.fa_eercast,
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
2017-08-03 13:36:21 +08:00
|
|
|
|
Size = new Vector2(48),
|
2016-12-07 16:21:59 +08:00
|
|
|
|
}
|
2016-12-06 23:02:27 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-07 16:21:59 +08:00
|
|
|
|
protected override void LoadComplete()
|
|
|
|
|
{
|
|
|
|
|
base.LoadComplete();
|
2017-07-22 00:23:01 +08:00
|
|
|
|
icon.Spin(1000, RotationDirection.Clockwise);
|
2016-12-07 16:21:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
2016-12-06 23:02:27 +08:00
|
|
|
|
public void UpdateProgress(double progress, int repeat)
|
|
|
|
|
{
|
|
|
|
|
if (Time.Current < slider.StartTime)
|
|
|
|
|
Alpha = 0;
|
|
|
|
|
|
|
|
|
|
Alpha = repeat + 1 < slider.RepeatCount && repeat % 2 == (isEnd ? 0 : 1) ? 1 : 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|