mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 14:03:01 +08:00
Fix hard crash when clicking on a preview button
This commit is contained in:
parent
f5cd0eae48
commit
cbcdc28900
@ -7,6 +7,7 @@ using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Online.Multiplayer.GameTypes;
|
||||
@ -18,7 +19,7 @@ using PlaylistItem = osu.Game.Online.Multiplayer.PlaylistItem;
|
||||
|
||||
namespace osu.Game.Screens.Multi.Match
|
||||
{
|
||||
public class MatchSubScreen : MultiplayerSubScreen
|
||||
public class MatchSubScreen : MultiplayerSubScreen, IPreviewTrackOwner
|
||||
{
|
||||
public override bool DisallowExternalBeatmapRulesetChanges => true;
|
||||
|
||||
@ -44,6 +45,9 @@ namespace osu.Game.Screens.Multi.Match
|
||||
[Resolved]
|
||||
private BeatmapManager beatmapManager { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private PreviewTrackManager trackManager { get; set; }
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
private OsuGame game { get; set; }
|
||||
|
||||
@ -184,6 +188,8 @@ namespace osu.Game.Screens.Multi.Match
|
||||
|
||||
Mods.Value = Array.Empty<Mod>();
|
||||
|
||||
trackManager.StopAnyPlaying(this);
|
||||
|
||||
return base.OnExiting(next);
|
||||
}
|
||||
|
||||
@ -237,6 +243,13 @@ namespace osu.Game.Screens.Multi.Match
|
||||
}
|
||||
}
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||
{
|
||||
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
||||
dependencies.CacheAs<IPreviewTrackOwner>(this);
|
||||
return dependencies;
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
Loading…
Reference in New Issue
Block a user