-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29188 from bdach/daily-challenge/better-messaging
Add notification on daily challenge conclusion & start of new one
- Loading branch information
Showing
7 changed files
with
192 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// 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 osu.Framework.Localisation; | ||
|
||
namespace osu.Game.Localisation | ||
{ | ||
public static class DailyChallengeStrings | ||
{ | ||
private const string prefix = @"osu.Game.Resources.Localisation.DailyChallenge"; | ||
|
||
/// <summary> | ||
/// "Today's daily challenge has concluded – thanks for playing! | ||
/// | ||
/// Tomorrow's challenge is now being prepared and will appear soon." | ||
/// </summary> | ||
public static LocalisableString ChallengeEndedNotification => new TranslatableString(getKey(@"todays_daily_challenge_has_concluded"), | ||
@"Today's daily challenge has concluded – thanks for playing! | ||
Tomorrow's challenge is now being prepared and will appear soon."); | ||
|
||
/// <summary> | ||
/// "Today's daily challenge is now live! Click here to play." | ||
/// </summary> | ||
public static LocalisableString ChallengeLiveNotification => new TranslatableString(getKey(@"todays_daily_challenge_is_now"), @"Today's daily challenge is now live! Click here to play."); | ||
|
||
private static string getKey(string key) => $@"{prefix}:{key}"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
osu.Game/Screens/OnlinePlay/DailyChallenge/NewDailyChallengeNotification.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// 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; | ||
using osu.Game.Online.API.Requests.Responses; | ||
using osu.Game.Online.Rooms; | ||
using osu.Game.Overlays.Notifications; | ||
using osu.Game.Screens.Menu; | ||
using osu.Game.Localisation; | ||
|
||
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] | ||
private void load(OsuGame? game) | ||
{ | ||
Text = DailyChallengeStrings.ChallengeLiveNotification; | ||
Content.Add(card = new BeatmapCardNano((APIBeatmapSet)room.Playlist.Single().Beatmap.BeatmapSet!)); | ||
Activated = () => | ||
{ | ||
game?.PerformFromScreen(s => s.Push(new DailyChallenge(room)), [typeof(MainMenu)]); | ||
return true; | ||
}; | ||
} | ||
|
||
protected override void Update() | ||
{ | ||
base.Update(); | ||
card.Width = Content.DrawWidth; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters