2022-10-17 13:26:51 +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.
|
|
|
|
|
2022-11-03 14:11:26 +08:00
|
|
|
using System;
|
2022-10-17 13:26:51 +08:00
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.UserInterface;
|
2022-11-03 14:11:26 +08:00
|
|
|
using osu.Framework.Utils;
|
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
|
|
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
2022-10-17 13:26:51 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Osu.Skinning.Argon
|
|
|
|
{
|
|
|
|
public partial class ArgonSpinnerRingArc : CompositeDrawable
|
|
|
|
{
|
|
|
|
private const float arc_fill = 0.31f;
|
2022-11-03 14:11:26 +08:00
|
|
|
private const float arc_fill_complete = 0.50f;
|
|
|
|
|
2022-10-17 13:26:51 +08:00
|
|
|
private const float arc_radius = 0.02f;
|
|
|
|
|
2022-11-03 14:11:26 +08:00
|
|
|
private DrawableSpinner spinner = null!;
|
|
|
|
private CircularProgress fill = null!;
|
|
|
|
|
2022-10-17 13:26:51 +08:00
|
|
|
[BackgroundDependencyLoader]
|
2022-11-03 14:11:26 +08:00
|
|
|
private void load(DrawableHitObject drawableHitObject)
|
2022-10-17 13:26:51 +08:00
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
|
|
|
|
2022-11-03 14:11:26 +08:00
|
|
|
spinner = (DrawableSpinner)drawableHitObject;
|
|
|
|
InternalChild = fill = new CircularProgress
|
2022-10-17 13:26:51 +08:00
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Current = { Value = arc_fill },
|
|
|
|
Rotation = -arc_fill * 180,
|
|
|
|
InnerRadius = arc_radius,
|
|
|
|
RoundedCaps = true,
|
|
|
|
};
|
|
|
|
}
|
2022-11-03 14:11:26 +08:00
|
|
|
|
|
|
|
protected override void Update()
|
|
|
|
{
|
|
|
|
base.Update();
|
|
|
|
|
|
|
|
fill.Current.Value = (float)Interpolation.DampContinuously(fill.Current.Value, spinner.Progress >= 1 ? arc_fill_complete : arc_fill, 40f, (float)Math.Abs(Time.Elapsed));
|
|
|
|
fill.InnerRadius = (float)Interpolation.DampContinuously(fill.InnerRadius, spinner.Progress >= 1 ? arc_radius * 2.2f : arc_radius, 40f, (float)Math.Abs(Time.Elapsed));
|
|
|
|
|
|
|
|
fill.Rotation = (float)(-fill.Current.Value * 180);
|
|
|
|
}
|
2022-10-17 13:26:51 +08:00
|
|
|
}
|
|
|
|
}
|