mirror of
https://github.com/ppy/osu.git
synced 2025-02-23 03:43:00 +08:00
Tidy up remaining common code
This commit is contained in:
parent
644fb29843
commit
7e1984452f
@ -64,7 +64,11 @@ namespace osu.Game.Screens.SelectV2
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OverlayColourProvider colourProvider, OsuColour colours)
|
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
|
InternalChild = TopLevelContent = new Container
|
||||||
{
|
{
|
||||||
@ -161,6 +165,12 @@ namespace osu.Game.Screens.SelectV2
|
|||||||
KeyboardSelected.BindValueChanged(_ => updateDisplay(), true);
|
KeyboardSelected.BindValueChanged(_ => updateDisplay(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void PrepareForUse()
|
||||||
|
{
|
||||||
|
base.PrepareForUse();
|
||||||
|
this.FadeInFromZero(duration, Easing.OutQuint);
|
||||||
|
}
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private BeatmapCarousel? carousel { get; set; }
|
private BeatmapCarousel? carousel { get; set; }
|
||||||
|
|
||||||
|
@ -26,12 +26,6 @@ namespace osu.Game.Screens.SelectV2
|
|||||||
{
|
{
|
||||||
public const float HEIGHT = CarouselItem.DEFAULT_HEIGHT;
|
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 StarCounter starCounter = null!;
|
||||||
private ConstrainedIconContainer difficultyIcon = null!;
|
private ConstrainedIconContainer difficultyIcon = null!;
|
||||||
private OsuSpriteText keyCountText = null!;
|
private OsuSpriteText keyCountText = null!;
|
||||||
@ -74,11 +68,6 @@ namespace osu.Game.Screens.SelectV2
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OverlayColourProvider colourProvider)
|
private void load(OverlayColourProvider colourProvider)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopRight;
|
|
||||||
Origin = Anchor.TopRight;
|
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.X;
|
|
||||||
Width = 1f;
|
|
||||||
Height = HEIGHT;
|
Height = HEIGHT;
|
||||||
|
|
||||||
Icon = difficultyIcon = new ConstrainedIconContainer
|
Icon = difficultyIcon = new ConstrainedIconContainer
|
||||||
@ -194,9 +183,6 @@ namespace osu.Game.Screens.SelectV2
|
|||||||
|
|
||||||
computeStarRating();
|
computeStarRating();
|
||||||
updateKeyCount();
|
updateKeyCount();
|
||||||
|
|
||||||
FinishTransforms(true);
|
|
||||||
this.FadeInFromZero(duration, Easing.OutQuint);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void FreeAfterUse()
|
protected override void FreeAfterUse()
|
||||||
@ -244,6 +230,8 @@ namespace osu.Game.Screens.SelectV2
|
|||||||
|
|
||||||
private void updateDisplay()
|
private void updateDisplay()
|
||||||
{
|
{
|
||||||
|
const float duration = 500;
|
||||||
|
|
||||||
var starDifficulty = starDifficultyBindable?.Value ?? default;
|
var starDifficulty = starDifficultyBindable?.Value ?? default;
|
||||||
|
|
||||||
starRatingDisplay.Current.Value = starDifficulty;
|
starRatingDisplay.Current.Value = starDifficulty;
|
||||||
|
@ -21,8 +21,6 @@ namespace osu.Game.Screens.SelectV2
|
|||||||
{
|
{
|
||||||
public const float HEIGHT = CarouselItem.DEFAULT_HEIGHT * 1.6f;
|
public const float HEIGHT = CarouselItem.DEFAULT_HEIGHT * 1.6f;
|
||||||
|
|
||||||
private const float duration = 500;
|
|
||||||
|
|
||||||
private BeatmapSetPanelBackground background = null!;
|
private BeatmapSetPanelBackground background = null!;
|
||||||
|
|
||||||
private OsuSpriteText titleText = null!;
|
private OsuSpriteText titleText = null!;
|
||||||
@ -46,9 +44,6 @@ namespace osu.Game.Screens.SelectV2
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopRight;
|
|
||||||
Origin = Anchor.TopRight;
|
|
||||||
RelativeSizeAxes = Axes.X;
|
|
||||||
Height = HEIGHT;
|
Height = HEIGHT;
|
||||||
|
|
||||||
Icon = chevronIcon = new Container
|
Icon = chevronIcon = new Container
|
||||||
@ -133,6 +128,8 @@ namespace osu.Game.Screens.SelectV2
|
|||||||
|
|
||||||
private void onExpanded()
|
private void onExpanded()
|
||||||
{
|
{
|
||||||
|
const float duration = 500;
|
||||||
|
|
||||||
chevronIcon.ResizeWidthTo(Expanded.Value ? 22 : 0f, duration, Easing.OutQuint);
|
chevronIcon.ResizeWidthTo(Expanded.Value ? 22 : 0f, duration, Easing.OutQuint);
|
||||||
chevronIcon.FadeTo(Expanded.Value ? 1f : 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;
|
updateButton.BeatmapSet = beatmapSet;
|
||||||
statusPill.Status = beatmapSet.Status;
|
statusPill.Status = beatmapSet.Status;
|
||||||
difficultiesDisplay.BeatmapSet = beatmapSet;
|
difficultiesDisplay.BeatmapSet = beatmapSet;
|
||||||
|
|
||||||
FinishTransforms(true);
|
|
||||||
this.FadeInFromZero(duration, Easing.OutQuint);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void FreeAfterUse()
|
protected override void FreeAfterUse()
|
||||||
|
@ -27,8 +27,6 @@ namespace osu.Game.Screens.SelectV2
|
|||||||
{
|
{
|
||||||
public const float HEIGHT = CarouselItem.DEFAULT_HEIGHT * 1.6f;
|
public const float HEIGHT = CarouselItem.DEFAULT_HEIGHT * 1.6f;
|
||||||
|
|
||||||
private const float duration = 500;
|
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IBindable<RulesetInfo> ruleset { get; set; } = null!;
|
private IBindable<RulesetInfo> ruleset { get; set; } = null!;
|
||||||
|
|
||||||
@ -73,10 +71,6 @@ namespace osu.Game.Screens.SelectV2
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopRight;
|
|
||||||
Origin = Anchor.TopRight;
|
|
||||||
RelativeSizeAxes = Axes.X;
|
|
||||||
Width = 1f;
|
|
||||||
Height = HEIGHT;
|
Height = HEIGHT;
|
||||||
|
|
||||||
Icon = difficultyIcon = new ConstrainedIconContainer
|
Icon = difficultyIcon = new ConstrainedIconContainer
|
||||||
@ -224,10 +218,6 @@ namespace osu.Game.Screens.SelectV2
|
|||||||
difficultyLine.Show();
|
difficultyLine.Show();
|
||||||
|
|
||||||
computeStarRating();
|
computeStarRating();
|
||||||
|
|
||||||
FinishTransforms(true);
|
|
||||||
|
|
||||||
this.FadeInFromZero(duration, Easing.OutQuint);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void FreeAfterUse()
|
protected override void FreeAfterUse()
|
||||||
@ -277,6 +267,8 @@ namespace osu.Game.Screens.SelectV2
|
|||||||
|
|
||||||
private void updateDisplay()
|
private void updateDisplay()
|
||||||
{
|
{
|
||||||
|
const float duration = 500;
|
||||||
|
|
||||||
var starDifficulty = starDifficultyBindable?.Value ?? default;
|
var starDifficulty = starDifficultyBindable?.Value ?? default;
|
||||||
|
|
||||||
AccentColour = colours.ForStarDifficulty(starDifficulty.Stars);
|
AccentColour = colours.ForStarDifficulty(starDifficulty.Stars);
|
||||||
|
@ -20,17 +20,12 @@ namespace osu.Game.Screens.SelectV2
|
|||||||
{
|
{
|
||||||
public const float HEIGHT = CarouselItem.DEFAULT_HEIGHT;
|
public const float HEIGHT = CarouselItem.DEFAULT_HEIGHT;
|
||||||
|
|
||||||
private const float duration = 500;
|
|
||||||
|
|
||||||
private Drawable chevronIcon = null!;
|
private Drawable chevronIcon = null!;
|
||||||
private OsuSpriteText titleText = null!;
|
private OsuSpriteText titleText = null!;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OverlayColourProvider colourProvider)
|
private void load(OverlayColourProvider colourProvider)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopRight;
|
|
||||||
Origin = Anchor.TopRight;
|
|
||||||
RelativeSizeAxes = Axes.X;
|
|
||||||
Height = HEIGHT;
|
Height = HEIGHT;
|
||||||
|
|
||||||
Icon = chevronIcon = new SpriteIcon
|
Icon = chevronIcon = new SpriteIcon
|
||||||
@ -93,6 +88,8 @@ namespace osu.Game.Screens.SelectV2
|
|||||||
|
|
||||||
private void onExpanded()
|
private void onExpanded()
|
||||||
{
|
{
|
||||||
|
const float duration = 500;
|
||||||
|
|
||||||
chevronIcon.ResizeWidthTo(Expanded.Value ? 12f : 0f, duration, Easing.OutQuint);
|
chevronIcon.ResizeWidthTo(Expanded.Value ? 12f : 0f, duration, Easing.OutQuint);
|
||||||
chevronIcon.FadeTo(Expanded.Value ? 1f : 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;
|
GroupDefinition group = (GroupDefinition)Item.Model;
|
||||||
|
|
||||||
titleText.Text = group.Title;
|
titleText.Text = group.Title;
|
||||||
|
|
||||||
FinishTransforms(true);
|
|
||||||
this.FadeInFromZero(500, Easing.OutQuint);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,10 +21,6 @@ namespace osu.Game.Screens.SelectV2
|
|||||||
{
|
{
|
||||||
public partial class PanelGroupStarDifficulty : PanelBase
|
public partial class PanelGroupStarDifficulty : PanelBase
|
||||||
{
|
{
|
||||||
public const float HEIGHT = CarouselItem.DEFAULT_HEIGHT;
|
|
||||||
|
|
||||||
private const float duration = 500;
|
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private OsuColour colours { get; set; } = null!;
|
private OsuColour colours { get; set; } = null!;
|
||||||
|
|
||||||
@ -39,10 +35,7 @@ namespace osu.Game.Screens.SelectV2
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopRight;
|
Height = PanelGroup.HEIGHT;
|
||||||
Origin = Anchor.TopRight;
|
|
||||||
RelativeSizeAxes = Axes.X;
|
|
||||||
Height = HEIGHT;
|
|
||||||
|
|
||||||
Icon = chevronIcon = new SpriteIcon
|
Icon = chevronIcon = new SpriteIcon
|
||||||
{
|
{
|
||||||
@ -117,12 +110,6 @@ namespace osu.Game.Screens.SelectV2
|
|||||||
Expanded.BindValueChanged(_ => onExpanded(), true);
|
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()
|
protected override void PrepareForUse()
|
||||||
{
|
{
|
||||||
base.PrepareForUse();
|
base.PrepareForUse();
|
||||||
@ -142,8 +129,14 @@ namespace osu.Game.Screens.SelectV2
|
|||||||
|
|
||||||
chevronIcon.Colour = contentColour;
|
chevronIcon.Colour = contentColour;
|
||||||
starCounter.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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user