From 1d13924e0a9051d8f5582b9922c0e8bcd27d2a54 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Tue, 21 Mar 2017 01:05:48 +0800 Subject: [PATCH 01/21] Remove redundant type parameter. Nested type has implicit type parameter from base type. --- osu.Game/Graphics/UserInterface/OsuTabControl.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index d5699eddaf..de81757fdf 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -16,7 +16,7 @@ namespace osu.Game.Graphics.UserInterface { public class OsuTabControl : TabControl { - protected override DropDownMenu CreateDropDownMenu() => new OsuTabDropDownMenu(); + protected override DropDownMenu CreateDropDownMenu() => new OsuTabDropDownMenu(); protected override TabItem CreateTabItem(T value) => new OsuTabItem { Value = value }; @@ -45,7 +45,7 @@ namespace osu.Game.Graphics.UserInterface set { accentColour = value; - var dropDown = DropDown as OsuTabDropDownMenu; + var dropDown = DropDown as OsuTabDropDownMenu; if (dropDown != null) dropDown.AccentColour = value; foreach (var item in TabContainer.Children.OfType>()) @@ -53,7 +53,7 @@ namespace osu.Game.Graphics.UserInterface } } - public class OsuTabDropDownMenu : OsuDropDownMenu + public class OsuTabDropDownMenu : OsuDropDownMenu { protected override DropDownHeader CreateHeader() => new OsuTabDropDownHeader { @@ -62,7 +62,7 @@ namespace osu.Game.Graphics.UserInterface Origin = Anchor.TopRight, }; - protected override DropDownMenuItem CreateDropDownItem(string key, T1 value) + protected override DropDownMenuItem CreateDropDownItem(string key, T value) { var item = base.CreateDropDownItem(key, value); item.ForegroundColourHover = Color4.Black; From f0edf5d3d3ec772961c51cce18e45af51c199b61 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Wed, 22 Mar 2017 06:51:26 +0800 Subject: [PATCH 02/21] Update to DropDown and Menu. --- .../Graphics/UserInterface/OsuDropDown.cs | 40 ++++++++++++ .../Graphics/UserInterface/OsuDropDownMenu.cs | 61 ------------------- osu.Game/Graphics/UserInterface/OsuMenu.cs | 34 +++++++++++ .../Graphics/UserInterface/OsuTabControl.cs | 20 +++--- osu.Game/Overlays/Options/OptionDropDown.cs | 4 +- osu.Game/osu.Game.csproj | 3 +- 6 files changed, 88 insertions(+), 74 deletions(-) create mode 100644 osu.Game/Graphics/UserInterface/OsuDropDown.cs delete mode 100644 osu.Game/Graphics/UserInterface/OsuDropDownMenu.cs create mode 100644 osu.Game/Graphics/UserInterface/OsuMenu.cs diff --git a/osu.Game/Graphics/UserInterface/OsuDropDown.cs b/osu.Game/Graphics/UserInterface/OsuDropDown.cs new file mode 100644 index 0000000000..51fb335698 --- /dev/null +++ b/osu.Game/Graphics/UserInterface/OsuDropDown.cs @@ -0,0 +1,40 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Linq; +using OpenTK.Graphics; +using osu.Framework.Allocation; +using osu.Framework.Graphics.UserInterface; + +namespace osu.Game.Graphics.UserInterface +{ + public class OsuDropDown : DropDown + { + protected override DropDownHeader CreateHeader() => new OsuDropDownHeader { AccentColour = AccentColour }; + + protected override Menu CreateMenu() => new OsuMenu(); + + private Color4? accentColour; + public virtual Color4 AccentColour + { + get { return accentColour.GetValueOrDefault(); } + set + { + accentColour = value; + if (Header != null) + ((OsuDropDownHeader)Header).AccentColour = value; + foreach (var item in MenuItems.OfType>()) + item.AccentColour = value; + } + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + if (accentColour == null) + AccentColour = colours.PinkDarker; + } + + protected override DropDownMenuItem CreateMenuItem(string key, T value) => new OsuDropDownMenuItem(key, value) { AccentColour = AccentColour }; + } +} \ No newline at end of file diff --git a/osu.Game/Graphics/UserInterface/OsuDropDownMenu.cs b/osu.Game/Graphics/UserInterface/OsuDropDownMenu.cs deleted file mode 100644 index 5d9e30db8d..0000000000 --- a/osu.Game/Graphics/UserInterface/OsuDropDownMenu.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System.Linq; -using osu.Framework.Allocation; -using OpenTK; -using OpenTK.Graphics; -using osu.Framework.Extensions.Color4Extensions; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Primitives; -using osu.Framework.Graphics.Transforms; -using osu.Framework.Graphics.UserInterface; - -namespace osu.Game.Graphics.UserInterface -{ - public class OsuDropDownMenu : DropDownMenu - { - protected override DropDownHeader CreateHeader() => new OsuDropDownHeader { AccentColour = AccentColour }; - - private Color4? accentColour; - public virtual Color4 AccentColour - { - get { return accentColour.GetValueOrDefault(); } - set - { - accentColour = value; - if (Header != null) - ((OsuDropDownHeader)Header).AccentColour = value; - foreach (var item in ItemList.OfType>()) - item.AccentColour = value; - } - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - if (accentColour == null) - AccentColour = colours.PinkDarker; - } - - public OsuDropDownMenu() - { - ContentContainer.CornerRadius = 4; - ContentBackground.Colour = Color4.Black.Opacity(0.5f); - - DropDownItemsContainer.Padding = new MarginPadding(5); - } - - protected override void AnimateOpen() => ContentContainer.FadeIn(300, EasingTypes.OutQuint); - - protected override void AnimateClose() => ContentContainer.FadeOut(300, EasingTypes.OutQuint); - - protected override void UpdateContentHeight() - { - var actualHeight = (RelativeSizeAxes & Axes.Y) > 0 ? 1 : ContentHeight; - ContentContainer.ResizeTo(new Vector2(1, State == DropDownMenuState.Opened ? actualHeight : 0), 300, EasingTypes.OutQuint); - } - - protected override DropDownMenuItem CreateDropDownItem(string key, T value) => new OsuDropDownMenuItem(key, value) { AccentColour = AccentColour }; - } -} \ No newline at end of file diff --git a/osu.Game/Graphics/UserInterface/OsuMenu.cs b/osu.Game/Graphics/UserInterface/OsuMenu.cs new file mode 100644 index 0000000000..4e80e1502a --- /dev/null +++ b/osu.Game/Graphics/UserInterface/OsuMenu.cs @@ -0,0 +1,34 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Primitives; +using osu.Framework.Graphics.Transforms; +using osu.Framework.Graphics.UserInterface; + +namespace osu.Game.Graphics.UserInterface +{ + public class OsuMenu : Menu + { + public OsuMenu() + { + CornerRadius = 4; + ContentBackground.Colour = Color4.Black.Opacity(0.5f); + + ItemsContainer.Padding = new MarginPadding(5); + } + + protected override void AnimateOpen() => FadeIn(300, EasingTypes.OutQuint); + + protected override void AnimateClose() => FadeOut(300, EasingTypes.OutQuint); + + protected override void UpdateContentHeight() + { + var actualHeight = (RelativeSizeAxes & Axes.Y) > 0 ? 1 : ContentHeight; + ResizeTo(new Vector2(1, State == MenuState.Opened ? actualHeight : 0), 300, EasingTypes.OutQuint); + } + } +} diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index de81757fdf..947b39f621 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -16,7 +16,7 @@ namespace osu.Game.Graphics.UserInterface { public class OsuTabControl : TabControl { - protected override DropDownMenu CreateDropDownMenu() => new OsuTabDropDownMenu(); + protected override DropDown CreateDropDownMenu() => new OsuTabDropDown(); protected override TabItem CreateTabItem(T value) => new OsuTabItem { Value = value }; @@ -45,7 +45,7 @@ namespace osu.Game.Graphics.UserInterface set { accentColour = value; - var dropDown = DropDown as OsuTabDropDownMenu; + var dropDown = DropDown as OsuTabDropDown; if (dropDown != null) dropDown.AccentColour = value; foreach (var item in TabContainer.Children.OfType>()) @@ -53,7 +53,7 @@ namespace osu.Game.Graphics.UserInterface } } - public class OsuTabDropDownMenu : OsuDropDownMenu + public class OsuTabDropDown : OsuDropDown { protected override DropDownHeader CreateHeader() => new OsuTabDropDownHeader { @@ -62,22 +62,22 @@ namespace osu.Game.Graphics.UserInterface Origin = Anchor.TopRight, }; - protected override DropDownMenuItem CreateDropDownItem(string key, T value) + protected override DropDownMenuItem CreateMenuItem(string key, T value) { - var item = base.CreateDropDownItem(key, value); + var item = base.CreateMenuItem(key, value); item.ForegroundColourHover = Color4.Black; return item; } - public OsuTabDropDownMenu() + public OsuTabDropDown() { - ContentContainer.Anchor = Anchor.TopRight; - ContentContainer.Origin = Anchor.TopRight; + DropDownMenu.Anchor = Anchor.TopRight; + DropDownMenu.Origin = Anchor.TopRight; RelativeSizeAxes = Axes.X; - ContentBackground.Colour = Color4.Black.Opacity(0.7f); - MaxDropDownHeight = 400; + DropDownMenu.Colour = Color4.Black.Opacity(0.7f); + DropDownMenu.MaxHeight = 400; } public class OsuTabDropDownHeader : OsuDropDownHeader diff --git a/osu.Game/Overlays/Options/OptionDropDown.cs b/osu.Game/Overlays/Options/OptionDropDown.cs index 4387e90b5a..690d3d21a5 100644 --- a/osu.Game/Overlays/Options/OptionDropDown.cs +++ b/osu.Game/Overlays/Options/OptionDropDown.cs @@ -16,7 +16,7 @@ namespace osu.Game.Overlays.Options { public class OptionDropDown : FillFlowContainer { - private DropDownMenu dropdown; + private DropDown dropdown; private SpriteText text; public string LabelText @@ -97,7 +97,7 @@ namespace osu.Game.Overlays.Options text = new OsuSpriteText { Alpha = 0, }, - dropdown = new OsuDropDownMenu + dropdown = new OsuDropDown { Margin = new MarginPadding { Top = 5 }, RelativeSizeAxes = Axes.X, diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 188d929888..3f97e196db 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -85,6 +85,7 @@ + @@ -159,7 +160,7 @@ - + From b46ded77945cfb9484cb2f797e070b10d8728ca9 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Wed, 22 Mar 2017 07:49:21 +0800 Subject: [PATCH 03/21] Use Bindable for DropDown. --- osu.Game/Overlays/Options/OptionDropDown.cs | 36 ++------------------- 1 file changed, 3 insertions(+), 33 deletions(-) diff --git a/osu.Game/Overlays/Options/OptionDropDown.cs b/osu.Game/Overlays/Options/OptionDropDown.cs index 690d3d21a5..9c9cd17b12 100644 --- a/osu.Game/Overlays/Options/OptionDropDown.cs +++ b/osu.Game/Overlays/Options/OptionDropDown.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; +using System.Collections.Generic; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -10,7 +10,6 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; -using System.Collections.Generic; namespace osu.Game.Overlays.Options { @@ -33,12 +32,8 @@ namespace osu.Game.Overlays.Options get { return bindable; } set { - if (bindable != null) - bindable.ValueChanged -= bindable_ValueChanged; bindable = value; - bindable.ValueChanged += bindable_ValueChanged; - bindable_ValueChanged(null, null); - + dropdown.SelectedValue.BindTo(bindable); if (bindable.Disabled) Alpha = 0.3f; } @@ -46,23 +41,6 @@ namespace osu.Game.Overlays.Options private Bindable bindable; - private void bindable_ValueChanged(object sender, EventArgs e) - { - dropdown.SelectedValue = bindable.Value; - } - - private void dropdown_ValueChanged(object sender, EventArgs e) - { - bindable.Value = dropdown.SelectedValue; - } - - protected override void Dispose(bool isDisposing) - { - bindable.ValueChanged -= bindable_ValueChanged; - dropdown.ValueChanged -= dropdown_ValueChanged; - base.Dispose(isDisposing); - } - private IEnumerable> items; public IEnumerable> Items { @@ -73,15 +51,8 @@ namespace osu.Game.Overlays.Options set { items = value; - if(dropdown != null) - { + if (dropdown != null) dropdown.Items = value; - - // We need to refresh the dropdown because our items changed, - // thus its selected value may be outdated. - if (bindable != null) - dropdown.SelectedValue = bindable.Value; - } } } @@ -104,7 +75,6 @@ namespace osu.Game.Overlays.Options Items = Items, } }; - dropdown.ValueChanged += dropdown_ValueChanged; } } } From b06eb0122c8860fa480081cde2849d162a3e3272 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Wed, 22 Mar 2017 07:55:47 +0800 Subject: [PATCH 04/21] Fix for colours and members rename. --- osu.Game/Graphics/UserInterface/OsuDropDown.cs | 2 +- osu.Game/Graphics/UserInterface/OsuMenu.cs | 2 +- osu.Game/Graphics/UserInterface/OsuTabControl.cs | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuDropDown.cs b/osu.Game/Graphics/UserInterface/OsuDropDown.cs index 51fb335698..a921be1a1d 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropDown.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropDown.cs @@ -35,6 +35,6 @@ namespace osu.Game.Graphics.UserInterface AccentColour = colours.PinkDarker; } - protected override DropDownMenuItem CreateMenuItem(string key, T value) => new OsuDropDownMenuItem(key, value) { AccentColour = AccentColour }; + protected override DropDownMenuItem CreateMenuItem(string text, T value) => new OsuDropDownMenuItem(text, value) { AccentColour = AccentColour }; } } \ No newline at end of file diff --git a/osu.Game/Graphics/UserInterface/OsuMenu.cs b/osu.Game/Graphics/UserInterface/OsuMenu.cs index 4e80e1502a..95df3be9bf 100644 --- a/osu.Game/Graphics/UserInterface/OsuMenu.cs +++ b/osu.Game/Graphics/UserInterface/OsuMenu.cs @@ -16,7 +16,7 @@ namespace osu.Game.Graphics.UserInterface public OsuMenu() { CornerRadius = 4; - ContentBackground.Colour = Color4.Black.Opacity(0.5f); + Background.Colour = Color4.Black.Opacity(0.5f); ItemsContainer.Padding = new MarginPadding(5); } diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index 947b39f621..84f3125ca4 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -16,7 +16,7 @@ namespace osu.Game.Graphics.UserInterface { public class OsuTabControl : TabControl { - protected override DropDown CreateDropDownMenu() => new OsuTabDropDown(); + protected override DropDown CreateDropDown() => new OsuTabDropDown(); protected override TabItem CreateTabItem(T value) => new OsuTabItem { Value = value }; @@ -62,9 +62,9 @@ namespace osu.Game.Graphics.UserInterface Origin = Anchor.TopRight, }; - protected override DropDownMenuItem CreateMenuItem(string key, T value) + protected override DropDownMenuItem CreateMenuItem(string text, T value) { - var item = base.CreateMenuItem(key, value); + var item = base.CreateMenuItem(text, value); item.ForegroundColourHover = Color4.Black; return item; } @@ -76,7 +76,7 @@ namespace osu.Game.Graphics.UserInterface RelativeSizeAxes = Axes.X; - DropDownMenu.Colour = Color4.Black.Opacity(0.7f); + DropDownMenu.Background.Colour = Color4.Black.Opacity(0.7f); DropDownMenu.MaxHeight = 400; } From 4f3ab879de5385fbc00705d414726095fcb7c56d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 Mar 2017 09:43:44 +0900 Subject: [PATCH 05/21] Make DrawableHitObject's UpdateState safer by blocking calls at a higher level with not yet loaded. UpdateState is called in LoadComplete for cases where the state may have changed before a load operation. --- osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs | 2 -- osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuHitObject.cs | 2 -- osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs | 2 -- osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs | 2 -- osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs | 2 -- osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs | 3 +++ 6 files changed, 3 insertions(+), 10 deletions(-) diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs index 20bb937b76..e8c74d4f8d 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -111,8 +111,6 @@ namespace osu.Game.Modes.Osu.Objects.Drawables protected override void UpdateState(ArmedState state) { - if (!IsLoaded) return; - base.UpdateState(state); ApproachCircle.FadeOut(); diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuHitObject.cs index 5e6249d66f..b2af678cae 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -22,8 +22,6 @@ namespace osu.Game.Modes.Osu.Objects.Drawables protected override void UpdateState(ArmedState state) { - if (!IsLoaded) return; - Flush(); UpdateInitialState(); diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs index e9db97a67b..a2a52c7d94 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs @@ -158,8 +158,6 @@ namespace osu.Game.Modes.Osu.Objects.Drawables protected override void UpdateState(ArmedState state) { - if (!IsLoaded) return; - base.UpdateState(state); ball.FadeIn(); diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs index 0400d4a866..fff08b9f60 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs @@ -95,8 +95,6 @@ namespace osu.Game.Modes.Osu.Objects.Drawables protected override void UpdateState(ArmedState state) { - if (!IsLoaded) return; - base.UpdateState(state); switch (state) diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs index 77bfb97ad4..8098e87b12 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs @@ -134,8 +134,6 @@ namespace osu.Game.Modes.Osu.Objects.Drawables protected override void UpdateState(ArmedState state) { - if (!IsLoaded) return; - base.UpdateState(state); Delay(spinner.Duration, true); diff --git a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs index 3ff30bd90e..6322614496 100644 --- a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs @@ -38,6 +38,9 @@ namespace osu.Game.Modes.Objects.Drawables return; state = value; + if (!IsLoaded) + return; + UpdateState(state); if (State == ArmedState.Hit) From 7fba0c4bce787fe8a4e5eda5bb66ba565c158bbe Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 22 Mar 2017 15:44:23 +0900 Subject: [PATCH 06/21] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 405537bd35..24fc560d01 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 405537bd351954878ddc1d2ba53e5d0563528446 +Subproject commit 24fc560d01ba16d86a1c429817ec3b71d146e698 From cc2b4c5c5b4cf2c15687ea942c16334a733c91a7 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 22 Mar 2017 05:54:07 -0400 Subject: [PATCH 07/21] Refactor WorkingBeatmap Gets ArchiveReader out of WorkingBeatmap and delegates extracting stuff from it to subclasses. Should enable us to make an OnlineWorkingBeatmap or so. --- .../Beatmaps/TestWorkingBeatmap.cs | 32 +++++ .../Tests/TestCaseGamefield.cs | 13 +- .../Tests/TestCasePlayer.cs | 12 +- .../osu.Desktop.VisualTests.csproj | 4 + osu.Game/Beatmaps/WorkingBeatmap.cs | 124 ++--------------- osu.Game/Database/BeatmapDatabase.cs | 15 +-- osu.Game/Database/DatabaseWorkingBeatmap.cs | 127 ++++++++++++++++++ osu.Game/osu.Game.csproj | 1 + 8 files changed, 176 insertions(+), 152 deletions(-) create mode 100644 osu.Desktop.VisualTests/Beatmaps/TestWorkingBeatmap.cs create mode 100644 osu.Game/Database/DatabaseWorkingBeatmap.cs diff --git a/osu.Desktop.VisualTests/Beatmaps/TestWorkingBeatmap.cs b/osu.Desktop.VisualTests/Beatmaps/TestWorkingBeatmap.cs new file mode 100644 index 0000000000..e6236b041f --- /dev/null +++ b/osu.Desktop.VisualTests/Beatmaps/TestWorkingBeatmap.cs @@ -0,0 +1,32 @@ +using System; +using osu.Framework.Audio.Track; +using osu.Framework.Graphics.Textures; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.IO; + +namespace osu.Desktop.VisualTests.Beatmaps +{ + public class TestWorkingBeatmap : WorkingBeatmap + { + public TestWorkingBeatmap(Beatmap beatmap) + : base(beatmap.BeatmapInfo, beatmap.BeatmapInfo.BeatmapSet) + { + this.beatmap = beatmap; + } + + private Beatmap beatmap; + public override Beatmap Beatmap => beatmap; + public override Texture Background => null; + public override Track Track => null; + + public override void Dispose() + { + // This space intentionally left blank + } + + public override void TransferTo(WorkingBeatmap other) + { + // This space intentionally left blank + } + } +} diff --git a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs index c2e33f7f32..6de2b36cd0 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs @@ -17,6 +17,8 @@ using osu.Game.Modes.Osu.Objects; using osu.Game.Modes.Osu.UI; using osu.Game.Modes.Taiko.UI; using System.Collections.Generic; +using osu.Framework.Graphics.Textures; +using osu.Desktop.VisualTests.Beatmaps; namespace osu.Desktop.VisualTests.Tests { @@ -95,16 +97,5 @@ namespace osu.Desktop.VisualTests.Tests } }); } - - private class TestWorkingBeatmap : WorkingBeatmap - { - public TestWorkingBeatmap(Beatmap beatmap) - : base(beatmap.BeatmapInfo, beatmap.BeatmapInfo.BeatmapSet) - { - Beatmap = beatmap; - } - - protected override ArchiveReader GetReader() => null; - } } } diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs index 41bd24b900..21a00ebdf6 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs @@ -15,6 +15,7 @@ using osu.Game.Modes.Objects; using osu.Game.Modes.Osu.Objects; using osu.Game.Screens.Play; using OpenTK.Graphics; +using osu.Desktop.VisualTests.Beatmaps; namespace osu.Desktop.VisualTests.Tests { @@ -97,16 +98,5 @@ namespace osu.Desktop.VisualTests.Tests Beatmap = beatmap }; } - - private class TestWorkingBeatmap : WorkingBeatmap - { - public TestWorkingBeatmap(Beatmap beatmap) - : base(beatmap.BeatmapInfo, beatmap.BeatmapInfo.BeatmapSet) - { - Beatmap = beatmap; - } - - protected override ArchiveReader GetReader() => null; - } } } diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index 6eb9e5e648..b67b4c4bb3 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -205,9 +205,13 @@ + + + +