From b020fe0d50c82a2eb2d38ff716c4546e90532417 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 23 Jun 2017 08:36:47 +0300 Subject: [PATCH 01/38] Added TestCase --- .../Tests/TestCaseBeatSyncedContainer.cs | 186 ++++++++++++++++++ 1 file changed, 186 insertions(+) create mode 100644 osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs new file mode 100644 index 0000000000..a8fa8bf218 --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs @@ -0,0 +1,186 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Testing; +using osu.Framework.Graphics; +using osu.Framework.Timing; +using osu.Game.Overlays; +using osu.Framework.Graphics.Containers; +using osu.Game.Graphics.Containers; +using osu.Framework.Audio.Track; +using osu.Game.Beatmaps.ControlPoints; +using osu.Framework.Graphics.Shapes; +using OpenTK.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Framework.Lists; +using System; +using System.Globalization; + +namespace osu.Desktop.VisualTests.Tests +{ + internal class TestCaseBeatSyncedContainer : TestCase + { + public override string Description => @"Tests beat synced containers."; + + private MusicController mc; + + public TestCaseBeatSyncedContainer() + { + Clock = new FramedClock(); + } + + public override void Reset() + { + base.Reset(); + Clock.ProcessFrame(); + + Add(new BeatContainer + { + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + }); + + Add(mc = new MusicController + { + Origin = Anchor.TopRight, + Anchor = Anchor.TopRight, + }); + mc.State = Visibility.Visible; + } + + private class BeatContainer : BeatSyncedContainer + { + private const int flash_layer_heigth = 150; + + private readonly InfoString timingPointCount; + private readonly InfoString currentTimingPoint; + private readonly InfoString beatCount; + private readonly InfoString currentBeat; + private readonly InfoString beatsPerMinute; + private readonly InfoString beatLength; + + private readonly Box flashLayer; + + public BeatContainer() + { + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + Children = new Drawable[] + { + new FillFlowContainer + { + Name = @"Info Layer", + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Direction = FillDirection.Vertical, + AutoSizeAxes = Axes.Both, + Margin = new MarginPadding { Bottom = flash_layer_heigth, }, + Children = new Drawable[] + { + timingPointCount = new InfoString(@"Timing points amount: "), + currentTimingPoint = new InfoString(@"Current timing point: "), + beatCount = new InfoString(@"Beats amount (in the current timing point): "), + currentBeat = new InfoString(@"Current beat: "), + beatsPerMinute = new InfoString(@"BPM: "), + beatLength = new InfoString(@"Beat length: "), + } + }, + new Container + { + Name = @"Color indicator", + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + RelativeSizeAxes = Axes.X, + Height = flash_layer_heigth, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, + }, + flashLayer = new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.White, + Alpha = 0, + } + } + } + }; + + Beatmap.ValueChanged += delegate + { + timingPointCount.Value = 0; + currentTimingPoint.Value = 0; + beatCount.Value = 0; + currentBeat.Value = 0; + beatsPerMinute.Value = 0; + beatLength.Value = 0; + }; + } + + private SortedList timingPoints => Beatmap.Value.Beatmap.ControlPointInfo.TimingPoints; + private TimingControlPoint getNextTimingPoint(TimingControlPoint current) + { + if (timingPoints[timingPoints.Count - 1] == current) + return current; + + return timingPoints[timingPoints.IndexOf(current) + 1]; + } + + private int calculateBeatCount(TimingControlPoint current) + { + if (timingPoints.IndexOf(current) + 1 == timingPoints.Count) + return (int)Math.Ceiling((Beatmap.Value.Track.Length - current.Time) / current.BeatLength); + + return (int)Math.Ceiling((getNextTimingPoint(current).Time - current.Time) / current.BeatLength); + } + + protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) + { + base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes); + + timingPointCount.Value = timingPoints.Count; + currentTimingPoint.Value = timingPoints.IndexOf(timingPoint) + 1; + beatCount.Value = calculateBeatCount(timingPoint); + currentBeat.Value = beatIndex + 1; + beatsPerMinute.Value = (float)Math.Round(60000 / timingPoint.BeatLength, 1); + beatLength.Value = (float)timingPoint.BeatLength; + + flashLayer.ClearTransforms(); + flashLayer.FadeTo(1); + flashLayer.FadeTo(0, timingPoint.BeatLength); + } + } + + private class InfoString : FillFlowContainer + { + private const int text_size = 20; + private const int margin = 7; + + private readonly OsuSpriteText valueText; + + private float? value; + public float Value + { + set + { + if (value == this.value) return; + this.value = value; + + valueText.Text = value.ToString(CultureInfo.CurrentCulture); + } + } + + public InfoString(string header) + { + AutoSizeAxes = Axes.Both; + Direction = FillDirection.Horizontal; + Add(new OsuSpriteText { Text = header, TextSize = text_size }); + Add(valueText = new OsuSpriteText() { TextSize = text_size }); + Margin = new MarginPadding { Vertical = margin, }; + } + } + } +} From 608f3fe8c5d5744da212d552f7e755d5b9494cab Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 23 Jun 2017 08:41:48 +0300 Subject: [PATCH 02/38] oops --- osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index de84e567d2..bd333c4df9 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -187,6 +187,7 @@ + From a59af5b0054a10c2f5f1f2b89bccaf37c56b8fa6 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 23 Jun 2017 10:01:28 +0300 Subject: [PATCH 03/38] Applied suggested changes --- .../Tests/TestCaseBeatSyncedContainer.cs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs index a8fa8bf218..d70e60cd93 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs @@ -57,7 +57,7 @@ namespace osu.Desktop.VisualTests.Tests private readonly InfoString beatCount; private readonly InfoString currentBeat; private readonly InfoString beatsPerMinute; - private readonly InfoString beatLength; + private readonly InfoString adjustedBeatLength; private readonly Box flashLayer; @@ -77,12 +77,12 @@ namespace osu.Desktop.VisualTests.Tests Margin = new MarginPadding { Bottom = flash_layer_heigth, }, Children = new Drawable[] { - timingPointCount = new InfoString(@"Timing points amount: "), - currentTimingPoint = new InfoString(@"Current timing point: "), - beatCount = new InfoString(@"Beats amount (in the current timing point): "), - currentBeat = new InfoString(@"Current beat: "), - beatsPerMinute = new InfoString(@"BPM: "), - beatLength = new InfoString(@"Beat length: "), + timingPointCount = new InfoString(@"Timing points amount"), + currentTimingPoint = new InfoString(@"Current timing point"), + beatCount = new InfoString(@"Beats amount (in the current timing point)"), + currentBeat = new InfoString(@"Current beat"), + beatsPerMinute = new InfoString(@"BPM"), + adjustedBeatLength = new InfoString(@"Beat length"), } }, new Container @@ -116,7 +116,7 @@ namespace osu.Desktop.VisualTests.Tests beatCount.Value = 0; currentBeat.Value = 0; beatsPerMinute.Value = 0; - beatLength.Value = 0; + adjustedBeatLength.Value = 0; }; } @@ -146,7 +146,7 @@ namespace osu.Desktop.VisualTests.Tests beatCount.Value = calculateBeatCount(timingPoint); currentBeat.Value = beatIndex + 1; beatsPerMinute.Value = (float)Math.Round(60000 / timingPoint.BeatLength, 1); - beatLength.Value = (float)timingPoint.BeatLength; + adjustedBeatLength.Value = (float)timingPoint.BeatLength; flashLayer.ClearTransforms(); flashLayer.FadeTo(1); @@ -177,7 +177,7 @@ namespace osu.Desktop.VisualTests.Tests { AutoSizeAxes = Axes.Both; Direction = FillDirection.Horizontal; - Add(new OsuSpriteText { Text = header, TextSize = text_size }); + Add(new OsuSpriteText { Text = header + @": ", TextSize = text_size }); Add(valueText = new OsuSpriteText() { TextSize = text_size }); Margin = new MarginPadding { Vertical = margin, }; } From 3150bdb54b75d33b76a98f92dd1dd8fed63ee7ba Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 23 Jun 2017 14:56:43 +0300 Subject: [PATCH 04/38] Fixed wrong display string --- osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs index d70e60cd93..c0d2b04bcb 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs @@ -82,7 +82,7 @@ namespace osu.Desktop.VisualTests.Tests beatCount = new InfoString(@"Beats amount (in the current timing point)"), currentBeat = new InfoString(@"Current beat"), beatsPerMinute = new InfoString(@"BPM"), - adjustedBeatLength = new InfoString(@"Beat length"), + adjustedBeatLength = new InfoString(@"Adjusted beat length"), } }, new Container From ba783f984cb964cc6317126c33bb0742405b7980 Mon Sep 17 00:00:00 2001 From: MrTheMake Date: Sat, 24 Jun 2017 13:36:57 +0200 Subject: [PATCH 05/38] Change usage of ScrollIntoView to ScrollTo in the setttings overlay --- osu.Game/Overlays/SettingsOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/SettingsOverlay.cs b/osu.Game/Overlays/SettingsOverlay.cs index 88f4599383..5677bbcad9 100644 --- a/osu.Game/Overlays/SettingsOverlay.cs +++ b/osu.Game/Overlays/SettingsOverlay.cs @@ -93,7 +93,7 @@ namespace osu.Game.Overlays new SidebarButton { Section = section, - Action = sectionsContainer.ScrollContainer.ScrollIntoView, + Action = sectionsContainer.ScrollContainer.ScrollTo, } ).ToArray() } From d914a1b00ef20bbc88082d3760775a4b4a363252 Mon Sep 17 00:00:00 2001 From: MrTheMake Date: Sat, 24 Jun 2017 13:47:34 +0200 Subject: [PATCH 06/38] Added animation parameter --- osu.Game/Overlays/Settings/SidebarButton.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Settings/SidebarButton.cs b/osu.Game/Overlays/Settings/SidebarButton.cs index 309216dd91..8d5e0e96b7 100644 --- a/osu.Game/Overlays/Settings/SidebarButton.cs +++ b/osu.Game/Overlays/Settings/SidebarButton.cs @@ -22,7 +22,7 @@ namespace osu.Game.Overlays.Settings private readonly Box backgroundBox; private readonly Box selectionIndicator; private readonly Container text; - public Action Action; + public Action Action; private SettingsSection section; public SettingsSection Section @@ -112,7 +112,7 @@ namespace osu.Game.Overlays.Settings protected override bool OnClick(InputState state) { - Action?.Invoke(section); + Action?.Invoke(section, true); backgroundBox.FlashColour(Color4.White, 400); return true; } From 40225238d96b78e1544f1f18721211d0174fb422 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Wed, 28 Jun 2017 12:24:23 +0300 Subject: [PATCH 07/38] Set RelativeSizeAxes for updated FillMode behavior --- osu-framework | 2 +- osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs | 1 + osu.Game/Graphics/Backgrounds/Background.cs | 1 + osu.Game/Overlays/Direct/DirectPanel.cs | 1 + osu.Game/Overlays/MusicController.cs | 1 + osu.Game/Screens/Multiplayer/RoomInspector.cs | 1 + osu.Game/Screens/Play/PlayerLoader.cs | 1 + osu.Game/Screens/Ranking/Results.cs | 1 + osu.Game/Screens/Ranking/ResultsPageScore.cs | 1 + osu.Game/Screens/Select/BeatmapInfoWedge.cs | 1 + osu.Game/Screens/Select/Leaderboards/DrawableRank.cs | 1 + osu.Game/Screens/Tournament/Drawings.cs | 1 + osu.Game/Screens/Tournament/Group.cs | 2 +- osu.Game/Users/Avatar.cs | 1 + osu.Game/Users/UserPanel.cs | 1 + 15 files changed, 15 insertions(+), 2 deletions(-) diff --git a/osu-framework b/osu-framework index a5e66079b9..3fffad110c 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit a5e66079b9df3cf74a8bd1431c1cb7faad3c4d9f +Subproject commit 3fffad110c0d019146944735ac2dcb8a37f98f8b diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs index 1ac6261621..b59dbac722 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs @@ -93,6 +93,7 @@ namespace osu.Game.Beatmaps.Drawables { new BeatmapBackgroundSprite(working) { + RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, FillMode = FillMode.Fill, diff --git a/osu.Game/Graphics/Backgrounds/Background.cs b/osu.Game/Graphics/Backgrounds/Background.cs index 7c47635276..8eb2ddc0ab 100644 --- a/osu.Game/Graphics/Backgrounds/Background.cs +++ b/osu.Game/Graphics/Backgrounds/Background.cs @@ -26,6 +26,7 @@ namespace osu.Game.Graphics.Backgrounds Add(Sprite = new Sprite { + RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, Colour = Color4.DarkGray, diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index f8acad1f59..3c708bff67 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -38,6 +38,7 @@ namespace osu.Game.Overlays.Direct { return new AsyncLoadWrapper(new BeatmapBackgroundSprite(new OnlineWorkingBeatmap(SetInfo.Beatmaps.FirstOrDefault(), textures, null)) { + RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fill, OnLoadComplete = d => d.FadeInFromZero(400, EasingTypes.Out), }) { RelativeSizeAxes = Axes.Both }; diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index e1e920ec0f..181046f3ff 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -397,6 +397,7 @@ namespace osu.Game.Overlays { sprite = new Sprite { + RelativeSizeAxes = Axes.Both, Colour = OsuColour.Gray(150), FillMode = FillMode.Fill, }, diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index f9e015eceb..3a822be791 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -438,6 +438,7 @@ namespace osu.Game.Screens.Multiplayer { new AsyncLoadWrapper(new BeatmapBackgroundSprite(new OnlineWorkingBeatmap(value, textures, null)) { + RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, FillMode = FillMode.Fill, diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 726397a3b1..c8ebb1f436 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -227,6 +227,7 @@ namespace osu.Game.Screens.Play { new Sprite { + RelativeSizeAxes = Axes.Both, Texture = beatmap?.Background, Origin = Anchor.Centre, Anchor = Anchor.Centre, diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index 2bff535603..dac83536ed 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -163,6 +163,7 @@ namespace osu.Game.Screens.Ranking { new Sprite { + RelativeSizeAxes = Axes.Both, Alpha = 0.2f, Texture = Beatmap?.Background, Anchor = Anchor.Centre, diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index 15e8e4bfcd..96e63585bf 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -343,6 +343,7 @@ namespace osu.Game.Screens.Ranking { cover = new Sprite { + RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fill, Anchor = Anchor.Centre, Origin = Anchor.Centre, diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 264fe6643b..42f9598096 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -152,6 +152,7 @@ namespace osu.Game.Screens.Select // Zoomed-in and cropped beatmap background new BeatmapBackgroundSprite(beatmap) { + RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, FillMode = FillMode.Fill, diff --git a/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs b/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs index 647398db9e..6329729687 100644 --- a/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs +++ b/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs @@ -31,6 +31,7 @@ namespace osu.Game.Screens.Select.Leaderboards { rankSprite = new Sprite { + RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, FillMode = FillMode.Fit diff --git a/osu.Game/Screens/Tournament/Drawings.cs b/osu.Game/Screens/Tournament/Drawings.cs index 7efb86a403..246fa17e85 100644 --- a/osu.Game/Screens/Tournament/Drawings.cs +++ b/osu.Game/Screens/Tournament/Drawings.cs @@ -82,6 +82,7 @@ namespace osu.Game.Screens.Tournament }, new Sprite { + RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fill, Texture = textures.Get(@"Backgrounds/Drawings/background.png") }, diff --git a/osu.Game/Screens/Tournament/Group.cs b/osu.Game/Screens/Tournament/Group.cs index 441a5c7bcd..bd13ced2cd 100644 --- a/osu.Game/Screens/Tournament/Group.cs +++ b/osu.Game/Screens/Tournament/Group.cs @@ -151,9 +151,9 @@ namespace osu.Game.Screens.Tournament { flagSprite = new Sprite { + RelativeSizeAxes = Axes.Both, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - FillMode = FillMode.Fit }, new OsuSpriteText diff --git a/osu.Game/Users/Avatar.cs b/osu.Game/Users/Avatar.cs index b032187624..5d518f1780 100644 --- a/osu.Game/Users/Avatar.cs +++ b/osu.Game/Users/Avatar.cs @@ -31,6 +31,7 @@ namespace osu.Game.Users Add(new Sprite { + RelativeSizeAxes = Axes.Both, Texture = texture, FillMode = FillMode.Fit, Anchor = Anchor.Centre, diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index 8cff3517a3..881aaf2e07 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -46,6 +46,7 @@ namespace osu.Game.Users { new AsyncLoadWrapper(new CoverBackgroundSprite(user) { + RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, FillMode = FillMode.Fill, From b6fdbd61283a1b6bd10665afa6315e96849c3b78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Fri, 30 Jun 2017 09:53:05 +0300 Subject: [PATCH 08/38] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 25b660ce32..2fdf4a83c5 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 25b660ce322922abbb9be53caca2041c0e0c3ba0 +Subproject commit 2fdf4a83c538a49df5647c68971a9f6a5611efbf From 5c02f1812f183b33aaa2d26b72948b1b5cf184f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Fri, 30 Jun 2017 09:53:52 +0300 Subject: [PATCH 09/38] Remove now unneeded Contains overrides --- osu.Game/Graphics/UserInterface/OsuTabControl.cs | 2 -- osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs | 2 -- 2 files changed, 4 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index c60a937440..df7238a6c6 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -23,8 +23,6 @@ namespace osu.Game.Graphics.UserInterface protected override TabItem CreateTabItem(T value) => new OsuTabItem(value); - public override bool Contains(Vector2 screenSpacePos) => base.Contains(screenSpacePos) || Dropdown.Contains(screenSpacePos); - private bool isEnumType => typeof(T).IsEnum; public OsuTabControl() diff --git a/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs index b5ec70b9e2..148a3a5d1c 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs @@ -29,8 +29,6 @@ namespace osu.Game.Overlays.SearchableList protected abstract T DefaultTab { get; } protected virtual Drawable CreateSupplementaryControls() => null; - public override bool Contains(Vector2 screenSpacePos) => base.Contains(screenSpacePos) || DisplayStyleControl.Dropdown.Contains(screenSpacePos); - protected SearchableListFilterControl() { if (!typeof(T).IsEnum) From bb15bc0467230740c784c414429ebf895bf5a4ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Fri, 30 Jun 2017 09:54:03 +0300 Subject: [PATCH 10/38] Use ReceiveMouseInputAt whenever possible --- osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs | 2 +- osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs | 2 +- osu.Game/Graphics/Cursor/CursorTrail.cs | 2 +- osu.Game/Graphics/UserInterface/BreadcrumbControl.cs | 2 +- osu.Game/Graphics/UserInterface/DialogButton.cs | 2 +- osu.Game/Graphics/UserInterface/TwoLayerButton.cs | 2 +- osu.Game/Overlays/ChatOverlay.cs | 2 +- osu.Game/Screens/Menu/Button.cs | 2 +- osu.Game/Screens/Menu/OsuLogo.cs | 2 +- osu.Game/Screens/Play/KeyCounterCollection.cs | 2 +- osu.Game/Screens/Play/KeyCounterMouse.cs | 2 +- osu.Game/Screens/Select/FilterControl.cs | 2 +- osu.Game/Screens/Select/Footer.cs | 2 +- osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs index 4857f5c0d2..9a114aa72c 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -118,7 +118,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces base.Update(); if (Time.Current < slider.EndTime) - Tracking = canCurrentlyTrack && lastState != null && Contains(lastState.Mouse.NativeState.Position) && lastState.Mouse.HasMainButtonPressed; + Tracking = canCurrentlyTrack && lastState != null && ReceiveMouseInputAt(lastState.Mouse.NativeState.Position) && lastState.Mouse.HasMainButtonPressed; } public void UpdateProgress(double progress, int repeat) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs index 234aa8d055..f3ddf683d2 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs @@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces }; } - public override bool Contains(Vector2 screenSpacePos) => true; + public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; private bool tracking; public bool Tracking diff --git a/osu.Game/Graphics/Cursor/CursorTrail.cs b/osu.Game/Graphics/Cursor/CursorTrail.cs index bbebc7e1b1..035f6f98b0 100644 --- a/osu.Game/Graphics/Cursor/CursorTrail.cs +++ b/osu.Game/Graphics/Cursor/CursorTrail.cs @@ -74,7 +74,7 @@ namespace osu.Game.Graphics.Cursor } } - public override bool Contains(Vector2 screenSpacePos) => true; + public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; [BackgroundDependencyLoader] private void load(ShaderManager shaders, TextureStore textures) diff --git a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs index c284398240..155b08fde8 100644 --- a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs +++ b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs @@ -38,7 +38,7 @@ namespace osu.Game.Graphics.UserInterface public readonly TextAwesome Chevron; //don't allow clicking between transitions and don't make the chevron clickable - public override bool Contains(Vector2 screenSpacePos) => Alpha == 1f && Text.Contains(screenSpacePos); + public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => Alpha == 1f && Text.ReceiveMouseInputAt(screenSpacePos); public override bool HandleInput => State == Visibility.Visible; private Visibility state; diff --git a/osu.Game/Graphics/UserInterface/DialogButton.cs b/osu.Game/Graphics/UserInterface/DialogButton.cs index 47f628f96c..253f902438 100644 --- a/osu.Game/Graphics/UserInterface/DialogButton.cs +++ b/osu.Game/Graphics/UserInterface/DialogButton.cs @@ -93,7 +93,7 @@ namespace osu.Game.Graphics.UserInterface private bool didClick; // Used for making sure that the OnMouseDown animation can call instead of OnHoverLost's when clicking - public override bool Contains(Vector2 screenSpacePos) => backgroundContainer.Contains(screenSpacePos); + public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => backgroundContainer.ReceiveMouseInputAt(screenSpacePos); protected override bool OnClick(Framework.Input.InputState state) { diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index b188e782e2..c774fad0e1 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -171,7 +171,7 @@ namespace osu.Game.Graphics.UserInterface } } - public override bool Contains(Vector2 screenSpacePos) => IconLayer.Contains(screenSpacePos) || TextLayer.Contains(screenSpacePos); + public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => IconLayer.ReceiveMouseInputAt(screenSpacePos) || TextLayer.ReceiveMouseInputAt(screenSpacePos); protected override bool OnHover(InputState state) { diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 97c7907874..37dc61e072 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -59,7 +59,7 @@ namespace osu.Game.Overlays private readonly Container channelSelectionContainer; private readonly ChannelSelectionOverlay channelSelection; - public override bool Contains(Vector2 screenSpacePos) => chatContainer.Contains(screenSpacePos) || channelSelection.State == Visibility.Visible && channelSelection.Contains(screenSpacePos); + public override bool Contains(Vector2 screenSpacePos) => chatContainer.ReceiveMouseInputAt(screenSpacePos) || channelSelection.State == Visibility.Visible && channelSelection.ReceiveMouseInputAt(screenSpacePos); public ChatOverlay() { diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index cdff79c94f..76d9eac5c5 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -35,7 +35,7 @@ namespace osu.Game.Screens.Menu private readonly Key triggerKey; private SampleChannel sampleClick; - public override bool Contains(Vector2 screenSpacePos) => box.Contains(screenSpacePos); + public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => box.ReceiveMouseInputAt(screenSpacePos); public Button(string text, string internalName, FontAwesome symbol, Color4 colour, Action clickAction = null, float extraWidth = 0, Key triggerKey = Key.Unknown) { diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 7b7f4a9df6..d7d89fe0ff 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -57,7 +57,7 @@ namespace osu.Game.Screens.Menu set { colourAndTriangles.Alpha = value ? 1 : 0; } } - public override bool Contains(Vector2 screenSpacePos) => logoContainer.Contains(screenSpacePos); + public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => logoContainer.ReceiveMouseInputAt(screenSpacePos); public bool Ripple { diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index 88522e23ab..b4b2691390 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -127,7 +127,7 @@ namespace osu.Game.Screens.Play this.target = target; } - public override bool Contains(Vector2 screenSpacePos) => true; + public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; public override bool HandleInput => true; diff --git a/osu.Game/Screens/Play/KeyCounterMouse.cs b/osu.Game/Screens/Play/KeyCounterMouse.cs index 3f3b44aef9..12ec976316 100644 --- a/osu.Game/Screens/Play/KeyCounterMouse.cs +++ b/osu.Game/Screens/Play/KeyCounterMouse.cs @@ -16,7 +16,7 @@ namespace osu.Game.Screens.Play Button = button; } - public override bool Contains(Vector2 screenSpacePos) => true; + public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; private static string getStringRepresentation(MouseButton button) { diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 6d732b58e4..4cc357a01b 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -67,7 +67,7 @@ namespace osu.Game.Screens.Select private readonly SearchTextBox searchTextBox; - public override bool Contains(Vector2 screenSpacePos) => base.Contains(screenSpacePos) || groupTabs.Contains(screenSpacePos) || sortTabs.Contains(screenSpacePos); + public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => base.ReceiveMouseInputAt(screenSpacePos) || groupTabs.ReceiveMouseInputAt(screenSpacePos) || sortTabs.ReceiveMouseInputAt(screenSpacePos); public FilterControl() { diff --git a/osu.Game/Screens/Select/Footer.cs b/osu.Game/Screens/Select/Footer.cs index 613c666b92..ddb808c5e4 100644 --- a/osu.Game/Screens/Select/Footer.cs +++ b/osu.Game/Screens/Select/Footer.cs @@ -124,7 +124,7 @@ namespace osu.Game.Screens.Select updateModeLight(); } - public override bool Contains(Vector2 screenSpacePos) => base.Contains(screenSpacePos) || StartButton.Contains(screenSpacePos); + public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => base.ReceiveMouseInputAt(screenSpacePos) || StartButton.ReceiveMouseInputAt(screenSpacePos); protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs index 942d3a6a32..e013b0a223 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs @@ -83,7 +83,7 @@ namespace osu.Game.Screens.Select.Options return false; } - public override bool Contains(Vector2 screenSpacePos) => box.Contains(screenSpacePos); + public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => box.ReceiveMouseInputAt(screenSpacePos); public BeatmapOptionsButton() { From bbae6e259051336c95c7c09227805b5aa8cd9e4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Fri, 30 Jun 2017 10:02:07 +0300 Subject: [PATCH 11/38] Remove unnecessary using --- osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs index 148a3a5d1c..8db802ad3d 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; From 2d7eefa6fe2bcb71e8a080b25ab6bc708fcb561c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sun, 2 Jul 2017 13:00:02 +0300 Subject: [PATCH 12/38] Update Cached usage according to framework --- osu-framework | 2 +- .../Overlays/Toolbar/ToolbarModeSelector.cs | 7 +++++-- .../Rulesets/Timing/DrawableTimingSection.cs | 17 +++++++++-------- osu.Game/Screens/Play/SquareGraph.cs | 7 ++++++- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/osu-framework b/osu-framework index bb8c723ad1..85541286b8 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit bb8c723ad135a2935a499c45f23c45bd14f3daa4 +Subproject commit 85541286b805120b8fa371eea60b15a4bcaff867 diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs index 59c4ac4a61..95906464ec 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs @@ -113,8 +113,11 @@ namespace osu.Game.Overlays.Toolbar { base.UpdateAfterChildren(); - if (!activeMode.EnsureValid()) - activeMode.Refresh(() => modeButtonLine.MoveToX(activeButton.DrawPosition.X, 200, EasingTypes.OutQuint)); + if (!activeMode.IsValid) + { + modeButtonLine.MoveToX(activeButton.DrawPosition.X, 200, EasingTypes.OutQuint); + activeMode.Validate(); + } } } } diff --git a/osu.Game/Rulesets/Timing/DrawableTimingSection.cs b/osu.Game/Rulesets/Timing/DrawableTimingSection.cs index 3ad9f23605..1dc7099aa8 100644 --- a/osu.Game/Rulesets/Timing/DrawableTimingSection.cs +++ b/osu.Game/Rulesets/Timing/DrawableTimingSection.cs @@ -81,13 +81,8 @@ namespace osu.Game.Rulesets.Timing } private Cached durationBacking = new Cached(); - /// - /// The maximum duration of any one hit object inside this . This is calculated as the maximum - /// end time between all hit objects relative to this 's . - /// - public double Duration => durationBacking.EnsureValid() - ? durationBacking.Value - : durationBacking.Refresh(() => + + private double computeDuration() { if (!Children.Any()) return 0; @@ -117,7 +112,13 @@ namespace osu.Game.Rulesets.Timing baseDuration *= 1 + maxAbsoluteSize / ourAbsoluteSize; return baseDuration; - }); + } + + /// + /// The maximum duration of any one hit object inside this . This is calculated as the maximum + /// end time between all hit objects relative to this 's . + /// + public double Duration => durationBacking.IsValid ? durationBacking : (durationBacking.Value = computeDuration()); protected override void Update() { diff --git a/osu.Game/Screens/Play/SquareGraph.cs b/osu.Game/Screens/Play/SquareGraph.cs index cd1e9c78c6..f3bb523611 100644 --- a/osu.Game/Screens/Play/SquareGraph.cs +++ b/osu.Game/Screens/Play/SquareGraph.cs @@ -77,7 +77,12 @@ namespace osu.Game.Screens.Play protected override void Update() { base.Update(); - layout.Refresh(recreateGraph); + + if (!layout.IsValid) + { + recreateGraph(); + layout.Validate(); + } } /// From 3f8ddaaa236fc5790342b9b3ff296352891d5e22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sun, 2 Jul 2017 13:09:56 +0300 Subject: [PATCH 13/38] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 85541286b8..5aa49c2ba8 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 85541286b805120b8fa371eea60b15a4bcaff867 +Subproject commit 5aa49c2ba8dc6c4f2f829715f2bd73df4e7d1c77 From c9784f57d30893bdd8e73c18d54aa2a3595ef238 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Sun, 2 Jul 2017 13:16:22 +0200 Subject: [PATCH 14/38] fix mod button samples --- osu.Game/Overlays/Mods/ModButton.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index 8a04d91cfb..b86a35484d 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -151,8 +151,8 @@ namespace osu.Game.Overlays.Mods [BackgroundDependencyLoader] private void load(AudioManager audio) { - sampleOn = audio.Sample.Get(@"Checkbox/check-on"); - sampleOff = audio.Sample.Get(@"Checkbox/check-off"); + sampleOn = audio.Sample.Get(@"UI/check-on"); + sampleOff = audio.Sample.Get(@"UI/check-off"); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) @@ -171,7 +171,7 @@ namespace osu.Game.Overlays.Mods public void SelectNext() { - (++SelectedIndex == -1 ? sampleOff : sampleOn).Play(); + (++SelectedIndex == Mods.Count() ? sampleOff : sampleOn).Play(); Action?.Invoke(SelectedMod); } From 5df33ad2d727e709941a8be0551474540e07d461 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Sun, 2 Jul 2017 13:33:42 +0200 Subject: [PATCH 15/38] use Length instead of Count() --- osu.Game/Overlays/Mods/ModButton.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index b86a35484d..a7e7bb53b5 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -171,7 +171,7 @@ namespace osu.Game.Overlays.Mods public void SelectNext() { - (++SelectedIndex == Mods.Count() ? sampleOff : sampleOn).Play(); + (++SelectedIndex == Mods.Length ? sampleOff : sampleOn).Play(); Action?.Invoke(SelectedMod); } From 192600066c67a855274de052869ca40ceee299e7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 5 Jul 2017 13:38:04 -0700 Subject: [PATCH 16/38] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 5aa49c2ba8..672e318d54 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 5aa49c2ba8dc6c4f2f829715f2bd73df4e7d1c77 +Subproject commit 672e318d541f6a7106a0a2b088dd3ec5e8bff5db From 2f8e6f20a6a783a6a2fbd8a37e4ca15ae758a017 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 5 Jul 2017 13:46:53 -0700 Subject: [PATCH 17/38] Fix CI issues --- osu.Game/Rulesets/Timing/DrawableTimingSection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Timing/DrawableTimingSection.cs b/osu.Game/Rulesets/Timing/DrawableTimingSection.cs index 1dc7099aa8..589ee9991d 100644 --- a/osu.Game/Rulesets/Timing/DrawableTimingSection.cs +++ b/osu.Game/Rulesets/Timing/DrawableTimingSection.cs @@ -80,7 +80,7 @@ namespace osu.Game.Rulesets.Timing base.InvalidateFromChild(invalidation); } - private Cached durationBacking = new Cached(); + private Cached durationBacking; private double computeDuration() { From d68f17b697c0287f8c519ddf96807accad8c3c32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Thu, 6 Jul 2017 15:15:12 +0300 Subject: [PATCH 18/38] Use tooltip and context menu containers as newly required --- osu-framework | 2 +- osu-resources | 2 +- .../Cursor/OsuContextMenuContainer.cs | 4 ---- osu.Game/OsuGameBase.cs | 20 +++++++++---------- 4 files changed, 11 insertions(+), 17 deletions(-) diff --git a/osu-framework b/osu-framework index 672e318d54..47ad455b71 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 672e318d541f6a7106a0a2b088dd3ec5e8bff5db +Subproject commit 47ad455b7160b9b936bac1610e4bae8db0c74165 diff --git a/osu-resources b/osu-resources index 900f47563f..76656c51f2 160000 --- a/osu-resources +++ b/osu-resources @@ -1 +1 @@ -Subproject commit 900f47563f5598eef7cbf203f0b3f2166508b6d5 +Subproject commit 76656c51f281e7934159e9ed4414378fef24d130 diff --git a/osu.Game/Graphics/Cursor/OsuContextMenuContainer.cs b/osu.Game/Graphics/Cursor/OsuContextMenuContainer.cs index 2cc6c3a46a..9162fd6893 100644 --- a/osu.Game/Graphics/Cursor/OsuContextMenuContainer.cs +++ b/osu.Game/Graphics/Cursor/OsuContextMenuContainer.cs @@ -10,9 +10,5 @@ namespace osu.Game.Graphics.Cursor public class OsuContextMenuContainer : ContextMenuContainer { protected override ContextMenu CreateContextMenu() => new OsuContextMenu(); - - public OsuContextMenuContainer(CursorContainer cursor) : base(cursor) - { - } } } \ No newline at end of file diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 5e73ea55e6..71ac8af08d 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -37,9 +37,9 @@ namespace osu.Game public APIAccess API; - protected override Container Content => ratioContainer; + private Container content; - private RatioAdjust ratioContainer; + protected override Container Content => content; protected MenuCursor Cursor; @@ -146,21 +146,19 @@ namespace osu.Game { base.LoadComplete(); - base.Content.Add(ratioContainer = new RatioAdjust + base.Content.Add(new RatioAdjust { Children = new Drawable[] { - new Container + Cursor = new MenuCursor(), + new OsuTooltipContainer(Cursor) { RelativeSizeAxes = Axes.Both, - Depth = float.MinValue, - Children = new Drawable[] + Child = content = new OsuContextMenuContainer { - Cursor = new MenuCursor(), - new OsuContextMenuContainer(Cursor) { Depth = -2 }, - new OsuTooltipContainer(Cursor) { Depth = -1 }, - } - }, + RelativeSizeAxes = Axes.Both, + }, + } } }); From eb647658484bdfd6370fca0873476304885a4727 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Thu, 6 Jul 2017 15:44:05 +0300 Subject: [PATCH 19/38] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 47ad455b71..862e478219 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 47ad455b7160b9b936bac1610e4bae8db0c74165 +Subproject commit 862e478219a376f769a7ecb32f6fa135fd69cb26 From 6de9776e05686e873af0124c13c4c7b19f6e3f68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Fri, 7 Jul 2017 08:59:17 +0300 Subject: [PATCH 20/38] Update framework with tooltip changes --- osu-framework | 2 +- osu.Game/Graphics/Cursor/OsuTooltipContainer.cs | 2 +- osu.Game/Overlays/ChatOverlay.cs | 2 +- osu.Game/Screens/Menu/OsuLogo.cs | 2 +- osu.Game/Screens/Play/SkipButton.cs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/osu-framework b/osu-framework index 862e478219..c966b1b9d0 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 862e478219a376f769a7ecb32f6fa135fd69cb26 +Subproject commit c966b1b9d035f8b1df5ee81db7aae112ac374847 diff --git a/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs b/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs index 133caf8040..7608a366dc 100644 --- a/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs +++ b/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs @@ -15,7 +15,7 @@ namespace osu.Game.Graphics.Cursor { public class OsuTooltipContainer : TooltipContainer { - protected override Tooltip CreateTooltip() => new OsuTooltip(); + protected override ITooltip CreateTooltip() => new OsuTooltip(); public OsuTooltipContainer(CursorContainer cursor) : base(cursor) { diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 5fcdf22122..700889ed26 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -194,7 +194,7 @@ namespace osu.Game.Overlays protected override bool OnDragStart(InputState state) { - if (!channelTabs.Hovering) + if (!channelTabs.IsHovered) return base.OnDragStart(state); startDragChatHeight = chatHeight.Value; diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index b26cbe02ba..efbd106cb5 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -236,7 +236,7 @@ namespace osu.Game.Screens.Menu if (beatIndex < 0) return; - if (Hovering) + if (IsHovered) { using (BeginDelayedSequence(early_activation)) Schedule(() => sampleBeat.Play()); diff --git a/osu.Game/Screens/Play/SkipButton.cs b/osu.Game/Screens/Play/SkipButton.cs index 4a81ce90ff..a3ee2aeb72 100644 --- a/osu.Game/Screens/Play/SkipButton.cs +++ b/osu.Game/Screens/Play/SkipButton.cs @@ -156,7 +156,7 @@ namespace osu.Game.Screens.Play if (lastState == Visibility.Hidden) FadeIn(500, EasingTypes.OutExpo); - if (!Hovering) + if (!IsHovered) using (BeginDelayedSequence(1000)) scheduledHide = Schedule(() => State = Visibility.Hidden); break; From 26c40105e2a4ed09923221f0de9dff4768901785 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Fri, 7 Jul 2017 10:22:07 +0300 Subject: [PATCH 21/38] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index c966b1b9d0..cd2b351de3 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit c966b1b9d035f8b1df5ee81db7aae112ac374847 +Subproject commit cd2b351de37f17b6d91d1fc062627208a09c3834 From 22a987f6cca0f754e8ff4dd4c90866a33736f3a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Fri, 7 Jul 2017 15:05:55 +0300 Subject: [PATCH 22/38] Update test cases to new framework and fix old crashes --- osu-framework | 2 +- .../Tests/TestCaseBeatmapDetailArea.cs | 4 +- .../Tests/TestCaseBeatmapDetails.cs | 4 +- .../Tests/TestCaseBeatmapOptionsOverlay.cs | 4 +- .../Tests/TestCaseBreadcrumbs.cs | 4 +- .../Tests/TestCaseChatDisplay.cs | 4 +- .../Tests/TestCaseContextMenu.cs | 4 +- .../Tests/TestCaseDialogOverlay.cs | 4 +- .../Tests/TestCaseDirect.cs | 4 +- .../Tests/TestCaseDrawableRoom.cs | 4 +- .../Tests/TestCaseDrawings.cs | 4 +- .../Tests/TestCaseGamefield.cs | 4 +- .../Tests/TestCaseGraph.cs | 4 +- .../Tests/TestCaseHitObjects.cs | 93 +++++++++---------- .../Tests/TestCaseKeyCounter.cs | 4 +- .../Tests/TestCaseLeaderboard.cs | 4 +- .../Tests/TestCaseManiaHitObjects.cs | 4 +- .../Tests/TestCaseManiaPlayfield.cs | 4 +- .../Tests/TestCaseMenuButtonSystem.cs | 4 +- .../Tests/TestCaseMenuOverlays.cs | 4 +- osu.Desktop.VisualTests/Tests/TestCaseMods.cs | 4 +- .../Tests/TestCaseMusicController.cs | 5 - .../Tests/TestCaseNotificationManager.cs | 4 +- .../Tests/TestCaseOnScreenDisplay.cs | 4 +- .../Tests/TestCasePlaySongSelect.cs | 3 +- .../Tests/TestCasePlayer.cs | 67 ++++++------- .../Tests/TestCaseReplaySettingsOverlay.cs | 4 +- .../Tests/TestCaseResults.cs | 6 +- .../Tests/TestCaseRoomInspector.cs | 4 +- .../Tests/TestCaseScoreCounter.cs | 4 +- .../Tests/TestCaseScrollingHitObjects.cs | 4 +- .../Tests/TestCaseSettings.cs | 9 +- .../Tests/TestCaseSkipButton.cs | 5 +- .../Tests/TestCaseSocial.cs | 4 +- .../Tests/TestCaseSongProgress.cs | 4 +- .../Tests/TestCaseTabControl.cs | 4 +- .../Tests/TestCaseTaikoHitObjects.cs | 4 +- .../Tests/TestCaseTaikoPlayfield.cs | 4 +- .../Tests/TestCaseTextAwesome.cs | 4 +- .../Tests/TestCaseTwoLayerButton.cs | 4 +- .../Tests/TestCaseUserPanel.cs | 4 +- osu.Game/Rulesets/UI/HitRenderer.cs | 2 +- osu.Game/Screens/Play/SongProgressGraph.cs | 12 +-- osu.Game/Screens/Select/SongSelect.cs | 9 +- 44 files changed, 139 insertions(+), 206 deletions(-) diff --git a/osu-framework b/osu-framework index cd2b351de3..b0909ce133 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit cd2b351de37f17b6d91d1fc062627208a09c3834 +Subproject commit b0909ce13389ba690bfc41232d2d39bdf175e896 diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs index e755924a15..e0a503bc76 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs @@ -12,10 +12,8 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Beatmap details in song select"; - public override void Reset() + public TestCaseBeatmapDetailArea() { - base.Reset(); - Add(new BeatmapDetailArea { Anchor = Anchor.Centre, diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs index df80ffdf53..903a26e7ea 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs @@ -15,10 +15,8 @@ namespace osu.Desktop.VisualTests.Tests private BeatmapDetails details; - public override void Reset() + public TestCaseBeatmapDetails() { - base.Reset(); - Add(details = new BeatmapDetails { RelativeSizeAxes = Axes.Both, diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs index 7c211227c6..c9c1740856 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs @@ -13,10 +13,8 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Beatmap options in song select"; - public override void Reset() + public TestCaseBeatmapOptionsOverlay() { - base.Reset(); - var overlay = new BeatmapOptionsOverlay(); overlay.AddButton(@"Remove", @"from unplayed", FontAwesome.fa_times_circle_o, Color4.Purple, null, Key.Number1); diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBreadcrumbs.cs b/osu.Desktop.VisualTests/Tests/TestCaseBreadcrumbs.cs index 658d2f92b1..f2dd454d65 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBreadcrumbs.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBreadcrumbs.cs @@ -11,10 +11,8 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"breadcrumb > control"; - public override void Reset() + public TestCaseBreadcrumbs() { - base.Reset(); - BreadcrumbControl c; Add(c = new BreadcrumbControl { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs b/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs index 2663c952cf..751b979bad 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs @@ -11,10 +11,8 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Testing chat api and overlay"; - public override void Reset() + public TestCaseChatDisplay() { - base.Reset(); - Add(new ChatOverlay { State = Visibility.Visible diff --git a/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs b/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs index 808e9b5d19..aeb59e9cf3 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs @@ -23,10 +23,8 @@ namespace osu.Desktop.VisualTests.Tests private MyContextMenuContainer container; - public override void Reset() + public TestCaseContextMenu() { - base.Reset(); - Add(container = new MyContextMenuContainer { Size = new Vector2(200), diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs index 90e214c3c9..cfdb31e88d 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs @@ -14,10 +14,8 @@ namespace osu.Desktop.VisualTests.Tests private DialogOverlay overlay; - public override void Reset() + public TestCaseDialogOverlay() { - base.Reset(); - Add(overlay = new DialogOverlay()); AddStep("dialog #1", () => overlay.Push(new PopupDialog diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs b/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs index 4cda14559f..6b68ffa260 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs @@ -16,9 +16,9 @@ namespace osu.Desktop.VisualTests.Tests private DirectOverlay direct; private RulesetDatabase rulesets; - public override void Reset() + protected override void LoadComplete() { - base.Reset(); + base.LoadComplete(); Add(direct = new DirectOverlay()); newBeatmaps(); diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs b/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs index 43a8069720..ddda4119bf 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs @@ -15,9 +15,9 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Select your favourite room"; - public override void Reset() + protected override void LoadComplete() { - base.Reset(); + base.LoadComplete(); DrawableRoom first; DrawableRoom second; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs b/osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs index ebc9930f93..63ec06963c 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs @@ -12,10 +12,8 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => "Tournament drawings"; - public override void Reset() + public TestCaseDrawings() { - base.Reset(); - Add(new Drawings { TeamList = new TestTeamList(), diff --git a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs index e2cd2bf67b..00d7e8b5c8 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs @@ -34,9 +34,9 @@ namespace osu.Desktop.VisualTests.Tests this.rulesets = rulesets; } - public override void Reset() + protected override void LoadComplete() { - base.Reset(); + base.LoadComplete(); List objects = new List(); diff --git a/osu.Desktop.VisualTests/Tests/TestCaseGraph.cs b/osu.Desktop.VisualTests/Tests/TestCaseGraph.cs index f653e2b9b4..0a5be88ef2 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseGraph.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseGraph.cs @@ -15,10 +15,8 @@ namespace osu.Desktop.VisualTests.Tests private BarGraph graph; - public override void Reset() + public TestCaseGraph() { - base.Reset(); - Children = new[] { graph = new BarGraph diff --git a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs index 8c913ae95e..888c5cd67e 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs @@ -29,6 +29,49 @@ namespace osu.Desktop.VisualTests.Tests var rateAdjustClock = new StopwatchClock(true); framedClock = new FramedClock(rateAdjustClock); playbackSpeed.ValueChanged += delegate { rateAdjustClock.Rate = playbackSpeed.Value; }; + + playbackSpeed.TriggerChange(); + + AddStep(@"circles", () => loadHitobjects(HitObjectType.Circle)); + AddStep(@"slider", () => loadHitobjects(HitObjectType.Slider)); + AddStep(@"spinner", () => loadHitobjects(HitObjectType.Spinner)); + + AddToggleStep(@"auto", state => { auto = state; loadHitobjects(mode); }); + + BasicSliderBar sliderBar; + Add(new Container + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + AutoSizeAxes = Axes.Both, + Children = new Drawable[] + { + new SpriteText { Text = "Playback Speed" }, + sliderBar = new BasicSliderBar + { + Width = 150, + Height = 10, + SelectionColor = Color4.Orange, + } + } + }); + + sliderBar.Current.BindTo(playbackSpeed); + + framedClock.ProcessFrame(); + + var clockAdjustContainer = new Container + { + RelativeSizeAxes = Axes.Both, + Clock = framedClock, + Children = new[] + { + playfieldContainer = new Container { RelativeSizeAxes = Axes.Both }, + approachContainer = new Container { RelativeSizeAxes = Axes.Both } + } + }; + + Add(clockAdjustContainer); } private HitObjectType mode = HitObjectType.Slider; @@ -37,7 +80,7 @@ namespace osu.Desktop.VisualTests.Tests private Container playfieldContainer; private Container approachContainer; - private void load(HitObjectType mode) + private void loadHitobjects(HitObjectType mode) { this.mode = mode; @@ -83,54 +126,6 @@ namespace osu.Desktop.VisualTests.Tests } } - public override void Reset() - { - base.Reset(); - - playbackSpeed.TriggerChange(); - - AddStep(@"circles", () => load(HitObjectType.Circle)); - AddStep(@"slider", () => load(HitObjectType.Slider)); - AddStep(@"spinner", () => load(HitObjectType.Spinner)); - - AddToggleStep(@"auto", state => { auto = state; load(mode); }); - - BasicSliderBar sliderBar; - Add(new Container - { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - AutoSizeAxes = Axes.Both, - Children = new Drawable[] - { - new SpriteText { Text = "Playback Speed" }, - sliderBar = new BasicSliderBar - { - Width = 150, - Height = 10, - SelectionColor = Color4.Orange, - } - } - }); - - sliderBar.Current.BindTo(playbackSpeed); - - framedClock.ProcessFrame(); - - var clockAdjustContainer = new Container - { - RelativeSizeAxes = Axes.Both, - Clock = framedClock, - Children = new[] - { - playfieldContainer = new Container { RelativeSizeAxes = Axes.Both }, - approachContainer = new Container { RelativeSizeAxes = Axes.Both } - } - }; - - Add(clockAdjustContainer); - } - private int depth; private void add(DrawableOsuHitObject h) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs index a28176b512..87a40a76ca 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs @@ -20,10 +20,8 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Tests key counter"; - public override void Reset() + public TestCaseKeyCounter() { - base.Reset(); - KeyCounterCollection kc = new KeyCounterCollection { Origin = Anchor.Centre, diff --git a/osu.Desktop.VisualTests/Tests/TestCaseLeaderboard.cs b/osu.Desktop.VisualTests/Tests/TestCaseLeaderboard.cs index 39010baf91..c800cb63aa 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseLeaderboard.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseLeaderboard.cs @@ -207,10 +207,8 @@ namespace osu.Desktop.VisualTests.Tests leaderboard.Scores = scores; } - public override void Reset() + public TestCaseLeaderboard() { - base.Reset(); - Add(leaderboard = new Leaderboard { Origin = Anchor.Centre, diff --git a/osu.Desktop.VisualTests/Tests/TestCaseManiaHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseManiaHitObjects.cs index c66b0b4db4..30346e90c9 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseManiaHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseManiaHitObjects.cs @@ -13,10 +13,8 @@ namespace osu.Desktop.VisualTests.Tests { internal class TestCaseManiaHitObjects : TestCase { - public override void Reset() + public TestCaseManiaHitObjects() { - base.Reset(); - Add(new FillFlowContainer { Anchor = Anchor.Centre, diff --git a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs index 352b6cdc81..adaae91815 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs @@ -25,10 +25,8 @@ namespace osu.Desktop.VisualTests.Tests protected override double TimePerAction => 200; - public override void Reset() + public TestCaseManiaPlayfield() { - base.Reset(); - Action createPlayfield = (cols, pos) => { Clear(); diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs b/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs index 0caa518a0b..bab471ed6a 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs @@ -13,10 +13,8 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Main menu button system"; - public override void Reset() + public TestCaseMenuButtonSystem() { - base.Reset(); - Add(new Box { ColourInfo = ColourInfo.GradientVertical(Color4.Gray, Color4.WhiteSmoke), diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMenuOverlays.cs b/osu.Desktop.VisualTests/Tests/TestCaseMenuOverlays.cs index 4de8b297eb..7c8e90aaf8 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMenuOverlays.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMenuOverlays.cs @@ -16,10 +16,8 @@ namespace osu.Desktop.VisualTests.Tests private FailOverlay failOverlay; private int retryCount; - public override void Reset() + public TestCaseMenuOverlays() { - base.Reset(); - retryCount = 0; Add(pauseOverlay = new PauseContainer.PauseOverlay diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMods.cs b/osu.Desktop.VisualTests/Tests/TestCaseMods.cs index 3f3a9d82f5..e626a70e5f 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMods.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMods.cs @@ -27,9 +27,9 @@ namespace osu.Desktop.VisualTests.Tests this.rulesets = rulesets; } - public override void Reset() + protected override void LoadComplete() { - base.Reset(); + base.LoadComplete(); Add(modSelect = new ModSelectOverlay { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs b/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs index 5665bf859a..fe02e655e7 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs @@ -18,12 +18,7 @@ namespace osu.Desktop.VisualTests.Tests public TestCaseMusicController() { Clock = new FramedClock(); - } - public override void Reset() - { - base.Reset(); - Clock.ProcessFrame(); mc = new MusicController { Origin = Anchor.Centre, diff --git a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs index 8972040b06..6a50076b08 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs @@ -18,10 +18,8 @@ namespace osu.Desktop.VisualTests.Tests private NotificationManager manager; - public override void Reset() + public TestCaseNotificationManager() { - base.Reset(); - progressingNotifications.Clear(); Content.Add(manager = new NotificationManager diff --git a/osu.Desktop.VisualTests/Tests/TestCaseOnScreenDisplay.cs b/osu.Desktop.VisualTests/Tests/TestCaseOnScreenDisplay.cs index 3cefb8a3d2..f2b4ed7918 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseOnScreenDisplay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseOnScreenDisplay.cs @@ -15,9 +15,9 @@ namespace osu.Desktop.VisualTests.Tests public override string Description => @"Make it easier to see setting changes"; - public override void Reset() + protected override void LoadComplete() { - base.Reset(); + base.LoadComplete(); Add(new OnScreenDisplay()); diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs index 35eb6d0ff9..a30d719a29 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs @@ -21,9 +21,8 @@ namespace osu.Desktop.VisualTests.Tests private RulesetDatabase rulesets; - public override void Reset() + public TestCasePlaySongSelect() { - base.Reset(); if (db == null) { storage = new TestStorage(@"TestCasePlaySongSelect"); diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs index d922f3bb4b..69031eba0c 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs @@ -33,53 +33,46 @@ namespace osu.Desktop.VisualTests.Tests this.db = db; } - public override void Reset() + protected override void LoadComplete() { - base.Reset(); + base.LoadComplete(); WorkingBeatmap beatmap = null; - var beatmapInfo = db.Query().FirstOrDefault(b => b.RulesetID == 0); - if (beatmapInfo != null) - beatmap = db.GetWorkingBeatmap(beatmapInfo); + var objects = new List(); - if (beatmap?.Track == null) + int time = 1500; + for (int i = 0; i < 50; i++) { - var objects = new List(); - - int time = 1500; - for (int i = 0; i < 50; i++) + objects.Add(new HitCircle { - objects.Add(new HitCircle - { - StartTime = time, - Position = new Vector2(i % 4 == 0 || i % 4 == 2 ? 0 : OsuPlayfield.BASE_SIZE.X, - i % 4 < 2 ? 0 : OsuPlayfield.BASE_SIZE.Y), - NewCombo = i % 4 == 0 - }); + StartTime = time, + Position = new Vector2(i % 4 == 0 || i % 4 == 2 ? 0 : OsuPlayfield.BASE_SIZE.X, + i % 4 < 2 ? 0 : OsuPlayfield.BASE_SIZE.Y), + NewCombo = i % 4 == 0 + }); - time += 500; - } - - Beatmap b = new Beatmap - { - HitObjects = objects, - BeatmapInfo = new BeatmapInfo - { - Difficulty = new BeatmapDifficulty(), - Ruleset = rulesets.Query().First(), - Metadata = new BeatmapMetadata - { - Artist = @"Unknown", - Title = @"Sample Beatmap", - Author = @"peppy", - } - } - }; - - beatmap = new TestWorkingBeatmap(b); + time += 500; } + Beatmap b = new Beatmap + { + HitObjects = objects, + BeatmapInfo = new BeatmapInfo + { + Difficulty = new BeatmapDifficulty(), + Ruleset = rulesets.Query().First(), + Metadata = new BeatmapMetadata + { + Artist = @"Unknown", + Title = @"Sample Beatmap", + Author = @"peppy", + } + } + }; + + beatmap = new TestWorkingBeatmap(b); + Add(new Box { RelativeSizeAxes = Framework.Graphics.Axes.Both, diff --git a/osu.Desktop.VisualTests/Tests/TestCaseReplaySettingsOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseReplaySettingsOverlay.cs index b2c211b7f0..923879b0f7 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseReplaySettingsOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseReplaySettingsOverlay.cs @@ -15,10 +15,8 @@ namespace osu.Desktop.VisualTests.Tests private ExampleContainer container; - public override void Reset() + public TestCaseReplaySettingsOverlay() { - base.Reset(); - Add(new ReplaySettingsOverlay() { Anchor = Anchor.TopRight, diff --git a/osu.Desktop.VisualTests/Tests/TestCaseResults.cs b/osu.Desktop.VisualTests/Tests/TestCaseResults.cs index f8c93e9a73..1cfc2fc664 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseResults.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseResults.cs @@ -28,9 +28,9 @@ namespace osu.Desktop.VisualTests.Tests private WorkingBeatmap beatmap; - public override void Reset() + protected override void LoadComplete() { - base.Reset(); + base.LoadComplete(); if (beatmap == null) { @@ -39,8 +39,6 @@ namespace osu.Desktop.VisualTests.Tests beatmap = db.GetWorkingBeatmap(beatmapInfo); } - base.Reset(); - Add(new Results(new Score { TotalScore = 2845370, diff --git a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs index beb664e7ff..00702f7ad0 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs @@ -17,9 +17,9 @@ namespace osu.Desktop.VisualTests.Tests private RulesetDatabase rulesets; - public override void Reset() + protected override void LoadComplete() { - base.Reset(); + base.LoadComplete(); var room = new Room { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs index 45ae82109f..e8fc2956b4 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs @@ -15,10 +15,8 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Tests multiple counters"; - public override void Reset() + public TestCaseScoreCounter() { - base.Reset(); - int numerator = 0, denominator = 0; ScoreCounter score = new ScoreCounter(7) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs index 4ddc35eb84..3206b6fb88 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs @@ -28,10 +28,8 @@ namespace osu.Desktop.VisualTests.Tests private OsuSpriteText bottomLabel; private SpriteText topTime, bottomTime; - public override void Reset() + public TestCaseScrollingHitObjects() { - base.Reset(); - timeRangeBindable = new BindableDouble(2000) { MinValue = 200, diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSettings.cs b/osu.Desktop.VisualTests/Tests/TestCaseSettings.cs index 660085e558..2b2511c79b 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSettings.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSettings.cs @@ -12,11 +12,14 @@ namespace osu.Desktop.VisualTests.Tests private SettingsOverlay settings; - public override void Reset() + public TestCaseSettings() { - base.Reset(); - Children = new[] { settings = new SettingsOverlay() }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); settings.ToggleVisibility(); } } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSkipButton.cs b/osu.Desktop.VisualTests/Tests/TestCaseSkipButton.cs index fb5be719c1..1f81226a8e 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSkipButton.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSkipButton.cs @@ -10,9 +10,10 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Skip skip skippediskip"; - public override void Reset() + protected override void LoadComplete() { - base.Reset(); + base.LoadComplete(); + Add(new SkipButton(Clock.CurrentTime + 5000)); } } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSocial.cs b/osu.Desktop.VisualTests/Tests/TestCaseSocial.cs index eb7df96355..34209119bd 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSocial.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSocial.cs @@ -11,10 +11,8 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"social browser overlay"; - public override void Reset() + public TestCaseSocial() { - base.Reset(); - SocialOverlay s = new SocialOverlay { Users = new[] diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs index e3c343f5f8..610fe947dc 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs @@ -20,10 +20,8 @@ namespace osu.Desktop.VisualTests.Tests private StopwatchClock clock; - public override void Reset() + public TestCaseSongProgress() { - base.Reset(); - clock = new StopwatchClock(true); Add(progress = new SongProgress diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs b/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs index 96933a15e7..c0c01a6daa 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs @@ -14,10 +14,8 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Filter for song select"; - public override void Reset() + public TestCaseTabControl() { - base.Reset(); - OsuSpriteText text; OsuTabControl filter; Add(filter = new OsuTabControl diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs index d769071bd9..d98e39ae7b 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs @@ -16,10 +16,8 @@ namespace osu.Desktop.VisualTests.Tests private bool kiai; - public override void Reset() + public TestCaseTaikoHitObjects() { - base.Reset(); - AddToggleStep("Kiai", b => { kiai = !kiai; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 259d0267db..8543f727dd 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -29,10 +29,8 @@ namespace osu.Desktop.VisualTests.Tests private TaikoPlayfield playfield; private Container playfieldContainer; - public override void Reset() + public TestCaseTaikoPlayfield() { - base.Reset(); - AddStep("Hit!", addHitJudgement); AddStep("Miss :(", addMissJudgement); AddStep("DrumRoll", () => addDrumRoll(false)); diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs b/osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs index 7182ee7c06..2824c0416f 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs @@ -16,10 +16,8 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Tests display of icons"; - public override void Reset() + public TestCaseTextAwesome() { - base.Reset(); - FillFlowContainer flow; Add(flow = new FillFlowContainer diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTwoLayerButton.cs b/osu.Desktop.VisualTests/Tests/TestCaseTwoLayerButton.cs index 2decb4c469..0c35a4b8aa 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTwoLayerButton.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTwoLayerButton.cs @@ -10,10 +10,8 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Mostly back button"; - public override void Reset() + public TestCaseTwoLayerButton() { - base.Reset(); - Add(new BackButton()); } } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs b/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs index 92d58c10c9..22cdf42f7d 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs @@ -13,10 +13,8 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Panels for displaying a user's status"; - public override void Reset() + public TestCaseUserPanel() { - base.Reset(); - UserPanel flyte; UserPanel peppy; Add(new FillFlowContainer diff --git a/osu.Game/Rulesets/UI/HitRenderer.cs b/osu.Game/Rulesets/UI/HitRenderer.cs index 00d678e11e..8fe1dd3e0a 100644 --- a/osu.Game/Rulesets/UI/HitRenderer.cs +++ b/osu.Game/Rulesets/UI/HitRenderer.cs @@ -148,7 +148,7 @@ namespace osu.Game.Rulesets.UI // Check if the beatmap can be converted if (!converter.CanConvert(beatmap.Beatmap)) - throw new BeatmapInvalidForRulesetException($"{nameof(Beatmap)} can't be converted for the current ruleset."); + throw new BeatmapInvalidForRulesetException($"{nameof(Beatmap)} can not be converted for the current ruleset (converter: {converter})."); // Convert the beatmap Beatmap = converter.Convert(beatmap.Beatmap, isForCurrentRuleset); diff --git a/osu.Game/Screens/Play/SongProgressGraph.cs b/osu.Game/Screens/Play/SongProgressGraph.cs index ea7c465e4d..9d39008b65 100644 --- a/osu.Game/Screens/Play/SongProgressGraph.cs +++ b/osu.Game/Screens/Play/SongProgressGraph.cs @@ -17,8 +17,12 @@ namespace osu.Game.Screens.Play set { objects = value; - + const int granularity = 200; + Values = new int[granularity]; + + if (!objects.Any()) + return; var firstHit = objects.First().StartTime; var lastHit = (objects.Last() as IHasEndTime)?.EndTime ?? 0; @@ -28,8 +32,6 @@ namespace osu.Game.Screens.Play var interval = (lastHit - firstHit + 1) / granularity; - var values = new int[granularity]; - foreach (var h in objects) { IHasEndTime end = h as IHasEndTime; @@ -37,10 +39,8 @@ namespace osu.Game.Screens.Play int startRange = (int)((h.StartTime - firstHit) / interval); int endRange = (int)(((end?.EndTime > 0 ? end.EndTime : h.StartTime) - firstHit) / interval); for (int i = startRange; i <= endRange; i++) - values[i]++; + Values[i]++; } - - Values = values; } } } diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index eda3cf39f6..90f18499bf 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -281,10 +281,13 @@ namespace osu.Game.Screens.Select { base.Dispose(isDisposing); - database.BeatmapSetAdded -= onBeatmapSetAdded; - database.BeatmapSetRemoved -= onBeatmapSetRemoved; + if (database != null) + { + database.BeatmapSetAdded -= onBeatmapSetAdded; + database.BeatmapSetRemoved -= onBeatmapSetRemoved; + } - initialAddSetsTask.Cancel(); + initialAddSetsTask?.Cancel(); } private void changeBackground(WorkingBeatmap beatmap) From 51f14ed21a08d549f84038d02689401735b3fae4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 8 Jul 2017 11:13:33 +0900 Subject: [PATCH 23/38] Update resources --- osu-resources | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-resources b/osu-resources index 900f47563f..76656c51f2 160000 --- a/osu-resources +++ b/osu-resources @@ -1 +1 @@ -Subproject commit 900f47563f5598eef7cbf203f0b3f2166508b6d5 +Subproject commit 76656c51f281e7934159e9ed4414378fef24d130 From 96189fa749d7c2361b77bb5eb01a3e664d4f1d2f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 8 Jul 2017 16:16:49 +0900 Subject: [PATCH 24/38] Fix crash on startup for release builds --- osu.Desktop/OsuGameDesktop.cs | 13 +++++++++---- osu.Desktop/Overlays/VersionManager.cs | 6 ------ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index 299f64d998..51145b42c8 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -11,6 +11,7 @@ using System.Reflection; using System.Drawing; using System.IO; using System.Threading.Tasks; +using osu.Framework.Graphics.Containers; using osu.Game.Screens.Menu; namespace osu.Desktop @@ -22,18 +23,22 @@ namespace osu.Desktop public OsuGameDesktop(string[] args = null) : base(args) { - versionManager = new VersionManager { Depth = int.MinValue }; + versionManager = new VersionManager + { + Depth = int.MinValue, + State = Visibility.Hidden + }; } protected override void LoadComplete() { base.LoadComplete(); - LoadComponentAsync(versionManager); + LoadComponentAsync(versionManager, Add); ScreenChanged += s => { - if (!versionManager.IsAlive && s is Intro) - Add(versionManager); + if (!versionManager.IsPresent && s is Intro) + versionManager.State = Visibility.Visible; }; } diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index b53c4ab3d4..9182f925e1 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -93,12 +93,6 @@ namespace osu.Desktop.Overlays checkForUpdateAsync(); } - protected override void LoadComplete() - { - base.LoadComplete(); - State = Visibility.Visible; - } - protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); From f2fa8dc2d21066940f08d78030d94faebf1bf26f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 8 Jul 2017 18:01:30 +0900 Subject: [PATCH 25/38] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index b0909ce133..af9ffbd8b9 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit b0909ce13389ba690bfc41232d2d39bdf175e896 +Subproject commit af9ffbd8b945e526801c469dd55464363e502962 From 3c425dd07f2d2e55fe4588900e93119b7f2cd623 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 8 Jul 2017 18:04:55 +0900 Subject: [PATCH 26/38] Fix CI issue --- osu.Desktop.VisualTests/Tests/TestCasePlayer.cs | 1 - osu.Game/Screens/Play/SongProgressGraph.cs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs index 69031eba0c..f79451882b 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlayer.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.Allocation; using osu.Framework.Testing; using osu.Game.Beatmaps; diff --git a/osu.Game/Screens/Play/SongProgressGraph.cs b/osu.Game/Screens/Play/SongProgressGraph.cs index 9d39008b65..9251ca33a4 100644 --- a/osu.Game/Screens/Play/SongProgressGraph.cs +++ b/osu.Game/Screens/Play/SongProgressGraph.cs @@ -17,7 +17,7 @@ namespace osu.Game.Screens.Play set { objects = value; - + const int granularity = 200; Values = new int[granularity]; From bb8efcc12fbed4ad026cecd4bc450274279afabb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 8 Jul 2017 18:17:47 +0900 Subject: [PATCH 27/38] Fix CI issues (pass #2) --- .../Tests/TestCaseBeatmapDetails.cs | 2 +- .../Tests/TestCaseContextMenu.cs | 4 ++-- .../Tests/TestCaseDialogOverlay.cs | 4 ++-- osu.Desktop.VisualTests/Tests/TestCaseGraph.cs | 4 ++-- .../Tests/TestCaseHitObjects.cs | 4 ++-- .../Tests/TestCaseLeaderboard.cs | 2 +- .../Tests/TestCaseMenuOverlays.cs | 15 ++++++++------- .../Tests/TestCaseMusicController.cs | 4 +--- .../Tests/TestCaseNotificationManager.cs | 2 +- .../Tests/TestCasePlaySongSelect.cs | 10 +++++----- osu.Desktop.VisualTests/Tests/TestCasePlayer.cs | 8 ++------ .../Tests/TestCaseReplaySettingsOverlay.cs | 6 +++--- .../Tests/TestCaseScrollingHitObjects.cs | 13 +++++++------ osu.Desktop.VisualTests/Tests/TestCaseSettings.cs | 2 +- .../Tests/TestCaseSongProgress.cs | 6 +++--- .../Tests/TestCaseTaikoPlayfield.cs | 4 ++-- 16 files changed, 43 insertions(+), 47 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs index 903a26e7ea..9335938265 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs @@ -13,7 +13,7 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => "BeatmapDetails tab of BeatmapDetailArea"; - private BeatmapDetails details; + private readonly BeatmapDetails details; public TestCaseBeatmapDetails() { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs b/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs index aeb59e9cf3..6c0da885ac 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs @@ -21,10 +21,10 @@ namespace osu.Desktop.VisualTests.Tests private const int start_time = 0; private const int duration = 1000; - private MyContextMenuContainer container; - public TestCaseContextMenu() { + MyContextMenuContainer container; + Add(container = new MyContextMenuContainer { Size = new Vector2(200), diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs index cfdb31e88d..6924817827 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs @@ -12,10 +12,10 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Display dialogs"; - private DialogOverlay overlay; - public TestCaseDialogOverlay() { + DialogOverlay overlay; + Add(overlay = new DialogOverlay()); AddStep("dialog #1", () => overlay.Push(new PopupDialog diff --git a/osu.Desktop.VisualTests/Tests/TestCaseGraph.cs b/osu.Desktop.VisualTests/Tests/TestCaseGraph.cs index 0a5be88ef2..d969decaa5 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseGraph.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseGraph.cs @@ -13,10 +13,10 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => "graph"; - private BarGraph graph; - public TestCaseGraph() { + BarGraph graph; + Children = new[] { graph = new BarGraph diff --git a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs index 888c5cd67e..33841cae90 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs @@ -77,8 +77,8 @@ namespace osu.Desktop.VisualTests.Tests private HitObjectType mode = HitObjectType.Slider; private readonly BindableNumber playbackSpeed = new BindableDouble(0.5) { MinValue = 0, MaxValue = 1 }; - private Container playfieldContainer; - private Container approachContainer; + private readonly Container playfieldContainer; + private readonly Container approachContainer; private void loadHitobjects(HitObjectType mode) { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseLeaderboard.cs b/osu.Desktop.VisualTests/Tests/TestCaseLeaderboard.cs index c800cb63aa..12d01ecc79 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseLeaderboard.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseLeaderboard.cs @@ -16,7 +16,7 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"From song select"; - private Leaderboard leaderboard; + private readonly Leaderboard leaderboard; private void newScores() { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMenuOverlays.cs b/osu.Desktop.VisualTests/Tests/TestCaseMenuOverlays.cs index 7c8e90aaf8..0187c0e629 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMenuOverlays.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMenuOverlays.cs @@ -12,13 +12,12 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Tests pause and fail overlays"; - private PauseContainer.PauseOverlay pauseOverlay; - private FailOverlay failOverlay; - private int retryCount; - public TestCaseMenuOverlays() { - retryCount = 0; + FailOverlay failOverlay; + PauseContainer.PauseOverlay pauseOverlay; + + var retryCount = 0; Add(pauseOverlay = new PauseContainer.PauseOverlay { @@ -32,14 +31,16 @@ namespace osu.Desktop.VisualTests.Tests OnQuit = () => Logger.Log(@"Quit"), }); - AddStep(@"Pause", delegate { + AddStep(@"Pause", delegate + { if (failOverlay.State == Visibility.Visible) { failOverlay.Hide(); } pauseOverlay.Show(); }); - AddStep("Fail", delegate { + AddStep("Fail", delegate + { if (pauseOverlay.State == Visibility.Visible) { pauseOverlay.Hide(); diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs b/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs index fe02e655e7..cbb2775234 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs @@ -13,13 +13,11 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Tests music controller ui."; - private MusicController mc; - public TestCaseMusicController() { Clock = new FramedClock(); - mc = new MusicController + var mc = new MusicController { Origin = Anchor.Centre, Anchor = Anchor.Centre diff --git a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs index 6a50076b08..4ba50c8220 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs @@ -16,7 +16,7 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"I handle notifications"; - private NotificationManager manager; + private readonly NotificationManager manager; public TestCaseNotificationManager() { diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs index a30d719a29..83a1436357 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs @@ -13,19 +13,19 @@ namespace osu.Desktop.VisualTests.Tests { internal class TestCasePlaySongSelect : TestCase { - private BeatmapDatabase db; - private TestStorage storage; - private PlaySongSelect songSelect; + private readonly BeatmapDatabase db; public override string Description => @"with fake data"; - private RulesetDatabase rulesets; + private readonly RulesetDatabase rulesets; public TestCasePlaySongSelect() { + PlaySongSelect songSelect; + if (db == null) { - storage = new TestStorage(@"TestCasePlaySongSelect"); + var storage = new TestStorage(@"TestCasePlaySongSelect"); var backingDatabase = storage.GetDatabase(@"client"); diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs index f79451882b..954d24fcc1 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs @@ -20,24 +20,20 @@ namespace osu.Desktop.VisualTests.Tests internal class TestCasePlayer : TestCase { protected Player Player; - private BeatmapDatabase db; private RulesetDatabase rulesets; public override string Description => @"Showing everything to play the game."; [BackgroundDependencyLoader] - private void load(BeatmapDatabase db, RulesetDatabase rulesets) + private void load(RulesetDatabase rulesets) { this.rulesets = rulesets; - this.db = db; } protected override void LoadComplete() { base.LoadComplete(); - WorkingBeatmap beatmap = null; - var objects = new List(); int time = 1500; @@ -70,7 +66,7 @@ namespace osu.Desktop.VisualTests.Tests } }; - beatmap = new TestWorkingBeatmap(b); + WorkingBeatmap beatmap = new TestWorkingBeatmap(b); Add(new Box { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseReplaySettingsOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseReplaySettingsOverlay.cs index 923879b0f7..00a9774067 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseReplaySettingsOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseReplaySettingsOverlay.cs @@ -13,11 +13,11 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Settings visible in replay/auto"; - private ExampleContainer container; - public TestCaseReplaySettingsOverlay() { - Add(new ReplaySettingsOverlay() + ExampleContainer container; + + Add(new ReplaySettingsOverlay { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, diff --git a/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs index 3206b6fb88..9f439fe193 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs @@ -21,15 +21,16 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => "SpeedAdjustmentContainer/DrawableTimingSection"; - private SpeedAdjustmentCollection adjustmentCollection; - - private BindableDouble timeRangeBindable; - private OsuSpriteText timeRangeText; - private OsuSpriteText bottomLabel; - private SpriteText topTime, bottomTime; + private readonly BindableDouble timeRangeBindable; + private readonly OsuSpriteText bottomLabel; + private readonly SpriteText topTime; + private readonly SpriteText bottomTime; public TestCaseScrollingHitObjects() { + OsuSpriteText timeRangeText; + SpeedAdjustmentCollection adjustmentCollection; + timeRangeBindable = new BindableDouble(2000) { MinValue = 200, diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSettings.cs b/osu.Desktop.VisualTests/Tests/TestCaseSettings.cs index 2b2511c79b..3d21f0e3b1 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSettings.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSettings.cs @@ -10,7 +10,7 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Tests the settings overlay"; - private SettingsOverlay settings; + private readonly SettingsOverlay settings; public TestCaseSettings() { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs index 610fe947dc..3368224be1 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs @@ -15,10 +15,10 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"With fake data"; - private SongProgress progress; - private SongProgressGraph graph; + private readonly SongProgress progress; + private readonly SongProgressGraph graph; - private StopwatchClock clock; + private readonly StopwatchClock clock; public TestCaseSongProgress() { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 8543f727dd..00929c06c2 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -26,8 +26,8 @@ namespace osu.Desktop.VisualTests.Tests protected override double TimePerAction => default_duration * 2; private readonly Random rng = new Random(1337); - private TaikoPlayfield playfield; - private Container playfieldContainer; + private readonly TaikoPlayfield playfield; + private readonly Container playfieldContainer; public TestCaseTaikoPlayfield() { From 912cac318f1bcbc4fa9c12918203b4c743b7dbf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sat, 8 Jul 2017 12:25:18 +0300 Subject: [PATCH 28/38] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index af9ffbd8b9..8dc785a0ae 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit af9ffbd8b945e526801c469dd55464363e502962 +Subproject commit 8dc785a0aecfb6df53496eff5bd9f961ff8deee6 From 45d07e39c18a8c4836ea06101dd76c0b7ca4fd2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sat, 8 Jul 2017 12:41:15 +0300 Subject: [PATCH 29/38] Update framework & change logic slightly --- osu-framework | 2 +- osu.Game/Overlays/Settings/SidebarButton.cs | 4 ++-- osu.Game/Overlays/SettingsOverlay.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu-framework b/osu-framework index af9ffbd8b9..8dc785a0ae 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit af9ffbd8b945e526801c469dd55464363e502962 +Subproject commit 8dc785a0aecfb6df53496eff5bd9f961ff8deee6 diff --git a/osu.Game/Overlays/Settings/SidebarButton.cs b/osu.Game/Overlays/Settings/SidebarButton.cs index 8d5e0e96b7..309216dd91 100644 --- a/osu.Game/Overlays/Settings/SidebarButton.cs +++ b/osu.Game/Overlays/Settings/SidebarButton.cs @@ -22,7 +22,7 @@ namespace osu.Game.Overlays.Settings private readonly Box backgroundBox; private readonly Box selectionIndicator; private readonly Container text; - public Action Action; + public Action Action; private SettingsSection section; public SettingsSection Section @@ -112,7 +112,7 @@ namespace osu.Game.Overlays.Settings protected override bool OnClick(InputState state) { - Action?.Invoke(section, true); + Action?.Invoke(section); backgroundBox.FlashColour(Color4.White, 400); return true; } diff --git a/osu.Game/Overlays/SettingsOverlay.cs b/osu.Game/Overlays/SettingsOverlay.cs index fc9dddf121..4a5a0de890 100644 --- a/osu.Game/Overlays/SettingsOverlay.cs +++ b/osu.Game/Overlays/SettingsOverlay.cs @@ -93,7 +93,7 @@ namespace osu.Game.Overlays new SidebarButton { Section = section, - Action = sectionsContainer.ScrollContainer.ScrollTo, + Action = b => sectionsContainer.ScrollContainer.ScrollTo(b), } ).ToArray() } From 105d57a697530bd743d7a4cf206594bd93c093c8 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Sun, 9 Jul 2017 13:39:48 +0300 Subject: [PATCH 30/38] Update Testcase inline with framework --- .../Tests/TestCaseBeatSyncedContainer.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs index c0d2b04bcb..9bf307b1ce 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs @@ -15,6 +15,7 @@ using osu.Game.Graphics.Sprites; using osu.Framework.Lists; using System; using System.Globalization; +using osu.Framework.Allocation; namespace osu.Desktop.VisualTests.Tests { @@ -27,11 +28,6 @@ namespace osu.Desktop.VisualTests.Tests public TestCaseBeatSyncedContainer() { Clock = new FramedClock(); - } - - public override void Reset() - { - base.Reset(); Clock.ProcessFrame(); Add(new BeatContainer @@ -45,7 +41,12 @@ namespace osu.Desktop.VisualTests.Tests Origin = Anchor.TopRight, Anchor = Anchor.TopRight, }); - mc.State = Visibility.Visible; + } + + [BackgroundDependencyLoader] + private void load() + { + mc.ToggleVisibility(); } private class BeatContainer : BeatSyncedContainer @@ -141,6 +142,8 @@ namespace osu.Desktop.VisualTests.Tests { base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes); + if (beatIndex < 0) return; + timingPointCount.Value = timingPoints.Count; currentTimingPoint.Value = timingPoints.IndexOf(timingPoint) + 1; beatCount.Value = calculateBeatCount(timingPoint); From bd45e1f1e741be4957a267562db1c2a2b89233f2 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Sun, 9 Jul 2017 13:48:20 +0300 Subject: [PATCH 31/38] Make field readonly --- osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs index 9bf307b1ce..ffcc76e82c 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs @@ -23,7 +23,7 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Tests beat synced containers."; - private MusicController mc; + private readonly MusicController mc; public TestCaseBeatSyncedContainer() { From 62fc55521c0864a78c5cda8a7b82130b67e07079 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Sun, 9 Jul 2017 13:54:38 +0300 Subject: [PATCH 32/38] Added background colour for better info visibility --- .../Tests/TestCaseBeatSyncedContainer.cs | 35 +++++++++++++------ 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs index ffcc76e82c..f5b96391dd 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs @@ -16,6 +16,7 @@ using osu.Framework.Lists; using System; using System.Globalization; using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; namespace osu.Desktop.VisualTests.Tests { @@ -68,22 +69,36 @@ namespace osu.Desktop.VisualTests.Tests AutoSizeAxes = Axes.Y; Children = new Drawable[] { - new FillFlowContainer + new Container { Name = @"Info Layer", Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, - Direction = FillDirection.Vertical, AutoSizeAxes = Axes.Both, - Margin = new MarginPadding { Bottom = flash_layer_heigth, }, + Margin = new MarginPadding { Bottom = flash_layer_heigth }, Children = new Drawable[] { - timingPointCount = new InfoString(@"Timing points amount"), - currentTimingPoint = new InfoString(@"Current timing point"), - beatCount = new InfoString(@"Beats amount (in the current timing point)"), - currentBeat = new InfoString(@"Current beat"), - beatsPerMinute = new InfoString(@"BPM"), - adjustedBeatLength = new InfoString(@"Adjusted beat length"), + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black.Opacity(150), + }, + new FillFlowContainer + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Children = new Drawable[] + { + timingPointCount = new InfoString(@"Timing points amount"), + currentTimingPoint = new InfoString(@"Current timing point"), + beatCount = new InfoString(@"Beats amount (in the current timing point)"), + currentBeat = new InfoString(@"Current beat"), + beatsPerMinute = new InfoString(@"BPM"), + adjustedBeatLength = new InfoString(@"Adjusted beat length"), + } + } } }, new Container @@ -182,7 +197,7 @@ namespace osu.Desktop.VisualTests.Tests Direction = FillDirection.Horizontal; Add(new OsuSpriteText { Text = header + @": ", TextSize = text_size }); Add(valueText = new OsuSpriteText() { TextSize = text_size }); - Margin = new MarginPadding { Vertical = margin, }; + Margin = new MarginPadding { Vertical = margin, Horizontal = margin }; } } } From d533ac0e98bfb530ab4120f4b5219f9c917171e5 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Sun, 9 Jul 2017 13:57:13 +0300 Subject: [PATCH 33/38] Simplify info margin --- osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs index f5b96391dd..88ed37ddb0 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs @@ -197,7 +197,7 @@ namespace osu.Desktop.VisualTests.Tests Direction = FillDirection.Horizontal; Add(new OsuSpriteText { Text = header + @": ", TextSize = text_size }); Add(valueText = new OsuSpriteText() { TextSize = text_size }); - Margin = new MarginPadding { Vertical = margin, Horizontal = margin }; + Margin = new MarginPadding(margin); } } } From 8c40b808132bf0efed87065496d8ac8602bc0d5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sun, 9 Jul 2017 19:33:23 +0300 Subject: [PATCH 34/38] Also display negative beats --- osu-framework | 2 +- osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/osu-framework b/osu-framework index 8dc785a0ae..1242968326 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 8dc785a0aecfb6df53496eff5bd9f961ff8deee6 +Subproject commit 1242968326461ec1d7e1fb6877b12658d7e1644c diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs index 88ed37ddb0..29eadfe26e 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs @@ -157,8 +157,6 @@ namespace osu.Desktop.VisualTests.Tests { base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes); - if (beatIndex < 0) return; - timingPointCount.Value = timingPoints.Count; currentTimingPoint.Value = timingPoints.IndexOf(timingPoint) + 1; beatCount.Value = calculateBeatCount(timingPoint); From 1f425c3be8b8cfdd35cf20f1f485c6a013e72b9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sun, 9 Jul 2017 19:40:36 +0300 Subject: [PATCH 35/38] Simplify existing code --- .../Tests/TestCaseBeatSyncedContainer.cs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs index 29eadfe26e..05038f2d59 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs @@ -44,9 +44,9 @@ namespace osu.Desktop.VisualTests.Tests }); } - [BackgroundDependencyLoader] - private void load() + protected override void LoadComplete() { + base.LoadComplete(); mc.ToggleVisibility(); } @@ -147,7 +147,7 @@ namespace osu.Desktop.VisualTests.Tests private int calculateBeatCount(TimingControlPoint current) { - if (timingPoints.IndexOf(current) + 1 == timingPoints.Count) + if (timingPoints[timingPoints.Count - 1] == current) return (int)Math.Ceiling((Beatmap.Value.Track.Length - current.Time) / current.BeatLength); return (int)Math.Ceiling((getNextTimingPoint(current).Time - current.Time) / current.BeatLength); @@ -177,16 +177,9 @@ namespace osu.Desktop.VisualTests.Tests private readonly OsuSpriteText valueText; - private float? value; public float Value { - set - { - if (value == this.value) return; - this.value = value; - - valueText.Text = value.ToString(CultureInfo.CurrentCulture); - } + set { valueText.Text = value.ToString(); } } public InfoString(string header) From 934a585b9482ac8f34061ee2483d76083178f726 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sun, 9 Jul 2017 19:40:57 +0300 Subject: [PATCH 36/38] Better number formatting --- .../Tests/TestCaseBeatSyncedContainer.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs index 05038f2d59..27c2467cb9 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs @@ -161,8 +161,8 @@ namespace osu.Desktop.VisualTests.Tests currentTimingPoint.Value = timingPoints.IndexOf(timingPoint) + 1; beatCount.Value = calculateBeatCount(timingPoint); currentBeat.Value = beatIndex + 1; - beatsPerMinute.Value = (float)Math.Round(60000 / timingPoint.BeatLength, 1); - adjustedBeatLength.Value = (float)timingPoint.BeatLength; + beatsPerMinute.Value = 60000 / timingPoint.BeatLength; + adjustedBeatLength.Value = timingPoint.BeatLength; flashLayer.ClearTransforms(); flashLayer.FadeTo(1); @@ -177,9 +177,9 @@ namespace osu.Desktop.VisualTests.Tests private readonly OsuSpriteText valueText; - public float Value + public double Value { - set { valueText.Text = value.ToString(); } + set { valueText.Text = $"{value:G}"; } } public InfoString(string header) From dedd4561a12e725ff68e3bcc990a319a92ad47e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sun, 9 Jul 2017 19:41:36 +0300 Subject: [PATCH 37/38] Display indices rather than one-based numbers --- osu-framework | 2 +- osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu-framework b/osu-framework index 1242968326..3c76bce457 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 1242968326461ec1d7e1fb6877b12658d7e1644c +Subproject commit 3c76bce45762765b7268f8036da681a788f756b9 diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs index 27c2467cb9..95e24dd6fa 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs @@ -158,9 +158,9 @@ namespace osu.Desktop.VisualTests.Tests base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes); timingPointCount.Value = timingPoints.Count; - currentTimingPoint.Value = timingPoints.IndexOf(timingPoint) + 1; + currentTimingPoint.Value = timingPoints.IndexOf(timingPoint); beatCount.Value = calculateBeatCount(timingPoint); - currentBeat.Value = beatIndex + 1; + currentBeat.Value = beatIndex; beatsPerMinute.Value = 60000 / timingPoint.BeatLength; adjustedBeatLength.Value = timingPoint.BeatLength; From fec6f2ba651276cfaffe14c064694be4304179b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sun, 9 Jul 2017 19:47:54 +0300 Subject: [PATCH 38/38] Remove unnecessary usings --- osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs index 95e24dd6fa..067bf47521 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs @@ -14,8 +14,6 @@ using OpenTK.Graphics; using osu.Game.Graphics.Sprites; using osu.Framework.Lists; using System; -using System.Globalization; -using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; namespace osu.Desktop.VisualTests.Tests