Skip to content

Commit

Permalink
Merge pull request #16197 from bdach/beatmap-card/renames
Browse files Browse the repository at this point in the history
Rename beatmap card-related classes
  • Loading branch information
peppy committed Dec 21, 2021
2 parents d7136d6 + c7b9b17 commit 0bda789
Show file tree
Hide file tree
Showing 18 changed files with 363 additions and 363 deletions.
8 changes: 4 additions & 4 deletions osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ private void createTestCase(Func<APIBeatmapSet, Drawable> creationFunc)
[Test]
public void TestNormal()
{
createTestCase(beatmapSetInfo => new BeatmapCard(beatmapSetInfo));
createTestCase(beatmapSetInfo => new BeatmapCardNormal(beatmapSetInfo));
}

[Test]
Expand All @@ -264,7 +264,7 @@ public void TestExtra()
[Test]
public void TestHoverState()
{
AddStep("create cards", () => Child = createContent(OverlayColourScheme.Blue, s => new BeatmapCard(s)));
AddStep("create cards", () => Child = createContent(OverlayColourScheme.Blue, s => new BeatmapCardNormal(s)));

AddStep("Hover card", () => InputManager.MoveMouseTo(firstCard()));
AddWaitStep("wait for potential state change", 5);
Expand All @@ -281,10 +281,10 @@ public void TestHoverState()
AddWaitStep("wait for potential state change", 5);
AddAssert("card is still expanded", () => firstCard().Expanded.Value);

AddStep("Hover away", () => InputManager.MoveMouseTo(this.ChildrenOfType<BeatmapCard>().Last()));
AddStep("Hover away", () => InputManager.MoveMouseTo(this.ChildrenOfType<BeatmapCardNormal>().Last()));
AddUntilStep("card is not expanded", () => !firstCard().Expanded.Value);

BeatmapCard firstCard() => this.ChildrenOfType<BeatmapCard>().First();
BeatmapCardNormal firstCard() => this.ChildrenOfType<BeatmapCardNormal>().First();
}
}
}
288 changes: 41 additions & 247 deletions osu.Game/Beatmaps/Drawables/Cards/BeatmapCard.cs

Large diffs are not rendered by default.

80 changes: 0 additions & 80 deletions osu.Game/Beatmaps/Drawables/Cards/BeatmapCardBase.cs

This file was deleted.

14 changes: 7 additions & 7 deletions osu.Game/Beatmaps/Drawables/Cards/BeatmapCardContent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public BeatmapCardContent(float height)
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
CornerRadius = BeatmapCardBase.CORNER_RADIUS,
CornerRadius = BeatmapCard.CORNER_RADIUS,
Masking = true,
Unhovered = _ => updateFromHoverChange(),
Children = new Drawable[]
Expand All @@ -67,7 +67,7 @@ public BeatmapCardContent(float height)
{
RelativeSizeAxes = Axes.X,
Height = height,
CornerRadius = BeatmapCardBase.CORNER_RADIUS,
CornerRadius = BeatmapCard.CORNER_RADIUS,
Masking = true,
},
dropdownContent = new HoverHandlingContainer
Expand All @@ -91,7 +91,7 @@ public BeatmapCardContent(float height)
borderContainer = new Container
{
RelativeSizeAxes = Axes.Both,
CornerRadius = BeatmapCardBase.CORNER_RADIUS,
CornerRadius = BeatmapCard.CORNER_RADIUS,
Masking = true,
BorderThickness = 3,
Child = new Box
Expand Down Expand Up @@ -143,9 +143,9 @@ private void updateState()
// 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);

background.FadeTo(Expanded.Value ? 1 : 0, BeatmapCardBase.TRANSITION_DURATION, Easing.OutQuint);
dropdownContent.FadeTo(Expanded.Value ? 1 : 0, BeatmapCardBase.TRANSITION_DURATION, Easing.OutQuint);
borderContainer.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, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
borderContainer.FadeTo(Expanded.Value ? 1 : 0, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);

content.TweenEdgeEffectTo(new EdgeEffectParameters
{
Expand All @@ -154,7 +154,7 @@ private void updateState()
Radius = 10,
Colour = Colour4.Black.Opacity(Expanded.Value ? 0.3f : 0f),
Hollow = true,
}, BeatmapCardBase.TRANSITION_DURATION, Easing.OutQuint);
}, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
}

private class ExpandedContentScrollContainer : OsuScrollContainer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ protected override void LoadComplete()

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));
cover.FadeColour(gradient, BeatmapCardBase.TRANSITION_DURATION, Easing.OutQuint);
cover.FadeColour(gradient, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ private void stateChanged()
break;

case DownloadState.Importing:
foregroundFill.FadeColour(colours.Yellow, BeatmapCardBase.TRANSITION_DURATION, Easing.OutQuint);
foregroundFill.FadeColour(colours.Yellow, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
break;
}
}

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);
}
}
}
2 changes: 1 addition & 1 deletion osu.Game/Beatmaps/Drawables/Cards/BeatmapCardExtra.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

namespace osu.Game.Beatmaps.Drawables.Cards
{
public class BeatmapCardExtra : BeatmapCardBase
public class BeatmapCardExtra : BeatmapCard
{
protected override Drawable IdleContent => idleBottomContent;
protected override Drawable DownloadInProgressContent => downloadProgressBar;
Expand Down

0 comments on commit 0bda789

Please sign in to comment.