1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 13:22:55 +08:00

Merge pull request #21502 from EVAST9919/smooth-progress-remove

Remove SmoothCircularProgress component as being replaced
This commit is contained in:
Dean Herbert 2022-12-05 14:49:32 +09:00 committed by GitHub
commit c288873365
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 144 deletions

View File

@ -11,7 +11,7 @@ using osu.Game.Beatmaps.Drawables.Cards.Buttons;
using osu.Game.Graphics;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays;
using osu.Game.Screens.Ranking.Expanded.Accuracy;
using osu.Framework.Graphics.UserInterface;
using osuTK;
using osuTK.Graphics;
@ -30,7 +30,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
private readonly UpdateableOnlineBeatmapSetCover cover;
private readonly Container foreground;
private readonly PlayButton playButton;
private readonly SmoothCircularProgress progress;
private readonly CircularProgress progress;
private readonly Container content;
protected override Container<Drawable> Content => content;
@ -53,7 +53,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
{
RelativeSizeAxes = Axes.Both
},
progress = new SmoothCircularProgress
progress = new CircularProgress
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,

View File

@ -12,6 +12,7 @@ using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Utils;
using osu.Game.Audio;
using osu.Game.Graphics;
@ -79,8 +80,8 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
private readonly ScoreInfo score;
private SmoothCircularProgress accuracyCircle;
private SmoothCircularProgress innerMask;
private CircularProgress accuracyCircle;
private CircularProgress innerMask;
private Container<RankBadge> badges;
private RankText rankText;
@ -109,7 +110,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
{
InternalChildren = new Drawable[]
{
new SmoothCircularProgress
new CircularProgress
{
Name = "Background circle",
Anchor = Anchor.Centre,
@ -120,7 +121,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
InnerRadius = accuracy_circle_radius + 0.01f, // Extends a little bit into the circle
Current = { Value = 1 },
},
accuracyCircle = new SmoothCircularProgress
accuracyCircle = new CircularProgress
{
Name = "Accuracy circle",
Anchor = Anchor.Centre,
@ -139,42 +140,42 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
Padding = new MarginPadding(2),
Children = new Drawable[]
{
new SmoothCircularProgress
new CircularProgress
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.ForRank(ScoreRank.X),
InnerRadius = RANK_CIRCLE_RADIUS,
Current = { Value = 1 }
},
new SmoothCircularProgress
new CircularProgress
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.ForRank(ScoreRank.S),
InnerRadius = RANK_CIRCLE_RADIUS,
Current = { Value = 1 - virtual_ss_percentage }
},
new SmoothCircularProgress
new CircularProgress
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.ForRank(ScoreRank.A),
InnerRadius = RANK_CIRCLE_RADIUS,
Current = { Value = 0.95f }
},
new SmoothCircularProgress
new CircularProgress
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.ForRank(ScoreRank.B),
InnerRadius = RANK_CIRCLE_RADIUS,
Current = { Value = 0.9f }
},
new SmoothCircularProgress
new CircularProgress
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.ForRank(ScoreRank.C),
InnerRadius = RANK_CIRCLE_RADIUS,
Current = { Value = 0.8f }
},
new SmoothCircularProgress
new CircularProgress
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.ForRank(ScoreRank.D),
@ -195,14 +196,14 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
Blending = new BlendingParameters
{
Source = BlendingType.DstColor,
Destination = BlendingType.OneMinusSrcAlpha,
Destination = BlendingType.OneMinusSrcColor,
SourceAlpha = BlendingType.One,
DestinationAlpha = BlendingType.SrcAlpha
},
Child = innerMask = new SmoothCircularProgress
Child = innerMask = new CircularProgress
{
RelativeSizeAxes = Axes.Both,
InnerRadius = RANK_CIRCLE_RADIUS - 0.01f,
InnerRadius = RANK_CIRCLE_RADIUS - 0.02f,
}
}
}

View File

@ -1,128 +0,0 @@
// 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.
#nullable disable
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Transforms;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics;
using osuTK;
namespace osu.Game.Screens.Ranking.Expanded.Accuracy
{
/// <summary>
/// Contains a <see cref="CircularProgress"/> with smoothened edges.
/// </summary>
public partial class SmoothCircularProgress : CompositeDrawable
{
public Bindable<double> Current
{
get => progress.Current;
set => progress.Current = value;
}
public float InnerRadius
{
get => progress.InnerRadius;
set
{
progress.InnerRadius = value;
innerSmoothingContainer.Size = new Vector2(1 - value);
smoothingWedge.Height = value / 2;
}
}
private readonly CircularProgress progress;
private readonly Container innerSmoothingContainer;
private readonly Drawable smoothingWedge;
public SmoothCircularProgress()
{
Container smoothingWedgeContainer;
InternalChild = new BufferedContainer
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
progress = new CircularProgress { RelativeSizeAxes = Axes.Both },
smoothingWedgeContainer = new Container
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Child = smoothingWedge = new Box
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
RelativeSizeAxes = Axes.Y,
Width = 1f,
EdgeSmoothness = new Vector2(2, 0),
}
},
new Container
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding(-1),
Child = new CircularContainer
{
RelativeSizeAxes = Axes.Both,
BorderThickness = 2,
Masking = true,
BorderColour = OsuColour.Gray(0.5f).Opacity(0.75f),
Blending = new BlendingParameters
{
AlphaEquation = BlendingEquation.ReverseSubtract,
},
Child = new Box
{
RelativeSizeAxes = Axes.Both,
Alpha = 0,
AlwaysPresent = true
}
}
},
innerSmoothingContainer = new Container
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Size = Vector2.Zero,
Padding = new MarginPadding(-1),
Child = new CircularContainer
{
RelativeSizeAxes = Axes.Both,
BorderThickness = 2,
BorderColour = OsuColour.Gray(0.5f).Opacity(0.75f),
Masking = true,
Blending = new BlendingParameters
{
AlphaEquation = BlendingEquation.ReverseSubtract,
},
Child = new Box
{
RelativeSizeAxes = Axes.Both,
Alpha = 0,
AlwaysPresent = true
}
}
},
}
};
Current.BindValueChanged(c =>
{
smoothingWedgeContainer.Alpha = c.NewValue > 0 ? 1 : 0;
smoothingWedgeContainer.Rotation = (float)(360 * c.NewValue);
}, true);
}
public TransformSequence<CircularProgress> FillTo(double newValue, double duration = 0, Easing easing = Easing.None)
=> progress.FillTo(newValue, duration, easing);
}
}