From f5bea077a09bcca057d6ad628a7e9977f75f7399 Mon Sep 17 00:00:00 2001 From: Ninjaprawn Date: Fri, 8 Dec 2017 11:26:34 +1100 Subject: [PATCH 001/169] Subclass ModIcon to remove the tooltip text --- osu.Game/Overlays/Mods/ModButton.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index 77b7c3add2..22a39b470c 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -204,13 +204,13 @@ namespace osu.Game.Overlays.Mods { iconsContainer.AddRange(new[] { - backgroundIcon = new ModIcon(Mods[1]) + backgroundIcon = new DisplayableModIcon(Mods[1]) { Origin = Anchor.BottomRight, Anchor = Anchor.BottomRight, Position = new Vector2(1.5f), }, - foregroundIcon = new ModIcon(Mods[0]) + foregroundIcon = new DisplayableModIcon(Mods[0]) { Origin = Anchor.BottomRight, Anchor = Anchor.BottomRight, @@ -220,7 +220,7 @@ namespace osu.Game.Overlays.Mods } else { - iconsContainer.Add(foregroundIcon = new ModIcon(Mod) + iconsContainer.Add(foregroundIcon = new DisplayableModIcon(Mod) { Origin = Anchor.Centre, Anchor = Anchor.Centre, @@ -259,5 +259,15 @@ namespace osu.Game.Overlays.Mods Mod = mod; } + + private class DisplayableModIcon : ModIcon { + + public string TooltipText => null; + + public DisplayableModIcon(Mod mod) : base(mod) { + + } + + } } } From 9b3e666a077ac83d3cf951a7c91d2f12dbf45ce3 Mon Sep 17 00:00:00 2001 From: Ninjaprawn Date: Fri, 8 Dec 2017 13:53:49 +1100 Subject: [PATCH 002/169] Added IgnoreTooltip to all classes required --- osu.Game.Tests/Visual/TestCaseTextAwesome.cs | 1 + osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs | 1 + osu.Game/Graphics/UserInterface/OsuSliderBar.cs | 1 + osu.Game/Overlays/BeatmapSet/AuthorInfo.cs | 1 + osu.Game/Overlays/BeatmapSet/BasicStats.cs | 1 + osu.Game/Overlays/Profile/ProfileHeader.cs | 1 + osu.Game/Overlays/Profile/Sections/Ranks/DrawableScore.cs | 1 + osu.Game/Overlays/Settings/SettingsItem.cs | 1 + osu.Game/Rulesets/UI/ModIcon.cs | 2 ++ osu.Game/Screens/Multiplayer/DrawableGameType.cs | 1 + osu.Game/Screens/Multiplayer/RoomInspector.cs | 1 + osu.Game/Tests/Visual/TestCasePerformancePoints.cs | 1 + 12 files changed, 13 insertions(+) diff --git a/osu.Game.Tests/Visual/TestCaseTextAwesome.cs b/osu.Game.Tests/Visual/TestCaseTextAwesome.cs index 37905a1883..1941aa76aa 100644 --- a/osu.Game.Tests/Visual/TestCaseTextAwesome.cs +++ b/osu.Game.Tests/Visual/TestCaseTextAwesome.cs @@ -36,6 +36,7 @@ namespace osu.Game.Tests.Visual private class Icon : Container, IHasTooltip { public string TooltipText { get; } + public bool IgnoreTooltip => false; public Icon(FontAwesome fa) { diff --git a/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs b/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs index 7f193a0e1a..08c9ffadc2 100644 --- a/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs @@ -103,6 +103,7 @@ namespace osu.Game.Graphics.UserInterface private class CapsWarning : SpriteIcon, IHasTooltip { public string TooltipText => @"Caps lock is active"; + public bool IgnoreTooltip => false; public CapsWarning() { diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index fd75269610..f2cc668c5e 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -46,6 +46,7 @@ namespace osu.Game.Graphics.UserInterface return Current.Value.ToString(); } } + public bool IgnoreTooltip => false; private Color4 accentColour; public Color4 AccentColour diff --git a/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs b/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs index 46ee5a9cdb..4df4e48ab7 100644 --- a/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs +++ b/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs @@ -126,6 +126,7 @@ namespace osu.Game.Overlays.BeatmapSet private class ClickableArea : OsuClickableContainer, IHasTooltip { public string TooltipText => @"View Profile"; + public bool IgnoreTooltip => false; } } } diff --git a/osu.Game/Overlays/BeatmapSet/BasicStats.cs b/osu.Game/Overlays/BeatmapSet/BasicStats.cs index 3ecff85bee..29e19f3370 100644 --- a/osu.Game/Overlays/BeatmapSet/BasicStats.cs +++ b/osu.Game/Overlays/BeatmapSet/BasicStats.cs @@ -68,6 +68,7 @@ namespace osu.Game.Overlays.BeatmapSet private readonly OsuSpriteText value; public string TooltipText => name; + public bool IgnoreTooltip => false; public string Value { get { return value.Text; } diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index c7bc5c1d93..e36385b7f4 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -531,6 +531,7 @@ namespace osu.Game.Overlays.Profile public class ProfileLink : LinkText, IHasTooltip { public string TooltipText => "View Profile in Browser"; + public bool IgnoreTooltip => false; public ProfileLink(User user) { diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableScore.cs b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableScore.cs index 35f4778047..9aac6ec56c 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableScore.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableScore.cs @@ -185,6 +185,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks private class MetadataContainer : OsuHoverContainer, IHasTooltip { public string TooltipText { get; set; } + public bool IgnoreTooltip => false; public MetadataContainer(string title, string artist) { diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index d9aac58c54..3731d385f3 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -158,6 +158,7 @@ namespace osu.Game.Overlays.Settings } public string TooltipText => "Revert to default"; + public bool IgnoreTooltip => false; public override bool HandleInput => true; diff --git a/osu.Game/Rulesets/UI/ModIcon.cs b/osu.Game/Rulesets/UI/ModIcon.cs index 5ca3d9521b..8cabd4f757 100644 --- a/osu.Game/Rulesets/UI/ModIcon.cs +++ b/osu.Game/Rulesets/UI/ModIcon.cs @@ -29,6 +29,7 @@ namespace osu.Game.Rulesets.UI private readonly ModType type; public string TooltipText { get; } + public virtual bool IgnoreTooltip { get; } public ModIcon(Mod mod) { @@ -37,6 +38,7 @@ namespace osu.Game.Rulesets.UI type = mod.Type; TooltipText = mod.Name; + IgnoreTooltip = false; Size = new Vector2(size); diff --git a/osu.Game/Screens/Multiplayer/DrawableGameType.cs b/osu.Game/Screens/Multiplayer/DrawableGameType.cs index 5b85fcc4da..5966abf865 100644 --- a/osu.Game/Screens/Multiplayer/DrawableGameType.cs +++ b/osu.Game/Screens/Multiplayer/DrawableGameType.cs @@ -16,6 +16,7 @@ namespace osu.Game.Screens.Multiplayer private readonly GameType type; public string TooltipText => type.Name; + public bool IgnoreTooltip => false; public DrawableGameType(GameType type) { diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index 8d7401500f..bafafeb1ec 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -384,6 +384,7 @@ namespace osu.Game.Screens.Multiplayer private readonly User user; public string TooltipText => user.Username; + public bool IgnoreTooltip => false; public UserTile(User user) { diff --git a/osu.Game/Tests/Visual/TestCasePerformancePoints.cs b/osu.Game/Tests/Visual/TestCasePerformancePoints.cs index 6da14e9b12..cf6a4946bc 100644 --- a/osu.Game/Tests/Visual/TestCasePerformancePoints.cs +++ b/osu.Game/Tests/Visual/TestCasePerformancePoints.cs @@ -144,6 +144,7 @@ namespace osu.Game.Tests.Visual private bool isSelected; public string TooltipText => text.Text; + public bool IgnoreTooltip => false; public BeatmapDisplay(BeatmapInfo beatmap) { From a491710fe42d61e2d77bbad23fe9ca55426ba24f Mon Sep 17 00:00:00 2001 From: Ninjaprawn Date: Fri, 8 Dec 2017 13:55:54 +1100 Subject: [PATCH 003/169] Override IgnoreTooltip in DisplayableModIcon --- osu.Game/Overlays/Mods/ModButton.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index 22a39b470c..e4a4413d09 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -35,6 +35,7 @@ namespace osu.Game.Overlays.Mods public Action Action; // Passed the selected mod or null if none public string TooltipText => (SelectedMod?.Description ?? Mods.FirstOrDefault()?.Description) ?? string.Empty; + public bool IgnoreTooltip => false; private const Easing mod_switch_easing = Easing.InOutSine; private const double mod_switch_duration = 120; @@ -262,10 +263,10 @@ namespace osu.Game.Overlays.Mods private class DisplayableModIcon : ModIcon { - public string TooltipText => null; + public override bool IgnoreTooltip { get; } public DisplayableModIcon(Mod mod) : base(mod) { - + IgnoreTooltip = true; } } From 71e59bc9e753777a86739446e3fb691b27bfb738 Mon Sep 17 00:00:00 2001 From: Ninjaprawn Date: Sat, 16 Dec 2017 20:16:40 +1100 Subject: [PATCH 004/169] Removed the IgnoreTooltip property --- osu.Game.Tests/Visual/TestCaseTextAwesome.cs | 1 - osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs | 1 - osu.Game/Graphics/UserInterface/OsuSliderBar.cs | 1 - osu.Game/Overlays/BeatmapSet/AuthorInfo.cs | 1 - osu.Game/Overlays/BeatmapSet/BasicStats.cs | 1 - osu.Game/Overlays/Profile/ProfileHeader.cs | 1 - osu.Game/Overlays/Profile/Sections/Ranks/DrawableScore.cs | 1 - osu.Game/Overlays/Settings/SettingsItem.cs | 1 - osu.Game/Rulesets/UI/ModIcon.cs | 4 +--- osu.Game/Screens/Multiplayer/DrawableGameType.cs | 1 - osu.Game/Screens/Multiplayer/RoomInspector.cs | 1 - osu.Game/Tests/Visual/TestCasePerformancePoints.cs | 1 - 12 files changed, 1 insertion(+), 14 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseTextAwesome.cs b/osu.Game.Tests/Visual/TestCaseTextAwesome.cs index 1941aa76aa..37905a1883 100644 --- a/osu.Game.Tests/Visual/TestCaseTextAwesome.cs +++ b/osu.Game.Tests/Visual/TestCaseTextAwesome.cs @@ -36,7 +36,6 @@ namespace osu.Game.Tests.Visual private class Icon : Container, IHasTooltip { public string TooltipText { get; } - public bool IgnoreTooltip => false; public Icon(FontAwesome fa) { diff --git a/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs b/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs index 08c9ffadc2..7f193a0e1a 100644 --- a/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs @@ -103,7 +103,6 @@ namespace osu.Game.Graphics.UserInterface private class CapsWarning : SpriteIcon, IHasTooltip { public string TooltipText => @"Caps lock is active"; - public bool IgnoreTooltip => false; public CapsWarning() { diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index f2cc668c5e..fd75269610 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -46,7 +46,6 @@ namespace osu.Game.Graphics.UserInterface return Current.Value.ToString(); } } - public bool IgnoreTooltip => false; private Color4 accentColour; public Color4 AccentColour diff --git a/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs b/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs index 4df4e48ab7..46ee5a9cdb 100644 --- a/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs +++ b/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs @@ -126,7 +126,6 @@ namespace osu.Game.Overlays.BeatmapSet private class ClickableArea : OsuClickableContainer, IHasTooltip { public string TooltipText => @"View Profile"; - public bool IgnoreTooltip => false; } } } diff --git a/osu.Game/Overlays/BeatmapSet/BasicStats.cs b/osu.Game/Overlays/BeatmapSet/BasicStats.cs index 29e19f3370..3ecff85bee 100644 --- a/osu.Game/Overlays/BeatmapSet/BasicStats.cs +++ b/osu.Game/Overlays/BeatmapSet/BasicStats.cs @@ -68,7 +68,6 @@ namespace osu.Game.Overlays.BeatmapSet private readonly OsuSpriteText value; public string TooltipText => name; - public bool IgnoreTooltip => false; public string Value { get { return value.Text; } diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index e36385b7f4..c7bc5c1d93 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -531,7 +531,6 @@ namespace osu.Game.Overlays.Profile public class ProfileLink : LinkText, IHasTooltip { public string TooltipText => "View Profile in Browser"; - public bool IgnoreTooltip => false; public ProfileLink(User user) { diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableScore.cs b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableScore.cs index 9aac6ec56c..35f4778047 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableScore.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableScore.cs @@ -185,7 +185,6 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks private class MetadataContainer : OsuHoverContainer, IHasTooltip { public string TooltipText { get; set; } - public bool IgnoreTooltip => false; public MetadataContainer(string title, string artist) { diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index 3731d385f3..d9aac58c54 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -158,7 +158,6 @@ namespace osu.Game.Overlays.Settings } public string TooltipText => "Revert to default"; - public bool IgnoreTooltip => false; public override bool HandleInput => true; diff --git a/osu.Game/Rulesets/UI/ModIcon.cs b/osu.Game/Rulesets/UI/ModIcon.cs index 8cabd4f757..90f63aeab6 100644 --- a/osu.Game/Rulesets/UI/ModIcon.cs +++ b/osu.Game/Rulesets/UI/ModIcon.cs @@ -28,8 +28,7 @@ namespace osu.Game.Rulesets.UI private readonly ModType type; - public string TooltipText { get; } - public virtual bool IgnoreTooltip { get; } + public virtual string TooltipText { get; } public ModIcon(Mod mod) { @@ -38,7 +37,6 @@ namespace osu.Game.Rulesets.UI type = mod.Type; TooltipText = mod.Name; - IgnoreTooltip = false; Size = new Vector2(size); diff --git a/osu.Game/Screens/Multiplayer/DrawableGameType.cs b/osu.Game/Screens/Multiplayer/DrawableGameType.cs index 5966abf865..5b85fcc4da 100644 --- a/osu.Game/Screens/Multiplayer/DrawableGameType.cs +++ b/osu.Game/Screens/Multiplayer/DrawableGameType.cs @@ -16,7 +16,6 @@ namespace osu.Game.Screens.Multiplayer private readonly GameType type; public string TooltipText => type.Name; - public bool IgnoreTooltip => false; public DrawableGameType(GameType type) { diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index bafafeb1ec..8d7401500f 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -384,7 +384,6 @@ namespace osu.Game.Screens.Multiplayer private readonly User user; public string TooltipText => user.Username; - public bool IgnoreTooltip => false; public UserTile(User user) { diff --git a/osu.Game/Tests/Visual/TestCasePerformancePoints.cs b/osu.Game/Tests/Visual/TestCasePerformancePoints.cs index cf6a4946bc..6da14e9b12 100644 --- a/osu.Game/Tests/Visual/TestCasePerformancePoints.cs +++ b/osu.Game/Tests/Visual/TestCasePerformancePoints.cs @@ -144,7 +144,6 @@ namespace osu.Game.Tests.Visual private bool isSelected; public string TooltipText => text.Text; - public bool IgnoreTooltip => false; public BeatmapDisplay(BeatmapInfo beatmap) { From 84ed91d5c94d9c9ebc001f4ae25d6387d7eb0f59 Mon Sep 17 00:00:00 2001 From: Ninjaprawn Date: Sat, 16 Dec 2017 20:17:20 +1100 Subject: [PATCH 005/169] Remove IgnoreTooltip; Override TooltipText to null --- osu.Game/Overlays/Mods/ModButton.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index e4a4413d09..e81ff44f03 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -35,7 +35,6 @@ namespace osu.Game.Overlays.Mods public Action Action; // Passed the selected mod or null if none public string TooltipText => (SelectedMod?.Description ?? Mods.FirstOrDefault()?.Description) ?? string.Empty; - public bool IgnoreTooltip => false; private const Easing mod_switch_easing = Easing.InOutSine; private const double mod_switch_duration = 120; @@ -263,10 +262,10 @@ namespace osu.Game.Overlays.Mods private class DisplayableModIcon : ModIcon { - public override bool IgnoreTooltip { get; } - + public override string TooltipText { get; } + public DisplayableModIcon(Mod mod) : base(mod) { - IgnoreTooltip = true; + TooltipText = null; } } From 214154c5124a67670337cfed99b688420b81ac38 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Thu, 21 Dec 2017 20:23:10 +0100 Subject: [PATCH 006/169] hide unnecessary lines on empty BeatmapInfoWedge adding back deleted line ooops meh --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 34 +++++++++++---------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 3ef6ceeaeb..d18aebe43b 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -95,7 +95,7 @@ namespace osu.Game.Screens.Select List labels = new List(); - if (beatmap != null) + if (beatmap != null && !(working is DummyWorkingBeatmap)) { HitObject lastObject = beatmap.HitObjects.LastOrDefault(); double endTime = (lastObject as IHasEndTime)?.EndTime ?? lastObject?.StartTime ?? 0; @@ -200,21 +200,7 @@ namespace osu.Game.Screens.Select Margin = new MarginPadding { Top = 10 }, Direction = FillDirection.Horizontal, AutoSizeAxes = Axes.Both, - Children = new[] - { - new OsuSpriteText - { - Font = @"Exo2.0-Medium", - Text = "mapped by ", - TextSize = 15, - }, - new OsuSpriteText - { - Font = @"Exo2.0-Bold", - Text = metadata.Author.Username, - TextSize = 15, - }, - } + Children = working is DummyWorkingBeatmap ? Array.Empty() : getMapper(metadata) }, new FillFlowContainer { @@ -228,6 +214,22 @@ namespace osu.Game.Screens.Select }; } + private OsuSpriteText[] getMapper(BeatmapMetadata metadata) => new[] + { + new OsuSpriteText + { + Font = @"Exo2.0-Medium", + Text = "mapped by ", + TextSize = 15, + }, + new OsuSpriteText + { + Font = @"Exo2.0-Bold", + Text = metadata.Author.Username, + TextSize = 15, + } + }; + private string getBPMRange(Beatmap beatmap) { double bpmMax = beatmap.ControlPointInfo.BPMMaximum; From 07f55a2a606a7d8a12973b637aa7e875c692b105 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Fri, 22 Dec 2017 10:18:25 +0100 Subject: [PATCH 007/169] remove references to DummyWorkingBeatmap determine content by data that is present instead --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 106 +++++++++++--------- 1 file changed, 60 insertions(+), 46 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index d18aebe43b..9b9a009ac0 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -89,34 +89,8 @@ namespace osu.Game.Screens.Select [BackgroundDependencyLoader] private void load() { - BeatmapInfo beatmapInfo = working.BeatmapInfo; - BeatmapMetadata metadata = beatmapInfo.Metadata ?? working.BeatmapSetInfo?.Metadata ?? new BeatmapMetadata(); - Beatmap beatmap = working.Beatmap; - - List labels = new List(); - - if (beatmap != null && !(working is DummyWorkingBeatmap)) - { - HitObject lastObject = beatmap.HitObjects.LastOrDefault(); - double endTime = (lastObject as IHasEndTime)?.EndTime ?? lastObject?.StartTime ?? 0; - - labels.Add(new InfoLabel(new BeatmapStatistic - { - Name = "Length", - Icon = FontAwesome.fa_clock_o, - Content = beatmap.HitObjects.Count == 0 ? "-" : TimeSpan.FromMilliseconds(endTime - beatmap.HitObjects.First().StartTime).ToString(@"m\:ss"), - })); - - labels.Add(new InfoLabel(new BeatmapStatistic - { - Name = "BPM", - Icon = FontAwesome.fa_circle, - Content = getBPMRange(beatmap), - })); - - //get statistics from the current ruleset. - labels.AddRange(beatmapInfo.Ruleset.CreateInstance().GetBeatmapStatistics(working).Select(s => new InfoLabel(s))); - } + var beatmapInfo = working.BeatmapInfo; + var metadata = beatmapInfo.Metadata ?? working.BeatmapSetInfo?.Metadata ?? new BeatmapMetadata(); PixelSnapping = true; CacheDrawnFrameBuffer = true; @@ -186,7 +160,7 @@ namespace osu.Game.Screens.Select new OsuSpriteText { Font = @"Exo2.0-MediumItalic", - Text = !string.IsNullOrEmpty(metadata.Source) ? metadata.Source + " — " + metadata.Title : metadata.Title, + Text = string.IsNullOrEmpty(metadata.Source) ? metadata.Title : metadata.Source + " — " + metadata.Title, TextSize = 28, }, new OsuSpriteText @@ -200,46 +174,86 @@ namespace osu.Game.Screens.Select Margin = new MarginPadding { Top = 10 }, Direction = FillDirection.Horizontal, AutoSizeAxes = Axes.Both, - Children = working is DummyWorkingBeatmap ? Array.Empty() : getMapper(metadata) + Children = getMapper(metadata) }, new FillFlowContainer { Margin = new MarginPadding { Top = 20 }, Spacing = new Vector2(20, 0), AutoSizeAxes = Axes.Both, - Children = labels - }, + Children = getInfoLabels() + } } - }, + } }; } - private OsuSpriteText[] getMapper(BeatmapMetadata metadata) => new[] + private InfoLabel[] getInfoLabels() { - new OsuSpriteText + var beatmap = working.Beatmap; + var info = working.BeatmapInfo; + + List labels = new List(); + + if (beatmap?.HitObjects?.Count > 0) { - Font = @"Exo2.0-Medium", - Text = "mapped by ", - TextSize = 15, - }, - new OsuSpriteText - { - Font = @"Exo2.0-Bold", - Text = metadata.Author.Username, - TextSize = 15, + HitObject lastObject = beatmap.HitObjects.LastOrDefault(); + double endTime = (lastObject as IHasEndTime)?.EndTime ?? lastObject?.StartTime ?? 0; + + labels.Add(new InfoLabel(new BeatmapStatistic + { + Name = "Length", + Icon = FontAwesome.fa_clock_o, + Content = beatmap.HitObjects.Count == 0 ? "-" : TimeSpan.FromMilliseconds(endTime - beatmap.HitObjects.First().StartTime).ToString(@"m\:ss"), + })); + + labels.Add(new InfoLabel(new BeatmapStatistic + { + Name = "BPM", + Icon = FontAwesome.fa_circle, + Content = getBPMRange(beatmap), + })); + + //get statistics from the current ruleset. + labels.AddRange(info.Ruleset.CreateInstance().GetBeatmapStatistics(working).Select(s => new InfoLabel(s))); } - }; + + return labels.ToArray(); + } private string getBPMRange(Beatmap beatmap) { double bpmMax = beatmap.ControlPointInfo.BPMMaximum; double bpmMin = beatmap.ControlPointInfo.BPMMinimum; - if (Precision.AlmostEquals(bpmMin, bpmMax)) return $"{bpmMin:0}"; + if (Precision.AlmostEquals(bpmMin, bpmMax)) + return $"{bpmMin:0}"; return $"{bpmMin:0}-{bpmMax:0} (mostly {beatmap.ControlPointInfo.BPMMode:0})"; } + private OsuSpriteText[] getMapper(BeatmapMetadata metadata) + { + if (string.IsNullOrEmpty(metadata.Author?.Username)) + return Array.Empty(); + + return new[] + { + new OsuSpriteText + { + Font = @"Exo2.0-Medium", + Text = "mapped by ", + TextSize = 15, + }, + new OsuSpriteText + { + Font = @"Exo2.0-Bold", + Text = metadata.Author.Username, + TextSize = 15, + } + }; + } + public class InfoLabel : Container, IHasTooltip { public string TooltipText { get; private set; } From ed827d5424fcadfa24e76a13cfbe1100916cfb00 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Fri, 22 Dec 2017 12:33:52 +0100 Subject: [PATCH 008/169] more visual tests for BeatmapInfoWedge also fix Author showing when not wanted --- .../Visual/TestCaseBeatmapInfoWedge.cs | 117 ++++++++++++++---- osu.Game/Beatmaps/DummyWorkingBeatmap.cs | 3 +- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 25 ++-- 3 files changed, 109 insertions(+), 36 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs index 0168cedc86..353f351a54 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs @@ -1,36 +1,48 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; +using System.Collections.Generic; +using System.Linq; using OpenTK; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; +using osu.Game.Graphics.Sprites; +using osu.Game.Rulesets; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Osu; using osu.Game.Screens.Select; +using osu.Game.Tests.Beatmaps; namespace osu.Game.Tests.Visual { public class TestCaseBeatmapInfoWedge : OsuTestCase { - private BeatmapManager beatmaps; - private readonly Random random; - private readonly BeatmapInfoWedge infoWedge; + private TestBeatmapInfoWedge infoWedge; + private readonly List beatmaps = new List(); private readonly Bindable beatmap = new Bindable(); - public TestCaseBeatmapInfoWedge() + [BackgroundDependencyLoader] + private void load(OsuGameBase game, RulesetStore rulesets) { - random = new Random(0123); + beatmap.BindTo(game.Beatmap); - Add(infoWedge = new BeatmapInfoWedge + Add(infoWedge = new TestBeatmapInfoWedge { Size = new Vector2(0.5f, 245), RelativeSizeAxes = Axes.X, Margin = new MarginPadding { Top = 20, - }, + } + }); + + AddStep("hide", () => + { + infoWedge.State = Visibility.Hidden; + Content.FadeOut(100); }); AddStep("show", () => @@ -39,31 +51,88 @@ namespace osu.Game.Tests.Visual infoWedge.State = Visibility.Visible; infoWedge.UpdateBeatmap(beatmap); }); - AddStep("hide", () => + + foreach (var rulesetInfo in rulesets.AvailableRulesets) { - infoWedge.State = Visibility.Hidden; - Content.FadeOut(100); + var ruleset = rulesetInfo.CreateInstance(); + beatmaps.Add(createTestBeatmap(rulesetInfo)); + + var name = rulesetInfo.ShortName; + selectBeatmap(name); + + // TODO: check InfoLabels of other rulesets + switch (ruleset) + { + case OsuRuleset osu: + testOsuBeatmap(osu); + break; + } + } + + testNullBeatmap(); + } + + private void testOsuBeatmap(OsuRuleset ruleset) + { + AddAssert("check version", () => infoWedge.Info.VersionLabel.Text == $"{ruleset.ShortName}Version"); + AddAssert("check title", () => infoWedge.Info.TitleLabel.Text == $"{ruleset.ShortName}Source — {ruleset.ShortName}Title"); + AddAssert("check artist", () => infoWedge.Info.ArtistLabel.Text == $"{ruleset.ShortName}Artist"); + AddAssert("check author", () => infoWedge.Info.MapperContainer.Children.OfType().Any(s => s.Text == $"{ruleset.ShortName}Author")); + // TODO: check InfoLabels + } + + private void testNullBeatmap() + { + selectNullBeatmap(); + AddAssert("check empty version", () => string.IsNullOrEmpty(infoWedge.Info.VersionLabel.Text)); + AddAssert("check default title", () => infoWedge.Info.TitleLabel.Text == beatmap.Default.BeatmapInfo.Metadata.Title); + AddAssert("check default artist", () => infoWedge.Info.ArtistLabel.Text == beatmap.Default.BeatmapInfo.Metadata.Artist); + AddAssert("check empty author", () => !infoWedge.Info.MapperContainer.Children.Any()); + AddAssert("check empty infos", () => !infoWedge.Info.InfoLabelContainer.Children.Any()); + } + + private void selectBeatmap(string name) + { + AddStep($"select {name} beatmap", () => + { + beatmap.Value = new TestWorkingBeatmap(beatmaps.First(b => b.BeatmapInfo.Ruleset.ShortName == name)); + infoWedge.UpdateBeatmap(beatmap); }); - AddStep("random beatmap", randomBeatmap); - AddStep("null beatmap", () => infoWedge.UpdateBeatmap(beatmap.Default)); } - [BackgroundDependencyLoader] - private void load(OsuGameBase game, BeatmapManager beatmaps) + private void selectNullBeatmap() { - this.beatmaps = beatmaps; - beatmap.BindTo(game.Beatmap); + AddStep("select null beatmap", () => + { + beatmap.Value = beatmap.Default; + infoWedge.UpdateBeatmap(beatmap); + }); } - private void randomBeatmap() + private Beatmap createTestBeatmap(RulesetInfo ruleset) { - var sets = beatmaps.GetAllUsableBeatmapSets(); - if (sets.Count == 0) - return; + return new Beatmap + { + BeatmapInfo = new BeatmapInfo + { + Metadata = new BeatmapMetadata + { + AuthorString = $"{ruleset.ShortName}Author", + Artist = $"{ruleset.ShortName}Artist", + Source = $"{ruleset.ShortName}Source", + Title = $"{ruleset.ShortName}Title" + }, + Ruleset = ruleset, + StarDifficulty = 6, + Version = $"{ruleset.ShortName}Version" + }, + HitObjects = new List() // TODO: Fill it with something depending on ruleset? + }; + } - var b = sets[random.Next(0, sets.Count)].Beatmaps[0]; - beatmap.Value = beatmaps.GetWorkingBeatmap(b); - infoWedge.UpdateBeatmap(beatmap); + private class TestBeatmapInfoWedge : BeatmapInfoWedge + { + public new BufferedWedgeInfo Info => base.Info; } } } diff --git a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs index 1434943da0..3ec83ed8d5 100644 --- a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs +++ b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs @@ -21,8 +21,7 @@ namespace osu.Game.Beatmaps Metadata = new BeatmapMetadata { Artist = "please load a beatmap!", - Title = "no beatmaps available!", - AuthorString = "no one", + Title = "no beatmaps available!" }, BeatmapSet = new BeatmapSetInfo(), BaseDifficulty = new BeatmapDifficulty diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 9b9a009ac0..5d4f950a51 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -27,7 +27,7 @@ namespace osu.Game.Screens.Select { private static readonly Vector2 wedged_container_shear = new Vector2(0.15f, 0); - private Drawable info; + protected BufferedWedgeInfo Info; public BeatmapInfoWedge() { @@ -63,23 +63,28 @@ namespace osu.Game.Screens.Select LoadComponentAsync(new BufferedWedgeInfo(beatmap) { Shear = -Shear, - Depth = info?.Depth + 1 ?? 0, + Depth = Info?.Depth + 1 ?? 0, }, newInfo => { // ensure we ourselves are visible if not already. if (!IsPresent) this.FadeIn(250); - info?.FadeOut(250); - info?.Expire(); + Info?.FadeOut(250); + Info?.Expire(); - Add(info = newInfo); + Add(Info = newInfo); }); } public class BufferedWedgeInfo : BufferedContainer { private readonly WorkingBeatmap working; + public OsuSpriteText VersionLabel { get; private set; } + public OsuSpriteText TitleLabel { get; private set; } + public OsuSpriteText ArtistLabel { get; private set; } + public FillFlowContainer MapperContainer { get; private set; } + public FillFlowContainer InfoLabelContainer { get; private set; } public BufferedWedgeInfo(WorkingBeatmap working) { @@ -139,7 +144,7 @@ namespace osu.Game.Screens.Select AutoSizeAxes = Axes.Both, Children = new Drawable[] { - new OsuSpriteText + VersionLabel = new OsuSpriteText { Font = @"Exo2.0-MediumItalic", Text = beatmapInfo.Version, @@ -157,26 +162,26 @@ namespace osu.Game.Screens.Select AutoSizeAxes = Axes.Both, Children = new Drawable[] { - new OsuSpriteText + TitleLabel = new OsuSpriteText { Font = @"Exo2.0-MediumItalic", Text = string.IsNullOrEmpty(metadata.Source) ? metadata.Title : metadata.Source + " — " + metadata.Title, TextSize = 28, }, - new OsuSpriteText + ArtistLabel = new OsuSpriteText { Font = @"Exo2.0-MediumItalic", Text = metadata.Artist, TextSize = 17, }, - new FillFlowContainer + MapperContainer = new FillFlowContainer { Margin = new MarginPadding { Top = 10 }, Direction = FillDirection.Horizontal, AutoSizeAxes = Axes.Both, Children = getMapper(metadata) }, - new FillFlowContainer + InfoLabelContainer = new FillFlowContainer { Margin = new MarginPadding { Top = 20 }, Spacing = new Vector2(20, 0), From 2313ff0ddbe0b04c04beda6fe4df5947ec32711f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 22 Dec 2017 22:19:11 +0900 Subject: [PATCH 009/169] Fix beatmap info wedge not showing up when zero beatmaps are loaded Closes #1722. --- osu.Game/Screens/Select/BeatmapCarousel.cs | 2 +- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 2 ++ osu.Game/Screens/Select/SongSelect.cs | 1 - 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index ff1dd95eac..e0fcba5b3c 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -509,7 +509,7 @@ namespace osu.Game.Screens.Select currentY += DrawHeight / 2; scrollableContent.Height = currentY; - if (selectedBeatmapSet != null && selectedBeatmapSet.State.Value != CarouselItemState.Selected) + if (selectedBeatmapSet == null || selectedBeatmapSet.State.Value != CarouselItemState.Selected) { selectedBeatmapSet = null; SelectionChanged?.Invoke(null); diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 3ef6ceeaeb..1baacb78ee 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -66,6 +66,8 @@ namespace osu.Game.Screens.Select Depth = info?.Depth + 1 ?? 0, }, newInfo => { + State = beatmap == null ? Visibility.Hidden : Visibility.Visible; + // ensure we ourselves are visible if not already. if (!IsPresent) this.FadeIn(250); diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 68ee08e721..9a7dbf002e 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -399,7 +399,6 @@ namespace osu.Game.Screens.Select backgroundModeBeatmap.FadeTo(1, 250); } - beatmapInfoWedge.State = Visibility.Visible; beatmapInfoWedge.UpdateBeatmap(beatmap); } From 6a8fd74e055bd3a35931c1112c86298e4cd6f91f Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Fri, 22 Dec 2017 17:38:22 +0100 Subject: [PATCH 010/169] fix failing tests 1) waiting for loading to finish so Drawables are all present to do asserts on 2) fix NullRef in ResultPage because of removed line in DummyWorkingBeatmap (author one) --- osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs | 8 ++++++++ osu.Game/Screens/Ranking/ResultsPageScore.cs | 9 ++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs index 353f351a54..1ef6291ee4 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs @@ -20,6 +20,7 @@ namespace osu.Game.Tests.Visual { public class TestCaseBeatmapInfoWedge : OsuTestCase { + private RulesetStore rulesets; private TestBeatmapInfoWedge infoWedge; private readonly List beatmaps = new List(); private readonly Bindable beatmap = new Bindable(); @@ -27,7 +28,14 @@ namespace osu.Game.Tests.Visual [BackgroundDependencyLoader] private void load(OsuGameBase game, RulesetStore rulesets) { + this.rulesets = rulesets; + beatmap.BindTo(game.Beatmap); + } + + protected override void LoadComplete() + { + base.LoadComplete(); Add(infoWedge = new TestBeatmapInfoWedge { diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index 911b688669..396d7f3c18 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -324,7 +324,14 @@ namespace osu.Game.Screens.Ranking title.Colour = artist.Colour = colours.BlueDarker; versionMapper.Colour = colours.Gray8; - versionMapper.Text = $"{beatmap.Version} - mapped by {beatmap.Metadata.Author.Username}"; + var creator = beatmap.Metadata.Author?.Username; + if (!string.IsNullOrEmpty(creator)) { + versionMapper.Text = $"mapped by {creator}"; + + if (!string.IsNullOrEmpty(beatmap.Version)) + versionMapper.Text = $"{beatmap.Version} - " + versionMapper.Text; + } + title.Current = localisation.GetUnicodePreference(beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title); artist.Current = localisation.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist); } From 49e855a29ae3d4538d618e7c6de255e4afa29741 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Sat, 23 Dec 2017 11:56:53 +0100 Subject: [PATCH 011/169] finished up visual tests --- .../Visual/TestCaseBeatmapInfoWedge.cs | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs index 1ef6291ee4..61c904aa60 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs @@ -68,11 +68,15 @@ namespace osu.Game.Tests.Visual var name = rulesetInfo.ShortName; selectBeatmap(name); - // TODO: check InfoLabels of other rulesets + // TODO: adjust cases once more info is shown for other gamemodes switch (ruleset) { case OsuRuleset osu: testOsuBeatmap(osu); + testInfoLabels(5); + break; + default: + testInfoLabels(2); break; } } @@ -86,7 +90,12 @@ namespace osu.Game.Tests.Visual AddAssert("check title", () => infoWedge.Info.TitleLabel.Text == $"{ruleset.ShortName}Source — {ruleset.ShortName}Title"); AddAssert("check artist", () => infoWedge.Info.ArtistLabel.Text == $"{ruleset.ShortName}Artist"); AddAssert("check author", () => infoWedge.Info.MapperContainer.Children.OfType().Any(s => s.Text == $"{ruleset.ShortName}Author")); - // TODO: check InfoLabels + } + + private void testInfoLabels(int expectedCount) + { + AddAssert("check infolabels exists", () => infoWedge.Info.InfoLabelContainer.Children.Any()); + AddAssert("check infolabels count", () => infoWedge.Info.InfoLabelContainer.Children.Count == expectedCount); } private void testNullBeatmap() @@ -96,7 +105,7 @@ namespace osu.Game.Tests.Visual AddAssert("check default title", () => infoWedge.Info.TitleLabel.Text == beatmap.Default.BeatmapInfo.Metadata.Title); AddAssert("check default artist", () => infoWedge.Info.ArtistLabel.Text == beatmap.Default.BeatmapInfo.Metadata.Artist); AddAssert("check empty author", () => !infoWedge.Info.MapperContainer.Children.Any()); - AddAssert("check empty infos", () => !infoWedge.Info.InfoLabelContainer.Children.Any()); + AddAssert("check no infolabels", () => !infoWedge.Info.InfoLabelContainer.Children.Any()); } private void selectBeatmap(string name) @@ -119,6 +128,10 @@ namespace osu.Game.Tests.Visual private Beatmap createTestBeatmap(RulesetInfo ruleset) { + List objects = new List(); + for (double i = 0; i < 50000; i += 1000) + objects.Add(new HitObject { StartTime = i }); + return new Beatmap { BeatmapInfo = new BeatmapInfo @@ -134,7 +147,7 @@ namespace osu.Game.Tests.Visual StarDifficulty = 6, Version = $"{ruleset.ShortName}Version" }, - HitObjects = new List() // TODO: Fill it with something depending on ruleset? + HitObjects = objects }; } From 68d76d4380f2816088cd7f0344331e79aa4df907 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Sat, 23 Dec 2017 20:58:09 +0900 Subject: [PATCH 012/169] Fix taiko strong hits not being handled --- osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index d960ab6b48..c397ea47ef 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -174,7 +174,7 @@ namespace osu.Game.Rulesets.Objects.Drawables { judgementOccurred = false; - if (AllJudged || State != ArmedState.Idle) + if (AllJudged) return false; if (NestedHitObjects != null) From 9bb0cda5256a8c14f4cf4bc7b50b2fdc832d5e3b Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Sat, 23 Dec 2017 14:33:43 +0100 Subject: [PATCH 013/169] fix NotificationOverlay going out of bounds at the bottom also fixes the overlap with the Toolbar at the top --- .../Visual/TestCaseNotificationOverlay.cs | 35 +++++++--------- osu.Game/OsuGame.cs | 1 + osu.Game/Overlays/NotificationOverlay.cs | 41 ++++++++++++------- 3 files changed, 42 insertions(+), 35 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs b/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs index 79d3d7d4ba..b93c2d812f 100644 --- a/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs @@ -3,19 +3,17 @@ using System.Collections.Generic; using System.Linq; -using NUnit.Framework; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.MathUtils; using osu.Game.Overlays; using osu.Game.Overlays.Notifications; namespace osu.Game.Tests.Visual { - [TestFixture] public class TestCaseNotificationOverlay : OsuTestCase { private readonly NotificationOverlay manager; + private readonly List progressingNotifications = new List(); public TestCaseNotificationOverlay() { @@ -24,15 +22,14 @@ namespace osu.Game.Tests.Visual Content.Add(manager = new NotificationOverlay { Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, + Origin = Anchor.TopRight }); - AddToggleStep(@"show", state => manager.State = state ? Visibility.Visible : Visibility.Hidden); - - AddStep(@"simple #1", sendNotification1); - AddStep(@"simple #2", sendNotification2); - AddStep(@"progress #1", sendProgress1); - AddStep(@"progress #2", sendProgress2); + AddStep(@"toggle", manager.ToggleVisibility); + AddStep(@"simple #1", sendHelloNotification); + AddStep(@"simple #2", sendAmazingNotification); + AddStep(@"progress #1", sendUploadProgress); + AddStep(@"progress #2", sendDownloadProgress); AddStep(@"barrage", () => sendBarrage()); } @@ -41,16 +38,16 @@ namespace osu.Game.Tests.Visual switch (RNG.Next(0, 4)) { case 0: - sendNotification1(); + sendHelloNotification(); break; case 1: - sendNotification2(); + sendAmazingNotification(); break; case 2: - sendProgress1(); + sendUploadProgress(); break; case 3: - sendProgress2(); + sendDownloadProgress(); break; } @@ -80,7 +77,7 @@ namespace osu.Game.Tests.Visual } } - private void sendProgress2() + private void sendDownloadProgress() { var n = new ProgressNotification { @@ -91,9 +88,7 @@ namespace osu.Game.Tests.Visual progressingNotifications.Add(n); } - private readonly List progressingNotifications = new List(); - - private void sendProgress1() + private void sendUploadProgress() { var n = new ProgressNotification { @@ -104,12 +99,12 @@ namespace osu.Game.Tests.Visual progressingNotifications.Add(n); } - private void sendNotification2() + private void sendAmazingNotification() { manager.Post(new SimpleNotification { Text = @"You are amazing" }); } - private void sendNotification1() + private void sendHelloNotification() { manager.Post(new SimpleNotification { Text = @"Welcome to osu!. Enjoy your stay!" }); } diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 4745733bd9..4c66539cf1 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -209,6 +209,7 @@ namespace osu.Game loadComponentSingleFile(notificationOverlay = new NotificationOverlay { + GetToolbarHeight = () => ToolbarOffset, Depth = -4, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, diff --git a/osu.Game/Overlays/NotificationOverlay.cs b/osu.Game/Overlays/NotificationOverlay.cs index 260214a14f..a4b5486596 100644 --- a/osu.Game/Overlays/NotificationOverlay.cs +++ b/osu.Game/Overlays/NotificationOverlay.cs @@ -10,6 +10,7 @@ using osu.Game.Overlays.Notifications; using OpenTK.Graphics; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.Containers; +using System; namespace osu.Game.Overlays { @@ -19,9 +20,13 @@ namespace osu.Game.Overlays public const float TRANSITION_LENGTH = 600; - private ScrollContainer scrollContainer; private FlowContainer sections; + /// + /// Provide a source for the toolbar height. + /// + public Func GetToolbarHeight; + [BackgroundDependencyLoader] private void load() { @@ -36,12 +41,12 @@ namespace osu.Game.Overlays { RelativeSizeAxes = Axes.Both, Colour = Color4.Black, - Alpha = 0.6f, + Alpha = 0.6f }, - scrollContainer = new OsuScrollContainer + new OsuScrollContainer { + Masking = true, RelativeSizeAxes = Axes.Both, - Margin = new MarginPadding { Top = Toolbar.Toolbar.HEIGHT }, Children = new[] { sections = new FillFlowContainer @@ -55,14 +60,14 @@ namespace osu.Game.Overlays { Title = @"Notifications", ClearText = @"Clear All", - AcceptTypes = new[] { typeof(SimpleNotification) }, + AcceptTypes = new[] { typeof(SimpleNotification) } }, new NotificationSection { Title = @"Running Tasks", ClearText = @"Cancel All", - AcceptTypes = new[] { typeof(ProgressNotification) }, - }, + AcceptTypes = new[] { typeof(ProgressNotification) } + } } } } @@ -103,14 +108,8 @@ namespace osu.Game.Overlays { base.PopIn(); - scrollContainer.MoveToX(0, TRANSITION_LENGTH, Easing.OutQuint); this.MoveToX(0, TRANSITION_LENGTH, Easing.OutQuint); - this.FadeTo(1, TRANSITION_LENGTH / 2); - } - - private void markAllRead() - { - sections.Children.ForEach(s => s.MarkAllRead()); + this.FadeTo(1, TRANSITION_LENGTH, Easing.OutQuint); } protected override void PopOut() @@ -120,7 +119,19 @@ namespace osu.Game.Overlays markAllRead(); this.MoveToX(width, TRANSITION_LENGTH, Easing.OutQuint); - this.FadeTo(0, TRANSITION_LENGTH / 2); + this.FadeTo(0, TRANSITION_LENGTH, Easing.OutQuint); + } + + private void markAllRead() + { + sections.Children.ForEach(s => s.MarkAllRead()); + } + + protected override void UpdateAfterChildren() + { + base.UpdateAfterChildren(); + + Padding = new MarginPadding { Top = GetToolbarHeight?.Invoke() ?? 0 }; } } } From 2ffc479411ab1edc093aa5416a5ec3e62eacf6a6 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Sat, 23 Dec 2017 14:56:23 +0100 Subject: [PATCH 014/169] let NotificationOverlay move the background --- osu.Game/OsuGame.cs | 21 +++++++++++++++++++-- osu.Game/Overlays/SettingsOverlay.cs | 6 +++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 4745733bd9..121e9360ce 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -75,6 +75,8 @@ namespace osu.Game private SettingsOverlay settings; + private float backgroundOffset; + public OsuGame(string[] args = null) { this.args = args; @@ -276,12 +278,27 @@ namespace osu.Game switch (settings.State) { case Visibility.Hidden: - intro.MoveToX(0, SettingsOverlay.TRANSITION_LENGTH, Easing.OutQuint); + backgroundOffset -= ToolbarButton.WIDTH / 2; break; case Visibility.Visible: - intro.MoveToX(SettingsOverlay.SIDEBAR_WIDTH / 2, SettingsOverlay.TRANSITION_LENGTH, Easing.OutQuint); + backgroundOffset += ToolbarButton.WIDTH / 2; break; } + intro.MoveToX(backgroundOffset, SettingsOverlay.TRANSITION_LENGTH, Easing.OutQuint); + }; + + notificationOverlay.StateChanged += delegate + { + switch (notificationOverlay.State) + { + case Visibility.Hidden: + backgroundOffset += ToolbarButton.WIDTH / 2; + break; + case Visibility.Visible: + backgroundOffset -= ToolbarButton.WIDTH / 2; + break; + } + intro.MoveToX(backgroundOffset, NotificationOverlay.TRANSITION_LENGTH, Easing.OutQuint); }; Cursor.State = Visibility.Hidden; diff --git a/osu.Game/Overlays/SettingsOverlay.cs b/osu.Game/Overlays/SettingsOverlay.cs index 798fa00032..a80f6d4da8 100644 --- a/osu.Game/Overlays/SettingsOverlay.cs +++ b/osu.Game/Overlays/SettingsOverlay.cs @@ -24,7 +24,7 @@ namespace osu.Game.Overlays public const float TRANSITION_LENGTH = 600; - public const float SIDEBAR_WIDTH = Sidebar.DEFAULT_WIDTH; + private const float sidebar_width = Sidebar.DEFAULT_WIDTH; protected const float WIDTH = 400; @@ -102,7 +102,7 @@ namespace osu.Game.Overlays if (showSidebar) { - AddInternal(Sidebar = new Sidebar { Width = SIDEBAR_WIDTH }); + AddInternal(Sidebar = new Sidebar { Width = sidebar_width }); SectionsContainer.SelectedSection.ValueChanged += section => { @@ -167,7 +167,7 @@ namespace osu.Game.Overlays ContentContainer.MoveToX(-WIDTH, TRANSITION_LENGTH, Easing.OutQuint); - Sidebar?.MoveToX(-SIDEBAR_WIDTH, TRANSITION_LENGTH, Easing.OutQuint); + Sidebar?.MoveToX(-sidebar_width, TRANSITION_LENGTH, Easing.OutQuint); this.FadeTo(0, TRANSITION_LENGTH, Easing.OutQuint); searchTextBox.HoldFocus = false; From a6566564039ecb7e809e96eefa4b93d0649737df Mon Sep 17 00:00:00 2001 From: Shawdooow Date: Sat, 23 Dec 2017 22:47:32 -0500 Subject: [PATCH 015/169] the fix --- osu.Game.Rulesets.Osu/Objects/Slider.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index 4f5a44e61d..01f83ac904 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -117,11 +117,18 @@ namespace osu.Game.Rulesets.Osu.Objects var minDistanceFromEnd = Velocity * 0.01; + bool sliderStart = false; + for (var repeat = 0; repeat < RepeatCount; repeat++) { var repeatStartTime = StartTime + repeat * repeatDuration; var reversed = repeat % 2 == 1; + if (!sliderStart) + sliderStart = true; + else + sliderStart = false; + for (var d = tickDistance; d <= length; d += tickDistance) { if (d > length - minDistanceFromEnd) @@ -130,6 +137,9 @@ namespace osu.Game.Rulesets.Osu.Objects var distanceProgress = d / length; var timeProgress = reversed ? 1 - distanceProgress : distanceProgress; + if (sliderStart) + distanceProgress = 0; + AddNested(new SliderTick { RepeatIndex = repeat, From d333fc5efe4bb28a9d8c548600a15ab31e6a1451 Mon Sep 17 00:00:00 2001 From: Shawdooow Date: Sat, 23 Dec 2017 23:08:55 -0500 Subject: [PATCH 016/169] fix the fix silly me, that was configured for vitaru! --- osu.Game.Rulesets.Osu/Objects/Slider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index 01f83ac904..44c7792e9c 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -117,7 +117,7 @@ namespace osu.Game.Rulesets.Osu.Objects var minDistanceFromEnd = Velocity * 0.01; - bool sliderStart = false; + bool sliderStart = true; for (var repeat = 0; repeat < RepeatCount; repeat++) { From af2a2781e7126f7d5eeb40f578cd7c4faf8ecd47 Mon Sep 17 00:00:00 2001 From: Shawdooow Date: Sat, 23 Dec 2017 23:12:10 -0500 Subject: [PATCH 017/169] fix the fix harder --- osu.Game.Rulesets.Osu/Objects/Slider.cs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index 44c7792e9c..800573f991 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -117,18 +117,11 @@ namespace osu.Game.Rulesets.Osu.Objects var minDistanceFromEnd = Velocity * 0.01; - bool sliderStart = true; - for (var repeat = 0; repeat < RepeatCount; repeat++) { var repeatStartTime = StartTime + repeat * repeatDuration; var reversed = repeat % 2 == 1; - if (!sliderStart) - sliderStart = true; - else - sliderStart = false; - for (var d = tickDistance; d <= length; d += tickDistance) { if (d > length - minDistanceFromEnd) @@ -137,9 +130,6 @@ namespace osu.Game.Rulesets.Osu.Objects var distanceProgress = d / length; var timeProgress = reversed ? 1 - distanceProgress : distanceProgress; - if (sliderStart) - distanceProgress = 0; - AddNested(new SliderTick { RepeatIndex = repeat, @@ -165,13 +155,20 @@ namespace osu.Game.Rulesets.Osu.Objects var repeatPointDistance = Math.Min(Distance, length); var repeatDuration = length / Velocity; + bool sliderStart = true; + for (var repeat = 1; repeat < RepeatCount; repeat++) { + sliderStart = !sliderStart; + for (var d = repeatPointDistance; d <= length; d += repeatPointDistance) { var repeatStartTime = StartTime + repeat * repeatDuration; var distanceProgress = d / length; + if (sliderStart) + distanceProgress = 0; + AddNested(new RepeatPoint { RepeatIndex = repeat, From 72b5a370da6fbc7702c80857e64476674f061c89 Mon Sep 17 00:00:00 2001 From: Shawdooow Date: Sat, 23 Dec 2017 23:13:53 -0500 Subject: [PATCH 018/169] dont play the same sound twice at once --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index befe84e3e9..d8a22d94ca 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -117,11 +117,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables progress = slider.ProgressAt(progress); if (repeat > currentRepeat) - { - if (repeat < slider.RepeatCount && ball.Tracking) - PlaySamples(); currentRepeat = repeat; - } //todo: we probably want to reconsider this before adding scoring, but it looks and feels nice. if (!initialCircle.Judgements.Any(j => j.IsHit)) From cf316b3c51661a7a21ae1b47c90b9f169c19b8f6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 24 Dec 2017 15:39:25 +0900 Subject: [PATCH 019/169] Add tests for initial load states of PlaySongSelect --- .../Visual/TestCasePlaySongSelect.cs | 48 ++++++++++++++++--- osu.Game/Screens/Select/BeatmapCarousel.cs | 1 - osu.Game/Screens/Select/SongSelect.cs | 34 ++++++------- 3 files changed, 59 insertions(+), 24 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs index 6435df7c2c..34b99c6ca6 100644 --- a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs @@ -26,6 +26,7 @@ namespace osu.Game.Tests.Visual private RulesetStore rulesets; private DependencyContainer dependencies; + private WorkingBeatmap defaultBeatmap; public override IReadOnlyList RequiredTypes => new[] { @@ -47,10 +48,16 @@ namespace osu.Game.Tests.Visual protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) => dependencies = new DependencyContainer(parent); + private class TestSongSelect : PlaySongSelect + { + public WorkingBeatmap CurrentBeatmap => Beatmap.Value; + public new BeatmapCarousel Carousel => base.Carousel; + } + [BackgroundDependencyLoader] private void load(BeatmapManager baseManager) { - PlaySongSelect songSelect; + TestSongSelect songSelect = null; if (manager == null) { @@ -64,14 +71,43 @@ namespace osu.Game.Tests.Visual dependencies.Cache(rulesets = new RulesetStore(contextFactory)); dependencies.Cache(manager = new BeatmapManager(storage, contextFactory, rulesets, null) { - DefaultBeatmap = baseManager.GetWorkingBeatmap(null) + DefaultBeatmap = defaultBeatmap = baseManager.GetWorkingBeatmap(null) }); - - for (int i = 0; i < 100; i += 10) - manager.Import(createTestBeatmapSet(i)); } - Add(songSelect = new PlaySongSelect()); + void loadNewSongSelect(bool deleteMaps = false) => AddStep("reload song select", () => + { + if (deleteMaps) manager.DeleteAll(); + + if (songSelect != null) + { + Remove(songSelect); + songSelect.Dispose(); + } + + Add(songSelect = new TestSongSelect()); + }); + + loadNewSongSelect(true); + + AddWaitStep(1); + + AddAssert("dummy selected", () => songSelect.CurrentBeatmap == defaultBeatmap); + + AddStep("import test maps", () => + { + for (int i = 0; i < 100; i += 10) + manager.Import(createTestBeatmapSet(i)); + }); + + AddWaitStep(1); + AddStep("select random", () => songSelect.Carousel.SelectNextRandom()); + + AddWaitStep(1); + AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap); + + loadNewSongSelect(); + AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap); AddStep(@"Sort by Artist", delegate { songSelect.FilterControl.Sort = SortMode.Artist; }); AddStep(@"Sort by Title", delegate { songSelect.FilterControl.Sort = SortMode.Title; }); diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index bfba9a7d6b..b4ca6f10f9 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -142,7 +142,6 @@ namespace osu.Game.Screens.Select if (newSet == null) { itemsCache.Invalidate(); - SelectNext(); return; } diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 9a7dbf002e..a15699d97a 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -55,7 +55,7 @@ namespace osu.Game.Screens.Select protected Container LeftContent; - private readonly BeatmapCarousel carousel; + protected readonly BeatmapCarousel Carousel; private readonly BeatmapInfoWedge beatmapInfoWedge; private DialogOverlay dialogOverlay; private BeatmapManager beatmaps; @@ -103,7 +103,7 @@ namespace osu.Game.Screens.Select Right = left_area_padding * 2, } }, - carousel = new BeatmapCarousel + Carousel = new BeatmapCarousel { RelativeSizeAxes = Axes.Y, Size = new Vector2(carousel_width, 1), @@ -116,7 +116,7 @@ namespace osu.Game.Screens.Select { RelativeSizeAxes = Axes.X, Height = filter_height, - FilterChanged = c => carousel.Filter(c), + FilterChanged = c => Carousel.Filter(c), Exit = Exit, }, beatmapInfoWedge = new BeatmapInfoWedge @@ -130,7 +130,7 @@ namespace osu.Game.Screens.Select Right = left_area_padding, }, }, - new ResetScrollContainer(() => carousel.ScrollToSelected()) + new ResetScrollContainer(() => Carousel.ScrollToSelected()) { RelativeSizeAxes = Axes.Y, Width = 250, @@ -190,15 +190,15 @@ namespace osu.Game.Screens.Select initialAddSetsTask = new CancellationTokenSource(); - carousel.BeatmapSets = this.beatmaps.GetAllUsableBeatmapSets(); + Carousel.BeatmapSets = this.beatmaps.GetAllUsableBeatmapSets(); - Beatmap.DisabledChanged += disabled => carousel.AllowSelection = !disabled; + Beatmap.DisabledChanged += disabled => Carousel.AllowSelection = !disabled; Beatmap.TriggerChange(); Beatmap.ValueChanged += b => { if (IsCurrentScreen) - carousel.SelectBeatmap(b?.BeatmapInfo); + Carousel.SelectBeatmap(b?.BeatmapInfo); }; } @@ -212,9 +212,9 @@ namespace osu.Game.Screens.Select { // if we have a pending filter operation, we want to run it now. // it could change selection (ie. if the ruleset has been changed). - carousel.FlushPendingFilterOperations(); + Carousel.FlushPendingFilterOperations(); - carousel.SelectBeatmap(beatmap); + Carousel.SelectBeatmap(beatmap); if (selectionChangedDebounce?.Completed == false) { @@ -282,9 +282,9 @@ namespace osu.Game.Screens.Select private void triggerRandom() { if (GetContainingInputManager().CurrentState.Keyboard.ShiftPressed) - carousel.SelectPreviousRandom(); + Carousel.SelectPreviousRandom(); else - carousel.SelectNextRandom(); + Carousel.SelectNextRandom(); } protected override void OnEntering(Screen last) @@ -416,17 +416,17 @@ namespace osu.Game.Screens.Select } } - private void onBeatmapSetAdded(BeatmapSetInfo s) => carousel.UpdateBeatmapSet(s); - private void onBeatmapSetRemoved(BeatmapSetInfo s) => carousel.RemoveBeatmapSet(s); - private void onBeatmapRestored(BeatmapInfo b) => carousel.UpdateBeatmapSet(beatmaps.QueryBeatmapSet(s => s.ID == b.BeatmapSetInfoID)); - private void onBeatmapHidden(BeatmapInfo b) => carousel.UpdateBeatmapSet(beatmaps.QueryBeatmapSet(s => s.ID == b.BeatmapSetInfoID)); + private void onBeatmapSetAdded(BeatmapSetInfo s) => Carousel.UpdateBeatmapSet(s); + private void onBeatmapSetRemoved(BeatmapSetInfo s) => Carousel.RemoveBeatmapSet(s); + private void onBeatmapRestored(BeatmapInfo b) => Carousel.UpdateBeatmapSet(beatmaps.QueryBeatmapSet(s => s.ID == b.BeatmapSetInfoID)); + private void onBeatmapHidden(BeatmapInfo b) => Carousel.UpdateBeatmapSet(beatmaps.QueryBeatmapSet(s => s.ID == b.BeatmapSetInfoID)); private void carouselBeatmapsLoaded() { if (Beatmap.Value.BeatmapSetInfo?.DeletePending == false) - carousel.SelectBeatmap(Beatmap.Value.BeatmapInfo); + Carousel.SelectBeatmap(Beatmap.Value.BeatmapInfo); else - carousel.SelectNextRandom(); + Carousel.SelectNextRandom(); } private void delete(BeatmapSetInfo beatmap) From a04ebd0595e423c02e38b57b5e386020d19f7157 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 24 Dec 2017 15:39:44 +0900 Subject: [PATCH 020/169] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 08f85f9bf9..64e04b9ff2 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 08f85f9bf9a7376aec8dfcde8c7c96d267d8c295 +Subproject commit 64e04b9ff2d5ba53e5c3a46cfa42a79baeffc014 From 482e10966cfb5fd80c892695bfda6f250b6ae4ee Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 24 Dec 2017 17:02:46 +0900 Subject: [PATCH 021/169] Ensure a selection is made on entering song select if no selection is current --- osu.Game.Tests/Visual/TestCasePlaySongSelect.cs | 3 --- osu.Game/Screens/Select/BeatmapCarousel.cs | 4 +++- osu.Game/Screens/Select/SongSelect.cs | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs index 34b99c6ca6..87f71d215b 100644 --- a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs @@ -100,9 +100,6 @@ namespace osu.Game.Tests.Visual manager.Import(createTestBeatmapSet(i)); }); - AddWaitStep(1); - AddStep("select random", () => songSelect.Carousel.SelectNextRandom()); - AddWaitStep(1); AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap); diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index b4ca6f10f9..c33993c68c 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -75,7 +75,8 @@ namespace osu.Game.Screens.Select scrollableContent.Clear(false); itemsCache.Invalidate(); scrollPositionCache.Invalidate(); - BeatmapSetsChanged?.Invoke(); + + Schedule(() => BeatmapSetsChanged?.Invoke()); })); } } @@ -154,6 +155,7 @@ namespace osu.Game.Screens.Select select((CarouselItem)newSet.Beatmaps.FirstOrDefault(b => b.Beatmap.ID == selectedBeatmap?.Beatmap.ID) ?? newSet); itemsCache.Invalidate(); + Schedule(() => BeatmapSetsChanged?.Invoke()); }); } diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index a15699d97a..75c4a68388 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -423,7 +423,7 @@ namespace osu.Game.Screens.Select private void carouselBeatmapsLoaded() { - if (Beatmap.Value.BeatmapSetInfo?.DeletePending == false) + if (!Beatmap.IsDefault && Beatmap.Value.BeatmapSetInfo?.DeletePending == false) Carousel.SelectBeatmap(Beatmap.Value.BeatmapInfo); else Carousel.SelectNextRandom(); From 5b22c5a45371e671b155f11bbcc6e4d94c95eff5 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Sun, 24 Dec 2017 10:28:37 +0100 Subject: [PATCH 022/169] reduce code duplication to move intro background --- osu.Game/OsuGame.cs | 51 ++++++++++++++++----------------------------- 1 file changed, 18 insertions(+), 33 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 121e9360ce..f91df9b6ba 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -37,7 +37,7 @@ namespace osu.Game private MusicController musicController; - private NotificationOverlay notificationOverlay; + private NotificationOverlay notifications; private DialogOverlay dialogOverlay; @@ -75,8 +75,6 @@ namespace osu.Game private SettingsOverlay settings; - private float backgroundOffset; - public OsuGame(string[] args = null) { this.args = args; @@ -138,7 +136,7 @@ namespace osu.Game if (s.Beatmap == null) { - notificationOverlay.Post(new SimpleNotification + notifications.Post(new SimpleNotification { Text = @"Tried to load a score for a beatmap we don't have!", Icon = FontAwesome.fa_life_saver, @@ -156,7 +154,7 @@ namespace osu.Game base.LoadComplete(); // hook up notifications to components. - BeatmapManager.PostNotification = n => notificationOverlay?.Post(n); + BeatmapManager.PostNotification = n => notifications?.Post(n); BeatmapManager.GetStableStorage = GetStorageForStableInstall; AddRange(new Drawable[] @@ -209,7 +207,7 @@ namespace osu.Game Origin = Anchor.TopRight, }, overlayContent.Add); - loadComponentSingleFile(notificationOverlay = new NotificationOverlay + loadComponentSingleFile(notifications = new NotificationOverlay { Depth = -4, Anchor = Anchor.TopRight, @@ -225,7 +223,7 @@ namespace osu.Game { if (entry.Level < LogLevel.Important) return; - notificationOverlay.Post(new SimpleNotification + notifications.Post(new SimpleNotification { Text = $@"{entry.Level}: {entry.Message}" }); @@ -238,7 +236,7 @@ namespace osu.Game dependencies.Cache(userProfile); dependencies.Cache(musicController); dependencies.Cache(beatmapSetOverlay); - dependencies.Cache(notificationOverlay); + dependencies.Cache(notifications); dependencies.Cache(dialogOverlay); // ensure only one of these overlays are open at once. @@ -273,33 +271,20 @@ namespace osu.Game }; } - settings.StateChanged += delegate + Action stateChanged = delegate { - switch (settings.State) - { - case Visibility.Hidden: - backgroundOffset -= ToolbarButton.WIDTH / 2; - break; - case Visibility.Visible: - backgroundOffset += ToolbarButton.WIDTH / 2; - break; - } - intro.MoveToX(backgroundOffset, SettingsOverlay.TRANSITION_LENGTH, Easing.OutQuint); + float offset = intro.X; + + if (settings.State == Visibility.Hidden || notifications.State == Visibility.Visible) + offset -= ToolbarButton.WIDTH / 2; + else if (settings.State == Visibility.Visible || notifications.State == Visibility.Hidden) + offset += ToolbarButton.WIDTH / 2; + + intro.MoveToX(offset, SettingsOverlay.TRANSITION_LENGTH, Easing.OutQuint); }; - notificationOverlay.StateChanged += delegate - { - switch (notificationOverlay.State) - { - case Visibility.Hidden: - backgroundOffset += ToolbarButton.WIDTH / 2; - break; - case Visibility.Visible: - backgroundOffset -= ToolbarButton.WIDTH / 2; - break; - } - intro.MoveToX(backgroundOffset, NotificationOverlay.TRANSITION_LENGTH, Easing.OutQuint); - }; + settings.StateChanged += stateChanged; + notifications.StateChanged += stateChanged; Cursor.State = Visibility.Hidden; } @@ -368,7 +353,7 @@ namespace osu.Game direct.State = Visibility.Hidden; social.State = Visibility.Hidden; userProfile.State = Visibility.Hidden; - notificationOverlay.State = Visibility.Hidden; + notifications.State = Visibility.Hidden; } private void screenChanged(Screen newScreen) From 68a00235b92fc87d54f88c432892ed8a63e06464 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Sun, 24 Dec 2017 14:32:56 +0100 Subject: [PATCH 023/169] simplify offset calculation for background --- osu.Game/OsuGame.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index f757d16c85..67f6e6f4e2 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -274,12 +274,12 @@ namespace osu.Game Action stateChanged = delegate { - float offset = intro.X; + float offset = 0; - if (settings.State == Visibility.Hidden || notifications.State == Visibility.Visible) - offset -= ToolbarButton.WIDTH / 2; - else if (settings.State == Visibility.Visible || notifications.State == Visibility.Hidden) + if (settings.State == Visibility.Visible) offset += ToolbarButton.WIDTH / 2; + if (notifications.State == Visibility.Visible) + offset -= ToolbarButton.WIDTH / 2; intro.MoveToX(offset, SettingsOverlay.TRANSITION_LENGTH, Easing.OutQuint); }; From a7ee6985b050fbf6df3f2880c87f7a1085cec863 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Dec 2017 01:06:33 +0900 Subject: [PATCH 024/169] Add wait step --- osu.Game.Tests/Visual/TestCasePlaySongSelect.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs index 87f71d215b..e27e786a05 100644 --- a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs @@ -104,6 +104,7 @@ namespace osu.Game.Tests.Visual AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap); loadNewSongSelect(); + AddWaitStep(1); AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap); AddStep(@"Sort by Artist", delegate { songSelect.FilterControl.Sort = SortMode.Artist; }); From 8529eb1d3a2350da13d8fb445a7d13375afa1c97 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 25 Dec 2017 14:49:39 +0900 Subject: [PATCH 025/169] Make strong hit misses not count as misses --- osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHitStrong.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHitStrong.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHitStrong.cs index 81b23af1a9..07f7b83cef 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHitStrong.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHitStrong.cs @@ -36,7 +36,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables if (!userTriggered) { if (timeOffset > second_hit_window) - AddJudgement(new TaikoStrongHitJudgement { Result = HitResult.Miss }); + AddJudgement(new TaikoStrongHitJudgement { Result = HitResult.None }); return; } From 844e39a9f6f177be8bc4f41fe8ff69425052d622 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 25 Dec 2017 15:04:22 +0900 Subject: [PATCH 026/169] Make Swells play samples while they're being hit --- .../Objects/Drawables/DrawableSwell.cs | 37 ++++++++++++++----- osu.Game.Rulesets.Taiko/Objects/Swell.cs | 28 +++++++++++++- .../Objects/SwellSampleMapping.cs | 28 ++++++++++++++ .../osu.Game.Rulesets.Taiko.csproj | 1 + 4 files changed, 83 insertions(+), 11 deletions(-) create mode 100644 osu.Game.Rulesets.Taiko/Objects/SwellSampleMapping.cs diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs index 738902846b..d657598554 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs @@ -14,6 +14,7 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics.Shapes; using osu.Game.Rulesets.Taiko.Judgements; +using osu.Framework.Audio; namespace osu.Game.Rulesets.Taiko.Objects.Drawables { @@ -34,10 +35,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables private readonly CircularContainer targetRing; private readonly CircularContainer expandingRing; - private readonly TaikoAction[] rimActions = { TaikoAction.LeftRim, TaikoAction.RightRim }; - private readonly TaikoAction[] centreActions = { TaikoAction.LeftCentre, TaikoAction.RightCentre }; - private TaikoAction[] lastAction; - /// /// The amount of times the user has hit this swell. /// @@ -120,11 +117,14 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OsuColour colours, AudioManager audio) { MainPiece.AccentColour = colours.YellowDark; expandingRing.Colour = colours.YellowLight; targetRing.BorderColour = colours.YellowDark.Opacity(0.25f); + + foreach (var mapping in HitObject.ProgressionSamples) + mapping.RetrieveChannels(audio); } protected override void LoadComplete() @@ -205,22 +205,39 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables } } + private bool? lastWasCentre; + public override bool OnPressed(TaikoAction action) { // Don't handle keys before the swell starts if (Time.Current < HitObject.StartTime) return false; - // Find the keyset which this key corresponds to - var keySet = rimActions.Contains(action) ? rimActions : centreActions; + var isCentre = action == TaikoAction.LeftCentre || action == TaikoAction.RightCentre; - // Ensure alternating keysets - if (keySet == lastAction) + // Ensure alternating centre and rim hits + if (lastWasCentre == isCentre) return false; - lastAction = keySet; + lastWasCentre = isCentre; UpdateJudgement(true); + if (AllJudged) + return true; + + // While the swell hasn't been fully judged, input is still blocked so it doesn't fall through to other hitobjects + // This causes the playfield to not play sounds, so they need to be handled locally + + var mappingIndex = HitObject.ProgressionSamples.BinarySearch(new SwellSampleMapping { Time = Time.Current }); + if (mappingIndex < 0) + mappingIndex = ~mappingIndex - 1; + + var mapping = HitObject.ProgressionSamples[mappingIndex]; + if (isCentre) + mapping.CentreChannel.Play(); + else + mapping.RimChannel.Play(); + return true; } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Swell.cs b/osu.Game.Rulesets.Taiko/Objects/Swell.cs index f74a543ca9..b4fa736045 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Swell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Swell.cs @@ -1,6 +1,11 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.Generic; +using System.Linq; +using osu.Game.Audio; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Rulesets.Taiko.Objects @@ -15,5 +20,26 @@ namespace osu.Game.Rulesets.Taiko.Objects /// The number of hits required to complete the swell successfully. /// public int RequiredHits = 10; + + public List ProgressionSamples = new List(); + + protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty) + { + base.ApplyDefaultsToSelf(controlPointInfo, difficulty); + + var progressionSamplePoints = + new[] { controlPointInfo.SamplePointAt(StartTime) } + .Concat(controlPointInfo.SamplePoints.Where(p => p.Time > StartTime && p.Time <= EndTime)); + + foreach (var point in progressionSamplePoints) + { + ProgressionSamples.Add(new SwellSampleMapping + { + Time = point.Time, + Centre = point.GetSampleInfo(), + Rim = point.GetSampleInfo(SampleInfo.HIT_CLAP) + }); + } + } } -} \ No newline at end of file +} diff --git a/osu.Game.Rulesets.Taiko/Objects/SwellSampleMapping.cs b/osu.Game.Rulesets.Taiko/Objects/SwellSampleMapping.cs new file mode 100644 index 0000000000..99d0e1d0fd --- /dev/null +++ b/osu.Game.Rulesets.Taiko/Objects/SwellSampleMapping.cs @@ -0,0 +1,28 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; +using osu.Game.Audio; + +namespace osu.Game.Rulesets.Taiko.Objects +{ + public class SwellSampleMapping : IComparable + { + public double Time; + public SampleInfo Centre; + public SampleInfo Rim; + + public SampleChannel CentreChannel { get; private set; } + public SampleChannel RimChannel { get; private set; } + + public void RetrieveChannels(AudioManager audio) + { + CentreChannel = Centre.GetChannel(audio.Sample); + RimChannel = Rim.GetChannel(audio.Sample); + } + + public int CompareTo(SwellSampleMapping other) => Time.CompareTo(other.Time); + } +} diff --git a/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj index bb02db62b9..9fa3936153 100644 --- a/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj +++ b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj @@ -74,6 +74,7 @@ + From d288d8a51f370a6f91141c046ad3a67b4a1a6c5a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 25 Dec 2017 15:35:28 +0900 Subject: [PATCH 027/169] Remove SampleInfoList --- osu.Game.Rulesets.Catch/Objects/JuiceStream.cs | 6 +++--- .../Beatmaps/ManiaBeatmapConverter.cs | 2 +- .../Legacy/DistanceObjectPatternGenerator.cs | 3 ++- .../Legacy/EndTimeObjectPatternGenerator.cs | 3 ++- osu.Game.Rulesets.Osu/Objects/Slider.cs | 6 +++--- .../Beatmaps/TaikoBeatmapConverter.cs | 6 +++--- osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs | 3 ++- .../Tests/TestCaseTaikoPlayfield.cs | 14 ++++++++++++-- osu.Game/Audio/SampleInfoList.cs | 18 ------------------ osu.Game/Rulesets/Objects/HitObject.cs | 2 +- .../Legacy/Catch/ConvertHitObjectParser.cs | 2 +- .../Objects/Legacy/ConvertHitObjectParser.cs | 8 ++++---- .../Rulesets/Objects/Legacy/ConvertSlider.cs | 2 +- .../Legacy/Mania/ConvertHitObjectParser.cs | 2 +- .../Legacy/Osu/ConvertHitObjectParser.cs | 4 ++-- .../Legacy/Taiko/ConvertHitObjectParser.cs | 4 ++-- osu.Game/Rulesets/Objects/Types/IHasRepeats.cs | 2 +- osu.Game/osu.Game.csproj | 1 - 18 files changed, 41 insertions(+), 47 deletions(-) delete mode 100644 osu.Game/Audio/SampleInfoList.cs diff --git a/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs b/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs index 8e496c3b0c..7d0d80a0ce 100644 --- a/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs +++ b/osu.Game.Rulesets.Catch/Objects/JuiceStream.cs @@ -86,7 +86,7 @@ namespace osu.Game.Rulesets.Catch.Objects StartTime = lastTickTime, ComboColour = ComboColour, X = Curve.PositionAt(distanceProgress).X / CatchPlayfield.BASE_WIDTH, - Samples = new SampleInfoList(Samples.Select(s => new SampleInfo + Samples = new List(Samples.Select(s => new SampleInfo { Bank = s.Bank, Name = @"slidertick", @@ -108,7 +108,7 @@ namespace osu.Game.Rulesets.Catch.Objects StartTime = repeatStartTime + t, ComboColour = ComboColour, X = Curve.PositionAt(progress).X / CatchPlayfield.BASE_WIDTH, - Samples = new SampleInfoList(Samples.Select(s => new SampleInfo + Samples = new List(Samples.Select(s => new SampleInfo { Bank = s.Bank, Name = @"slidertick", @@ -147,7 +147,7 @@ namespace osu.Game.Rulesets.Catch.Objects set { Curve.ControlPoints = value; } } - public List RepeatSamples { get; set; } = new List(); + public List> RepeatSamples { get; set; } = new List>(); public CurveType CurveType { diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index d5a799b4ed..407d4db143 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -192,7 +192,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps /// /// The time to retrieve the sample info list from. /// - private SampleInfoList sampleInfoListAt(double time) + private List sampleInfoListAt(double time) { var curveData = HitObject as IHasCurve; diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs index 270c264e0c..8251dea5f7 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Collections.Generic; using System.Linq; using osu.Game.Audio; using osu.Game.Beatmaps; @@ -435,7 +436,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy /// /// The time to retrieve the sample info list from. /// - private SampleInfoList sampleInfoListAt(double time) + private List sampleInfoListAt(double time) { var curveData = HitObject as IHasCurve; diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs index 3e9fc1ae27..8e832960df 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mania.MathUtils; using osu.Game.Rulesets.Objects; @@ -77,7 +78,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy }; if (hold.Head.Samples == null) - hold.Head.Samples = new SampleInfoList(); + hold.Head.Samples = new List(); hold.Head.Samples.Add(new SampleInfo { Name = SampleInfo.HIT_NORMAL }); diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index 4f5a44e61d..5f9f11c783 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -57,7 +57,7 @@ namespace osu.Game.Rulesets.Osu.Objects /// internal float LazyTravelDistance; - public List RepeatSamples { get; set; } = new List(); + public List> RepeatSamples { get; set; } = new List>(); public int RepeatCount { get; set; } = 1; private int stackHeight; @@ -138,7 +138,7 @@ namespace osu.Game.Rulesets.Osu.Objects StackHeight = StackHeight, Scale = Scale, ComboColour = ComboColour, - Samples = new SampleInfoList(Samples.Select(s => new SampleInfo + Samples = new List(Samples.Select(s => new SampleInfo { Bank = s.Bank, Name = @"slidertick", @@ -170,7 +170,7 @@ namespace osu.Game.Rulesets.Osu.Objects StackHeight = StackHeight, Scale = Scale, ComboColour = ComboColour, - Samples = new SampleInfoList(RepeatSamples[repeat]) + Samples = new List(RepeatSamples[repeat]) }); } } diff --git a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 9b4a6c47a9..690b80b12c 100644 --- a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -78,7 +78,7 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps var curveData = obj as IHasCurve; // Old osu! used hit sounding to determine various hit type information - SampleInfoList samples = obj.Samples; + List samples = obj.Samples; bool strong = samples.Any(s => s.Name == SampleInfo.HIT_FINISH); @@ -115,12 +115,12 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps if (!isForCurrentRuleset && tickSpacing > 0 && osuDuration < 2 * speedAdjustedBeatLength) { - List allSamples = curveData != null ? curveData.RepeatSamples : new List(new[] { samples }); + List> allSamples = curveData != null ? curveData.RepeatSamples : new List>(new[] { samples }); int i = 0; for (double j = obj.StartTime; j <= obj.StartTime + taikoDuration + tickSpacing / 8; j += tickSpacing) { - SampleInfoList currentSamples = allSamples[i]; + List currentSamples = allSamples[i]; bool isRim = currentSamples.Any(s => s.Name == SampleInfo.HIT_CLAP || s.Name == SampleInfo.HIT_WHISTLE); strong = currentSamples.Any(s => s.Name == SampleInfo.HIT_FINISH); diff --git a/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs b/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs index 4104b59979..5a566fd091 100644 --- a/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs @@ -3,6 +3,7 @@ using osu.Game.Rulesets.Objects.Types; using System; +using System.Collections.Generic; using System.Linq; using osu.Game.Audio; using osu.Game.Beatmaps; @@ -75,7 +76,7 @@ namespace osu.Game.Rulesets.Taiko.Objects TickSpacing = tickSpacing, StartTime = t, IsStrong = IsStrong, - Samples = new SampleInfoList(Samples.Select(s => new SampleInfo + Samples = new List(Samples.Select(s => new SampleInfo { Bank = s.Bank, Name = @"slidertick", diff --git a/osu.Game.Rulesets.Taiko/Tests/TestCaseTaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/Tests/TestCaseTaikoPlayfield.cs index bca4806108..b1e6e9c4ce 100644 --- a/osu.Game.Rulesets.Taiko/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/Tests/TestCaseTaikoPlayfield.cs @@ -165,11 +165,15 @@ namespace osu.Game.Rulesets.Taiko.Tests private void addSwell(double duration = default_duration) { - rulesetContainer.Playfield.Add(new DrawableSwell(new Swell + var swell = new Swell { StartTime = rulesetContainer.Playfield.Time.Current + scroll_time, Duration = duration, - })); + }; + + swell.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); + + rulesetContainer.Playfield.Add(new DrawableSwell(swell)); } private void addDrumRoll(bool strong, double duration = default_duration) @@ -184,6 +188,8 @@ namespace osu.Game.Rulesets.Taiko.Tests Duration = duration, }; + d.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); + rulesetContainer.Playfield.Add(new DrawableDrumRoll(d)); } @@ -195,6 +201,8 @@ namespace osu.Game.Rulesets.Taiko.Tests IsStrong = strong }; + h.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); + if (strong) rulesetContainer.Playfield.Add(new DrawableCentreHitStrong(h)); else @@ -209,6 +217,8 @@ namespace osu.Game.Rulesets.Taiko.Tests IsStrong = strong }; + h.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); + if (strong) rulesetContainer.Playfield.Add(new DrawableRimHitStrong(h)); else diff --git a/osu.Game/Audio/SampleInfoList.cs b/osu.Game/Audio/SampleInfoList.cs deleted file mode 100644 index 06dd716a4a..0000000000 --- a/osu.Game/Audio/SampleInfoList.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System.Collections.Generic; - -namespace osu.Game.Audio -{ - public class SampleInfoList : List - { - public SampleInfoList() - { - } - - public SampleInfoList(IEnumerable elements) : base(elements) - { - } - } -} \ No newline at end of file diff --git a/osu.Game/Rulesets/Objects/HitObject.cs b/osu.Game/Rulesets/Objects/HitObject.cs index e950516bf4..56f7a2e1a2 100644 --- a/osu.Game/Rulesets/Objects/HitObject.cs +++ b/osu.Game/Rulesets/Objects/HitObject.cs @@ -32,7 +32,7 @@ namespace osu.Game.Rulesets.Objects /// and can be treated as the default samples for the hit object. /// /// - public SampleInfoList Samples; + public List Samples; [JsonIgnore] public SampleControlPoint SampleControlPoint; diff --git a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs index 667f921e04..fbf02f5345 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs @@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List repeatSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) { return new ConvertSlider { diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index 0d7d617405..bdbd7a9e65 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -127,7 +127,7 @@ namespace osu.Game.Rulesets.Objects.Legacy } // Generate the final per-node samples - var nodeSamples = new List(nodes); + var nodeSamples = new List>(nodes); for (int i = 0; i <= repeatCount; i++) nodeSamples.Add(convertSoundType(nodeSoundTypes[i], nodeBankInfos[i])); @@ -216,7 +216,7 @@ namespace osu.Game.Rulesets.Objects.Legacy /// The slider repeat count. /// The samples to be played when the repeat nodes are hit. This includes the head and tail of the slider. /// The hit object. - protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List repeatSamples); + protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples); /// /// Creates a legacy Spinner-type hit object. @@ -234,9 +234,9 @@ namespace osu.Game.Rulesets.Objects.Legacy /// The hold end time. protected abstract HitObject CreateHold(Vector2 position, bool newCombo, double endTime); - private SampleInfoList convertSoundType(LegacySoundType type, SampleBankInfo bankInfo) + private List convertSoundType(LegacySoundType type, SampleBankInfo bankInfo) { - var soundTypes = new SampleInfoList + var soundTypes = new List { new SampleInfo { diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs index 698b74cc28..6dc8a07630 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs @@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Objects.Legacy public double Distance { get; set; } - public List RepeatSamples { get; set; } + public List> RepeatSamples { get; set; } public int RepeatCount { get; set; } = 1; public double EndTime => StartTime + RepeatCount * Distance / Velocity; diff --git a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs index 86dd40b06e..2060b84222 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs @@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List repeatSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) { return new ConvertSlider { diff --git a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs index 24c205db13..0062d29446 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs @@ -2,9 +2,9 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; -using osu.Game.Audio; using osu.Game.Rulesets.Objects.Types; using System.Collections.Generic; +using osu.Game.Audio; namespace osu.Game.Rulesets.Objects.Legacy.Osu { @@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List repeatSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) { return new ConvertSlider { diff --git a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs index 0554cfd97d..529a28ac15 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs @@ -2,9 +2,9 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; -using osu.Game.Audio; using osu.Game.Rulesets.Objects.Types; using System.Collections.Generic; +using osu.Game.Audio; namespace osu.Game.Rulesets.Objects.Legacy.Taiko { @@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List repeatSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) { return new ConvertSlider { diff --git a/osu.Game/Rulesets/Objects/Types/IHasRepeats.cs b/osu.Game/Rulesets/Objects/Types/IHasRepeats.cs index 5abad2d661..2fe2424d49 100644 --- a/osu.Game/Rulesets/Objects/Types/IHasRepeats.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasRepeats.cs @@ -19,6 +19,6 @@ namespace osu.Game.Rulesets.Objects.Types /// /// The samples to be played when each repeat node is hit (0 -> first repeat node, 1 -> second repeat node, etc). /// - List RepeatSamples { get; } + List> RepeatSamples { get; } } } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 94678106bf..1c5d20842d 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -239,7 +239,6 @@ - From 0fb620a8d3c730da1f10d1d5ab45482d783a3b2d Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 25 Dec 2017 16:41:18 +0900 Subject: [PATCH 028/169] Make HitObject.Samples non-nullable --- osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs | 5 +++-- osu.Game/Rulesets/Objects/HitObject.cs | 8 +++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index c397ea47ef..be161b9ad3 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -84,10 +84,11 @@ namespace osu.Game.Rulesets.Objects.Drawables [BackgroundDependencyLoader] private void load(AudioManager audio) { - if (HitObject.Samples != null) + if (Samples.Count > 0) { if (HitObject.SampleControlPoint == null) - throw new ArgumentNullException(nameof(HitObject.SampleControlPoint), $"{nameof(HitObject)} must always have an attached {nameof(HitObject.SampleControlPoint)}."); + throw new ArgumentNullException(nameof(HitObject.SampleControlPoint), $"{nameof(HitObject)}s must always have an attached {nameof(HitObject.SampleControlPoint)}." + + $" This is an indication that {nameof(HitObject.ApplyDefaults)} has not been invoked on {this}."); foreach (SampleInfo s in HitObject.Samples) { diff --git a/osu.Game/Rulesets/Objects/HitObject.cs b/osu.Game/Rulesets/Objects/HitObject.cs index 56f7a2e1a2..4f06f6afe1 100644 --- a/osu.Game/Rulesets/Objects/HitObject.cs +++ b/osu.Game/Rulesets/Objects/HitObject.cs @@ -25,6 +25,8 @@ namespace osu.Game.Rulesets.Objects /// public virtual double StartTime { get; set; } + private List samples; + /// /// The samples to be played when this hit object is hit. /// @@ -32,7 +34,11 @@ namespace osu.Game.Rulesets.Objects /// and can be treated as the default samples for the hit object. /// /// - public List Samples; + public List Samples + { + get => samples ?? (samples = new List()); + set => samples = value; + } [JsonIgnore] public SampleControlPoint SampleControlPoint; From 8bfdee586b6cde7effbc17b8c3ae6b7ed1ae4dec Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 25 Dec 2017 16:47:29 +0900 Subject: [PATCH 029/169] Rename SwellSampleMapping -> DrumSampleMapping --- .../Audio/DrumSampleMapping.cs | 40 +++++++++++++++++++ .../Objects/Drawables/DrawableSwell.cs | 3 +- osu.Game.Rulesets.Taiko/Objects/Swell.cs | 15 ++----- .../Objects/SwellSampleMapping.cs | 28 ------------- .../osu.Game.Rulesets.Taiko.csproj | 2 +- 5 files changed, 47 insertions(+), 41 deletions(-) create mode 100644 osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs delete mode 100644 osu.Game.Rulesets.Taiko/Objects/SwellSampleMapping.cs diff --git a/osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs b/osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs new file mode 100644 index 0000000000..25fa9951df --- /dev/null +++ b/osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs @@ -0,0 +1,40 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using osu.Framework.Audio; +using osu.Framework.Audio.Sample; +using osu.Game.Audio; +using osu.Game.Beatmaps.ControlPoints; + +namespace osu.Game.Rulesets.Taiko.Audio +{ + public class DrumSampleMapping : IComparable + { + public double Time; + public readonly SampleInfo Centre; + public readonly SampleInfo Rim; + + public SampleChannel CentreChannel { get; private set; } + public SampleChannel RimChannel { get; private set; } + + public DrumSampleMapping() + { + } + + public DrumSampleMapping(SampleControlPoint samplePoint) + { + Time = samplePoint.Time; + Centre = samplePoint.GetSampleInfo(); + Rim = samplePoint.GetSampleInfo(SampleInfo.HIT_CLAP); + } + + public void RetrieveChannels(AudioManager audio) + { + CentreChannel = Centre.GetChannel(audio.Sample); + RimChannel = Rim.GetChannel(audio.Sample); + } + + public int CompareTo(DrumSampleMapping other) => Time.CompareTo(other.Time); + } +} diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs index d657598554..5131572abd 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs @@ -15,6 +15,7 @@ using OpenTK.Graphics; using osu.Framework.Graphics.Shapes; using osu.Game.Rulesets.Taiko.Judgements; using osu.Framework.Audio; +using osu.Game.Rulesets.Taiko.Audio; namespace osu.Game.Rulesets.Taiko.Objects.Drawables { @@ -228,7 +229,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables // While the swell hasn't been fully judged, input is still blocked so it doesn't fall through to other hitobjects // This causes the playfield to not play sounds, so they need to be handled locally - var mappingIndex = HitObject.ProgressionSamples.BinarySearch(new SwellSampleMapping { Time = Time.Current }); + var mappingIndex = HitObject.ProgressionSamples.BinarySearch(new DrumSampleMapping { Time = Time.Current }); if (mappingIndex < 0) mappingIndex = ~mappingIndex - 1; diff --git a/osu.Game.Rulesets.Taiko/Objects/Swell.cs b/osu.Game.Rulesets.Taiko/Objects/Swell.cs index b4fa736045..849c88ee4d 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Swell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Swell.cs @@ -7,6 +7,7 @@ using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Objects.Types; +using osu.Game.Rulesets.Taiko.Audio; namespace osu.Game.Rulesets.Taiko.Objects { @@ -21,25 +22,17 @@ namespace osu.Game.Rulesets.Taiko.Objects /// public int RequiredHits = 10; - public List ProgressionSamples = new List(); + public List ProgressionSamples = new List(); protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty) { base.ApplyDefaultsToSelf(controlPointInfo, difficulty); - var progressionSamplePoints = - new[] { controlPointInfo.SamplePointAt(StartTime) } + var progressionSamplePoints = new[] { controlPointInfo.SamplePointAt(StartTime) } .Concat(controlPointInfo.SamplePoints.Where(p => p.Time > StartTime && p.Time <= EndTime)); foreach (var point in progressionSamplePoints) - { - ProgressionSamples.Add(new SwellSampleMapping - { - Time = point.Time, - Centre = point.GetSampleInfo(), - Rim = point.GetSampleInfo(SampleInfo.HIT_CLAP) - }); - } + ProgressionSamples.Add(new DrumSampleMapping(point)); } } } diff --git a/osu.Game.Rulesets.Taiko/Objects/SwellSampleMapping.cs b/osu.Game.Rulesets.Taiko/Objects/SwellSampleMapping.cs deleted file mode 100644 index 99d0e1d0fd..0000000000 --- a/osu.Game.Rulesets.Taiko/Objects/SwellSampleMapping.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System; -using osu.Framework.Audio; -using osu.Framework.Audio.Sample; -using osu.Game.Audio; - -namespace osu.Game.Rulesets.Taiko.Objects -{ - public class SwellSampleMapping : IComparable - { - public double Time; - public SampleInfo Centre; - public SampleInfo Rim; - - public SampleChannel CentreChannel { get; private set; } - public SampleChannel RimChannel { get; private set; } - - public void RetrieveChannels(AudioManager audio) - { - CentreChannel = Centre.GetChannel(audio.Sample); - RimChannel = Rim.GetChannel(audio.Sample); - } - - public int CompareTo(SwellSampleMapping other) => Time.CompareTo(other.Time); - } -} diff --git a/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj index 9fa3936153..f1c29c1a34 100644 --- a/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj +++ b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj @@ -44,6 +44,7 @@ + @@ -74,7 +75,6 @@ - From ac8b345bfebba4530c67bbf9d0087472825ace18 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 25 Dec 2017 17:29:20 +0900 Subject: [PATCH 030/169] Make TaikoPlayfield use the new DrumSampleMapping --- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 37 +++++++++----------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 2cc95fc981..96ef86e3ce 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -23,6 +23,7 @@ using osu.Framework.Audio.Sample; using System.Collections.Generic; using osu.Game.Audio; using System; +using osu.Game.Rulesets.Taiko.Audio; namespace osu.Game.Rulesets.Taiko.UI { @@ -62,7 +63,7 @@ namespace osu.Game.Rulesets.Taiko.UI private readonly Box background; private readonly ControlPointInfo controlPointInfo; - private Dictionary drumSampleMappings; + private readonly List drumSampleMappings = new List(); public TaikoPlayfield(ControlPointInfo controlPointInfo) : base(Axes.X) @@ -207,15 +208,16 @@ namespace osu.Game.Rulesets.Taiko.UI [BackgroundDependencyLoader] private void load(OsuColour colours, AudioManager audio) { - drumSampleMappings = new Dictionary(); - foreach (var s in controlPointInfo.SamplePoints) + // We may have 0 sample points, but we need at least the default one + var samplePoints = new[] { controlPointInfo.SamplePointAt(double.MinValue) } + .Concat(controlPointInfo.SamplePoints); + + foreach (var s in samplePoints) { - drumSampleMappings.Add(s, - new DrumSamples - { - Centre = s.GetSampleInfo().GetChannel(audio.Sample), - Rim = s.GetSampleInfo(SampleInfo.HIT_CLAP).GetChannel(audio.Sample) - }); + var mapping = new DrumSampleMapping(s); + mapping.RetrieveChannels(audio); + + drumSampleMappings.Add(mapping); } overlayBackgroundContainer.BorderColour = colours.Gray0; @@ -285,25 +287,20 @@ namespace osu.Game.Rulesets.Taiko.UI public bool OnPressed(TaikoAction action) { - var samplePoint = controlPointInfo.SamplePointAt(Clock.CurrentTime); + var mappingIndex = drumSampleMappings.BinarySearch(new DrumSampleMapping { Time = Time.Current }); + if (mappingIndex < 0) + mappingIndex = ~mappingIndex - 1; - if (!drumSampleMappings.TryGetValue(samplePoint, out var samples)) - throw new InvalidOperationException("Current sample set not found."); + var mapping = drumSampleMappings[mappingIndex]; if (action == TaikoAction.LeftCentre || action == TaikoAction.RightCentre) - samples.Centre.Play(); + mapping.CentreChannel.Play(); else - samples.Rim.Play(); + mapping.RimChannel.Play(); return true; } public bool OnReleased(TaikoAction action) => false; - - private class DrumSamples - { - public SampleChannel Centre; - public SampleChannel Rim; - } } } From affdd81563b21d0fdfec753bc2dcdc46cb417ad9 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 25 Dec 2017 17:29:44 +0900 Subject: [PATCH 031/169] Remove unused usings --- osu.Game.Rulesets.Taiko/Objects/Swell.cs | 1 - osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 3 --- 2 files changed, 4 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/Swell.cs b/osu.Game.Rulesets.Taiko/Objects/Swell.cs index 849c88ee4d..714e5d29ee 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Swell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Swell.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; -using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Objects.Types; diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 96ef86e3ce..229e44cf27 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -19,10 +19,7 @@ using osu.Game.Rulesets.Taiko.Objects.Drawables; using osu.Framework.Input.Bindings; using osu.Game.Beatmaps.ControlPoints; using osu.Framework.Audio; -using osu.Framework.Audio.Sample; using System.Collections.Generic; -using osu.Game.Audio; -using System; using osu.Game.Rulesets.Taiko.Audio; namespace osu.Game.Rulesets.Taiko.UI From 320a6b0480036653aa0e3f976918c00422ccedff Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Dec 2017 17:12:21 +0900 Subject: [PATCH 032/169] Reduce notification output when exceptions are encountered --- osu.Game/OsuGame.cs | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 67f6e6f4e2..95a7e696ea 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -220,15 +220,7 @@ namespace osu.Game Depth = -6, }, overlayContent.Add); - Logger.NewEntry += entry => - { - if (entry.Level < LogLevel.Important) return; - - notifications.Post(new SimpleNotification - { - Text = $@"{entry.Level}: {entry.Message}" - }); - }; + forwardLoggedErrorsToNotifications(); dependencies.Cache(settings); dependencies.Cache(social); @@ -290,6 +282,36 @@ namespace osu.Game Cursor.State = Visibility.Hidden; } + private void forwardLoggedErrorsToNotifications() + { + int recentErrorCount = 0; + + const double debounce = 5000; + + Logger.NewEntry += entry => + { + if (entry.Level < LogLevel.Error || entry.Target == null) return; + + if (recentErrorCount < 2) + { + notifications.Post(new SimpleNotification + { + Icon = FontAwesome.fa_bomb, + Text = (recentErrorCount == 0 ? entry.Message : "Subsequent errors occurred and have been logged.") + "\nClick to view log files.", + Activated = () => + { + Host.Storage.GetStorageForDirectory("logs").OpenInNativeExplorer(); + return true; + } + }); + } + + recentErrorCount++; + + Scheduler.AddDelayed(() => recentErrorCount--, debounce); + }; + } + private Task asyncLoadStream; private void loadComponentSingleFile(T d, Action add) From 6f5f4f76e5f548ac35c256122c5b23be3b8a647f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Dec 2017 18:21:15 +0900 Subject: [PATCH 033/169] Use Logger.Error when exceptions are involved --- osu.Game/OsuGameBase.cs | 3 +-- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 2 +- osu.Game/Screens/Play/Player.cs | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 0ddff5e5aa..ea0bf22112 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -177,8 +177,7 @@ namespace osu.Game } catch (MigrationFailedException e) { - Logger.Log((e.InnerException ?? e).ToString(), LoggingTarget.Database, LogLevel.Error); - Logger.Log("Migration failed! We'll be starting with a fresh database.", LoggingTarget.Database, LogLevel.Error); + Logger.Error(e.InnerException ?? e, "Migration failed! We'll be starting with a fresh database.", LoggingTarget.Database); // if we failed, let's delete the database and start fresh. // todo: we probably want a better (non-destructive) migrations/recovery process at a later point than this. diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 4487f74364..36740b96cb 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Edit } catch (Exception e) { - Logger.Log($"Could not load this beatmap sucessfully ({e})!", LoggingTarget.Runtime, LogLevel.Error); + Logger.Error(e, "Could not load beatmap sucessfully!"); return; } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 340fc39d52..2cbb203c37 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -125,7 +125,7 @@ namespace osu.Game.Screens.Play } catch (Exception e) { - Logger.Log($"Could not load this beatmap sucessfully ({e})!", LoggingTarget.Runtime, LogLevel.Error); + Logger.Error(e, "Could not load beatmap sucessfully!"); //couldn't load, hard abort! Exit(); From 96e4518e606d2282820c7bbceb8057fc049df94c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Dec 2017 18:22:58 +0900 Subject: [PATCH 034/169] Add thread safety --- osu.Game/OsuGame.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 95a7e696ea..750808a291 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -16,6 +16,7 @@ using osu.Game.Screens; using osu.Game.Screens.Menu; using OpenTK; using System.Linq; +using System.Threading; using System.Threading.Tasks; using osu.Framework.Input.Bindings; using osu.Framework.Platform; @@ -306,9 +307,9 @@ namespace osu.Game }); } - recentErrorCount++; + Interlocked.Increment(ref recentErrorCount); - Scheduler.AddDelayed(() => recentErrorCount--, debounce); + Scheduler.AddDelayed(() => Interlocked.Decrement(ref recentErrorCount), debounce); }; } From 40dd66cb974fe56d80cc7de451573a118e8afa6e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Dec 2017 18:31:19 +0900 Subject: [PATCH 035/169] Make TestCaseNotificationOverlay dynamically testable --- osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs b/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs index b93c2d812f..40d7a77c10 100644 --- a/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Graphics; @@ -15,6 +16,15 @@ namespace osu.Game.Tests.Visual private readonly NotificationOverlay manager; private readonly List progressingNotifications = new List(); + public override IReadOnlyList RequiredTypes => new[] + { + typeof(Notification), + typeof(ProgressNotification), + typeof(ProgressCompletionNotification), + typeof(SimpleNotification), + typeof(IHasCompletionTarget), + }; + public TestCaseNotificationOverlay() { progressingNotifications.Clear(); From 861bf55773a153a35cc68c190236851608377ec3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Dec 2017 18:31:32 +0900 Subject: [PATCH 036/169] Adjust notification padding a touch --- osu.Game/Overlays/Notifications/Notification.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Notifications/Notification.cs b/osu.Game/Overlays/Notifications/Notification.cs index 422051364e..dc2dcf2d74 100644 --- a/osu.Game/Overlays/Notifications/Notification.cs +++ b/osu.Game/Overlays/Notifications/Notification.cs @@ -91,7 +91,6 @@ namespace osu.Game.Overlays.Notifications AutoSizeAxes = Axes.Y, Padding = new MarginPadding { - Top = 5, Left = 45, Right = 30 }, @@ -261,4 +260,4 @@ namespace osu.Game.Overlays.Notifications } } } -} \ No newline at end of file +} From 71a94d6b44d427f24b8da0391baf7f602a4cdd2a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Dec 2017 18:52:09 +0900 Subject: [PATCH 037/169] Add a bindable Enabled flag to NotificationManager Also better handles delays before notifications are displayed. --- osu.Desktop/Overlays/VersionManager.cs | 2 +- osu.Game/OsuGame.cs | 29 ++++++++++------ osu.Game/Overlays/NotificationOverlay.cs | 43 ++++++++++++++++++++++-- osu.Game/Screens/Edit/Editor.cs | 2 +- osu.Game/Screens/Loader.cs | 2 +- osu.Game/Screens/Menu/ButtonSystem.cs | 14 ++++---- osu.Game/Screens/Menu/Disclaimer.cs | 2 +- osu.Game/Screens/Menu/Intro.cs | 2 +- osu.Game/Screens/Menu/MainMenu.cs | 2 +- osu.Game/Screens/OsuScreen.cs | 14 +++++++- osu.Game/Screens/Play/Player.cs | 2 +- osu.Game/Screens/Play/PlayerLoader.cs | 2 +- osu.Game/Screens/Tournament/Drawings.cs | 2 +- 13 files changed, 89 insertions(+), 29 deletions(-) diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index 9e13003c3f..c46b0e3d12 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -110,7 +110,7 @@ namespace osu.Desktop.Overlays // only show a notification if we've previously saved a version to the config file (ie. not the first run). if (!string.IsNullOrEmpty(lastVersion)) - Scheduler.AddDelayed(() => notificationOverlay.Post(new UpdateCompleteNotification(version)), 5000); + notificationOverlay.Post(new UpdateCompleteNotification(version)); } } diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 67f6e6f4e2..391a9ee19a 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -64,6 +64,8 @@ namespace osu.Game public float ToolbarOffset => Toolbar.Position.Y + Toolbar.DrawHeight; + public readonly BindableBool ShowOverlays = new BindableBool(); + private OsuScreen screenStack; private VolumeControl volume; @@ -287,6 +289,21 @@ namespace osu.Game settings.StateChanged += stateChanged; notifications.StateChanged += stateChanged; + notifications.Enabled.BindTo(ShowOverlays); + + ShowOverlays.ValueChanged += visible => + { + //central game screen change logic. + if (!visible) + { + hideAllOverlays(); + musicController.State = Visibility.Hidden; + Toolbar.State = Visibility.Hidden; + } + else + Toolbar.State = Visibility.Visible; + }; + Cursor.State = Visibility.Hidden; } @@ -357,6 +374,8 @@ namespace osu.Game notifications.State = Visibility.Hidden; } + private ScheduledDelegate notificationsEnabler; + private void screenChanged(Screen newScreen) { currentScreen = newScreen as OsuScreen; @@ -367,16 +386,6 @@ namespace osu.Game return; } - //central game screen change logic. - if (!currentScreen.ShowOverlays) - { - hideAllOverlays(); - musicController.State = Visibility.Hidden; - Toolbar.State = Visibility.Hidden; - } - else - Toolbar.State = Visibility.Visible; - ScreenChanged?.Invoke(newScreen); } diff --git a/osu.Game/Overlays/NotificationOverlay.cs b/osu.Game/Overlays/NotificationOverlay.cs index a4b5486596..75e2ad0bdc 100644 --- a/osu.Game/Overlays/NotificationOverlay.cs +++ b/osu.Game/Overlays/NotificationOverlay.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Linq; -using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -11,6 +10,9 @@ using OpenTK.Graphics; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.Containers; using System; +using osu.Framework.Allocation; +using osu.Framework.Configuration; +using osu.Framework.Threading; namespace osu.Game.Overlays { @@ -20,6 +22,11 @@ namespace osu.Game.Overlays public const float TRANSITION_LENGTH = 600; + /// + /// Whether posted notifications should be processed. + /// + public readonly BindableBool Enabled = new BindableBool(true); + private FlowContainer sections; /// @@ -27,6 +34,27 @@ namespace osu.Game.Overlays /// public Func GetToolbarHeight; + public NotificationOverlay() + { + ScheduledDelegate notificationsEnabler = null; + Enabled.ValueChanged += v => + { + if (!IsLoaded) + { + processingPosts = v; + return; + } + + notificationsEnabler?.Cancel(); + + if (v) + // we want a slight delay before toggling notifications on to avoid the user becoming overwhelmed. + notificationsEnabler = Scheduler.AddDelayed(() => processingPosts = true, 1000); + else + processingPosts = false; + }; + } + [BackgroundDependencyLoader] private void load() { @@ -84,9 +112,13 @@ namespace osu.Game.Overlays State = Visibility.Hidden; } + private readonly Scheduler postScheduler = new Scheduler(); + + private bool processingPosts = true; + public void Post(Notification notification) { - Schedule(() => + postScheduler.Add(() => { State = Visibility.Visible; @@ -104,6 +136,13 @@ namespace osu.Game.Overlays }); } + protected override void Update() + { + base.Update(); + if (processingPosts) + postScheduler.Update(); + } + protected override void PopIn() { base.PopIn(); diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 19d00f3477..76f51d1c33 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -24,7 +24,7 @@ namespace osu.Game.Screens.Edit { protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4"); - public override bool ShowOverlays => false; + public override bool ShowOverlaysOnEnter => false; private readonly Box bottomBackground; private readonly Container screenContainer; diff --git a/osu.Game/Screens/Loader.cs b/osu.Game/Screens/Loader.cs index ec2e8e0cb1..c96194f63d 100644 --- a/osu.Game/Screens/Loader.cs +++ b/osu.Game/Screens/Loader.cs @@ -17,7 +17,7 @@ namespace osu.Game.Screens { private bool showDisclaimer; - public override bool ShowOverlays => false; + public override bool ShowOverlaysOnEnter => false; public Loader() { diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index ce7856c5a9..c82d90d16c 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -11,12 +11,12 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input; using osu.Game.Graphics; -using osu.Game.Overlays.Toolbar; using OpenTK; using OpenTK.Graphics; using OpenTK.Input; using osu.Framework.Audio.Sample; using osu.Framework.Audio; +using osu.Framework.Configuration; using osu.Framework.Threading; namespace osu.Game.Screens.Menu @@ -25,6 +25,8 @@ namespace osu.Game.Screens.Menu { public event Action StateChanged; + private readonly BindableBool showOverlays = new BindableBool(); + public Action OnEdit; public Action OnExit; public Action OnDirect; @@ -34,8 +36,6 @@ namespace osu.Game.Screens.Menu public Action OnChart; public Action OnTest; - private Toolbar toolbar; - private readonly FlowContainerWithOrigin buttonFlow; //todo: make these non-internal somehow. @@ -131,9 +131,9 @@ namespace osu.Game.Screens.Menu } [BackgroundDependencyLoader(true)] - private void load(AudioManager audio, OsuGame game = null) + private void load(AudioManager audio, OsuGame game) { - toolbar = game?.Toolbar; + if (game != null) showOverlays.BindTo(game.ShowOverlays); sampleBack = audio.Sample.Get(@"Menu/button-back-select"); } @@ -300,7 +300,7 @@ namespace osu.Game.Screens.Menu logoDelayedAction = Scheduler.AddDelayed(() => { - toolbar?.Hide(); + showOverlays.Value = false; logo.ClearTransforms(targetMember: nameof(Position)); logo.RelativePositionAxes = Axes.Both; @@ -329,7 +329,7 @@ namespace osu.Game.Screens.Menu logoTracking = true; logo.Impact(); - toolbar?.Show(); + showOverlays.Value = true; }, 200); break; default: diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index 532ee71b72..d0ad613640 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -18,7 +18,7 @@ namespace osu.Game.Screens.Menu private readonly SpriteIcon icon; private Color4 iconColour; - public override bool ShowOverlays => false; + public override bool ShowOverlaysOnEnter => false; public override bool HasLocalCursorDisplayed => true; diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index d7beb34a2f..a6a1afa320 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -33,7 +33,7 @@ namespace osu.Game.Screens.Menu public override bool HasLocalCursorDisplayed => true; - public override bool ShowOverlays => false; + public override bool ShowOverlaysOnEnter => false; protected override BackgroundScreen CreateBackground() => new BackgroundScreenEmpty(); diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 90f68ba9f1..fac0ec1422 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -24,7 +24,7 @@ namespace osu.Game.Screens.Menu { private readonly ButtonSystem buttons; - public override bool ShowOverlays => buttons.State != MenuState.Initial; + public override bool ShowOverlaysOnEnter => buttons.State != MenuState.Initial; private readonly BackgroundScreenDefault background; private Screen songSelect; diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index 4a27c7f1ea..0013d1a882 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -28,7 +28,12 @@ namespace osu.Game.Screens /// protected virtual BackgroundScreen CreateBackground() => null; - public virtual bool ShowOverlays => true; + protected BindableBool ShowOverlays = new BindableBool(); + + /// + /// Whether overlays should be shown when this screen is entered or resumed. + /// + public virtual bool ShowOverlaysOnEnter => true; protected new OsuGameBase Game => base.Game as OsuGameBase; @@ -70,7 +75,10 @@ namespace osu.Game.Screens } if (osuGame != null) + { Ruleset.BindTo(osuGame.Ruleset); + ShowOverlays.BindTo(osuGame.ShowOverlays); + } sampleExit = audio.Sample.Get(@"UI/screen-back"); } @@ -94,6 +102,8 @@ namespace osu.Game.Screens base.OnResuming(last); logo.AppendAnimatingAction(() => LogoArriving(logo, true), true); sampleExit?.Play(); + + ShowOverlays.Value = ShowOverlaysOnEnter; } protected override void OnSuspending(Screen next) @@ -139,6 +149,8 @@ namespace osu.Game.Screens logo.AppendAnimatingAction(() => LogoArriving(logo, false), true); base.OnEntering(last); + + ShowOverlays.Value = ShowOverlaysOnEnter; } protected override bool OnExiting(Screen next) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 340fc39d52..d5cd89c386 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -35,7 +35,7 @@ namespace osu.Game.Screens.Play { protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap); - public override bool ShowOverlays => false; + public override bool ShowOverlaysOnEnter => false; public override bool HasLocalCursorDisplayed => !pauseContainer.IsPaused && !HasFailed && RulesetContainer.ProvidingUserCursor; diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index de67bef004..c2a8f13207 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -23,7 +23,7 @@ namespace osu.Game.Screens.Play private BeatmapMetadataDisplay info; private bool showOverlays = true; - public override bool ShowOverlays => showOverlays; + public override bool ShowOverlaysOnEnter => showOverlays; public override bool AllowBeatmapRulesetChange => false; diff --git a/osu.Game/Screens/Tournament/Drawings.cs b/osu.Game/Screens/Tournament/Drawings.cs index 3e7ab56c99..fbf24eb609 100644 --- a/osu.Game/Screens/Tournament/Drawings.cs +++ b/osu.Game/Screens/Tournament/Drawings.cs @@ -29,7 +29,7 @@ namespace osu.Game.Screens.Tournament { private const string results_filename = "drawings_results.txt"; - public override bool ShowOverlays => false; + public override bool ShowOverlaysOnEnter => false; protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault(); From bb4b5bebf915eaf845d702e10b2285274c510839 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Mon, 25 Dec 2017 15:25:47 +0100 Subject: [PATCH 038/169] fix supporter icon in profile missing its background also it doesn't show up on profiles without supporter anymore --- osu.Game.Tests/Visual/TestCaseUserProfile.cs | 25 +++++++- osu.Game/Overlays/Profile/ProfileHeader.cs | 31 +++------- osu.Game/Overlays/Profile/SupporterIcon.cs | 61 ++++++++++++++++++++ osu.Game/Overlays/UserProfileOverlay.cs | 8 +-- osu.Game/Users/UserPanel.cs | 50 +--------------- osu.Game/osu.Game.csproj | 1 + 6 files changed, 97 insertions(+), 79 deletions(-) create mode 100644 osu.Game/Overlays/Profile/SupporterIcon.cs diff --git a/osu.Game.Tests/Visual/TestCaseUserProfile.cs b/osu.Game.Tests/Visual/TestCaseUserProfile.cs index 38d59f03b5..88627755f4 100644 --- a/osu.Game.Tests/Visual/TestCaseUserProfile.cs +++ b/osu.Game.Tests/Visual/TestCaseUserProfile.cs @@ -13,6 +13,8 @@ namespace osu.Game.Tests.Visual { public class TestCaseUserProfile : OsuTestCase { + private readonly TestUserProfileOverlay profile; + public override IReadOnlyList RequiredTypes => new[] { typeof(ProfileHeader), @@ -23,8 +25,7 @@ namespace osu.Game.Tests.Visual public TestCaseUserProfile() { - var profile = new UserProfileOverlay(); - Add(profile); + Add(profile = new TestUserProfileOverlay()); AddStep("Show offline dummy", () => profile.ShowUser(new User { @@ -48,6 +49,9 @@ namespace osu.Game.Tests.Visual Data = Enumerable.Range(2345, 45).Concat(Enumerable.Range(2109, 40)).ToArray() } }, false)); + + checkSupporterTag(false); + AddStep("Show ppy", () => profile.ShowUser(new User { Username = @"peppy", @@ -55,6 +59,9 @@ namespace osu.Game.Tests.Visual Country = new Country { FullName = @"Australia", FlagName = @"AU" }, CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg" })); + + checkSupporterTag(true); + AddStep("Show flyte", () => profile.ShowUser(new User { Username = @"flyte", @@ -62,8 +69,22 @@ namespace osu.Game.Tests.Visual Country = new Country { FullName = @"Japan", FlagName = @"JP" }, CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg" })); + AddStep("Hide", profile.Hide); AddStep("Show without reload", profile.Show); } + + private void checkSupporterTag(bool isSupporter) + { + AddUntilStep(() => profile.Header.User != null, "wait for load"); + if(isSupporter) + AddAssert("is supporter", () => profile.Header.SupporterTag.Alpha == 1); + else + AddAssert("no supporter", () => profile.Header.SupporterTag.Alpha == 0); + } + + private class TestUserProfileOverlay : UserProfileOverlay { + public new ProfileHeader Header => base.Header; + } } } diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index a706799664..f000ca74d4 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -29,7 +29,8 @@ namespace osu.Game.Overlays.Profile private readonly FillFlowContainer scoreText, scoreNumberText; private readonly RankGraph rankGraph; - private readonly Container coverContainer, supporterTag; + public readonly SupporterIcon SupporterTag; + private readonly Container coverContainer; private readonly Sprite levelBadge; private readonly SpriteText levelText; private readonly GradeBadge gradeSSPlus, gradeSS, gradeSPlus, gradeS, gradeA; @@ -94,32 +95,13 @@ namespace osu.Game.Overlays.Profile AutoSizeAxes = Axes.Both, Children = new Drawable[] { - supporterTag = new CircularContainer + SupporterTag = new SupporterIcon { + Alpha = 0, Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Y = -75, - Size = new Vector2(25, 25), - Masking = true, - BorderThickness = 3, - BorderColour = Color4.White, - Alpha = 0, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Alpha = 0, - AlwaysPresent = true - }, - new SpriteIcon - { - Icon = FontAwesome.fa_heart, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(12), - } - } + Size = new Vector2(25, 25) }, new LinkFlowContainer.ProfileLink(user) { @@ -328,7 +310,8 @@ namespace osu.Game.Overlays.Profile Depth = float.MaxValue, }, coverContainer.Add); - if (user.IsSupporter) supporterTag.Show(); + if (user.IsSupporter) + SupporterTag.Show(); if (!string.IsNullOrEmpty(user.Colour)) { diff --git a/osu.Game/Overlays/Profile/SupporterIcon.cs b/osu.Game/Overlays/Profile/SupporterIcon.cs new file mode 100644 index 0000000000..570d5a13bb --- /dev/null +++ b/osu.Game/Overlays/Profile/SupporterIcon.cs @@ -0,0 +1,61 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; +using osu.Game.Graphics.Backgrounds; + +namespace osu.Game.Overlays.Profile +{ + public class SupporterIcon : CircularContainer + { + private readonly Box background; + + public SupporterIcon() + { + Masking = true; + Children = new Drawable[] + { + new Box { RelativeSizeAxes = Axes.Both }, + new CircularContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Scale = new Vector2(0.8f), + Masking = true, + Children = new Drawable[] + { + background = new Box { RelativeSizeAxes = Axes.Both }, + new Triangles + { + TriangleScale = 0.2f, + ColourLight = OsuColour.FromHex(@"ff7db7"), + ColourDark = OsuColour.FromHex(@"de5b95"), + RelativeSizeAxes = Axes.Both, + Velocity = 0.3f, + }, + } + }, + new SpriteIcon + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Icon = FontAwesome.fa_heart, + Scale = new Vector2(0.45f), + } + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + background.Colour = colours.Pink; + } + } +} diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index 7374a9aa44..9aa660147a 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -28,7 +28,7 @@ namespace osu.Game.Overlays private ProfileSection[] sections; private GetUserRequest userReq; private APIAccess api; - private ProfileHeader header; + protected ProfileHeader Header; private SectionsContainer sectionsContainer; private ProfileTabControl tabs; @@ -113,12 +113,12 @@ namespace osu.Game.Overlays Colour = OsuColour.Gray(0.2f) }); - header = new ProfileHeader(user); + Header = new ProfileHeader(user); Add(sectionsContainer = new SectionsContainer { RelativeSizeAxes = Axes.Both, - ExpandableHeader = header, + ExpandableHeader = Header, FixedHeader = tabs, HeaderBackground = new Box { @@ -169,7 +169,7 @@ namespace osu.Game.Overlays private void userLoadComplete(User user) { - header.User = user; + Header.User = user; foreach (string id in user.ProfileOrder) { diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index d056afcf54..a2cc8e8d49 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -16,8 +16,8 @@ using osu.Game.Overlays; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.UserInterface; using osu.Framework.Graphics.Cursor; -using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Containers; +using osu.Game.Overlays.Profile; namespace osu.Game.Users { @@ -220,53 +220,5 @@ namespace osu.Game.Users { new OsuMenuItem("View Profile", MenuItemType.Highlighted, ViewProfile), }; - - private class SupporterIcon : CircularContainer - { - private readonly Box background; - - public SupporterIcon() - { - Masking = true; - Children = new Drawable[] - { - new Box { RelativeSizeAxes = Axes.Both }, - new CircularContainer - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Scale = new Vector2(0.8f), - Masking = true, - Children = new Drawable[] - { - background = new Box { RelativeSizeAxes = Axes.Both }, - new Triangles - { - TriangleScale = 0.2f, - ColourLight = OsuColour.FromHex(@"ff7db7"), - ColourDark = OsuColour.FromHex(@"de5b95"), - RelativeSizeAxes = Axes.Both, - Velocity = 0.3f, - }, - } - }, - new SpriteIcon - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Icon = FontAwesome.fa_heart, - Scale = new Vector2(0.45f), - } - }; - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - background.Colour = colours.Pink; - } - } } } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 94678106bf..18134582f3 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -268,6 +268,7 @@ + From f76878e2fea6b2e7fd23163cd9d42dc6211f623d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Dec 2017 00:34:12 +0900 Subject: [PATCH 039/169] Add a very basic popup testcase --- osu.Game.Tests/Visual/TestCasePopupDialog.cs | 37 ++++++++++++++++++++ osu.Game.Tests/osu.Game.Tests.csproj | 1 + 2 files changed, 38 insertions(+) create mode 100644 osu.Game.Tests/Visual/TestCasePopupDialog.cs diff --git a/osu.Game.Tests/Visual/TestCasePopupDialog.cs b/osu.Game.Tests/Visual/TestCasePopupDialog.cs new file mode 100644 index 0000000000..ed9c47a253 --- /dev/null +++ b/osu.Game.Tests/Visual/TestCasePopupDialog.cs @@ -0,0 +1,37 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Game.Graphics; +using osu.Game.Overlays.Dialog; + +namespace osu.Game.Tests.Visual +{ + public class TestCasePopupDialog : OsuTestCase + { + public TestCasePopupDialog() + { + var popup = new PopupDialog + { + RelativeSizeAxes = Axes.Both, + State = Framework.Graphics.Containers.Visibility.Visible, + Icon = FontAwesome.fa_assistive_listening_systems, + HeaderText = @"This is a test popup", + BodyText = "I can say lots of stuff and even wrap my words!", + Buttons = new PopupDialogButton[] + { + new PopupDialogCancelButton + { + Text = @"Yes. That you can.", + }, + new PopupDialogOkButton + { + Text = @"You're a fake!", + }, + } + }; + + Add(popup); + } + } +} diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index ff012bb6e2..134fc4a6ac 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -134,6 +134,7 @@ + From 929633efaa8ad611969e678a9cfe796d4014b86b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Dec 2017 00:34:40 +0900 Subject: [PATCH 040/169] Make body text in popups word wrap properly --- osu.Game/Overlays/Dialog/PopupDialog.cs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/osu.Game/Overlays/Dialog/PopupDialog.cs b/osu.Game/Overlays/Dialog/PopupDialog.cs index 9b19b8150e..d2bd50cad6 100644 --- a/osu.Game/Overlays/Dialog/PopupDialog.cs +++ b/osu.Game/Overlays/Dialog/PopupDialog.cs @@ -32,7 +32,7 @@ namespace osu.Game.Overlays.Dialog private readonly FillFlowContainer buttonsContainer; private readonly SpriteIcon icon; private readonly SpriteText header; - private readonly SpriteText body; + private readonly TextFlowContainer body; public FontAwesome Icon { @@ -48,7 +48,6 @@ namespace osu.Game.Overlays.Dialog public string BodyText { - get { return body.Text; } set { body.Text = value; } } @@ -220,17 +219,15 @@ namespace osu.Game.Overlays.Dialog { Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, - Text = @"Header", TextSize = 25, Shadow = true, }, - body = new OsuSpriteText + body = new OsuTextFlowContainer(t => t.TextSize = 18) { - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - Text = @"Body", - TextSize = 18, - Shadow = true, + Padding = new MarginPadding(15), + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + TextAnchor = Anchor.TopCentre, }, }, }, From 3c1654e5e496d8c22927019ca9a90d0177045b58 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Dec 2017 00:44:35 +0900 Subject: [PATCH 041/169] Fix many instances of non-osu-prefixed text classes being used Results in incorrect default formatting. --- osu.Game/Overlays/BeatmapSet/Info.cs | 3 ++- osu.Game/Overlays/MedalSplash/DrawableMedal.cs | 3 ++- osu.Game/Overlays/Notifications/ProgressNotification.cs | 3 ++- osu.Game/Overlays/Notifications/SimpleNotification.cs | 5 +++-- osu.Game/Overlays/OnScreenDisplay.cs | 7 ++++--- osu.Game/Overlays/Profile/ProfileHeader.cs | 2 +- osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs | 3 ++- osu.Game/Screens/Ranking/Results.cs | 9 +++++---- osu.Game/Screens/Ranking/ResultsPageScore.cs | 4 ++-- osu.Game/Screens/Select/BeatmapDetails.cs | 5 +++-- osu.Game/Tests/Visual/TestCasePerformancePoints.cs | 3 +-- osu.sln.DotSettings | 5 +++++ 12 files changed, 32 insertions(+), 20 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Info.cs b/osu.Game/Overlays/BeatmapSet/Info.cs index bd108a193b..b4aea898b2 100644 --- a/osu.Game/Overlays/BeatmapSet/Info.cs +++ b/osu.Game/Overlays/BeatmapSet/Info.cs @@ -8,6 +8,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Beatmaps; using osu.Game.Graphics; +using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; @@ -176,7 +177,7 @@ namespace osu.Game.Overlays.BeatmapSet Shadow = false, Margin = new MarginPadding { Top = 20 }, }, - textFlow = new TextFlowContainer + textFlow = new OsuTextFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, diff --git a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs index 53d77dab6c..c6be428987 100644 --- a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs +++ b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Game.Graphics; +using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Users; @@ -88,7 +89,7 @@ namespace osu.Game.Overlays.MedalSplash Alpha = 0f, Scale = new Vector2(1f / scale_when_full), }, - description = new TextFlowContainer + description = new OsuTextFlowContainer { TextAnchor = Anchor.TopCentre, Anchor = Anchor.TopCentre, diff --git a/osu.Game/Overlays/Notifications/ProgressNotification.cs b/osu.Game/Overlays/Notifications/ProgressNotification.cs index 12c7fe64ba..9211c227f8 100644 --- a/osu.Game/Overlays/Notifications/ProgressNotification.cs +++ b/osu.Game/Overlays/Notifications/ProgressNotification.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; +using osu.Game.Graphics.Containers; using OpenTK; using OpenTK.Graphics; @@ -114,7 +115,7 @@ namespace osu.Game.Overlays.Notifications RelativeSizeAxes = Axes.Both, }); - Content.Add(textDrawable = new TextFlowContainer(t => + Content.Add(textDrawable = new OsuTextFlowContainer(t => { t.TextSize = 16; }) diff --git a/osu.Game/Overlays/Notifications/SimpleNotification.cs b/osu.Game/Overlays/Notifications/SimpleNotification.cs index daf1ac838d..0b8b365c48 100644 --- a/osu.Game/Overlays/Notifications/SimpleNotification.cs +++ b/osu.Game/Overlays/Notifications/SimpleNotification.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; +using osu.Game.Graphics.Containers; using OpenTK; namespace osu.Game.Overlays.Notifications @@ -58,7 +59,7 @@ namespace osu.Game.Overlays.Notifications } }); - Content.Add(textDrawable = new TextFlowContainer(t => t.TextSize = 16) + Content.Add(textDrawable = new OsuTextFlowContainer(t => t.TextSize = 16) { Colour = OsuColour.Gray(128), AutoSizeAxes = Axes.Y, @@ -87,4 +88,4 @@ namespace osu.Game.Overlays.Notifications } } } -} \ No newline at end of file +} diff --git a/osu.Game/Overlays/OnScreenDisplay.cs b/osu.Game/Overlays/OnScreenDisplay.cs index dcab942522..ce0feeb4c6 100644 --- a/osu.Game/Overlays/OnScreenDisplay.cs +++ b/osu.Game/Overlays/OnScreenDisplay.cs @@ -14,6 +14,7 @@ using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; using osu.Framework.Extensions.Color4Extensions; +using osu.Game.Graphics.Sprites; namespace osu.Game.Overlays { @@ -63,7 +64,7 @@ namespace osu.Game.Overlays Width = 240, RelativeSizeAxes = Axes.Y, }, - textLine1 = new SpriteText + textLine1 = new OsuSpriteText { Padding = new MarginPadding(10), Font = @"Exo2.0-Black", @@ -72,7 +73,7 @@ namespace osu.Game.Overlays Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, }, - textLine2 = new SpriteText + textLine2 = new OsuSpriteText { TextSize = 24, Font = @"Exo2.0-Light", @@ -97,7 +98,7 @@ namespace osu.Game.Overlays Origin = Anchor.TopCentre, AutoSizeAxes = Axes.Both }, - textLine3 = new SpriteText + textLine3 = new OsuSpriteText { Padding = new MarginPadding { Bottom = 15 }, Font = @"Exo2.0-Bold", diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index a706799664..4cdb6ec958 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -473,7 +473,7 @@ namespace osu.Game.Overlays.Profile Width = width, Height = 26 }); - Add(numberText = new SpriteText + Add(numberText = new OsuSpriteText { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs index 8a835634b8..904ed609e8 100644 --- a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input; using osu.Game.Graphics; +using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Users; @@ -120,7 +121,7 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu } } }, - new TextFlowContainer(t => { t.TextSize = 19; }) + new OsuTextFlowContainer(t => { t.TextSize = 19; }) { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index 8e27cb235c..406887624c 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -17,6 +17,7 @@ using OpenTK.Graphics; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics.Sprites; namespace osu.Game.Screens.Ranking { @@ -183,7 +184,7 @@ namespace osu.Game.Screens.Ranking Height = 50, Margin = new MarginPadding { Bottom = 110 }, }, - new SpriteText + new OsuSpriteText { Text = $"{score.MaxCombo}x", TextSize = 40, @@ -194,7 +195,7 @@ namespace osu.Game.Screens.Ranking Anchor = Anchor.CentreLeft, Origin = Anchor.BottomCentre, }, - new SpriteText + new OsuSpriteText { Text = "max combo", TextSize = 20, @@ -204,7 +205,7 @@ namespace osu.Game.Screens.Ranking Anchor = Anchor.CentreLeft, Origin = Anchor.TopCentre, }, - new SpriteText + new OsuSpriteText { Text = $"{score.Accuracy:P2}", TextSize = 40, @@ -215,7 +216,7 @@ namespace osu.Game.Screens.Ranking Anchor = Anchor.CentreLeft, Origin = Anchor.BottomCentre, }, - new SpriteText + new OsuSpriteText { Text = "accuracy", TextSize = 20, diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index 911b688669..4c776aa7ab 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -201,14 +201,14 @@ namespace osu.Game.Screens.Ranking { Children = new Drawable[] { - new SpriteText { + new OsuSpriteText { Text = statistic.Value.ToString().PadLeft(4, '0'), Colour = colours.Gray7, TextSize = 30, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, }, - new SpriteText { + new OsuSpriteText { Text = statistic.Key, Colour = colours.Gray7, Font = @"Exo2.0-Bold", diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index a9a778fe17..79d76dd00e 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -17,6 +17,7 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Extensions.Color4Extensions; using osu.Game.Screens.Select.Details; using osu.Game.Beatmaps; +using osu.Game.Graphics.Containers; namespace osu.Game.Screens.Select { @@ -334,7 +335,7 @@ namespace osu.Game.Screens.Select TextSize = 14, }, }, - textFlow = new TextFlowContainer + textFlow = new OsuTextFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, @@ -359,7 +360,7 @@ namespace osu.Game.Screens.Select private void setTextAsync(string text) { - LoadComponentAsync(new TextFlowContainer(s => s.TextSize = 14) + LoadComponentAsync(new OsuTextFlowContainer(s => s.TextSize = 14) { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, diff --git a/osu.Game/Tests/Visual/TestCasePerformancePoints.cs b/osu.Game/Tests/Visual/TestCasePerformancePoints.cs index f71bece279..8984fc843f 100644 --- a/osu.Game/Tests/Visual/TestCasePerformancePoints.cs +++ b/osu.Game/Tests/Visual/TestCasePerformancePoints.cs @@ -12,7 +12,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.Sprites; using osu.Framework.Input; using osu.Game.Beatmaps; using osu.Game.Graphics.Sprites; @@ -224,7 +223,7 @@ namespace osu.Game.Tests.Visual if (!api.IsLoggedIn) { - InternalChild = new SpriteText + InternalChild = new OsuSpriteText { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index 2f52881d6d..20007e3306 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -172,6 +172,7 @@ NEXT_LINE NEXT_LINE True + NEVER False False True @@ -655,7 +656,11 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-frame <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> True + True + True + True True True + True True True From 3c8d30f8e67158ce5b105ce28eff9b726aa09093 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Dec 2017 00:37:50 +0900 Subject: [PATCH 042/169] Add a dialog offering to import beatmaps from stable --- osu.Game/Beatmaps/BeatmapManager.cs | 6 ++-- .../Sections/Maintenance/GeneralSettings.cs | 3 +- .../Screens/Select/ImportFromStablePopup.cs | 33 +++++++++++++++++++ osu.Game/Screens/Select/PlaySongSelect.cs | 15 +++++++-- osu.Game/osu.Game.csproj | 1 + 5 files changed, 52 insertions(+), 6 deletions(-) create mode 100644 osu.Game/Screens/Select/ImportFromStablePopup.cs diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 0325785016..c86860f7b0 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -697,10 +697,12 @@ namespace osu.Game.Beatmaps } } + public bool StableInstallationAvailable => GetStableStorage?.Invoke() != null; + /// /// This is a temporary method and will likely be replaced by a full-fledged (and more correctly placed) migration process in the future. /// - public void ImportFromStable() + public async Task ImportFromStable() { var stable = GetStableStorage?.Invoke(); @@ -710,7 +712,7 @@ namespace osu.Game.Beatmaps return; } - Import(stable.GetDirectories("Songs")); + await Task.Factory.StartNew(() => Import(stable.GetDirectories("Songs")), TaskCreationOptions.LongRunning); } public void DeleteAll() diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs index e288445c6d..9ab4143613 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs @@ -30,8 +30,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance Action = () => { importButton.Enabled.Value = false; - Task.Factory.StartNew(beatmaps.ImportFromStable) - .ContinueWith(t => Schedule(() => importButton.Enabled.Value = true), TaskContinuationOptions.LongRunning); + beatmaps.ImportFromStable().ContinueWith(t => Schedule(() => importButton.Enabled.Value = true)); } }, deleteButton = new DangerousSettingsButton diff --git a/osu.Game/Screens/Select/ImportFromStablePopup.cs b/osu.Game/Screens/Select/ImportFromStablePopup.cs new file mode 100644 index 0000000000..489ab79fa4 --- /dev/null +++ b/osu.Game/Screens/Select/ImportFromStablePopup.cs @@ -0,0 +1,33 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using osu.Game.Graphics; +using osu.Game.Overlays.Dialog; + +namespace osu.Game.Screens.Select +{ + public class ImportFromStablePopup : PopupDialog + { + public ImportFromStablePopup(Action importFromStable) + { + HeaderText = @"You have no beatmaps!"; + BodyText = "An existing copy of osu! was found, though.\nWould you like to import your beatmaps?"; + + Icon = FontAwesome.fa_trash_o; + + Buttons = new PopupDialogButton[] + { + new PopupDialogOkButton + { + Text = @"Yes please!", + Action = importFromStable + }, + new PopupDialogCancelButton + { + Text = @"No, I'd like to start from scratch", + }, + }; + } + } +} diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 4a0ee31fbb..727cdb9959 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Screens; using osu.Game.Beatmaps; using osu.Game.Graphics; +using osu.Game.Overlays; using osu.Game.Overlays.Mods; using osu.Game.Screens.Edit; using osu.Game.Screens.Play; @@ -45,8 +46,8 @@ namespace osu.Game.Screens.Select private SampleChannel sampleConfirm; - [BackgroundDependencyLoader] - private void load(OsuColour colours, AudioManager audio) + [BackgroundDependencyLoader(true)] + private void load(OsuColour colours, AudioManager audio, BeatmapManager beatmaps, DialogOverlay dialogOverlay) { sampleConfirm = audio.Sample.Get(@"SongSelect/confirm-selection"); @@ -59,6 +60,16 @@ namespace osu.Game.Screens.Select ValidForResume = false; Push(new Editor()); }, Key.Number3); + + if (dialogOverlay != null) + { + Schedule(() => + { + // if we have no beatmaps but osu-stable is found, let's prompt the user to import. + if (!beatmaps.GetAllUsableBeatmapSets().Any() && beatmaps.StableInstallationAvailable) + dialogOverlay.Push(new ImportFromStablePopup(() => beatmaps.ImportFromStable())); + }); + } } protected override void UpdateBeatmap(WorkingBeatmap beatmap) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 94678106bf..fa25fa7048 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -310,6 +310,7 @@ + From 48e55a06865ab8cf50987edfb588c3d6b7ba3d71 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Mon, 25 Dec 2017 16:52:17 +0100 Subject: [PATCH 043/169] fix formatting and test add missing line --- osu.Game.Tests/Visual/TestCaseUserProfile.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseUserProfile.cs b/osu.Game.Tests/Visual/TestCaseUserProfile.cs index 88627755f4..13b6509740 100644 --- a/osu.Game.Tests/Visual/TestCaseUserProfile.cs +++ b/osu.Game.Tests/Visual/TestCaseUserProfile.cs @@ -26,6 +26,11 @@ namespace osu.Game.Tests.Visual public TestCaseUserProfile() { Add(profile = new TestUserProfileOverlay()); + } + + protected override void LoadComplete() + { + base.LoadComplete(); AddStep("Show offline dummy", () => profile.ShowUser(new User { @@ -77,13 +82,14 @@ namespace osu.Game.Tests.Visual private void checkSupporterTag(bool isSupporter) { AddUntilStep(() => profile.Header.User != null, "wait for load"); - if(isSupporter) + if (isSupporter) AddAssert("is supporter", () => profile.Header.SupporterTag.Alpha == 1); else AddAssert("no supporter", () => profile.Header.SupporterTag.Alpha == 0); } - private class TestUserProfileOverlay : UserProfileOverlay { + private class TestUserProfileOverlay : UserProfileOverlay + { public new ProfileHeader Header => base.Header; } } From dff082ed940ad1cd93e0a52f62bd8dd46a5546f6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Dec 2017 01:12:46 +0900 Subject: [PATCH 044/169] Make toolbar testable and add the most basic of visual tests --- osu.Game.Tests/Visual/TestCaseToolbar.cs | 25 +++++++++++++++++++ osu.Game.Tests/osu.Game.Tests.csproj | 1 + .../Overlays/Toolbar/ToolbarChatButton.cs | 2 +- .../Overlays/Toolbar/ToolbarDirectButton.cs | 2 +- .../Overlays/Toolbar/ToolbarModeSelector.cs | 7 ++++-- .../Overlays/Toolbar/ToolbarMusicButton.cs | 2 +- .../Toolbar/ToolbarNotificationButton.cs | 2 +- .../Toolbar/ToolbarOverlayToggleButton.cs | 7 ++++-- .../Overlays/Toolbar/ToolbarSettingsButton.cs | 2 +- .../Overlays/Toolbar/ToolbarSocialButton.cs | 2 +- 10 files changed, 42 insertions(+), 10 deletions(-) create mode 100644 osu.Game.Tests/Visual/TestCaseToolbar.cs diff --git a/osu.Game.Tests/Visual/TestCaseToolbar.cs b/osu.Game.Tests/Visual/TestCaseToolbar.cs new file mode 100644 index 0000000000..9045249b9a --- /dev/null +++ b/osu.Game.Tests/Visual/TestCaseToolbar.cs @@ -0,0 +1,25 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Collections.Generic; +using osu.Framework.Graphics.Containers; +using osu.Game.Overlays.Toolbar; + +namespace osu.Game.Tests.Visual +{ + public class TestCaseToolbar : OsuTestCase + { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(ToolbarButton), + typeof(ToolbarModeSelector), + typeof(ToolbarModeButton), + }; + + public TestCaseToolbar() + { + Add(new Toolbar { State = Visibility.Visible }); + } + } +} diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index ff012bb6e2..71703d264a 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -148,6 +148,7 @@ + diff --git a/osu.Game/Overlays/Toolbar/ToolbarChatButton.cs b/osu.Game/Overlays/Toolbar/ToolbarChatButton.cs index ed206e7e1d..b0171feb30 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarChatButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarChatButton.cs @@ -13,7 +13,7 @@ namespace osu.Game.Overlays.Toolbar SetIcon(FontAwesome.fa_comments); } - [BackgroundDependencyLoader] + [BackgroundDependencyLoader(true)] private void load(ChatOverlay chat) { StateContainer = chat; diff --git a/osu.Game/Overlays/Toolbar/ToolbarDirectButton.cs b/osu.Game/Overlays/Toolbar/ToolbarDirectButton.cs index 7d25440e2c..5c64ae69ec 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarDirectButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarDirectButton.cs @@ -13,7 +13,7 @@ namespace osu.Game.Overlays.Toolbar SetIcon(FontAwesome.fa_osu_chevron_down_o); } - [BackgroundDependencyLoader] + [BackgroundDependencyLoader(true)] private void load(DirectOverlay direct) { StateContainer = direct; diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs index 319dd63bc9..f38c772890 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs @@ -64,7 +64,7 @@ namespace osu.Game.Overlays.Toolbar }; } - [BackgroundDependencyLoader] + [BackgroundDependencyLoader(true)] private void load(RulesetStore rulesets, OsuGame game) { foreach (var r in rulesets.AvailableRulesets) @@ -81,7 +81,10 @@ namespace osu.Game.Overlays.Toolbar ruleset.ValueChanged += rulesetChanged; ruleset.DisabledChanged += disabledChanged; - ruleset.BindTo(game.Ruleset); + if (game != null) + ruleset.BindTo(game.Ruleset); + else + ruleset.Value = rulesets.AvailableRulesets.FirstOrDefault(); } public override bool HandleInput => !ruleset.Disabled; diff --git a/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs b/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs index d150aacdf9..81c57a984f 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarMusicButton.cs @@ -13,7 +13,7 @@ namespace osu.Game.Overlays.Toolbar Icon = FontAwesome.fa_music; } - [BackgroundDependencyLoader] + [BackgroundDependencyLoader(true)] private void load(MusicController music) { StateContainer = music; diff --git a/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs b/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs index e11a22d675..dbe8b48424 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs @@ -18,7 +18,7 @@ namespace osu.Game.Overlays.Toolbar TooltipSub = "Waiting for 'ya"; } - [BackgroundDependencyLoader] + [BackgroundDependencyLoader(true)] private void load(NotificationOverlay notificationOverlay) { StateContainer = notificationOverlay; diff --git a/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs b/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs index 69fdd27d5d..59314b8771 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs @@ -21,8 +21,11 @@ namespace osu.Game.Overlays.Toolbar set { stateContainer = value; - Action = stateContainer.ToggleVisibility; - stateContainer.StateChanged += stateChanged; + if (stateContainer != null) + { + Action = stateContainer.ToggleVisibility; + stateContainer.StateChanged += stateChanged; + } } } diff --git a/osu.Game/Overlays/Toolbar/ToolbarSettingsButton.cs b/osu.Game/Overlays/Toolbar/ToolbarSettingsButton.cs index cf4f664e81..d0d76dd5d2 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarSettingsButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarSettingsButton.cs @@ -15,7 +15,7 @@ namespace osu.Game.Overlays.Toolbar TooltipSub = "Change your settings"; } - [BackgroundDependencyLoader] + [BackgroundDependencyLoader(true)] private void load(SettingsOverlay settings) { StateContainer = settings; diff --git a/osu.Game/Overlays/Toolbar/ToolbarSocialButton.cs b/osu.Game/Overlays/Toolbar/ToolbarSocialButton.cs index 234d6f0f9a..74d1da4384 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarSocialButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarSocialButton.cs @@ -13,7 +13,7 @@ namespace osu.Game.Overlays.Toolbar Icon = FontAwesome.fa_users; } - [BackgroundDependencyLoader] + [BackgroundDependencyLoader(true)] private void load(SocialOverlay chat) { StateContainer = chat; From bb33d0211a5802c6706c3a18570cbc16ffa4c227 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Dec 2017 01:36:58 +0900 Subject: [PATCH 045/169] Add a count of unread notifications to the toolbar --- osu.Game.Tests/Visual/TestCaseToolbar.cs | 16 ++++- .../Toolbar/ToolbarNotificationButton.cs | 64 +++++++++++++++++++ 2 files changed, 79 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/TestCaseToolbar.cs b/osu.Game.Tests/Visual/TestCaseToolbar.cs index 9045249b9a..9f538af09b 100644 --- a/osu.Game.Tests/Visual/TestCaseToolbar.cs +++ b/osu.Game.Tests/Visual/TestCaseToolbar.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Linq; using osu.Framework.Graphics.Containers; using osu.Game.Overlays.Toolbar; @@ -15,11 +16,24 @@ namespace osu.Game.Tests.Visual typeof(ToolbarButton), typeof(ToolbarModeSelector), typeof(ToolbarModeButton), + typeof(ToolbarNotificationButton), }; public TestCaseToolbar() { - Add(new Toolbar { State = Visibility.Visible }); + var toolbar = new Toolbar { State = Visibility.Visible }; + + Add(toolbar); + + var notificationButton = toolbar.Children.OfType().Last().Children.OfType().First(); + + void setNotifications(int count) => AddStep($"set notification count to {count}", () => notificationButton.NotificationCount.Value = count); + + setNotifications(1); + setNotifications(2); + setNotifications(3); + setNotifications(0); + setNotifications(144); } } } diff --git a/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs b/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs index dbe8b48424..78a04d156a 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs @@ -2,8 +2,14 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using OpenTK; +using OpenTK.Graphics; namespace osu.Game.Overlays.Toolbar { @@ -11,17 +17,75 @@ namespace osu.Game.Overlays.Toolbar { protected override Anchor TooltipAnchor => Anchor.TopRight; + public BindableInt NotificationCount = new BindableInt(); + + private CountCircle countDisplay; + public ToolbarNotificationButton() { Icon = FontAwesome.fa_bars; TooltipMain = "Notifications"; TooltipSub = "Waiting for 'ya"; + + Add(countDisplay = new CountCircle + { + Alpha = 0, + Height = 16, + RelativePositionAxes = Axes.Both, + Origin = Anchor.TopCentre, + Position = new Vector2(0.7f, 0.05f), + }); } [BackgroundDependencyLoader(true)] private void load(NotificationOverlay notificationOverlay) { StateContainer = notificationOverlay; + + NotificationCount.ValueChanged += count => + { + if (count == 0) + countDisplay.FadeOut(200, Easing.OutQuint); + else + countDisplay.FadeIn(200, Easing.OutQuint); + + countDisplay.Count = count; + }; + } + + private class CountCircle : CompositeDrawable + { + private readonly OsuSpriteText count; + + public int Count + { + set { count.Text = value.ToString("#,0"); } + } + + public CountCircle() + { + AutoSizeAxes = Axes.X; + + InternalChildren = new Drawable[] + { + new Circle + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Red + }, + count = new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Y = -1, + TextSize = 14, + Padding = new MarginPadding(5), + Colour = Color4.White, + UseFullGlyphHeight = true, + Font = "Exo2.0-Bold", + } + }; + } } } } From 1fc240f6c594ad7f1469f4276a0778034c59bb2e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Dec 2017 01:50:05 +0900 Subject: [PATCH 046/169] Expose unread notification count --- .../Visual/TestCaseNotificationOverlay.cs | 7 ++++ osu.Game/Overlays/NotificationOverlay.cs | 42 ++++++++++++------- .../Notifications/NotificationSection.cs | 4 +- 3 files changed, 37 insertions(+), 16 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs b/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs index b93c2d812f..233914767d 100644 --- a/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Graphics; +using osu.Framework.Graphics.Sprites; using osu.Framework.MathUtils; using osu.Game.Overlays; using osu.Game.Overlays.Notifications; @@ -25,6 +26,12 @@ namespace osu.Game.Tests.Visual Origin = Anchor.TopRight }); + SpriteText displayedCount = new SpriteText(); + + Content.Add(displayedCount); + + manager.UnreadCount.ValueChanged += count => { displayedCount.Text = $"displayed count: {count}"; }; + AddStep(@"toggle", manager.ToggleVisibility); AddStep(@"simple #1", sendHelloNotification); AddStep(@"simple #2", sendAmazingNotification); diff --git a/osu.Game/Overlays/NotificationOverlay.cs b/osu.Game/Overlays/NotificationOverlay.cs index a4b5486596..2f1c3285ef 100644 --- a/osu.Game/Overlays/NotificationOverlay.cs +++ b/osu.Game/Overlays/NotificationOverlay.cs @@ -11,6 +11,7 @@ using OpenTK.Graphics; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.Containers; using System; +using osu.Framework.Configuration; namespace osu.Game.Overlays { @@ -75,34 +76,38 @@ namespace osu.Game.Overlays }; } + private int totalCount => sections.Select(c => c.DisplayedCount).Sum(); + private int unreadCount => sections.Select(c => c.UnreadCount).Sum(); + + public readonly BindableInt UnreadCount = new BindableInt(); + private int runningDepth; private void notificationClosed() { // hide ourselves if all notifications have been dismissed. - if (sections.Select(c => c.DisplayedCount).Sum() == 0) + if (totalCount == 0) State = Visibility.Hidden; + + updateCounts(); } - public void Post(Notification notification) + public void Post(Notification notification) => Schedule(() => { - Schedule(() => - { - State = Visibility.Visible; + ++runningDepth; + notification.Depth = notification.DisplayOnTop ? runningDepth : -runningDepth; - ++runningDepth; - notification.Depth = notification.DisplayOnTop ? runningDepth : -runningDepth; + notification.Closed += notificationClosed; - notification.Closed += notificationClosed; + var hasCompletionTarget = notification as IHasCompletionTarget; + if (hasCompletionTarget != null) + hasCompletionTarget.CompletionTarget = Post; - var hasCompletionTarget = notification as IHasCompletionTarget; - if (hasCompletionTarget != null) - hasCompletionTarget.CompletionTarget = Post; + var ourType = notification.GetType(); + sections.Children.FirstOrDefault(s => s.AcceptTypes.Any(accept => accept.IsAssignableFrom(ourType)))?.Add(notification); - var ourType = notification.GetType(); - sections.Children.FirstOrDefault(s => s.AcceptTypes.Any(accept => accept.IsAssignableFrom(ourType)))?.Add(notification); - }); - } + updateCounts(); + }); protected override void PopIn() { @@ -122,9 +127,16 @@ namespace osu.Game.Overlays this.FadeTo(0, TRANSITION_LENGTH, Easing.OutQuint); } + private void updateCounts() + { + UnreadCount.Value = unreadCount; + } + private void markAllRead() { sections.Children.ForEach(s => s.MarkAllRead()); + + updateCounts(); } protected override void UpdateAfterChildren() diff --git a/osu.Game/Overlays/Notifications/NotificationSection.cs b/osu.Game/Overlays/Notifications/NotificationSection.cs index 09768ba0ea..2bd0321d12 100644 --- a/osu.Game/Overlays/Notifications/NotificationSection.cs +++ b/osu.Game/Overlays/Notifications/NotificationSection.cs @@ -26,6 +26,8 @@ namespace osu.Game.Overlays.Notifications public int DisplayedCount => notifications.Count(n => !n.WasClosed); + public int UnreadCount => notifications.Count(n => !n.WasClosed && !n.Read); + public void Add(Notification notification) => notifications.Add(notification); public IEnumerable AcceptTypes; @@ -157,4 +159,4 @@ namespace osu.Game.Overlays.Notifications notifications?.Children.ForEach(n => n.Read = true); } } -} \ No newline at end of file +} From 0886107ec911c79d6d3f25317b31c0586ddc0ba2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Dec 2017 01:56:57 +0900 Subject: [PATCH 047/169] Connect counter with button display --- .../Toolbar/ToolbarNotificationButton.cs | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs b/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs index 78a04d156a..faf802f5e7 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs @@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Toolbar public BindableInt NotificationCount = new BindableInt(); - private CountCircle countDisplay; + private readonly CountCircle countDisplay; public ToolbarNotificationButton() { @@ -32,8 +32,8 @@ namespace osu.Game.Overlays.Toolbar Alpha = 0, Height = 16, RelativePositionAxes = Axes.Both, - Origin = Anchor.TopCentre, - Position = new Vector2(0.7f, 0.05f), + Origin = Anchor.Centre, + Position = new Vector2(0.7f, 0.25f), }); } @@ -42,24 +42,34 @@ namespace osu.Game.Overlays.Toolbar { StateContainer = notificationOverlay; + if (notificationOverlay != null) + NotificationCount.BindTo(notificationOverlay.UnreadCount); + NotificationCount.ValueChanged += count => { if (count == 0) countDisplay.FadeOut(200, Easing.OutQuint); else + { + countDisplay.Count = count; countDisplay.FadeIn(200, Easing.OutQuint); - - countDisplay.Count = count; + } }; } private class CountCircle : CompositeDrawable { private readonly OsuSpriteText count; + private readonly Circle circle; public int Count { - set { count.Text = value.ToString("#,0"); } + set + { + count.Text = value.ToString("#,0"); + circle.FlashColour(Color4.White, 600, Easing.OutQuint); + this.ScaleTo(1.1f).Then().ScaleTo(1, 600, Easing.OutElastic); + } } public CountCircle() @@ -68,7 +78,7 @@ namespace osu.Game.Overlays.Toolbar InternalChildren = new Drawable[] { - new Circle + circle = new Circle { RelativeSizeAxes = Axes.Both, Colour = Color4.Red From d8f084474216cccb9add01ec3ec40f282bc42bce Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Dec 2017 11:24:13 +0900 Subject: [PATCH 048/169] Fix null reference in release builds Intro may not be initialised yet --- osu.Game/OsuGame.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 67f6e6f4e2..fe7ca77d44 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -272,7 +272,7 @@ namespace osu.Game }; } - Action stateChanged = delegate + void updateScreenOffset() { float offset = 0; @@ -281,11 +281,11 @@ namespace osu.Game if (notifications.State == Visibility.Visible) offset -= ToolbarButton.WIDTH / 2; - intro.MoveToX(offset, SettingsOverlay.TRANSITION_LENGTH, Easing.OutQuint); - }; + screenStack.MoveToX(offset, SettingsOverlay.TRANSITION_LENGTH, Easing.OutQuint); + } - settings.StateChanged += stateChanged; - notifications.StateChanged += stateChanged; + settings.StateChanged += _ => updateScreenOffset(); + notifications.StateChanged += _ => updateScreenOffset(); Cursor.State = Visibility.Hidden; } From 798c2c66667cdb7f5b2c54d59731d3ae71486894 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Dec 2017 12:57:45 +0900 Subject: [PATCH 049/169] Add special logic to song select to avoid obvious clipping when notifications are displayed Not sure if we will keep this going forward (there will likely be an opaque tab control on the notifications overlay similar to options) but let's go with this for now. --- osu.Game/Screens/Select/FilterControl.cs | 4 +- osu.Game/Screens/Select/SongSelect.cs | 48 +++++++++++++++++------- 2 files changed, 37 insertions(+), 15 deletions(-) diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 1b86cec613..2dbd63f77b 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -75,7 +75,7 @@ namespace osu.Game.Screens.Select { Children = new Drawable[] { - new Box + Background = new Box { Colour = Color4.Black, Alpha = 0.8f, @@ -167,6 +167,8 @@ namespace osu.Game.Screens.Select private Bindable showConverted; + public readonly Box Background; + [BackgroundDependencyLoader(permitNulls: true)] private void load(OsuColour colours, OsuGame osu, OsuConfigManager config) { diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 68ee08e721..8189624ce1 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -103,21 +103,41 @@ namespace osu.Game.Screens.Select Right = left_area_padding * 2, } }, - carousel = new BeatmapCarousel + new Container { - RelativeSizeAxes = Axes.Y, - Size = new Vector2(carousel_width, 1), - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, - SelectionChanged = carouselSelectionChanged, - BeatmapSetsChanged = carouselBeatmapsLoaded, - }, - FilterControl = new FilterControl - { - RelativeSizeAxes = Axes.X, - Height = filter_height, - FilterChanged = c => carousel.Filter(c), - Exit = Exit, + RelativeSizeAxes = Axes.Both, + Masking = true, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Width = 2, //avoid horizontal masking so the panels don't clip when screen stack is pushed. + Child = new Container + { + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Width = 0.5f, + Children = new Drawable[] + { + carousel = new BeatmapCarousel + { + Masking = false, + RelativeSizeAxes = Axes.Y, + Size = new Vector2(carousel_width, 1), + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + SelectionChanged = carouselSelectionChanged, + BeatmapSetsChanged = carouselBeatmapsLoaded, + }, + FilterControl = new FilterControl + { + RelativeSizeAxes = Axes.X, + Height = filter_height, + FilterChanged = c => carousel.Filter(c), + Background = { Width = 2 }, + Exit = Exit, + }, + } + }, }, beatmapInfoWedge = new BeatmapInfoWedge { From c737e5245e0442d097d7e9efd6cd6c18cd9dfc60 Mon Sep 17 00:00:00 2001 From: FreezyLemon Date: Tue, 26 Dec 2017 01:50:05 +0100 Subject: [PATCH 050/169] Removed unnecessary SelectNext() call and change to dummy map when no items present --- osu.Game/Screens/Select/BeatmapCarousel.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index be176c1459..802667e6a0 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -142,7 +142,6 @@ namespace osu.Game.Screens.Select if (newSet == null) { itemsCache.Invalidate(); - SelectNext(); return; } @@ -512,7 +511,7 @@ namespace osu.Game.Screens.Select currentY += DrawHeight / 2; scrollableContent.Height = currentY; - if (selectedBeatmapSet != null && selectedBeatmapSet.State.Value != CarouselItemState.Selected) + if (!Items.Any() || selectedBeatmapSet != null && selectedBeatmapSet.State.Value != CarouselItemState.Selected) { selectedBeatmapSet = null; SelectionChanged?.Invoke(null); From c82273572430b6bcefa1b3dbfe45644e543fed2f Mon Sep 17 00:00:00 2001 From: FreezyLemon Date: Tue, 26 Dec 2017 03:57:18 +0100 Subject: [PATCH 051/169] Added tests for hiding diffs (and especially the last visible diff) --- .../Visual/TestCaseBeatmapCarousel.cs | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapCarousel.cs b/osu.Game.Tests/Visual/TestCaseBeatmapCarousel.cs index 639befef74..c09b987407 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapCarousel.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapCarousel.cs @@ -70,6 +70,7 @@ namespace osu.Game.Tests.Visual testRemoveAll(); testEmptyTraversal(); + testHiding(); } private void ensureRandomFetchSuccess() => @@ -295,6 +296,40 @@ namespace osu.Game.Tests.Visual checkNoSelection(); } + private void testHiding() + { + var hidingSet = createTestBeatmapSet(1); + hidingSet.Beatmaps[1].Hidden = true; + AddStep("Add set with diff 2 hidden", () => carousel.UpdateBeatmapSet(hidingSet)); + setSelected(1, 1); + + checkVisibleItemCount(true, 2); + advanceSelection(true); + checkSelected(1, 3); + + setHidden(3); + checkSelected(1, 1); + + setHidden(2, false); + advanceSelection(true); + checkSelected(1, 2); + + setHidden(1); + checkSelected(1, 2); + + setHidden(2); + checkNoSelection(); + + void setHidden(int diff, bool hidden = true) + { + AddStep((hidden ? "" : "un") + $"hide diff {diff}", () => + { + hidingSet.Beatmaps[diff - 1].Hidden = hidden; + carousel.UpdateBeatmapSet(hidingSet); + }); + } + } + private BeatmapSetInfo createTestBeatmapSet(int i) { return new BeatmapSetInfo From 09ce24a7dba54deb34d629e75eee48978d1f26a8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Dec 2017 13:41:02 +0900 Subject: [PATCH 052/169] Switch to a better way of deciding on null selection This avoids `SelectionChanged` potentially being invoked multiple times after `selectedBeatmapSet` is already `null`. --- osu.Game/Screens/Select/BeatmapCarousel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 802667e6a0..87edfe9692 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -511,7 +511,7 @@ namespace osu.Game.Screens.Select currentY += DrawHeight / 2; scrollableContent.Height = currentY; - if (!Items.Any() || selectedBeatmapSet != null && selectedBeatmapSet.State.Value != CarouselItemState.Selected) + if (selectedBeatmapSet != null && (selectedBeatmap == null || selectedBeatmapSet.State.Value != CarouselItemState.Selected)) { selectedBeatmapSet = null; SelectionChanged?.Invoke(null); From 14162b5d46a56f4f8da0e01829c25c67c331b1e9 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 26 Dec 2017 14:18:23 +0900 Subject: [PATCH 053/169] Make InputDrum handle all Normals/Claps, hitobjects all others --- .../Audio/DrumSampleMapping.cs | 47 +++++++++++-------- .../Objects/Drawables/DrawableSwell.cs | 19 -------- .../Drawables/DrawableTaikoHitObject.cs | 7 +++ osu.Game.Rulesets.Taiko/Objects/Swell.cs | 13 ----- osu.Game.Rulesets.Taiko/UI/InputDrum.cs | 36 ++++++++++++-- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 38 ++------------- .../Objects/Drawables/DrawableHitObject.cs | 6 ++- 7 files changed, 72 insertions(+), 94 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs b/osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs index 25fa9951df..9d0037b97a 100644 --- a/osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs +++ b/osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs @@ -1,7 +1,8 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; +using System.Collections.Generic; +using System.Linq; using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Game.Audio; @@ -9,32 +10,38 @@ using osu.Game.Beatmaps.ControlPoints; namespace osu.Game.Rulesets.Taiko.Audio { - public class DrumSampleMapping : IComparable + public class DrumSampleMapping { - public double Time; - public readonly SampleInfo Centre; - public readonly SampleInfo Rim; + private readonly ControlPointInfo controlPoints; + private readonly Dictionary mappings = new Dictionary(); - public SampleChannel CentreChannel { get; private set; } - public SampleChannel RimChannel { get; private set; } - - public DrumSampleMapping() + public DrumSampleMapping(ControlPointInfo controlPoints, AudioManager audio) { + this.controlPoints = controlPoints; + + IEnumerable samplePoints; + if (controlPoints.SamplePoints.Count == 0) + // Get the default sample point + samplePoints = new[] { controlPoints.SamplePointAt(double.MinValue) }; + else + samplePoints = controlPoints.SamplePoints; + + foreach (var s in samplePoints.Distinct()) + { + mappings[s] = new DrumSample + { + Centre = s.GetSampleInfo().GetChannel(audio.Sample), + Rim = s.GetSampleInfo(SampleInfo.HIT_CLAP).GetChannel(audio.Sample) + }; + } } - public DrumSampleMapping(SampleControlPoint samplePoint) - { - Time = samplePoint.Time; - Centre = samplePoint.GetSampleInfo(); - Rim = samplePoint.GetSampleInfo(SampleInfo.HIT_CLAP); - } + public DrumSample SampleAt(double time) => mappings[controlPoints.SamplePointAt(time)]; - public void RetrieveChannels(AudioManager audio) + public class DrumSample { - CentreChannel = Centre.GetChannel(audio.Sample); - RimChannel = Rim.GetChannel(audio.Sample); + public SampleChannel Centre; + public SampleChannel Rim; } - - public int CompareTo(DrumSampleMapping other) => Time.CompareTo(other.Time); } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs index 5131572abd..3099c6984c 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs @@ -123,9 +123,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables MainPiece.AccentColour = colours.YellowDark; expandingRing.Colour = colours.YellowLight; targetRing.BorderColour = colours.YellowDark.Opacity(0.25f); - - foreach (var mapping in HitObject.ProgressionSamples) - mapping.RetrieveChannels(audio); } protected override void LoadComplete() @@ -223,22 +220,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables UpdateJudgement(true); - if (AllJudged) - return true; - - // While the swell hasn't been fully judged, input is still blocked so it doesn't fall through to other hitobjects - // This causes the playfield to not play sounds, so they need to be handled locally - - var mappingIndex = HitObject.ProgressionSamples.BinarySearch(new DrumSampleMapping { Time = Time.Current }); - if (mappingIndex < 0) - mappingIndex = ~mappingIndex - 1; - - var mapping = HitObject.ProgressionSamples[mappingIndex]; - if (isCentre) - mapping.CentreChannel.Play(); - else - mapping.RimChannel.Play(); - return true; } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs index 7976cbbbc1..cf0df260b1 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs @@ -6,6 +6,10 @@ using osu.Framework.Input.Bindings; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; using OpenTK; +using System; +using System.Linq; +using osu.Game.Audio; +using System.Collections.Generic; namespace osu.Game.Rulesets.Taiko.Objects.Drawables { @@ -35,6 +39,9 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables MainPiece.KiaiMode = HitObject.Kiai; } + // Normal and clap samples are handled by the drum + protected override IEnumerable GetSamples() => HitObject.Samples.Where(s => s.Name != SampleInfo.HIT_NORMAL && s.Name != SampleInfo.HIT_CLAP); + protected virtual TaikoPiece CreateMainPiece() => new CirclePiece(); public abstract bool OnPressed(TaikoAction action); diff --git a/osu.Game.Rulesets.Taiko/Objects/Swell.cs b/osu.Game.Rulesets.Taiko/Objects/Swell.cs index 714e5d29ee..95ea9f8aa4 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Swell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Swell.cs @@ -20,18 +20,5 @@ namespace osu.Game.Rulesets.Taiko.Objects /// The number of hits required to complete the swell successfully. /// public int RequiredHits = 10; - - public List ProgressionSamples = new List(); - - protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty) - { - base.ApplyDefaultsToSelf(controlPointInfo, difficulty); - - var progressionSamplePoints = new[] { controlPointInfo.SamplePointAt(StartTime) } - .Concat(controlPointInfo.SamplePoints.Where(p => p.Time > StartTime && p.Time <= EndTime)); - - foreach (var point in progressionSamplePoints) - ProgressionSamples.Add(new DrumSampleMapping(point)); - } } } diff --git a/osu.Game.Rulesets.Taiko/UI/InputDrum.cs b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs index 5e79166bec..8c02b21733 100644 --- a/osu.Game.Rulesets.Taiko/UI/InputDrum.cs +++ b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs @@ -2,14 +2,20 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Collections.Generic; +using System.Linq; using OpenTK; using osu.Framework.Allocation; +using osu.Framework.Audio; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Framework.Input.Bindings; +using osu.Game.Audio; +using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics; +using osu.Game.Rulesets.Taiko.Audio; namespace osu.Game.Rulesets.Taiko.UI { @@ -18,16 +24,26 @@ namespace osu.Game.Rulesets.Taiko.UI /// internal class InputDrum : Container { - public InputDrum() + private const float middle_split = 0.025f; + + private readonly ControlPointInfo controlPoints; + + public InputDrum(ControlPointInfo controlPoints) { + this.controlPoints = controlPoints; + RelativeSizeAxes = Axes.Both; FillMode = FillMode.Fit; + } - const float middle_split = 0.025f; + [BackgroundDependencyLoader] + private void load(AudioManager audio) + { + var sampleMappings = new DrumSampleMapping(controlPoints, audio); Children = new Drawable[] { - new TaikoHalfDrum(false) + new TaikoHalfDrum(false, sampleMappings) { Name = "Left Half", Anchor = Anchor.Centre, @@ -38,7 +54,7 @@ namespace osu.Game.Rulesets.Taiko.UI RimAction = TaikoAction.LeftRim, CentreAction = TaikoAction.LeftCentre }, - new TaikoHalfDrum(true) + new TaikoHalfDrum(true, sampleMappings) { Name = "Right Half", Anchor = Anchor.Centre, @@ -72,8 +88,12 @@ namespace osu.Game.Rulesets.Taiko.UI private readonly Sprite centre; private readonly Sprite centreHit; - public TaikoHalfDrum(bool flipped) + private readonly DrumSampleMapping sampleMappings; + + public TaikoHalfDrum(bool flipped, DrumSampleMapping sampleMappings) { + this.sampleMappings = sampleMappings; + Masking = true; Children = new Drawable[] @@ -128,15 +148,21 @@ namespace osu.Game.Rulesets.Taiko.UI Drawable target = null; Drawable back = null; + var drumSample = sampleMappings.SampleAt(Time.Current); + if (action == CentreAction) { target = centreHit; back = centre; + + drumSample.Centre.Play(); } else if (action == RimAction) { target = rimHit; back = rim; + + drumSample.Rim.Play(); } if (target != null) diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 229e44cf27..14f8de0f48 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -24,7 +24,7 @@ using osu.Game.Rulesets.Taiko.Audio; namespace osu.Game.Rulesets.Taiko.UI { - public class TaikoPlayfield : ScrollingPlayfield, IKeyBindingHandler + public class TaikoPlayfield : ScrollingPlayfield { /// /// Default height of a when inside a . @@ -59,13 +59,9 @@ namespace osu.Game.Rulesets.Taiko.UI private readonly Box overlayBackground; private readonly Box background; - private readonly ControlPointInfo controlPointInfo; - private readonly List drumSampleMappings = new List(); - - public TaikoPlayfield(ControlPointInfo controlPointInfo) + public TaikoPlayfield(ControlPointInfo controlPoints) : base(Axes.X) { - this.controlPointInfo = controlPointInfo; AddRangeInternal(new Drawable[] { backgroundContainer = new Container @@ -158,7 +154,7 @@ namespace osu.Game.Rulesets.Taiko.UI { RelativeSizeAxes = Axes.Both, }, - new InputDrum + new InputDrum(controlPoints) { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, @@ -205,17 +201,7 @@ namespace osu.Game.Rulesets.Taiko.UI [BackgroundDependencyLoader] private void load(OsuColour colours, AudioManager audio) { - // We may have 0 sample points, but we need at least the default one - var samplePoints = new[] { controlPointInfo.SamplePointAt(double.MinValue) } - .Concat(controlPointInfo.SamplePoints); - foreach (var s in samplePoints) - { - var mapping = new DrumSampleMapping(s); - mapping.RetrieveChannels(audio); - - drumSampleMappings.Add(mapping); - } overlayBackgroundContainer.BorderColour = colours.Gray0; overlayBackground.Colour = colours.Gray1; @@ -281,23 +267,5 @@ namespace osu.Game.Rulesets.Taiko.UI kiaiExplosionContainer.Add(new KiaiHitExplosion(judgedObject, isRim)); } } - - public bool OnPressed(TaikoAction action) - { - var mappingIndex = drumSampleMappings.BinarySearch(new DrumSampleMapping { Time = Time.Current }); - if (mappingIndex < 0) - mappingIndex = ~mappingIndex - 1; - - var mapping = drumSampleMappings[mappingIndex]; - - if (action == TaikoAction.LeftCentre || action == TaikoAction.RightCentre) - mapping.CentreChannel.Play(); - else - mapping.RimChannel.Play(); - - return true; - } - - public bool OnReleased(TaikoAction action) => false; } } diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index be161b9ad3..ab4c04be3f 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -72,6 +72,7 @@ namespace osu.Game.Rulesets.Objects.Drawables public IReadOnlyList Judgements => judgements; protected List Samples = new List(); + protected virtual IEnumerable GetSamples() => HitObject.Samples; public readonly Bindable State = new Bindable(); @@ -84,13 +85,14 @@ namespace osu.Game.Rulesets.Objects.Drawables [BackgroundDependencyLoader] private void load(AudioManager audio) { - if (Samples.Count > 0) + var samples = GetSamples(); + if (samples.Any()) { if (HitObject.SampleControlPoint == null) throw new ArgumentNullException(nameof(HitObject.SampleControlPoint), $"{nameof(HitObject)}s must always have an attached {nameof(HitObject.SampleControlPoint)}." + $" This is an indication that {nameof(HitObject.ApplyDefaults)} has not been invoked on {this}."); - foreach (SampleInfo s in HitObject.Samples) + foreach (SampleInfo s in samples) { SampleInfo localSampleInfo = new SampleInfo { From 35d7fa8a81ae017f964c1644ddac3db0b7f94135 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 26 Dec 2017 14:18:38 +0900 Subject: [PATCH 054/169] Cleanup things that are now not needed with these changes --- osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs | 2 +- .../Objects/Drawables/DrawableHitStrong.cs | 2 +- .../Objects/Drawables/DrawableSwell.cs | 4 +--- .../Objects/Drawables/DrawableTaikoHitObject.cs | 1 - osu.Game.Rulesets.Taiko/Objects/Swell.cs | 5 ----- osu.Game.Rulesets.Taiko/UI/InputDrum.cs | 3 --- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 8 +------- 7 files changed, 4 insertions(+), 21 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs index df33aae94e..fd35f0eaec 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs @@ -68,7 +68,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables validKeyPressed = HitActions.Contains(action); // Only count this as handled if the new judgement is a hit - return UpdateJudgement(true) && Judgements.LastOrDefault()?.IsHit == true; + return UpdateJudgement(true); } protected override void Update() diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHitStrong.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHitStrong.cs index 07f7b83cef..cda82afe0e 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHitStrong.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHitStrong.cs @@ -83,7 +83,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables return false; // Assume the intention was to hit the strong hit with both keys only if the first key is still being held down - return firstKeyHeld && UpdateJudgement(true) && Judgements.LastOrDefault()?.IsHit == true; + return firstKeyHeld && UpdateJudgement(true); } } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs index 3099c6984c..5ca33aaea2 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs @@ -14,8 +14,6 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics.Shapes; using osu.Game.Rulesets.Taiko.Judgements; -using osu.Framework.Audio; -using osu.Game.Rulesets.Taiko.Audio; namespace osu.Game.Rulesets.Taiko.Objects.Drawables { @@ -118,7 +116,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables } [BackgroundDependencyLoader] - private void load(OsuColour colours, AudioManager audio) + private void load(OsuColour colours) { MainPiece.AccentColour = colours.YellowDark; expandingRing.Colour = colours.YellowLight; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs index cf0df260b1..92da3fe09e 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs @@ -6,7 +6,6 @@ using osu.Framework.Input.Bindings; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; using OpenTK; -using System; using System.Linq; using osu.Game.Audio; using System.Collections.Generic; diff --git a/osu.Game.Rulesets.Taiko/Objects/Swell.cs b/osu.Game.Rulesets.Taiko/Objects/Swell.cs index 95ea9f8aa4..cd2876ea2d 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Swell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Swell.cs @@ -1,12 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Collections.Generic; -using System.Linq; -using osu.Game.Beatmaps; -using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Objects.Types; -using osu.Game.Rulesets.Taiko.Audio; namespace osu.Game.Rulesets.Taiko.Objects { diff --git a/osu.Game.Rulesets.Taiko/UI/InputDrum.cs b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs index 8c02b21733..bf1274256b 100644 --- a/osu.Game.Rulesets.Taiko/UI/InputDrum.cs +++ b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs @@ -2,8 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Collections.Generic; -using System.Linq; using OpenTK; using osu.Framework.Allocation; using osu.Framework.Audio; @@ -12,7 +10,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Framework.Input.Bindings; -using osu.Game.Audio; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics; using osu.Game.Rulesets.Taiko.Audio; diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 14f8de0f48..3fdbd056ce 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -16,11 +16,7 @@ using osu.Framework.Extensions.Color4Extensions; using System.Linq; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Taiko.Objects.Drawables; -using osu.Framework.Input.Bindings; using osu.Game.Beatmaps.ControlPoints; -using osu.Framework.Audio; -using System.Collections.Generic; -using osu.Game.Rulesets.Taiko.Audio; namespace osu.Game.Rulesets.Taiko.UI { @@ -199,10 +195,8 @@ namespace osu.Game.Rulesets.Taiko.UI } [BackgroundDependencyLoader] - private void load(OsuColour colours, AudioManager audio) + private void load(OsuColour colours) { - - overlayBackgroundContainer.BorderColour = colours.Gray0; overlayBackground.Colour = colours.Gray1; From 9fb958eadc39a914acaec1317ad04339e6e9c51b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Dec 2017 14:00:58 +0900 Subject: [PATCH 055/169] Make TestCasePlayer more usable No results screen crash, no unnecessary leadin time. --- osu.Game/Screens/Play/Player.cs | 9 ++++++++- osu.Game/Tests/Visual/TestCasePlayer.cs | 4 +++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 340fc39d52..531913470f 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -46,6 +46,8 @@ namespace osu.Game.Screens.Play public bool HasFailed { get; private set; } public bool AllowPause { get; set; } = true; + public bool AllowLeadIn { get; set; } = true; + public bool AllowResults { get; set; } = true; public int RestartCount; @@ -136,7 +138,10 @@ namespace osu.Game.Screens.Play decoupledClock = new DecoupleableInterpolatingFramedClock { IsCoupled = false }; var firstObjectTime = RulesetContainer.Objects.First().StartTime; - decoupledClock.Seek(Math.Min(0, firstObjectTime - Math.Max(beatmap.ControlPointInfo.TimingPointAt(firstObjectTime).BeatLength * 4, beatmap.BeatmapInfo.AudioLeadIn))); + decoupledClock.Seek(AllowLeadIn + ? Math.Min(0, firstObjectTime - Math.Max(beatmap.ControlPointInfo.TimingPointAt(firstObjectTime).BeatLength * 4, beatmap.BeatmapInfo.AudioLeadIn)) + : firstObjectTime); + decoupledClock.ProcessFrame(); offsetClock = new FramedOffsetClock(decoupledClock); @@ -273,6 +278,8 @@ namespace osu.Game.Screens.Play ValidForResume = false; + if (!AllowResults) return; + using (BeginDelayedSequence(1000)) { onCompletionEvent = Schedule(delegate diff --git a/osu.Game/Tests/Visual/TestCasePlayer.cs b/osu.Game/Tests/Visual/TestCasePlayer.cs index 106f0fa8f3..c71c1de499 100644 --- a/osu.Game/Tests/Visual/TestCasePlayer.cs +++ b/osu.Game/Tests/Visual/TestCasePlayer.cs @@ -91,7 +91,9 @@ namespace osu.Game.Tests.Visual protected virtual Player CreatePlayer(WorkingBeatmap beatmap, Ruleset ruleset) => new Player { InitialBeatmap = beatmap, - AllowPause = false + AllowPause = false, + AllowLeadIn = false, + AllowResults = false, }; private const string test_beatmap_data = From 99a44e6d79618374318ba0fac8a104603ec6a9e5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Dec 2017 15:02:01 +0900 Subject: [PATCH 056/169] Allow testbrowser's rate adjust to affect TestCasePlayer --- osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs | 2 +- osu.Game/Tests/Visual/TestCasePlayer.cs | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs b/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs index da139775b1..82248c2cb8 100644 --- a/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs +++ b/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs @@ -19,6 +19,6 @@ namespace osu.Game.Tests.Beatmaps protected override Beatmap GetBeatmap() => beatmap; protected override Texture GetBackground() => null; - protected override Track GetTrack() => null; + protected override Track GetTrack() => new TrackVirtual(); } } diff --git a/osu.Game/Tests/Visual/TestCasePlayer.cs b/osu.Game/Tests/Visual/TestCasePlayer.cs index c71c1de499..933781890f 100644 --- a/osu.Game/Tests/Visual/TestCasePlayer.cs +++ b/osu.Game/Tests/Visual/TestCasePlayer.cs @@ -22,6 +22,8 @@ namespace osu.Game.Tests.Visual protected Player Player; + private TestWorkingBeatmap working; + /// /// Create a TestCase which runs through the Player screen. /// @@ -75,7 +77,7 @@ namespace osu.Game.Tests.Visual var instance = r.CreateInstance(); - WorkingBeatmap working = new TestWorkingBeatmap(beatmap); + working = new TestWorkingBeatmap(beatmap); working.Mods.Value = new[] { instance.GetAllMods().First(m => m is ModNoFail) }; if (Player != null) @@ -88,6 +90,15 @@ namespace osu.Game.Tests.Visual return player; } + protected override void Update() + { + base.Update(); + + if (working != null) + // note that this will override any mod rate application + working.Track.Rate = Clock.Rate; + } + protected virtual Player CreatePlayer(WorkingBeatmap beatmap, Ruleset ruleset) => new Player { InitialBeatmap = beatmap, From 9ccc49c9b5a2b61c73e30a9cea35118614f5f4fb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Dec 2017 15:32:39 +0900 Subject: [PATCH 057/169] Make selection triggering more liberal --- osu.Game/Screens/Select/BeatmapCarousel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index e3566f3206..9d7867659d 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -513,7 +513,7 @@ namespace osu.Game.Screens.Select currentY += DrawHeight / 2; scrollableContent.Height = currentY; - if (selectedBeatmapSet != null && (selectedBeatmap == null || selectedBeatmapSet.State.Value != CarouselItemState.Selected)) + if (selectedBeatmapSet == null || selectedBeatmap == null || selectedBeatmapSet.State.Value != CarouselItemState.Selected) { selectedBeatmapSet = null; SelectionChanged?.Invoke(null); From e14ad31a071cacfc10f4ab8668f3d00634776c68 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Dec 2017 15:32:53 +0900 Subject: [PATCH 058/169] Increase wait durations for test stability --- osu.Game.Tests/Visual/TestCasePlaySongSelect.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs index e27e786a05..69aa371958 100644 --- a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs @@ -90,7 +90,7 @@ namespace osu.Game.Tests.Visual loadNewSongSelect(true); - AddWaitStep(1); + AddWaitStep(3); AddAssert("dummy selected", () => songSelect.CurrentBeatmap == defaultBeatmap); @@ -100,11 +100,11 @@ namespace osu.Game.Tests.Visual manager.Import(createTestBeatmapSet(i)); }); - AddWaitStep(1); + AddWaitStep(3); AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap); loadNewSongSelect(); - AddWaitStep(1); + AddWaitStep(3); AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap); AddStep(@"Sort by Artist", delegate { songSelect.FilterControl.Sort = SortMode.Artist; }); From 024d9a6850c9071225cba706b77e8f21d9f426e6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Dec 2017 15:33:02 +0900 Subject: [PATCH 059/169] Remove unnecessary null check --- .../Visual/TestCasePlaySongSelect.cs | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs index 69aa371958..18e40db064 100644 --- a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs @@ -59,21 +59,18 @@ namespace osu.Game.Tests.Visual { TestSongSelect songSelect = null; - if (manager == null) + var storage = new TestStorage(@"TestCasePlaySongSelect"); + + // this is by no means clean. should be replacing inside of OsuGameBase somehow. + var context = new OsuDbContext(); + + Func contextFactory = () => context; + + dependencies.Cache(rulesets = new RulesetStore(contextFactory)); + dependencies.Cache(manager = new BeatmapManager(storage, contextFactory, rulesets, null) { - var storage = new TestStorage(@"TestCasePlaySongSelect"); - - // this is by no means clean. should be replacing inside of OsuGameBase somehow. - var context = new OsuDbContext(); - - Func contextFactory = () => context; - - dependencies.Cache(rulesets = new RulesetStore(contextFactory)); - dependencies.Cache(manager = new BeatmapManager(storage, contextFactory, rulesets, null) - { - DefaultBeatmap = defaultBeatmap = baseManager.GetWorkingBeatmap(null) - }); - } + DefaultBeatmap = defaultBeatmap = baseManager.GetWorkingBeatmap(null) + }); void loadNewSongSelect(bool deleteMaps = false) => AddStep("reload song select", () => { From ed1df94f778d983933e72183a386e0f3bbd1b11d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Dec 2017 15:48:01 +0900 Subject: [PATCH 060/169] Fix unread light not turning off --- osu.Game/Overlays/Notifications/Notification.cs | 2 +- osu.Game/Overlays/Notifications/SimpleNotification.cs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Notifications/Notification.cs b/osu.Game/Overlays/Notifications/Notification.cs index 422051364e..b4720e79c4 100644 --- a/osu.Game/Overlays/Notifications/Notification.cs +++ b/osu.Game/Overlays/Notifications/Notification.cs @@ -261,4 +261,4 @@ namespace osu.Game.Overlays.Notifications } } } -} \ No newline at end of file +} diff --git a/osu.Game/Overlays/Notifications/SimpleNotification.cs b/osu.Game/Overlays/Notifications/SimpleNotification.cs index 0b8b365c48..1e691e2a5a 100644 --- a/osu.Game/Overlays/Notifications/SimpleNotification.cs +++ b/osu.Game/Overlays/Notifications/SimpleNotification.cs @@ -83,8 +83,10 @@ namespace osu.Game.Overlays.Notifications set { + if (value == base.Read) return; + base.Read = value; - Light.FadeTo(value ? 1 : 0, 100); + Light.FadeTo(value ? 0 : 1, 100); } } } From 45b3acdd6f1ad89ade0f0abd8564c0fcaa7fefb7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Dec 2017 15:50:59 +0900 Subject: [PATCH 061/169] Fix progress notifications not closing properly when opening their continuation --- osu.Game/Overlays/Notifications/ProgressNotification.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Notifications/ProgressNotification.cs b/osu.Game/Overlays/Notifications/ProgressNotification.cs index 9211c227f8..c39c630858 100644 --- a/osu.Game/Overlays/Notifications/ProgressNotification.cs +++ b/osu.Game/Overlays/Notifications/ProgressNotification.cs @@ -95,7 +95,7 @@ namespace osu.Game.Overlays.Notifications protected virtual void Completed() { - Expire(); + base.Close(); CompletionTarget?.Invoke(CreateCompletionNotification()); } From 24d8d357d07e762fb233411c5e8860400664f151 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Dec 2017 15:52:36 +0900 Subject: [PATCH 062/169] Only bounce and flash notification count when increasing --- .../Toolbar/ToolbarNotificationButton.cs | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs b/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs index faf802f5e7..c093767e52 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs @@ -59,16 +59,27 @@ namespace osu.Game.Overlays.Toolbar private class CountCircle : CompositeDrawable { - private readonly OsuSpriteText count; + private readonly OsuSpriteText countText; private readonly Circle circle; + private int count; + public int Count { + get { return count; } set { - count.Text = value.ToString("#,0"); - circle.FlashColour(Color4.White, 600, Easing.OutQuint); - this.ScaleTo(1.1f).Then().ScaleTo(1, 600, Easing.OutElastic); + if (count == value) + return; + + if (value > count) + { + circle.FlashColour(Color4.White, 600, Easing.OutQuint); + this.ScaleTo(1.1f).Then().ScaleTo(1, 600, Easing.OutElastic); + } + + count = value; + countText.Text = value.ToString("#,0"); } } @@ -83,7 +94,7 @@ namespace osu.Game.Overlays.Toolbar RelativeSizeAxes = Axes.Both, Colour = Color4.Red }, - count = new OsuSpriteText + countText = new OsuSpriteText { Anchor = Anchor.Centre, Origin = Anchor.Centre, From c15b2382a218a7171258f6b3aa0a1013fef9b311 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Dec 2017 15:56:32 +0900 Subject: [PATCH 063/169] Remove unused variable --- osu.Game/OsuGame.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 391a9ee19a..4342b020a8 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -374,8 +374,6 @@ namespace osu.Game notifications.State = Visibility.Hidden; } - private ScheduledDelegate notificationsEnabler; - private void screenChanged(Screen newScreen) { currentScreen = newScreen as OsuScreen; From f737a64189ea85a0e316e9034c5c21749346e375 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Dec 2017 16:09:40 +0900 Subject: [PATCH 064/169] Remove ScreenChanged --- osu.Game/OsuGame.cs | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 4342b020a8..b45a9f41ea 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -355,8 +355,6 @@ namespace osu.Game public bool OnReleased(GlobalAction action) => false; - public event Action ScreenChanged; - private Container mainContent; private Container overlayContent; @@ -374,19 +372,6 @@ namespace osu.Game notifications.State = Visibility.Hidden; } - private void screenChanged(Screen newScreen) - { - currentScreen = newScreen as OsuScreen; - - if (currentScreen == null) - { - Exit(); - return; - } - - ScreenChanged?.Invoke(newScreen); - } - protected override bool OnExiting() { if (screenStack.ChildScreen == null) return false; @@ -434,13 +419,12 @@ namespace osu.Game { newScreen.ModePushed += screenAdded; newScreen.Exited += screenRemoved; - - screenChanged(newScreen); } private void screenRemoved(Screen newScreen) { - screenChanged(newScreen); + if (newScreen == null) + Exit(); } } } From 3f1ced618ae6db07f71ad6ba05b81f477c617334 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Dec 2017 16:15:15 +0900 Subject: [PATCH 065/169] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 08f85f9bf9..46d4704b0a 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 08f85f9bf9a7376aec8dfcde8c7c96d267d8c295 +Subproject commit 46d4704b0a3f140fa8ad10ca0b1553b67d8385ab From 836d807f4ff122480e9a029d0606aae669f62945 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 26 Dec 2017 19:32:20 +0900 Subject: [PATCH 066/169] Give SampleControlPoint a 100% volume by default --- osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs index 40e45da13c..c2c13e1909 100644 --- a/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs @@ -17,7 +17,7 @@ namespace osu.Game.Beatmaps.ControlPoints /// /// The default sample volume at this control point. /// - public int SampleVolume; + public int SampleVolume = 100; /// /// Create a SampleInfo based on the sample settings in this control point. From 3113a55a988be6fe7112f73d1c905edd0cd787ab Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 26 Dec 2017 19:33:01 +0900 Subject: [PATCH 067/169] Make ControlPointInfo return a set default control point --- .../ControlPoints/ControlPointInfo.cs | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index f031ebe353..5ad6b4ec6b 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -12,6 +12,11 @@ namespace osu.Game.Beatmaps.ControlPoints [Serializable] public class ControlPointInfo { + private static readonly TimingControlPoint default_timing_point = new TimingControlPoint(); + private static readonly DifficultyControlPoint default_difficulty_point = new DifficultyControlPoint(); + private static readonly SampleControlPoint default_sample_point = new SampleControlPoint(); + private static readonly EffectControlPoint default_effect_point = new EffectControlPoint(); + /// /// All timing points. /// @@ -41,68 +46,68 @@ namespace osu.Game.Beatmaps.ControlPoints /// /// The time to find the difficulty control point at. /// The difficulty control point. - public DifficultyControlPoint DifficultyPointAt(double time) => binarySearch(DifficultyPoints, time); + public DifficultyControlPoint DifficultyPointAt(double time) => binarySearch(DifficultyPoints, time, default_difficulty_point); /// /// Finds the effect control point that is active at . /// /// The time to find the effect control point at. /// The effect control point. - public EffectControlPoint EffectPointAt(double time) => binarySearch(EffectPoints, time); + public EffectControlPoint EffectPointAt(double time) => binarySearch(EffectPoints, time, default_effect_point); /// /// Finds the sound control point that is active at . /// /// The time to find the sound control point at. /// The sound control point. - public SampleControlPoint SamplePointAt(double time) => binarySearch(SamplePoints, time, SamplePoints.FirstOrDefault()); + public SampleControlPoint SamplePointAt(double time) => binarySearch(SamplePoints, time, SamplePoints.FirstOrDefault() ?? default_sample_point); /// /// Finds the timing control point that is active at . /// /// The time to find the timing control point at. /// The timing control point. - public TimingControlPoint TimingPointAt(double time) => binarySearch(TimingPoints, time, TimingPoints.FirstOrDefault()); + public TimingControlPoint TimingPointAt(double time) => binarySearch(TimingPoints, time, TimingPoints.FirstOrDefault() ?? default_timing_point); [JsonIgnore] /// /// Finds the maximum BPM represented by any timing control point. /// public double BPMMaximum => - 60000 / (TimingPoints.OrderBy(c => c.BeatLength).FirstOrDefault() ?? new TimingControlPoint()).BeatLength; + 60000 / (TimingPoints.OrderBy(c => c.BeatLength).FirstOrDefault() ?? default_timing_point).BeatLength; [JsonIgnore] /// /// Finds the minimum BPM represented by any timing control point. /// public double BPMMinimum => - 60000 / (TimingPoints.OrderByDescending(c => c.BeatLength).FirstOrDefault() ?? new TimingControlPoint()).BeatLength; + 60000 / (TimingPoints.OrderByDescending(c => c.BeatLength).FirstOrDefault() ?? default_timing_point).BeatLength; [JsonIgnore] /// /// Finds the mode BPM (most common BPM) represented by the control points. /// public double BPMMode => - 60000 / (TimingPoints.GroupBy(c => c.BeatLength).OrderByDescending(grp => grp.Count()).FirstOrDefault()?.FirstOrDefault() ?? new TimingControlPoint()).BeatLength; + 60000 / (TimingPoints.GroupBy(c => c.BeatLength).OrderByDescending(grp => grp.Count()).FirstOrDefault()?.FirstOrDefault() ?? default_timing_point).BeatLength; /// /// Binary searches one of the control point lists to find the active control point at . /// /// The list to search. /// The time to find the control point at. - /// The control point to use when is before any control points. If null, a new control point will be constructed. + /// The control point to use when there is not control point before . /// The active control point at . - private T binarySearch(SortedList list, double time, T prePoint = null) + private T binarySearch(SortedList list, double time, T defaultPoint) where T : ControlPoint, new() { if (list == null) throw new ArgumentNullException(nameof(list)); if (list.Count == 0) - return new T(); + return defaultPoint; if (time < list[0].Time) - return prePoint ?? new T(); + return defaultPoint; int index = list.BinarySearch(new T { Time = time }); From c74561b3d4e1db279f2fc8e24d3648b3f8c61c6d Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 26 Dec 2017 19:33:28 +0900 Subject: [PATCH 068/169] Add test case for InputDrum --- .../Tests/TestCaseInputDrum.cs | 32 +++++++++++++++++++ .../osu.Game.Rulesets.Taiko.csproj | 1 + 2 files changed, 33 insertions(+) create mode 100644 osu.Game.Rulesets.Taiko/Tests/TestCaseInputDrum.cs diff --git a/osu.Game.Rulesets.Taiko/Tests/TestCaseInputDrum.cs b/osu.Game.Rulesets.Taiko/Tests/TestCaseInputDrum.cs new file mode 100644 index 0000000000..7c18ecc34b --- /dev/null +++ b/osu.Game.Rulesets.Taiko/Tests/TestCaseInputDrum.cs @@ -0,0 +1,32 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using NUnit.Framework; +using OpenTK; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets.Taiko.UI; +using osu.Game.Tests.Visual; + +namespace osu.Game.Rulesets.Taiko.Tests +{ + [Ignore("getting CI working")] + public class TestCaseInputDrum : OsuTestCase + { + public TestCaseInputDrum() + { + Add(new TaikoInputManager(new RulesetInfo { ID = 1 }) + { + RelativeSizeAxes = Axes.Both, + Child = new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(200), + Child = new InputDrum(new ControlPointInfo()) + } + }); + } + } +} diff --git a/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj index f1c29c1a34..bd0d199772 100644 --- a/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj +++ b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj @@ -83,6 +83,7 @@ + From 44fbe7859a0a703f540f2fa6a70b413665bcb75a Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Tue, 26 Dec 2017 11:34:26 +0100 Subject: [PATCH 069/169] move anchor and origin so metadata doesn't move if it's partially empty --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 5d4f950a51..4f20b50d35 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -154,9 +154,10 @@ namespace osu.Game.Screens.Select }, new FillFlowContainer { - Name = "Bottom-aligned metadata", - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, + Name = "Centre-aligned metadata", + Anchor = Anchor.CentreLeft, + Origin = Anchor.TopLeft, + Y = -22, Direction = FillDirection.Vertical, Margin = new MarginPadding { Top = 15, Left = 25, Right = 10, Bottom = 20 }, AutoSizeAxes = Axes.Both, From f5d4ed2a220e95e03d244a4819ec3112aa9de3e7 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Sat, 9 Dec 2017 17:43:30 +0100 Subject: [PATCH 070/169] add interface to adjust DrawableHitObjects --- osu.Game.Rulesets.Osu/Mods/OsuMod.cs | 8 ++++++- .../Mods/IApplicableToDrawableHitObject.cs | 24 +++++++++++++++++++ osu.Game/Rulesets/UI/RulesetContainer.cs | 3 +++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 osu.Game/Rulesets/Mods/IApplicableToDrawableHitObject.cs diff --git a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs index 71349285b3..efe4a2002f 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs @@ -13,6 +13,7 @@ using osu.Game.Rulesets.Osu.UI; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; using OpenTK; +using osu.Game.Rulesets.Objects.Drawables; namespace osu.Game.Rulesets.Osu.Mods { @@ -26,10 +27,15 @@ namespace osu.Game.Rulesets.Osu.Mods } - public class OsuModHidden : ModHidden + public class OsuModHidden : ModHidden, IApplicableToDrawableHitObjects { public override string Description => @"Play with no approach circles and fading notes for a slight score advantage."; public override double ScoreMultiplier => 1.06; + + public void ApplyToDrawableHitObjects(IEnumerable drawables) + { + + } } public class OsuModHardRock : ModHardRock, IApplicableToHitObject diff --git a/osu.Game/Rulesets/Mods/IApplicableToDrawableHitObject.cs b/osu.Game/Rulesets/Mods/IApplicableToDrawableHitObject.cs new file mode 100644 index 0000000000..2751e36a25 --- /dev/null +++ b/osu.Game/Rulesets/Mods/IApplicableToDrawableHitObject.cs @@ -0,0 +1,24 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using osu.Game.Rulesets.Objects.Drawables; + +namespace osu.Game.Rulesets.Mods +{ + /// + /// An interface for s that can be applied to s. + /// + public interface IApplicableToDrawableHitObjects + { + /// + /// Applies this to a list of s. + /// + /// The list of s to apply to. + void ApplyToDrawableHitObjects(IEnumerable drawables); + } +} diff --git a/osu.Game/Rulesets/UI/RulesetContainer.cs b/osu.Game/Rulesets/UI/RulesetContainer.cs index fe7c0c05ed..40a37c689b 100644 --- a/osu.Game/Rulesets/UI/RulesetContainer.cs +++ b/osu.Game/Rulesets/UI/RulesetContainer.cs @@ -260,6 +260,9 @@ namespace osu.Game.Rulesets.UI } Playfield.PostProcess(); + + foreach (var mod in Mods.OfType()) + mod.ApplyToDrawableHitObjects(Playfield.HitObjects.Objects); } protected override void Update() From 96905915931336c16d5b808af25c41a4cd7b9a4b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 26 Dec 2017 19:55:56 +0900 Subject: [PATCH 071/169] Make taiko use namespaced hitsounds This is a temporary solution for now that uses DrawableHitObject.SampleNamespace for the override. We will not want to do this going forward, and instead have the rulesets add their custom resource stores to the games', but that requires deciding where/when to apply/remove such resource stores, and is probably left to skinning. --- osu-resources | 2 +- osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs | 4 ++-- .../Objects/Drawables/DrawableTaikoHitObject.cs | 2 ++ osu.Game.Rulesets.Taiko/Tests/TestCaseInputDrum.cs | 12 ++++++++++++ osu.Game/Audio/SampleInfo.cs | 11 +++++++++-- .../Rulesets/Objects/Drawables/DrawableHitObject.cs | 5 ++++- 6 files changed, 30 insertions(+), 6 deletions(-) diff --git a/osu-resources b/osu-resources index 4287ee8043..e01f71160f 160000 --- a/osu-resources +++ b/osu-resources @@ -1 +1 @@ -Subproject commit 4287ee8043fb1419017359bc3a5db5dc06bc643f +Subproject commit e01f71160fb9b3167efcd177c7d7dba9e5d36604 diff --git a/osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs b/osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs index 9d0037b97a..74e2195e09 100644 --- a/osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs +++ b/osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs @@ -30,8 +30,8 @@ namespace osu.Game.Rulesets.Taiko.Audio { mappings[s] = new DrumSample { - Centre = s.GetSampleInfo().GetChannel(audio.Sample), - Rim = s.GetSampleInfo(SampleInfo.HIT_CLAP).GetChannel(audio.Sample) + Centre = s.GetSampleInfo().GetChannel(audio.Sample, "Taiko"), + Rim = s.GetSampleInfo(SampleInfo.HIT_CLAP).GetChannel(audio.Sample, "Taiko") }; } } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs index 92da3fe09e..cc7dd2fa0f 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs @@ -41,6 +41,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables // Normal and clap samples are handled by the drum protected override IEnumerable GetSamples() => HitObject.Samples.Where(s => s.Name != SampleInfo.HIT_NORMAL && s.Name != SampleInfo.HIT_CLAP); + protected override string SampleNamespace => "Taiko"; + protected virtual TaikoPiece CreateMainPiece() => new CirclePiece(); public abstract bool OnPressed(TaikoAction action); diff --git a/osu.Game.Rulesets.Taiko/Tests/TestCaseInputDrum.cs b/osu.Game.Rulesets.Taiko/Tests/TestCaseInputDrum.cs index 7c18ecc34b..172c6e9d84 100644 --- a/osu.Game.Rulesets.Taiko/Tests/TestCaseInputDrum.cs +++ b/osu.Game.Rulesets.Taiko/Tests/TestCaseInputDrum.cs @@ -1,11 +1,15 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; +using System.Collections.Generic; using NUnit.Framework; using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Game.Audio; using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets.Taiko.Audio; using osu.Game.Rulesets.Taiko.UI; using osu.Game.Tests.Visual; @@ -14,6 +18,14 @@ namespace osu.Game.Rulesets.Taiko.Tests [Ignore("getting CI working")] public class TestCaseInputDrum : OsuTestCase { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(InputDrum), + typeof(DrumSampleMapping), + typeof(SampleInfo), + typeof(SampleControlPoint) + }; + public TestCaseInputDrum() { Add(new TaikoInputManager(new RulesetInfo { ID = 1 }) diff --git a/osu.Game/Audio/SampleInfo.cs b/osu.Game/Audio/SampleInfo.cs index 64a9aa50a0..1133dde570 100644 --- a/osu.Game/Audio/SampleInfo.cs +++ b/osu.Game/Audio/SampleInfo.cs @@ -14,9 +14,16 @@ namespace osu.Game.Audio public const string HIT_NORMAL = @"hitnormal"; public const string HIT_CLAP = @"hitclap"; - public SampleChannel GetChannel(SampleManager manager) + public SampleChannel GetChannel(SampleManager manager, string resourceNamespace = null) { - var channel = manager.Get($"Gameplay/{Bank}-{Name}"); + SampleChannel channel = null; + + if (!string.IsNullOrEmpty(resourceNamespace)) + channel = manager.Get($"Gameplay/{resourceNamespace}/{Bank}-{Name}"); + + if (channel == null) + channel = manager.Get($"Gameplay/{Bank}-{Name}"); + channel.Volume.Value = Volume / 100.0; return channel; } diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index ab4c04be3f..c118cd5bee 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -74,6 +74,9 @@ namespace osu.Game.Rulesets.Objects.Drawables protected List Samples = new List(); protected virtual IEnumerable GetSamples() => HitObject.Samples; + // Todo: Rulesets should be overriding the resources instead, but we need to figure out where/when to apply overrides first + protected virtual string SampleNamespace => null; + public readonly Bindable State = new Bindable(); protected DrawableHitObject(TObject hitObject) @@ -101,7 +104,7 @@ namespace osu.Game.Rulesets.Objects.Drawables Volume = s.Volume > 0 ? s.Volume : HitObject.SampleControlPoint.SampleVolume }; - SampleChannel channel = localSampleInfo.GetChannel(audio.Sample); + SampleChannel channel = localSampleInfo.GetChannel(audio.Sample, SampleNamespace); if (channel == null) continue; From 0c4e4012f8a13dcebeaa4f5851c5469cbbaf7d3e Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 26 Dec 2017 19:57:16 +0900 Subject: [PATCH 072/169] Taiko drumroll ticks should just play the playfield samples --- osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs b/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs index 5a566fd091..a39d627cc4 100644 --- a/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs @@ -3,9 +3,6 @@ using osu.Game.Rulesets.Objects.Types; using System; -using System.Collections.Generic; -using System.Linq; -using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; @@ -75,13 +72,7 @@ namespace osu.Game.Rulesets.Taiko.Objects FirstTick = first, TickSpacing = tickSpacing, StartTime = t, - IsStrong = IsStrong, - Samples = new List(Samples.Select(s => new SampleInfo - { - Bank = s.Bank, - Name = @"slidertick", - Volume = s.Volume - })) + IsStrong = IsStrong }); first = false; From d479955e20e48b48cf75dbe390a6601cd63e4b89 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 26 Dec 2017 20:01:02 +0900 Subject: [PATCH 073/169] Fix spelling error --- osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index 5ad6b4ec6b..234a50d5dd 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -95,7 +95,7 @@ namespace osu.Game.Beatmaps.ControlPoints /// /// The list to search. /// The time to find the control point at. - /// The control point to use when there is not control point before . + /// The control point to use when there is no control point before . /// The active control point at . private T binarySearch(SortedList list, double time, T defaultPoint) where T : ControlPoint, new() From 1c4bcdda96f690123a8eb2ae7a502da9cac11a52 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Dec 2017 20:13:55 +0900 Subject: [PATCH 074/169] Fix test race condition async loads --- osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs index 61c904aa60..53943edfab 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs @@ -110,11 +110,15 @@ namespace osu.Game.Tests.Visual private void selectBeatmap(string name) { + var infoBefore = infoWedge.Info; + AddStep($"select {name} beatmap", () => { beatmap.Value = new TestWorkingBeatmap(beatmaps.First(b => b.BeatmapInfo.Ruleset.ShortName == name)); infoWedge.UpdateBeatmap(beatmap); }); + + AddUntilStep(() => infoWedge.Info != infoBefore, "wait for async load"); } private void selectNullBeatmap() From 7504cd589dc532f67e1a2c42aac5505732c9c6ee Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Dec 2017 20:18:47 +0900 Subject: [PATCH 075/169] Move alpha handling to state --- .../Visual/TestCaseBeatmapInfoWedge.cs | 20 +++++++++---------- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 9 ++++++--- osu.Game/Screens/Select/SongSelect.cs | 1 - 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs index 53943edfab..3a50e43239 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs @@ -41,25 +41,23 @@ namespace osu.Game.Tests.Visual { Size = new Vector2(0.5f, 245), RelativeSizeAxes = Axes.X, - Margin = new MarginPadding - { - Top = 20, - } - }); - - AddStep("hide", () => - { - infoWedge.State = Visibility.Hidden; - Content.FadeOut(100); + Margin = new MarginPadding { Top = 20 } }); AddStep("show", () => { - Content.FadeInFromZero(250); infoWedge.State = Visibility.Visible; infoWedge.UpdateBeatmap(beatmap); }); + AddWaitStep(3); + + AddStep("hide", () => { infoWedge.State = Visibility.Hidden; }); + + AddWaitStep(3); + + AddStep("show", () => { infoWedge.State = Visibility.Visible; }); + foreach (var rulesetInfo in rulesets.AvailableRulesets) { var ruleset = rulesetInfo.CreateInstance(); diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 4f20b50d35..d4f1b90ebf 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -35,6 +35,7 @@ namespace osu.Game.Screens.Select Masking = true; BorderColour = new Color4(221, 255, 255, 255); BorderThickness = 2.5f; + Alpha = 0; EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Glow, @@ -50,12 +51,14 @@ namespace osu.Game.Screens.Select { this.MoveToX(0, 800, Easing.OutQuint); this.RotateTo(0, 800, Easing.OutQuint); + this.FadeIn(250); } protected override void PopOut() { - this.MoveToX(-100, 800, Easing.InQuint); - this.RotateTo(10, 800, Easing.InQuint); + this.MoveToX(-100, 800, Easing.In); + this.RotateTo(10, 800, Easing.In); + this.FadeOut(500, Easing.In); } public void UpdateBeatmap(WorkingBeatmap beatmap) @@ -68,7 +71,7 @@ namespace osu.Game.Screens.Select { // ensure we ourselves are visible if not already. if (!IsPresent) - this.FadeIn(250); + State = Visibility.Visible; Info?.FadeOut(250); Info?.Expire(); diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 68ee08e721..a66cd0b3e3 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -121,7 +121,6 @@ namespace osu.Game.Screens.Select }, beatmapInfoWedge = new BeatmapInfoWedge { - Alpha = 0, Size = wedged_container_size, RelativeSizeAxes = Axes.X, Margin = new MarginPadding From 4c2554595eba4b035435fedc50795bee09c1ef0f Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Tue, 26 Dec 2017 17:25:18 +0100 Subject: [PATCH 076/169] implement hidden (mostly) some things work and others don't, I dunno --- osu.Game.Rulesets.Osu/Mods/OsuMod.cs | 55 +++++++++++++--- .../Objects/Drawables/DrawableHitCircle.cs | 13 ++-- .../Objects/Drawables/DrawableOsuHitObject.cs | 13 ++-- .../Objects/Drawables/DrawableSlider.cs | 64 +++++++++---------- .../Objects/Drawables/DrawableSpinner.cs | 46 ++++++------- .../Objects/Drawables/Pieces/SpinnerDisc.cs | 2 + .../Mods/IApplicableToDrawableHitObject.cs | 4 -- .../Objects/Drawables/DrawableHitObject.cs | 8 +++ osu.Game/osu.Game.csproj | 1 + 9 files changed, 126 insertions(+), 80 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs index efe4a2002f..6b8f30eaec 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs @@ -11,9 +11,10 @@ using System.Collections.Generic; using System.Linq; using osu.Game.Rulesets.Osu.UI; using osu.Game.Rulesets.Scoring; -using osu.Game.Rulesets.UI; using OpenTK; using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Osu.Objects.Drawables; +using osu.Framework.Graphics; namespace osu.Game.Rulesets.Osu.Mods { @@ -24,7 +25,6 @@ namespace osu.Game.Rulesets.Osu.Mods public class OsuModEasy : ModEasy { - } public class OsuModHidden : ModHidden, IApplicableToDrawableHitObjects @@ -32,9 +32,54 @@ namespace osu.Game.Rulesets.Osu.Mods public override string Description => @"Play with no approach circles and fading notes for a slight score advantage."; public override double ScoreMultiplier => 1.06; + private const double fade_in_speed_multiplier = 0.6; + private const double fade_out_speed_multiplier = 0.3; + + private float preEmpt => DrawableOsuHitObject.TIME_PREEMPT; + public void ApplyToDrawableHitObjects(IEnumerable drawables) { + foreach (var d in drawables.OfType()) + d.ApplyCustomUpdateState += customSequence; + } + private void customSequence(DrawableHitObject drawable, ArmedState state) + { + if (!(drawable is DrawableOsuHitObject d)) + return; + + //var duration = (d.HitObject as IHasEndTime)?.Duration ?? 0; + var fadeInTime = d.HitObject.StartTime - preEmpt; + var fadeIn = d.HitObject.StartTime - preEmpt * fade_in_speed_multiplier - fadeInTime; + var fadeOutTime = fadeInTime + fadeIn; + var fadeOut = d.HitObject.StartTime - preEmpt * fade_out_speed_multiplier - fadeOutTime; + + d.FadeIn = fadeIn; + + using (drawable.BeginAbsoluteSequence(fadeInTime)) + { + switch (drawable) + { + case DrawableHitCircle circle: + circle.ApproachCircle.FadeOut(); + circle.LifetimeEnd = circle.HitObject.StartTime + Math.Max(fadeOut, circle.HitObject.HitWindowFor(HitResult.Miss)); + + using (circle.BeginDelayedSequence(fadeIn)) + circle.FadeOut(fadeOut); + break; + case DrawableSlider slider: + slider.InitialCircle.ApplyCustomUpdateState += customSequence; + + //using (slider.BeginDelayedSequence(fadeIn)) + // slider.Body.FadeOut(duration, Easing.Out); + break; + case DrawableSpinner spinner: + spinner.Disc.FadeOut(); + spinner.Ticks.FadeOut(); + spinner.Background.FadeOut(); + break; + } + } } } @@ -57,11 +102,6 @@ namespace osu.Game.Rulesets.Osu.Mods slider.ControlPoints = newControlPoints; slider.Curve?.Calculate(); // Recalculate the slider curve } - - public void ApplyToHitObjects(RulesetContainer rulesetContainer) - { - - } } public class OsuModSuddenDeath : ModSuddenDeath @@ -102,7 +142,6 @@ namespace osu.Game.Rulesets.Osu.Mods public class OsuModPerfect : ModPerfect { - } public class OsuModSpunOut : Mod diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index a973d2b580..84ae568a1d 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -6,7 +6,6 @@ using osu.Framework.Graphics; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using OpenTK; -using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Osu.Judgements; namespace osu.Game.Rulesets.Osu.Objects.Drawables @@ -48,7 +47,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables }, number = new NumberPiece { - Text = h is Spinner ? "S" : (HitObject.ComboIndex + 1).ToString(), + Text = (HitObject.ComboIndex + 1).ToString(), }, ring = new RingPiece(), flash = new FlashPiece(), @@ -88,25 +87,23 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { base.UpdatePreemptState(); - ApproachCircle.FadeIn(Math.Min(TIME_FADEIN * 2, TIME_PREEMPT)); + ApproachCircle.FadeIn(Math.Min(FadeIn * 2, TIME_PREEMPT)); ApproachCircle.ScaleTo(1.1f, TIME_PREEMPT); } protected override void UpdateCurrentState(ArmedState state) { - double duration = ((HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime) - HitObject.StartTime; - - glow.Delay(duration).FadeOut(400); + glow.FadeOut(400); switch (state) { case ArmedState.Idle: - this.Delay(duration + TIME_PREEMPT).FadeOut(TIME_FADEOUT); + this.Delay(TIME_PREEMPT).FadeOut(500); Expire(true); break; case ArmedState.Miss: ApproachCircle.FadeOut(50); - this.FadeOut(TIME_FADEOUT / 5); + this.FadeOut(100); Expire(); break; case ArmedState.Hit: diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index 3e0c23a1ab..a5b5fc481a 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -12,7 +12,13 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { public const float TIME_PREEMPT = 600; public const float TIME_FADEIN = 400; - public const float TIME_FADEOUT = 500; + + /// + /// The number of milliseconds used to fade in. + /// + public double FadeIn = TIME_FADEIN; + + public override bool IsPresent => base.IsPresent || State.Value == ArmedState.Idle && Time.Current >= HitObject.StartTime - TIME_PREEMPT; protected DrawableOsuHitObject(OsuHitObject hitObject) : base(hitObject) @@ -37,10 +43,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables } } - protected virtual void UpdatePreemptState() - { - this.FadeIn(TIME_FADEIN); - } + protected virtual void UpdatePreemptState() => this.FadeIn(FadeIn); protected virtual void UpdateCurrentState(ArmedState state) { diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index befe84e3e9..e5387a1ce8 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -15,25 +15,25 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { public class DrawableSlider : DrawableOsuHitObject, IDrawableHitObjectWithProxiedApproach { - private readonly Slider slider; + public readonly Slider Slider; - private readonly DrawableHitCircle initialCircle; + public readonly DrawableHitCircle InitialCircle; private readonly List components = new List(); private readonly Container ticks; private readonly Container repeatPoints; - private readonly SliderBody body; - private readonly SliderBall ball; + public readonly SliderBody Body; + public readonly SliderBall Ball; public DrawableSlider(Slider s) : base(s) { - slider = s; + Slider = s; Children = new Drawable[] { - body = new SliderBody(s) + Body = new SliderBody(s) { AccentColour = AccentColour, Position = s.StackedPosition, @@ -41,14 +41,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables }, ticks = new Container(), repeatPoints = new Container(), - ball = new SliderBall(s) + Ball = new SliderBall(s) { Scale = new Vector2(s.Scale), AccentColour = AccentColour, AlwaysPresent = true, Alpha = 0 }, - initialCircle = new DrawableHitCircle(new HitCircle + InitialCircle = new DrawableHitCircle(new HitCircle { //todo: avoid creating this temporary HitCircle. StartTime = s.StartTime, @@ -61,16 +61,16 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables }) }; - components.Add(body); - components.Add(ball); + components.Add(Body); + components.Add(Ball); - AddNested(initialCircle); + AddNested(InitialCircle); var repeatDuration = s.Curve.Distance / s.Velocity; foreach (var tick in s.NestedHitObjects.OfType()) { var repeatStartTime = s.StartTime + tick.RepeatIndex * repeatDuration; - var fadeInTime = repeatStartTime + (tick.StartTime - repeatStartTime) / 2 - (tick.RepeatIndex == 0 ? TIME_FADEIN : TIME_FADEIN / 2); + var fadeInTime = repeatStartTime + (tick.StartTime - repeatStartTime) / 2 - (tick.RepeatIndex == 0 ? FadeIn : FadeIn / 2); var fadeOutTime = repeatStartTime + repeatDuration; var drawableTick = new DrawableSliderTick(tick) @@ -87,7 +87,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables foreach (var repeatPoint in s.NestedHitObjects.OfType()) { var repeatStartTime = s.StartTime + repeatPoint.RepeatIndex * repeatDuration; - var fadeInTime = repeatStartTime + (repeatPoint.StartTime - repeatStartTime) / 2 - (repeatPoint.RepeatIndex == 0 ? TIME_FADEIN : TIME_FADEIN / 2); + var fadeInTime = repeatStartTime + (repeatPoint.StartTime - repeatStartTime) / 2 - (repeatPoint.RepeatIndex == 0 ? FadeIn : FadeIn / 2); var fadeOutTime = repeatStartTime + repeatDuration; var drawableRepeatPoint = new DrawableRepeatPoint(repeatPoint, this) @@ -109,41 +109,41 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { base.Update(); - Tracking = ball.Tracking; + Tracking = Ball.Tracking; - double progress = MathHelper.Clamp((Time.Current - slider.StartTime) / slider.Duration, 0, 1); + double progress = MathHelper.Clamp((Time.Current - Slider.StartTime) / Slider.Duration, 0, 1); - int repeat = slider.RepeatAt(progress); - progress = slider.ProgressAt(progress); + int repeat = Slider.RepeatAt(progress); + progress = Slider.ProgressAt(progress); if (repeat > currentRepeat) { - if (repeat < slider.RepeatCount && ball.Tracking) + if (repeat < Slider.RepeatCount && Ball.Tracking) PlaySamples(); currentRepeat = repeat; } //todo: we probably want to reconsider this before adding scoring, but it looks and feels nice. - if (!initialCircle.Judgements.Any(j => j.IsHit)) - initialCircle.Position = slider.Curve.PositionAt(progress); + if (!InitialCircle.Judgements.Any(j => j.IsHit)) + InitialCircle.Position = Slider.Curve.PositionAt(progress); foreach (var c in components) c.UpdateProgress(progress, repeat); - foreach (var t in ticks.Children) t.Tracking = ball.Tracking; + foreach (var t in ticks.Children) t.Tracking = Ball.Tracking; } protected override void CheckForJudgements(bool userTriggered, double timeOffset) { - if (!userTriggered && Time.Current >= slider.EndTime) + if (!userTriggered && Time.Current >= Slider.EndTime) { var judgementsCount = ticks.Children.Count + repeatPoints.Children.Count + 1; var judgementsHit = ticks.Children.Count(t => t.Judgements.Any(j => j.IsHit)) + repeatPoints.Children.Count(t => t.Judgements.Any(j => j.IsHit)); - if (initialCircle.Judgements.Any(j => j.IsHit)) + if (InitialCircle.Judgements.Any(j => j.IsHit)) judgementsHit++; var hitFraction = (double)judgementsHit / judgementsCount; - if (hitFraction == 1 && initialCircle.Judgements.Any(j => j.Result == HitResult.Great)) + if (hitFraction == 1 && InitialCircle.Judgements.Any(j => j.Result == HitResult.Great)) AddJudgement(new OsuJudgement { Result = HitResult.Great }); - else if (hitFraction >= 0.5 && initialCircle.Judgements.Any(j => j.Result >= HitResult.Good)) + else if (hitFraction >= 0.5 && InitialCircle.Judgements.Any(j => j.Result >= HitResult.Good)) AddJudgement(new OsuJudgement { Result = HitResult.Good }); else if (hitFraction > 0) AddJudgement(new OsuJudgement { Result = HitResult.Meh }); @@ -154,22 +154,22 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables protected override void UpdateCurrentState(ArmedState state) { - ball.FadeIn(); + Ball.FadeIn(); - using (BeginDelayedSequence(slider.Duration, true)) + using (BeginDelayedSequence(Slider.Duration, true)) { - body.FadeOut(160); - ball.FadeOut(160); + Body.FadeOut(160); + Ball.FadeOut(160); this.FadeOut(800) .Expire(); } } - public Drawable ProxiedLayer => initialCircle.ApproachCircle; + public Drawable ProxiedLayer => InitialCircle.ApproachCircle; - public override Vector2 SelectionPoint => ToScreenSpace(body.Position); - public override Quad SelectionQuad => body.PathDrawQuad; + public override Vector2 SelectionPoint => ToScreenSpace(Body.Position); + public override Quad SelectionQuad => Body.PathDrawQuad; } internal interface ISliderProgress diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 054a2067ec..9e80e3ccd1 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -20,13 +20,13 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { private readonly Spinner spinner; - private readonly SpinnerDisc disc; - private readonly SpinnerTicks ticks; + public readonly SpinnerDisc Disc; + public readonly SpinnerTicks Ticks; private readonly SpinnerSpmCounter spmCounter; private readonly Container mainContainer; - private readonly SpinnerBackground background; + public readonly SpinnerBackground Background; private readonly Container circleContainer; private readonly CirclePiece circle; private readonly GlowPiece glow; @@ -84,20 +84,20 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables RelativeSizeAxes = Axes.Y, Children = new Drawable[] { - background = new SpinnerBackground + Background = new SpinnerBackground { Alpha = 0.6f, Anchor = Anchor.Centre, Origin = Anchor.Centre, }, - disc = new SpinnerDisc(spinner) + Disc = new SpinnerDisc(spinner) { Scale = Vector2.Zero, Anchor = Anchor.Centre, Origin = Anchor.Centre, }, circleContainer.CreateProxy(), - ticks = new SpinnerTicks + Ticks = new SpinnerTicks { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -114,22 +114,22 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables }; } - public float Progress => MathHelper.Clamp(disc.RotationAbsolute / 360 / spinner.SpinsRequired, 0, 1); + public float Progress => MathHelper.Clamp(Disc.RotationAbsolute / 360 / spinner.SpinsRequired, 0, 1); protected override void CheckForJudgements(bool userTriggered, double timeOffset) { if (Time.Current < HitObject.StartTime) return; - if (Progress >= 1 && !disc.Complete) + if (Progress >= 1 && !Disc.Complete) { - disc.Complete = true; + Disc.Complete = true; const float duration = 200; - disc.FadeAccent(completeColour, duration); + Disc.FadeAccent(completeColour, duration); - background.FadeAccent(completeColour, duration); - background.FadeOut(duration); + Background.FadeAccent(completeColour, duration); + Background.FadeOut(duration); circle.FadeColour(completeColour, duration); glow.FadeColour(completeColour, duration); @@ -153,20 +153,20 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { normalColour = baseColour; - background.AccentColour = normalColour; + Background.AccentColour = normalColour; completeColour = colours.YellowLight.Opacity(0.75f); - disc.AccentColour = fillColour; + Disc.AccentColour = fillColour; circle.Colour = colours.BlueDark; glow.Colour = colours.BlueDark; } protected override void Update() { - disc.Tracking = OsuActionInputManager.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton); - if (!spmCounter.IsPresent && disc.Tracking) - spmCounter.FadeIn(TIME_FADEIN); + Disc.Tracking = OsuActionInputManager.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton); + if (!spmCounter.IsPresent && Disc.Tracking) + spmCounter.FadeIn(FadeIn); base.Update(); } @@ -175,14 +175,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { base.UpdateAfterChildren(); - circle.Rotation = disc.Rotation; - ticks.Rotation = disc.Rotation; - spmCounter.SetRotation(disc.RotationAbsolute); + circle.Rotation = Disc.Rotation; + Ticks.Rotation = Disc.Rotation; + spmCounter.SetRotation(Disc.RotationAbsolute); float relativeCircleScale = spinner.Scale * circle.DrawHeight / mainContainer.DrawHeight; - disc.ScaleTo(relativeCircleScale + (1 - relativeCircleScale) * Progress, 200, Easing.OutQuint); + Disc.ScaleTo(relativeCircleScale + (1 - relativeCircleScale) * Progress, 200, Easing.OutQuint); - symbol.RotateTo(disc.Rotation / 2, 500, Easing.OutQuint); + symbol.RotateTo(Disc.Rotation / 2, 500, Easing.OutQuint); } protected override void UpdatePreemptState() @@ -192,7 +192,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables circleContainer.ScaleTo(spinner.Scale * 0.3f); circleContainer.ScaleTo(spinner.Scale, TIME_PREEMPT / 1.4f, Easing.OutQuint); - disc.RotateTo(-720); + Disc.RotateTo(-720); symbol.RotateTo(-720); mainContainer diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs index ca75a61738..9f54ce3fa3 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs @@ -26,6 +26,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces private const float idle_alpha = 0.2f; private const float tracking_alpha = 0.4f; + public override bool IsPresent => true; // handle input when hidden + public SpinnerDisc(Spinner s) { spinner = s; diff --git a/osu.Game/Rulesets/Mods/IApplicableToDrawableHitObject.cs b/osu.Game/Rulesets/Mods/IApplicableToDrawableHitObject.cs index 2751e36a25..1024d5686d 100644 --- a/osu.Game/Rulesets/Mods/IApplicableToDrawableHitObject.cs +++ b/osu.Game/Rulesets/Mods/IApplicableToDrawableHitObject.cs @@ -1,11 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using osu.Game.Rulesets.Objects.Drawables; namespace osu.Game.Rulesets.Mods diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index ab4c04be3f..ca5326f35e 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -119,6 +119,9 @@ namespace osu.Game.Rulesets.Objects.Drawables { UpdateState(state); + // apply any custom state overrides + ApplyCustomUpdateState?.Invoke(this, state); + if (State == ArmedState.Hit) PlaySamples(); }; @@ -243,6 +246,11 @@ namespace osu.Game.Rulesets.Objects.Drawables nestedHitObjects.Add(h); } + /// + /// Bind to apply a custom state which can override the default implementation. + /// + public event Action ApplyCustomUpdateState; + protected abstract void UpdateState(ArmedState state); } } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index b5f93123fd..a5d60f80f6 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -310,6 +310,7 @@ + From d17f6cb5647c03b4fef7f7464ef7cfbfac43fa43 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Dec 2017 11:20:17 +0900 Subject: [PATCH 077/169] Fix crash when starting play mode with no beatmap Closes #1767 --- osu.Game/Screens/Play/PlayerLoader.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index de67bef004..a220dcee0e 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -250,7 +250,7 @@ namespace osu.Game.Screens.Play Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, }, - new MetadataLine("Mapper", metadata.Author.Username) + new MetadataLine("Mapper", metadata.AuthorString) { Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, From ae9f08f387dc26ca63eea7e09507e0ed9d4eded0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Dec 2017 11:47:04 +0900 Subject: [PATCH 078/169] Fix crash in editor when trying to seek on a virtual track --- .../Edit/Components/Timelines/Summary/Parts/MarkerPart.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs index 367cf4337d..b2308aca71 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs @@ -47,6 +47,8 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts if (Beatmap.Value == null) return; + if (Beatmap.Value.Track.Length == double.PositiveInfinity) return; + float markerPos = MathHelper.Clamp(ToLocalSpace(screenPosition).X, 0, DrawWidth); seekTo(markerPos / DrawWidth * Beatmap.Value.Track.Length); } From b95d7fc2cdbe07cd219256aedd413798a4728870 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 12:41:59 +0900 Subject: [PATCH 079/169] Revert "Make ControlPointInfo return a set default control point" This reverts commit 3113a55a988be6fe7112f73d1c905edd0cd787ab. --- .../ControlPoints/ControlPointInfo.cs | 27 ++++++++----------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index 234a50d5dd..f031ebe353 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -12,11 +12,6 @@ namespace osu.Game.Beatmaps.ControlPoints [Serializable] public class ControlPointInfo { - private static readonly TimingControlPoint default_timing_point = new TimingControlPoint(); - private static readonly DifficultyControlPoint default_difficulty_point = new DifficultyControlPoint(); - private static readonly SampleControlPoint default_sample_point = new SampleControlPoint(); - private static readonly EffectControlPoint default_effect_point = new EffectControlPoint(); - /// /// All timing points. /// @@ -46,68 +41,68 @@ namespace osu.Game.Beatmaps.ControlPoints /// /// The time to find the difficulty control point at. /// The difficulty control point. - public DifficultyControlPoint DifficultyPointAt(double time) => binarySearch(DifficultyPoints, time, default_difficulty_point); + public DifficultyControlPoint DifficultyPointAt(double time) => binarySearch(DifficultyPoints, time); /// /// Finds the effect control point that is active at . /// /// The time to find the effect control point at. /// The effect control point. - public EffectControlPoint EffectPointAt(double time) => binarySearch(EffectPoints, time, default_effect_point); + public EffectControlPoint EffectPointAt(double time) => binarySearch(EffectPoints, time); /// /// Finds the sound control point that is active at . /// /// The time to find the sound control point at. /// The sound control point. - public SampleControlPoint SamplePointAt(double time) => binarySearch(SamplePoints, time, SamplePoints.FirstOrDefault() ?? default_sample_point); + public SampleControlPoint SamplePointAt(double time) => binarySearch(SamplePoints, time, SamplePoints.FirstOrDefault()); /// /// Finds the timing control point that is active at . /// /// The time to find the timing control point at. /// The timing control point. - public TimingControlPoint TimingPointAt(double time) => binarySearch(TimingPoints, time, TimingPoints.FirstOrDefault() ?? default_timing_point); + public TimingControlPoint TimingPointAt(double time) => binarySearch(TimingPoints, time, TimingPoints.FirstOrDefault()); [JsonIgnore] /// /// Finds the maximum BPM represented by any timing control point. /// public double BPMMaximum => - 60000 / (TimingPoints.OrderBy(c => c.BeatLength).FirstOrDefault() ?? default_timing_point).BeatLength; + 60000 / (TimingPoints.OrderBy(c => c.BeatLength).FirstOrDefault() ?? new TimingControlPoint()).BeatLength; [JsonIgnore] /// /// Finds the minimum BPM represented by any timing control point. /// public double BPMMinimum => - 60000 / (TimingPoints.OrderByDescending(c => c.BeatLength).FirstOrDefault() ?? default_timing_point).BeatLength; + 60000 / (TimingPoints.OrderByDescending(c => c.BeatLength).FirstOrDefault() ?? new TimingControlPoint()).BeatLength; [JsonIgnore] /// /// Finds the mode BPM (most common BPM) represented by the control points. /// public double BPMMode => - 60000 / (TimingPoints.GroupBy(c => c.BeatLength).OrderByDescending(grp => grp.Count()).FirstOrDefault()?.FirstOrDefault() ?? default_timing_point).BeatLength; + 60000 / (TimingPoints.GroupBy(c => c.BeatLength).OrderByDescending(grp => grp.Count()).FirstOrDefault()?.FirstOrDefault() ?? new TimingControlPoint()).BeatLength; /// /// Binary searches one of the control point lists to find the active control point at . /// /// The list to search. /// The time to find the control point at. - /// The control point to use when there is no control point before . + /// The control point to use when is before any control points. If null, a new control point will be constructed. /// The active control point at . - private T binarySearch(SortedList list, double time, T defaultPoint) + private T binarySearch(SortedList list, double time, T prePoint = null) where T : ControlPoint, new() { if (list == null) throw new ArgumentNullException(nameof(list)); if (list.Count == 0) - return defaultPoint; + return new T(); if (time < list[0].Time) - return defaultPoint; + return prePoint ?? new T(); int index = list.BinarySearch(new T { Time = time }); From cf9a9762f7f7370c9f2cd1cf39080da5700b1455 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Dec 2017 12:30:30 +0900 Subject: [PATCH 080/169] Fix beatmap wedge appearing with incorrect info on entering song select Closes #1762 --- osu.Game/Screens/Select/BeatmapCarousel.cs | 13 +++++++++++-- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 4 ---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 9d7867659d..ffdd1daf72 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -53,6 +53,11 @@ namespace osu.Game.Screens.Select public override bool HandleInput => AllowSelection; + /// + /// Used to avoid firing null selections before the initial baetmaps have been loaded via . + /// + private bool initialLoadComplete; + private IEnumerable beatmapSets => root.Children.OfType(); public IEnumerable BeatmapSets @@ -76,7 +81,11 @@ namespace osu.Game.Screens.Select itemsCache.Invalidate(); scrollPositionCache.Invalidate(); - Schedule(() => BeatmapSetsChanged?.Invoke()); + Schedule(() => + { + BeatmapSetsChanged?.Invoke(); + initialLoadComplete = true; + }); })); } } @@ -513,7 +522,7 @@ namespace osu.Game.Screens.Select currentY += DrawHeight / 2; scrollableContent.Height = currentY; - if (selectedBeatmapSet == null || selectedBeatmap == null || selectedBeatmapSet.State.Value != CarouselItemState.Selected) + if (initialLoadComplete && (selectedBeatmapSet == null || selectedBeatmap == null || selectedBeatmapSet.State.Value != CarouselItemState.Selected)) { selectedBeatmapSet = null; SelectionChanged?.Invoke(null); diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index fa1326de8c..729cb458c2 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -71,10 +71,6 @@ namespace osu.Game.Screens.Select { State = beatmap == null ? Visibility.Hidden : Visibility.Visible; - // ensure we ourselves are visible if not already. - if (!IsPresent) - State = Visibility.Visible; - Info?.FadeOut(250); Info?.Expire(); From 519ef72adfa3b44d4a5fe28e904beb2fcd2c8c93 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 13:03:46 +0900 Subject: [PATCH 081/169] Lookup by control point time rather than control point Under some situations, such as when there are no control points, ControlPointInfo will return to us a newly-constructed controlpoint with every call to SamplePointAt, which will fail on this key lookup. Between this and overriding GetHashCode, I think this is the more proper fix for this. --- osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs b/osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs index 74e2195e09..982b339d3a 100644 --- a/osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs +++ b/osu.Game.Rulesets.Taiko/Audio/DrumSampleMapping.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; -using System.Linq; using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Game.Audio; @@ -13,7 +12,7 @@ namespace osu.Game.Rulesets.Taiko.Audio public class DrumSampleMapping { private readonly ControlPointInfo controlPoints; - private readonly Dictionary mappings = new Dictionary(); + private readonly Dictionary mappings = new Dictionary(); public DrumSampleMapping(ControlPointInfo controlPoints, AudioManager audio) { @@ -26,9 +25,9 @@ namespace osu.Game.Rulesets.Taiko.Audio else samplePoints = controlPoints.SamplePoints; - foreach (var s in samplePoints.Distinct()) + foreach (var s in samplePoints) { - mappings[s] = new DrumSample + mappings[s.Time] = new DrumSample { Centre = s.GetSampleInfo().GetChannel(audio.Sample, "Taiko"), Rim = s.GetSampleInfo(SampleInfo.HIT_CLAP).GetChannel(audio.Sample, "Taiko") @@ -36,7 +35,7 @@ namespace osu.Game.Rulesets.Taiko.Audio } } - public DrumSample SampleAt(double time) => mappings[controlPoints.SamplePointAt(time)]; + public DrumSample SampleAt(double time) => mappings[controlPoints.SamplePointAt(time).Time]; public class DrumSample { From 18d2be75d54a84dfe1d601c1a3cadab354fce7cc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Dec 2017 13:04:24 +0900 Subject: [PATCH 082/169] Fix random selection happening more than once on quick imports --- osu.Game/Screens/Select/SongSelect.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index b4494936f4..9e5a2fa633 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -444,7 +444,7 @@ namespace osu.Game.Screens.Select { if (!Beatmap.IsDefault && Beatmap.Value.BeatmapSetInfo?.DeletePending == false) Carousel.SelectBeatmap(Beatmap.Value.BeatmapInfo); - else + else if (Carousel.SelectedBeatmapSet == null) Carousel.SelectNextRandom(); } From 9fa0cfd250b7ed577a0169b2b436bac77fd4bb0c Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 13:06:36 +0900 Subject: [PATCH 083/169] Fix taiko autoplay hitting drumroll ticks with the rims instead of centres Fixes #1772. --- osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs b/osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs index df1a19267f..c43899ebf1 100644 --- a/osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs +++ b/osu.Game.Rulesets.Taiko/Replays/TaikoAutoGenerator.cs @@ -86,7 +86,7 @@ namespace osu.Game.Rulesets.Taiko.Replays { foreach (var tick in drumRoll.NestedHitObjects.OfType()) { - Frames.Add(new ReplayFrame(tick.StartTime, null, null, hitButton ? ReplayButtonState.Left1 : ReplayButtonState.Left2)); + Frames.Add(new ReplayFrame(tick.StartTime, null, null, hitButton ? ReplayButtonState.Right1 : ReplayButtonState.Right2)); hitButton = !hitButton; } } From 5b529511ec6727ccded551c9bce9312027ffa7f0 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 13:18:34 +0900 Subject: [PATCH 084/169] Update OpenTK nuget package Fixes the recent AppVeyor errors --- osu.Desktop/osu.Desktop.csproj | 4 ++-- osu.Desktop/packages.config | 2 +- osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj | 4 ++-- osu.Game.Rulesets.Catch/packages.config | 2 +- osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj | 4 ++-- osu.Game.Rulesets.Mania/packages.config | 2 +- osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj | 4 ++-- osu.Game.Rulesets.Osu/packages.config | 2 +- osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj | 4 ++-- osu.Game.Rulesets.Taiko/packages.config | 2 +- osu.Game.Tests/osu.Game.Tests.csproj | 4 ++-- osu.Game.Tests/packages.config | 2 +- osu.Game/osu.Game.csproj | 4 ++-- osu.Game/packages.config | 2 +- 14 files changed, 21 insertions(+), 21 deletions(-) diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index e4e9807754..4a1798feb4 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -135,8 +135,8 @@ $(SolutionDir)\packages\squirrel.windows.1.7.8\lib\Net45\NuGet.Squirrel.dll True - - $(SolutionDir)\packages\OpenTK.3.0.0-git00009\lib\net20\OpenTK.dll + + $(SolutionDir)\packages\OpenTK.3.0.0-git00021\lib\net20\OpenTK.dll True diff --git a/osu.Desktop/packages.config b/osu.Desktop/packages.config index 6b6361b578..e7233a42ac 100644 --- a/osu.Desktop/packages.config +++ b/osu.Desktop/packages.config @@ -6,7 +6,7 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste - + diff --git a/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj b/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj index b03c8d2eea..578d8eb34d 100644 --- a/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj +++ b/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj @@ -36,8 +36,8 @@ $(SolutionDir)\packages\NUnit.3.8.1\lib\net45\nunit.framework.dll True - - $(SolutionDir)\packages\OpenTK.3.0.0-git00009\lib\net20\OpenTK.dll + + $(SolutionDir)\packages\OpenTK.3.0.0-git00021\lib\net20\OpenTK.dll True diff --git a/osu.Game.Rulesets.Catch/packages.config b/osu.Game.Rulesets.Catch/packages.config index cde428acea..2369f7529b 100644 --- a/osu.Game.Rulesets.Catch/packages.config +++ b/osu.Game.Rulesets.Catch/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj index 26181164f9..bdd6656ed9 100644 --- a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj +++ b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj @@ -36,8 +36,8 @@ $(SolutionDir)\packages\NUnit.3.8.1\lib\net45\nunit.framework.dll True - - $(SolutionDir)\packages\OpenTK.3.0.0-git00009\lib\net20\OpenTK.dll + + $(SolutionDir)\packages\OpenTK.3.0.0-git00021\lib\net20\OpenTK.dll True diff --git a/osu.Game.Rulesets.Mania/packages.config b/osu.Game.Rulesets.Mania/packages.config index cde428acea..2369f7529b 100644 --- a/osu.Game.Rulesets.Mania/packages.config +++ b/osu.Game.Rulesets.Mania/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj index ec71869adb..6e61d7fb2d 100644 --- a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj +++ b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj @@ -37,8 +37,8 @@ $(SolutionDir)\packages\NUnit.3.8.1\lib\net45\nunit.framework.dll True - - $(SolutionDir)\packages\OpenTK.3.0.0-git00009\lib\net20\OpenTK.dll + + $(SolutionDir)\packages\OpenTK.3.0.0-git00021\lib\net20\OpenTK.dll True diff --git a/osu.Game.Rulesets.Osu/packages.config b/osu.Game.Rulesets.Osu/packages.config index cde428acea..2369f7529b 100644 --- a/osu.Game.Rulesets.Osu/packages.config +++ b/osu.Game.Rulesets.Osu/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj index f1c29c1a34..f73831a952 100644 --- a/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj +++ b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj @@ -36,8 +36,8 @@ $(SolutionDir)\packages\NUnit.3.8.1\lib\net45\nunit.framework.dll True - - $(SolutionDir)\packages\OpenTK.3.0.0-git00009\lib\net20\OpenTK.dll + + $(SolutionDir)\packages\OpenTK.3.0.0-git00021\lib\net20\OpenTK.dll True diff --git a/osu.Game.Rulesets.Taiko/packages.config b/osu.Game.Rulesets.Taiko/packages.config index cde428acea..2369f7529b 100644 --- a/osu.Game.Rulesets.Taiko/packages.config +++ b/osu.Game.Rulesets.Taiko/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index e0b9eb4091..df66896d9b 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -37,8 +37,8 @@ $(SolutionDir)\packages\NUnit.3.8.1\lib\net45\nunit.framework.dll True - - $(SolutionDir)\packages\OpenTK.3.0.0-git00009\lib\net20\OpenTK.dll + + $(SolutionDir)\packages\OpenTK.3.0.0-git00021\lib\net20\OpenTK.dll True diff --git a/osu.Game.Tests/packages.config b/osu.Game.Tests/packages.config index e09f2a07ba..c2056e09a8 100644 --- a/osu.Game.Tests/packages.config +++ b/osu.Game.Tests/packages.config @@ -6,6 +6,6 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste - + \ No newline at end of file diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index b5f93123fd..7d146c0a12 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -143,8 +143,8 @@ $(SolutionDir)\packages\NUnit.3.8.1\lib\net45\nunit.framework.dll True - - $(SolutionDir)\packages\OpenTK.3.0.0-git00009\lib\net20\OpenTK.dll + + $(SolutionDir)\packages\OpenTK.3.0.0-git00021\lib\net20\OpenTK.dll True diff --git a/osu.Game/packages.config b/osu.Game/packages.config index 02ace918de..3ba50388e8 100644 --- a/osu.Game/packages.config +++ b/osu.Game/packages.config @@ -66,7 +66,7 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste - + From 2a7147240f74af787b7f0d217c7c63e250d912e7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Dec 2017 13:25:42 +0900 Subject: [PATCH 085/169] Fix progress notifications not creating their completion notification early enough FIxes notification overlay thinking it has no notifications left and closing. --- osu.Game/Overlays/NotificationOverlay.cs | 9 ++++++--- osu.Game/Overlays/Notifications/ProgressNotification.cs | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/NotificationOverlay.cs b/osu.Game/Overlays/NotificationOverlay.cs index 2f1c3285ef..f19a80ef47 100644 --- a/osu.Game/Overlays/NotificationOverlay.cs +++ b/osu.Game/Overlays/NotificationOverlay.cs @@ -85,9 +85,12 @@ namespace osu.Game.Overlays private void notificationClosed() { - // hide ourselves if all notifications have been dismissed. - if (totalCount == 0) - State = Visibility.Hidden; + Schedule(() => + { + // hide ourselves if all notifications have been dismissed. + if (totalCount == 0) + State = Visibility.Hidden; + }); updateCounts(); } diff --git a/osu.Game/Overlays/Notifications/ProgressNotification.cs b/osu.Game/Overlays/Notifications/ProgressNotification.cs index c39c630858..d797372390 100644 --- a/osu.Game/Overlays/Notifications/ProgressNotification.cs +++ b/osu.Game/Overlays/Notifications/ProgressNotification.cs @@ -95,8 +95,8 @@ namespace osu.Game.Overlays.Notifications protected virtual void Completed() { - base.Close(); CompletionTarget?.Invoke(CreateCompletionNotification()); + base.Close(); } public override bool DisplayOnTop => false; From 5ad86d2b757baefcc57b1ac545e4283be8920e3a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 13:50:54 +0900 Subject: [PATCH 086/169] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 46d4704b0a..b28d4ba82a 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 46d4704b0a3f140fa8ad10ca0b1553b67d8385ab +Subproject commit b28d4ba82af0138d38ff8b3f4f3392d9d9068da9 From b97d0ce0509566a008cf38153e157222562aebf3 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 14:59:45 +0900 Subject: [PATCH 087/169] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 08f85f9bf9..b28d4ba82a 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 08f85f9bf9a7376aec8dfcde8c7c96d267d8c295 +Subproject commit b28d4ba82af0138d38ff8b3f4f3392d9d9068da9 From b564215527f506b726d7305411219a34d1a8ba73 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 17:32:19 +0900 Subject: [PATCH 088/169] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 08f85f9bf9..b28d4ba82a 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 08f85f9bf9a7376aec8dfcde8c7c96d267d8c295 +Subproject commit b28d4ba82af0138d38ff8b3f4f3392d9d9068da9 From b87e6c8b2ae1562045bb7cd3689a3cd9a594e9b0 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 17:33:34 +0900 Subject: [PATCH 089/169] Add a method to get ruleset by name --- osu.Game/Rulesets/RulesetStore.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/osu.Game/Rulesets/RulesetStore.cs b/osu.Game/Rulesets/RulesetStore.cs index 5cdf46ee46..3038c51e64 100644 --- a/osu.Game/Rulesets/RulesetStore.cs +++ b/osu.Game/Rulesets/RulesetStore.cs @@ -38,6 +38,13 @@ namespace osu.Game.Rulesets /// A ruleset, if available, else null. public RulesetInfo GetRuleset(int id) => AvailableRulesets.FirstOrDefault(r => r.ID == id); + /// + /// Retrieve a ruleset using a known short name. + /// + /// The ruleset's short name. + /// A ruleset, if available, else null. + public RulesetInfo GetRuleset(string shortName) => AvailableRulesets.FirstOrDefault(r => r.ShortName == shortName); + /// /// All available rulesets. /// From cb18baa4d86e526d7d8ebf6cf6cb45618b07fe3f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 17:34:07 +0900 Subject: [PATCH 090/169] Add HitCircle/Slider testcases --- .../Objects/Drawables/DrawableSlider.cs | 5 -- .../Objects/ISliderProgress.cs | 10 +++ .../Tests/TestCaseHitCircle.cs | 51 +++++++++++ osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs | 88 +++++++++++++++++++ .../osu.Game.Rulesets.Osu.csproj | 3 + 5 files changed, 152 insertions(+), 5 deletions(-) create mode 100644 osu.Game.Rulesets.Osu/Objects/ISliderProgress.cs create mode 100644 osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs create mode 100644 osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index d8a22d94ca..41d5ef1b02 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -167,9 +167,4 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables public override Vector2 SelectionPoint => ToScreenSpace(body.Position); public override Quad SelectionQuad => body.PathDrawQuad; } - - internal interface ISliderProgress - { - void UpdateProgress(double progress, int repeat); - } } diff --git a/osu.Game.Rulesets.Osu/Objects/ISliderProgress.cs b/osu.Game.Rulesets.Osu/Objects/ISliderProgress.cs new file mode 100644 index 0000000000..cb0d177a60 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Objects/ISliderProgress.cs @@ -0,0 +1,10 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Rulesets.Osu.Objects +{ + public interface ISliderProgress + { + void UpdateProgress(double progress, int repeat); + } +} diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs new file mode 100644 index 0000000000..a86101285a --- /dev/null +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs @@ -0,0 +1,51 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables; +using osu.Game.Tests.Visual; +using OpenTK; + +namespace osu.Game.Rulesets.Osu.Tests +{ + public class TestCaseHitCircle : OsuTestCase + { + private readonly Container content; + protected override Container Content => content; + + public TestCaseHitCircle() + { + base.Content.Add(content = new OsuInputManager(new RulesetInfo { ID = 0 })); + + AddStep("Single", addHitCircle); + AddStep("Stream", addStream); + } + + private void addHitCircle() + { + var circle = new HitCircle { StartTime = Time.Current + 1000 }; + circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); + + Add(new DrawableHitCircle(circle) { Anchor = Anchor.Centre }); + } + + private void addStream() + { + Vector2 pos = Vector2.Zero; + + for (int i = 1000; i <= 2000; i += 100) + { + var circle = new HitCircle { StartTime = Time.Current + i, Position = pos }; + circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); + + Add(new DrawableHitCircle(circle) { Anchor = Anchor.Centre, Depth = i}); + + pos += new Vector2(10); + } + } + } +} diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs new file mode 100644 index 0000000000..c423ca3736 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs @@ -0,0 +1,88 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Collections.Generic; +using System.Linq; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Audio; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables; +using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; +using osu.Game.Tests.Visual; +using OpenTK; + +namespace osu.Game.Rulesets.Osu.Tests +{ + public class TestCaseSlider : OsuTestCase + { + public override IReadOnlyList RequiredTypes => new[] { typeof(DrawableSlider) }; + + private readonly Container content; + protected override Container Content => content; + + public TestCaseSlider() + { + base.Content.Add(content = new OsuInputManager(new RulesetInfo { ID = 0 })); + + AddStep("Single", addSingle); + AddStep("Repeated (1)", () => addRepeated(1)); + AddStep("Repeated (2)", () => addRepeated(2)); + AddStep("Repeated (3)", () => addRepeated(3)); + AddStep("Repeated (4)", () => addRepeated(4)); + AddStep("Stream", addStream); + } + + private void addSingle() + { + var slider = new Slider + { + StartTime = Time.Current + 1000, + Position = new Vector2(-200, 0), + ControlPoints = new List + { + new Vector2(-200, 0), + new Vector2(400, 0), + }, + Distance = 400, + Velocity = 1, + TickDistance = 100, + }; + + slider.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); + + Add(new DrawableSlider(slider) { Anchor = Anchor.Centre }); + } + + private void addRepeated(int repeats) + { + var slider = new Slider + { + StartTime = Time.Current + 1000, + Position = new Vector2(-200, 0), + ControlPoints = new List + { + new Vector2(-200, 0), + new Vector2(400, 0), + }, + Distance = 400, + Velocity = 11, + TickDistance = 100, + RepeatCount = repeats, + RepeatSamples = new List[repeats].ToList() + }; + + slider.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); + + Add(new DrawableSlider(slider) { Anchor = Anchor.Centre }); + } + + private void addStream() + { + + } + } +} diff --git a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj index 6e61d7fb2d..d99f8bc948 100644 --- a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj +++ b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj @@ -75,6 +75,7 @@ + @@ -86,8 +87,10 @@ + + From 7d0c94fd01625e81565b530afe4df5e049c4c5ba Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Dec 2017 19:42:44 +0900 Subject: [PATCH 091/169] Fix notification overlay layout and scheduled tasks being delayed Closes #1295 --- .../Visual/TestCaseNotificationOverlay.cs | 49 ++++++++++++++++--- .../Notifications/NotificationSection.cs | 4 ++ 2 files changed, 46 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs b/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs index a83cead213..e1711be102 100644 --- a/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.MathUtils; using osu.Game.Overlays; @@ -19,11 +20,12 @@ namespace osu.Game.Tests.Visual public override IReadOnlyList RequiredTypes => new[] { - typeof(Notification), + typeof(NotificationSection), + typeof(SimpleNotification), typeof(ProgressNotification), typeof(ProgressCompletionNotification), - typeof(SimpleNotification), typeof(IHasCompletionTarget), + typeof(Notification) }; public TestCaseNotificationOverlay() @@ -40,17 +42,44 @@ namespace osu.Game.Tests.Visual Content.Add(displayedCount); + void setState(Visibility state) => AddStep(state.ToString(), () => manager.State = state); + void checkProgressingCount(int expected) => AddAssert($"progressing count is {expected}", () => progressingNotifications.Count == expected); + manager.UnreadCount.ValueChanged += count => { displayedCount.Text = $"displayed count: {count}"; }; - AddStep(@"toggle", manager.ToggleVisibility); + + setState(Visibility.Visible); AddStep(@"simple #1", sendHelloNotification); AddStep(@"simple #2", sendAmazingNotification); AddStep(@"progress #1", sendUploadProgress); AddStep(@"progress #2", sendDownloadProgress); - AddStep(@"barrage", () => sendBarrage()); + + checkProgressingCount(2); + + setState(Visibility.Hidden); + + AddRepeatStep(@"add many simple", sendManyNotifications, 3); + AddWaitStep(5); + + checkProgressingCount(0); + + AddStep(@"progress #3", sendUploadProgress); + + checkProgressingCount(1); + + AddAssert("Displayed count is 33", () => manager.UnreadCount.Value == 33); + + AddWaitStep(5); + + checkProgressingCount(0); + + + setState(Visibility.Visible); + + //AddStep(@"barrage", () => sendBarrage()); } - private void sendBarrage(int remaining = 100) + private void sendBarrage(int remaining = 10) { switch (RNG.Next(0, 4)) { @@ -80,7 +109,7 @@ namespace osu.Game.Tests.Visual if (progressingNotifications.Count(n => n.State == ProgressNotificationState.Active) < 3) { - var p = progressingNotifications.FirstOrDefault(n => n.IsAlive && n.State == ProgressNotificationState.Queued); + var p = progressingNotifications.FirstOrDefault(n => n.State == ProgressNotificationState.Queued); if (p != null) p.State = ProgressNotificationState.Active; } @@ -88,7 +117,7 @@ namespace osu.Game.Tests.Visual foreach (var n in progressingNotifications.FindAll(n => n.State == ProgressNotificationState.Active)) { if (n.Progress < 1) - n.Progress += (float)(Time.Elapsed / 2000) * RNG.NextSingle(); + n.Progress += (float)(Time.Elapsed / 200) * RNG.NextSingle(); else n.State = ProgressNotificationState.Completed; } @@ -125,5 +154,11 @@ namespace osu.Game.Tests.Visual { manager.Post(new SimpleNotification { Text = @"Welcome to osu!. Enjoy your stay!" }); } + + private void sendManyNotifications() + { + for (int i = 0; i < 10; i++) + manager.Post(new SimpleNotification { Text = @"Spam incoming!!" }); + } } } diff --git a/osu.Game/Overlays/Notifications/NotificationSection.cs b/osu.Game/Overlays/Notifications/NotificationSection.cs index 2bd0321d12..e6587506aa 100644 --- a/osu.Game/Overlays/Notifications/NotificationSection.cs +++ b/osu.Game/Overlays/Notifications/NotificationSection.cs @@ -20,6 +20,10 @@ namespace osu.Game.Overlays.Notifications private OsuSpriteText titleText; private OsuSpriteText countText; + // this is required to ensure correct layout and scheduling on children. + // the layout portion of this is being tracked as a framework issue (TODO). + protected override bool RequiresChildrenUpdate => true; + private ClearAllButton clearButton; private FlowContainer notifications; From 4d5216da00d63a8830c42d3e7718d912b49fcc6c Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 19:47:42 +0900 Subject: [PATCH 092/169] Finish up implementation of TestCaseSlider --- osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs | 66 ++++++++++++++----- 1 file changed, 49 insertions(+), 17 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs index c423ca3736..5b9047db88 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Audio; @@ -11,7 +10,6 @@ using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; -using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using osu.Game.Tests.Visual; using OpenTK; @@ -24,11 +22,18 @@ namespace osu.Game.Rulesets.Osu.Tests private readonly Container content; protected override Container Content => content; + private double speedMultiplier; + private double sliderMultiplier; + private int depthIndex; + public TestCaseSlider() { base.Content.Add(content = new OsuInputManager(new RulesetInfo { ID = 0 })); - AddStep("Single", addSingle); + AddSliderStep("SpeedMultiplier", 0.01, 10, 2, s => speedMultiplier = s); + AddSliderStep("SliderMultiplier", 0.01, 10, 2, s => sliderMultiplier = s); + + AddStep("Single", () => addSingle()); AddStep("Repeated (1)", () => addRepeated(1)); AddStep("Repeated (2)", () => addRepeated(2)); AddStep("Repeated (3)", () => addRepeated(3)); @@ -36,29 +41,44 @@ namespace osu.Game.Rulesets.Osu.Tests AddStep("Stream", addStream); } - private void addSingle() + private void addSingle(double timeOffset = 0, Vector2? positionOffset = null) { + positionOffset = positionOffset ?? Vector2.Zero; + var slider = new Slider { - StartTime = Time.Current + 1000, - Position = new Vector2(-200, 0), + StartTime = Time.Current + 1000 + timeOffset, + Position = new Vector2(-200, 0) + positionOffset.Value, ControlPoints = new List { - new Vector2(-200, 0), - new Vector2(400, 0), + new Vector2(-200, 0) + positionOffset.Value, + new Vector2(400, 0) + positionOffset.Value, }, Distance = 400, - Velocity = 1, - TickDistance = 100, }; - slider.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); + var cpi = new ControlPointInfo(); + cpi.DifficultyPoints.Add(new DifficultyControlPoint { SpeedMultiplier = speedMultiplier }); - Add(new DrawableSlider(slider) { Anchor = Anchor.Centre }); + var difficulty = new BeatmapDifficulty { SliderMultiplier = (float)sliderMultiplier }; + + slider.ApplyDefaults(cpi, difficulty); + Add(new DrawableSlider(slider) + { + Anchor = Anchor.Centre, + Depth = depthIndex++ + }); } private void addRepeated(int repeats) { + // The first run through the slider is considered a repeat + repeats++; + + var repeatSamples = new List>(); + for (int i = 0; i < repeats; i++) + repeatSamples.Add(new List()); + var slider = new Slider { StartTime = Time.Current + 1000, @@ -69,20 +89,32 @@ namespace osu.Game.Rulesets.Osu.Tests new Vector2(400, 0), }, Distance = 400, - Velocity = 11, - TickDistance = 100, RepeatCount = repeats, - RepeatSamples = new List[repeats].ToList() + RepeatSamples = repeatSamples }; - slider.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); + var cpi = new ControlPointInfo(); + cpi.DifficultyPoints.Add(new DifficultyControlPoint { SpeedMultiplier = speedMultiplier }); - Add(new DrawableSlider(slider) { Anchor = Anchor.Centre }); + var difficulty = new BeatmapDifficulty { SliderMultiplier = (float)sliderMultiplier }; + + slider.ApplyDefaults(cpi, difficulty); + Add(new DrawableSlider(slider) + { + Anchor = Anchor.Centre, + Depth = depthIndex++ + }); } private void addStream() { + Vector2 pos = Vector2.Zero; + for (int i = 0; i <= 1000; i += 100) + { + addSingle(i, pos); + pos += new Vector2(10); + } } } } From fdafc2107e40b5cd51916e648a3ae7a807491042 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 19:47:55 +0900 Subject: [PATCH 093/169] Cleanups + add auto to TestCaseHitCircle --- .../Tests/TestCaseHitCircle.cs | 37 ++++++++++++++----- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs index a86101285a..dea941fb01 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs @@ -5,6 +5,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Tests.Visual; @@ -17,33 +18,49 @@ namespace osu.Game.Rulesets.Osu.Tests private readonly Container content; protected override Container Content => content; + private bool auto; + private int depthIndex; + public TestCaseHitCircle() { base.Content.Add(content = new OsuInputManager(new RulesetInfo { ID = 0 })); - AddStep("Single", addHitCircle); + AddStep("Single", () => addSingle()); AddStep("Stream", addStream); + AddToggleStep("Auto", v => auto = v); } - private void addHitCircle() + private void addSingle(double timeOffset = 0, Vector2? positionOffset = null) { - var circle = new HitCircle { StartTime = Time.Current + 1000 }; + positionOffset = positionOffset ?? Vector2.Zero; + + var circle = new HitCircle + { + StartTime = Time.Current + 1000 + timeOffset, + Position = positionOffset.Value + }; + circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); - Add(new DrawableHitCircle(circle) { Anchor = Anchor.Centre }); + var drawable = new DrawableHitCircle(circle) + { + Anchor = Anchor.Centre, + Depth = depthIndex++ + }; + + if (auto) + drawable.State.Value = ArmedState.Hit; + + Add(drawable); } private void addStream() { Vector2 pos = Vector2.Zero; - for (int i = 1000; i <= 2000; i += 100) + for (int i = 0; i <= 1000; i += 100) { - var circle = new HitCircle { StartTime = Time.Current + i, Position = pos }; - circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); - - Add(new DrawableHitCircle(circle) { Anchor = Anchor.Centre, Depth = i}); - + addSingle(i, pos); pos += new Vector2(10); } } From ccaf63a4378219d4cdef5453500c63acef9a94c0 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 20:01:20 +0900 Subject: [PATCH 094/169] Add a Spinner testcase --- .../Tests/TestCaseSpinner.cs | 43 +++++++++++++++++++ .../osu.Game.Rulesets.Osu.csproj | 1 + 2 files changed, 44 insertions(+) create mode 100644 osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs new file mode 100644 index 0000000000..6db9c1a473 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs @@ -0,0 +1,43 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables; +using osu.Game.Tests.Visual; + +namespace osu.Game.Rulesets.Osu.Tests +{ + public class TestCaseSpinner : OsuTestCase + { + private readonly Container content; + protected override Container Content => content; + + private int depthIndex; + + public TestCaseSpinner() + { + base.Content.Add(content = new OsuInputManager(new RulesetInfo { ID = 0 })); + + AddStep("Single", addSingle); + } + + private void addSingle() + { + var spinner = new Spinner { StartTime = Time.Current + 1000, EndTime = Time.Current + 4000 }; + + spinner.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); + + var drawable = new DrawableSpinner(spinner) + { + Anchor = Anchor.Centre, + Depth = depthIndex++ + }; + + Add(drawable); + } + } +} diff --git a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj index d99f8bc948..ab34d1803f 100644 --- a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj +++ b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj @@ -91,6 +91,7 @@ + From 4c032df6770e2372b899929628aa9f48a7876c74 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 20:08:33 +0900 Subject: [PATCH 095/169] Move sliderbars to the end of the testcase buttons --- osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs index 5b9047db88..4f7fa1dada 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs @@ -22,23 +22,23 @@ namespace osu.Game.Rulesets.Osu.Tests private readonly Container content; protected override Container Content => content; - private double speedMultiplier; - private double sliderMultiplier; + private double speedMultiplier = 2; + private double sliderMultiplier = 2; private int depthIndex; public TestCaseSlider() { base.Content.Add(content = new OsuInputManager(new RulesetInfo { ID = 0 })); - AddSliderStep("SpeedMultiplier", 0.01, 10, 2, s => speedMultiplier = s); - AddSliderStep("SliderMultiplier", 0.01, 10, 2, s => sliderMultiplier = s); - AddStep("Single", () => addSingle()); AddStep("Repeated (1)", () => addRepeated(1)); AddStep("Repeated (2)", () => addRepeated(2)); AddStep("Repeated (3)", () => addRepeated(3)); AddStep("Repeated (4)", () => addRepeated(4)); AddStep("Stream", addStream); + + AddSliderStep("SpeedMultiplier", 0.01, 10, 2, s => speedMultiplier = s); + AddSliderStep("SliderMultiplier", 0.01, 10, 2, s => sliderMultiplier = s); } private void addSingle(double timeOffset = 0, Vector2? positionOffset = null) From 5b45d36fef389bbae971bf4e87ea472b9240ea9f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 20:09:33 +0900 Subject: [PATCH 096/169] Decomission TestCaseHitObjects --- .../Tests/TestCaseHitObjects.cs | 129 ------------------ .../osu.Game.Rulesets.Osu.csproj | 1 - 2 files changed, 130 deletions(-) delete mode 100644 osu.Game.Rulesets.Osu/Tests/TestCaseHitObjects.cs diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseHitObjects.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseHitObjects.cs deleted file mode 100644 index c4932d7803..0000000000 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseHitObjects.cs +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System.Collections.Generic; -using NUnit.Framework; -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Timing; -using osu.Game.Rulesets.Objects.Drawables; -using osu.Game.Rulesets.Osu.Objects; -using osu.Game.Rulesets.Osu.Objects.Drawables; -using osu.Game.Tests.Visual; -using OpenTK; - -namespace osu.Game.Rulesets.Osu.Tests -{ - [TestFixture] - [Ignore("getting CI working")] - public class TestCaseHitObjects : OsuTestCase - { - private FramedClock framedClock; - - private bool auto; - - [BackgroundDependencyLoader] - private void load(RulesetStore rulesets) - { - var rateAdjustClock = new StopwatchClock(true); - framedClock = new FramedClock(rateAdjustClock); - - AddStep(@"circles", () => loadHitobjects(HitObjectType.Circle)); - AddStep(@"slider", () => loadHitobjects(HitObjectType.Slider)); - AddStep(@"spinner", () => loadHitobjects(HitObjectType.Spinner)); - - AddToggleStep("Auto", state => { auto = state; loadHitobjects(mode); }); - AddSliderStep("Playback speed", 0.0, 2.0, 0.5, v => rateAdjustClock.Rate = v); - - framedClock.ProcessFrame(); - - var clockAdjustContainer = new Container - { - RelativeSizeAxes = Axes.Both, - Clock = framedClock, - Children = new[] - { - playfieldContainer = new OsuInputManager(rulesets.GetRuleset(0)) { RelativeSizeAxes = Axes.Both }, - approachContainer = new Container { RelativeSizeAxes = Axes.Both } - } - }; - - Add(clockAdjustContainer); - } - - private HitObjectType mode = HitObjectType.Slider; - - private Container playfieldContainer; - private Container approachContainer; - - private void loadHitobjects(HitObjectType mode) - { - this.mode = mode; - - switch (mode) - { - case HitObjectType.Circle: - const int count = 10; - - for (int i = 0; i < count; i++) - { - var h = new HitCircle - { - StartTime = framedClock.CurrentTime + 600 + i * 80, - Position = new Vector2((i - count / 2) * 14), - }; - - add(new DrawableHitCircle(h)); - } - break; - case HitObjectType.Slider: - add(new DrawableSlider(new Slider - { - StartTime = framedClock.CurrentTime + 600, - ControlPoints = new List - { - new Vector2(-200, 0), - new Vector2(400, 0), - }, - Distance = 400, - Position = new Vector2(-200, 0), - Velocity = 1, - TickDistance = 100, - })); - break; - case HitObjectType.Spinner: - add(new DrawableSpinner(new Spinner - { - StartTime = framedClock.CurrentTime + 600, - EndTime = framedClock.CurrentTime + 1600, - Position = new Vector2(0, 0), - })); - break; - } - } - - private int depth; - - private void add(DrawableOsuHitObject h) - { - h.Anchor = Anchor.Centre; - h.Depth = depth++; - - if (auto) - h.State.Value = ArmedState.Hit; - - playfieldContainer.Add(h); - var proxyable = h as IDrawableHitObjectWithProxiedApproach; - if (proxyable != null) - approachContainer.Add(proxyable.ProxiedLayer.CreateProxy()); - } - - private enum HitObjectType - { - Circle, - Slider, - Spinner - } - } -} diff --git a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj index ab34d1803f..245f3eed91 100644 --- a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj +++ b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj @@ -88,7 +88,6 @@ - From edab169024fb253470865aaf0fac2216485fb9f9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Dec 2017 20:27:20 +0900 Subject: [PATCH 097/169] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 08f85f9bf9..10cae790c6 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 08f85f9bf9a7376aec8dfcde8c7c96d267d8c295 +Subproject commit 10cae790c6f1d559c326f9438958d0b012d61dc6 From c18fd5da48fc28f1c4a610e05a19973a99e3db3b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 20:37:28 +0900 Subject: [PATCH 098/169] Simplify creation of repeat points --- osu.Game.Rulesets.Osu/Objects/Slider.cs | 35 ++++++++----------------- 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index 2d3a4ed7f0..bfb7801532 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -151,35 +151,22 @@ namespace osu.Game.Rulesets.Osu.Objects private void createRepeatPoints() { - var length = Curve.Distance; - var repeatPointDistance = Math.Min(Distance, length); - var repeatDuration = length / Velocity; - - bool sliderStart = true; + var repeatDuration = Distance / Velocity; for (var repeat = 1; repeat < RepeatCount; repeat++) { - sliderStart = !sliderStart; + var repeatStartTime = StartTime + repeat * repeatDuration; - for (var d = repeatPointDistance; d <= length; d += repeatPointDistance) + AddNested(new RepeatPoint { - var repeatStartTime = StartTime + repeat * repeatDuration; - var distanceProgress = d / length; - - if (sliderStart) - distanceProgress = 0; - - AddNested(new RepeatPoint - { - RepeatIndex = repeat, - StartTime = repeatStartTime, - Position = Curve.PositionAt(distanceProgress), - StackHeight = StackHeight, - Scale = Scale, - ComboColour = ComboColour, - Samples = new List(RepeatSamples[repeat]) - }); - } + RepeatIndex = repeat, + StartTime = repeatStartTime, + Position = Curve.PositionAt(repeat), + StackHeight = StackHeight, + Scale = Scale, + ComboColour = ComboColour, + Samples = new List(RepeatSamples[repeat]) + }); } } } From 1a5cf98e0c51e13f15ac826878eca260d7db7fce Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 20:40:38 +0900 Subject: [PATCH 099/169] Fix repeat points always being placed at end position of th slider PositionAt is clamped to [0, 1] where 0 denotes the beginning of the curve and 1 denotes the end of the curve. It has no concept of repeats. --- osu.Game.Rulesets.Osu/Objects/Slider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index bfb7801532..ec51a10345 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -161,7 +161,7 @@ namespace osu.Game.Rulesets.Osu.Objects { RepeatIndex = repeat, StartTime = repeatStartTime, - Position = Curve.PositionAt(repeat), + Position = Curve.PositionAt(repeat % 2), StackHeight = StackHeight, Scale = Scale, ComboColour = ComboColour, From 6fe20bb91099abb437e93c0026ad61a081cc9db3 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 20:41:59 +0900 Subject: [PATCH 100/169] Ignore test cases for CI --- osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs | 2 ++ osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs | 2 ++ osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs | 2 ++ 3 files changed, 6 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs index dea941fb01..5130a976f7 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; @@ -13,6 +14,7 @@ using OpenTK; namespace osu.Game.Rulesets.Osu.Tests { + [Ignore("getting CI working")] public class TestCaseHitCircle : OsuTestCase { private readonly Container content; diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs index 4f7fa1dada..3e861b0890 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Audio; @@ -15,6 +16,7 @@ using OpenTK; namespace osu.Game.Rulesets.Osu.Tests { + [Ignore("getting CI working")] public class TestCaseSlider : OsuTestCase { public override IReadOnlyList RequiredTypes => new[] { typeof(DrawableSlider) }; diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs index 6db9c1a473..fc76170585 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; @@ -11,6 +12,7 @@ using osu.Game.Tests.Visual; namespace osu.Game.Rulesets.Osu.Tests { + [Ignore("getting CI working")] public class TestCaseSpinner : OsuTestCase { private readonly Container content; From 46ef17354ee1922f30ef2e64d38ee321455e0f2b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Dec 2017 21:05:16 +0900 Subject: [PATCH 101/169] Simplify path construction --- osu.Game/Audio/SampleInfo.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/osu.Game/Audio/SampleInfo.cs b/osu.Game/Audio/SampleInfo.cs index 1133dde570..31acb8bc89 100644 --- a/osu.Game/Audio/SampleInfo.cs +++ b/osu.Game/Audio/SampleInfo.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.IO; using osu.Framework.Audio.Sample; namespace osu.Game.Audio @@ -16,14 +17,7 @@ namespace osu.Game.Audio public SampleChannel GetChannel(SampleManager manager, string resourceNamespace = null) { - SampleChannel channel = null; - - if (!string.IsNullOrEmpty(resourceNamespace)) - channel = manager.Get($"Gameplay/{resourceNamespace}/{Bank}-{Name}"); - - if (channel == null) - channel = manager.Get($"Gameplay/{Bank}-{Name}"); - + SampleChannel channel = manager.Get(Path.Combine("Gameplay", resourceNamespace ?? string.Empty, $"{Bank}-{Name}")); channel.Volume.Value = Volume / 100.0; return channel; } From 3428cf65012e214751349a0a9d5de75a3b65dba4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Dec 2017 20:26:14 +0900 Subject: [PATCH 102/169] Decrease speed of progress notifications --- osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs b/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs index e1711be102..46deca073f 100644 --- a/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs @@ -69,7 +69,7 @@ namespace osu.Game.Tests.Visual AddAssert("Displayed count is 33", () => manager.UnreadCount.Value == 33); - AddWaitStep(5); + AddWaitStep(10); checkProgressingCount(0); @@ -117,7 +117,7 @@ namespace osu.Game.Tests.Visual foreach (var n in progressingNotifications.FindAll(n => n.State == ProgressNotificationState.Active)) { if (n.Progress < 1) - n.Progress += (float)(Time.Elapsed / 200) * RNG.NextSingle(); + n.Progress += (float)(Time.Elapsed / 400) * RNG.NextSingle(); else n.State = ProgressNotificationState.Completed; } From 9a4b2f0d1dfe607f7bc773be2b47d707fe98bd85 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Dec 2017 21:19:06 +0900 Subject: [PATCH 103/169] Apply workaround at two levels --- .../Notifications/NotificationSection.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/Notifications/NotificationSection.cs b/osu.Game/Overlays/Notifications/NotificationSection.cs index e6587506aa..42fcc3aa0f 100644 --- a/osu.Game/Overlays/Notifications/NotificationSection.cs +++ b/osu.Game/Overlays/Notifications/NotificationSection.cs @@ -15,15 +15,11 @@ using osu.Game.Graphics.Containers; namespace osu.Game.Overlays.Notifications { - public class NotificationSection : FillFlowContainer + public class NotificationSection : AlwaysUpdateFillFlowContainer { private OsuSpriteText titleText; private OsuSpriteText countText; - // this is required to ensure correct layout and scheduling on children. - // the layout portion of this is being tracked as a framework issue (TODO). - protected override bool RequiresChildrenUpdate => true; - private ClearAllButton clearButton; private FlowContainer notifications; @@ -37,6 +33,7 @@ namespace osu.Game.Overlays.Notifications public IEnumerable AcceptTypes; private string clearText; + public string ClearText { get { return clearText; } @@ -114,7 +111,7 @@ namespace osu.Game.Overlays.Notifications }, }, }, - notifications = new FillFlowContainer + notifications = new AlwaysUpdateFillFlowContainer { AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, @@ -163,4 +160,13 @@ namespace osu.Game.Overlays.Notifications notifications?.Children.ForEach(n => n.Read = true); } } + + public class AlwaysUpdateFillFlowContainer : FillFlowContainer + where T : Drawable + { + // this is required to ensure correct layout and scheduling on children. + // the layout portion of this is being tracked as a framework issue (https://github.com/ppy/osu-framework/issues/1297). + protected override bool RequiresChildrenUpdate => true; + } + } From 3f73a9a693ab6573e7fef09bfca8d7ce1106e720 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Dec 2017 21:44:04 +0900 Subject: [PATCH 104/169] Add better sample fallback logic Also adds support for null channels at InputDrum level. --- osu.Game.Rulesets.Taiko/UI/InputDrum.cs | 4 ++-- osu.Game/Audio/SampleInfo.cs | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/InputDrum.cs b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs index bf1274256b..9b2ea095d2 100644 --- a/osu.Game.Rulesets.Taiko/UI/InputDrum.cs +++ b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs @@ -152,14 +152,14 @@ namespace osu.Game.Rulesets.Taiko.UI target = centreHit; back = centre; - drumSample.Centre.Play(); + drumSample.Centre?.Play(); } else if (action == RimAction) { target = rimHit; back = rim; - drumSample.Rim.Play(); + drumSample.Rim?.Play(); } if (target != null) diff --git a/osu.Game/Audio/SampleInfo.cs b/osu.Game/Audio/SampleInfo.cs index 31acb8bc89..9597acd902 100644 --- a/osu.Game/Audio/SampleInfo.cs +++ b/osu.Game/Audio/SampleInfo.cs @@ -17,8 +17,18 @@ namespace osu.Game.Audio public SampleChannel GetChannel(SampleManager manager, string resourceNamespace = null) { - SampleChannel channel = manager.Get(Path.Combine("Gameplay", resourceNamespace ?? string.Empty, $"{Bank}-{Name}")); - channel.Volume.Value = Volume / 100.0; + SampleChannel channel = null; + + if (resourceNamespace != null) + channel = manager.Get(Path.Combine("Gameplay", resourceNamespace, $"{Bank}-{Name}")); + + // try without namespace as a fallback. + if (channel == null) + channel = manager.Get(Path.Combine("Gameplay", $"{Bank}-{Name}")); + + if (channel != null) + channel.Volume.Value = Volume / 100.0; + return channel; } From 3a2dadc9d390b2112d201eef4a1b5a16d7409d56 Mon Sep 17 00:00:00 2001 From: Dan Balasescu <1329837+smoogipoo@users.noreply.github.com> Date: Wed, 27 Dec 2017 23:14:48 +0900 Subject: [PATCH 105/169] Fix spelling error --- osu.Game/Screens/Select/BeatmapCarousel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index ffdd1daf72..e877633ab3 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -54,7 +54,7 @@ namespace osu.Game.Screens.Select public override bool HandleInput => AllowSelection; /// - /// Used to avoid firing null selections before the initial baetmaps have been loaded via . + /// Used to avoid firing null selections before the initial beatmaps have been loaded via . /// private bool initialLoadComplete; From 7b06c16e70882bfbcbb8003da9172259f6dba97f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Dec 2017 23:44:51 +0900 Subject: [PATCH 106/169] Display larger hitcircles --- osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs | 2 +- osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs | 12 ++++++++++-- osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs index 5130a976f7..ef0bffa14e 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs @@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Osu.Tests Position = positionOffset.Value }; - circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); + circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = 0 }); var drawable = new DrawableHitCircle(circle) { diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs index 3e861b0890..7ce9c35bd5 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs @@ -62,7 +62,11 @@ namespace osu.Game.Rulesets.Osu.Tests var cpi = new ControlPointInfo(); cpi.DifficultyPoints.Add(new DifficultyControlPoint { SpeedMultiplier = speedMultiplier }); - var difficulty = new BeatmapDifficulty { SliderMultiplier = (float)sliderMultiplier }; + var difficulty = new BeatmapDifficulty + { + SliderMultiplier = (float)sliderMultiplier, + CircleSize = 0 + }; slider.ApplyDefaults(cpi, difficulty); Add(new DrawableSlider(slider) @@ -98,7 +102,11 @@ namespace osu.Game.Rulesets.Osu.Tests var cpi = new ControlPointInfo(); cpi.DifficultyPoints.Add(new DifficultyControlPoint { SpeedMultiplier = speedMultiplier }); - var difficulty = new BeatmapDifficulty { SliderMultiplier = (float)sliderMultiplier }; + var difficulty = new BeatmapDifficulty + { + SliderMultiplier = (float)sliderMultiplier, + CircleSize = 0 + }; slider.ApplyDefaults(cpi, difficulty); Add(new DrawableSlider(slider) diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs index fc76170585..76cc70effd 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs @@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Osu.Tests { var spinner = new Spinner { StartTime = Time.Current + 1000, EndTime = Time.Current + 4000 }; - spinner.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); + spinner.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = 0 }); var drawable = new DrawableSpinner(spinner) { From 7a0662da4b9364963774240d849284cc904cf2be Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Dec 2017 00:38:50 +0900 Subject: [PATCH 107/169] Fix regression during merges --- osu.Game/OsuGame.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 9c852a189a..2bc32794d7 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -440,12 +440,16 @@ namespace osu.Game private void screenAdded(Screen newScreen) { + currentScreen = (OsuScreen)newScreen; + newScreen.ModePushed += screenAdded; newScreen.Exited += screenRemoved; } private void screenRemoved(Screen newScreen) { + currentScreen = (OsuScreen)newScreen; + if (newScreen == null) Exit(); } From 4e6988d21bba51441c9553d12580c1e8e7bfd11f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Dec 2017 01:00:01 +0900 Subject: [PATCH 108/169] As it turns out, native directory separators are not supported --- osu.Game/Audio/SampleInfo.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game/Audio/SampleInfo.cs b/osu.Game/Audio/SampleInfo.cs index 9597acd902..71975bf0fa 100644 --- a/osu.Game/Audio/SampleInfo.cs +++ b/osu.Game/Audio/SampleInfo.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.IO; using osu.Framework.Audio.Sample; namespace osu.Game.Audio @@ -20,11 +19,11 @@ namespace osu.Game.Audio SampleChannel channel = null; if (resourceNamespace != null) - channel = manager.Get(Path.Combine("Gameplay", resourceNamespace, $"{Bank}-{Name}")); + channel = manager.Get($"Gameplay/{resourceNamespace}/{Bank}-{Name}"); // try without namespace as a fallback. if (channel == null) - channel = manager.Get(Path.Combine("Gameplay", $"{Bank}-{Name}")); + channel = manager.Get($"Gameplay/{Bank}-{Name}"); if (channel != null) channel.Volume.Value = Volume / 100.0; From 7d29c076d2eed3d70c1f55aad4c479a0eea4871c Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Wed, 27 Dec 2017 21:12:02 +0100 Subject: [PATCH 109/169] fix circles and slider sequences + minor cleanup --- osu.Game.Rulesets.Osu/Mods/OsuMod.cs | 21 ++++++++++++------- .../UI/OsuRulesetContainer.cs | 9 +++----- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs index 6b8f30eaec..8c8e8e7d3a 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs @@ -48,7 +48,6 @@ namespace osu.Game.Rulesets.Osu.Mods if (!(drawable is DrawableOsuHitObject d)) return; - //var duration = (d.HitObject as IHasEndTime)?.Duration ?? 0; var fadeInTime = d.HitObject.StartTime - preEmpt; var fadeIn = d.HitObject.StartTime - preEmpt * fade_in_speed_multiplier - fadeInTime; var fadeOutTime = fadeInTime + fadeIn; @@ -56,22 +55,30 @@ namespace osu.Game.Rulesets.Osu.Mods d.FadeIn = fadeIn; - using (drawable.BeginAbsoluteSequence(fadeInTime)) + using (drawable.BeginAbsoluteSequence(fadeInTime, true)) { switch (drawable) { case DrawableHitCircle circle: circle.ApproachCircle.FadeOut(); + // prolong the hitcircle long enough so misses are still possible circle.LifetimeEnd = circle.HitObject.StartTime + Math.Max(fadeOut, circle.HitObject.HitWindowFor(HitResult.Miss)); - - using (circle.BeginDelayedSequence(fadeIn)) - circle.FadeOut(fadeOut); + circle.FadeIn(fadeIn).Then().FadeOut(fadeOut); // override fade in as it somehow gets cut otherwise break; case DrawableSlider slider: slider.InitialCircle.ApplyCustomUpdateState += customSequence; - //using (slider.BeginDelayedSequence(fadeIn)) - // slider.Body.FadeOut(duration, Easing.Out); + using (slider.BeginAbsoluteSequence(fadeOutTime, true)) + { + var duration = slider.Slider.EndTime - fadeOutTime; // new duration from fade in to end of the slider + slider.Body.FadeOut(duration); + // delay a bit less to let the sliderball fade out peacefully instead of having a hard cut + using (slider.BeginDelayedSequence(duration - fadeOut, true)) + { + slider.Ball.FadeOut(fadeOut); + slider.Delay(fadeOut).Expire(); + } + } break; case DrawableSpinner spinner: spinner.Disc.FadeOut(); diff --git a/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs b/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs index 7c9cbd63fc..f37b87e533 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs @@ -35,16 +35,13 @@ namespace osu.Game.Rulesets.Osu.UI protected override DrawableHitObject GetVisualRepresentation(OsuHitObject h) { - var circle = h as HitCircle; - if (circle != null) + if (h is HitCircle circle) return new DrawableHitCircle(circle); - var slider = h as Slider; - if (slider != null) + if (h is Slider slider) return new DrawableSlider(slider); - var spinner = h as Spinner; - if (spinner != null) + if (h is Spinner spinner) return new DrawableSpinner(spinner); return null; } From e42fa7205b7f160376ebdffcd498abefb5e0a838 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Wed, 27 Dec 2017 21:23:56 +0100 Subject: [PATCH 110/169] adjust spinner sequence to the new fadeout speed --- osu.Game.Rulesets.Osu/Mods/OsuMod.cs | 23 ++++++++++++++++--- .../Objects/Drawables/DrawableSpinner.cs | 22 +++++++++--------- 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs index 8c8e8e7d3a..318ccab2f1 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs @@ -70,10 +70,10 @@ namespace osu.Game.Rulesets.Osu.Mods using (slider.BeginAbsoluteSequence(fadeOutTime, true)) { - var duration = slider.Slider.EndTime - fadeOutTime; // new duration from fade in to end of the slider - slider.Body.FadeOut(duration); + var sliderDuration = slider.Slider.EndTime - fadeOutTime; // new duration from fade in to end of the slider + slider.Body.FadeOut(sliderDuration); // delay a bit less to let the sliderball fade out peacefully instead of having a hard cut - using (slider.BeginDelayedSequence(duration - fadeOut, true)) + using (slider.BeginDelayedSequence(sliderDuration - fadeOut, true)) { slider.Ball.FadeOut(fadeOut); slider.Delay(fadeOut).Expire(); @@ -84,6 +84,23 @@ namespace osu.Game.Rulesets.Osu.Mods spinner.Disc.FadeOut(); spinner.Ticks.FadeOut(); spinner.Background.FadeOut(); + + using (spinner.BeginAbsoluteSequence(fadeOutTime, true)) + { + var spinnerDuration = spinner.Spinner.EndTime - fadeOutTime; // new duration from fade in to end of the spinner + var sequence = spinner.Delay(spinnerDuration).FadeOut(fadeOut); + // speed up the end sequence accordingly + switch (state) + { + case ArmedState.Hit: + sequence.ScaleTo(spinner.Scale * 1.2f, fadeOut * 2, Easing.Out); + break; + case ArmedState.Miss: + sequence.ScaleTo(spinner.Scale * 0.8f, fadeOut * 2, Easing.Out); + break; + } + sequence.Expire(); + } break; } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 9e80e3ccd1..57aa0f2c09 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { public class DrawableSpinner : DrawableOsuHitObject { - private readonly Spinner spinner; + public readonly Spinner Spinner; public readonly SpinnerDisc Disc; public readonly SpinnerTicks Ticks; @@ -49,7 +49,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables // we are slightly bigger than our parent, to clip the top and bottom of the circle Height = 1.3f; - spinner = s; + Spinner = s; Children = new Drawable[] { @@ -90,7 +90,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables Anchor = Anchor.Centre, Origin = Anchor.Centre, }, - Disc = new SpinnerDisc(spinner) + Disc = new SpinnerDisc(Spinner) { Scale = Vector2.Zero, Anchor = Anchor.Centre, @@ -114,7 +114,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables }; } - public float Progress => MathHelper.Clamp(Disc.RotationAbsolute / 360 / spinner.SpinsRequired, 0, 1); + public float Progress => MathHelper.Clamp(Disc.RotationAbsolute / 360 / Spinner.SpinsRequired, 0, 1); protected override void CheckForJudgements(bool userTriggered, double timeOffset) { @@ -135,7 +135,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables glow.FadeColour(completeColour, duration); } - if (!userTriggered && Time.Current >= spinner.EndTime) + if (!userTriggered && Time.Current >= Spinner.EndTime) { if (Progress >= 1) AddJudgement(new OsuJudgement { Result = HitResult.Great }); @@ -143,7 +143,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables AddJudgement(new OsuJudgement { Result = HitResult.Good }); else if (Progress > .75) AddJudgement(new OsuJudgement { Result = HitResult.Meh }); - else if (Time.Current >= spinner.EndTime) + else if (Time.Current >= Spinner.EndTime) AddJudgement(new OsuJudgement { Result = HitResult.Miss }); } } @@ -179,7 +179,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables Ticks.Rotation = Disc.Rotation; spmCounter.SetRotation(Disc.RotationAbsolute); - float relativeCircleScale = spinner.Scale * circle.DrawHeight / mainContainer.DrawHeight; + float relativeCircleScale = Spinner.Scale * circle.DrawHeight / mainContainer.DrawHeight; Disc.ScaleTo(relativeCircleScale + (1 - relativeCircleScale) * Progress, 200, Easing.OutQuint); symbol.RotateTo(Disc.Rotation / 2, 500, Easing.OutQuint); @@ -189,22 +189,22 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { base.UpdatePreemptState(); - circleContainer.ScaleTo(spinner.Scale * 0.3f); - circleContainer.ScaleTo(spinner.Scale, TIME_PREEMPT / 1.4f, Easing.OutQuint); + circleContainer.ScaleTo(Spinner.Scale * 0.3f); + circleContainer.ScaleTo(Spinner.Scale, TIME_PREEMPT / 1.4f, Easing.OutQuint); Disc.RotateTo(-720); symbol.RotateTo(-720); mainContainer .ScaleTo(0) - .ScaleTo(spinner.Scale * circle.DrawHeight / DrawHeight * 1.4f, TIME_PREEMPT - 150, Easing.OutQuint) + .ScaleTo(Spinner.Scale * circle.DrawHeight / DrawHeight * 1.4f, TIME_PREEMPT - 150, Easing.OutQuint) .Then() .ScaleTo(1, 500, Easing.OutQuint); } protected override void UpdateCurrentState(ArmedState state) { - var sequence = this.Delay(spinner.Duration).FadeOut(160); + var sequence = this.Delay(Spinner.Duration).FadeOut(160); switch (state) { From 4c3b4dc5bbf204d6f52423d482f0d4ffd5a4892a Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Wed, 27 Dec 2017 21:26:11 +0100 Subject: [PATCH 111/169] Updated submodule osu-framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 08f85f9bf9..10cae790c6 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 08f85f9bf9a7376aec8dfcde8c7c96d267d8c295 +Subproject commit 10cae790c6f1d559c326f9438958d0b012d61dc6 From 5b735a07c28c0264465c61f51b4406e2e83950ef Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Wed, 27 Dec 2017 21:48:41 +0100 Subject: [PATCH 112/169] Updated submodule osu-resources --- osu-resources | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-resources b/osu-resources index 4287ee8043..e01f71160f 160000 --- a/osu-resources +++ b/osu-resources @@ -1 +1 @@ -Subproject commit 4287ee8043fb1419017359bc3a5db5dc06bc643f +Subproject commit e01f71160fb9b3167efcd177c7d7dba9e5d36604 From 7250d2e6ca9ffce02846e4eec956e9fa0c1fd575 Mon Sep 17 00:00:00 2001 From: kiroma Date: Thu, 28 Dec 2017 00:49:15 +0100 Subject: [PATCH 113/169] Create a compilation guide --- COMPILING.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 COMPILING.md diff --git a/COMPILING.md b/COMPILING.md new file mode 100644 index 0000000000..8f717520ee --- /dev/null +++ b/COMPILING.md @@ -0,0 +1,40 @@ +# Linux +### 1. Requirements: +Mono >= 5.4.0 (>= 5.8.0 recommended) +Please check [here](http://www.mono-project.com/download/) for stable or [here](http://www.mono-project.com/download/alpha/) for an alpha release. +NuGet >= 4.4.0 +msbuild +git + +### 2. Cloning project +Clone the entire repository with submodules using +``` +git clone https://github.com/ppy/osu --recursive +``` +Then restore NuGet packages from the repository +``` +nuget restore +``` +We also need OpenTK >= 3.0.0-pre +``` +nuget install opentk -version=3.0.0-pre +``` +### 3. Compiling +Simply run `msbuild` where `osu.sln` is located, this will create all binaries in `osu/osu.Desktop/bin/Debug`. +### 4. Optimizing +If you want additional performance you can change build type to Release with +``` +msbuild -p:Configuration=Release +``` +Additionally, mono provides an AOT utility which attempts to precompile binaries. You can utilize that by running +``` +mono --aot ./osu\!.exe +``` +### 5. Troubleshooting +You may run into trouble with NuGet versioning, as the one in packaging system is almost always out of date. Simply run +``` +nuget +sudo nuget update -self +``` +**Warning** NuGet creates few config files when it's run for the first time. +Do not run NuGet as root on the first run or you might run into very peculiar issues. From 998f9c090d3cc5167b42611503930fa827d2cc9a Mon Sep 17 00:00:00 2001 From: FreezyLemon Date: Thu, 28 Dec 2017 01:56:10 +0100 Subject: [PATCH 114/169] select pause buttons after mouse move only --- osu.Game/Screens/Play/GameplayMenuOverlay.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/osu.Game/Screens/Play/GameplayMenuOverlay.cs b/osu.Game/Screens/Play/GameplayMenuOverlay.cs index 6969cd915b..094c0331f4 100644 --- a/osu.Game/Screens/Play/GameplayMenuOverlay.cs +++ b/osu.Game/Screens/Play/GameplayMenuOverlay.cs @@ -263,6 +263,14 @@ namespace osu.Game.Screens.Play private class Button : DialogButton { + protected override bool OnHover(InputState state) => true; + + protected override bool OnMouseMove(InputState state) + { + Selected.Value = true; + return base.OnMouseMove(state); + } + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { if (args.Repeat || args.Key != Key.Enter || !Selected) From 64d99a75600be3186dc00cfe25852020e2e03ddf Mon Sep 17 00:00:00 2001 From: FreezyLemon Date: Thu, 28 Dec 2017 02:29:58 +0100 Subject: [PATCH 115/169] Fix tests --- osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs b/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs index bd5772d3bb..87552c3f17 100644 --- a/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs @@ -73,7 +73,7 @@ namespace osu.Game.Tests.Visual { AddStep("Show overlay", () => failOverlay.Show()); - AddStep("Hover first button", () => failOverlay.Buttons.First().TriggerOnHover(null)); + AddStep("Hover first button", () => failOverlay.Buttons.First().TriggerOnMouseMove(null)); AddStep("Hide overlay", () => failOverlay.Hide()); AddAssert("Overlay state is reset", () => !failOverlay.Buttons.Any(b => b.Selected)); @@ -162,7 +162,7 @@ namespace osu.Game.Tests.Visual var secondButton = pauseOverlay.Buttons.Skip(1).First(); AddStep("Down arrow", () => pauseOverlay.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = Key.Down })); - AddStep("Hover second button", () => secondButton.TriggerOnHover(null)); + AddStep("Hover second button", () => secondButton.TriggerOnMouseMove(null)); AddAssert("First button not selected", () => !pauseOverlay.Buttons.First().Selected); AddAssert("Second button selected", () => secondButton.Selected); @@ -178,7 +178,7 @@ namespace osu.Game.Tests.Visual var secondButton = pauseOverlay.Buttons.Skip(1).First(); - AddStep("Hover second button", () => secondButton.TriggerOnHover(null)); + AddStep("Hover second button", () => secondButton.TriggerOnMouseMove(null)); AddStep("Up arrow", () => pauseOverlay.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = Key.Up })); AddAssert("Second button not selected", () => !secondButton.Selected); AddAssert("First button selected", () => pauseOverlay.Buttons.First().Selected); @@ -195,7 +195,7 @@ namespace osu.Game.Tests.Visual var secondButton = pauseOverlay.Buttons.Skip(1).First(); - AddStep("Hover second button", () => secondButton.TriggerOnHover(null)); + AddStep("Hover second button", () => secondButton.TriggerOnMouseMove(null)); AddStep("Unhover second button", () => secondButton.TriggerOnHoverLost(null)); AddStep("Down arrow", () => pauseOverlay.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = Key.Down })); AddAssert("First button selected", () => pauseOverlay.Buttons.First().Selected); // Initial state condition From 33480b85c85abbc92730e47c6389a725ed8ae4d5 Mon Sep 17 00:00:00 2001 From: FreezyLemon Date: Thu, 28 Dec 2017 03:35:53 +0100 Subject: [PATCH 116/169] fix for Drawables being empty crashing --- osu.Game/Screens/Select/BeatmapCarousel.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index e877633ab3..d0990d2d12 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -194,7 +194,11 @@ namespace osu.Game.Screens.Select if (!Items.Any()) return; - int originalIndex = Items.IndexOf(selectedBeatmap?.Drawables.First()); + var d = selectedBeatmap?.Drawables.FirstOrDefault(); + if (d == null) + return; + + int originalIndex = Items.IndexOf(d); int currentIndex = originalIndex; // local function to increment the index in the required direction, wrapping over extremities. From e4a8402d3ccf861ccda33665c56a6001a2a84253 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Dec 2017 12:38:40 +0900 Subject: [PATCH 117/169] Use better logic We need to still perform selection if selectedBeatmap itself is null --- osu.Game/Screens/Select/BeatmapCarousel.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index d0990d2d12..b343998e11 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -194,11 +194,14 @@ namespace osu.Game.Screens.Select if (!Items.Any()) return; - var d = selectedBeatmap?.Drawables.FirstOrDefault(); - if (d == null) + DrawableCarouselItem drawable = null; + + if (selectedBeatmap != null && (drawable = selectedBeatmap.Drawables.FirstOrDefault()) == null) + // if the selected beatmap isn't present yet, we can't correctly change selection. + // we can fix this by changing this method to not reference drawables / Items in the first place. return; - int originalIndex = Items.IndexOf(d); + int originalIndex = Items.IndexOf(drawable); int currentIndex = originalIndex; // local function to increment the index in the required direction, wrapping over extremities. From e0f23a056ab838af5dde01e9b247bc3306779eef Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Dec 2017 21:07:19 +0900 Subject: [PATCH 118/169] Fix crash from being able to perform selection after entering play mode Closes #1757 --- .../Select/Carousel/DrawableCarouselBeatmap.cs | 2 +- osu.Game/Screens/Select/EditSongSelect.cs | 6 +++++- osu.Game/Screens/Select/MatchSongSelect.cs | 6 +++++- osu.Game/Screens/Select/PlaySongSelect.cs | 11 ++++++++--- osu.Game/Screens/Select/SongSelect.cs | 18 ++++++++++++------ 5 files changed, 31 insertions(+), 12 deletions(-) diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index 6c0cc341fd..cea658b06c 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -46,7 +46,7 @@ namespace osu.Game.Screens.Select.Carousel { if (songSelect != null) { - startRequested = songSelect.Start; + startRequested = songSelect.FinaliseSelection; editRequested = songSelect.Edit; } diff --git a/osu.Game/Screens/Select/EditSongSelect.cs b/osu.Game/Screens/Select/EditSongSelect.cs index f02d25501e..37f2663d91 100644 --- a/osu.Game/Screens/Select/EditSongSelect.cs +++ b/osu.Game/Screens/Select/EditSongSelect.cs @@ -7,6 +7,10 @@ namespace osu.Game.Screens.Select { protected override bool ShowFooter => false; - protected override void Start() => Exit(); + protected override bool OnSelectionFinalised() + { + Exit(); + return true; + } } } diff --git a/osu.Game/Screens/Select/MatchSongSelect.cs b/osu.Game/Screens/Select/MatchSongSelect.cs index 898c195432..9143da326d 100644 --- a/osu.Game/Screens/Select/MatchSongSelect.cs +++ b/osu.Game/Screens/Select/MatchSongSelect.cs @@ -5,6 +5,10 @@ namespace osu.Game.Screens.Select { public class MatchSongSelect : SongSelect { - protected override void Start() => Exit(); + protected override bool OnSelectionFinalised() + { + Exit(); + return true; + } } } diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 727cdb9959..87b3485dc1 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -124,9 +124,9 @@ namespace osu.Game.Screens.Select return false; } - protected override void Start() + protected override bool OnSelectionFinalised() { - if (player != null) return; + if (player != null) return false; // Ctrl+Enter should start map with autoplay enabled. if (GetContainingInputManager().CurrentState?.Keyboard.ControlPressed == true) @@ -147,7 +147,12 @@ namespace osu.Game.Screens.Select sampleConfirm?.Play(); - LoadComponentAsync(player = new PlayerLoader(new Player()), l => Push(player)); + LoadComponentAsync(player = new PlayerLoader(new Player()), l => + { + if (IsCurrentScreen) Push(player); + }); + + return true; } } } diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 9e5a2fa633..b89a8a4e73 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -227,13 +227,18 @@ namespace osu.Game.Screens.Select Push(new Editor()); } - public void Start(BeatmapInfo beatmap) + /// + /// Call to make a selection and perform the default action for this SongSelect. + /// + /// An optional beatmap to override the current carousel selection. + public void FinaliseSelection(BeatmapInfo beatmap = null) { // if we have a pending filter operation, we want to run it now. // it could change selection (ie. if the ruleset has been changed). Carousel.FlushPendingFilterOperations(); - Carousel.SelectBeatmap(beatmap); + if (beatmap != null) + Carousel.SelectBeatmap(beatmap); if (selectionChangedDebounce?.Completed == false) { @@ -242,13 +247,14 @@ namespace osu.Game.Screens.Select selectionChangedDebounce = null; } - Start(); + OnSelectionFinalised(); } /// /// Called when a selection is made. /// - protected abstract void Start(); + /// If a resultant action occurred that takes the user away from SongSelect. + protected abstract bool OnSelectionFinalised(); private ScheduledDelegate selectionChangedDebounce; @@ -339,7 +345,7 @@ namespace osu.Game.Screens.Select logo.Action = () => { - Start(); + FinaliseSelection(); return false; }; } @@ -462,7 +468,7 @@ namespace osu.Game.Screens.Select { case Key.KeypadEnter: case Key.Enter: - Start(); + FinaliseSelection(); return true; case Key.Delete: if (state.Keyboard.ShiftPressed) From 0cea0185767d71d7a94538c9127d2fb49ef158d4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Dec 2017 21:23:59 +0900 Subject: [PATCH 119/169] Use a more suiting (?) icon for import dialog Closes #1763. --- osu.Game/Screens/Select/ImportFromStablePopup.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/ImportFromStablePopup.cs b/osu.Game/Screens/Select/ImportFromStablePopup.cs index 489ab79fa4..03e9462636 100644 --- a/osu.Game/Screens/Select/ImportFromStablePopup.cs +++ b/osu.Game/Screens/Select/ImportFromStablePopup.cs @@ -14,7 +14,7 @@ namespace osu.Game.Screens.Select HeaderText = @"You have no beatmaps!"; BodyText = "An existing copy of osu! was found, though.\nWould you like to import your beatmaps?"; - Icon = FontAwesome.fa_trash_o; + Icon = FontAwesome.fa_plane; Buttons = new PopupDialogButton[] { From 379d488160c7bb3ef150e24731086d0001af9906 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Dec 2017 21:54:34 +0900 Subject: [PATCH 120/169] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 10cae790c6..293b156697 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 10cae790c6f1d559c326f9438958d0b012d61dc6 +Subproject commit 293b1566971963202986d781f23df4ac1a6e8f20 From 2669974bff052a75d6502a6dcd92d3eed29a93d0 Mon Sep 17 00:00:00 2001 From: kiroma Date: Thu, 28 Dec 2017 15:25:54 +0100 Subject: [PATCH 121/169] Update COMPILING.md NuGet - 10/10 would use again --- COMPILING.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/COMPILING.md b/COMPILING.md index 8f717520ee..bfcbf6bc2c 100644 --- a/COMPILING.md +++ b/COMPILING.md @@ -15,10 +15,6 @@ Then restore NuGet packages from the repository ``` nuget restore ``` -We also need OpenTK >= 3.0.0-pre -``` -nuget install opentk -version=3.0.0-pre -``` ### 3. Compiling Simply run `msbuild` where `osu.sln` is located, this will create all binaries in `osu/osu.Desktop/bin/Debug`. ### 4. Optimizing From 0b23ceb7815d3e26b175de600ab7aa76b80cbcc5 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Thu, 28 Dec 2017 15:36:27 +0100 Subject: [PATCH 122/169] fix slider fade out to be eased + move duration calculation to not be done twice + made Slider / Spinner private again as they are not accessed externally anymore --- osu.Game.Rulesets.Osu/Mods/OsuMod.cs | 12 +++++----- .../Objects/Drawables/DrawableSlider.cs | 16 +++++++------- .../Objects/Drawables/DrawableSpinner.cs | 22 +++++++++---------- 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs index 318ccab2f1..e8d98aebf3 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs @@ -15,6 +15,7 @@ using OpenTK; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Framework.Graphics; +using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Rulesets.Osu.Mods { @@ -53,6 +54,9 @@ namespace osu.Game.Rulesets.Osu.Mods var fadeOutTime = fadeInTime + fadeIn; var fadeOut = d.HitObject.StartTime - preEmpt * fade_out_speed_multiplier - fadeOutTime; + // new duration from completed fade in to end (before fading out) + var newDuration = ((d.HitObject as IHasEndTime)?.EndTime ?? d.HitObject.StartTime) - fadeOutTime; + d.FadeIn = fadeIn; using (drawable.BeginAbsoluteSequence(fadeInTime, true)) @@ -70,10 +74,9 @@ namespace osu.Game.Rulesets.Osu.Mods using (slider.BeginAbsoluteSequence(fadeOutTime, true)) { - var sliderDuration = slider.Slider.EndTime - fadeOutTime; // new duration from fade in to end of the slider - slider.Body.FadeOut(sliderDuration); + slider.Body.FadeOut(newDuration, Easing.Out); // delay a bit less to let the sliderball fade out peacefully instead of having a hard cut - using (slider.BeginDelayedSequence(sliderDuration - fadeOut, true)) + using (slider.BeginDelayedSequence(newDuration - fadeOut, true)) { slider.Ball.FadeOut(fadeOut); slider.Delay(fadeOut).Expire(); @@ -87,8 +90,7 @@ namespace osu.Game.Rulesets.Osu.Mods using (spinner.BeginAbsoluteSequence(fadeOutTime, true)) { - var spinnerDuration = spinner.Spinner.EndTime - fadeOutTime; // new duration from fade in to end of the spinner - var sequence = spinner.Delay(spinnerDuration).FadeOut(fadeOut); + var sequence = spinner.Delay(newDuration).FadeOut(fadeOut); // speed up the end sequence accordingly switch (state) { diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 6beb430895..75fa3e0f01 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { public class DrawableSlider : DrawableOsuHitObject, IDrawableHitObjectWithProxiedApproach { - public readonly Slider Slider; + private readonly Slider slider; public readonly DrawableHitCircle InitialCircle; @@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables public DrawableSlider(Slider s) : base(s) { - Slider = s; + slider = s; Children = new Drawable[] { @@ -111,17 +111,17 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables Tracking = Ball.Tracking; - double progress = MathHelper.Clamp((Time.Current - Slider.StartTime) / Slider.Duration, 0, 1); + double progress = MathHelper.Clamp((Time.Current - slider.StartTime) / slider.Duration, 0, 1); - int repeat = Slider.RepeatAt(progress); - progress = Slider.ProgressAt(progress); + int repeat = slider.RepeatAt(progress); + progress = slider.ProgressAt(progress); if (repeat > currentRepeat) currentRepeat = repeat; //todo: we probably want to reconsider this before adding scoring, but it looks and feels nice. if (!InitialCircle.Judgements.Any(j => j.IsHit)) - InitialCircle.Position = Slider.Curve.PositionAt(progress); + InitialCircle.Position = slider.Curve.PositionAt(progress); foreach (var c in components) c.UpdateProgress(progress, repeat); foreach (var t in ticks.Children) t.Tracking = Ball.Tracking; @@ -129,7 +129,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables protected override void CheckForJudgements(bool userTriggered, double timeOffset) { - if (!userTriggered && Time.Current >= Slider.EndTime) + if (!userTriggered && Time.Current >= slider.EndTime) { var judgementsCount = ticks.Children.Count + repeatPoints.Children.Count + 1; var judgementsHit = ticks.Children.Count(t => t.Judgements.Any(j => j.IsHit)) + repeatPoints.Children.Count(t => t.Judgements.Any(j => j.IsHit)); @@ -152,7 +152,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { Ball.FadeIn(); - using (BeginDelayedSequence(Slider.Duration, true)) + using (BeginDelayedSequence(slider.Duration, true)) { Body.FadeOut(160); Ball.FadeOut(160); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 57aa0f2c09..9e80e3ccd1 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { public class DrawableSpinner : DrawableOsuHitObject { - public readonly Spinner Spinner; + private readonly Spinner spinner; public readonly SpinnerDisc Disc; public readonly SpinnerTicks Ticks; @@ -49,7 +49,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables // we are slightly bigger than our parent, to clip the top and bottom of the circle Height = 1.3f; - Spinner = s; + spinner = s; Children = new Drawable[] { @@ -90,7 +90,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables Anchor = Anchor.Centre, Origin = Anchor.Centre, }, - Disc = new SpinnerDisc(Spinner) + Disc = new SpinnerDisc(spinner) { Scale = Vector2.Zero, Anchor = Anchor.Centre, @@ -114,7 +114,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables }; } - public float Progress => MathHelper.Clamp(Disc.RotationAbsolute / 360 / Spinner.SpinsRequired, 0, 1); + public float Progress => MathHelper.Clamp(Disc.RotationAbsolute / 360 / spinner.SpinsRequired, 0, 1); protected override void CheckForJudgements(bool userTriggered, double timeOffset) { @@ -135,7 +135,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables glow.FadeColour(completeColour, duration); } - if (!userTriggered && Time.Current >= Spinner.EndTime) + if (!userTriggered && Time.Current >= spinner.EndTime) { if (Progress >= 1) AddJudgement(new OsuJudgement { Result = HitResult.Great }); @@ -143,7 +143,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables AddJudgement(new OsuJudgement { Result = HitResult.Good }); else if (Progress > .75) AddJudgement(new OsuJudgement { Result = HitResult.Meh }); - else if (Time.Current >= Spinner.EndTime) + else if (Time.Current >= spinner.EndTime) AddJudgement(new OsuJudgement { Result = HitResult.Miss }); } } @@ -179,7 +179,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables Ticks.Rotation = Disc.Rotation; spmCounter.SetRotation(Disc.RotationAbsolute); - float relativeCircleScale = Spinner.Scale * circle.DrawHeight / mainContainer.DrawHeight; + float relativeCircleScale = spinner.Scale * circle.DrawHeight / mainContainer.DrawHeight; Disc.ScaleTo(relativeCircleScale + (1 - relativeCircleScale) * Progress, 200, Easing.OutQuint); symbol.RotateTo(Disc.Rotation / 2, 500, Easing.OutQuint); @@ -189,22 +189,22 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { base.UpdatePreemptState(); - circleContainer.ScaleTo(Spinner.Scale * 0.3f); - circleContainer.ScaleTo(Spinner.Scale, TIME_PREEMPT / 1.4f, Easing.OutQuint); + circleContainer.ScaleTo(spinner.Scale * 0.3f); + circleContainer.ScaleTo(spinner.Scale, TIME_PREEMPT / 1.4f, Easing.OutQuint); Disc.RotateTo(-720); symbol.RotateTo(-720); mainContainer .ScaleTo(0) - .ScaleTo(Spinner.Scale * circle.DrawHeight / DrawHeight * 1.4f, TIME_PREEMPT - 150, Easing.OutQuint) + .ScaleTo(spinner.Scale * circle.DrawHeight / DrawHeight * 1.4f, TIME_PREEMPT - 150, Easing.OutQuint) .Then() .ScaleTo(1, 500, Easing.OutQuint); } protected override void UpdateCurrentState(ArmedState state) { - var sequence = this.Delay(Spinner.Duration).FadeOut(160); + var sequence = this.Delay(spinner.Duration).FadeOut(160); switch (state) { From cd237da6d39fb2f846e2b575e8bde7230ca02612 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Thu, 28 Dec 2017 17:06:15 +0100 Subject: [PATCH 123/169] extend TestCaseHitCircle with new steps - Hidden, Size and Scale - also fix Auto still missing because no judgement was created --- osu.Game.Rulesets.Osu/Mods/OsuMod.cs | 6 +-- .../Tests/TestCaseHitCircle.cs | 48 +++++++++++++++++-- 2 files changed, 48 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs index e8d98aebf3..77ce7235ee 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs @@ -41,10 +41,10 @@ namespace osu.Game.Rulesets.Osu.Mods public void ApplyToDrawableHitObjects(IEnumerable drawables) { foreach (var d in drawables.OfType()) - d.ApplyCustomUpdateState += customSequence; + d.ApplyCustomUpdateState += CustomSequence; } - private void customSequence(DrawableHitObject drawable, ArmedState state) + protected void CustomSequence(DrawableHitObject drawable, ArmedState state) { if (!(drawable is DrawableOsuHitObject d)) return; @@ -70,7 +70,7 @@ namespace osu.Game.Rulesets.Osu.Mods circle.FadeIn(fadeIn).Then().FadeOut(fadeOut); // override fade in as it somehow gets cut otherwise break; case DrawableSlider slider: - slider.InitialCircle.ApplyCustomUpdateState += customSequence; + slider.InitialCircle.ApplyCustomUpdateState += CustomSequence; using (slider.BeginAbsoluteSequence(fadeOutTime, true)) { diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs index ef0bffa14e..3e5201efc7 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs @@ -11,6 +11,9 @@ using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Tests.Visual; using OpenTK; +using osu.Game.Rulesets.Osu.Mods; +using OpenTK.Graphics; +using osu.Game.Rulesets.Osu.Judgements; namespace osu.Game.Rulesets.Osu.Tests { @@ -21,7 +24,10 @@ namespace osu.Game.Rulesets.Osu.Tests protected override Container Content => content; private bool auto; + private bool hidden; private int depthIndex; + private int circleSize; + private float circleScale; public TestCaseHitCircle() { @@ -30,6 +36,9 @@ namespace osu.Game.Rulesets.Osu.Tests AddStep("Single", () => addSingle()); AddStep("Stream", addStream); AddToggleStep("Auto", v => auto = v); + AddToggleStep("Hidden", v => hidden = v); + AddSliderStep("CircleSize", 0, 10, 0, s => circleSize = s); + AddSliderStep("CircleScale", 0.5f, 2, 1, s => circleScale = s); } private void addSingle(double timeOffset = 0, Vector2? positionOffset = null) @@ -39,20 +48,25 @@ namespace osu.Game.Rulesets.Osu.Tests var circle = new HitCircle { StartTime = Time.Current + 1000 + timeOffset, - Position = positionOffset.Value + Position = positionOffset.Value, + ComboColour = Color4.LightSeaGreen }; - circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = 0 }); + circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = circleSize }); - var drawable = new DrawableHitCircle(circle) + var drawable = new TestDrawableHitCircle(circle, auto) { Anchor = Anchor.Centre, + Scale = new Vector2(circleScale), Depth = depthIndex++ }; if (auto) drawable.State.Value = ArmedState.Hit; + if (hidden) + drawable.ApplyCustomUpdateState += new TestOsuModHidden().CustomSequence; + Add(drawable); } @@ -66,5 +80,33 @@ namespace osu.Game.Rulesets.Osu.Tests pos += new Vector2(10); } } + + private class TestOsuModHidden : OsuModHidden + { + public new void CustomSequence(DrawableHitObject drawable, ArmedState state) => base.CustomSequence(drawable, state); + } + + private class TestDrawableHitCircle : DrawableHitCircle + { + private readonly bool auto; + + public TestDrawableHitCircle(OsuHitObject h, bool auto) : base(h) + { + this.auto = auto; + } + + protected override void CheckForJudgements(bool userTriggered, double timeOffset) + { + if (auto && !userTriggered && timeOffset > 0) + { + // pretend we really hit it + AddJudgement(new OsuJudgement + { + Result = HitObject.ScoreResultForOffset(timeOffset) + }); + } + base.CheckForJudgements(userTriggered, timeOffset); + } + } } } From 8d5f4d4f19f6d71d97892d717baa5abb38b67d6a Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Thu, 28 Dec 2017 18:09:35 +0100 Subject: [PATCH 124/169] extend TestCaseSlider with new steps - Hidden, Size and Scale - made Repeats an SliderStep instead --- .../Tests/TestCaseHitCircle.cs | 10 +-- osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs | 86 +++++++++++-------- 2 files changed, 53 insertions(+), 43 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs index 3e5201efc7..babe39c41d 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs @@ -33,15 +33,15 @@ namespace osu.Game.Rulesets.Osu.Tests { base.Content.Add(content = new OsuInputManager(new RulesetInfo { ID = 0 })); - AddStep("Single", () => addSingle()); - AddStep("Stream", addStream); + AddStep("Single", () => testSingle()); + AddStep("Stream", testStream); AddToggleStep("Auto", v => auto = v); AddToggleStep("Hidden", v => hidden = v); AddSliderStep("CircleSize", 0, 10, 0, s => circleSize = s); AddSliderStep("CircleScale", 0.5f, 2, 1, s => circleScale = s); } - private void addSingle(double timeOffset = 0, Vector2? positionOffset = null) + private void testSingle(double timeOffset = 0, Vector2? positionOffset = null) { positionOffset = positionOffset ?? Vector2.Zero; @@ -70,13 +70,13 @@ namespace osu.Game.Rulesets.Osu.Tests Add(drawable); } - private void addStream() + private void testStream() { Vector2 pos = Vector2.Zero; for (int i = 0; i <= 1000; i += 100) { - addSingle(i, pos); + testSingle(i, pos); pos += new Vector2(10); } } diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs index 7ce9c35bd5..224e2ea3ef 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs @@ -13,6 +13,8 @@ using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Tests.Visual; using OpenTK; +using osu.Game.Rulesets.Osu.Mods; +using osu.Game.Rulesets.Objects.Drawables; namespace osu.Game.Rulesets.Osu.Tests { @@ -24,26 +26,30 @@ namespace osu.Game.Rulesets.Osu.Tests private readonly Container content; protected override Container Content => content; + private bool hidden; + private int repeats; + private int depthIndex; + private int circleSize; + private float circleScale; private double speedMultiplier = 2; private double sliderMultiplier = 2; - private int depthIndex; public TestCaseSlider() { base.Content.Add(content = new OsuInputManager(new RulesetInfo { ID = 0 })); - AddStep("Single", () => addSingle()); - AddStep("Repeated (1)", () => addRepeated(1)); - AddStep("Repeated (2)", () => addRepeated(2)); - AddStep("Repeated (3)", () => addRepeated(3)); - AddStep("Repeated (4)", () => addRepeated(4)); - AddStep("Stream", addStream); - - AddSliderStep("SpeedMultiplier", 0.01, 10, 2, s => speedMultiplier = s); - AddSliderStep("SliderMultiplier", 0.01, 10, 2, s => sliderMultiplier = s); + AddStep("Single", () => testSingle()); + AddStep("Stream", testStream); + AddStep("Repeated", () => testRepeated(repeats)); + AddToggleStep("Hidden", v => hidden = v); + AddSliderStep("Repeats", 1, 10, 1, s => repeats = s); + AddSliderStep("CircleSize", 0, 10, 0, s => circleSize = s); + AddSliderStep("CircleScale", 0.5f, 2, 1, s => circleScale = s); + AddSliderStep("SpeedMultiplier", 0.1, 10, 2, s => speedMultiplier = s); + AddSliderStep("SliderMultiplier", 0.1, 10, 2, s => sliderMultiplier = s); } - private void addSingle(double timeOffset = 0, Vector2? positionOffset = null) + private void testSingle(double timeOffset = 0, Vector2? positionOffset = null) { positionOffset = positionOffset ?? Vector2.Zero; @@ -59,24 +65,10 @@ namespace osu.Game.Rulesets.Osu.Tests Distance = 400, }; - var cpi = new ControlPointInfo(); - cpi.DifficultyPoints.Add(new DifficultyControlPoint { SpeedMultiplier = speedMultiplier }); - - var difficulty = new BeatmapDifficulty - { - SliderMultiplier = (float)sliderMultiplier, - CircleSize = 0 - }; - - slider.ApplyDefaults(cpi, difficulty); - Add(new DrawableSlider(slider) - { - Anchor = Anchor.Centre, - Depth = depthIndex++ - }); + addSlider(slider); } - private void addRepeated(int repeats) + private void testRepeated(int repeats) { // The first run through the slider is considered a repeat repeats++; @@ -99,32 +91,50 @@ namespace osu.Game.Rulesets.Osu.Tests RepeatSamples = repeatSamples }; + addSlider(slider); + } + + private void testStream() + { + Vector2 pos = Vector2.Zero; + + for (int i = 0; i <= 1000; i += 100) + { + testSingle(i, pos); + pos += new Vector2(10); + } + } + + private void addSlider(Slider slider) + { var cpi = new ControlPointInfo(); cpi.DifficultyPoints.Add(new DifficultyControlPoint { SpeedMultiplier = speedMultiplier }); var difficulty = new BeatmapDifficulty { SliderMultiplier = (float)sliderMultiplier, - CircleSize = 0 + CircleSize = circleSize }; slider.ApplyDefaults(cpi, difficulty); - Add(new DrawableSlider(slider) + + var drawable = new DrawableSlider(slider) { Anchor = Anchor.Centre, + Scale = new Vector2(circleScale), Depth = depthIndex++ - }); + }; + + if (hidden) + drawable.ApplyCustomUpdateState += new TestOsuModHidden().CustomSequence; + + Add(drawable); } - private void addStream() + private class TestOsuModHidden : OsuModHidden { - Vector2 pos = Vector2.Zero; - - for (int i = 0; i <= 1000; i += 100) - { - addSingle(i, pos); - pos += new Vector2(10); - } + public new void CustomSequence(DrawableHitObject drawable, ArmedState state) => base.CustomSequence(drawable, state); } } + } From ca650e8d48fde20add55bccbae7b666fd30cfb50 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Thu, 28 Dec 2017 18:21:08 +0100 Subject: [PATCH 125/169] extend TestCaseSpinner with new steps - Hidden, Size and Scale --- .../Tests/TestCaseHitCircle.cs | 2 +- osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs | 2 +- .../Tests/TestCaseSpinner.cs | 24 ++++++++++++++++--- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs index babe39c41d..ddb6000fbb 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs @@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Osu.Tests private bool hidden; private int depthIndex; private int circleSize; - private float circleScale; + private float circleScale = 1; public TestCaseHitCircle() { diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs index 224e2ea3ef..8b2eb8baef 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs @@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Osu.Tests private int repeats; private int depthIndex; private int circleSize; - private float circleScale; + private float circleScale = 1; private double speedMultiplier = 2; private double sliderMultiplier = 2; diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs index 76cc70effd..4f97ba9697 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs @@ -2,10 +2,13 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using NUnit.Framework; +using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Osu.Mods; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Tests.Visual; @@ -18,28 +21,43 @@ namespace osu.Game.Rulesets.Osu.Tests private readonly Container content; protected override Container Content => content; + private bool hidden; private int depthIndex; + private int circleSize; + private float circleScale = 1; public TestCaseSpinner() { base.Content.Add(content = new OsuInputManager(new RulesetInfo { ID = 0 })); - AddStep("Single", addSingle); + AddStep("Single", testSingle); + AddToggleStep("Hidden", v => hidden = v); + AddSliderStep("CircleSize", 0, 10, 0, s => circleSize = s); + AddSliderStep("CircleScale", 0.5f, 2, 1, s => circleScale = s); } - private void addSingle() + private void testSingle() { var spinner = new Spinner { StartTime = Time.Current + 1000, EndTime = Time.Current + 4000 }; - spinner.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = 0 }); + spinner.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = circleSize }); var drawable = new DrawableSpinner(spinner) { Anchor = Anchor.Centre, + Scale = new Vector2(circleScale), Depth = depthIndex++ }; + if (hidden) + drawable.ApplyCustomUpdateState += new TestOsuModHidden().CustomSequence; + Add(drawable); } + + private class TestOsuModHidden : OsuModHidden + { + public new void CustomSequence(DrawableHitObject drawable, ArmedState state) => base.CustomSequence(drawable, state); + } } } From 2ca10b28c6a10ae29d62cf5210133042e41bfa59 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 29 Dec 2017 15:42:51 +0900 Subject: [PATCH 126/169] Use a non-broken opentk library --- NuGet.config | 6 ------ osu.Desktop/osu.Desktop.csproj | 2 +- osu.Desktop/packages.config | 2 +- osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj | 2 +- osu.Game.Rulesets.Catch/packages.config | 2 +- osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj | 2 +- osu.Game.Rulesets.Mania/packages.config | 2 +- osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj | 2 +- osu.Game.Rulesets.Osu/packages.config | 2 +- osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj | 2 +- osu.Game.Rulesets.Taiko/packages.config | 2 +- osu.Game.Tests/osu.Game.Tests.csproj | 2 +- osu.Game.Tests/packages.config | 2 +- osu.Game/osu.Game.csproj | 2 +- osu.Game/packages.config | 2 +- 15 files changed, 14 insertions(+), 20 deletions(-) delete mode 100644 NuGet.config diff --git a/NuGet.config b/NuGet.config deleted file mode 100644 index 95f993e510..0000000000 --- a/NuGet.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index 4a1798feb4..3cc4e7f943 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -136,7 +136,7 @@ True - $(SolutionDir)\packages\OpenTK.3.0.0-git00021\lib\net20\OpenTK.dll + $(SolutionDir)\packages\ppy.OpenTK.3.0.11\lib\net45\OpenTK.dll True diff --git a/osu.Desktop/packages.config b/osu.Desktop/packages.config index e7233a42ac..4757b50c4c 100644 --- a/osu.Desktop/packages.config +++ b/osu.Desktop/packages.config @@ -6,7 +6,7 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste - + diff --git a/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj b/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj index 578d8eb34d..16c909e063 100644 --- a/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj +++ b/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj @@ -37,7 +37,7 @@ True - $(SolutionDir)\packages\OpenTK.3.0.0-git00021\lib\net20\OpenTK.dll + $(SolutionDir)\packages\ppy.OpenTK.3.0.11\lib\net45\OpenTK.dll True diff --git a/osu.Game.Rulesets.Catch/packages.config b/osu.Game.Rulesets.Catch/packages.config index 2369f7529b..b39a85a382 100644 --- a/osu.Game.Rulesets.Catch/packages.config +++ b/osu.Game.Rulesets.Catch/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj index bdd6656ed9..3393774a9c 100644 --- a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj +++ b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj @@ -37,7 +37,7 @@ True - $(SolutionDir)\packages\OpenTK.3.0.0-git00021\lib\net20\OpenTK.dll + $(SolutionDir)\packages\ppy.OpenTK.3.0.11\lib\net45\OpenTK.dll True diff --git a/osu.Game.Rulesets.Mania/packages.config b/osu.Game.Rulesets.Mania/packages.config index 2369f7529b..b39a85a382 100644 --- a/osu.Game.Rulesets.Mania/packages.config +++ b/osu.Game.Rulesets.Mania/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj index 245f3eed91..785c3e17fb 100644 --- a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj +++ b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj @@ -38,7 +38,7 @@ True - $(SolutionDir)\packages\OpenTK.3.0.0-git00021\lib\net20\OpenTK.dll + $(SolutionDir)\packages\ppy.OpenTK.3.0.11\lib\net45\OpenTK.dll True diff --git a/osu.Game.Rulesets.Osu/packages.config b/osu.Game.Rulesets.Osu/packages.config index 2369f7529b..b39a85a382 100644 --- a/osu.Game.Rulesets.Osu/packages.config +++ b/osu.Game.Rulesets.Osu/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj index 7e44e85e52..1aed86f8f9 100644 --- a/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj +++ b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj @@ -37,7 +37,7 @@ True - $(SolutionDir)\packages\OpenTK.3.0.0-git00021\lib\net20\OpenTK.dll + $(SolutionDir)\packages\ppy.OpenTK.3.0.11\lib\net45\OpenTK.dll True diff --git a/osu.Game.Rulesets.Taiko/packages.config b/osu.Game.Rulesets.Taiko/packages.config index 2369f7529b..b39a85a382 100644 --- a/osu.Game.Rulesets.Taiko/packages.config +++ b/osu.Game.Rulesets.Taiko/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index df66896d9b..8c04874e75 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -38,7 +38,7 @@ True - $(SolutionDir)\packages\OpenTK.3.0.0-git00021\lib\net20\OpenTK.dll + $(SolutionDir)\packages\ppy.OpenTK.3.0.11\lib\net45\OpenTK.dll True diff --git a/osu.Game.Tests/packages.config b/osu.Game.Tests/packages.config index c2056e09a8..9fbb0537bc 100644 --- a/osu.Game.Tests/packages.config +++ b/osu.Game.Tests/packages.config @@ -6,6 +6,6 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste - + \ No newline at end of file diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 7d146c0a12..22191c98ab 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -144,7 +144,7 @@ True - $(SolutionDir)\packages\OpenTK.3.0.0-git00021\lib\net20\OpenTK.dll + $(SolutionDir)\packages\ppy.OpenTK.3.0.11\lib\net45\OpenTK.dll True diff --git a/osu.Game/packages.config b/osu.Game/packages.config index 3ba50388e8..e35f06dd67 100644 --- a/osu.Game/packages.config +++ b/osu.Game/packages.config @@ -66,7 +66,7 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste - + From 16c1bc9880539664b2e90f967a8a19c91b8969ec Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 29 Dec 2017 15:43:38 +0900 Subject: [PATCH 127/169] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 10cae790c6..2438afea86 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 10cae790c6f1d559c326f9438958d0b012d61dc6 +Subproject commit 2438afea86d0ce1f91b1b2f01bca1cf8afdd4659 From b74248a705665adf9f68037c5f8dfbb9b26e7f7a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 29 Dec 2017 16:22:06 +0900 Subject: [PATCH 128/169] Rename application method --- osu.Game.Rulesets.Osu/Mods/OsuMod.cs | 6 +++--- osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs | 4 ++-- osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs | 2 +- osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs index 77ce7235ee..09360bea68 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs @@ -41,10 +41,10 @@ namespace osu.Game.Rulesets.Osu.Mods public void ApplyToDrawableHitObjects(IEnumerable drawables) { foreach (var d in drawables.OfType()) - d.ApplyCustomUpdateState += CustomSequence; + d.ApplyCustomUpdateState += ApplyHiddenState; } - protected void CustomSequence(DrawableHitObject drawable, ArmedState state) + protected void ApplyHiddenState(DrawableHitObject drawable, ArmedState state) { if (!(drawable is DrawableOsuHitObject d)) return; @@ -70,7 +70,7 @@ namespace osu.Game.Rulesets.Osu.Mods circle.FadeIn(fadeIn).Then().FadeOut(fadeOut); // override fade in as it somehow gets cut otherwise break; case DrawableSlider slider: - slider.InitialCircle.ApplyCustomUpdateState += CustomSequence; + slider.InitialCircle.ApplyCustomUpdateState += ApplyHiddenState; using (slider.BeginAbsoluteSequence(fadeOutTime, true)) { diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs index ddb6000fbb..045d95e942 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs @@ -65,7 +65,7 @@ namespace osu.Game.Rulesets.Osu.Tests drawable.State.Value = ArmedState.Hit; if (hidden) - drawable.ApplyCustomUpdateState += new TestOsuModHidden().CustomSequence; + drawable.ApplyCustomUpdateState += new TestOsuModHidden().ApplyHiddenState; Add(drawable); } @@ -83,7 +83,7 @@ namespace osu.Game.Rulesets.Osu.Tests private class TestOsuModHidden : OsuModHidden { - public new void CustomSequence(DrawableHitObject drawable, ArmedState state) => base.CustomSequence(drawable, state); + public new void ApplyHiddenState(DrawableHitObject drawable, ArmedState state) => base.ApplyHiddenState(drawable, state); } private class TestDrawableHitCircle : DrawableHitCircle diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs index 8b2eb8baef..87ed67fe82 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs @@ -133,7 +133,7 @@ namespace osu.Game.Rulesets.Osu.Tests private class TestOsuModHidden : OsuModHidden { - public new void CustomSequence(DrawableHitObject drawable, ArmedState state) => base.CustomSequence(drawable, state); + public new void CustomSequence(DrawableHitObject drawable, ArmedState state) => base.ApplyHiddenState(drawable, state); } } diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs index 4f97ba9697..96f9b6b97f 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs @@ -57,7 +57,7 @@ namespace osu.Game.Rulesets.Osu.Tests private class TestOsuModHidden : OsuModHidden { - public new void CustomSequence(DrawableHitObject drawable, ArmedState state) => base.CustomSequence(drawable, state); + public new void CustomSequence(DrawableHitObject drawable, ArmedState state) => base.ApplyHiddenState(drawable, state); } } } From 2c61ebbcd9b04367c7dbb9d000e2ecd4f37cb0cb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 29 Dec 2017 17:10:33 +0900 Subject: [PATCH 129/169] Remove unnecessary local derived classes --- osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs | 7 +------ osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs | 8 +------- osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs | 8 +------- 3 files changed, 3 insertions(+), 20 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs index 045d95e942..c0a67e5dc1 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs @@ -65,7 +65,7 @@ namespace osu.Game.Rulesets.Osu.Tests drawable.State.Value = ArmedState.Hit; if (hidden) - drawable.ApplyCustomUpdateState += new TestOsuModHidden().ApplyHiddenState; + new OsuModHidden().ApplyToDrawableHitObjects(new [] { drawable }); Add(drawable); } @@ -81,11 +81,6 @@ namespace osu.Game.Rulesets.Osu.Tests } } - private class TestOsuModHidden : OsuModHidden - { - public new void ApplyHiddenState(DrawableHitObject drawable, ArmedState state) => base.ApplyHiddenState(drawable, state); - } - private class TestDrawableHitCircle : DrawableHitCircle { private readonly bool auto; diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs index 87ed67fe82..9acf286915 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs @@ -14,7 +14,6 @@ using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Tests.Visual; using OpenTK; using osu.Game.Rulesets.Osu.Mods; -using osu.Game.Rulesets.Objects.Drawables; namespace osu.Game.Rulesets.Osu.Tests { @@ -126,15 +125,10 @@ namespace osu.Game.Rulesets.Osu.Tests }; if (hidden) - drawable.ApplyCustomUpdateState += new TestOsuModHidden().CustomSequence; + new OsuModHidden().ApplyToDrawableHitObjects(new [] { drawable }); Add(drawable); } - - private class TestOsuModHidden : OsuModHidden - { - public new void CustomSequence(DrawableHitObject drawable, ArmedState state) => base.ApplyHiddenState(drawable, state); - } } } diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs index 96f9b6b97f..895984c1ce 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs @@ -7,7 +7,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; -using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Mods; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; @@ -50,14 +49,9 @@ namespace osu.Game.Rulesets.Osu.Tests }; if (hidden) - drawable.ApplyCustomUpdateState += new TestOsuModHidden().CustomSequence; + new OsuModHidden().ApplyToDrawableHitObjects(new [] { drawable }); Add(drawable); } - - private class TestOsuModHidden : OsuModHidden - { - public new void CustomSequence(DrawableHitObject drawable, ArmedState state) => base.ApplyHiddenState(drawable, state); - } } } From 27cb445c24927285219752d8e7e5b0ead86b783d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 29 Dec 2017 17:48:05 +0900 Subject: [PATCH 130/169] Always recrusively apply custom sequence to nested hitobjects --- osu.Game.Rulesets.Osu/Mods/OsuMod.cs | 2 -- osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs index 09360bea68..36429bbca5 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs @@ -70,8 +70,6 @@ namespace osu.Game.Rulesets.Osu.Mods circle.FadeIn(fadeIn).Then().FadeOut(fadeOut); // override fade in as it somehow gets cut otherwise break; case DrawableSlider slider: - slider.InitialCircle.ApplyCustomUpdateState += ApplyHiddenState; - using (slider.BeginAbsoluteSequence(fadeOutTime, true)) { slider.Body.FadeOut(newDuration, Easing.Out); diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index af525903c5..af038909d2 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -246,6 +246,7 @@ namespace osu.Game.Rulesets.Objects.Drawables h.OnJudgement += (d, j) => OnJudgement?.Invoke(d, j); h.OnJudgementRemoved += (d, j) => OnJudgementRemoved?.Invoke(d, j); + h.ApplyCustomUpdateState += (d, s) => ApplyCustomUpdateState?.Invoke(d, s); nestedHitObjects.Add(h); } From c9d4da65d2c382cbf7df4003e2c0c133642ccd88 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 29 Dec 2017 18:06:41 +0900 Subject: [PATCH 131/169] Simplify and rename time variables --- osu.Game.Rulesets.Osu/Mods/OsuMod.cs | 38 +++++++++++++++------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs index 36429bbca5..0ed72db18c 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs @@ -49,35 +49,37 @@ namespace osu.Game.Rulesets.Osu.Mods if (!(drawable is DrawableOsuHitObject d)) return; - var fadeInTime = d.HitObject.StartTime - preEmpt; - var fadeIn = d.HitObject.StartTime - preEmpt * fade_in_speed_multiplier - fadeInTime; - var fadeOutTime = fadeInTime + fadeIn; - var fadeOut = d.HitObject.StartTime - preEmpt * fade_out_speed_multiplier - fadeOutTime; + var fadeInStartTime = d.HitObject.StartTime - preEmpt; + var fadeInDuration = preEmpt * fade_in_speed_multiplier; + + var fadeOutStartTime = fadeInStartTime + fadeInDuration; + var fadeOutDuration = preEmpt * fade_out_speed_multiplier; // new duration from completed fade in to end (before fading out) - var newDuration = ((d.HitObject as IHasEndTime)?.EndTime ?? d.HitObject.StartTime) - fadeOutTime; + var newDuration = ((d.HitObject as IHasEndTime)?.EndTime ?? d.HitObject.StartTime) - fadeOutStartTime; - d.FadeIn = fadeIn; + d.FadeIn = fadeInDuration; - using (drawable.BeginAbsoluteSequence(fadeInTime, true)) + using (drawable.BeginAbsoluteSequence(fadeInStartTime, true)) { switch (drawable) { case DrawableHitCircle circle: - circle.ApproachCircle.FadeOut(); + // we don't want to see the approach circle + circle.ApproachCircle.Hide(); // prolong the hitcircle long enough so misses are still possible - circle.LifetimeEnd = circle.HitObject.StartTime + Math.Max(fadeOut, circle.HitObject.HitWindowFor(HitResult.Miss)); - circle.FadeIn(fadeIn).Then().FadeOut(fadeOut); // override fade in as it somehow gets cut otherwise + circle.LifetimeEnd = circle.HitObject.StartTime + Math.Max(fadeOutDuration, circle.HitObject.HitWindowFor(HitResult.Miss)); + circle.FadeIn(fadeInDuration).Then().FadeOut(fadeOutDuration); // override fade in as it somehow gets cut otherwise break; case DrawableSlider slider: - using (slider.BeginAbsoluteSequence(fadeOutTime, true)) + using (slider.BeginAbsoluteSequence(fadeOutStartTime, true)) { slider.Body.FadeOut(newDuration, Easing.Out); // delay a bit less to let the sliderball fade out peacefully instead of having a hard cut - using (slider.BeginDelayedSequence(newDuration - fadeOut, true)) + using (slider.BeginDelayedSequence(newDuration - fadeOutDuration, true)) { - slider.Ball.FadeOut(fadeOut); - slider.Delay(fadeOut).Expire(); + slider.Ball.FadeOut(fadeOutDuration); + slider.Delay(fadeOutDuration).Expire(); } } break; @@ -86,17 +88,17 @@ namespace osu.Game.Rulesets.Osu.Mods spinner.Ticks.FadeOut(); spinner.Background.FadeOut(); - using (spinner.BeginAbsoluteSequence(fadeOutTime, true)) + using (spinner.BeginAbsoluteSequence(fadeOutStartTime, true)) { - var sequence = spinner.Delay(newDuration).FadeOut(fadeOut); + var sequence = spinner.Delay(newDuration).FadeOut(fadeOutDuration); // speed up the end sequence accordingly switch (state) { case ArmedState.Hit: - sequence.ScaleTo(spinner.Scale * 1.2f, fadeOut * 2, Easing.Out); + sequence.ScaleTo(spinner.Scale * 1.2f, fadeOutDuration * 2, Easing.Out); break; case ArmedState.Miss: - sequence.ScaleTo(spinner.Scale * 0.8f, fadeOut * 2, Easing.Out); + sequence.ScaleTo(spinner.Scale * 0.8f, fadeOutDuration * 2, Easing.Out); break; } sequence.Expire(); From ced2d9749d61a9bbe2830aab8609ab59dfd0a9d9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 29 Dec 2017 18:25:33 +0900 Subject: [PATCH 132/169] Adjust presets and rename more --- osu.Game.Rulesets.Osu/Mods/OsuMod.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs index 0ed72db18c..f24a360575 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs @@ -33,8 +33,8 @@ namespace osu.Game.Rulesets.Osu.Mods public override string Description => @"Play with no approach circles and fading notes for a slight score advantage."; public override double ScoreMultiplier => 1.06; - private const double fade_in_speed_multiplier = 0.6; - private const double fade_out_speed_multiplier = 0.3; + private const double fade_in_duration_multiplier = 0.4; + private const double fade_out_duration_multiplier = 0.3; private float preEmpt => DrawableOsuHitObject.TIME_PREEMPT; @@ -50,10 +50,10 @@ namespace osu.Game.Rulesets.Osu.Mods return; var fadeInStartTime = d.HitObject.StartTime - preEmpt; - var fadeInDuration = preEmpt * fade_in_speed_multiplier; + var fadeInDuration = preEmpt * fade_in_duration_multiplier; var fadeOutStartTime = fadeInStartTime + fadeInDuration; - var fadeOutDuration = preEmpt * fade_out_speed_multiplier; + var fadeOutDuration = preEmpt * fade_out_duration_multiplier; // new duration from completed fade in to end (before fading out) var newDuration = ((d.HitObject as IHasEndTime)?.EndTime ?? d.HitObject.StartTime) - fadeOutStartTime; @@ -67,6 +67,7 @@ namespace osu.Game.Rulesets.Osu.Mods case DrawableHitCircle circle: // we don't want to see the approach circle circle.ApproachCircle.Hide(); + // prolong the hitcircle long enough so misses are still possible circle.LifetimeEnd = circle.HitObject.StartTime + Math.Max(fadeOutDuration, circle.HitObject.HitWindowFor(HitResult.Miss)); circle.FadeIn(fadeInDuration).Then().FadeOut(fadeOutDuration); // override fade in as it somehow gets cut otherwise @@ -75,6 +76,7 @@ namespace osu.Game.Rulesets.Osu.Mods using (slider.BeginAbsoluteSequence(fadeOutStartTime, true)) { slider.Body.FadeOut(newDuration, Easing.Out); + // delay a bit less to let the sliderball fade out peacefully instead of having a hard cut using (slider.BeginDelayedSequence(newDuration - fadeOutDuration, true)) { @@ -91,6 +93,7 @@ namespace osu.Game.Rulesets.Osu.Mods using (spinner.BeginAbsoluteSequence(fadeOutStartTime, true)) { var sequence = spinner.Delay(newDuration).FadeOut(fadeOutDuration); + // speed up the end sequence accordingly switch (state) { @@ -101,6 +104,7 @@ namespace osu.Game.Rulesets.Osu.Mods sequence.ScaleTo(spinner.Scale * 0.8f, fadeOutDuration * 2, Easing.Out); break; } + sequence.Expire(); } break; From 0ae00cbd17f006272a4ea1ecde3f03bbaf9a1619 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 29 Dec 2017 18:28:16 +0900 Subject: [PATCH 133/169] Rename one more variable --- osu.Game.Rulesets.Osu/Mods/OsuMod.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs index f24a360575..c19f8a679b 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs @@ -56,7 +56,7 @@ namespace osu.Game.Rulesets.Osu.Mods var fadeOutDuration = preEmpt * fade_out_duration_multiplier; // new duration from completed fade in to end (before fading out) - var newDuration = ((d.HitObject as IHasEndTime)?.EndTime ?? d.HitObject.StartTime) - fadeOutStartTime; + var longFadeDuration = ((d.HitObject as IHasEndTime)?.EndTime ?? d.HitObject.StartTime) - fadeOutStartTime; d.FadeIn = fadeInDuration; @@ -75,10 +75,10 @@ namespace osu.Game.Rulesets.Osu.Mods case DrawableSlider slider: using (slider.BeginAbsoluteSequence(fadeOutStartTime, true)) { - slider.Body.FadeOut(newDuration, Easing.Out); + slider.Body.FadeOut(longFadeDuration, Easing.Out); // delay a bit less to let the sliderball fade out peacefully instead of having a hard cut - using (slider.BeginDelayedSequence(newDuration - fadeOutDuration, true)) + using (slider.BeginDelayedSequence(longFadeDuration - fadeOutDuration, true)) { slider.Ball.FadeOut(fadeOutDuration); slider.Delay(fadeOutDuration).Expire(); @@ -92,7 +92,7 @@ namespace osu.Game.Rulesets.Osu.Mods using (spinner.BeginAbsoluteSequence(fadeOutStartTime, true)) { - var sequence = spinner.Delay(newDuration).FadeOut(fadeOutDuration); + var sequence = spinner.Delay(longFadeDuration).FadeOut(fadeOutDuration); // speed up the end sequence accordingly switch (state) From dd2ae3f701974e00ef053b1a78fae9904c6babe7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 29 Dec 2017 18:48:10 +0900 Subject: [PATCH 134/169] SImplify everything --- osu.Game.Rulesets.Osu/Mods/OsuMod.cs | 87 ++++++++++++++-------------- 1 file changed, 45 insertions(+), 42 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs index c19f8a679b..1c0f694e4f 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs @@ -60,55 +60,58 @@ namespace osu.Game.Rulesets.Osu.Mods d.FadeIn = fadeInDuration; - using (drawable.BeginAbsoluteSequence(fadeInStartTime, true)) + switch (drawable) { - switch (drawable) - { - case DrawableHitCircle circle: - // we don't want to see the approach circle - circle.ApproachCircle.Hide(); + case DrawableHitCircle circle: + // we don't want to see the approach circle + circle.ApproachCircle.Hide(); - // prolong the hitcircle long enough so misses are still possible - circle.LifetimeEnd = circle.HitObject.StartTime + Math.Max(fadeOutDuration, circle.HitObject.HitWindowFor(HitResult.Miss)); - circle.FadeIn(fadeInDuration).Then().FadeOut(fadeOutDuration); // override fade in as it somehow gets cut otherwise - break; - case DrawableSlider slider: - using (slider.BeginAbsoluteSequence(fadeOutStartTime, true)) + // prolong the hitcircle long enough so misses are still possible + circle.LifetimeEnd = circle.HitObject.StartTime + Math.Max(fadeOutDuration, circle.HitObject.HitWindowFor(HitResult.Miss)); + + // fade out immediately after fade in. + using (drawable.BeginAbsoluteSequence(fadeInStartTime + fadeInDuration, true)) + circle.FadeOut(fadeOutDuration); + break; + case DrawableSlider slider: + using (slider.BeginAbsoluteSequence(fadeOutStartTime, true)) + { + slider.Body.FadeOut(longFadeDuration, Easing.Out); + + // delay a bit less to let the sliderball fade out peacefully instead of having a hard cut + using (slider.BeginDelayedSequence(longFadeDuration - fadeOutDuration, true)) { - slider.Body.FadeOut(longFadeDuration, Easing.Out); - - // delay a bit less to let the sliderball fade out peacefully instead of having a hard cut - using (slider.BeginDelayedSequence(longFadeDuration - fadeOutDuration, true)) - { - slider.Ball.FadeOut(fadeOutDuration); - slider.Delay(fadeOutDuration).Expire(); - } + slider.Ball.FadeOut(fadeOutDuration); + slider.Delay(fadeOutDuration).Expire(); } - break; - case DrawableSpinner spinner: - spinner.Disc.FadeOut(); - spinner.Ticks.FadeOut(); - spinner.Background.FadeOut(); + } - using (spinner.BeginAbsoluteSequence(fadeOutStartTime, true)) + break; + case DrawableSpinner spinner: + // hide elements we don't care about. + spinner.Disc.Hide(); + spinner.Ticks.Hide(); + spinner.Background.Hide(); + + using (spinner.BeginAbsoluteSequence(fadeOutStartTime + longFadeDuration, true)) + { + spinner.FadeOut(fadeOutDuration); + + // speed up the end sequence accordingly + switch (state) { - var sequence = spinner.Delay(longFadeDuration).FadeOut(fadeOutDuration); - - // speed up the end sequence accordingly - switch (state) - { - case ArmedState.Hit: - sequence.ScaleTo(spinner.Scale * 1.2f, fadeOutDuration * 2, Easing.Out); - break; - case ArmedState.Miss: - sequence.ScaleTo(spinner.Scale * 0.8f, fadeOutDuration * 2, Easing.Out); - break; - } - - sequence.Expire(); + case ArmedState.Hit: + spinner.ScaleTo(spinner.Scale * 1.2f, fadeOutDuration * 2, Easing.Out); + break; + case ArmedState.Miss: + spinner.ScaleTo(spinner.Scale * 0.8f, fadeOutDuration * 2, Easing.Out); + break; } - break; - } + + spinner.Expire(); + } + + break; } } } From a4f941cdf161bf802729f2a7d092b54056077fd6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 29 Dec 2017 18:51:14 +0900 Subject: [PATCH 135/169] Move lifetime adjustment to DrawableHitCircle --- osu.Game.Rulesets.Osu/Mods/OsuMod.cs | 3 --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs | 4 ++++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs index 1c0f694e4f..6f2657c3ce 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs @@ -66,9 +66,6 @@ namespace osu.Game.Rulesets.Osu.Mods // we don't want to see the approach circle circle.ApproachCircle.Hide(); - // prolong the hitcircle long enough so misses are still possible - circle.LifetimeEnd = circle.HitObject.StartTime + Math.Max(fadeOutDuration, circle.HitObject.HitWindowFor(HitResult.Miss)); - // fade out immediately after fade in. using (drawable.BeginAbsoluteSequence(fadeInStartTime + fadeInDuration, true)) circle.FadeOut(fadeOutDuration); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index 84ae568a1d..5ee1f3dd05 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -99,7 +99,11 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { case ArmedState.Idle: this.Delay(TIME_PREEMPT).FadeOut(500); + Expire(true); + + // override lifetime end as FadeIn may have been changed externally, causing out expiration to be too early. + LifetimeEnd = HitObject.StartTime + HitObject.HitWindowFor(HitResult.Miss); break; case ArmedState.Miss: ApproachCircle.FadeOut(50); From db8228f69d1b90d969fa4f82f3074367fd046752 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 29 Dec 2017 18:57:38 +0900 Subject: [PATCH 136/169] Don't think we need this expire call --- osu.Game.Rulesets.Osu/Mods/OsuMod.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs index 6f2657c3ce..34694ac1ab 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs @@ -77,10 +77,7 @@ namespace osu.Game.Rulesets.Osu.Mods // delay a bit less to let the sliderball fade out peacefully instead of having a hard cut using (slider.BeginDelayedSequence(longFadeDuration - fadeOutDuration, true)) - { slider.Ball.FadeOut(fadeOutDuration); - slider.Delay(fadeOutDuration).Expire(); - } } break; From b200134a18269f177899f6c1cc5717ba38d9877a Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Fri, 29 Dec 2017 17:44:10 +0100 Subject: [PATCH 137/169] fix spinner easing with hidden --- osu.Game.Rulesets.Osu/Mods/OsuMod.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs index 34694ac1ab..26aa7cd023 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs @@ -98,7 +98,7 @@ namespace osu.Game.Rulesets.Osu.Mods spinner.ScaleTo(spinner.Scale * 1.2f, fadeOutDuration * 2, Easing.Out); break; case ArmedState.Miss: - spinner.ScaleTo(spinner.Scale * 0.8f, fadeOutDuration * 2, Easing.Out); + spinner.ScaleTo(spinner.Scale * 0.8f, fadeOutDuration * 2, Easing.In); break; } From ca9f0147141ee4e0f307a7afdacd4b376c642827 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Fri, 29 Dec 2017 17:44:38 +0100 Subject: [PATCH 138/169] add required types to testclasses --- osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs | 9 +++++++++ osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs | 9 ++++++++- osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs | 9 +++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs index c0a67e5dc1..e669dd234a 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs @@ -14,12 +14,21 @@ using OpenTK; using osu.Game.Rulesets.Osu.Mods; using OpenTK.Graphics; using osu.Game.Rulesets.Osu.Judgements; +using System.Collections.Generic; +using System; namespace osu.Game.Rulesets.Osu.Tests { [Ignore("getting CI working")] public class TestCaseHitCircle : OsuTestCase { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(HitCircle), + typeof(OsuModHidden), + typeof(DrawableHitCircle) + }; + private readonly Container content; protected override Container Content => content; diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs index 9acf286915..80d23be6a6 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs @@ -20,7 +20,14 @@ namespace osu.Game.Rulesets.Osu.Tests [Ignore("getting CI working")] public class TestCaseSlider : OsuTestCase { - public override IReadOnlyList RequiredTypes => new[] { typeof(DrawableSlider) }; + public override IReadOnlyList RequiredTypes => new[] + { + typeof(Slider), + typeof(HitCircle), + typeof(OsuModHidden), + typeof(DrawableSlider), + typeof(DrawableHitCircle) + }; private readonly Container content; protected override Container Content => content; diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs index 895984c1ce..c4ee56455a 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseSpinner.cs @@ -1,6 +1,8 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; +using System.Collections.Generic; using NUnit.Framework; using OpenTK; using osu.Framework.Graphics; @@ -17,6 +19,13 @@ namespace osu.Game.Rulesets.Osu.Tests [Ignore("getting CI working")] public class TestCaseSpinner : OsuTestCase { + public override IReadOnlyList RequiredTypes => new[] +{ + typeof(Spinner), + typeof(OsuModHidden), + typeof(DrawableSpinner) + }; + private readonly Container content; protected override Container Content => content; From a58b5ff5f226e0abac33329a895ce1b505799860 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Fri, 29 Dec 2017 17:46:22 +0100 Subject: [PATCH 139/169] simplify sequence --- osu.Game.Rulesets.Osu/Mods/OsuMod.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs index 26aa7cd023..4a4ecec654 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs @@ -67,7 +67,7 @@ namespace osu.Game.Rulesets.Osu.Mods circle.ApproachCircle.Hide(); // fade out immediately after fade in. - using (drawable.BeginAbsoluteSequence(fadeInStartTime + fadeInDuration, true)) + using (drawable.BeginAbsoluteSequence(fadeOutStartTime, true)) circle.FadeOut(fadeOutDuration); break; case DrawableSlider slider: From f547c7986d91e498f4452cd53e7020f716cc982a Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Fri, 29 Dec 2017 17:50:55 +0100 Subject: [PATCH 140/169] created option to override values before UpdateState is called --- osu.Game.Rulesets.Osu/Mods/OsuMod.cs | 10 ++++++++-- .../Rulesets/Objects/Drawables/DrawableHitObject.cs | 8 ++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs index 4a4ecec654..6da9bea1f2 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs @@ -44,6 +44,14 @@ namespace osu.Game.Rulesets.Osu.Mods d.ApplyCustomUpdateState += ApplyHiddenState; } + protected void ApplyHiddenValues(DrawableHitObject drawable) + { + if (!(drawable is DrawableOsuHitObject d)) + return; + + d.FadeIn = preEmpt * fade_in_duration_multiplier; + } + protected void ApplyHiddenState(DrawableHitObject drawable, ArmedState state) { if (!(drawable is DrawableOsuHitObject d)) @@ -58,8 +66,6 @@ namespace osu.Game.Rulesets.Osu.Mods // new duration from completed fade in to end (before fading out) var longFadeDuration = ((d.HitObject as IHasEndTime)?.EndTime ?? d.HitObject.StartTime) - fadeOutStartTime; - d.FadeIn = fadeInDuration; - switch (drawable) { case DrawableHitCircle circle: diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index af038909d2..76afd57178 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -120,6 +120,9 @@ namespace osu.Game.Rulesets.Objects.Drawables State.ValueChanged += state => { + // apply any custom values + ApplyCustomValues?.Invoke(this); + UpdateState(state); // apply any custom state overrides @@ -250,6 +253,11 @@ namespace osu.Game.Rulesets.Objects.Drawables nestedHitObjects.Add(h); } + /// + /// Bind to apply custom values. + /// + public event Action ApplyCustomValues; + /// /// Bind to apply a custom state which can override the default implementation. /// From 5c3b67bcef25cd7a628aaf9dcd8ed8def0ed06d9 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Fri, 29 Dec 2017 17:51:59 +0100 Subject: [PATCH 141/169] remove unnecessary values --- osu.Game.Rulesets.Osu/Mods/OsuMod.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs index 6da9bea1f2..39c34fa246 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs @@ -57,10 +57,7 @@ namespace osu.Game.Rulesets.Osu.Mods if (!(drawable is DrawableOsuHitObject d)) return; - var fadeInStartTime = d.HitObject.StartTime - preEmpt; - var fadeInDuration = preEmpt * fade_in_duration_multiplier; - - var fadeOutStartTime = fadeInStartTime + fadeInDuration; + var fadeOutStartTime = d.HitObject.StartTime - preEmpt + d.FadeIn; var fadeOutDuration = preEmpt * fade_out_duration_multiplier; // new duration from completed fade in to end (before fading out) From 07040f9fd161c039e13e70441bd85c847805d54e Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Fri, 29 Dec 2017 17:52:28 +0100 Subject: [PATCH 142/169] rename field --- osu.Game.Rulesets.Osu/Mods/OsuMod.cs | 4 ++-- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs | 2 +- .../Objects/Drawables/DrawableOsuHitObject.cs | 4 ++-- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs | 4 ++-- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs index 39c34fa246..a5331321c2 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs @@ -49,7 +49,7 @@ namespace osu.Game.Rulesets.Osu.Mods if (!(drawable is DrawableOsuHitObject d)) return; - d.FadeIn = preEmpt * fade_in_duration_multiplier; + d.FadeInDuration = preEmpt * fade_in_duration_multiplier; } protected void ApplyHiddenState(DrawableHitObject drawable, ArmedState state) @@ -57,7 +57,7 @@ namespace osu.Game.Rulesets.Osu.Mods if (!(drawable is DrawableOsuHitObject d)) return; - var fadeOutStartTime = d.HitObject.StartTime - preEmpt + d.FadeIn; + var fadeOutStartTime = d.HitObject.StartTime - preEmpt + d.FadeInDuration; var fadeOutDuration = preEmpt * fade_out_duration_multiplier; // new duration from completed fade in to end (before fading out) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index 5ee1f3dd05..29b31a3fcc 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -87,7 +87,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { base.UpdatePreemptState(); - ApproachCircle.FadeIn(Math.Min(FadeIn * 2, TIME_PREEMPT)); + ApproachCircle.FadeIn(Math.Min(FadeInDuration * 2, TIME_PREEMPT)); ApproachCircle.ScaleTo(1.1f, TIME_PREEMPT); } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index a5b5fc481a..33657c200f 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables /// /// The number of milliseconds used to fade in. /// - public double FadeIn = TIME_FADEIN; + public double FadeInDuration = TIME_FADEIN; public override bool IsPresent => base.IsPresent || State.Value == ArmedState.Idle && Time.Current >= HitObject.StartTime - TIME_PREEMPT; @@ -43,7 +43,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables } } - protected virtual void UpdatePreemptState() => this.FadeIn(FadeIn); + protected virtual void UpdatePreemptState() => this.FadeIn(FadeInDuration); protected virtual void UpdateCurrentState(ArmedState state) { diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 75fa3e0f01..9c04acb011 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -70,7 +70,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables foreach (var tick in s.NestedHitObjects.OfType()) { var repeatStartTime = s.StartTime + tick.RepeatIndex * repeatDuration; - var fadeInTime = repeatStartTime + (tick.StartTime - repeatStartTime) / 2 - (tick.RepeatIndex == 0 ? FadeIn : FadeIn / 2); + var fadeInTime = repeatStartTime + (tick.StartTime - repeatStartTime) / 2 - (tick.RepeatIndex == 0 ? FadeInDuration : FadeInDuration / 2); var fadeOutTime = repeatStartTime + repeatDuration; var drawableTick = new DrawableSliderTick(tick) @@ -87,7 +87,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables foreach (var repeatPoint in s.NestedHitObjects.OfType()) { var repeatStartTime = s.StartTime + repeatPoint.RepeatIndex * repeatDuration; - var fadeInTime = repeatStartTime + (repeatPoint.StartTime - repeatStartTime) / 2 - (repeatPoint.RepeatIndex == 0 ? FadeIn : FadeIn / 2); + var fadeInTime = repeatStartTime + (repeatPoint.StartTime - repeatStartTime) / 2 - (repeatPoint.RepeatIndex == 0 ? FadeInDuration : FadeInDuration / 2); var fadeOutTime = repeatStartTime + repeatDuration; var drawableRepeatPoint = new DrawableRepeatPoint(repeatPoint, this) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 9e80e3ccd1..30c9fb13d0 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -166,7 +166,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { Disc.Tracking = OsuActionInputManager.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton); if (!spmCounter.IsPresent && Disc.Tracking) - spmCounter.FadeIn(FadeIn); + spmCounter.FadeIn(FadeInDuration); base.Update(); } From 6c6fa08a06cf01c98ce4a08c019c20efb4ddc9b5 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Fri, 29 Dec 2017 17:56:48 +0100 Subject: [PATCH 143/169] added some colour to testsliders gray just wasn't sticking out well --- osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs index 80d23be6a6..22ab64636e 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs @@ -14,6 +14,7 @@ using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Tests.Visual; using OpenTK; using osu.Game.Rulesets.Osu.Mods; +using OpenTK.Graphics; namespace osu.Game.Rulesets.Osu.Tests { @@ -63,12 +64,13 @@ namespace osu.Game.Rulesets.Osu.Tests { StartTime = Time.Current + 1000 + timeOffset, Position = new Vector2(-200, 0) + positionOffset.Value, + ComboColour = Color4.LightSeaGreen, ControlPoints = new List { new Vector2(-200, 0) + positionOffset.Value, new Vector2(400, 0) + positionOffset.Value, }, - Distance = 400, + Distance = 400 }; addSlider(slider); @@ -87,6 +89,7 @@ namespace osu.Game.Rulesets.Osu.Tests { StartTime = Time.Current + 1000, Position = new Vector2(-200, 0), + ComboColour = Color4.LightSeaGreen, ControlPoints = new List { new Vector2(-200, 0), From 5e887240aeeee6229535672f56d64945161e3dc3 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Fri, 29 Dec 2017 18:04:40 +0100 Subject: [PATCH 144/169] actually use option to override values... --- osu.Game.Rulesets.Osu/Mods/OsuMod.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs index a5331321c2..cc52a6eb72 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs @@ -41,7 +41,10 @@ namespace osu.Game.Rulesets.Osu.Mods public void ApplyToDrawableHitObjects(IEnumerable drawables) { foreach (var d in drawables.OfType()) + { + d.ApplyCustomValues += ApplyHiddenValues; d.ApplyCustomUpdateState += ApplyHiddenState; + } } protected void ApplyHiddenValues(DrawableHitObject drawable) From 0a2e41884e7d7a19d05acd147aeb9eec7ac21bcb Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Fri, 29 Dec 2017 20:01:26 +0100 Subject: [PATCH 145/169] add more required types for test slider --- osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs index 22ab64636e..5b6b357351 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseSlider.cs @@ -27,7 +27,9 @@ namespace osu.Game.Rulesets.Osu.Tests typeof(HitCircle), typeof(OsuModHidden), typeof(DrawableSlider), - typeof(DrawableHitCircle) + typeof(DrawableHitCircle), + typeof(DrawableSliderTick), + typeof(DrawableRepeatPoint) }; private readonly Container content; From 52dd5ddba66c50ba33b25c7005314bac12436e76 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Fri, 29 Dec 2017 20:03:43 +0100 Subject: [PATCH 146/169] fix repeat points not scaling properly --- .../Objects/Drawables/DrawableRepeatPoint.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs index a9b63ea642..dc64294eea 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs @@ -27,8 +27,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables AutoSizeAxes = Axes.Both; Blending = BlendingMode.Additive; Origin = Anchor.Centre; - Scale = new Vector2(0.5f); - Children = new Drawable[] { new SpriteIcon @@ -36,7 +34,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables Icon = FontAwesome.fa_eercast, Anchor = Anchor.Centre, Origin = Anchor.Centre, - Size = new Vector2(32), + Size = new Vector2(32 * repeatPoint.Scale), } }; } From b1dd64983dcc5eb7b0bd76cedfc9de9d257ea5f9 Mon Sep 17 00:00:00 2001 From: jai_ Date: Fri, 29 Dec 2017 19:05:50 +0000 Subject: [PATCH 147/169] Add tooltip text to supporter icon --- osu.Game/Overlays/Profile/SupporterIcon.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Profile/SupporterIcon.cs b/osu.Game/Overlays/Profile/SupporterIcon.cs index 570d5a13bb..0b40281193 100644 --- a/osu.Game/Overlays/Profile/SupporterIcon.cs +++ b/osu.Game/Overlays/Profile/SupporterIcon.cs @@ -1,19 +1,22 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . +// Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; namespace osu.Game.Overlays.Profile { - public class SupporterIcon : CircularContainer + public class SupporterIcon : CircularContainer, IHasToolTip { private readonly Box background; + + public string TooltipText => "osu!supporter"; public SupporterIcon() { From 6de41ba1729a78a25f65028a4019f45bdb9ff6e8 Mon Sep 17 00:00:00 2001 From: jai_ Date: Fri, 29 Dec 2017 19:16:43 +0000 Subject: [PATCH 148/169] Trim whitespace --- osu.Game/Overlays/Profile/SupporterIcon.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Profile/SupporterIcon.cs b/osu.Game/Overlays/Profile/SupporterIcon.cs index 0b40281193..1ac6daa19e 100644 --- a/osu.Game/Overlays/Profile/SupporterIcon.cs +++ b/osu.Game/Overlays/Profile/SupporterIcon.cs @@ -15,7 +15,7 @@ namespace osu.Game.Overlays.Profile public class SupporterIcon : CircularContainer, IHasToolTip { private readonly Box background; - + public string TooltipText => "osu!supporter"; public SupporterIcon() From 9660e0885b11acbcade28cd1799dc39501fe1478 Mon Sep 17 00:00:00 2001 From: jai_ Date: Fri, 29 Dec 2017 19:20:37 +0000 Subject: [PATCH 149/169] correctly name tooltip interface --- osu.Game/Overlays/Profile/SupporterIcon.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Profile/SupporterIcon.cs b/osu.Game/Overlays/Profile/SupporterIcon.cs index 1ac6daa19e..b5cd94e54b 100644 --- a/osu.Game/Overlays/Profile/SupporterIcon.cs +++ b/osu.Game/Overlays/Profile/SupporterIcon.cs @@ -12,7 +12,7 @@ using osu.Game.Graphics.Backgrounds; namespace osu.Game.Overlays.Profile { - public class SupporterIcon : CircularContainer, IHasToolTip + public class SupporterIcon : CircularContainer, IHasTooltip { private readonly Box background; From b99e0a0439cab0fa7c0831018605f53631f9865a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Sat, 30 Dec 2017 14:15:42 +0900 Subject: [PATCH 150/169] Fix DrawableHitCircle accepting a base OsuHitObject parameter Fixes #1778. --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index a973d2b580..736bc5267d 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables private readonly NumberPiece number; private readonly GlowPiece glow; - public DrawableHitCircle(OsuHitObject h) : base(h) + public DrawableHitCircle(HitCircle h) : base(h) { Origin = Anchor.Centre; @@ -48,7 +48,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables }, number = new NumberPiece { - Text = h is Spinner ? "S" : (HitObject.ComboIndex + 1).ToString(), + Text = (HitObject.ComboIndex + 1).ToString(), }, ring = new RingPiece(), flash = new FlashPiece(), From a0966305d4fae937ab12fdfa354d6f5bff4de54e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 30 Dec 2017 14:46:44 +0900 Subject: [PATCH 151/169] Remove unnecessary new event --- osu.Game.Rulesets.Osu/Mods/OsuMod.cs | 10 +--------- .../Rulesets/Objects/Drawables/DrawableHitObject.cs | 8 -------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs index cc52a6eb72..7b1f80f439 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuMod.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs @@ -42,19 +42,11 @@ namespace osu.Game.Rulesets.Osu.Mods { foreach (var d in drawables.OfType()) { - d.ApplyCustomValues += ApplyHiddenValues; d.ApplyCustomUpdateState += ApplyHiddenState; + d.FadeInDuration = preEmpt * fade_in_duration_multiplier; } } - protected void ApplyHiddenValues(DrawableHitObject drawable) - { - if (!(drawable is DrawableOsuHitObject d)) - return; - - d.FadeInDuration = preEmpt * fade_in_duration_multiplier; - } - protected void ApplyHiddenState(DrawableHitObject drawable, ArmedState state) { if (!(drawable is DrawableOsuHitObject d)) diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 76afd57178..af038909d2 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -120,9 +120,6 @@ namespace osu.Game.Rulesets.Objects.Drawables State.ValueChanged += state => { - // apply any custom values - ApplyCustomValues?.Invoke(this); - UpdateState(state); // apply any custom state overrides @@ -253,11 +250,6 @@ namespace osu.Game.Rulesets.Objects.Drawables nestedHitObjects.Add(h); } - /// - /// Bind to apply custom values. - /// - public event Action ApplyCustomValues; - /// /// Bind to apply a custom state which can override the default implementation. /// From a2840d2519a6faddfd7346fd6275690552493a4c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 30 Dec 2017 15:21:25 +0900 Subject: [PATCH 152/169] Fix FadeInDuration not being passed down to sliders' InitialCircle --- .../Objects/Drawables/DrawableOsuHitObject.cs | 2 +- .../Objects/Drawables/DrawableSlider.cs | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index 33657c200f..f5f0300ae1 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables /// /// The number of milliseconds used to fade in. /// - public double FadeInDuration = TIME_FADEIN; + public virtual double FadeInDuration { get; set; } = TIME_FADEIN; public override bool IsPresent => base.IsPresent || State.Value == ArmedState.Idle && Time.Current >= HitObject.StartTime - TIME_PREEMPT; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 9c04acb011..022bedf1fd 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -27,7 +27,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables public readonly SliderBody Body; public readonly SliderBall Ball; - public DrawableSlider(Slider s) : base(s) + public DrawableSlider(Slider s) + : base(s) { slider = s; @@ -50,7 +51,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables }, InitialCircle = new DrawableHitCircle(new HitCircle { - //todo: avoid creating this temporary HitCircle. StartTime = s.StartTime, Position = s.StackedPosition, ComboIndex = s.ComboIndex, @@ -105,6 +105,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables private int currentRepeat; public bool Tracking; + public override double FadeInDuration + { + get { return base.FadeInDuration; } + set { InitialCircle.FadeInDuration = base.FadeInDuration = value; } + } + protected override void Update() { base.Update(); From 0bd1b75d0b4910b14c69dfbd6c17c7f892091fff Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 30 Dec 2017 15:38:10 +0900 Subject: [PATCH 153/169] Fix test case --- osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs b/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs index e669dd234a..cdce19ad21 100644 --- a/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Tests/TestCaseHitCircle.cs @@ -94,7 +94,7 @@ namespace osu.Game.Rulesets.Osu.Tests { private readonly bool auto; - public TestDrawableHitCircle(OsuHitObject h, bool auto) : base(h) + public TestDrawableHitCircle(HitCircle h, bool auto) : base(h) { this.auto = auto; } From 1ab2c0e21b5aec815d7b431f3a2944936b3a1fe1 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Sat, 30 Dec 2017 16:45:59 +0900 Subject: [PATCH 154/169] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 797a351db2..0c48da1d49 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 797a351db2e852fef5296453641ffbf6b2f6dc11 +Subproject commit 0c48da1d49f470d56aeab9b15651ce0a4f5ac261 From 616ad5b723bfaaa4be5a58e944372bed4bed8971 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Sat, 30 Dec 2017 16:55:01 +0900 Subject: [PATCH 155/169] Cleanups --- osu.Game/Overlays/Mods/ModButton.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index e81ff44f03..35c2e9234d 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -204,13 +204,13 @@ namespace osu.Game.Overlays.Mods { iconsContainer.AddRange(new[] { - backgroundIcon = new DisplayableModIcon(Mods[1]) + backgroundIcon = new PassThroughTooltipModIcon(Mods[1]) { Origin = Anchor.BottomRight, Anchor = Anchor.BottomRight, Position = new Vector2(1.5f), }, - foregroundIcon = new DisplayableModIcon(Mods[0]) + foregroundIcon = new PassThroughTooltipModIcon(Mods[0]) { Origin = Anchor.BottomRight, Anchor = Anchor.BottomRight, @@ -220,7 +220,7 @@ namespace osu.Game.Overlays.Mods } else { - iconsContainer.Add(foregroundIcon = new DisplayableModIcon(Mod) + iconsContainer.Add(foregroundIcon = new PassThroughTooltipModIcon(Mod) { Origin = Anchor.Centre, Anchor = Anchor.Centre, @@ -260,14 +260,13 @@ namespace osu.Game.Overlays.Mods Mod = mod; } - private class DisplayableModIcon : ModIcon { + private class PassThroughTooltipModIcon : ModIcon + { + public override string TooltipText => null; - public override string TooltipText { get; } - - public DisplayableModIcon(Mod mod) : base(mod) { - TooltipText = null; + public PassThroughTooltipModIcon(Mod mod) : base(mod) + { } - } } } From 1f71bd3425910870b843c36a1dbbcffe5657dc8c Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Sat, 30 Dec 2017 09:05:40 +0100 Subject: [PATCH 156/169] scale the correct part of the repeat point --- .../Objects/Drawables/DrawableRepeatPoint.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs index dc64294eea..4f3f951948 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs @@ -24,17 +24,17 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables this.repeatPoint = repeatPoint; this.drawableSlider = drawableSlider; - AutoSizeAxes = Axes.Both; + Size = new Vector2(32 * repeatPoint.Scale); + Blending = BlendingMode.Additive; Origin = Anchor.Centre; + Children = new Drawable[] { new SpriteIcon { - Icon = FontAwesome.fa_eercast, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(32 * repeatPoint.Scale), + RelativeSizeAxes = Axes.Both, + Icon = FontAwesome.fa_eercast } }; } From 03e9b05c3fba27c1e65a4880d3cb8c694d2f1cc3 Mon Sep 17 00:00:00 2001 From: Techno-coder Date: Sat, 30 Dec 2017 21:38:33 +1300 Subject: [PATCH 157/169] Add Getting Started section to Readme and MonoDevelop IDE for Linux --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 856536d22d..f9936e9259 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,13 @@ This is still heavily under development and is not intended for end-user use. Th # Requirements -- A desktop platform which can compile .NET 4.5 (tested on macOS, linux and windows). We recommend using [Visual Studio Code](https://code.visualstudio.com/) (all platforms) or [Visual Studio Community Edition](https://www.visualstudio.com/) (windows only), both of which are free. +- A desktop platform which can compile .NET 4.5 (tested on macOS, linux and windows). We recommend using [MonoDevelop](http://www.monodevelop.com/download/) (Linux), [Visual Studio Code](https://code.visualstudio.com/) (macOS) or [Visual Studio Community Edition](https://www.visualstudio.com/) (Windows), all of which are free. - Make sure you initialise and keep submodules up-to-date. +# Getting Started +- Clone the repository including submodules (`git clone --recurse-submodules https://github.com/ppy/osu`) +- Build in your IDE of choice (recommended IDEs automatically restore nuget packages; if you are using an alternative make sure to `nuget restore`) + # Contributing We welcome all contributions, but keep in mind that we already have a lot of the UI designed. If you wish to work on something with the intention on having it included in the official distribution, please open an issue for discussion and we will give you what you need from a design perspective to proceed. If you want to make *changes* to the design, we recommend you open an issue with your intentions before spending too much time, to ensure no effort is wasted. From e28f91a6028dd8b60231e9da40ecf99b29181b8c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 30 Dec 2017 18:20:51 +0900 Subject: [PATCH 158/169] Improve wording and fix macOS requirement --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index f9936e9259..47df86f57e 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,7 @@ This is still heavily under development and is not intended for end-user use. Th # Requirements -- A desktop platform which can compile .NET 4.5 (tested on macOS, linux and windows). We recommend using [MonoDevelop](http://www.monodevelop.com/download/) (Linux), [Visual Studio Code](https://code.visualstudio.com/) (macOS) or [Visual Studio Community Edition](https://www.visualstudio.com/) (Windows), all of which are free. -- Make sure you initialise and keep submodules up-to-date. +- A desktop platform that can compile .NET 4.6.1. We recommend using [Visual Studio Community Edition](https://www.visualstudio.com/) (Windows), [Visual Studio for Mac](https://www.visualstudio.com/vs/visual-studio-mac/) (macOS) or [MonoDevelop](http://www.monodevelop.com/download/) (Linux), all of which are free. [Visual Studio Code](https://code.visualstudio.com/) may also be used but requires further setup steps which are not covered here. # Getting Started - Clone the repository including submodules (`git clone --recurse-submodules https://github.com/ppy/osu`) From 86a00411d719e4a55e4f0466c213f6d41ac33994 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Sat, 30 Dec 2017 19:58:01 +0900 Subject: [PATCH 159/169] Update framework Reverts fillflow changes. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 0c48da1d49..6134dafccb 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 0c48da1d49f470d56aeab9b15651ce0a4f5ac261 +Subproject commit 6134dafccb3368dac96d837537325c04b89fb8ee From f7fe0830181e28248f29131afd2b1feaa1b6da0a Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Sat, 30 Dec 2017 14:57:57 +0100 Subject: [PATCH 160/169] add tooltip to country flags --- .../BeatmapSet/Scores/DrawableScore.cs | 2 +- .../BeatmapSet/Scores/DrawableTopScore.cs | 2 +- osu.Game/Overlays/Profile/ProfileHeader.cs | 4 +- .../Screens/Multiplayer/ParticipantInfo.cs | 2 +- .../Select/Leaderboards/LeaderboardScore.cs | 2 +- osu.Game/Users/Country.cs | 43 +++++++++++-------- osu.Game/Users/UserPanel.cs | 2 +- 7 files changed, 32 insertions(+), 25 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs index 5a3aba7b43..8b407ac208 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs @@ -48,7 +48,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Font = @"Exo2.0-RegularItalic", Margin = new MarginPadding { Left = side_margin } }, - new DrawableFlag(score.User.Country?.FlagName) + new DrawableFlag(score.User.Country) { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs index 833ed94c0f..66bf89bbac 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs @@ -52,7 +52,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores score = value; avatar.User = username.User = score.User; - flag.FlagName = score.User.Country?.FlagName; + flag.Country = score.User.Country; date.Text = $@"achieved {score.Date:MMM d, yyyy}"; rank.UpdateRank(score.Rank); diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 18e77cf186..960bb60287 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -109,7 +109,7 @@ namespace osu.Game.Overlays.Profile Origin = Anchor.BottomLeft, Y = -48, }, - countryFlag = new DrawableFlag(user.Country?.FlagName) + countryFlag = new DrawableFlag(user.Country) { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, @@ -333,7 +333,7 @@ namespace osu.Game.Overlays.Profile { infoTextLeft.AddText("from "); infoTextLeft.AddText(user.Country.FullName, boldItalic); - countryFlag.FlagName = user.Country.FlagName; + countryFlag.Country = user.Country; } infoTextLeft.NewParagraph(); diff --git a/osu.Game/Screens/Multiplayer/ParticipantInfo.cs b/osu.Game/Screens/Multiplayer/ParticipantInfo.cs index fa48287ce1..2197b7477c 100644 --- a/osu.Game/Screens/Multiplayer/ParticipantInfo.cs +++ b/osu.Game/Screens/Multiplayer/ParticipantInfo.cs @@ -27,7 +27,7 @@ namespace osu.Game.Screens.Multiplayer set { host.Text = value.Username; - flagContainer.Children = new[] { new DrawableFlag(value.Country?.FlagName) { RelativeSizeAxes = Axes.Both } }; + flagContainer.Children = new[] { new DrawableFlag(value.Country) { RelativeSizeAxes = Axes.Both } }; } } diff --git a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs index 03466439ad..e0c9a3e04e 100644 --- a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs @@ -145,7 +145,7 @@ namespace osu.Game.Screens.Select.Leaderboards Masking = true, Children = new Drawable[] { - new DrawableFlag(Score.User?.Country?.FlagName) + new DrawableFlag(Score.User?.Country) { Width = 30, RelativeSizeAxes = Axes.Y, diff --git a/osu.Game/Users/Country.cs b/osu.Game/Users/Country.cs index 0c0d12c1cc..46ddaee637 100644 --- a/osu.Game/Users/Country.cs +++ b/osu.Game/Users/Country.cs @@ -6,6 +6,7 @@ using Newtonsoft.Json; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; @@ -26,36 +27,30 @@ namespace osu.Game.Users public string FlagName; } - public class DrawableFlag : Container + public class DrawableFlag : Container, IHasTooltip { private readonly Sprite sprite; private TextureStore textures; - private string flagName; - public string FlagName + private Country country; + public Country Country { - get { return flagName; } + get { return country; } set { - if (value == flagName) return; - flagName = value; - sprite.Texture = textures.Get($@"Flags/{flagName}"); + if (value == country) + return; + + country = value; + sprite.Texture = getFlagTexture(); } } - [BackgroundDependencyLoader] - private void load(TextureStore ts) - { - if (ts == null) - throw new ArgumentNullException(nameof(ts)); + public string TooltipText => country?.FullName; - textures = ts; - sprite.Texture = textures.Get($@"Flags/{flagName}"); - } - - public DrawableFlag(string name = null) + public DrawableFlag(Country country = null) { - flagName = name ?? @"__"; + this.country = country; Children = new Drawable[] { @@ -65,5 +60,17 @@ namespace osu.Game.Users }, }; } + + [BackgroundDependencyLoader] + private void load(TextureStore ts) + { + if (ts == null) + throw new ArgumentNullException(nameof(ts)); + + textures = ts; + sprite.Texture = getFlagTexture(); + } + + private Texture getFlagTexture() => textures.Get($@"Flags/{country?.FlagName ?? @"__"}"); } } diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index a2cc8e8d49..e0a4e3184d 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -114,7 +114,7 @@ namespace osu.Game.Users Spacing = new Vector2(5f, 0f), Children = new Drawable[] { - new DrawableFlag(user.Country?.FlagName) + new DrawableFlag(user.Country) { Width = 30f, RelativeSizeAxes = Axes.Y, From 138d78309f3af57e27f363c806d8d78934986cd7 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Sat, 30 Dec 2017 18:07:30 +0100 Subject: [PATCH 161/169] add HitCount enum and replace string usage with enum --- .../Scoring/OsuPerformanceCalculator.cs | 9 +++++---- .../Scoring/OsuScoreProcessor.cs | 12 ++++++------ .../Visual/TestCaseBeatmapScoresContainer.cs | 19 ++++++++++--------- osu.Game.Tests/Visual/TestCaseResults.cs | 11 ++++++----- .../Online/API/Requests/GetScoresRequest.cs | 14 +++++++------- .../BeatmapSet/Scores/DrawableScore.cs | 3 ++- .../BeatmapSet/Scores/DrawableTopScore.cs | 3 ++- osu.Game/Rulesets/Scoring/Score.cs | 18 +++++++++++++++++- osu.Game/Screens/Ranking/ResultsPageScore.cs | 8 +++++--- 9 files changed, 60 insertions(+), 37 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Scoring/OsuPerformanceCalculator.cs b/osu.Game.Rulesets.Osu/Scoring/OsuPerformanceCalculator.cs index 2cf321da50..0d9dc0e43b 100644 --- a/osu.Game.Rulesets.Osu/Scoring/OsuPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Osu/Scoring/OsuPerformanceCalculator.cs @@ -10,6 +10,7 @@ using osu.Game.Rulesets.Osu.Beatmaps; using osu.Game.Rulesets.Osu.Mods; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Scoring; +using static osu.Game.Rulesets.Scoring.Score; namespace osu.Game.Rulesets.Osu.Scoring { @@ -41,10 +42,10 @@ namespace osu.Game.Rulesets.Osu.Scoring mods = Score.Mods; accuracy = Score.Accuracy; scoreMaxCombo = Score.MaxCombo; - count300 = Convert.ToInt32(Score.Statistics["300"]); - count100 = Convert.ToInt32(Score.Statistics["100"]); - count50 = Convert.ToInt32(Score.Statistics["50"]); - countMiss = Convert.ToInt32(Score.Statistics["x"]); + count300 = Convert.ToInt32(Score.Statistics[HitCount.Great]); + count100 = Convert.ToInt32(Score.Statistics[HitCount.Good]); + count50 = Convert.ToInt32(Score.Statistics[HitCount.Meh]); + countMiss = Convert.ToInt32(Score.Statistics[HitCount.Miss]); // Don't count scores made with supposedly unranked mods if (mods.Any(m => !m.Ranked)) diff --git a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs index ad9737af52..1c376d7c63 100644 --- a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs +++ b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs @@ -12,6 +12,7 @@ using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; +using static osu.Game.Rulesets.Scoring.Score; namespace osu.Game.Rulesets.Osu.Scoring { @@ -33,8 +34,7 @@ namespace osu.Game.Rulesets.Osu.Scoring foreach (var obj in beatmap.HitObjects) { - var slider = obj as Slider; - if (slider != null) + if (obj is Slider slider) { // Head AddJudgement(new OsuJudgement { Result = HitResult.Great }); @@ -64,10 +64,10 @@ namespace osu.Game.Rulesets.Osu.Scoring { base.PopulateScore(score); - score.Statistics[@"300"] = scoreResultCounts.GetOrDefault(HitResult.Great); - score.Statistics[@"100"] = scoreResultCounts.GetOrDefault(HitResult.Good); - score.Statistics[@"50"] = scoreResultCounts.GetOrDefault(HitResult.Meh); - score.Statistics[@"x"] = scoreResultCounts.GetOrDefault(HitResult.Miss); + score.Statistics[HitCount.Great] = scoreResultCounts.GetOrDefault(HitResult.Great); + score.Statistics[HitCount.Good] = scoreResultCounts.GetOrDefault(HitResult.Good); + score.Statistics[HitCount.Meh] = scoreResultCounts.GetOrDefault(HitResult.Meh); + score.Statistics[HitCount.Miss] = scoreResultCounts.GetOrDefault(HitResult.Miss); } protected override void OnNewJudgement(Judgement judgement) diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs b/osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs index cef8797f20..75ec0481e8 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs @@ -14,6 +14,7 @@ using osu.Game.Rulesets.Scoring; using osu.Game.Users; using System.Collections.Generic; using osu.Framework.Graphics.Containers; +using static osu.Game.Rulesets.Scoring.Score; namespace osu.Game.Tests.Visual { @@ -160,9 +161,9 @@ namespace osu.Game.Tests.Visual }; foreach(var s in scores) { - s.Statistics.Add("300", RNG.Next(2000)); - s.Statistics.Add("100", RNG.Next(2000)); - s.Statistics.Add("50", RNG.Next(2000)); + s.Statistics.Add(HitCount.Great, RNG.Next(2000)); + s.Statistics.Add(HitCount.Good, RNG.Next(2000)); + s.Statistics.Add(HitCount.Meh, RNG.Next(2000)); } anotherScores = new[] @@ -272,9 +273,9 @@ namespace osu.Game.Tests.Visual }; foreach (var s in anotherScores) { - s.Statistics.Add("300", RNG.Next(2000)); - s.Statistics.Add("100", RNG.Next(2000)); - s.Statistics.Add("50", RNG.Next(2000)); + s.Statistics.Add(HitCount.Great, RNG.Next(2000)); + s.Statistics.Add(HitCount.Good, RNG.Next(2000)); + s.Statistics.Add(HitCount.Meh, RNG.Next(2000)); } topScore = new OnlineScore @@ -299,9 +300,9 @@ namespace osu.Game.Tests.Visual TotalScore = 987654321, Accuracy = 0.8487, }; - topScore.Statistics.Add("300", RNG.Next(2000)); - topScore.Statistics.Add("100", RNG.Next(2000)); - topScore.Statistics.Add("50", RNG.Next(2000)); + topScore.Statistics.Add(HitCount.Great, RNG.Next(2000)); + topScore.Statistics.Add(HitCount.Good, RNG.Next(2000)); + topScore.Statistics.Add(HitCount.Meh, RNG.Next(2000)); } [BackgroundDependencyLoader] diff --git a/osu.Game.Tests/Visual/TestCaseResults.cs b/osu.Game.Tests/Visual/TestCaseResults.cs index d0c5aa4939..5190baff4e 100644 --- a/osu.Game.Tests/Visual/TestCaseResults.cs +++ b/osu.Game.Tests/Visual/TestCaseResults.cs @@ -8,6 +8,7 @@ using osu.Game.Beatmaps; using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Ranking; using osu.Game.Users; +using static osu.Game.Rulesets.Scoring.Score; namespace osu.Game.Tests.Visual { @@ -41,12 +42,12 @@ namespace osu.Game.Tests.Visual MaxCombo = 123, Rank = ScoreRank.A, Date = DateTimeOffset.Now, - Statistics = new Dictionary + Statistics = new Dictionary { - { "300", 50 }, - { "100", 20 }, - { "50", 50 }, - { "x", 1 } + { HitCount.Great, 50 }, + { HitCount.Good, 20 }, + { HitCount.Meh, 50 }, + { HitCount.Miss, 1 } }, User = new User { diff --git a/osu.Game/Online/API/Requests/GetScoresRequest.cs b/osu.Game/Online/API/Requests/GetScoresRequest.cs index 065c770738..9e5aa6d93f 100644 --- a/osu.Game/Online/API/Requests/GetScoresRequest.cs +++ b/osu.Game/Online/API/Requests/GetScoresRequest.cs @@ -122,26 +122,26 @@ namespace osu.Game.Online.API.Requests { foreach (var kvp in value) { - string key = kvp.Key; - switch (key) + HitCount newKey; + switch (kvp.Key) { case @"count_300": - key = @"300"; + newKey = HitCount.Great; break; case @"count_100": - key = @"100"; + newKey = HitCount.Good; break; case @"count_50": - key = @"50"; + newKey = HitCount.Meh; break; case @"count_miss": - key = @"x"; + newKey = HitCount.Miss; break; default: continue; } - Statistics.Add(key, kvp.Value); + Statistics.Add(newKey, kvp.Value); } } } diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs index 8b407ac208..301c62ee77 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs @@ -15,6 +15,7 @@ using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.UI; using osu.Game.Screens.Select.Leaderboards; using osu.Game.Users; +using static osu.Game.Rulesets.Scoring.Score; namespace osu.Game.Overlays.BeatmapSet.Scores { @@ -104,7 +105,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, - Text = $"{score.Statistics["300"]}/{score.Statistics["100"]}/{score.Statistics["50"]}", + Text = $"{score.Statistics[HitCount.Great]}/{score.Statistics[HitCount.Good]}/{score.Statistics[HitCount.Meh]}", Font = @"Exo2.0-RegularItalic", Margin = new MarginPadding { Right = side_margin } }, diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs index 66bf89bbac..612728ff4c 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs @@ -18,6 +18,7 @@ using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; using osu.Game.Screens.Select.Leaderboards; using osu.Game.Users; +using static osu.Game.Rulesets.Scoring.Score; namespace osu.Game.Overlays.BeatmapSet.Scores { @@ -58,7 +59,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores totalScore.Value = $@"{score.TotalScore:N0}"; accuracy.Value = $@"{score.Accuracy:P2}"; - statistics.Value = $"{score.Statistics["300"]}/{score.Statistics["100"]}/{score.Statistics["50"]}"; + statistics.Value = $"{score.Statistics[HitCount.Great]}/{score.Statistics[HitCount.Good]}/{score.Statistics[HitCount.Meh]}"; modsContainer.Clear(); foreach (Mod mod in score.Mods) diff --git a/osu.Game/Rulesets/Scoring/Score.cs b/osu.Game/Rulesets/Scoring/Score.cs index 6a06f364c6..56c7bc583f 100644 --- a/osu.Game/Rulesets/Scoring/Score.cs +++ b/osu.Game/Rulesets/Scoring/Score.cs @@ -7,6 +7,7 @@ using osu.Game.Beatmaps; using osu.Game.Rulesets.Mods; using osu.Game.Users; using osu.Game.Rulesets.Replays; +using System.ComponentModel; namespace osu.Game.Rulesets.Scoring { @@ -40,6 +41,21 @@ namespace osu.Game.Rulesets.Scoring public DateTimeOffset Date; - public Dictionary Statistics = new Dictionary(); + public Dictionary Statistics = new Dictionary(); + + public enum HitCount + { + [Description("300")] + Great, + + [Description("100")] + Good, + + [Description("50")] + Meh, + + [Description("x")] + Miss + } } } diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index 25a42cae1c..e2de44ab14 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -23,6 +23,8 @@ using osu.Game.Screens.Play; using osu.Game.Screens.Select.Leaderboards; using osu.Game.Users; using osu.Framework.Graphics.Shapes; +using static osu.Game.Rulesets.Scoring.Score; +using osu.Framework.Extensions; namespace osu.Game.Screens.Ranking { @@ -186,9 +188,9 @@ namespace osu.Game.Screens.Ranking private class DrawableScoreStatistic : Container { - private readonly KeyValuePair statistic; + private readonly KeyValuePair statistic; - public DrawableScoreStatistic(KeyValuePair statistic) + public DrawableScoreStatistic(KeyValuePair statistic) { this.statistic = statistic; @@ -209,7 +211,7 @@ namespace osu.Game.Screens.Ranking Origin = Anchor.TopCentre, }, new OsuSpriteText { - Text = statistic.Key, + Text = statistic.Key.GetDescription(), Colour = colours.Gray7, Font = @"Exo2.0-Bold", Y = 26, From 1ef4ff6776be903f64df9b63deba3808a8d6d7e5 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Sat, 30 Dec 2017 18:07:53 +0100 Subject: [PATCH 162/169] order statistics before adding to resultpage --- osu.Game/Screens/Ranking/ResultsPageScore.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index e2de44ab14..6d2aa8fce8 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -165,7 +165,7 @@ namespace osu.Game.Screens.Ranking } }; - statisticsContainer.ChildrenEnumerable = Score.Statistics.Select(s => new DrawableScoreStatistic(s)); + statisticsContainer.ChildrenEnumerable = Score.Statistics.OrderBy(p => p.Key).Select(s => new DrawableScoreStatistic(s)); } protected override void LoadComplete() From ccb69d16d9c81a056da0b07f340e2e14a1a8894b Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Sat, 30 Dec 2017 21:23:18 +0100 Subject: [PATCH 163/169] move HitResult in Scoring namespace to replace HitCount --- .../Drawable/DrawableCatchHitObject.cs | 1 + .../Scoring/CatchScoreProcessor.cs | 1 - .../Judgements/HitWindows.cs | 2 +- .../Judgements/HoldNoteTailJudgement.cs | 4 ++-- .../Judgements/HoldNoteTickJudgement.cs | 4 ++-- .../Judgements/ManiaJudgement.cs | 2 +- .../Objects/Drawables/DrawableHoldNote.cs | 1 + .../Objects/Drawables/DrawableHoldNoteTick.cs | 3 ++- .../Objects/Drawables/DrawableNote.cs | 1 + .../Scoring/ManiaScoreProcessor.cs | 1 - .../Tests/TestCaseManiaPlayfield.cs | 2 +- .../Judgements/OsuJudgement.cs | 4 ++-- .../Objects/Drawables/DrawableHitCircle.cs | 1 + .../Objects/Drawables/DrawableOsuJudgement.cs | 4 ++-- .../Objects/Drawables/DrawableRepeatPoint.cs | 1 + .../Objects/Drawables/DrawableSlider.cs | 1 + .../Objects/Drawables/DrawableSliderTick.cs | 1 + .../Objects/Drawables/DrawableSpinner.cs | 1 + osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs | 2 +- .../Replays/OsuAutoGenerator.cs | 2 +- .../Scoring/OsuPerformanceCalculator.cs | 9 ++++----- .../Scoring/OsuScoreProcessor.cs | 10 ++++------ .../Judgements/TaikoDrumRollTickJudgement.cs | 4 ++-- .../Judgements/TaikoJudgement.cs | 2 +- .../Objects/Drawables/DrawableDrumRoll.cs | 1 + .../Objects/Drawables/DrawableDrumRollTick.cs | 1 + .../Objects/Drawables/DrawableHit.cs | 1 + .../Objects/Drawables/DrawableHitStrong.cs | 2 +- .../Objects/Drawables/DrawableSwell.cs | 1 + .../Scoring/TaikoScoreProcessor.cs | 1 - .../Tests/TestCaseTaikoPlayfield.cs | 1 + .../UI/DrawableTaikoJudgement.cs | 3 ++- .../Visual/TestCaseBeatmapScoresContainer.cs | 19 +++++++++---------- osu.Game.Tests/Visual/TestCaseResults.cs | 11 +++++------ .../Online/API/Requests/GetScoresRequest.cs | 10 +++++----- .../BeatmapSet/Scores/DrawableScore.cs | 4 ++-- .../BeatmapSet/Scores/DrawableTopScore.cs | 3 +-- .../Rulesets/Judgements/DrawableJudgement.cs | 2 +- osu.Game/Rulesets/Judgements/Judgement.cs | 1 + .../Objects/Drawables/DrawableHitObject.cs | 1 + .../Drawables => Scoring}/HitResult.cs | 2 +- osu.Game/Rulesets/Scoring/Score.cs | 18 +----------------- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 1 - .../Screens/Play/HUD/StandardHealthDisplay.cs | 2 +- osu.Game/Screens/Ranking/ResultsPageScore.cs | 5 ++--- osu.Game/osu.Game.csproj | 2 +- 46 files changed, 73 insertions(+), 83 deletions(-) rename osu.Game/Rulesets/{Objects/Drawables => Scoring}/HitResult.cs (91%) diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs index b90a06b94e..a617b65676 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs @@ -6,6 +6,7 @@ using osu.Framework.Graphics; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects.Drawables; using OpenTK; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Catch.Objects.Drawable { diff --git a/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs b/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs index 3826fd1129..3b9eacde9c 100644 --- a/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs +++ b/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs @@ -5,7 +5,6 @@ using System.Linq; using osu.Game.Beatmaps; using osu.Game.Rulesets.Catch.Judgements; using osu.Game.Rulesets.Catch.Objects; -using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; diff --git a/osu.Game.Rulesets.Mania/Judgements/HitWindows.cs b/osu.Game.Rulesets.Mania/Judgements/HitWindows.cs index d7bfa9caa1..ded1bc17af 100644 --- a/osu.Game.Rulesets.Mania/Judgements/HitWindows.cs +++ b/osu.Game.Rulesets.Mania/Judgements/HitWindows.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Beatmaps; -using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Mania.Judgements { diff --git a/osu.Game.Rulesets.Mania/Judgements/HoldNoteTailJudgement.cs b/osu.Game.Rulesets.Mania/Judgements/HoldNoteTailJudgement.cs index a8d1b079eb..e369df6ae1 100644 --- a/osu.Game.Rulesets.Mania/Judgements/HoldNoteTailJudgement.cs +++ b/osu.Game.Rulesets.Mania/Judgements/HoldNoteTailJudgement.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Mania.Judgements { @@ -24,4 +24,4 @@ namespace osu.Game.Rulesets.Mania.Judgements } } } -} \ No newline at end of file +} diff --git a/osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs b/osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs index d326c6fc0a..4787a4977b 100644 --- a/osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs +++ b/osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Mania.Judgements { @@ -11,4 +11,4 @@ namespace osu.Game.Rulesets.Mania.Judgements protected override int NumericResultFor(HitResult result) => 20; } -} \ No newline at end of file +} diff --git a/osu.Game.Rulesets.Mania/Judgements/ManiaJudgement.cs b/osu.Game.Rulesets.Mania/Judgements/ManiaJudgement.cs index 1f3b352da4..4762a98c40 100644 --- a/osu.Game.Rulesets.Mania/Judgements/ManiaJudgement.cs +++ b/osu.Game.Rulesets.Mania/Judgements/ManiaJudgement.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Rulesets.Judgements; -using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Mania.Judgements { diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs index 7b207ca229..41d817a746 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs @@ -12,6 +12,7 @@ using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Mania.Judgements; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Input.Bindings; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Mania.Objects.Drawables { diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs index 557fbf6ea8..8ed5d2b924 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Mania.Judgements; using osu.Game.Rulesets.Objects.Drawables; using osu.Framework.Graphics.Shapes; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Mania.Objects.Drawables { @@ -113,4 +114,4 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables UpdateJudgement(true); } } -} \ No newline at end of file +} diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs index 537246509b..aabfcafa85 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs @@ -8,6 +8,7 @@ using osu.Framework.Input.Bindings; using osu.Game.Rulesets.Mania.Judgements; using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces; using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Mania.Objects.Drawables { diff --git a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs index 012137f555..140bab2225 100644 --- a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs +++ b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs @@ -6,7 +6,6 @@ using osu.Game.Beatmaps; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Mania.Judgements; using osu.Game.Rulesets.Mania.Objects; -using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; diff --git a/osu.Game.Rulesets.Mania/Tests/TestCaseManiaPlayfield.cs b/osu.Game.Rulesets.Mania/Tests/TestCaseManiaPlayfield.cs index 1932038411..b5890b289f 100644 --- a/osu.Game.Rulesets.Mania/Tests/TestCaseManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/Tests/TestCaseManiaPlayfield.cs @@ -13,7 +13,7 @@ using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Mania.Timing; using osu.Game.Rulesets.Mania.UI; -using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Timing; using osu.Game.Tests.Visual; diff --git a/osu.Game.Rulesets.Osu/Judgements/OsuJudgement.cs b/osu.Game.Rulesets.Osu/Judgements/OsuJudgement.cs index 28b6a04376..cd9c3888df 100644 --- a/osu.Game.Rulesets.Osu/Judgements/OsuJudgement.cs +++ b/osu.Game.Rulesets.Osu/Judgements/OsuJudgement.cs @@ -4,7 +4,7 @@ using OpenTK; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Osu.Objects.Drawables; -using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Osu.Judgements { @@ -34,4 +34,4 @@ namespace osu.Game.Rulesets.Osu.Judgements public ComboResult Combo; } -} \ No newline at end of file +} diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index 7bdb6d04b6..6220bbd120 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -7,6 +7,7 @@ using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using OpenTK; using osu.Game.Rulesets.Osu.Judgements; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Osu.Objects.Drawables { diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuJudgement.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuJudgement.cs index 7755a54e88..f16a41519e 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuJudgement.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuJudgement.cs @@ -2,10 +2,10 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; -using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Judgements; using OpenTK; using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Osu.Objects.Drawables { @@ -24,4 +24,4 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables base.LoadComplete(); } } -} \ No newline at end of file +} diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs index 4f3f951948..477ced01c6 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableRepeatPoint.cs @@ -7,6 +7,7 @@ using osu.Game.Rulesets.Objects.Drawables; using OpenTK; using osu.Game.Graphics; using osu.Game.Rulesets.Osu.Judgements; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Osu.Objects.Drawables { diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 022bedf1fd..5a8bcae277 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -10,6 +10,7 @@ using System.Linq; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Osu.Judgements; using osu.Framework.Graphics.Primitives; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Osu.Objects.Drawables { diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs index 7199691ae6..bce7ef6141 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs @@ -8,6 +8,7 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics.Shapes; using osu.Game.Rulesets.Osu.Judgements; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Osu.Objects.Drawables { diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 30c9fb13d0..5351ad50c4 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -13,6 +13,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Allocation; using osu.Game.Rulesets.Osu.Judgements; using osu.Game.Screens.Ranking; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Osu.Objects.Drawables { diff --git a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs index 7532387aa2..a3a6527b31 100644 --- a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs @@ -7,7 +7,7 @@ using OpenTK; using osu.Game.Rulesets.Objects.Types; using OpenTK.Graphics; using osu.Game.Beatmaps.ControlPoints; -using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Osu.Objects { diff --git a/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs b/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs index f82c6ce3b2..ba774e887f 100644 --- a/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs +++ b/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs @@ -9,9 +9,9 @@ using osu.Game.Rulesets.Osu.Objects.Drawables; using System; using System.Diagnostics; using osu.Framework.Graphics; -using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Replays; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Osu.Replays { diff --git a/osu.Game.Rulesets.Osu/Scoring/OsuPerformanceCalculator.cs b/osu.Game.Rulesets.Osu/Scoring/OsuPerformanceCalculator.cs index 0d9dc0e43b..38c602bc42 100644 --- a/osu.Game.Rulesets.Osu/Scoring/OsuPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Osu/Scoring/OsuPerformanceCalculator.cs @@ -10,7 +10,6 @@ using osu.Game.Rulesets.Osu.Beatmaps; using osu.Game.Rulesets.Osu.Mods; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Scoring; -using static osu.Game.Rulesets.Scoring.Score; namespace osu.Game.Rulesets.Osu.Scoring { @@ -42,10 +41,10 @@ namespace osu.Game.Rulesets.Osu.Scoring mods = Score.Mods; accuracy = Score.Accuracy; scoreMaxCombo = Score.MaxCombo; - count300 = Convert.ToInt32(Score.Statistics[HitCount.Great]); - count100 = Convert.ToInt32(Score.Statistics[HitCount.Good]); - count50 = Convert.ToInt32(Score.Statistics[HitCount.Meh]); - countMiss = Convert.ToInt32(Score.Statistics[HitCount.Miss]); + count300 = Convert.ToInt32(Score.Statistics[HitResult.Great]); + count100 = Convert.ToInt32(Score.Statistics[HitResult.Good]); + count50 = Convert.ToInt32(Score.Statistics[HitResult.Meh]); + countMiss = Convert.ToInt32(Score.Statistics[HitResult.Miss]); // Don't count scores made with supposedly unranked mods if (mods.Any(m => !m.Ranked)) diff --git a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs index 1c376d7c63..7520e1801c 100644 --- a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs +++ b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs @@ -6,13 +6,11 @@ using System.Linq; using osu.Framework.Extensions; using osu.Game.Beatmaps; using osu.Game.Rulesets.Judgements; -using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Judgements; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; -using static osu.Game.Rulesets.Scoring.Score; namespace osu.Game.Rulesets.Osu.Scoring { @@ -64,10 +62,10 @@ namespace osu.Game.Rulesets.Osu.Scoring { base.PopulateScore(score); - score.Statistics[HitCount.Great] = scoreResultCounts.GetOrDefault(HitResult.Great); - score.Statistics[HitCount.Good] = scoreResultCounts.GetOrDefault(HitResult.Good); - score.Statistics[HitCount.Meh] = scoreResultCounts.GetOrDefault(HitResult.Meh); - score.Statistics[HitCount.Miss] = scoreResultCounts.GetOrDefault(HitResult.Miss); + score.Statistics[HitResult.Great] = scoreResultCounts.GetOrDefault(HitResult.Great); + score.Statistics[HitResult.Good] = scoreResultCounts.GetOrDefault(HitResult.Good); + score.Statistics[HitResult.Meh] = scoreResultCounts.GetOrDefault(HitResult.Meh); + score.Statistics[HitResult.Miss] = scoreResultCounts.GetOrDefault(HitResult.Miss); } protected override void OnNewJudgement(Judgement judgement) diff --git a/osu.Game.Rulesets.Taiko/Judgements/TaikoDrumRollTickJudgement.cs b/osu.Game.Rulesets.Taiko/Judgements/TaikoDrumRollTickJudgement.cs index c9daef8c99..ce5be8d148 100644 --- a/osu.Game.Rulesets.Taiko/Judgements/TaikoDrumRollTickJudgement.cs +++ b/osu.Game.Rulesets.Taiko/Judgements/TaikoDrumRollTickJudgement.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Taiko.Judgements { @@ -20,4 +20,4 @@ namespace osu.Game.Rulesets.Taiko.Judgements } } } -} \ No newline at end of file +} diff --git a/osu.Game.Rulesets.Taiko/Judgements/TaikoJudgement.cs b/osu.Game.Rulesets.Taiko/Judgements/TaikoJudgement.cs index 3cd134f3f7..70cdd1fe0e 100644 --- a/osu.Game.Rulesets.Taiko/Judgements/TaikoJudgement.cs +++ b/osu.Game.Rulesets.Taiko/Judgements/TaikoJudgement.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Rulesets.Judgements; -using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Taiko.Judgements { diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs index 75e988ced6..f5bafefd0b 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs @@ -13,6 +13,7 @@ using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Taiko.Objects.Drawables { diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs index e662f61bbe..a741e35963 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs @@ -4,6 +4,7 @@ using System; using osu.Framework.Graphics; using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Taiko.Judgements; using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs index fd35f0eaec..0c10c7142e 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs @@ -5,6 +5,7 @@ using System; using System.Linq; using osu.Framework.Graphics; using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Taiko.Judgements; using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHitStrong.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHitStrong.cs index cda82afe0e..249bb41d91 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHitStrong.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHitStrong.cs @@ -3,7 +3,7 @@ using System; using System.Linq; -using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Taiko.Judgements; namespace osu.Game.Rulesets.Taiko.Objects.Drawables diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs index 5ca33aaea2..26e6585fb9 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs @@ -14,6 +14,7 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics.Shapes; using osu.Game.Rulesets.Taiko.Judgements; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Taiko.Objects.Drawables { diff --git a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs index df9ce5e2eb..3848e36fc9 100644 --- a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs +++ b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs @@ -4,7 +4,6 @@ using System.Linq; using osu.Game.Beatmaps; using osu.Game.Rulesets.Judgements; -using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Taiko.Judgements; using osu.Game.Rulesets.Taiko.Objects; diff --git a/osu.Game.Rulesets.Taiko/Tests/TestCaseTaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/Tests/TestCaseTaikoPlayfield.cs index b1e6e9c4ce..1f13864c2a 100644 --- a/osu.Game.Rulesets.Taiko/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/Tests/TestCaseTaikoPlayfield.cs @@ -20,6 +20,7 @@ using osu.Game.Rulesets.Taiko.UI; using osu.Game.Tests.Beatmaps; using osu.Game.Tests.Visual; using OpenTK; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Taiko.Tests { diff --git a/osu.Game.Rulesets.Taiko/UI/DrawableTaikoJudgement.cs b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoJudgement.cs index 41b66c286b..0b67613ec3 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrawableTaikoJudgement.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoJudgement.cs @@ -6,6 +6,7 @@ using osu.Framework.Allocation; using osu.Game.Graphics; using osu.Game.Rulesets.Judgements; using osu.Framework.Graphics; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Taiko.UI { @@ -49,4 +50,4 @@ namespace osu.Game.Rulesets.Taiko.UI base.LoadComplete(); } } -} \ No newline at end of file +} diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs b/osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs index 75ec0481e8..ad15833569 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs @@ -14,7 +14,6 @@ using osu.Game.Rulesets.Scoring; using osu.Game.Users; using System.Collections.Generic; using osu.Framework.Graphics.Containers; -using static osu.Game.Rulesets.Scoring.Score; namespace osu.Game.Tests.Visual { @@ -161,9 +160,9 @@ namespace osu.Game.Tests.Visual }; foreach(var s in scores) { - s.Statistics.Add(HitCount.Great, RNG.Next(2000)); - s.Statistics.Add(HitCount.Good, RNG.Next(2000)); - s.Statistics.Add(HitCount.Meh, RNG.Next(2000)); + s.Statistics.Add(HitResult.Great, RNG.Next(2000)); + s.Statistics.Add(HitResult.Good, RNG.Next(2000)); + s.Statistics.Add(HitResult.Meh, RNG.Next(2000)); } anotherScores = new[] @@ -273,9 +272,9 @@ namespace osu.Game.Tests.Visual }; foreach (var s in anotherScores) { - s.Statistics.Add(HitCount.Great, RNG.Next(2000)); - s.Statistics.Add(HitCount.Good, RNG.Next(2000)); - s.Statistics.Add(HitCount.Meh, RNG.Next(2000)); + s.Statistics.Add(HitResult.Great, RNG.Next(2000)); + s.Statistics.Add(HitResult.Good, RNG.Next(2000)); + s.Statistics.Add(HitResult.Meh, RNG.Next(2000)); } topScore = new OnlineScore @@ -300,9 +299,9 @@ namespace osu.Game.Tests.Visual TotalScore = 987654321, Accuracy = 0.8487, }; - topScore.Statistics.Add(HitCount.Great, RNG.Next(2000)); - topScore.Statistics.Add(HitCount.Good, RNG.Next(2000)); - topScore.Statistics.Add(HitCount.Meh, RNG.Next(2000)); + topScore.Statistics.Add(HitResult.Great, RNG.Next(2000)); + topScore.Statistics.Add(HitResult.Good, RNG.Next(2000)); + topScore.Statistics.Add(HitResult.Meh, RNG.Next(2000)); } [BackgroundDependencyLoader] diff --git a/osu.Game.Tests/Visual/TestCaseResults.cs b/osu.Game.Tests/Visual/TestCaseResults.cs index 5190baff4e..5c474461cb 100644 --- a/osu.Game.Tests/Visual/TestCaseResults.cs +++ b/osu.Game.Tests/Visual/TestCaseResults.cs @@ -8,7 +8,6 @@ using osu.Game.Beatmaps; using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Ranking; using osu.Game.Users; -using static osu.Game.Rulesets.Scoring.Score; namespace osu.Game.Tests.Visual { @@ -42,12 +41,12 @@ namespace osu.Game.Tests.Visual MaxCombo = 123, Rank = ScoreRank.A, Date = DateTimeOffset.Now, - Statistics = new Dictionary + Statistics = new Dictionary { - { HitCount.Great, 50 }, - { HitCount.Good, 20 }, - { HitCount.Meh, 50 }, - { HitCount.Miss, 1 } + { HitResult.Great, 50 }, + { HitResult.Good, 20 }, + { HitResult.Meh, 50 }, + { HitResult.Miss, 1 } }, User = new User { diff --git a/osu.Game/Online/API/Requests/GetScoresRequest.cs b/osu.Game/Online/API/Requests/GetScoresRequest.cs index 9e5aa6d93f..14605081b6 100644 --- a/osu.Game/Online/API/Requests/GetScoresRequest.cs +++ b/osu.Game/Online/API/Requests/GetScoresRequest.cs @@ -122,20 +122,20 @@ namespace osu.Game.Online.API.Requests { foreach (var kvp in value) { - HitCount newKey; + HitResult newKey; switch (kvp.Key) { case @"count_300": - newKey = HitCount.Great; + newKey = HitResult.Great; break; case @"count_100": - newKey = HitCount.Good; + newKey = HitResult.Good; break; case @"count_50": - newKey = HitCount.Meh; + newKey = HitResult.Meh; break; case @"count_miss": - newKey = HitCount.Miss; + newKey = HitResult.Miss; break; default: continue; diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs index 301c62ee77..2d5913d8ca 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs @@ -12,10 +12,10 @@ using osu.Game.Graphics.Sprites; using osu.Game.Online.API.Requests; using osu.Game.Overlays.Profile.Sections.Ranks; using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; using osu.Game.Screens.Select.Leaderboards; using osu.Game.Users; -using static osu.Game.Rulesets.Scoring.Score; namespace osu.Game.Overlays.BeatmapSet.Scores { @@ -105,7 +105,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, - Text = $"{score.Statistics[HitCount.Great]}/{score.Statistics[HitCount.Good]}/{score.Statistics[HitCount.Meh]}", + Text = $"{score.Statistics[HitResult.Great]}/{score.Statistics[HitResult.Good]}/{score.Statistics[HitResult.Meh]}", Font = @"Exo2.0-RegularItalic", Margin = new MarginPadding { Right = side_margin } }, diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs index 612728ff4c..e3b878587d 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs @@ -18,7 +18,6 @@ using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; using osu.Game.Screens.Select.Leaderboards; using osu.Game.Users; -using static osu.Game.Rulesets.Scoring.Score; namespace osu.Game.Overlays.BeatmapSet.Scores { @@ -59,7 +58,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores totalScore.Value = $@"{score.TotalScore:N0}"; accuracy.Value = $@"{score.Accuracy:P2}"; - statistics.Value = $"{score.Statistics[HitCount.Great]}/{score.Statistics[HitCount.Good]}/{score.Statistics[HitCount.Meh]}"; + statistics.Value = $"{score.Statistics[HitResult.Great]}/{score.Statistics[HitResult.Good]}/{score.Statistics[HitResult.Meh]}"; modsContainer.Clear(); foreach (Mod mod in score.Mods) diff --git a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs index 5ab4b7636b..3d7880f56f 100644 --- a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs +++ b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs @@ -9,7 +9,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; -using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Judgements { diff --git a/osu.Game/Rulesets/Judgements/Judgement.cs b/osu.Game/Rulesets/Judgements/Judgement.cs index d804111a7f..f8c9b9734f 100644 --- a/osu.Game/Rulesets/Judgements/Judgement.cs +++ b/osu.Game/Rulesets/Judgements/Judgement.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Judgements { diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index af038909d2..45a7275c53 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -16,6 +16,7 @@ using osu.Game.Graphics; using osu.Framework.Configuration; using OpenTK; using osu.Framework.Graphics.Primitives; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Objects.Drawables { diff --git a/osu.Game/Rulesets/Objects/Drawables/HitResult.cs b/osu.Game/Rulesets/Scoring/HitResult.cs similarity index 91% rename from osu.Game/Rulesets/Objects/Drawables/HitResult.cs rename to osu.Game/Rulesets/Scoring/HitResult.cs index 961843cbd7..49ab9fd2f0 100644 --- a/osu.Game/Rulesets/Objects/Drawables/HitResult.cs +++ b/osu.Game/Rulesets/Scoring/HitResult.cs @@ -3,7 +3,7 @@ using System.ComponentModel; -namespace osu.Game.Rulesets.Objects.Drawables +namespace osu.Game.Rulesets.Scoring { public enum HitResult { diff --git a/osu.Game/Rulesets/Scoring/Score.cs b/osu.Game/Rulesets/Scoring/Score.cs index 56c7bc583f..025335ba55 100644 --- a/osu.Game/Rulesets/Scoring/Score.cs +++ b/osu.Game/Rulesets/Scoring/Score.cs @@ -7,7 +7,6 @@ using osu.Game.Beatmaps; using osu.Game.Rulesets.Mods; using osu.Game.Users; using osu.Game.Rulesets.Replays; -using System.ComponentModel; namespace osu.Game.Rulesets.Scoring { @@ -41,21 +40,6 @@ namespace osu.Game.Rulesets.Scoring public DateTimeOffset Date; - public Dictionary Statistics = new Dictionary(); - - public enum HitCount - { - [Description("300")] - Great, - - [Description("100")] - Good, - - [Description("50")] - Meh, - - [Description("x")] - Miss - } + public Dictionary Statistics = new Dictionary(); } } diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index e129a81116..23c4464bb1 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -8,7 +8,6 @@ using osu.Game.Beatmaps; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.UI; -using osu.Game.Rulesets.Objects.Drawables; namespace osu.Game.Rulesets.Scoring { diff --git a/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs b/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs index 06ef87276a..351db533f3 100644 --- a/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs +++ b/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs @@ -7,10 +7,10 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Game.Rulesets.Judgements; -using osu.Game.Rulesets.Objects.Drawables; using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics.Shapes; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Screens.Play.HUD { diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index 6d2aa8fce8..4b5f590dce 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -23,7 +23,6 @@ using osu.Game.Screens.Play; using osu.Game.Screens.Select.Leaderboards; using osu.Game.Users; using osu.Framework.Graphics.Shapes; -using static osu.Game.Rulesets.Scoring.Score; using osu.Framework.Extensions; namespace osu.Game.Screens.Ranking @@ -188,9 +187,9 @@ namespace osu.Game.Screens.Ranking private class DrawableScoreStatistic : Container { - private readonly KeyValuePair statistic; + private readonly KeyValuePair statistic; - public DrawableScoreStatistic(KeyValuePair statistic) + public DrawableScoreStatistic(KeyValuePair statistic) { this.statistic = statistic; diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 6cb12430c3..82b9f41567 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -612,7 +612,7 @@ - + From 61bbb669960eed59f443886b96288a75dd9aedcf Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Sat, 30 Dec 2017 21:27:15 +0100 Subject: [PATCH 164/169] sort resultpage hitresults descending HitCount was good to bad but HitResult is the opposite. To account for this just descending order on the result page. --- osu.Game/Screens/Ranking/ResultsPageScore.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index 4b5f590dce..b8098b3b4b 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -164,7 +164,7 @@ namespace osu.Game.Screens.Ranking } }; - statisticsContainer.ChildrenEnumerable = Score.Statistics.OrderBy(p => p.Key).Select(s => new DrawableScoreStatistic(s)); + statisticsContainer.ChildrenEnumerable = Score.Statistics.OrderByDescending(p => p.Key).Select(s => new DrawableScoreStatistic(s)); } protected override void LoadComplete() From d6af8ad748c6c5e6831670d4e5b8a37bbea7d133 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Sat, 30 Dec 2017 21:48:49 +0100 Subject: [PATCH 165/169] swap date and time in ResultsPageScore --- osu.Game/Screens/Ranking/ResultsPageScore.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index 25a42cae1c..f24ad1da14 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -250,16 +250,16 @@ namespace osu.Game.Screens.Ranking { Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, - Text = datetime.ToString("HH:mm"), - Padding = new MarginPadding { Left = 10, Right = 10, Top = 5, Bottom = 5 }, + Text = datetime.ToString("yyyy/MM/dd"), + Padding = new MarginPadding { Horizontal = 10, Vertical = 5 }, Colour = Color4.White, }, new OsuSpriteText { Origin = Anchor.CentreRight, Anchor = Anchor.CentreRight, - Text = datetime.ToString("yyyy/MM/dd"), - Padding = new MarginPadding { Left = 10, Right = 10, Top = 5, Bottom = 5 }, + Text = datetime.ToString("HH:mm"), + Padding = new MarginPadding { Horizontal = 10, Vertical = 5 }, Colour = Color4.White, } }; From 0dad9cbe53aa35f8946dc8e18229fa52cf6d546c Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Sat, 30 Dec 2017 21:49:05 +0100 Subject: [PATCH 166/169] change date to be more friendly to read --- osu.Game/Screens/Ranking/ResultsPageScore.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index f24ad1da14..993f192cd5 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -250,7 +250,7 @@ namespace osu.Game.Screens.Ranking { Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, - Text = datetime.ToString("yyyy/MM/dd"), + Text = datetime.ToString("dd/MM/yyyy"), Padding = new MarginPadding { Horizontal = 10, Vertical = 5 }, Colour = Color4.White, }, From 2a0699f13cae859af78c5c91747312c1bf6a8010 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Sat, 30 Dec 2017 22:41:01 +0100 Subject: [PATCH 167/169] use ToShortDateString to create a date depending on current culture --- osu.Game/Screens/Ranking/ResultsPageScore.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index 993f192cd5..59acc6a275 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -250,7 +250,7 @@ namespace osu.Game.Screens.Ranking { Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, - Text = datetime.ToString("dd/MM/yyyy"), + Text = datetime.ToShortDateString(), Padding = new MarginPadding { Horizontal = 10, Vertical = 5 }, Colour = Color4.White, }, From 301efb948ea00e75faccf47c8bfe51f601eb655f Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Sat, 30 Dec 2017 22:45:02 +0100 Subject: [PATCH 168/169] add required types to TestCase --- osu.Game.Tests/Visual/TestCaseResults.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/osu.Game.Tests/Visual/TestCaseResults.cs b/osu.Game.Tests/Visual/TestCaseResults.cs index d0c5aa4939..7a84742e7d 100644 --- a/osu.Game.Tests/Visual/TestCaseResults.cs +++ b/osu.Game.Tests/Visual/TestCaseResults.cs @@ -15,6 +15,15 @@ namespace osu.Game.Tests.Visual { private BeatmapManager beatmaps; + public override IReadOnlyList RequiredTypes => new[] + { + typeof(Score), + typeof(Results), + typeof(ResultsPage), + typeof(ResultsPageScore), + typeof(ResultsPageRanking) + }; + [BackgroundDependencyLoader] private void load(BeatmapManager beatmaps) { From 3d66b879a7ad36ec11fc672a6af1b19ffa49d319 Mon Sep 17 00:00:00 2001 From: Aergwyn Date: Sat, 30 Dec 2017 22:45:28 +0100 Subject: [PATCH 169/169] use ToShortTimeString to create a time depending on current culture --- osu.Game/Screens/Ranking/ResultsPageScore.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index 59acc6a275..9d778e0679 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -258,7 +258,7 @@ namespace osu.Game.Screens.Ranking { Origin = Anchor.CentreRight, Anchor = Anchor.CentreRight, - Text = datetime.ToString("HH:mm"), + Text = datetime.ToShortTimeString(), Padding = new MarginPadding { Horizontal = 10, Vertical = 5 }, Colour = Color4.White, }