2020-01-04 20:01:42 +08:00
|
|
|
// 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.
|
|
|
|
|
2023-10-17 20:33:57 +08:00
|
|
|
using System;
|
2020-12-04 19:21:53 +08:00
|
|
|
using osu.Framework.Allocation;
|
2020-01-04 20:01:42 +08:00
|
|
|
using osu.Framework.Graphics;
|
2023-10-02 18:17:45 +08:00
|
|
|
using osu.Framework.Graphics.Containers;
|
2020-01-04 20:01:42 +08:00
|
|
|
using osu.Framework.Graphics.Sprites;
|
2025-01-02 17:36:58 +08:00
|
|
|
using osu.Framework.Utils;
|
2020-04-05 18:36:52 +08:00
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
2020-12-04 19:21:53 +08:00
|
|
|
using osu.Game.Rulesets.Osu.Objects;
|
2023-10-17 20:33:57 +08:00
|
|
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
2020-12-04 19:21:53 +08:00
|
|
|
using osuTK;
|
2020-01-04 20:01:42 +08:00
|
|
|
|
2020-12-04 19:21:53 +08:00
|
|
|
namespace osu.Game.Rulesets.Osu.Skinning.Default
|
2020-01-04 20:01:42 +08:00
|
|
|
{
|
2023-10-02 18:17:45 +08:00
|
|
|
public partial class DefaultReverseArrow : CompositeDrawable
|
2020-01-04 20:01:42 +08:00
|
|
|
{
|
2023-10-17 20:33:57 +08:00
|
|
|
private DrawableSliderRepeat drawableRepeat { get; set; } = null!;
|
2020-04-05 17:45:10 +08:00
|
|
|
|
2023-10-02 16:41:08 +08:00
|
|
|
public DefaultReverseArrow()
|
2020-01-04 20:01:42 +08:00
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre;
|
|
|
|
Origin = Anchor.Centre;
|
|
|
|
|
2023-09-20 11:48:15 +08:00
|
|
|
Size = OsuHitObject.OBJECT_DIMENSIONS;
|
2020-01-04 20:01:42 +08:00
|
|
|
|
2023-10-02 18:17:45 +08:00
|
|
|
InternalChild = new SpriteIcon
|
2020-01-04 20:01:42 +08:00
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2020-04-08 17:58:09 +08:00
|
|
|
Blending = BlendingParameters.Additive,
|
2020-01-04 20:01:42 +08:00
|
|
|
Icon = FontAwesome.Solid.ChevronRight,
|
2023-10-02 16:41:08 +08:00
|
|
|
Size = new Vector2(0.35f),
|
2020-01-04 20:01:42 +08:00
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2023-10-02 18:17:45 +08:00
|
|
|
[BackgroundDependencyLoader]
|
2023-10-17 20:33:57 +08:00
|
|
|
private void load(DrawableHitObject drawableObject)
|
2023-10-02 18:17:45 +08:00
|
|
|
{
|
2023-10-17 20:33:57 +08:00
|
|
|
drawableRepeat = (DrawableSliderRepeat)drawableObject;
|
2023-10-02 18:17:45 +08:00
|
|
|
}
|
|
|
|
|
2025-01-02 17:36:58 +08:00
|
|
|
protected override void Update()
|
2023-10-02 18:17:45 +08:00
|
|
|
{
|
2025-01-02 17:36:58 +08:00
|
|
|
base.Update();
|
2023-10-02 18:17:45 +08:00
|
|
|
|
2025-01-02 17:36:58 +08:00
|
|
|
if (Time.Current >= drawableRepeat.HitStateUpdateTime && drawableRepeat.State.Value == ArmedState.Hit)
|
2023-10-02 18:17:45 +08:00
|
|
|
{
|
2025-01-02 17:36:58 +08:00
|
|
|
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));
|
2023-10-02 18:17:45 +08:00
|
|
|
}
|
2025-01-02 17:36:58 +08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
const float scale_amount = 1.3f;
|
2023-10-02 18:17:45 +08:00
|
|
|
|
2025-01-02 17:36:58 +08:00
|
|
|
const double move_out_duration = 35;
|
|
|
|
const double move_in_duration = 250;
|
|
|
|
const double total = 300;
|
2023-10-02 21:28:33 +08:00
|
|
|
|
2025-01-02 17:36:58 +08: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 17:45:10 +08:00
|
|
|
}
|
2020-01-04 20:01:42 +08:00
|
|
|
}
|
|
|
|
}
|