Skip to content

Commit 92102f5

Browse files
authored
Merge pull request #107 from ppy/master
aa
2 parents b63daf9 + 522d2bd commit 92102f5

3 files changed

Lines changed: 12 additions & 46 deletions

File tree

osu.Game/Screens/Backgrounds/EditorBackgroundScreen.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ public void RefreshBackgroundAsync()
111111
private void updateState(bool withAnimation = true)
112112
{
113113
background?.Storyboard.FadeTo(showStoryboard.Value ? 1 : 0, withAnimation ? 500 : 0, Easing.OutQuint);
114+
// if the storyboard is disabled, in some cases (e.g. involving `StoryboardReplacesBackground`)
115+
// we still need to show the background sprite, because if we don't, then there will be no background shown at all
116+
background?.Sprite.FadeTo(showStoryboard.Value ? 0 : 1, withAnimation ? 500 : 0, Easing.OutQuint);
114117
}
115118

116119
public override bool Equals(BackgroundScreen? other)

osu.Game/Screens/OnlinePlay/Matchmaking/RankedPlay/GameplayWarmupScreen.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ public partial class GameplayWarmupScreen : RankedPlaySubScreen
5353
[Resolved]
5454
private RulesetStore rulesets { get; set; } = null!;
5555

56+
[Resolved]
57+
private MusicController musicController { get; set; } = null!;
58+
5659
[Resolved]
5760
private Bindable<WorkingBeatmap> globalBeatmap { get; set; } = null!;
5861

@@ -164,6 +167,10 @@ protected override void LoadComplete()
164167
globalRuleset.Value = ruleset;
165168
globalMods.Value = item.RequiredMods.Select(m => m.ToMod(rulesetInstance)).ToArray();
166169

170+
// Play the new track from its preview point.
171+
globalBeatmap.Value.PrepareTrackForPreview(false);
172+
musicController.Play(true);
173+
167174
Client.ChangeState(MultiplayerUserState.Ready).FireAndForget();
168175
}
169176

osu.Game/Screens/OnlinePlay/Matchmaking/RankedPlay/RankedPlayScreen.cs

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ public partial class RankedPlayScreen : OsuScreen, IPreviewTrackOwner, IHandlePr
6666
[Resolved]
6767
private PreviewTrackManager previewTrackManager { get; set; } = null!;
6868

69-
[Resolved]
70-
private MusicController music { get; set; } = null!;
71-
7269
[Resolved]
7370
private QueueController? controller { get; set; }
7471

@@ -285,16 +282,9 @@ private void onStageChanged(RankedPlayStage stage)
285282
}
286283
}
287284

288-
public override void OnEntering(ScreenTransitionEvent e)
289-
{
290-
base.OnEntering(e);
291-
292-
beginHandlingTrack();
293-
}
294-
295285
public override void OnSuspending(ScreenTransitionEvent e)
296286
{
297-
endHandlingTrack();
287+
previewTrackManager.StopAnyPlaying(this);
298288

299289
base.OnSuspending(e);
300290
}
@@ -312,7 +302,7 @@ public override bool OnExiting(ScreenExitEvent e)
312302
return true;
313303
}
314304

315-
endHandlingTrack();
305+
previewTrackManager.StopAnyPlaying(this);
316306

317307
client.LeaveRoom().FireAndForget();
318308

@@ -341,8 +331,6 @@ public override void OnResuming(ScreenTransitionEvent e)
341331
{
342332
base.OnResuming(e);
343333

344-
beginHandlingTrack();
345-
346334
if (e.Last is not MultiplayerPlayerLoader playerLoader)
347335
return;
348336

@@ -355,38 +343,6 @@ public override void OnResuming(ScreenTransitionEvent e)
355343
client.ChangeState(MultiplayerUserState.Idle).FireAndForget();
356344
}
357345

358-
/// <summary>
359-
/// Handles changes in the track to keep it looping while active.
360-
/// </summary>
361-
private void beginHandlingTrack()
362-
{
363-
Beatmap.BindValueChanged(applyLoopingToTrack, true);
364-
}
365-
366-
/// <summary>
367-
/// Stops looping the current track and stops handling further changes to the track.
368-
/// </summary>
369-
private void endHandlingTrack()
370-
{
371-
Beatmap.ValueChanged -= applyLoopingToTrack;
372-
Beatmap.Value.Track.Looping = false;
373-
374-
previewTrackManager.StopAnyPlaying(this);
375-
}
376-
377-
/// <summary>
378-
/// Invoked on changes to the beatmap to loop the track. See: <see cref="beginHandlingTrack"/>.
379-
/// </summary>
380-
/// <param name="beatmap">The beatmap change event.</param>
381-
private void applyLoopingToTrack(ValueChangedEvent<WorkingBeatmap> beatmap)
382-
{
383-
if (!this.IsCurrentScreen())
384-
return;
385-
386-
beatmap.NewValue.PrepareTrackForPreview(true);
387-
music.EnsurePlayingSomething();
388-
}
389-
390346
public void PresentBeatmap(WorkingBeatmap beatmap, RulesetInfo ruleset)
391347
{
392348
// Do nothing to prevent the user from potentially being kicked out

0 commit comments

Comments
 (0)