mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 09:43:10 +08:00
Merge branch 'master' into import-from-stable-part-two
This commit is contained in:
commit
1f205d87f8
@ -1,11 +1,15 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Timing;
|
|
||||||
using osu.Game.Overlays;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Testing;
|
||||||
|
using osu.Framework.Timing;
|
||||||
|
using osu.Game;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Overlays;
|
||||||
|
|
||||||
namespace osu.Desktop.VisualTests.Tests
|
namespace osu.Desktop.VisualTests.Tests
|
||||||
{
|
{
|
||||||
@ -13,6 +17,8 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
{
|
{
|
||||||
public override string Description => @"Tests music controller ui.";
|
public override string Description => @"Tests music controller ui.";
|
||||||
|
|
||||||
|
private readonly Bindable<WorkingBeatmap> beatmapBacking = new Bindable<WorkingBeatmap>();
|
||||||
|
|
||||||
public TestCaseMusicController()
|
public TestCaseMusicController()
|
||||||
{
|
{
|
||||||
Clock = new FramedClock();
|
Clock = new FramedClock();
|
||||||
@ -26,6 +32,13 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
|
|
||||||
AddToggleStep(@"toggle visibility", state => mc.State = state ? Visibility.Visible : Visibility.Hidden);
|
AddToggleStep(@"toggle visibility", state => mc.State = state ? Visibility.Visible : Visibility.Hidden);
|
||||||
AddStep(@"show", () => mc.State = Visibility.Visible);
|
AddStep(@"show", () => mc.State = Visibility.Visible);
|
||||||
|
AddToggleStep(@"toggle beatmap lock", state => beatmapBacking.Disabled = state);
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuGameBase game)
|
||||||
|
{
|
||||||
|
beatmapBacking.BindTo(game.Beatmap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,6 +80,8 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
hover.Colour = colours.Yellow.Opacity(0.6f);
|
hover.Colour = colours.Yellow.Opacity(0.6f);
|
||||||
flashColour = colours.Yellow;
|
flashColour = colours.Yellow;
|
||||||
|
|
||||||
|
Enabled.ValueChanged += enabled => this.FadeColour(enabled ? Color4.White : colours.Gray9, 200, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnHover(InputState state)
|
protected override bool OnHover(InputState state)
|
||||||
|
@ -6,14 +6,14 @@ using System.Linq;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
|
using osu.Framework.Input;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Input;
|
|
||||||
using osu.Framework.Graphics.Shapes;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Music
|
namespace osu.Game.Overlays.Music
|
||||||
{
|
{
|
||||||
|
@ -12,18 +12,18 @@ using osu.Framework.Configuration;
|
|||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
|
using osu.Framework.Threading;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Framework.Threading;
|
|
||||||
using osu.Game.Overlays.Music;
|
using osu.Game.Overlays.Music;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Framework.Graphics.Shapes;
|
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
@ -41,7 +41,9 @@ namespace osu.Game.Overlays
|
|||||||
private Drawable currentBackground;
|
private Drawable currentBackground;
|
||||||
private ProgressBar progressBar;
|
private ProgressBar progressBar;
|
||||||
|
|
||||||
|
private IconButton prevButton;
|
||||||
private IconButton playButton;
|
private IconButton playButton;
|
||||||
|
private IconButton nextButton;
|
||||||
private IconButton playlistButton;
|
private IconButton playlistButton;
|
||||||
|
|
||||||
private SpriteText title, artist;
|
private SpriteText title, artist;
|
||||||
@ -158,7 +160,7 @@ namespace osu.Game.Overlays
|
|||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
new IconButton
|
prevButton = new IconButton
|
||||||
{
|
{
|
||||||
Action = prev,
|
Action = prev,
|
||||||
Icon = FontAwesome.fa_step_backward,
|
Icon = FontAwesome.fa_step_backward,
|
||||||
@ -170,7 +172,7 @@ namespace osu.Game.Overlays
|
|||||||
Action = play,
|
Action = play,
|
||||||
Icon = FontAwesome.fa_play_circle_o,
|
Icon = FontAwesome.fa_play_circle_o,
|
||||||
},
|
},
|
||||||
new IconButton
|
nextButton = new IconButton
|
||||||
{
|
{
|
||||||
Action = next,
|
Action = next,
|
||||||
Icon = FontAwesome.fa_step_forward,
|
Icon = FontAwesome.fa_step_forward,
|
||||||
@ -209,11 +211,22 @@ namespace osu.Game.Overlays
|
|||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
beatmapBacking.ValueChanged += beatmapChanged;
|
beatmapBacking.ValueChanged += beatmapChanged;
|
||||||
|
beatmapBacking.DisabledChanged += beatmapDisabledChanged;
|
||||||
beatmapBacking.TriggerChange();
|
beatmapBacking.TriggerChange();
|
||||||
|
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void beatmapDisabledChanged(bool disabled)
|
||||||
|
{
|
||||||
|
if (disabled)
|
||||||
|
playlist.Hide();
|
||||||
|
|
||||||
|
prevButton.Enabled.Value = !disabled;
|
||||||
|
nextButton.Enabled.Value = !disabled;
|
||||||
|
playlistButton.Enabled.Value = !disabled;
|
||||||
|
}
|
||||||
|
|
||||||
protected override void UpdateAfterChildren()
|
protected override void UpdateAfterChildren()
|
||||||
{
|
{
|
||||||
base.UpdateAfterChildren();
|
base.UpdateAfterChildren();
|
||||||
@ -233,7 +246,8 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
playButton.Icon = track.IsRunning ? FontAwesome.fa_pause_circle_o : FontAwesome.fa_play_circle_o;
|
playButton.Icon = track.IsRunning ? FontAwesome.fa_pause_circle_o : FontAwesome.fa_play_circle_o;
|
||||||
|
|
||||||
if (track.HasCompleted && !track.Looping) next();
|
if (track.HasCompleted && !track.Looping && !beatmapBacking.Disabled)
|
||||||
|
next();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
playButton.Icon = FontAwesome.fa_play_circle_o;
|
playButton.Icon = FontAwesome.fa_play_circle_o;
|
||||||
@ -245,7 +259,8 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
if (track == null)
|
if (track == null)
|
||||||
{
|
{
|
||||||
playlist.PlayNext();
|
if (!beatmapBacking.Disabled)
|
||||||
|
playlist.PlayNext();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,16 +272,12 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private void prev()
|
private void prev()
|
||||||
{
|
{
|
||||||
if (beatmapBacking.Disabled) return;
|
|
||||||
|
|
||||||
queuedDirection = TransformDirection.Prev;
|
queuedDirection = TransformDirection.Prev;
|
||||||
playlist.PlayPrevious();
|
playlist.PlayPrevious();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void next()
|
private void next()
|
||||||
{
|
{
|
||||||
if (beatmapBacking.Disabled) return;
|
|
||||||
|
|
||||||
queuedDirection = TransformDirection.Next;
|
queuedDirection = TransformDirection.Next;
|
||||||
playlist.PlayNext();
|
playlist.PlayNext();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user