mirror of
https://github.com/ppy/osu.git
synced 2024-12-05 02:53:21 +08:00
Compare commits
6 Commits
0821356f79
...
89f4e4d64e
Author | SHA1 | Date | |
---|---|---|---|
|
89f4e4d64e | ||
|
f09d8f097a | ||
|
457957d3b8 | ||
|
2ceb3f6f85 | ||
|
53dce83b56 | ||
|
9140893249 |
@ -21,7 +21,7 @@ namespace osu.Game.Tests.Visual.Mods
|
|||||||
protected override TestPlayer CreateModPlayer(Ruleset ruleset)
|
protected override TestPlayer CreateModPlayer(Ruleset ruleset)
|
||||||
{
|
{
|
||||||
var player = base.CreateModPlayer(ruleset);
|
var player = base.CreateModPlayer(ruleset);
|
||||||
player.RestartRequested = _ => restartRequested = true;
|
player.PrepareLoaderForRestart = _ => restartRequested = true;
|
||||||
return player;
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +44,11 @@ namespace osu.Game.Localisation
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static LocalisableString CheckUpdate => new TranslatableString(getKey(@"check_update"), @"Check for updates");
|
public static LocalisableString CheckUpdate => new TranslatableString(getKey(@"check_update"), @"Check for updates");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Checking for updates"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString CheckingForUpdates => new TranslatableString(getKey(@"checking_for_updates"), @"Checking for updates");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// "Open osu! folder"
|
/// "Open osu! folder"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Extensions;
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
@ -13,6 +12,7 @@ using osu.Framework.Screens;
|
|||||||
using osu.Framework.Statistics;
|
using osu.Framework.Statistics;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Localisation;
|
using osu.Game.Localisation;
|
||||||
|
using osu.Game.Online.Multiplayer;
|
||||||
using osu.Game.Overlays.Notifications;
|
using osu.Game.Overlays.Notifications;
|
||||||
using osu.Game.Overlays.Settings.Sections.Maintenance;
|
using osu.Game.Overlays.Settings.Sections.Maintenance;
|
||||||
using osu.Game.Updater;
|
using osu.Game.Updater;
|
||||||
@ -36,8 +36,11 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private Storage storage { get; set; } = null!;
|
private Storage storage { get; set; } = null!;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private OsuGame? game { get; set; }
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuConfigManager config, OsuGame? game)
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
Add(new SettingsEnumDropdown<ReleaseStream>
|
Add(new SettingsEnumDropdown<ReleaseStream>
|
||||||
{
|
{
|
||||||
@ -50,23 +53,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
|||||||
Add(checkForUpdatesButton = new SettingsButton
|
Add(checkForUpdatesButton = new SettingsButton
|
||||||
{
|
{
|
||||||
Text = GeneralSettingsStrings.CheckUpdate,
|
Text = GeneralSettingsStrings.CheckUpdate,
|
||||||
Action = () =>
|
Action = () => checkForUpdates().FireAndForget()
|
||||||
{
|
|
||||||
checkForUpdatesButton.Enabled.Value = false;
|
|
||||||
Task.Run(updateManager.CheckForUpdateAsync).ContinueWith(task => Schedule(() =>
|
|
||||||
{
|
|
||||||
if (!task.GetResultSafely())
|
|
||||||
{
|
|
||||||
notifications?.Post(new SimpleNotification
|
|
||||||
{
|
|
||||||
Text = GeneralSettingsStrings.RunningLatestRelease(game!.Version),
|
|
||||||
Icon = FontAwesome.Solid.CheckCircle,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
checkForUpdatesButton.Enabled.Value = true;
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,6 +81,44 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task checkForUpdates()
|
||||||
|
{
|
||||||
|
if (updateManager == null || game == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
checkForUpdatesButton.Enabled.Value = false;
|
||||||
|
|
||||||
|
var checkingNotification = new ProgressNotification
|
||||||
|
{
|
||||||
|
Text = GeneralSettingsStrings.CheckingForUpdates,
|
||||||
|
};
|
||||||
|
notifications?.Post(checkingNotification);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
bool foundUpdate = await updateManager.CheckForUpdateAsync().ConfigureAwait(true);
|
||||||
|
|
||||||
|
if (!foundUpdate)
|
||||||
|
{
|
||||||
|
notifications?.Post(new SimpleNotification
|
||||||
|
{
|
||||||
|
Text = GeneralSettingsStrings.RunningLatestRelease(game.Version),
|
||||||
|
Icon = FontAwesome.Solid.CheckCircle,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
// This sequence allows the notification to be immediately dismissed.
|
||||||
|
checkingNotification.State = ProgressNotificationState.Cancelled;
|
||||||
|
checkingNotification.Close(false);
|
||||||
|
checkForUpdatesButton.Enabled.Value = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void exportLogs()
|
private void exportLogs()
|
||||||
{
|
{
|
||||||
ProgressNotification notification = new ProgressNotification
|
ProgressNotification notification = new ProgressNotification
|
||||||
|
@ -83,7 +83,7 @@ namespace osu.Game.Screens.Play
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual bool PauseOnFocusLost => true;
|
protected virtual bool PauseOnFocusLost => true;
|
||||||
|
|
||||||
public Action<bool> RestartRequested;
|
public Action<bool> PrepareLoaderForRestart;
|
||||||
|
|
||||||
private bool isRestarting;
|
private bool isRestarting;
|
||||||
private bool skipExitTransition;
|
private bool skipExitTransition;
|
||||||
@ -719,10 +719,16 @@ namespace osu.Game.Screens.Play
|
|||||||
// stopping here is to ensure music doesn't become audible after exiting back to PlayerLoader.
|
// stopping here is to ensure music doesn't become audible after exiting back to PlayerLoader.
|
||||||
musicController.Stop();
|
musicController.Stop();
|
||||||
|
|
||||||
if (RestartRequested != null)
|
skipExitTransition = quickRestart;
|
||||||
|
PrepareLoaderForRestart?.Invoke(quickRestart);
|
||||||
|
|
||||||
|
if (!this.IsCurrentScreen())
|
||||||
{
|
{
|
||||||
skipExitTransition = quickRestart;
|
// if we're called externally (i.e. from results screen),
|
||||||
RestartRequested?.Invoke(quickRestart);
|
// use MakeCurrent to exit results screen as well as this player screen
|
||||||
|
// since ValidForResume = false in here
|
||||||
|
Debug.Assert(!ValidForResume);
|
||||||
|
this.MakeCurrent();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -457,7 +457,7 @@ namespace osu.Game.Screens.Play
|
|||||||
CurrentPlayer = createPlayer();
|
CurrentPlayer = createPlayer();
|
||||||
CurrentPlayer.Configuration.AutomaticallySkipIntro |= quickRestart;
|
CurrentPlayer.Configuration.AutomaticallySkipIntro |= quickRestart;
|
||||||
CurrentPlayer.RestartCount = restartCount++;
|
CurrentPlayer.RestartCount = restartCount++;
|
||||||
CurrentPlayer.RestartRequested = restartRequested;
|
CurrentPlayer.PrepareLoaderForRestart = prepareForRestart;
|
||||||
|
|
||||||
LoadTask = LoadComponentAsync(CurrentPlayer, _ =>
|
LoadTask = LoadComponentAsync(CurrentPlayer, _ =>
|
||||||
{
|
{
|
||||||
@ -470,13 +470,11 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private void restartRequested(bool quickRestartRequested)
|
private void prepareForRestart(bool quickRestartRequested)
|
||||||
{
|
{
|
||||||
quickRestart = quickRestartRequested;
|
quickRestart = quickRestartRequested;
|
||||||
hideOverlays = true;
|
hideOverlays = true;
|
||||||
ValidForResume = true;
|
ValidForResume = true;
|
||||||
|
|
||||||
this.MakeCurrent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void contentIn(double delayBeforeSideDisplays = 0)
|
private void contentIn(double delayBeforeSideDisplays = 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user