1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-22 11:02:56 +08:00

Tidy up remaining common code

This commit is contained in:
Dean Herbert 2025-02-18 16:32:12 +09:00
parent 644fb29843
commit 7e1984452f
No known key found for this signature in database
6 changed files with 27 additions and 56 deletions

View File

@ -64,7 +64,11 @@ namespace osu.Game.Screens.SelectV2
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider, OsuColour colours)
{
RelativeSizeAxes = Axes.Both;
Anchor = Anchor.TopRight;
Origin = Anchor.TopRight;
RelativeSizeAxes = Axes.X;
Height = CarouselItem.DEFAULT_HEIGHT;
InternalChild = TopLevelContent = new Container
{
@ -161,6 +165,12 @@ namespace osu.Game.Screens.SelectV2
KeyboardSelected.BindValueChanged(_ => updateDisplay(), true);
}
protected override void PrepareForUse()
{
base.PrepareForUse();
this.FadeInFromZero(duration, Easing.OutQuint);
}
[Resolved]
private BeatmapCarousel? carousel { get; set; }

View File

@ -26,12 +26,6 @@ namespace osu.Game.Screens.SelectV2
{
public const float HEIGHT = CarouselItem.DEFAULT_HEIGHT;
// todo: this should be replaced with information from CarouselItem about how deep is PanelBeatmap in the carousel
// (i.e. whether it's under a beatmap set that's under a group, or just under a top-level beatmap set).
private const float difficulty_x_offset = 100f; // constant X offset for beatmap difficulty panels specifically.
private const float duration = 500;
private StarCounter starCounter = null!;
private ConstrainedIconContainer difficultyIcon = null!;
private OsuSpriteText keyCountText = null!;
@ -74,11 +68,6 @@ namespace osu.Game.Screens.SelectV2
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
Anchor = Anchor.TopRight;
Origin = Anchor.TopRight;
RelativeSizeAxes = Axes.X;
Width = 1f;
Height = HEIGHT;
Icon = difficultyIcon = new ConstrainedIconContainer
@ -194,9 +183,6 @@ namespace osu.Game.Screens.SelectV2
computeStarRating();
updateKeyCount();
FinishTransforms(true);
this.FadeInFromZero(duration, Easing.OutQuint);
}
protected override void FreeAfterUse()
@ -244,6 +230,8 @@ namespace osu.Game.Screens.SelectV2
private void updateDisplay()
{
const float duration = 500;
var starDifficulty = starDifficultyBindable?.Value ?? default;
starRatingDisplay.Current.Value = starDifficulty;

View File

@ -21,8 +21,6 @@ namespace osu.Game.Screens.SelectV2
{
public const float HEIGHT = CarouselItem.DEFAULT_HEIGHT * 1.6f;
private const float duration = 500;
private BeatmapSetPanelBackground background = null!;
private OsuSpriteText titleText = null!;
@ -46,9 +44,6 @@ namespace osu.Game.Screens.SelectV2
[BackgroundDependencyLoader]
private void load()
{
Anchor = Anchor.TopRight;
Origin = Anchor.TopRight;
RelativeSizeAxes = Axes.X;
Height = HEIGHT;
Icon = chevronIcon = new Container
@ -133,6 +128,8 @@ namespace osu.Game.Screens.SelectV2
private void onExpanded()
{
const float duration = 500;
chevronIcon.ResizeWidthTo(Expanded.Value ? 22 : 0f, duration, Easing.OutQuint);
chevronIcon.FadeTo(Expanded.Value ? 1f : 0f, duration, Easing.OutQuint);
}
@ -153,9 +150,6 @@ namespace osu.Game.Screens.SelectV2
updateButton.BeatmapSet = beatmapSet;
statusPill.Status = beatmapSet.Status;
difficultiesDisplay.BeatmapSet = beatmapSet;
FinishTransforms(true);
this.FadeInFromZero(duration, Easing.OutQuint);
}
protected override void FreeAfterUse()

View File

@ -27,8 +27,6 @@ namespace osu.Game.Screens.SelectV2
{
public const float HEIGHT = CarouselItem.DEFAULT_HEIGHT * 1.6f;
private const float duration = 500;
[Resolved]
private IBindable<RulesetInfo> ruleset { get; set; } = null!;
@ -73,10 +71,6 @@ namespace osu.Game.Screens.SelectV2
[BackgroundDependencyLoader]
private void load()
{
Anchor = Anchor.TopRight;
Origin = Anchor.TopRight;
RelativeSizeAxes = Axes.X;
Width = 1f;
Height = HEIGHT;
Icon = difficultyIcon = new ConstrainedIconContainer
@ -224,10 +218,6 @@ namespace osu.Game.Screens.SelectV2
difficultyLine.Show();
computeStarRating();
FinishTransforms(true);
this.FadeInFromZero(duration, Easing.OutQuint);
}
protected override void FreeAfterUse()
@ -277,6 +267,8 @@ namespace osu.Game.Screens.SelectV2
private void updateDisplay()
{
const float duration = 500;
var starDifficulty = starDifficultyBindable?.Value ?? default;
AccentColour = colours.ForStarDifficulty(starDifficulty.Stars);

View File

@ -20,17 +20,12 @@ namespace osu.Game.Screens.SelectV2
{
public const float HEIGHT = CarouselItem.DEFAULT_HEIGHT;
private const float duration = 500;
private Drawable chevronIcon = null!;
private OsuSpriteText titleText = null!;
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
Anchor = Anchor.TopRight;
Origin = Anchor.TopRight;
RelativeSizeAxes = Axes.X;
Height = HEIGHT;
Icon = chevronIcon = new SpriteIcon
@ -93,6 +88,8 @@ namespace osu.Game.Screens.SelectV2
private void onExpanded()
{
const float duration = 500;
chevronIcon.ResizeWidthTo(Expanded.Value ? 12f : 0f, duration, Easing.OutQuint);
chevronIcon.FadeTo(Expanded.Value ? 1f : 0f, duration, Easing.OutQuint);
}
@ -106,9 +103,6 @@ namespace osu.Game.Screens.SelectV2
GroupDefinition group = (GroupDefinition)Item.Model;
titleText.Text = group.Title;
FinishTransforms(true);
this.FadeInFromZero(500, Easing.OutQuint);
}
}
}

View File

@ -21,10 +21,6 @@ namespace osu.Game.Screens.SelectV2
{
public partial class PanelGroupStarDifficulty : PanelBase
{
public const float HEIGHT = CarouselItem.DEFAULT_HEIGHT;
private const float duration = 500;
[Resolved]
private OsuColour colours { get; set; } = null!;
@ -39,10 +35,7 @@ namespace osu.Game.Screens.SelectV2
[BackgroundDependencyLoader]
private void load()
{
Anchor = Anchor.TopRight;
Origin = Anchor.TopRight;
RelativeSizeAxes = Axes.X;
Height = HEIGHT;
Height = PanelGroup.HEIGHT;
Icon = chevronIcon = new SpriteIcon
{
@ -117,12 +110,6 @@ namespace osu.Game.Screens.SelectV2
Expanded.BindValueChanged(_ => onExpanded(), true);
}
private void onExpanded()
{
chevronIcon.ResizeWidthTo(Expanded.Value ? 12f : 0f, duration, Easing.OutQuint);
chevronIcon.FadeTo(Expanded.Value ? 1f : 0f, duration, Easing.OutQuint);
}
protected override void PrepareForUse()
{
base.PrepareForUse();
@ -142,8 +129,14 @@ namespace osu.Game.Screens.SelectV2
chevronIcon.Colour = contentColour;
starCounter.Colour = contentColour;
}
this.FadeInFromZero(500, Easing.OutQuint);
private void onExpanded()
{
const float duration = 500;
chevronIcon.ResizeWidthTo(Expanded.Value ? 12f : 0f, duration, Easing.OutQuint);
chevronIcon.FadeTo(Expanded.Value ? 1f : 0f, duration, Easing.OutQuint);
}
}
}