1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 03:07:26 +08:00

Add more difficulty information and further tweaks to visuals

This commit is contained in:
Dean Herbert 2024-08-07 18:51:44 +09:00
parent 083fe32d20
commit e52d80a41b
No known key found for this signature in database

View File

@ -4,6 +4,7 @@
using System; using System;
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
@ -12,7 +13,6 @@ using osu.Framework.Screens;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Drawables; using osu.Game.Beatmaps.Drawables;
using osu.Game.Extensions;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Online.Rooms; using osu.Game.Online.Rooms;
@ -40,6 +40,14 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
private bool beatmapBackgroundLoaded; private bool beatmapBackgroundLoaded;
private bool animationBegan;
private bool trackContent;
private IBindable<StarDifficulty?> starDifficulty = null!;
private const float initial_v_shift = 32;
private const float final_v_shift = 340;
[Cached] [Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Plum); private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Plum);
@ -54,10 +62,14 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
protected override BackgroundScreen CreateBackground() => new DailyChallengeIntroBackgroundScreen(colourProvider); protected override BackgroundScreen CreateBackground() => new DailyChallengeIntroBackgroundScreen(colourProvider);
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load(BeatmapDifficultyCache difficultyCache)
{ {
const float horizontal_info_size = 500f;
Ruleset ruleset = Ruleset.Value.CreateInstance(); Ruleset ruleset = Ruleset.Value.CreateInstance();
StarRatingDisplay starRatingDisplay;
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
introContent = new Container introContent = new Container
@ -85,7 +97,7 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
{ {
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Size = new Vector2(500f, 150f), Size = new Vector2(horizontal_info_size, 150f),
CornerRadius = 20f, CornerRadius = 20f,
BorderColour = colourProvider.Content2, BorderColour = colourProvider.Content2,
BorderThickness = 3f, BorderThickness = 3f,
@ -110,7 +122,7 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
{ {
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Width = 500f, Width = horizontal_info_size,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
CornerRadius = 10f, CornerRadius = 10f,
Masking = true, Masking = true,
@ -121,18 +133,70 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
Colour = colourProvider.Background3, Colour = colourProvider.Background3,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },
new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Direction = FillDirection.Vertical,
Padding = new MarginPadding(5f),
Children = new Drawable[]
{
new TruncatingSpriteText new TruncatingSpriteText
{ {
Anchor = Anchor.Centre, Anchor = Anchor.TopCentre,
Origin = Anchor.Centre, Origin = Anchor.TopCentre,
RelativeSizeAxes = Axes.X,
Shear = new Vector2(-OsuGame.SHEAR, 0f), Shear = new Vector2(-OsuGame.SHEAR, 0f),
Text = item.Beatmap.GetDisplayString(), MaxWidth = horizontal_info_size,
Padding = new MarginPadding { Vertical = 5f, Horizontal = 5f }, Text = item.Beatmap.BeatmapSet!.Metadata.GetDisplayTitleRomanisable(false),
Font = OsuFont.GetFont(size: 24), Padding = new MarginPadding { Horizontal = 5f },
Font = OsuFont.GetFont(size: 26),
},
new TruncatingSpriteText
{
Text = $"Difficulty: {item.Beatmap.DifficultyName}",
Font = OsuFont.GetFont(size: 20, italics: true),
MaxWidth = horizontal_info_size,
Shear = new Vector2(-OsuGame.SHEAR, 0f),
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
},
new TruncatingSpriteText
{
Text = $"by {item.Beatmap.Metadata.Author.Username}",
Font = OsuFont.GetFont(size: 16, italics: true),
MaxWidth = horizontal_info_size,
Shear = new Vector2(-OsuGame.SHEAR, 0f),
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
},
starRatingDisplay = new StarRatingDisplay(default)
{
Shear = new Vector2(-OsuGame.SHEAR, 0f),
Margin = new MarginPadding(5),
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
}
}
}, },
} }
}, },
new Container
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Width = horizontal_info_size,
AutoSizeAxes = Axes.Y,
CornerRadius = 10f,
Masking = true,
Children = new Drawable[]
{
new Box
{
Colour = colourProvider.Background3,
RelativeSizeAxes = Axes.Both,
},
new ModFlowDisplay new ModFlowDisplay
{ {
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
@ -145,6 +209,8 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
}, },
} }
} }
}
}
}, },
topTitleDisplay = new Container topTitleDisplay = new Container
{ {
@ -200,6 +266,13 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
} }
}; };
starDifficulty = difficultyCache.GetBindableDifficulty(item.Beatmap);
starDifficulty.BindValueChanged(star =>
{
if (star.NewValue != null)
starRatingDisplay.Current.Value = star.NewValue.Value;
}, true);
LoadComponentAsync(new OnlineBeatmapSetCover(item.Beatmap.BeatmapSet as IBeatmapSetOnlineInfo) LoadComponentAsync(new OnlineBeatmapSetCover(item.Beatmap.BeatmapSet as IBeatmapSetOnlineInfo)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
@ -217,12 +290,6 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
}); });
} }
private bool animationBegan;
private bool trackContent;
private const float initial_v_shift = 32;
private const float final_v_shift = 340;
protected override void Update() protected override void Update()
{ {
base.Update(); base.Update();
@ -248,7 +315,7 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
public override void OnSuspending(ScreenTransitionEvent e) public override void OnSuspending(ScreenTransitionEvent e)
{ {
this.FadeOut(200, Easing.OutQuint); this.FadeOut(800, Easing.OutQuint);
base.OnSuspending(e); base.OnSuspending(e);
} }
@ -290,21 +357,21 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
beatmapContent beatmapContent
.ScaleTo(1f, 500, Easing.InQuint) .ScaleTo(1f, 500, Easing.InQuint)
.Then() .Then()
.ScaleTo(1.1f, 3000); .ScaleTo(1.02f, 3000);
using (BeginDelayedSequence(240)) using (BeginDelayedSequence(240))
{ {
beatmapContent.FadeInFromZero(280, Easing.InQuad); beatmapContent.FadeInFromZero(280, Easing.InQuad);
flash using (BeginDelayedSequence(300))
.Delay(400) Schedule(() => ApplyToBackground(bs => ((RoomBackgroundScreen)bs).SelectedItem.Value = item));
.FadeOutFromOne(5000, Easing.OutQuint);
ApplyToBackground(bs => ((RoomBackgroundScreen)bs).SelectedItem.Value = item); using (BeginDelayedSequence(400))
flash.FadeOutFromOne(5000, Easing.OutQuint);
using (BeginDelayedSequence(2600)) using (BeginDelayedSequence(2600))
{ {
introContent.FadeOut(200, Easing.OutQuint).OnComplete(_ => Schedule(() =>
{ {
if (this.IsCurrentScreen()) if (this.IsCurrentScreen())
this.Push(new DailyChallenge(room)); this.Push(new DailyChallenge(room));