Merge pull request #19812 from peppy/improve-intro-timings-2

Tweak intro timings more and ensure non-theme tracks play from preview point
This commit is contained in:
Dan Balasescu 2022-08-17 15:50:42 +09:00 committed by GitHub
commit aaaaff1bbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 19 additions and 18 deletions

View File

@ -134,6 +134,6 @@ namespace osu.Game.Beatmaps
/// <summary> /// <summary>
/// Reads the correct track restart point from beatmap metadata and sets looping to enabled. /// Reads the correct track restart point from beatmap metadata and sets looping to enabled.
/// </summary> /// </summary>
void PrepareTrackForPreviewLooping(); void PrepareTrackForPreview(bool looping);
} }
} }

View File

@ -110,9 +110,9 @@ namespace osu.Game.Beatmaps
public Track LoadTrack() => track = GetBeatmapTrack() ?? GetVirtualTrack(1000); public Track LoadTrack() => track = GetBeatmapTrack() ?? GetVirtualTrack(1000);
public void PrepareTrackForPreviewLooping() public void PrepareTrackForPreview(bool looping)
{ {
Track.Looping = true; Track.Looping = looping;
Track.RestartPoint = Metadata.PreviewTime; Track.RestartPoint = Metadata.PreviewTime;
if (Track.RestartPoint == -1) if (Track.RestartPoint == -1)

View File

@ -19,11 +19,9 @@ 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; public const double TRACK_START_DELAY = 600;
private const double track_start_delay_themed = 600;
private const double delay_for_menu = 2900; private const double delay_for_menu = 2900;
private const double delay_step_one = 2300;
private Sample welcome; private Sample welcome;
@ -47,16 +45,14 @@ 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_for_menu - trackStartDelay); Scheduler.AddDelayed(LoadMenu, delay_for_menu - TRACK_START_DELAY);
}, trackStartDelay); }, TRACK_START_DELAY);
logo.ScaleTo(1); logo.ScaleTo(1);
logo.FadeIn(); logo.FadeIn();

View File

@ -276,12 +276,17 @@ namespace osu.Game.Screens.Menu
{ {
var drawableTrack = musicController.CurrentTrack; var drawableTrack = musicController.CurrentTrack;
drawableTrack.Start();
if (!UsingThemedIntro) if (!UsingThemedIntro)
{ {
drawableTrack.VolumeTo(0).Then() initialBeatmap?.PrepareTrackForPreview(false);
.VolumeTo(1, 2000, Easing.OutQuint);
drawableTrack.VolumeTo(0);
drawableTrack.Restart();
drawableTrack.VolumeTo(1, 2200, Easing.InCubic);
}
else
{
drawableTrack.Restart();
} }
} }

View File

@ -88,7 +88,7 @@ namespace osu.Game.Screens.Menu
// If the user has requested no theme, fallback to the same intro voice and delay as IntroCircles. // 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. // 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); Scheduler.AddDelayed(StartTrack, IntroCircles.TRACK_START_DELAY);
} }
else else
StartTrack(); StartTrack();

View File

@ -192,7 +192,7 @@ namespace osu.Game.Screens.Menu
// presume the track is the current beatmap's track. not sure how correct this assumption is but it has worked until now. // presume the track is the current beatmap's track. not sure how correct this assumption is but it has worked until now.
if (!track.IsRunning) if (!track.IsRunning)
{ {
Beatmap.Value.PrepareTrackForPreviewLooping(); Beatmap.Value.PrepareTrackForPreview(false);
track.Restart(); track.Restart();
} }
} }

View File

@ -485,7 +485,7 @@ namespace osu.Game.Screens.OnlinePlay.Match
if (track != null) if (track != null)
{ {
Beatmap.Value.PrepareTrackForPreviewLooping(); Beatmap.Value.PrepareTrackForPreview(true);
music?.EnsurePlayingSomething(); music?.EnsurePlayingSomething();
} }
} }

View File

@ -683,7 +683,7 @@ namespace osu.Game.Screens.Select
} }
private void ensureTrackLooping(IWorkingBeatmap beatmap, TrackChangeDirection changeDirection) private void ensureTrackLooping(IWorkingBeatmap beatmap, TrackChangeDirection changeDirection)
=> beatmap.PrepareTrackForPreviewLooping(); => beatmap.PrepareTrackForPreview(true);
public override bool OnBackButton() public override bool OnBackButton()
{ {