1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 01:27:29 +08:00

TestCase reset.

This commit is contained in:
Huo Yaoyuan 2016-10-24 18:26:50 +08:00
parent b671a33911
commit 0da78c19a2
2 changed files with 15 additions and 12 deletions

View File

@ -22,6 +22,8 @@ namespace osu.Desktop.Tests
IFrameBasedClock ourClock;
protected override IFrameBasedClock Clock => ourClock;
protected MusicController mc;
public override void Load(BaseGame game)
{
base.Load(game);
@ -32,7 +34,8 @@ namespace osu.Desktop.Tests
{
base.Reset();
ourClock.ProcessFrame();
MusicController mc = new MusicController
mc?.CurrentTrack?.Stop();
mc = new MusicController
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre

View File

@ -29,7 +29,7 @@ namespace osu.Game.Overlays
private OsuGameBase osuGame;
private List<BeatmapSetInfo> playList;
private BeatmapSetInfo currentPlay;
private AudioTrack currentTrack;
public AudioTrack CurrentTrack { get; set; }//TODO:gets exterally
public override void Load(BaseGame game)
{
base.Load(game);
@ -83,15 +83,15 @@ namespace osu.Game.Overlays
Position = new Vector2(0, 30),
Action = () =>
{
if (currentTrack == null) return;
if (currentTrack.IsRunning)
if (CurrentTrack == null) return;
if (CurrentTrack.IsRunning)
{
currentTrack.Stop();
CurrentTrack.Stop();
playButton.Icon = FontAwesome.play_circle_o;
}
else
{
currentTrack.Start();
CurrentTrack.Start();
playButton.Icon = FontAwesome.pause;
}
},
@ -179,9 +179,9 @@ namespace osu.Game.Overlays
protected override void Update()
{
base.Update();
if (currentTrack == null) return;
progress.Width = (float)(currentTrack.CurrentTime / currentTrack.Length);
if (currentTrack.HasCompleted) next();
if (CurrentTrack == null) return;
progress.Width = (float)(CurrentTrack.CurrentTime / CurrentTrack.Length);
if (CurrentTrack.HasCompleted) next();
}
private void prev()
@ -208,9 +208,9 @@ namespace osu.Game.Overlays
title.Text = metadata.TitleUnicode ?? metadata.Title;
artist.Text = metadata.ArtistUnicode ?? metadata.Artist;
ArchiveReader reader = osuGame.Beatmaps.GetReader(currentPlay);
currentTrack?.Stop();
currentTrack = new AudioTrackBass(reader.ReadFile(metadata.AudioFile));
currentTrack.Start();
CurrentTrack?.Stop();
CurrentTrack = new AudioTrackBass(reader.ReadFile(metadata.AudioFile));
CurrentTrack.Start();
Sprite newBackground = getScaledSprite(TextureLoader.FromStream(reader.ReadFile(metadata.BackgroundFile)));
Add(newBackground);
if (isNext == true)