mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 06:03:08 +08:00
Merge branch 'master' into editor-setup-no-state-change
This commit is contained in:
commit
1861f34427
@ -29,6 +29,7 @@ using osu.Game.Screens.Play;
|
|||||||
using osu.Game.Screens.Play.PlayerSettings;
|
using osu.Game.Screens.Play.PlayerSettings;
|
||||||
using osu.Game.Utils;
|
using osu.Game.Utils;
|
||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
|
using SkipOverlay = osu.Game.Screens.Play.SkipOverlay;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Gameplay
|
namespace osu.Game.Tests.Visual.Gameplay
|
||||||
{
|
{
|
||||||
@ -98,7 +99,13 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
private void prepareBeatmap()
|
private void prepareBeatmap()
|
||||||
{
|
{
|
||||||
var workingBeatmap = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);
|
var workingBeatmap = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);
|
||||||
|
|
||||||
|
// Add intro time to test quick retry skipping (TestQuickRetry).
|
||||||
|
workingBeatmap.BeatmapInfo.AudioLeadIn = 60000;
|
||||||
|
|
||||||
|
// Turn on epilepsy warning to test warning display (TestEpilepsyWarning).
|
||||||
workingBeatmap.BeatmapInfo.EpilepsyWarning = epilepsyWarning;
|
workingBeatmap.BeatmapInfo.EpilepsyWarning = epilepsyWarning;
|
||||||
|
|
||||||
Beatmap.Value = workingBeatmap;
|
Beatmap.Value = workingBeatmap;
|
||||||
|
|
||||||
foreach (var mod in SelectedMods.Value.OfType<IApplicableToTrack>())
|
foreach (var mod in SelectedMods.Value.OfType<IApplicableToTrack>())
|
||||||
@ -400,6 +407,37 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestQuickRetry()
|
||||||
|
{
|
||||||
|
TestPlayer getCurrentPlayer() => loader.CurrentPlayer as TestPlayer;
|
||||||
|
bool checkSkipButtonVisible() => player.ChildrenOfType<SkipOverlay>().FirstOrDefault()?.IsButtonVisible == true;
|
||||||
|
|
||||||
|
TestPlayer previousPlayer = null;
|
||||||
|
|
||||||
|
AddStep("load dummy beatmap", () => resetPlayer(false));
|
||||||
|
|
||||||
|
AddUntilStep("wait for current", () => getCurrentPlayer()?.IsCurrentScreen() == true);
|
||||||
|
AddStep("store previous player", () => previousPlayer = getCurrentPlayer());
|
||||||
|
|
||||||
|
AddStep("Restart map normally", () => getCurrentPlayer().Restart());
|
||||||
|
AddUntilStep("wait for load", () => getCurrentPlayer()?.LoadedBeatmapSuccessfully == true);
|
||||||
|
|
||||||
|
AddUntilStep("restart completed", () => getCurrentPlayer() != null && getCurrentPlayer() != previousPlayer);
|
||||||
|
AddStep("store previous player", () => previousPlayer = getCurrentPlayer());
|
||||||
|
|
||||||
|
AddUntilStep("skip button visible", checkSkipButtonVisible);
|
||||||
|
|
||||||
|
AddStep("press quick retry key", () => InputManager.PressKey(Key.Tilde));
|
||||||
|
AddUntilStep("restart completed", () => getCurrentPlayer() != null && getCurrentPlayer() != previousPlayer);
|
||||||
|
AddStep("release quick retry key", () => InputManager.ReleaseKey(Key.Tilde));
|
||||||
|
|
||||||
|
AddUntilStep("wait for load", () => getCurrentPlayer()?.LoadedBeatmapSuccessfully == true);
|
||||||
|
|
||||||
|
AddUntilStep("time reached zero", () => getCurrentPlayer()?.GameplayClockContainer.CurrentTime > 0);
|
||||||
|
AddUntilStep("skip button not visible", () => !checkSkipButtonVisible());
|
||||||
|
}
|
||||||
|
|
||||||
private EpilepsyWarning getWarning() => loader.ChildrenOfType<EpilepsyWarning>().SingleOrDefault();
|
private EpilepsyWarning getWarning() => loader.ChildrenOfType<EpilepsyWarning>().SingleOrDefault();
|
||||||
|
|
||||||
private class TestPlayerLoader : PlayerLoader
|
private class TestPlayerLoader : PlayerLoader
|
||||||
|
@ -23,7 +23,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.RestartRequested = _ => restartRequested = true;
|
||||||
return player;
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,6 +102,14 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
public string OnlineMD5Hash { get; set; } = string.Empty;
|
public string OnlineMD5Hash { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The last time of a local modification (via the editor).
|
||||||
|
/// </summary>
|
||||||
|
public DateTimeOffset? LastLocalUpdate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The last time online metadata was applied to this beatmap.
|
||||||
|
/// </summary>
|
||||||
public DateTimeOffset? LastOnlineUpdate { get; set; }
|
public DateTimeOffset? LastOnlineUpdate { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -94,6 +94,7 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
var beatmapSet = new BeatmapSetInfo
|
var beatmapSet = new BeatmapSetInfo
|
||||||
{
|
{
|
||||||
|
DateAdded = DateTimeOffset.UtcNow,
|
||||||
Beatmaps =
|
Beatmaps =
|
||||||
{
|
{
|
||||||
new BeatmapInfo(ruleset, new BeatmapDifficulty(), metadata)
|
new BeatmapInfo(ruleset, new BeatmapDifficulty(), metadata)
|
||||||
@ -313,6 +314,7 @@ namespace osu.Game.Beatmaps
|
|||||||
beatmapInfo.MD5Hash = stream.ComputeMD5Hash();
|
beatmapInfo.MD5Hash = stream.ComputeMD5Hash();
|
||||||
beatmapInfo.Hash = stream.ComputeSHA2Hash();
|
beatmapInfo.Hash = stream.ComputeSHA2Hash();
|
||||||
|
|
||||||
|
beatmapInfo.LastLocalUpdate = DateTimeOffset.Now;
|
||||||
beatmapInfo.Status = BeatmapOnlineStatus.LocallyModified;
|
beatmapInfo.Status = BeatmapOnlineStatus.LocallyModified;
|
||||||
|
|
||||||
AddFile(setInfo, stream, createBeatmapFilenameFromMetadata(beatmapInfo));
|
AddFile(setInfo, stream, createBeatmapFilenameFromMetadata(beatmapInfo));
|
||||||
|
@ -89,7 +89,7 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
if (existing != null)
|
if (existing != null)
|
||||||
{
|
{
|
||||||
foreach (string newBeatmap in existing.BeatmapMD5Hashes)
|
foreach (string newBeatmap in collection.BeatmapMD5Hashes)
|
||||||
{
|
{
|
||||||
if (!existing.BeatmapMD5Hashes.Contains(newBeatmap))
|
if (!existing.BeatmapMD5Hashes.Contains(newBeatmap))
|
||||||
existing.BeatmapMD5Hashes.Add(newBeatmap);
|
existing.BeatmapMD5Hashes.Add(newBeatmap);
|
||||||
|
@ -68,8 +68,9 @@ namespace osu.Game.Database
|
|||||||
/// 20 2022-07-21 Added LastAppliedDifficultyVersion to RulesetInfo, changed default value of BeatmapInfo.StarRating to -1.
|
/// 20 2022-07-21 Added LastAppliedDifficultyVersion to RulesetInfo, changed default value of BeatmapInfo.StarRating to -1.
|
||||||
/// 21 2022-07-27 Migrate collections to realm (BeatmapCollection).
|
/// 21 2022-07-27 Migrate collections to realm (BeatmapCollection).
|
||||||
/// 22 2022-07-31 Added ModPreset.
|
/// 22 2022-07-31 Added ModPreset.
|
||||||
|
/// 23 2022-08-01 Added LastLocalUpdate to BeatmapInfo.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private const int schema_version = 22;
|
private const int schema_version = 23;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Lock object which is held during <see cref="BlockAllOperations"/> sections, blocking realm retrieval during blocking periods.
|
/// Lock object which is held during <see cref="BlockAllOperations"/> sections, blocking realm retrieval during blocking periods.
|
||||||
|
@ -19,8 +19,11 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
protected override string BeatmapFile => "circles.osz";
|
protected override string BeatmapFile => "circles.osz";
|
||||||
|
|
||||||
|
public const double TRACK_START_DELAY_NON_THEMED = 1000;
|
||||||
|
private const double track_start_delay_themed = 600;
|
||||||
|
|
||||||
|
private const double delay_for_menu = 2900;
|
||||||
private const double delay_step_one = 2300;
|
private const double delay_step_one = 2300;
|
||||||
private const double delay_step_two = 600;
|
|
||||||
|
|
||||||
private Sample welcome;
|
private Sample welcome;
|
||||||
|
|
||||||
@ -44,14 +47,16 @@ namespace osu.Game.Screens.Menu
|
|||||||
{
|
{
|
||||||
welcome?.Play();
|
welcome?.Play();
|
||||||
|
|
||||||
|
double trackStartDelay = UsingThemedIntro ? track_start_delay_themed : TRACK_START_DELAY_NON_THEMED;
|
||||||
|
|
||||||
Scheduler.AddDelayed(delegate
|
Scheduler.AddDelayed(delegate
|
||||||
{
|
{
|
||||||
StartTrack();
|
StartTrack();
|
||||||
|
|
||||||
PrepareMenuLoad();
|
PrepareMenuLoad();
|
||||||
|
|
||||||
Scheduler.AddDelayed(LoadMenu, delay_step_one);
|
Scheduler.AddDelayed(LoadMenu, delay_for_menu - trackStartDelay);
|
||||||
}, delay_step_two);
|
}, trackStartDelay);
|
||||||
|
|
||||||
logo.ScaleTo(1);
|
logo.ScaleTo(1);
|
||||||
logo.FadeIn();
|
logo.FadeIn();
|
||||||
|
@ -272,11 +272,17 @@ namespace osu.Game.Screens.Menu
|
|||||||
FadeInBackground(200);
|
FadeInBackground(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void StartTrack()
|
protected void StartTrack()
|
||||||
{
|
{
|
||||||
// Only start the current track if it is the menu music. A beatmap's track is started when entering the Main Menu.
|
var drawableTrack = musicController.CurrentTrack;
|
||||||
if (UsingThemedIntro)
|
|
||||||
Track.Start();
|
drawableTrack.Start();
|
||||||
|
|
||||||
|
if (!UsingThemedIntro)
|
||||||
|
{
|
||||||
|
drawableTrack.VolumeTo(0).Then()
|
||||||
|
.VolumeTo(1, 2000, Easing.OutQuint);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LogoArriving(OsuLogo logo, bool resuming)
|
protected override void LogoArriving(OsuLogo logo, bool resuming)
|
||||||
|
@ -84,9 +84,17 @@ namespace osu.Game.Screens.Menu
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (!UsingThemedIntro)
|
if (!UsingThemedIntro)
|
||||||
|
{
|
||||||
|
// If the user has requested no theme, fallback to the same intro voice and delay as IntroCircles.
|
||||||
|
// The triangles intro voice and theme are combined which makes it impossible to use.
|
||||||
welcome?.Play();
|
welcome?.Play();
|
||||||
|
Scheduler.AddDelayed(StartTrack, IntroCircles.TRACK_START_DELAY_NON_THEMED);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
StartTrack();
|
||||||
|
|
||||||
StartTrack();
|
// no-op for the case of themed intro, no harm in calling for both scenarios as a safety measure.
|
||||||
|
decoupledClock.Start();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -99,11 +107,6 @@ namespace osu.Game.Screens.Menu
|
|||||||
intro.Expire();
|
intro.Expire();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void StartTrack()
|
|
||||||
{
|
|
||||||
decoupledClock.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
private class TrianglesIntroSequence : CompositeDrawable
|
private class TrianglesIntroSequence : CompositeDrawable
|
||||||
{
|
{
|
||||||
private readonly OsuLogo logo;
|
private readonly OsuLogo logo;
|
||||||
|
@ -77,7 +77,7 @@ namespace osu.Game.Screens.Play
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual bool PauseOnFocusLost => true;
|
protected virtual bool PauseOnFocusLost => true;
|
||||||
|
|
||||||
public Action RestartRequested;
|
public Action<bool> RestartRequested;
|
||||||
|
|
||||||
private bool isRestarting;
|
private bool isRestarting;
|
||||||
|
|
||||||
@ -267,7 +267,7 @@ namespace osu.Game.Screens.Play
|
|||||||
FailOverlay = new FailOverlay
|
FailOverlay = new FailOverlay
|
||||||
{
|
{
|
||||||
SaveReplay = prepareAndImportScore,
|
SaveReplay = prepareAndImportScore,
|
||||||
OnRetry = Restart,
|
OnRetry = () => Restart(),
|
||||||
OnQuit = () => PerformExit(true),
|
OnQuit = () => PerformExit(true),
|
||||||
},
|
},
|
||||||
new HotkeyExitOverlay
|
new HotkeyExitOverlay
|
||||||
@ -294,7 +294,7 @@ namespace osu.Game.Screens.Play
|
|||||||
if (!this.IsCurrentScreen()) return;
|
if (!this.IsCurrentScreen()) return;
|
||||||
|
|
||||||
fadeOut(true);
|
fadeOut(true);
|
||||||
Restart();
|
Restart(true);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -371,6 +371,9 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
IsBreakTime.BindTo(breakTracker.IsBreakTime);
|
IsBreakTime.BindTo(breakTracker.IsBreakTime);
|
||||||
IsBreakTime.BindValueChanged(onBreakTimeChanged, true);
|
IsBreakTime.BindValueChanged(onBreakTimeChanged, true);
|
||||||
|
|
||||||
|
if (Configuration.AutomaticallySkipIntro)
|
||||||
|
skipIntroOverlay.SkipWhenReady();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual GameplayClockContainer CreateGameplayClockContainer(WorkingBeatmap beatmap, double gameplayStart) => new MasterGameplayClockContainer(beatmap, gameplayStart);
|
protected virtual GameplayClockContainer CreateGameplayClockContainer(WorkingBeatmap beatmap, double gameplayStart) => new MasterGameplayClockContainer(beatmap, gameplayStart);
|
||||||
@ -441,7 +444,7 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
OnResume = Resume,
|
OnResume = Resume,
|
||||||
Retries = RestartCount,
|
Retries = RestartCount,
|
||||||
OnRetry = Restart,
|
OnRetry = () => Restart(),
|
||||||
OnQuit = () => PerformExit(true),
|
OnQuit = () => PerformExit(true),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -648,7 +651,8 @@ namespace osu.Game.Screens.Play
|
|||||||
/// Restart gameplay via a parent <see cref="PlayerLoader"/>.
|
/// Restart gameplay via a parent <see cref="PlayerLoader"/>.
|
||||||
/// <remarks>This can be called from a child screen in order to trigger the restart process.</remarks>
|
/// <remarks>This can be called from a child screen in order to trigger the restart process.</remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Restart()
|
/// <param name="quickRestart">Whether a quick restart was requested (skipping intro etc.).</param>
|
||||||
|
public void Restart(bool quickRestart = false)
|
||||||
{
|
{
|
||||||
if (!Configuration.AllowRestart)
|
if (!Configuration.AllowRestart)
|
||||||
return;
|
return;
|
||||||
@ -660,7 +664,7 @@ namespace osu.Game.Screens.Play
|
|||||||
musicController.Stop();
|
musicController.Stop();
|
||||||
|
|
||||||
sampleRestart?.Play();
|
sampleRestart?.Play();
|
||||||
RestartRequested?.Invoke();
|
RestartRequested?.Invoke(quickRestart);
|
||||||
|
|
||||||
PerformExit(false);
|
PerformExit(false);
|
||||||
}
|
}
|
||||||
@ -840,7 +844,7 @@ namespace osu.Game.Screens.Play
|
|||||||
failAnimationLayer.Start();
|
failAnimationLayer.Start();
|
||||||
|
|
||||||
if (GameplayState.Mods.OfType<IApplicableFailOverride>().Any(m => m.RestartOnFail))
|
if (GameplayState.Mods.OfType<IApplicableFailOverride>().Any(m => m.RestartOnFail))
|
||||||
Restart();
|
Restart(true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -31,5 +31,10 @@ namespace osu.Game.Screens.Play
|
|||||||
/// Whether the player should be allowed to skip intros/outros, advancing to the start of gameplay or the end of a storyboard.
|
/// Whether the player should be allowed to skip intros/outros, advancing to the start of gameplay or the end of a storyboard.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool AllowSkipping { get; set; } = true;
|
public bool AllowSkipping { get; set; } = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the intro should be skipped by default.
|
||||||
|
/// </summary>
|
||||||
|
public bool AutomaticallySkipIntro { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,6 +123,8 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private EpilepsyWarning? epilepsyWarning;
|
private EpilepsyWarning? epilepsyWarning;
|
||||||
|
|
||||||
|
private bool quickRestart;
|
||||||
|
|
||||||
[Resolved(CanBeNull = true)]
|
[Resolved(CanBeNull = true)]
|
||||||
private INotificationOverlay? notificationOverlay { get; set; }
|
private INotificationOverlay? notificationOverlay { get; set; }
|
||||||
|
|
||||||
@ -361,6 +363,7 @@ namespace osu.Game.Screens.Play
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
CurrentPlayer = createPlayer();
|
CurrentPlayer = createPlayer();
|
||||||
|
CurrentPlayer.Configuration.AutomaticallySkipIntro = quickRestart;
|
||||||
CurrentPlayer.RestartCount = restartCount++;
|
CurrentPlayer.RestartCount = restartCount++;
|
||||||
CurrentPlayer.RestartRequested = restartRequested;
|
CurrentPlayer.RestartRequested = restartRequested;
|
||||||
|
|
||||||
@ -375,8 +378,9 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private void restartRequested()
|
private void restartRequested(bool quickRestartRequested)
|
||||||
{
|
{
|
||||||
|
quickRestart = quickRestartRequested;
|
||||||
hideOverlays = true;
|
hideOverlays = true;
|
||||||
ValidForResume = true;
|
ValidForResume = true;
|
||||||
}
|
}
|
||||||
|
@ -39,10 +39,13 @@ namespace osu.Game.Screens.Play
|
|||||||
private double displayTime;
|
private double displayTime;
|
||||||
|
|
||||||
private bool isClickable;
|
private bool isClickable;
|
||||||
|
private bool skipQueued;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IGameplayClock gameplayClock { get; set; }
|
private IGameplayClock gameplayClock { get; set; }
|
||||||
|
|
||||||
|
internal bool IsButtonVisible => fadeContainer.State == Visibility.Visible && buttonContainer.State.Value == Visibility.Visible;
|
||||||
|
|
||||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
|
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -123,6 +126,20 @@ namespace osu.Game.Screens.Play
|
|||||||
displayTime = gameplayClock.CurrentTime;
|
displayTime = gameplayClock.CurrentTime;
|
||||||
|
|
||||||
fadeContainer.TriggerShow();
|
fadeContainer.TriggerShow();
|
||||||
|
|
||||||
|
if (skipQueued)
|
||||||
|
{
|
||||||
|
Scheduler.AddDelayed(() => button.TriggerClick(), 200);
|
||||||
|
skipQueued = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SkipWhenReady()
|
||||||
|
{
|
||||||
|
if (IsLoaded)
|
||||||
|
button.TriggerClick();
|
||||||
|
else
|
||||||
|
skipQueued = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
|
@ -177,7 +177,7 @@ namespace osu.Game.Screens.Ranking
|
|||||||
{
|
{
|
||||||
if (!this.IsCurrentScreen()) return;
|
if (!this.IsCurrentScreen()) return;
|
||||||
|
|
||||||
player?.Restart();
|
player?.Restart(true);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user