mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 23:59:16 +08:00
Allow notification of new strings
This commit is contained in:
parent
bdc465e1c6
commit
e77489f2a9
29
osu.Game/Localisation/DailyChallengeStrings.cs
Normal file
29
osu.Game/Localisation/DailyChallengeStrings.cs
Normal file
@ -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}";
|
||||||
|
}
|
||||||
|
}
|
@ -417,16 +417,13 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
|
|||||||
{
|
{
|
||||||
if (change.OldValue?.RoomID == room.RoomID.Value && change.NewValue == null)
|
if (change.OldValue?.RoomID == room.RoomID.Value && change.NewValue == null)
|
||||||
{
|
{
|
||||||
notificationOverlay?.Post(new SimpleNotification
|
notificationOverlay?.Post(new SimpleNotification { Text = DailyChallengeStrings.ChallengeEndedNotification });
|
||||||
{
|
|
||||||
Text = "Today's daily challenge has concluded – thanks for playing!\n\nTomorrow's challenge is now being prepared and will appear soon."
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void forcefullyExit()
|
private void forcefullyExit()
|
||||||
{
|
{
|
||||||
Logger.Log($"{this} forcefully exiting due to loss of API connection");
|
Logger.Log(@$"{this} forcefully exiting due to loss of API connection");
|
||||||
|
|
||||||
// This is temporary since we don't currently have a way to force screens to be exited
|
// This is temporary since we don't currently have a way to force screens to be exited
|
||||||
// See also: `OnlinePlayScreen.forcefullyExit()`
|
// See also: `OnlinePlayScreen.forcefullyExit()`
|
||||||
|
@ -9,6 +9,7 @@ using osu.Game.Online.API.Requests.Responses;
|
|||||||
using osu.Game.Online.Rooms;
|
using osu.Game.Online.Rooms;
|
||||||
using osu.Game.Overlays.Notifications;
|
using osu.Game.Overlays.Notifications;
|
||||||
using osu.Game.Screens.Menu;
|
using osu.Game.Screens.Menu;
|
||||||
|
using osu.Game.Localisation;
|
||||||
|
|
||||||
namespace osu.Game.Screens.OnlinePlay.DailyChallenge
|
namespace osu.Game.Screens.OnlinePlay.DailyChallenge
|
||||||
{
|
{
|
||||||
@ -26,7 +27,7 @@ namespace osu.Game.Screens.OnlinePlay.DailyChallenge
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuGame? game)
|
private void load(OsuGame? game)
|
||||||
{
|
{
|
||||||
Text = "Today's daily challenge is now live! Click here to play.";
|
Text = DailyChallengeStrings.ChallengeLiveNotification;
|
||||||
Content.Add(card = new BeatmapCardNano((APIBeatmapSet)room.Playlist.Single().Beatmap.BeatmapSet!));
|
Content.Add(card = new BeatmapCardNano((APIBeatmapSet)room.Playlist.Single().Beatmap.BeatmapSet!));
|
||||||
Activated = () =>
|
Activated = () =>
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user