mirror of
https://github.com/ppy/osu.git
synced 2025-03-05 11:43:01 +08:00
Only show daily challenge notification if it started within the last 30 minutes
This commit is contained in:
parent
45c1dfde5e
commit
52b2d73e04
@ -104,8 +104,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
info.BindValueChanged(_ => dailyChallengeChanged(postNotification: true));
|
info.BindValueChanged(dailyChallengeChanged, true);
|
||||||
dailyChallengeChanged(postNotification: false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
@ -131,28 +130,29 @@ namespace osu.Game.Screens.Menu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dailyChallengeChanged(bool postNotification)
|
private void dailyChallengeChanged(ValueChangedEvent<DailyChallengeInfo?> info)
|
||||||
{
|
{
|
||||||
UpdateState();
|
UpdateState();
|
||||||
|
|
||||||
scheduledCountdownUpdate?.Cancel();
|
scheduledCountdownUpdate?.Cancel();
|
||||||
scheduledCountdownUpdate = null;
|
scheduledCountdownUpdate = null;
|
||||||
|
|
||||||
if (info.Value == null)
|
if (this.info.Value == null)
|
||||||
{
|
{
|
||||||
Room = null;
|
Room = null;
|
||||||
cover.OnlineInfo = TooltipContent = null;
|
cover.OnlineInfo = TooltipContent = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var roomRequest = new GetRoomRequest(info.Value.Value.RoomID);
|
var roomRequest = new GetRoomRequest(this.info.Value.Value.RoomID);
|
||||||
|
|
||||||
roomRequest.Success += room =>
|
roomRequest.Success += room =>
|
||||||
{
|
{
|
||||||
Room = room;
|
Room = room;
|
||||||
cover.OnlineInfo = TooltipContent = room.Playlist.FirstOrDefault()?.Beatmap.BeatmapSet as APIBeatmapSet;
|
cover.OnlineInfo = TooltipContent = room.Playlist.FirstOrDefault()?.Beatmap.BeatmapSet as APIBeatmapSet;
|
||||||
|
|
||||||
if (postNotification)
|
// We only want to notify the user if a new challenge recently went live.
|
||||||
|
if (Math.Abs((DateTimeOffset.Now - room.StartDate.Value!.Value).TotalSeconds) < 600)
|
||||||
notificationOverlay?.Post(new NewDailyChallengeNotification(room));
|
notificationOverlay?.Post(new NewDailyChallengeNotification(room));
|
||||||
|
|
||||||
updateCountdown();
|
updateCountdown();
|
||||||
|
Loading…
Reference in New Issue
Block a user