1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 20:22:55 +08:00

Merge branch 'master' into dev-overlay-counter

This commit is contained in:
Dean Herbert 2017-12-21 21:09:40 +09:00 committed by GitHub
commit 5b596765c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
56 changed files with 320 additions and 125 deletions

@ -1 +1 @@
Subproject commit 5da6990a8e68dea852495950996e1362a293dbd5 Subproject commit f4fde31f8c09305d2130064da2f7bae995be8286

View File

@ -14,7 +14,7 @@ namespace osu.Game.Rulesets.Catch.Tests
{ {
[TestFixture] [TestFixture]
[Ignore("getting CI working")] [Ignore("getting CI working")]
internal class TestCaseCatcherArea : OsuTestCase public class TestCaseCatcherArea : OsuTestCase
{ {
private RulesetInfo catchRuleset; private RulesetInfo catchRuleset;
private TestCatcherArea catcherArea; private TestCatcherArea catcherArea;

View File

@ -14,7 +14,7 @@ namespace osu.Game.Rulesets.Mania.Tests
{ {
[TestFixture] [TestFixture]
[Ignore("getting CI working")] [Ignore("getting CI working")]
internal class TestCaseManiaHitObjects : OsuTestCase public class TestCaseManiaHitObjects : OsuTestCase
{ {
public TestCaseManiaHitObjects() public TestCaseManiaHitObjects()
{ {

View File

@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Mania.Tests
{ {
[TestFixture] [TestFixture]
[Ignore("getting CI working")] [Ignore("getting CI working")]
internal class TestCaseManiaPlayfield : OsuTestCase public class TestCaseManiaPlayfield : OsuTestCase
{ {
private const double start_time = 500; private const double start_time = 500;
private const double duration = 500; private const double duration = 500;

View File

@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Osu.Tests
{ {
[TestFixture] [TestFixture]
[Ignore("getting CI working")] [Ignore("getting CI working")]
internal class TestCaseHitObjects : OsuTestCase public class TestCaseHitObjects : OsuTestCase
{ {
private FramedClock framedClock; private FramedClock framedClock;

View File

@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
{ {
[TestFixture] [TestFixture]
[Ignore("getting CI working")] [Ignore("getting CI working")]
internal class TestCaseTaikoPlayfield : OsuTestCase public class TestCaseTaikoPlayfield : OsuTestCase
{ {
private const double default_duration = 1000; private const double default_duration = 1000;
private const float scroll_time = 1000; private const float scroll_time = 1000;

View File

@ -17,7 +17,7 @@ using OpenTK.Graphics;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
internal class TestCaseBeatSyncedContainer : OsuTestCase public class TestCaseBeatSyncedContainer : OsuTestCase
{ {
private readonly MusicController mc; private readonly MusicController mc;

View File

@ -17,7 +17,7 @@ using osu.Game.Screens.Select.Filter;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
internal class TestCaseBeatmapCarousel : OsuTestCase public class TestCaseBeatmapCarousel : OsuTestCase
{ {
private TestBeatmapCarousel carousel; private TestBeatmapCarousel carousel;

View File

@ -10,7 +10,7 @@ namespace osu.Game.Tests.Visual
{ {
[TestFixture] [TestFixture]
[System.ComponentModel.Description("PlaySongSelect leaderboard/details area")] [System.ComponentModel.Description("PlaySongSelect leaderboard/details area")]
internal class TestCaseBeatmapDetailArea : OsuTestCase public class TestCaseBeatmapDetailArea : OsuTestCase
{ {
public TestCaseBeatmapDetailArea() public TestCaseBeatmapDetailArea()
{ {

View File

@ -10,7 +10,7 @@ using osu.Game.Screens.Select;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
[Description("PlaySongSelect beatmap details")] [Description("PlaySongSelect beatmap details")]
internal class TestCaseBeatmapDetails : OsuTestCase public class TestCaseBeatmapDetails : OsuTestCase
{ {
public TestCaseBeatmapDetails() public TestCaseBeatmapDetails()
{ {

View File

@ -12,7 +12,7 @@ using osu.Game.Screens.Select;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
internal class TestCaseBeatmapInfoWedge : OsuTestCase public class TestCaseBeatmapInfoWedge : OsuTestCase
{ {
private BeatmapManager beatmaps; private BeatmapManager beatmaps;
private readonly Random random; private readonly Random random;

View File

@ -10,7 +10,7 @@ using OpenTK.Input;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
[Description("bottom beatmap details")] [Description("bottom beatmap details")]
internal class TestCaseBeatmapOptionsOverlay : OsuTestCase public class TestCaseBeatmapOptionsOverlay : OsuTestCase
{ {
public TestCaseBeatmapOptionsOverlay() public TestCaseBeatmapOptionsOverlay()
{ {

View File

@ -12,7 +12,7 @@ using osu.Game.Users;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
internal class TestCaseBeatmapSetOverlay : OsuTestCase public class TestCaseBeatmapSetOverlay : OsuTestCase
{ {
private readonly BeatmapSetOverlay overlay; private readonly BeatmapSetOverlay overlay;

View File

@ -6,7 +6,7 @@ using osu.Game.Graphics.UserInterface;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
internal class TestCaseBreadcrumbs : OsuTestCase public class TestCaseBreadcrumbs : OsuTestCase
{ {
public TestCaseBreadcrumbs() public TestCaseBreadcrumbs()
{ {

View File

@ -8,7 +8,7 @@ using System.Collections.Generic;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
internal class TestCaseBreakOverlay : OsuTestCase public class TestCaseBreakOverlay : OsuTestCase
{ {
private readonly BreakOverlay breakOverlay; private readonly BreakOverlay breakOverlay;

View File

@ -9,7 +9,7 @@ using OpenTK.Graphics;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
internal class TestCaseButtonSystem : OsuTestCase public class TestCaseButtonSystem : OsuTestCase
{ {
public TestCaseButtonSystem() public TestCaseButtonSystem()
{ {

View File

@ -8,7 +8,7 @@ using osu.Game.Overlays;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
[Description("Testing chat api and overlay")] [Description("Testing chat api and overlay")]
internal class TestCaseChatDisplay : OsuTestCase public class TestCaseChatDisplay : OsuTestCase
{ {
public TestCaseChatDisplay() public TestCaseChatDisplay()
{ {

View File

@ -13,7 +13,7 @@ using osu.Game.Graphics.Cursor;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
internal class TestCaseContextMenu : OsuTestCase public class TestCaseContextMenu : OsuTestCase
{ {
private const int start_time = 0; private const int start_time = 0;
private const int duration = 1000; private const int duration = 1000;

View File

@ -7,7 +7,7 @@ using osu.Game.Overlays.Dialog;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
internal class TestCaseDialogOverlay : OsuTestCase public class TestCaseDialogOverlay : OsuTestCase
{ {
public TestCaseDialogOverlay() public TestCaseDialogOverlay()
{ {

View File

@ -12,7 +12,7 @@ using osu.Game.Users;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
internal class TestCaseDrawableRoom : OsuTestCase public class TestCaseDrawableRoom : OsuTestCase
{ {
private RulesetStore rulesets; private RulesetStore rulesets;

View File

@ -9,7 +9,7 @@ using osu.Game.Screens.Tournament.Teams;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
[Description("for tournament use")] [Description("for tournament use")]
internal class TestCaseDrawings : OsuTestCase public class TestCaseDrawings : OsuTestCase
{ {
public TestCaseDrawings() public TestCaseDrawings()
{ {

View File

@ -14,7 +14,7 @@ using osu.Framework.Configuration;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
internal class TestCaseEditorSummaryTimeline : OsuTestCase public class TestCaseEditorSummaryTimeline : OsuTestCase
{ {
private const int length = 60000; private const int length = 60000;
private readonly Random random; private readonly Random random;

View File

@ -5,7 +5,7 @@ using osu.Game.Beatmaps.ControlPoints;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
internal class TestCaseGamefield : OsuTestCase public class TestCaseGamefield : OsuTestCase
{ {
protected override void LoadComplete() protected override void LoadComplete()
{ {

View File

@ -15,7 +15,7 @@ using osu.Game.Screens.Play;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
[Description("player pause/fail screens")] [Description("player pause/fail screens")]
internal class TestCaseGameplayMenuOverlay : OsuTestCase public class TestCaseGameplayMenuOverlay : OsuTestCase
{ {
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(FailOverlay), typeof(PauseContainer) }; public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(FailOverlay), typeof(PauseContainer) };

View File

@ -8,7 +8,7 @@ using OpenTK;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
internal class TestCaseGraph : OsuTestCase public class TestCaseGraph : OsuTestCase
{ {
public TestCaseGraph() public TestCaseGraph()
{ {

View File

@ -13,7 +13,7 @@ using osu.Game.Users;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
internal class TestCaseHistoricalSection : OsuTestCase public class TestCaseHistoricalSection : OsuTestCase
{ {
public override IReadOnlyList<Type> RequiredTypes => public override IReadOnlyList<Type> RequiredTypes =>
new[] new[]

View File

@ -8,7 +8,7 @@ using OpenTK.Input;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
internal class TestCaseKeyCounter : OsuTestCase public class TestCaseKeyCounter : OsuTestCase
{ {
public TestCaseKeyCounter() public TestCaseKeyCounter()
{ {

View File

@ -11,7 +11,7 @@ using OpenTK;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
[Description("PlaySongSelect leaderboard")] [Description("PlaySongSelect leaderboard")]
internal class TestCaseLeaderboard : OsuTestCase public class TestCaseLeaderboard : OsuTestCase
{ {
private readonly Leaderboard leaderboard; private readonly Leaderboard leaderboard;

View File

@ -9,7 +9,7 @@ using osu.Game.Users;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
internal class TestCaseMedalOverlay : OsuTestCase public class TestCaseMedalOverlay : OsuTestCase
{ {
public override IReadOnlyList<Type> RequiredTypes => new[] public override IReadOnlyList<Type> RequiredTypes => new[]
{ {

View File

@ -8,17 +8,25 @@ using osu.Game.Overlays.Mods;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Screens.Play.HUD; using osu.Game.Screens.Play.HUD;
using OpenTK; using OpenTK;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Mods;
using System.Linq;
using System.Collections.Generic;
using osu.Game.Rulesets.Osu;
using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.Sprites;
using OpenTK.Graphics;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
[Description("mod select and icon display")] [Description("mod select and icon display")]
internal class TestCaseMods : OsuTestCase public class TestCaseMods : OsuTestCase
{ {
private ModSelectOverlay modSelect; private const string unranked_suffix = " (Unranked)";
private ModDisplay modDisplay;
private RulesetStore rulesets; private RulesetStore rulesets;
private ModDisplay modDisplay;
private TestModSelectOverlay modSelect;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(RulesetStore rulesets) private void load(RulesetStore rulesets)
@ -30,7 +38,7 @@ namespace osu.Game.Tests.Visual
{ {
base.LoadComplete(); base.LoadComplete();
Add(modSelect = new ModSelectOverlay Add(modSelect = new TestModSelectOverlay
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Origin = Anchor.BottomCentre, Origin = Anchor.BottomCentre,
@ -48,9 +56,156 @@ namespace osu.Game.Tests.Visual
modDisplay.Current.BindTo(modSelect.SelectedMods); modDisplay.Current.BindTo(modSelect.SelectedMods);
AddStep("Toggle", modSelect.ToggleVisibility); AddStep("Toggle", modSelect.ToggleVisibility);
AddStep("Hide", modSelect.Hide);
AddStep("Show", modSelect.Show);
foreach (var ruleset in rulesets.AvailableRulesets) foreach (var rulesetInfo in rulesets.AvailableRulesets)
AddStep(ruleset.CreateInstance().Description, () => modSelect.Ruleset.Value = ruleset); {
Ruleset ruleset = rulesetInfo.CreateInstance();
AddStep($"switch to {ruleset.Description}", () => modSelect.Ruleset.Value = rulesetInfo);
switch (ruleset) {
case OsuRuleset or:
testOsuMods(or);
break;
}
}
}
private void testOsuMods(OsuRuleset ruleset)
{
var easierMods = ruleset.GetModsFor(ModType.DifficultyReduction);
var harderMods = ruleset.GetModsFor(ModType.DifficultyIncrease);
var assistMods = ruleset.GetModsFor(ModType.Special);
var noFailMod = easierMods.FirstOrDefault(m => m is OsuModNoFail);
var hiddenMod = harderMods.FirstOrDefault(m => m is OsuModHidden);
var doubleTimeMod = harderMods.OfType<MultiMod>().FirstOrDefault(m => m.Mods.Any(a => a is OsuModDoubleTime));
var autoPilotMod = assistMods.FirstOrDefault(m => m is OsuModAutopilot);
testSingleMod(noFailMod);
testMultiMod(doubleTimeMod);
testIncompatibleMods(noFailMod, autoPilotMod);
testDeselectAll(easierMods.Where(m => !(m is MultiMod)));
testMultiplierTextColour(noFailMod, modSelect.LowMultiplierColour);
testMultiplierTextColour(hiddenMod, modSelect.HighMultiplierColour);
testMultiplierTextUnranked(autoPilotMod);
}
private void testSingleMod(Mod mod)
{
selectNext(mod);
checkSelected(mod);
selectPrevious(mod);
checkNotSelected(mod);
selectNext(mod);
selectNext(mod);
checkNotSelected(mod);
selectPrevious(mod);
selectPrevious(mod);
checkNotSelected(mod);
}
private void testMultiMod(MultiMod multiMod)
{
foreach (var mod in multiMod.Mods)
{
selectNext(mod);
checkSelected(mod);
}
for (int index = multiMod.Mods.Length - 1; index >= 0; index--)
selectPrevious(multiMod.Mods[index]);
foreach (var mod in multiMod.Mods)
checkNotSelected(mod);
}
private void testIncompatibleMods(Mod modA, Mod modB)
{
selectNext(modA);
checkSelected(modA);
checkNotSelected(modB);
selectNext(modB);
checkSelected(modB);
checkNotSelected(modA);
selectPrevious(modB);
checkNotSelected(modA);
checkNotSelected(modB);
}
private void testDeselectAll(IEnumerable<Mod> mods)
{
foreach (var mod in mods)
selectNext(mod);
AddAssert("check for any selection", () => modSelect.SelectedMods.Value.Any());
AddStep("deselect all", modSelect.DeselectAllButton.Action.Invoke);
AddAssert("check for no selection", () => !modSelect.SelectedMods.Value.Any());
}
private void testMultiplierTextColour(Mod mod, Color4 colour)
{
checkLabelColor(Color4.White);
selectNext(mod);
AddWaitStep(1, "wait for changing colour");
checkLabelColor(colour);
selectPrevious(mod);
AddWaitStep(1, "wait for changing colour");
checkLabelColor(Color4.White);
}
private void testMultiplierTextUnranked(Mod mod)
{
AddAssert("check for ranked", () => !modSelect.MultiplierLabel.Text.EndsWith(unranked_suffix));
selectNext(mod);
AddAssert("check for unranked", () => modSelect.MultiplierLabel.Text.EndsWith(unranked_suffix));
selectPrevious(mod);
AddAssert("check for ranked", () => !modSelect.MultiplierLabel.Text.EndsWith(unranked_suffix));
}
private void selectNext(Mod mod) => AddStep($"left click {mod.Name}", () => modSelect.GetModButton(mod)?.SelectNext());
private void selectPrevious(Mod mod) => AddStep($"right click {mod.Name}", () => modSelect.GetModButton(mod)?.SelectPrevious());
private void checkSelected(Mod mod)
{
AddAssert($"check {mod.Name} is selected", () =>
{
var button = modSelect.GetModButton(mod);
return modSelect.SelectedMods.Value.Single(m => m.Name == mod.Name) != null && button.SelectedMod.GetType() == mod.GetType() && button.Selected;
});
}
private void checkNotSelected(Mod mod)
{
AddAssert($"check {mod.Name} is not selected", () =>
{
var button = modSelect.GetModButton(mod);
return modSelect.SelectedMods.Value.All(m => m.GetType() != mod.GetType()) && button.SelectedMod?.GetType() != mod.GetType();
});
}
private void checkLabelColor(Color4 color) => AddAssert("check label has expected colour", () => modSelect.MultiplierLabel.Colour.AverageColour == color);
private class TestModSelectOverlay : ModSelectOverlay
{
public ModButton GetModButton(Mod mod)
{
var section = ModSectionsContainer.Children.Single(s => s.ModType == mod.Type);
return section.ButtonsContainer.OfType<ModButton>().Single(b => b.Mods.Any(m => m.GetType() == mod.GetType()));
}
public new OsuSpriteText MultiplierLabel => base.MultiplierLabel;
public new TriangleButton DeselectAllButton => base.DeselectAllButton;
public new Color4 LowMultiplierColour => base.LowMultiplierColour;
public new Color4 HighMultiplierColour => base.HighMultiplierColour;
} }
} }
} }

View File

@ -11,7 +11,7 @@ using osu.Game.Overlays;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
internal class TestCaseMusicController : OsuTestCase public class TestCaseMusicController : OsuTestCase
{ {
private readonly Bindable<WorkingBeatmap> beatmapBacking = new Bindable<WorkingBeatmap>(); private readonly Bindable<WorkingBeatmap> beatmapBacking = new Bindable<WorkingBeatmap>();

View File

@ -13,7 +13,7 @@ using osu.Game.Overlays.Notifications;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
[TestFixture] [TestFixture]
internal class TestCaseNotificationOverlay : OsuTestCase public class TestCaseNotificationOverlay : OsuTestCase
{ {
private readonly NotificationOverlay manager; private readonly NotificationOverlay manager;
@ -82,7 +82,11 @@ namespace osu.Game.Tests.Visual
private void sendProgress2() private void sendProgress2()
{ {
var n = new ProgressNotification { Text = @"Downloading Haitai..." }; var n = new ProgressNotification
{
Text = @"Downloading Haitai...",
CompletionText = "Downloaded Haitai!",
};
manager.Post(n); manager.Post(n);
progressingNotifications.Add(n); progressingNotifications.Add(n);
} }
@ -91,7 +95,11 @@ namespace osu.Game.Tests.Visual
private void sendProgress1() private void sendProgress1()
{ {
var n = new ProgressNotification { Text = @"Uploading to BSS..." }; var n = new ProgressNotification
{
Text = @"Uploading to BSS...",
CompletionText = "Uploaded to BSS!",
};
manager.Post(n); manager.Post(n);
progressingNotifications.Add(n); progressingNotifications.Add(n);
} }

View File

@ -7,7 +7,7 @@ using osu.Game.Overlays;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
internal class TestCaseOnScreenDisplay : OsuTestCase public class TestCaseOnScreenDisplay : OsuTestCase
{ {
private FrameworkConfigManager config; private FrameworkConfigManager config;
private Bindable<FrameSync> frameSyncMode; private Bindable<FrameSync> frameSyncMode;

View File

@ -19,7 +19,7 @@ using osu.Game.Tests.Platform;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
internal class TestCasePlaySongSelect : OsuTestCase public class TestCasePlaySongSelect : OsuTestCase
{ {
private BeatmapManager manager; private BeatmapManager manager;

View File

@ -8,7 +8,7 @@ using osu.Game.Screens.Play;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
internal class TestCaseReplay : TestCasePlayer public class TestCaseReplay : TestCasePlayer
{ {
protected override Player CreatePlayer(WorkingBeatmap beatmap, Ruleset ruleset) protected override Player CreatePlayer(WorkingBeatmap beatmap, Ruleset ruleset)
{ {

View File

@ -8,7 +8,7 @@ using osu.Game.Screens.Play.ReplaySettings;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
internal class TestCaseReplaySettingsOverlay : OsuTestCase public class TestCaseReplaySettingsOverlay : OsuTestCase
{ {
public TestCaseReplaySettingsOverlay() public TestCaseReplaySettingsOverlay()
{ {

View File

@ -11,7 +11,7 @@ using osu.Game.Users;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
internal class TestCaseResults : OsuTestCase public class TestCaseResults : OsuTestCase
{ {
private BeatmapManager beatmaps; private BeatmapManager beatmaps;

View File

@ -11,7 +11,7 @@ using osu.Game.Users;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
internal class TestCaseRoomInspector : OsuTestCase public class TestCaseRoomInspector : OsuTestCase
{ {
private RulesetStore rulesets; private RulesetStore rulesets;

View File

@ -10,7 +10,7 @@ using OpenTK;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
internal class TestCaseScoreCounter : OsuTestCase public class TestCaseScoreCounter : OsuTestCase
{ {
public TestCaseScoreCounter() public TestCaseScoreCounter()
{ {

View File

@ -5,7 +5,7 @@ using osu.Game.Overlays;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
internal class TestCaseSettings : OsuTestCase public class TestCaseSettings : OsuTestCase
{ {
private readonly SettingsOverlay settings; private readonly SettingsOverlay settings;

View File

@ -5,7 +5,7 @@ using osu.Game.Screens.Play;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
internal class TestCaseSkipButton : OsuTestCase public class TestCaseSkipButton : OsuTestCase
{ {
protected override void LoadComplete() protected override void LoadComplete()
{ {

View File

@ -10,7 +10,7 @@ using osu.Game.Screens.Play;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
internal class TestCaseSongProgress : OsuTestCase public class TestCaseSongProgress : OsuTestCase
{ {
private readonly SongProgress progress; private readonly SongProgress progress;
private readonly SongProgressGraph graph; private readonly SongProgressGraph graph;

View File

@ -14,7 +14,7 @@ using OpenTK.Graphics;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
internal class TestCaseStoryboard : OsuTestCase public class TestCaseStoryboard : OsuTestCase
{ {
private readonly Bindable<WorkingBeatmap> beatmapBacking = new Bindable<WorkingBeatmap>(); private readonly Bindable<WorkingBeatmap> beatmapBacking = new Bindable<WorkingBeatmap>();

View File

@ -10,7 +10,7 @@ using OpenTK;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
internal class TestCaseTextAwesome : OsuTestCase public class TestCaseTextAwesome : OsuTestCase
{ {
public TestCaseTextAwesome() public TestCaseTextAwesome()
{ {

View File

@ -7,7 +7,7 @@ using osu.Game.Graphics.UserInterface;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
[Description("mostly back button")] [Description("mostly back button")]
internal class TestCaseTwoLayerButton : OsuTestCase public class TestCaseTwoLayerButton : OsuTestCase
{ {
public TestCaseTwoLayerButton() public TestCaseTwoLayerButton()
{ {

View File

@ -8,7 +8,7 @@ using OpenTK;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
internal class TestCaseUserPanel : OsuTestCase public class TestCaseUserPanel : OsuTestCase
{ {
public TestCaseUserPanel() public TestCaseUserPanel()
{ {

View File

@ -8,7 +8,7 @@ using osu.Game.Users;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
internal class TestCaseUserProfile : OsuTestCase public class TestCaseUserProfile : OsuTestCase
{ {
public TestCaseUserProfile() public TestCaseUserProfile()
{ {

View File

@ -13,7 +13,7 @@ using System.Collections.Generic;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
internal class TestCaseUserRanks : OsuTestCase public class TestCaseUserRanks : OsuTestCase
{ {
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(DrawableProfileScore), typeof(RanksSection) }; public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(DrawableProfileScore), typeof(RanksSection) };

View File

@ -15,7 +15,7 @@ using osu.Game.Screens.Edit.Screens.Compose.Timeline;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {
internal class TestCaseWaveform : OsuTestCase public class TestCaseWaveform : OsuTestCase
{ {
private readonly Bindable<WorkingBeatmap> beatmapBacking = new Bindable<WorkingBeatmap>(); private readonly Bindable<WorkingBeatmap> beatmapBacking = new Bindable<WorkingBeatmap>();

View File

@ -134,6 +134,7 @@ namespace osu.Game.Beatmaps
var notification = new ProgressNotification var notification = new ProgressNotification
{ {
Text = "Beatmap import is initialising...", Text = "Beatmap import is initialising...",
CompletionText = "Import successful!",
Progress = 0, Progress = 0,
State = ProgressNotificationState.Active, State = ProgressNotificationState.Active,
}; };
@ -245,8 +246,9 @@ namespace osu.Game.Beatmaps
return; return;
} }
ProgressNotification downloadNotification = new ProgressNotification var downloadNotification = new ProgressNotification
{ {
CompletionText = $"Imported {beatmapSetInfo.Metadata.Artist} - {beatmapSetInfo.Metadata.Title}!",
Text = $"Downloading {beatmapSetInfo.Metadata.Artist} - {beatmapSetInfo.Metadata.Title}", Text = $"Downloading {beatmapSetInfo.Metadata.Artist} - {beatmapSetInfo.Metadata.Title}",
}; };
@ -665,6 +667,7 @@ namespace osu.Game.Beatmaps
var notification = new ProgressNotification var notification = new ProgressNotification
{ {
Progress = 0, Progress = 0,
CompletionText = "Deleted all beatmaps!",
State = ProgressNotificationState.Active, State = ProgressNotificationState.Active,
}; };

View File

@ -5,11 +5,12 @@ using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Linq; using System.Linq;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Input;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
namespace osu.Game.Input.Bindings namespace osu.Game.Input.Bindings
{ {
public class GlobalKeyBindingInputManager : DatabasedKeyBindingInputManager<GlobalAction> public class GlobalKeyBindingInputManager : DatabasedKeyBindingInputManager<GlobalAction>, IHandleGlobalInput
{ {
private readonly Drawable handler; private readonly Drawable handler;

View File

@ -17,22 +17,21 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Mods namespace osu.Game.Overlays.Mods
{ {
public class ModSelectOverlay : WaveOverlayContainer public class ModSelectOverlay : WaveOverlayContainer
{ {
private const int button_duration = 700;
private const int ranked_multiplier_duration = 700;
private const float content_width = 0.8f; private const float content_width = 0.8f;
private Color4 lowMultiplierColour, highMultiplierColour; protected Color4 LowMultiplierColour, HighMultiplierColour;
private readonly OsuSpriteText rankedLabel; protected readonly TriangleButton DeselectAllButton;
private readonly OsuSpriteText multiplierLabel; protected readonly OsuSpriteText MultiplierLabel;
private readonly FillFlowContainer rankedMultiplerContainer; private readonly FillFlowContainer footerContainer;
private readonly FillFlowContainer<ModSection> modSectionsContainer; protected readonly FillFlowContainer<ModSection> ModSectionsContainer;
public readonly Bindable<IEnumerable<Mod>> SelectedMods = new Bindable<IEnumerable<Mod>>(); public readonly Bindable<IEnumerable<Mod>> SelectedMods = new Bindable<IEnumerable<Mod>>();
@ -42,7 +41,7 @@ namespace osu.Game.Overlays.Mods
{ {
var instance = newRuleset.CreateInstance(); var instance = newRuleset.CreateInstance();
foreach (ModSection section in modSectionsContainer.Children) foreach (ModSection section in ModSectionsContainer.Children)
section.Mods = instance.GetModsFor(section.ModType); section.Mods = instance.GetModsFor(section.ModType);
refreshSelectedMods(); refreshSelectedMods();
} }
@ -50,8 +49,8 @@ namespace osu.Game.Overlays.Mods
[BackgroundDependencyLoader(permitNulls: true)] [BackgroundDependencyLoader(permitNulls: true)]
private void load(OsuColour colours, OsuGame osu, RulesetStore rulesets) private void load(OsuColour colours, OsuGame osu, RulesetStore rulesets)
{ {
lowMultiplierColour = colours.Red; LowMultiplierColour = colours.Red;
highMultiplierColour = colours.Green; HighMultiplierColour = colours.Green;
if (osu != null) if (osu != null)
Ruleset.BindTo(osu.Ruleset); Ruleset.BindTo(osu.Ruleset);
@ -66,14 +65,14 @@ namespace osu.Game.Overlays.Mods
{ {
base.PopOut(); base.PopOut();
rankedMultiplerContainer.MoveToX(rankedMultiplerContainer.DrawSize.X, APPEAR_DURATION, Easing.InSine); footerContainer.MoveToX(footerContainer.DrawSize.X, DISAPPEAR_DURATION, Easing.InSine);
rankedMultiplerContainer.FadeOut(APPEAR_DURATION, Easing.InSine); footerContainer.FadeOut(DISAPPEAR_DURATION, Easing.InSine);
foreach (ModSection section in modSectionsContainer.Children) foreach (ModSection section in ModSectionsContainer.Children)
{ {
section.ButtonsContainer.TransformSpacingTo(new Vector2(100f, 0f), APPEAR_DURATION, Easing.InSine); section.ButtonsContainer.TransformSpacingTo(new Vector2(100f, 0f), DISAPPEAR_DURATION, Easing.InSine);
section.ButtonsContainer.MoveToX(100f, APPEAR_DURATION, Easing.InSine); section.ButtonsContainer.MoveToX(100f, DISAPPEAR_DURATION, Easing.InSine);
section.ButtonsContainer.FadeOut(APPEAR_DURATION, Easing.InSine); section.ButtonsContainer.FadeOut(DISAPPEAR_DURATION, Easing.InSine);
} }
} }
@ -81,27 +80,28 @@ namespace osu.Game.Overlays.Mods
{ {
base.PopIn(); base.PopIn();
rankedMultiplerContainer.MoveToX(0, ranked_multiplier_duration, Easing.OutQuint); footerContainer.MoveToX(0, APPEAR_DURATION, Easing.OutQuint);
rankedMultiplerContainer.FadeIn(ranked_multiplier_duration, Easing.OutQuint); footerContainer.FadeIn(APPEAR_DURATION, Easing.OutQuint);
foreach (ModSection section in modSectionsContainer.Children) foreach (ModSection section in ModSectionsContainer.Children)
{ {
section.ButtonsContainer.TransformSpacingTo(new Vector2(50f, 0f), button_duration, Easing.OutQuint); section.ButtonsContainer.TransformSpacingTo(new Vector2(50f, 0f), APPEAR_DURATION, Easing.OutQuint);
section.ButtonsContainer.MoveToX(0, button_duration, Easing.OutQuint); section.ButtonsContainer.MoveToX(0, APPEAR_DURATION, Easing.OutQuint);
section.ButtonsContainer.FadeIn(button_duration, Easing.OutQuint); section.ButtonsContainer.FadeIn(APPEAR_DURATION, Easing.OutQuint);
} }
} }
public void DeselectAll() public void DeselectAll()
{ {
foreach (ModSection section in modSectionsContainer.Children) foreach (ModSection section in ModSectionsContainer.Children)
section.DeselectAll(); section.DeselectAll();
refreshSelectedMods();
} }
public void DeselectTypes(Type[] modTypes) public void DeselectTypes(Type[] modTypes)
{ {
if (modTypes.Length == 0) return; if (modTypes.Length == 0) return;
foreach (ModSection section in modSectionsContainer.Children) foreach (ModSection section in ModSectionsContainer.Children)
section.DeselectTypes(modTypes); section.DeselectTypes(modTypes);
} }
@ -114,7 +114,7 @@ namespace osu.Game.Overlays.Mods
private void refreshSelectedMods() private void refreshSelectedMods()
{ {
SelectedMods.Value = modSectionsContainer.Children.SelectMany(s => s.SelectedMods).ToArray(); SelectedMods.Value = ModSectionsContainer.Children.SelectMany(s => s.SelectedMods).ToArray();
double multiplier = 1.0; double multiplier = 1.0;
bool ranked = true; bool ranked = true;
@ -129,16 +129,16 @@ namespace osu.Game.Overlays.Mods
// 1.05x // 1.05x
// 1.20x // 1.20x
multiplierLabel.Text = $"{multiplier:N2}x"; MultiplierLabel.Text = $"{multiplier:N2}x";
string rankedString = ranked ? "Ranked" : "Unranked"; if (!ranked)
rankedLabel.Text = $@"{rankedString}, Score Multiplier: "; MultiplierLabel.Text += " (Unranked)";
if (multiplier > 1.0) if (multiplier > 1.0)
multiplierLabel.FadeColour(highMultiplierColour, 200); MultiplierLabel.FadeColour(HighMultiplierColour, 200);
else if (multiplier < 1.0) else if (multiplier < 1.0)
multiplierLabel.FadeColour(lowMultiplierColour, 200); MultiplierLabel.FadeColour(LowMultiplierColour, 200);
else else
multiplierLabel.FadeColour(Color4.White, 200); MultiplierLabel.FadeColour(Color4.White, 200);
} }
public ModSelectOverlay() public ModSelectOverlay()
@ -232,7 +232,7 @@ namespace osu.Game.Overlays.Mods
}, },
new OsuSpriteText new OsuSpriteText
{ {
Text = @"Others are just for fun", Text = @"Others are just for fun.",
TextSize = 18, TextSize = 18,
Shadow = true, Shadow = true,
}, },
@ -241,7 +241,7 @@ namespace osu.Game.Overlays.Mods
}, },
}, },
// Body // Body
modSectionsContainer = new FillFlowContainer<ModSection> ModSectionsContainer = new FillFlowContainer<ModSection>
{ {
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
@ -289,7 +289,7 @@ namespace osu.Game.Overlays.Mods
Colour = new Color4(172, 20, 116, 255), Colour = new Color4(172, 20, 116, 255),
Alpha = 0.5f, Alpha = 0.5f,
}, },
rankedMultiplerContainer = new FillFlowContainer footerContainer = new FillFlowContainer
{ {
Origin = Anchor.BottomCentre, Origin = Anchor.BottomCentre,
Anchor = Anchor.BottomCentre, Anchor = Anchor.BottomCentre,
@ -299,26 +299,42 @@ namespace osu.Game.Overlays.Mods
Direction = FillDirection.Horizontal, Direction = FillDirection.Horizontal,
Padding = new MarginPadding Padding = new MarginPadding
{ {
Top = 20, Vertical = 15
Bottom = 20,
}, },
Children = new Drawable[] Children = new Drawable[]
{ {
rankedLabel = new OsuSpriteText DeselectAllButton = new TriangleButton
{ {
Text = @"Ranked, Score Multiplier: ", Width = 180,
Text = "Deselect All",
Action = DeselectAll,
Margin = new MarginPadding
{
Right = 20
}
},
new OsuSpriteText
{
Text = @"Score Multiplier: ",
TextSize = 30, TextSize = 30,
Shadow = true, Shadow = true,
Margin = new MarginPadding
{
Top = 5
}
}, },
multiplierLabel = new OsuSpriteText MultiplierLabel = new OsuSpriteText
{ {
Font = @"Exo2.0-Bold", Font = @"Exo2.0-Bold",
Text = @"1.00x",
TextSize = 30, TextSize = 30,
Shadow = true, Shadow = true,
}, Margin = new MarginPadding
}, {
}, Top = 5
}
}
}
}
}, },
}, },
}, },

View File

@ -22,6 +22,8 @@ namespace osu.Game.Overlays.Notifications
} }
} }
public string CompletionText { get; set; } = "Task has completed!";
public float Progress public float Progress
{ {
get { return progressBar.Progress; } get { return progressBar.Progress; }
@ -87,7 +89,7 @@ namespace osu.Game.Overlays.Notifications
protected virtual Notification CreateCompletionNotification() => new ProgressCompletionNotification protected virtual Notification CreateCompletionNotification() => new ProgressCompletionNotification
{ {
Activated = CompletionClickAction, Activated = CompletionClickAction,
Text = "Task has completed!" Text = CompletionText
}; };
protected virtual void Completed() protected virtual void Completed()

View File

@ -53,6 +53,7 @@ namespace osu.Game.Overlays.Profile
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Height = cover_height, Height = cover_height,
Masking = true,
Children = new Drawable[] Children = new Drawable[]
{ {
new Box new Box
@ -324,8 +325,7 @@ namespace osu.Game.Overlays.Profile
FillMode = FillMode.Fill, FillMode = FillMode.Fill,
OnLoadComplete = d => d.FadeInFromZero(200), OnLoadComplete = d => d.FadeInFromZero(200),
Depth = float.MaxValue, Depth = float.MaxValue,
}, }, coverContainer.Add);
coverContainer.Add);
if (user.IsSupporter) supporterTag.Show(); if (user.IsSupporter) supporterTag.Show();
@ -514,7 +514,7 @@ namespace osu.Game.Overlays.Profile
{ {
set set
{ {
if(value != null) if (value != null)
content.Action = () => Process.Start(value); content.Action = () => Process.Start(value);
} }
} }

View File

@ -26,6 +26,8 @@ namespace osu.Game.Screens.Play
protected override bool BlockPassThroughKeyboard => true; protected override bool BlockPassThroughKeyboard => true;
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true;
public Action OnRetry; public Action OnRetry;
public Action OnQuit; public Action OnQuit;
@ -173,6 +175,7 @@ namespace osu.Game.Screens.Play
} }
private int _selectionIndex = -1; private int _selectionIndex = -1;
private int selectionIndex private int selectionIndex
{ {
get { return _selectionIndex; } get { return _selectionIndex; }
@ -195,26 +198,26 @@ namespace osu.Game.Screens.Play
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
{ {
if (args.Repeat) if (!args.Repeat)
return false;
switch (args.Key)
{ {
case Key.Up: switch (args.Key)
if (selectionIndex == -1 || selectionIndex == 0) {
selectionIndex = InternalButtons.Count - 1; case Key.Up:
else if (selectionIndex == -1 || selectionIndex == 0)
selectionIndex--; selectionIndex = InternalButtons.Count - 1;
return true; else
case Key.Down: selectionIndex--;
if (selectionIndex == -1 || selectionIndex == InternalButtons.Count - 1) return true;
selectionIndex = 0; case Key.Down:
else if (selectionIndex == -1 || selectionIndex == InternalButtons.Count - 1)
selectionIndex++; selectionIndex = 0;
return true; else
selectionIndex++;
return true;
}
} }
return false; return base.OnKeyDown(state, args);
} }
private void buttonSelectionChanged(DialogButton button, bool isSelected) private void buttonSelectionChanged(DialogButton button, bool isSelected)

View File

@ -17,6 +17,7 @@ using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Drawables; using osu.Game.Beatmaps.Drawables;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
@ -26,6 +27,7 @@ namespace osu.Game.Screens.Select.Carousel
{ {
private Action<BeatmapSetInfo> deleteRequested; private Action<BeatmapSetInfo> deleteRequested;
private Action<BeatmapSetInfo> restoreHiddenRequested; private Action<BeatmapSetInfo> restoreHiddenRequested;
private Action<int> viewDetails;
private readonly BeatmapSetInfo beatmapSet; private readonly BeatmapSetInfo beatmapSet;
@ -37,14 +39,16 @@ namespace osu.Game.Screens.Select.Carousel
beatmapSet = set.BeatmapSet; beatmapSet = set.BeatmapSet;
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader(true)]
private void load(LocalisationEngine localisation, BeatmapManager manager) private void load(LocalisationEngine localisation, BeatmapManager manager, BeatmapSetOverlay beatmapOverlay)
{ {
if (localisation == null) if (localisation == null)
throw new ArgumentNullException(nameof(localisation)); throw new ArgumentNullException(nameof(localisation));
restoreHiddenRequested = s => s.Beatmaps.ForEach(manager.Restore); restoreHiddenRequested = s => s.Beatmaps.ForEach(manager.Restore);
deleteRequested = manager.Delete; deleteRequested = manager.Delete;
if (beatmapOverlay != null)
viewDetails = beatmapOverlay.ShowBeatmapSet;
Children = new Drawable[] Children = new Drawable[]
{ {
@ -96,6 +100,9 @@ namespace osu.Game.Screens.Select.Carousel
if (Item.State == CarouselItemState.NotSelected) if (Item.State == CarouselItemState.NotSelected)
items.Add(new OsuMenuItem("Expand", MenuItemType.Highlighted, () => Item.State.Value = CarouselItemState.Selected)); items.Add(new OsuMenuItem("Expand", MenuItemType.Highlighted, () => Item.State.Value = CarouselItemState.Selected));
if (beatmapSet.OnlineBeatmapSetID != null)
items.Add(new OsuMenuItem("Details...", MenuItemType.Standard, () => viewDetails?.Invoke(beatmapSet.OnlineBeatmapSetID.Value)));
if (beatmapSet.Beatmaps.Any(b => b.Hidden)) if (beatmapSet.Beatmaps.Any(b => b.Hidden))
items.Add(new OsuMenuItem("Restore all hidden", MenuItemType.Standard, () => restoreHiddenRequested?.Invoke(beatmapSet))); items.Add(new OsuMenuItem("Restore all hidden", MenuItemType.Standard, () => restoreHiddenRequested?.Invoke(beatmapSet)));