1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-14 16:37: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,28 +133,82 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
Colour = colourProvider.Background3, Colour = colourProvider.Background3,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },
new TruncatingSpriteText new FillFlowContainer
{ {
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Shear = new Vector2(-OsuGame.SHEAR, 0f), AutoSizeAxes = Axes.Y,
Text = item.Beatmap.GetDisplayString(), Anchor = Anchor.TopCentre,
Padding = new MarginPadding { Vertical = 5f, Horizontal = 5f }, Origin = Anchor.TopCentre,
Font = OsuFont.GetFont(size: 24), Direction = FillDirection.Vertical,
Padding = new MarginPadding(5f),
Children = new Drawable[]
{
new TruncatingSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Shear = new Vector2(-OsuGame.SHEAR, 0f),
MaxWidth = horizontal_info_size,
Text = item.Beatmap.BeatmapSet!.Metadata.GetDisplayTitleRomanisable(false),
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 ModFlowDisplay new Container
{ {
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
AutoSizeAxes = Axes.Both, Width = horizontal_info_size,
Shear = new Vector2(-OsuGame.SHEAR, 0f), AutoSizeAxes = Axes.Y,
Current = CornerRadius = 10f,
Masking = true,
Children = new Drawable[]
{ {
Value = item.RequiredMods.Select(m => m.ToMod(ruleset)).ToArray() new Box
}, {
Colour = colourProvider.Background3,
RelativeSizeAxes = Axes.Both,
},
new ModFlowDisplay
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
AutoSizeAxes = Axes.Both,
Shear = new Vector2(-OsuGame.SHEAR, 0f),
Current =
{
Value = item.RequiredMods.Select(m => m.ToMod(ruleset)).ToArray()
},
}
}
} }
} }
}, },
@ -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));