mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 07:42:57 +08:00
Merge branch 'master' into acc-challenge
This commit is contained in:
commit
fd919879c3
49
osu.Game/Localisation/GameplayMenuOverlayStrings.cs
Normal file
49
osu.Game/Localisation/GameplayMenuOverlayStrings.cs
Normal file
@ -0,0 +1,49 @@
|
||||
// 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 GameplayMenuOverlayStrings
|
||||
{
|
||||
private const string prefix = @"osu.Game.Resources.Localisation.GameplayMenuOverlay";
|
||||
|
||||
/// <summary>
|
||||
/// "Continue"
|
||||
/// </summary>
|
||||
public static LocalisableString Continue => new TranslatableString(getKey(@"continue"), @"Continue");
|
||||
|
||||
/// <summary>
|
||||
/// "Retry"
|
||||
/// </summary>
|
||||
public static LocalisableString Retry => new TranslatableString(getKey(@"retry"), @"Retry");
|
||||
|
||||
/// <summary>
|
||||
/// "Quit"
|
||||
/// </summary>
|
||||
public static LocalisableString Quit => new TranslatableString(getKey(@"quit"), @"Quit");
|
||||
|
||||
/// <summary>
|
||||
/// "failed"
|
||||
/// </summary>
|
||||
public static LocalisableString FailedHeader => new TranslatableString(getKey(@"failed_header"), @"failed");
|
||||
|
||||
/// <summary>
|
||||
/// "paused"
|
||||
/// </summary>
|
||||
public static LocalisableString PausedHeader => new TranslatableString(getKey(@"paused_header"), @"paused");
|
||||
|
||||
/// <summary>
|
||||
/// "Retry count: "
|
||||
/// </summary>
|
||||
public static LocalisableString RetryCount => new TranslatableString(getKey(@"retry_count"), @"Retry count: ");
|
||||
|
||||
/// <summary>
|
||||
/// "Song progress: "
|
||||
/// </summary>
|
||||
public static LocalisableString SongProgress => new TranslatableString(getKey(@"song_progress"), @"Song progress: ");
|
||||
|
||||
private static string getKey(string key) => $@"{prefix}:{key}";
|
||||
}
|
||||
}
|
@ -15,6 +15,8 @@ using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Localisation;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
{
|
||||
@ -22,13 +24,13 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
public Func<Task<ScoreInfo>> SaveReplay;
|
||||
|
||||
public override string Header => "failed";
|
||||
public override LocalisableString Header => GameplayMenuOverlayStrings.FailedHeader;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
AddButton("Retry", colours.YellowDark, () => OnRetry?.Invoke());
|
||||
AddButton("Quit", new Color4(170, 27, 39, 255), () => OnQuit?.Invoke());
|
||||
AddButton(GameplayMenuOverlayStrings.Retry, colours.YellowDark, () => OnRetry?.Invoke());
|
||||
AddButton(GameplayMenuOverlayStrings.Quit, new Color4(170, 27, 39, 255), () => OnQuit?.Invoke());
|
||||
// from #10339 maybe this is a better visual effect
|
||||
Add(new Container
|
||||
{
|
||||
|
@ -12,6 +12,7 @@ using osu.Framework.Graphics.Effects;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
@ -20,6 +21,7 @@ using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
using osu.Game.Localisation;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
{
|
||||
@ -49,7 +51,7 @@ namespace osu.Game.Screens.Play
|
||||
/// </summary>
|
||||
protected virtual Action SelectAction => () => InternalButtons.Selected?.TriggerClick();
|
||||
|
||||
public abstract string Header { get; }
|
||||
public abstract LocalisableString Header { get; }
|
||||
|
||||
protected SelectionCycleFillFlowContainer<DialogButton> InternalButtons = null!;
|
||||
public IReadOnlyList<DialogButton> Buttons => InternalButtons;
|
||||
@ -153,7 +155,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
protected override bool OnMouseMove(MouseMoveEvent e) => true;
|
||||
|
||||
protected void AddButton(string text, Color4 colour, Action? action)
|
||||
protected void AddButton(LocalisableString text, Color4 colour, Action? action)
|
||||
{
|
||||
var button = new Button
|
||||
{
|
||||
@ -209,13 +211,13 @@ namespace osu.Game.Screens.Play
|
||||
private void updateInfoText()
|
||||
{
|
||||
playInfoText.Clear();
|
||||
playInfoText.AddText("Retry count: ");
|
||||
playInfoText.AddText(GameplayMenuOverlayStrings.RetryCount);
|
||||
playInfoText.AddText(retries.ToString(), cp => cp.Font = cp.Font.With(weight: FontWeight.Bold));
|
||||
|
||||
if (getSongProgress() is int progress)
|
||||
{
|
||||
playInfoText.NewLine();
|
||||
playInfoText.AddText("Song progress: ");
|
||||
playInfoText.AddText(GameplayMenuOverlayStrings.SongProgress);
|
||||
playInfoText.AddText($"{progress}%", cp => cp.Font = cp.Font.With(weight: FontWeight.Bold));
|
||||
}
|
||||
}
|
||||
|
@ -9,9 +9,11 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Localisation;
|
||||
using osu.Game.Skinning;
|
||||
using osuTK.Graphics;
|
||||
|
||||
@ -23,7 +25,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
public override bool IsPresent => base.IsPresent || pauseLoop.IsPlaying;
|
||||
|
||||
public override string Header => "paused";
|
||||
public override LocalisableString Header => GameplayMenuOverlayStrings.PausedHeader;
|
||||
|
||||
private SkinnableSound pauseLoop;
|
||||
|
||||
@ -32,9 +34,9 @@ namespace osu.Game.Screens.Play
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
AddButton("Continue", colours.Green, () => OnResume?.Invoke());
|
||||
AddButton("Retry", colours.YellowDark, () => OnRetry?.Invoke());
|
||||
AddButton("Quit", new Color4(170, 27, 39, 255), () => OnQuit?.Invoke());
|
||||
AddButton(GameplayMenuOverlayStrings.Continue, colours.Green, () => OnResume?.Invoke());
|
||||
AddButton(GameplayMenuOverlayStrings.Retry, colours.YellowDark, () => OnRetry?.Invoke());
|
||||
AddButton(GameplayMenuOverlayStrings.Quit, new Color4(170, 27, 39, 255), () => OnQuit?.Invoke());
|
||||
|
||||
AddInternal(pauseLoop = new SkinnableSound(new SampleInfo("Gameplay/pause-loop"))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user