mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 16:25:32 +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>.
|
// 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
|
||||||
{
|
{
|
||||||
@ -15,11 +19,19 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
|
|
||||||
private MusicController mc;
|
private MusicController mc;
|
||||||
|
|
||||||
|
private readonly Bindable<WorkingBeatmap> beatmapBacking = new Bindable<WorkingBeatmap>();
|
||||||
|
|
||||||
public TestCaseMusicController()
|
public TestCaseMusicController()
|
||||||
{
|
{
|
||||||
Clock = new FramedClock();
|
Clock = new FramedClock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuGameBase game)
|
||||||
|
{
|
||||||
|
beatmapBacking.BindTo(game.Beatmap);
|
||||||
|
}
|
||||||
|
|
||||||
public override void Reset()
|
public override void Reset()
|
||||||
{
|
{
|
||||||
base.Reset();
|
base.Reset();
|
||||||
@ -33,6 +45,7 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Framework.Graphics.Transforms;
|
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
{
|
{
|
||||||
@ -34,7 +33,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
set { icon.Scale = value; }
|
set { icon.Scale = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private Color4 disabledColour;
|
private Color4 disableColour;
|
||||||
|
|
||||||
public IconButton()
|
public IconButton()
|
||||||
{
|
{
|
||||||
@ -82,7 +81,7 @@ 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;
|
||||||
disabledColour = colours.Gray9;
|
disableColour = colours.Gray9;
|
||||||
|
|
||||||
Enabled.ValueChanged += enabledChanged;
|
Enabled.ValueChanged += enabledChanged;
|
||||||
}
|
}
|
||||||
@ -91,26 +90,14 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
if (newEnabled)
|
if (newEnabled)
|
||||||
{
|
{
|
||||||
// Only fade the colour to white if there is no colour transformation pending
|
FadeColour(Color4.White, 200, EasingTypes.OutQuint);
|
||||||
bool colorTransformation = false;
|
|
||||||
foreach (ITransform<IconButton> t in Transforms)
|
|
||||||
{
|
|
||||||
if (t is TransformColour)
|
|
||||||
{
|
|
||||||
colorTransformation = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!colorTransformation)
|
|
||||||
FadeColour(Color4.White, 200, EasingTypes.OutQuint);
|
|
||||||
|
|
||||||
if (Hovering)
|
if (Hovering)
|
||||||
OnHover(new InputState());
|
OnHover(new InputState());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FadeColour(disabledColour, 200, EasingTypes.OutQuint);
|
FadeColour(disableColour, 200, EasingTypes.OutQuint);
|
||||||
content.ScaleTo(1, 200, EasingTypes.OutElastic);
|
content.ScaleTo(1, 200, EasingTypes.OutElastic);
|
||||||
|
|
||||||
if (Hovering)
|
if (Hovering)
|
||||||
|
@ -45,7 +45,7 @@ namespace osu.Game.Overlays
|
|||||||
private IconButton nextButton;
|
private IconButton nextButton;
|
||||||
private IconButton playlistButton;
|
private IconButton playlistButton;
|
||||||
|
|
||||||
private Color4 colorYellow;
|
private Color4 playlistButtonColor;
|
||||||
|
|
||||||
private SpriteText title, artist;
|
private SpriteText title, artist;
|
||||||
|
|
||||||
@ -60,8 +60,6 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private bool showPlaylistOnceAvailable;
|
private bool showPlaylistOnceAvailable;
|
||||||
|
|
||||||
private bool AllowBeatmapChange => !beatmapBacking.Disabled;
|
|
||||||
|
|
||||||
public MusicController()
|
public MusicController()
|
||||||
{
|
{
|
||||||
Width = 400;
|
Width = 400;
|
||||||
@ -207,12 +205,12 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
beatmapBacking.BindTo(game.Beatmap);
|
beatmapBacking.BindTo(game.Beatmap);
|
||||||
|
|
||||||
colorYellow = colours.Yellow;
|
playlistButtonColor = colours.Yellow;
|
||||||
|
|
||||||
playlist.StateChanged += (c, s) =>
|
playlist.StateChanged += (c, s) =>
|
||||||
{
|
{
|
||||||
if (AllowBeatmapChange)
|
if (!beatmapBacking.Disabled)
|
||||||
playlistButton.FadeColour(s == Visibility.Visible ? colorYellow : Color4.White, 200, EasingTypes.OutQuint);
|
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));
|
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;
|
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
|
else
|
||||||
playButton.Icon = FontAwesome.fa_play_circle_o;
|
playButton.Icon = FontAwesome.fa_play_circle_o;
|
||||||
@ -274,7 +272,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
if (track == null)
|
if (track == null)
|
||||||
{
|
{
|
||||||
if (AllowBeatmapChange)
|
if (!beatmapBacking.Disabled)
|
||||||
playlist.PlayNext();
|
playlist.PlayNext();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user