Fix looping not working

This commit is contained in:
smoogipoo 2018-12-18 17:07:47 +09:00
parent 2f15d10029
commit aabe6c68f5
2 changed files with 34 additions and 4 deletions

View File

@ -178,10 +178,6 @@ namespace osu.Game.Screens.Multi.Match
Beatmap.Disabled = beatmapDisabled;
Ruleset.Disabled = rulesetDisabled;
Beatmap.Value.Track.Looping = true;
Beatmap.Value.Track.Seek(Beatmap.Value.Metadata.PreviewTime);
Beatmap.Value.Track.Start();
}
private void onStart()

View File

@ -11,6 +11,7 @@ using osu.Game.Graphics.Backgrounds;
using osu.Game.Graphics.Containers;
using osu.Game.Screens.Menu;
using osu.Game.Screens.Multi.Lounge;
using osu.Game.Screens.Multi.Match;
namespace osu.Game.Screens.Multi
{
@ -76,6 +77,11 @@ namespace osu.Game.Screens.Multi
protected override bool OnExiting(Screen next)
{
waves.Hide();
var track = Beatmap.Value.Track;
if (track != null)
track.Looping = false;
return base.OnExiting(next);
}
@ -102,6 +108,27 @@ namespace osu.Game.Screens.Multi
base.LogoExiting(logo);
}
protected override void Update()
{
base.Update();
if (currentScreen is MatchScreen)
{
var track = Beatmap.Value.Track;
if (track != null)
{
track.Looping = true;
if (!track.IsRunning)
{
Game.Audio.AddItemToList(track);
track.Seek(Beatmap.Value.Metadata.PreviewTime);
track.Start();
}
}
}
}
private void screenAdded(Screen newScreen)
{
currentScreen = (OsuScreen)newScreen;
@ -112,6 +139,13 @@ namespace osu.Game.Screens.Multi
private void screenRemoved(Screen newScreen)
{
if (currentScreen is MatchScreen)
{
var track = Beatmap.Value.Track;
if (track != null)
track.Looping = false;
}
currentScreen = (OsuScreen)newScreen;
}