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

Merge remote-tracking branch 'refs/remotes/ppy/master' into user-best-score

This commit is contained in:
Andrei Zavatski 2019-07-10 19:39:41 +03:00
commit a041421e0d
7 changed files with 36 additions and 16 deletions

View File

@ -70,7 +70,7 @@ namespace osu.Game.Tests.Visual.Online
});
channelTabControl.OnRequestLeave += channel => channelTabControl.RemoveChannel(channel);
channelTabControl.Current.ValueChanged += channel => currentText.Text = "Currently selected channel: " + channel.NewValue.ToString();
channelTabControl.Current.ValueChanged += channel => currentText.Text = "Currently selected channel: " + channel.NewValue;
AddStep("Add random private channel", addRandomPrivateChannel);
AddAssert("There is only one channels", () => channelTabControl.Items.Count() == 2);

View File

@ -14,8 +14,6 @@ namespace osu.Game.Tests.Visual.UserInterface
{
public class TestSceneBackButton : OsuTestScene
{
private readonly BackButton button;
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(TwoLayerButton)
@ -23,6 +21,8 @@ namespace osu.Game.Tests.Visual.UserInterface
public TestSceneBackButton()
{
BackButton button;
Child = new Container
{
Anchor = Anchor.Centre,
@ -40,11 +40,12 @@ namespace osu.Game.Tests.Visual.UserInterface
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Action = () => button.Hide(),
}
}
};
button.Action = () => button.Hide();
AddStep("show button", () => button.Show());
AddStep("hide button", () => button.Hide());
}

View File

@ -48,7 +48,7 @@ namespace osu.Game.Tests.Visual.UserInterface
},
};
breadcrumbs.Current.ValueChanged += screen => titleText.Text = $"Changed to {screen.NewValue.ToString()}";
breadcrumbs.Current.ValueChanged += screen => titleText.Text = $"Changed to {screen.NewValue}";
breadcrumbs.Current.TriggerChange();
waitForCurrent();

View File

@ -55,6 +55,8 @@ namespace osu.Game.Overlays
private Container dragContainer;
private Container playerContainer;
public bool IsUserPaused { get; private set; }
[Resolved]
private Bindable<WorkingBeatmap> beatmap { get; set; }
@ -157,7 +159,7 @@ namespace osu.Game.Overlays
Origin = Anchor.Centre,
Scale = new Vector2(1.4f),
IconScale = new Vector2(1.4f),
Action = play,
Action = togglePause,
Icon = FontAwesome.Regular.PlayCircle,
},
nextButton = new MusicIconButton
@ -276,7 +278,7 @@ namespace osu.Game.Overlays
}
}
private void play()
private void togglePause()
{
var track = current?.Track;
@ -288,9 +290,15 @@ namespace osu.Game.Overlays
}
if (track.IsRunning)
{
IsUserPaused = true;
track.Stop();
}
else
{
track.Start();
IsUserPaused = false;
}
}
private void prev()

View File

@ -224,30 +224,32 @@ namespace osu.Game.Screens.Edit
public override void OnResuming(IScreen last)
{
Beatmap.Value.Track?.Stop();
base.OnResuming(last);
Beatmap.Value.Track?.Stop();
}
public override void OnEntering(IScreen last)
{
base.OnEntering(last);
Background.FadeColour(Color4.DarkGray, 500);
Beatmap.Value.Track?.Stop();
resetTrack();
}
public override bool OnExiting(IScreen next)
{
Background.FadeColour(Color4.White, 500);
if (Beatmap.Value.Track != null)
{
Beatmap.Value.Track.Tempo.Value = 1;
Beatmap.Value.Track.Start();
}
resetTrack();
return base.OnExiting(next);
}
private void resetTrack()
{
Beatmap.Value.Track?.ResetSpeedAdjustments();
Beatmap.Value.Track?.Stop();
}
private void exportBeatmap() => host.OpenFileExternally(Beatmap.Value.Save());
private void onModeChanged(ValueChangedEvent<EditorScreenMode> e)

View File

@ -42,6 +42,9 @@ namespace osu.Game.Screens.Menu
[Resolved]
private GameHost host { get; set; }
[Resolved(canBeNull: true)]
private MusicController music { get; set; }
private BackgroundScreenDefault background;
protected override BackgroundScreen CreateBackground() => background;
@ -189,6 +192,9 @@ namespace osu.Game.Screens.Menu
//we may have consumed our preloaded instance, so let's make another.
preloadSongSelect();
if (Beatmap.Value.Track != null && music?.IsUserPaused != true)
Beatmap.Value.Track.Start();
}
public override bool OnExiting(IScreen next)

View File

@ -87,6 +87,9 @@ namespace osu.Game.Screens.Select
private readonly Bindable<RulesetInfo> decoupledRuleset = new Bindable<RulesetInfo>();
[Resolved(canBeNull: true)]
private MusicController music { get; set; }
[Cached]
[Cached(Type = typeof(IBindable<IReadOnlyList<Mod>>))]
private readonly Bindable<IReadOnlyList<Mod>> mods = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>()); // Bound to the game's mods, but is not reset on exiting
@ -570,7 +573,7 @@ namespace osu.Game.Screens.Select
{
Track track = Beatmap.Value.Track;
if (!track.IsRunning || restart)
if ((!track.IsRunning || restart) && music?.IsUserPaused != true)
{
track.RestartPoint = Beatmap.Value.Metadata.PreviewTime;
track.Restart();