mirror of https://github.com/ppy/osu
Show restart notice when changing renderer
This commit is contained in:
parent
13be709718
commit
956fabb445
|
@ -19,6 +19,11 @@ public static class GraphicsSettingsStrings
|
|||
/// </summary>
|
||||
public static LocalisableString RendererHeader => new TranslatableString(getKey(@"renderer_header"), @"Renderer");
|
||||
|
||||
/// <summary>
|
||||
/// "Renderer"
|
||||
/// </summary>
|
||||
public static LocalisableString Renderer => new TranslatableString(getKey(@"renderer"), @"Renderer");
|
||||
|
||||
/// <summary>
|
||||
/// "Frame limiter"
|
||||
/// </summary>
|
||||
|
@ -144,6 +149,12 @@ public static class GraphicsSettingsStrings
|
|||
/// </summary>
|
||||
public static LocalisableString Png => new TranslatableString(getKey(@"png_lossless"), @"PNG (lossless)");
|
||||
|
||||
/// <summary>
|
||||
/// "In order to change the renderer, the game will close. Please open it again."
|
||||
/// </summary>
|
||||
public static LocalisableString ChangeRendererConfirmation =>
|
||||
new TranslatableString(getKey(@"change_renderer_configuration"), @"In order to change the renderer, the game will close. Please open it again.");
|
||||
|
||||
private static string getKey(string key) => $"{prefix}:{key}";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Localisation;
|
||||
using osu.Game.Overlays.Dialog;
|
||||
|
||||
namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
{
|
||||
|
@ -17,15 +17,16 @@ public partial class RendererSettings : SettingsSubsection
|
|||
protected override LocalisableString Header => GraphicsSettingsStrings.RendererHeader;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(FrameworkConfigManager config, OsuConfigManager osuConfig)
|
||||
private void load(FrameworkConfigManager config, OsuConfigManager osuConfig, IDialogOverlay dialogOverlay, OsuGame game, GameHost host)
|
||||
{
|
||||
// NOTE: Compatability mode omitted
|
||||
var renderer = config.GetBindable<RendererType>(FrameworkSetting.Renderer);
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SettingsEnumDropdown<RendererType>
|
||||
{
|
||||
LabelText = GraphicsSettingsStrings.Renderer,
|
||||
Current = config.GetBindable<RendererType>(FrameworkSetting.Renderer),
|
||||
Current = renderer,
|
||||
Keywords = new[] { @"compatibility", @"directx" },
|
||||
},
|
||||
// TODO: this needs to be a custom dropdown at some point
|
||||
|
@ -46,6 +47,17 @@ private void load(FrameworkConfigManager config, OsuConfigManager osuConfig)
|
|||
Current = osuConfig.GetBindable<bool>(OsuSetting.ShowFpsDisplay)
|
||||
},
|
||||
};
|
||||
|
||||
renderer.BindValueChanged(r =>
|
||||
{
|
||||
if (r.NewValue == host.ResolvedRenderer)
|
||||
return;
|
||||
|
||||
dialogOverlay.Push(new ConfirmDialog(GraphicsSettingsStrings.ChangeRendererConfirmation, game.AttemptExit, () =>
|
||||
{
|
||||
renderer.SetDefault();
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue