1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-11 05:10:02 +08:00

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

71 lines
2.6 KiB
C#
Raw Normal View History

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
2020-12-04 20:21:53 +09:00
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Utils;
2020-04-05 13:36:52 +03:00
using osu.Game.Rulesets.Objects.Drawables;
2020-12-04 20:21:53 +09:00
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
2020-12-04 20:21:53 +09:00
using osuTK;
2020-12-04 20:21:53 +09:00
namespace osu.Game.Rulesets.Osu.Skinning.Default
{
public partial class DefaultReverseArrow : CompositeDrawable
{
private DrawableSliderRepeat drawableRepeat { get; set; } = null!;
2020-04-05 12:45:10 +03:00
public DefaultReverseArrow()
{
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
2023-09-20 12:48:15 +09:00
Size = OsuHitObject.OBJECT_DIMENSIONS;
InternalChild = new SpriteIcon
{
RelativeSizeAxes = Axes.Both,
2020-04-08 18:58:09 +09:00
Blending = BlendingParameters.Additive,
Icon = FontAwesome.Solid.ChevronRight,
Size = new Vector2(0.35f),
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
};
}
[BackgroundDependencyLoader]
private void load(DrawableHitObject drawableObject)
{
drawableRepeat = (DrawableSliderRepeat)drawableObject;
}
protected override void Update()
{
base.Update();
if (Time.Current >= drawableRepeat.HitStateUpdateTime && drawableRepeat.State.Value == ArmedState.Hit)
{
double animDuration = Math.Min(300, drawableRepeat.HitObject.SpanDuration);
Scale = new Vector2(Interpolation.ValueAt(Time.Current, 1, 1.5f, drawableRepeat.HitStateUpdateTime, drawableRepeat.HitStateUpdateTime + animDuration, Easing.Out));
}
else
{
const float scale_amount = 1.3f;
const double move_out_duration = 35;
const double move_in_duration = 250;
const double total = 300;
2023-10-02 22:28:33 +09:00
double loopCurrentTime = (Time.Current - drawableRepeat.AnimationStartTime.Value) % total;
if (loopCurrentTime < move_out_duration)
Scale = new Vector2(Interpolation.ValueAt(loopCurrentTime, 1, scale_amount, 0, move_out_duration, Easing.Out));
else
Scale = new Vector2(Interpolation.ValueAt(loopCurrentTime, scale_amount, 1f, move_out_duration, move_out_duration + move_in_duration, Easing.Out));
}
2020-04-05 12:45:10 +03:00
}
}
}