Rename BeatmapCard{Base => }

This commit is contained in:
Bartłomiej Dach
2021-12-21 08:26:19 +01:00
parent 88d4e95ad8
commit c7b9b176c6
12 changed files with 27 additions and 27 deletions

View File

@ -15,7 +15,7 @@ using osu.Game.Overlays;
namespace osu.Game.Beatmaps.Drawables.Cards namespace osu.Game.Beatmaps.Drawables.Cards
{ {
public abstract class BeatmapCardBase : OsuClickableContainer public abstract class BeatmapCard : OsuClickableContainer
{ {
public const float TRANSITION_DURATION = 400; public const float TRANSITION_DURATION = 400;
public const float CORNER_RADIUS = 10; public const float CORNER_RADIUS = 10;
@ -30,7 +30,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
protected readonly BeatmapDownloadTracker DownloadTracker; protected readonly BeatmapDownloadTracker DownloadTracker;
protected BeatmapCardBase(APIBeatmapSet beatmapSet, bool allowExpansion = true) protected BeatmapCard(APIBeatmapSet beatmapSet, bool allowExpansion = true)
: base(HoverSampleSet.Submit) : base(HoverSampleSet.Submit)
{ {
Expanded = new BindableBool { Disabled = !allowExpansion }; Expanded = new BindableBool { Disabled = !allowExpansion };

View File

@ -54,7 +54,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
CornerRadius = BeatmapCardBase.CORNER_RADIUS, CornerRadius = BeatmapCard.CORNER_RADIUS,
Masking = true, Masking = true,
Unhovered = _ => updateFromHoverChange(), Unhovered = _ => updateFromHoverChange(),
Children = new Drawable[] Children = new Drawable[]
@ -67,7 +67,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Height = height, Height = height,
CornerRadius = BeatmapCardBase.CORNER_RADIUS, CornerRadius = BeatmapCard.CORNER_RADIUS,
Masking = true, Masking = true,
}, },
dropdownContent = new HoverHandlingContainer dropdownContent = new HoverHandlingContainer
@ -91,7 +91,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
borderContainer = new Container borderContainer = new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
CornerRadius = BeatmapCardBase.CORNER_RADIUS, CornerRadius = BeatmapCard.CORNER_RADIUS,
Masking = true, Masking = true,
BorderThickness = 3, BorderThickness = 3,
Child = new Box Child = new Box
@ -143,9 +143,9 @@ namespace osu.Game.Beatmaps.Drawables.Cards
// This avoids depth issues where a hovered (scaled) card to the right of another card would be beneath the card to the left. // This avoids depth issues where a hovered (scaled) card to the right of another card would be beneath the card to the left.
this.ScaleTo(Expanded.Value ? 1.03f : 1, 500, Easing.OutQuint); this.ScaleTo(Expanded.Value ? 1.03f : 1, 500, Easing.OutQuint);
background.FadeTo(Expanded.Value ? 1 : 0, BeatmapCardBase.TRANSITION_DURATION, Easing.OutQuint); background.FadeTo(Expanded.Value ? 1 : 0, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
dropdownContent.FadeTo(Expanded.Value ? 1 : 0, BeatmapCardBase.TRANSITION_DURATION, Easing.OutQuint); dropdownContent.FadeTo(Expanded.Value ? 1 : 0, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
borderContainer.FadeTo(Expanded.Value ? 1 : 0, BeatmapCardBase.TRANSITION_DURATION, Easing.OutQuint); borderContainer.FadeTo(Expanded.Value ? 1 : 0, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
content.TweenEdgeEffectTo(new EdgeEffectParameters content.TweenEdgeEffectTo(new EdgeEffectParameters
{ {
@ -154,7 +154,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
Radius = 10, Radius = 10,
Colour = Colour4.Black.Opacity(Expanded.Value ? 0.3f : 0f), Colour = Colour4.Black.Opacity(Expanded.Value ? 0.3f : 0f),
Hollow = true, Hollow = true,
}, BeatmapCardBase.TRANSITION_DURATION, Easing.OutQuint); }, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
} }
private class ExpandedContentScrollContainer : OsuScrollContainer private class ExpandedContentScrollContainer : OsuScrollContainer

View File

@ -62,10 +62,10 @@ namespace osu.Game.Beatmaps.Drawables.Cards
private void updateState() => Schedule(() => private void updateState() => Schedule(() =>
{ {
background.FadeColour(Dimmed.Value ? colourProvider.Background4 : colourProvider.Background2, BeatmapCardBase.TRANSITION_DURATION, Easing.OutQuint); background.FadeColour(Dimmed.Value ? colourProvider.Background4 : colourProvider.Background2, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
var gradient = ColourInfo.GradientHorizontal(Colour4.White.Opacity(0), Colour4.White.Opacity(0.2f)); var gradient = ColourInfo.GradientHorizontal(Colour4.White.Opacity(0), Colour4.White.Opacity(0.2f));
cover.FadeColour(gradient, BeatmapCardBase.TRANSITION_DURATION, Easing.OutQuint); cover.FadeColour(gradient, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
}); });
} }
} }

View File

@ -82,14 +82,14 @@ namespace osu.Game.Beatmaps.Drawables.Cards
break; break;
case DownloadState.Importing: case DownloadState.Importing:
foregroundFill.FadeColour(colours.Yellow, BeatmapCardBase.TRANSITION_DURATION, Easing.OutQuint); foregroundFill.FadeColour(colours.Yellow, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
break; break;
} }
} }
private void progressChanged() private void progressChanged()
{ {
foreground.ResizeWidthTo((float)progress.Value, progress.Value > 0 ? BeatmapCardBase.TRANSITION_DURATION : 0, Easing.OutQuint); foreground.ResizeWidthTo((float)progress.Value, progress.Value > 0 ? BeatmapCard.TRANSITION_DURATION : 0, Easing.OutQuint);
} }
} }
} }

View File

@ -20,7 +20,7 @@ using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Beatmaps.Drawables.Cards namespace osu.Game.Beatmaps.Drawables.Cards
{ {
public class BeatmapCardExtra : BeatmapCardBase public class BeatmapCardExtra : BeatmapCard
{ {
protected override Drawable IdleContent => idleBottomContent; protected override Drawable IdleContent => idleBottomContent;
protected override Drawable DownloadInProgressContent => downloadProgressBar; protected override Drawable DownloadInProgressContent => downloadProgressBar;

View File

@ -21,7 +21,7 @@ using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Beatmaps.Drawables.Cards namespace osu.Game.Beatmaps.Drawables.Cards
{ {
public class BeatmapCardNormal : BeatmapCardBase public class BeatmapCardNormal : BeatmapCard
{ {
protected override Drawable IdleContent => idleBottomContent; protected override Drawable IdleContent => idleBottomContent;
protected override Drawable DownloadInProgressContent => downloadProgressBar; protected override Drawable DownloadInProgressContent => downloadProgressBar;

View File

@ -88,8 +88,8 @@ namespace osu.Game.Beatmaps.Drawables.Cards
{ {
bool shouldDim = Dimmed.Value || playButton.Playing.Value; bool shouldDim = Dimmed.Value || playButton.Playing.Value;
playButton.FadeTo(shouldDim ? 1 : 0, BeatmapCardBase.TRANSITION_DURATION, Easing.OutQuint); playButton.FadeTo(shouldDim ? 1 : 0, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
cover.FadeColour(shouldDim ? OsuColour.Gray(0.2f) : Color4.White, BeatmapCardBase.TRANSITION_DURATION, Easing.OutQuint); cover.FadeColour(shouldDim ? OsuColour.Gray(0.2f) : Color4.White, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
} }
} }
} }

View File

@ -115,7 +115,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards.Buttons
bool isHovered = IsHovered && Enabled.Value; bool isHovered = IsHovered && Enabled.Value;
content.ScaleTo(isHovered ? 1.2f : 1, 500, Easing.OutQuint); content.ScaleTo(isHovered ? 1.2f : 1, 500, Easing.OutQuint);
content.FadeColour(isHovered ? HoverColour : IdleColour, BeatmapCardBase.TRANSITION_DURATION, Easing.OutQuint); content.FadeColour(isHovered ? HoverColour : IdleColour, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
} }
} }
} }

View File

@ -69,7 +69,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards.Buttons
case DownloadState.LocallyAvailable: case DownloadState.LocallyAvailable:
Action = null; Action = null;
TooltipText = string.Empty; TooltipText = string.Empty;
this.FadeOut(BeatmapCardBase.TRANSITION_DURATION, Easing.OutQuint); this.FadeOut(BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
break; break;
case DownloadState.NotDownloaded: case DownloadState.NotDownloaded:
@ -81,7 +81,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards.Buttons
} }
Action = () => beatmaps.Download(beatmapSet, preferNoVideo.Value); Action = () => beatmaps.Download(beatmapSet, preferNoVideo.Value);
this.FadeIn(BeatmapCardBase.TRANSITION_DURATION, Easing.OutQuint); this.FadeIn(BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
spinner.Hide(); spinner.Hide();
Icon.Show(); Icon.Show();

View File

@ -43,7 +43,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards.Buttons
private void updateState() private void updateState()
{ {
this.FadeTo(state.Value == DownloadState.LocallyAvailable ? 1 : 0, BeatmapCardBase.TRANSITION_DURATION, Easing.OutQuint); this.FadeTo(state.Value == DownloadState.LocallyAvailable ? 1 : 0, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
} }
} }
} }

View File

@ -141,7 +141,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards.Buttons
private void toggleLoading(bool loading) private void toggleLoading(bool loading)
{ {
Enabled.Value = !loading; Enabled.Value = !loading;
icon.FadeTo(loading ? 0 : 1, BeatmapCardBase.TRANSITION_DURATION, Easing.OutQuint); icon.FadeTo(loading ? 0 : 1, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
loadingSpinner.State.Value = loading ? Visibility.Visible : Visibility.Hidden; loadingSpinner.State.Value = loading ? Visibility.Visible : Visibility.Hidden;
} }
} }

View File

@ -78,7 +78,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
RelativeSizeAxes = Axes.Y; RelativeSizeAxes = Axes.Y;
Masking = true; Masking = true;
CornerRadius = BeatmapCardBase.CORNER_RADIUS; CornerRadius = BeatmapCard.CORNER_RADIUS;
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
@ -133,7 +133,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
{ {
Name = @"Main content", Name = @"Main content",
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
CornerRadius = BeatmapCardBase.CORNER_RADIUS, CornerRadius = BeatmapCard.CORNER_RADIUS,
Masking = true, Masking = true,
Children = new Drawable[] Children = new Drawable[]
{ {
@ -169,10 +169,10 @@ namespace osu.Game.Beatmaps.Drawables.Cards
{ {
float targetWidth = Width - (ShowDetails.Value ? ButtonsExpandedWidth : ButtonsCollapsedWidth); float targetWidth = Width - (ShowDetails.Value ? ButtonsExpandedWidth : ButtonsCollapsedWidth);
mainArea.ResizeWidthTo(targetWidth, BeatmapCardBase.TRANSITION_DURATION, Easing.OutQuint); mainArea.ResizeWidthTo(targetWidth, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
background.FadeColour(downloadTracker.State.Value == DownloadState.LocallyAvailable ? colours.Lime0 : colourProvider.Background3, BeatmapCardBase.TRANSITION_DURATION, Easing.OutQuint); background.FadeColour(downloadTracker.State.Value == DownloadState.LocallyAvailable ? colours.Lime0 : colourProvider.Background3, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
buttons.FadeTo(ShowDetails.Value ? 1 : 0, BeatmapCardBase.TRANSITION_DURATION, Easing.OutQuint); buttons.FadeTo(ShowDetails.Value ? 1 : 0, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
foreach (var button in buttons) foreach (var button in buttons)
{ {