mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 06:17:23 +08:00
Added test case usability, namings and bug fixes
This commit is contained in:
parent
67292a5dcf
commit
8b07565025
@ -1,11 +1,15 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// 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.Timing;
|
||||
using osu.Game.Overlays;
|
||||
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
|
||||
{
|
||||
@ -15,11 +19,19 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
|
||||
private MusicController mc;
|
||||
|
||||
private readonly Bindable<WorkingBeatmap> beatmapBacking = new Bindable<WorkingBeatmap>();
|
||||
|
||||
public TestCaseMusicController()
|
||||
{
|
||||
Clock = new FramedClock();
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuGameBase game)
|
||||
{
|
||||
beatmapBacking.BindTo(game.Beatmap);
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
@ -33,6 +45,7 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
|
||||
AddToggleStep(@"toggle visibility", state => mc.State = state ? Visibility.Visible : Visibility.Hidden);
|
||||
AddStep(@"show", () => mc.State = Visibility.Visible);
|
||||
AddToggleStep(@"toggle beatmap lock", state => beatmapBacking.Disabled = state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Graphics.Transforms;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
@ -34,7 +33,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
set { icon.Scale = value; }
|
||||
}
|
||||
|
||||
private Color4 disabledColour;
|
||||
private Color4 disableColour;
|
||||
|
||||
public IconButton()
|
||||
{
|
||||
@ -82,7 +81,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
hover.Colour = colours.Yellow.Opacity(0.6f);
|
||||
flashColour = colours.Yellow;
|
||||
disabledColour = colours.Gray9;
|
||||
disableColour = colours.Gray9;
|
||||
|
||||
Enabled.ValueChanged += enabledChanged;
|
||||
}
|
||||
@ -91,26 +90,14 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
if (newEnabled)
|
||||
{
|
||||
// Only fade the colour to white if there is no colour transformation pending
|
||||
bool colorTransformation = false;
|
||||
foreach (ITransform<IconButton> t in Transforms)
|
||||
{
|
||||
if (t is TransformColour)
|
||||
{
|
||||
colorTransformation = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!colorTransformation)
|
||||
FadeColour(Color4.White, 200, EasingTypes.OutQuint);
|
||||
FadeColour(Color4.White, 200, EasingTypes.OutQuint);
|
||||
|
||||
if (Hovering)
|
||||
OnHover(new InputState());
|
||||
}
|
||||
else
|
||||
{
|
||||
FadeColour(disabledColour, 200, EasingTypes.OutQuint);
|
||||
FadeColour(disableColour, 200, EasingTypes.OutQuint);
|
||||
content.ScaleTo(1, 200, EasingTypes.OutElastic);
|
||||
|
||||
if (Hovering)
|
||||
|
@ -45,7 +45,7 @@ namespace osu.Game.Overlays
|
||||
private IconButton nextButton;
|
||||
private IconButton playlistButton;
|
||||
|
||||
private Color4 colorYellow;
|
||||
private Color4 playlistButtonColor;
|
||||
|
||||
private SpriteText title, artist;
|
||||
|
||||
@ -60,8 +60,6 @@ namespace osu.Game.Overlays
|
||||
|
||||
private bool showPlaylistOnceAvailable;
|
||||
|
||||
private bool AllowBeatmapChange => !beatmapBacking.Disabled;
|
||||
|
||||
public MusicController()
|
||||
{
|
||||
Width = 400;
|
||||
@ -207,12 +205,12 @@ namespace osu.Game.Overlays
|
||||
|
||||
beatmapBacking.BindTo(game.Beatmap);
|
||||
|
||||
colorYellow = colours.Yellow;
|
||||
playlistButtonColor = colours.Yellow;
|
||||
|
||||
playlist.StateChanged += (c, s) =>
|
||||
{
|
||||
if (AllowBeatmapChange)
|
||||
playlistButton.FadeColour(s == Visibility.Visible ? colorYellow : Color4.White, 200, EasingTypes.OutQuint);
|
||||
if (!beatmapBacking.Disabled)
|
||||
playlistButton.FadeColour(s == Visibility.Visible ? playlistButtonColor : Color4.White, 200, EasingTypes.OutQuint);
|
||||
};
|
||||
}
|
||||
|
||||
@ -262,7 +260,7 @@ namespace osu.Game.Overlays
|
||||
progressBar.UpdatePosition(track.Length == 0 ? 0 : (float)(track.CurrentTime / track.Length));
|
||||
playButton.Icon = track.IsRunning ? FontAwesome.fa_pause_circle_o : FontAwesome.fa_play_circle_o;
|
||||
|
||||
if (track.HasCompleted && !track.Looping && AllowBeatmapChange) next();
|
||||
if (track.HasCompleted && !track.Looping && !beatmapBacking.Disabled) next();
|
||||
}
|
||||
else
|
||||
playButton.Icon = FontAwesome.fa_play_circle_o;
|
||||
@ -274,7 +272,7 @@ namespace osu.Game.Overlays
|
||||
|
||||
if (track == null)
|
||||
{
|
||||
if (AllowBeatmapChange)
|
||||
if (!beatmapBacking.Disabled)
|
||||
playlist.PlayNext();
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user