1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-17 06:42:54 +08:00

Add DailyChallengeIntroPlayed session static

This commit is contained in:
Salman Ahmed 2024-08-21 03:35:26 +09:00
parent f4b8fc6165
commit 637c9aeef0
4 changed files with 22 additions and 1 deletions

View File

@ -80,5 +80,11 @@ namespace osu.Game.Configuration
/// Stores the local user's last score (can be completed or aborted).
/// </summary>
LastLocalUserScore,
/// <summary>
/// Whether the intro animation for the daily challenge screen has been played once.
/// This is reset when a new challenge is up.
/// </summary>
DailyChallengeIntroPlayed,
}
}

View File

@ -13,6 +13,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Framework.Threading;
using osu.Framework.Utils;
using osu.Game.Beatmaps.Drawables;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Localisation;
@ -46,6 +47,9 @@ namespace osu.Game.Screens.Menu
[Resolved]
private INotificationOverlay? notificationOverlay { get; set; }
[Resolved]
private SessionStatics statics { get; set; } = null!;
public DailyChallengeButton(string sampleName, Color4 colour, Action<MainMenuButton>? clickAction = null, params Key[] triggerKeys)
: base(ButtonSystemStrings.DailyChallenge, sampleName, OsuIcon.DailyChallenge, colour, clickAction, triggerKeys)
{
@ -148,6 +152,9 @@ namespace osu.Game.Screens.Menu
roomRequest.Success += room =>
{
// force showing intro on the first time when a new daily challenge is up.
statics.SetValue(Static.DailyChallengeIntroPlayed, false);
Room = room;
cover.OnlineInfo = TooltipContent = room.Playlist.FirstOrDefault()?.Beatmap.BeatmapSet as APIBeatmapSet;

View File

@ -150,7 +150,10 @@ namespace osu.Game.Screens.Menu
OnPlaylists = () => this.Push(new Playlists()),
OnDailyChallenge = room =>
{
this.Push(new DailyChallengeIntro(room));
if (statics.Get<bool>(Static.DailyChallengeIntroPlayed))
this.Push(new DailyChallenge(room));
else
this.Push(new DailyChallengeIntro(room));
},
OnExit = () =>
{

View File

@ -70,6 +70,9 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
[Resolved]
private MusicController musicController { get; set; } = null!;
[Resolved]
private SessionStatics statics { get; set; } = null!;
private Sample? dateWindupSample;
private Sample? dateImpactSample;
private Sample? beatmapWindupSample;
@ -461,6 +464,8 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
{
Schedule(() =>
{
statics.SetValue(Static.DailyChallengeIntroPlayed, true);
if (this.IsCurrentScreen())
this.Push(new DailyChallenge(room));
});