mirror of
https://github.com/ppy/osu.git
synced 2025-02-22 16:16:07 +08:00
Add disposal and pre-check before reloading audio track
This commit is contained in:
parent
a274b9a1fd
commit
1c53d93a8f
@ -5,6 +5,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -60,6 +61,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
||||
private readonly Container gameplayContent;
|
||||
private readonly LoadingLayer loadingLayer;
|
||||
private OsuScreenStack? stack;
|
||||
private Track? loadedTrack;
|
||||
|
||||
public PlayerArea(int userId, SpectatorPlayerClock clock)
|
||||
{
|
||||
@ -90,7 +92,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
||||
Score = score;
|
||||
|
||||
var workingBeatmap = beatmapManager.GetWorkingBeatmap(Score.ScoreInfo.BeatmapInfo);
|
||||
workingBeatmap.LoadTrack();
|
||||
if (!workingBeatmap.TrackLoaded)
|
||||
loadedTrack = workingBeatmap.LoadTrack();
|
||||
gameplayContent.Child = new PlayerIsolationContainer(workingBeatmap, Score.ScoreInfo.Ruleset, Score.ScoreInfo.Mods)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
@ -129,6 +132,12 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
||||
public override bool PropagatePositionalInputSubTree => false;
|
||||
public override bool PropagateNonPositionalInputSubTree => false;
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
loadedTrack?.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Isolates each player instance from the game-wide ruleset/beatmap/mods (to allow for different players having different settings).
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user