2024-07-29 20:20:47 +08:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
using System.Linq;
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Screens;
|
|
|
|
using osu.Game.Beatmaps.Drawables.Cards;
|
2024-09-08 03:46:42 +08:00
|
|
|
using osu.Game.Configuration;
|
2024-07-29 20:20:47 +08:00
|
|
|
using osu.Game.Online.API.Requests.Responses;
|
|
|
|
using osu.Game.Online.Rooms;
|
|
|
|
using osu.Game.Overlays.Notifications;
|
|
|
|
using osu.Game.Screens.Menu;
|
2024-07-31 02:10:36 +08:00
|
|
|
using osu.Game.Localisation;
|
2024-07-29 20:20:47 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Screens.OnlinePlay.DailyChallenge
|
|
|
|
{
|
|
|
|
public partial class NewDailyChallengeNotification : SimpleNotification
|
|
|
|
{
|
|
|
|
private readonly Room room;
|
|
|
|
|
|
|
|
private BeatmapCardNano card = null!;
|
|
|
|
|
|
|
|
public NewDailyChallengeNotification(Room room)
|
|
|
|
{
|
|
|
|
this.room = room;
|
|
|
|
}
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
2024-09-08 03:46:42 +08:00
|
|
|
private void load(OsuGame? game, SessionStatics statics)
|
2024-07-29 20:20:47 +08:00
|
|
|
{
|
2024-07-31 02:10:36 +08:00
|
|
|
Text = DailyChallengeStrings.ChallengeLiveNotification;
|
2024-07-29 20:20:47 +08:00
|
|
|
Content.Add(card = new BeatmapCardNano((APIBeatmapSet)room.Playlist.Single().Beatmap.BeatmapSet!));
|
|
|
|
Activated = () =>
|
|
|
|
{
|
2024-09-08 04:01:38 +08:00
|
|
|
if (statics.Get<bool>(Static.DailyChallengeIntroPlayed))
|
2024-09-08 03:46:42 +08:00
|
|
|
game?.PerformFromScreen(s => s.Push(new DailyChallenge(room)), [typeof(MainMenu)]);
|
|
|
|
else
|
|
|
|
game?.PerformFromScreen(s => s.Push(new DailyChallengeIntro(room)), [typeof(MainMenu)]);
|
2024-09-08 03:48:14 +08:00
|
|
|
|
2024-07-29 20:20:47 +08:00
|
|
|
return true;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void Update()
|
|
|
|
{
|
|
|
|
base.Update();
|
|
|
|
card.Width = Content.DrawWidth;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|