2016-12-06 23:02:27 +08:00
|
|
|
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2016-12-07 16:21:59 +08:00
|
|
|
|
using osu.Game.Graphics;
|
2016-12-06 23:02:27 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
|
|
|
|
|
{
|
|
|
|
|
public class SliderBouncer : Container, ISliderProgress
|
|
|
|
|
{
|
|
|
|
|
private readonly Slider slider;
|
|
|
|
|
private readonly bool isEnd;
|
2016-12-07 16:21:59 +08:00
|
|
|
|
private TextAwesome 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[]
|
|
|
|
|
{
|
2016-12-07 16:21:59 +08:00
|
|
|
|
icon = new TextAwesome
|
|
|
|
|
{
|
|
|
|
|
Icon = FontAwesome.fa_eercast,
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
2016-12-11 17:11:22 +08:00
|
|
|
|
TextSize = 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();
|
|
|
|
|
icon.RotateTo(360, 1000);
|
|
|
|
|
icon.Loop();
|
|
|
|
|
}
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|