From 0d8815bd376509c012fa13e26d1ebc8f238cd48c Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Fri, 3 Feb 2017 15:22:02 -0400 Subject: [PATCH 001/442] Added back current work --- .../Tests/TestCaseSongProgressBar.cs | 26 +++++++++++++ .../osu.Desktop.VisualTests.csproj | 1 + .../UserInterface/SongProgressBar.cs} | 38 ++++++++++--------- .../UserInterface/SongProgressGraph.cs | 9 +++++ osu.Game/Overlays/Pause/PauseOverlay.cs | 6 --- osu.Game/Overlays/Pause/PauseProgressGraph.cs | 9 ----- osu.Game/osu.Game.csproj | 4 +- 7 files changed, 59 insertions(+), 34 deletions(-) create mode 100644 osu.Desktop.VisualTests/Tests/TestCaseSongProgressBar.cs rename osu.Game/{Overlays/Pause/PauseProgressBar.cs => Graphics/UserInterface/SongProgressBar.cs} (80%) create mode 100644 osu.Game/Graphics/UserInterface/SongProgressGraph.cs delete mode 100644 osu.Game/Overlays/Pause/PauseProgressGraph.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgressBar.cs b/osu.Desktop.VisualTests/Tests/TestCaseSongProgressBar.cs new file mode 100644 index 0000000000..479dac895e --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseSongProgressBar.cs @@ -0,0 +1,26 @@ +using System; +using osu.Framework.Graphics; +using osu.Framework.GameModes.Testing; +using osu.Game.Graphics.UserInterface; + +namespace osu.Desktop.VisualTests +{ + public class TestCaseSongProgressBar : TestCase + { + public override string Name => @"SongProgressBar"; + + public override string Description => @"Tests the song progress bar"; + + public override void Reset() + { + base.Reset(); + + Add(new SongProgressBar + { + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + RelativeSizeAxes = Axes.X + }); + } + } +} diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index 69df007013..1619c18e4c 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -188,6 +188,7 @@ + diff --git a/osu.Game/Overlays/Pause/PauseProgressBar.cs b/osu.Game/Graphics/UserInterface/SongProgressBar.cs similarity index 80% rename from osu.Game/Overlays/Pause/PauseProgressBar.cs rename to osu.Game/Graphics/UserInterface/SongProgressBar.cs index 28824cb7ea..ec208ad0de 100644 --- a/osu.Game/Overlays/Pause/PauseProgressBar.cs +++ b/osu.Game/Graphics/UserInterface/SongProgressBar.cs @@ -6,12 +6,16 @@ using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; using osu.Framework.Graphics.Primitives; -namespace osu.Game.Overlays.Pause +namespace osu.Game.Graphics.UserInterface { - public class PauseProgressBar : Container + public class SongProgressBar : Container { - private Color4 fillColour = new Color4(221, 255, 255, 255); - private Color4 glowColour = new Color4(221, 255, 255, 150); + private const int bar_height = 5; + private const int graph_height = 40; + private const int handle_height = 25; + private const int handle_width = 14; + private Color4 fill_colour = new Color4(221, 255, 255, 255); + private Color4 glow_colour = new Color4(221, 255, 255, 150); private Container fill; private WorkingBeatmap current; @@ -32,22 +36,22 @@ namespace osu.Game.Overlays.Pause } } - public PauseProgressBar() + public SongProgressBar() { RelativeSizeAxes = Axes.X; - Height = 60; + Height = bar_height + graph_height + handle_height; Children = new Drawable[] { - new PauseProgressGraph + new SongProgressGraph { RelativeSizeAxes = Axes.X, Origin = Anchor.BottomCentre, Anchor = Anchor.BottomCentre, - Height = 35, + Height = graph_height, Margin = new MarginPadding { - Bottom = 5 + Bottom = bar_height } }, new Container @@ -55,7 +59,7 @@ namespace osu.Game.Overlays.Pause Origin = Anchor.BottomRight, Anchor = Anchor.BottomRight, RelativeSizeAxes = Axes.X, - Height = 5, + Height = bar_height, Children = new Drawable[] { new Box @@ -72,7 +76,7 @@ namespace osu.Game.Overlays.Pause Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, Width = 0, - Height = 60, + Height = bar_height + graph_height + handle_height, Children = new Drawable[] { new Container @@ -88,12 +92,12 @@ namespace osu.Game.Overlays.Pause Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, RelativeSizeAxes = Axes.X, - Height = 5, + Height = bar_height, Masking = true, EdgeEffect = new EdgeEffect { Type = EdgeEffectType.Glow, - Colour = glowColour, + Colour = glow_colour, Radius = 5 }, Children = new Drawable[] @@ -101,7 +105,7 @@ namespace osu.Game.Overlays.Pause new Box { RelativeSizeAxes = Axes.Both, - Colour = fillColour + Colour = fill_colour } } } @@ -112,7 +116,7 @@ namespace osu.Game.Overlays.Pause Origin = Anchor.BottomRight, Anchor = Anchor.BottomRight, Width = 2, - Height = 35, + Height = bar_height + graph_height , Children = new Drawable[] { new Box @@ -124,8 +128,8 @@ namespace osu.Game.Overlays.Pause { Origin = Anchor.BottomCentre, Anchor = Anchor.TopCentre, - Width = 14, - Height = 25, + Width = handle_width, + Height = handle_height, CornerRadius = 5, Masking = true, Children = new Drawable[] diff --git a/osu.Game/Graphics/UserInterface/SongProgressGraph.cs b/osu.Game/Graphics/UserInterface/SongProgressGraph.cs new file mode 100644 index 0000000000..4af7b8e857 --- /dev/null +++ b/osu.Game/Graphics/UserInterface/SongProgressGraph.cs @@ -0,0 +1,9 @@ +using osu.Framework.Graphics.Containers; + +namespace osu.Game.Graphics.UserInterface +{ + public class SongProgressGraph : Container + { + // TODO: Implement the song progress graph + } +} diff --git a/osu.Game/Overlays/Pause/PauseOverlay.cs b/osu.Game/Overlays/Pause/PauseOverlay.cs index 3cf514b7c8..3d1e52bb20 100644 --- a/osu.Game/Overlays/Pause/PauseOverlay.cs +++ b/osu.Game/Overlays/Pause/PauseOverlay.cs @@ -186,12 +186,6 @@ namespace osu.Game.Overlays.Pause Anchor = Anchor.TopCentre } } - }, - new PauseProgressBar - { - Origin = Anchor.BottomCentre, - Anchor = Anchor.BottomCentre, - Width = 1f } }; diff --git a/osu.Game/Overlays/Pause/PauseProgressGraph.cs b/osu.Game/Overlays/Pause/PauseProgressGraph.cs deleted file mode 100644 index fab9f37923..0000000000 --- a/osu.Game/Overlays/Pause/PauseProgressGraph.cs +++ /dev/null @@ -1,9 +0,0 @@ -using osu.Framework.Graphics.Containers; - -namespace osu.Game.Overlays.Pause -{ - public class PauseProgressGraph : Container - { - // TODO: Implement the pause progress graph - } -} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index f8fa2c951a..2b26c1ee50 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -247,11 +247,11 @@ - - + + From 3d0feb4de9073790c5717f7f7cf67620a3b5e0df Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 7 Feb 2017 01:49:41 -0400 Subject: [PATCH 002/442] Very basic implementation of the graph --- .../Tests/TestCaseSongProgressBar.cs | 55 +++++++------ .../Graphics/UserInterface/SongProgressBar.cs | 8 +- .../UserInterface/SongProgressGraph.cs | 58 ++++++++++++- .../UserInterface/SongProgressGraphColumn.cs | 81 +++++++++++++++++++ osu.Game/osu.Game.csproj | 1 + 5 files changed, 174 insertions(+), 29 deletions(-) create mode 100644 osu.Game/Graphics/UserInterface/SongProgressGraphColumn.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgressBar.cs b/osu.Desktop.VisualTests/Tests/TestCaseSongProgressBar.cs index 479dac895e..dbb9ad0e49 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSongProgressBar.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSongProgressBar.cs @@ -1,26 +1,35 @@ -using System; -using osu.Framework.Graphics; -using osu.Framework.GameModes.Testing; +using System; +using OpenTK.Graphics; using osu.Game.Graphics.UserInterface; +using osu.Framework.Graphics; +using osu.Framework.GameModes.Testing; +using osu.Framework.Graphics.Sprites; +using osu.Framework.GameModes.Testing; +using osu.Framework.Graphics.Colour; -namespace osu.Desktop.VisualTests -{ - public class TestCaseSongProgressBar : TestCase - { - public override string Name => @"SongProgressBar"; - - public override string Description => @"Tests the song progress bar"; - - public override void Reset() - { - base.Reset(); - - Add(new SongProgressBar +namespace osu.Desktop.VisualTests +{ + public class TestCaseSongProgressBar : TestCase + { + public override string Name => @"SongProgressBar"; + + public override string Description => @"Tests the song progress bar"; + + public override void Reset() + { + base.Reset(); + + Add(new Box { - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - RelativeSizeAxes = Axes.X - }); - } - } -} + ColourInfo = ColourInfo.GradientVertical(Color4.WhiteSmoke, Color4.Gray), + RelativeSizeAxes = Framework.Graphics.Axes.Both, + }); + Add(new SongProgressBar + { + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + RelativeSizeAxes = Axes.X + }); + } + } +} diff --git a/osu.Game/Graphics/UserInterface/SongProgressBar.cs b/osu.Game/Graphics/UserInterface/SongProgressBar.cs index ec208ad0de..1c837a980f 100644 --- a/osu.Game/Graphics/UserInterface/SongProgressBar.cs +++ b/osu.Game/Graphics/UserInterface/SongProgressBar.cs @@ -11,13 +11,14 @@ namespace osu.Game.Graphics.UserInterface public class SongProgressBar : Container { private const int bar_height = 5; - private const int graph_height = 40; + private const int graph_height = 34; private const int handle_height = 25; private const int handle_width = 14; private Color4 fill_colour = new Color4(221, 255, 255, 255); private Color4 glow_colour = new Color4(221, 255, 255, 150); private Container fill; + private SongProgressGraph progressGraph; private WorkingBeatmap current; [BackgroundDependencyLoader] @@ -33,6 +34,7 @@ namespace osu.Game.Graphics.UserInterface if (current?.TrackLoaded ?? false) { fill.Width = (float)(current.Track.CurrentTime / current.Track.Length); + progressGraph.Progress = fill.Width; } } @@ -43,7 +45,7 @@ namespace osu.Game.Graphics.UserInterface Children = new Drawable[] { - new SongProgressGraph + progressGraph = new SongProgressGraph { RelativeSizeAxes = Axes.X, Origin = Anchor.BottomCentre, @@ -116,7 +118,7 @@ namespace osu.Game.Graphics.UserInterface Origin = Anchor.BottomRight, Anchor = Anchor.BottomRight, Width = 2, - Height = bar_height + graph_height , + Height = bar_height + graph_height, Children = new Drawable[] { new Box diff --git a/osu.Game/Graphics/UserInterface/SongProgressGraph.cs b/osu.Game/Graphics/UserInterface/SongProgressGraph.cs index 4af7b8e857..4e03f0a906 100644 --- a/osu.Game/Graphics/UserInterface/SongProgressGraph.cs +++ b/osu.Game/Graphics/UserInterface/SongProgressGraph.cs @@ -1,9 +1,61 @@ -using osu.Framework.Graphics.Containers; +using OpenTK; +using System; +using System.Collections.Generic; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Primitives; namespace osu.Game.Graphics.UserInterface { - public class SongProgressGraph : Container + public class SongProgressGraph : BufferedContainer { - // TODO: Implement the song progress graph + private List columns = new List(); + + public override bool HandleInput => false; + + private float progress; + public float Progress + { + get + { + return progress; + } + set + { + if (value == progress) return; + progress = value; + + for (int i = 0; i < columns.Count; i++) + { + columns[i].State = i <= (columns.Count * progress) ? SongProgressGraphColumnState.Lit : SongProgressGraphColumnState.Dimmed; + } + + ForceRedraw(); + } + } + + public SongProgressGraph() + { + CacheDrawnFrameBuffer = true; + PixelSnapping = true; + + Margin = new MarginPadding + { + Left = 1, + Right = 1 + }; + + var random = new Random(); + for (int column = 0; column < 1200; column += 3) + { + columns.Add(new SongProgressGraphColumn + { + Position = new Vector2(column, 0), + Filled = random.Next(1, 11), + State = SongProgressGraphColumnState.Dimmed + }); + + Add(columns[columns.Count - 1]); + } + } } } diff --git a/osu.Game/Graphics/UserInterface/SongProgressGraphColumn.cs b/osu.Game/Graphics/UserInterface/SongProgressGraphColumn.cs new file mode 100644 index 0000000000..c14e0ba634 --- /dev/null +++ b/osu.Game/Graphics/UserInterface/SongProgressGraphColumn.cs @@ -0,0 +1,81 @@ +using OpenTK; +using OpenTK.Graphics; +using System.Collections.Generic; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; + +namespace osu.Game.Graphics.UserInterface +{ + public class SongProgressGraphColumn : Container + { + private int rows = 11; + private Color4 empty_colour = Color4.White.Opacity(50); + private Color4 lit_colour = new Color4(221, 255, 255, 255); + private Color4 dimmed_colour = Color4.White.Opacity(175); + + private List drawableRows = new List(); + + private int filled; + public int Filled + { + get + { + return filled; + } + set + { + if (value == filled) return; + filled = value; + } + } + + private SongProgressGraphColumnState state; + public SongProgressGraphColumnState State + { + get + { + return state; + } + set + { + if (value == state) return; + state = value; + + fillActive(value == SongProgressGraphColumnState.Lit ? lit_colour : dimmed_colour); + } + } + + private void fillActive(Color4 color) + { + for (int i = 0; i < drawableRows.Count; i++) + { + drawableRows[i].Colour = i <= Filled ? color : empty_colour; + } + } + + public SongProgressGraphColumn() + { + Size = new Vector2(4, rows * 3); + + for (int row = 0; row < rows * 3; row += 3) + { + drawableRows.Add(new Box + { + Size = new Vector2(2), + Position = new Vector2(0, row + 1) + }); + + Add(drawableRows[drawableRows.Count - 1]); + } + + // Reverse drawableRows so when iterating through them they start at the bottom + drawableRows.Reverse(); + } + } + + public enum SongProgressGraphColumnState + { + Lit, Dimmed + } +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 0de83a3134..c43bba96bd 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -257,6 +257,7 @@ + From dfc53be095bbdfb8bc15ecfbacc84039922a86c4 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 7 Feb 2017 13:02:56 -0400 Subject: [PATCH 003/442] Further work on the progress graph, column states moved to an enum, SongProgressGraphColumnState -> ColumnState, graph can resize dynamically --- .../Graphics/UserInterface/SongProgressBar.cs | 2 + .../UserInterface/SongProgressGraph.cs | 69 ++++++++++++------- .../UserInterface/SongProgressGraphColumn.cs | 8 +-- 3 files changed, 50 insertions(+), 29 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/SongProgressBar.cs b/osu.Game/Graphics/UserInterface/SongProgressBar.cs index 1c837a980f..95c53bdd5e 100644 --- a/osu.Game/Graphics/UserInterface/SongProgressBar.cs +++ b/osu.Game/Graphics/UserInterface/SongProgressBar.cs @@ -5,6 +5,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; using osu.Framework.Graphics.Primitives; +using OpenTK; namespace osu.Game.Graphics.UserInterface { @@ -119,6 +120,7 @@ namespace osu.Game.Graphics.UserInterface Anchor = Anchor.BottomRight, Width = 2, Height = bar_height + graph_height, + Position = new Vector2(2, 0), Children = new Drawable[] { new Box diff --git a/osu.Game/Graphics/UserInterface/SongProgressGraph.cs b/osu.Game/Graphics/UserInterface/SongProgressGraph.cs index 4e03f0a906..27f60992c0 100644 --- a/osu.Game/Graphics/UserInterface/SongProgressGraph.cs +++ b/osu.Game/Graphics/UserInterface/SongProgressGraph.cs @@ -3,12 +3,14 @@ using System; using System.Collections.Generic; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; +using osu.Framework.Graphics; namespace osu.Game.Graphics.UserInterface { public class SongProgressGraph : BufferedContainer { private List columns = new List(); + private float lastDrawWidth; public override bool HandleInput => false; @@ -24,38 +26,55 @@ namespace osu.Game.Graphics.UserInterface if (value == progress) return; progress = value; - for (int i = 0; i < columns.Count; i++) - { - columns[i].State = i <= (columns.Count * progress) ? SongProgressGraphColumnState.Lit : SongProgressGraphColumnState.Dimmed; - } - - ForceRedraw(); + redrawProgress(); } } + private void redrawProgress() + { + for (int i = 0; i < columns.Count; i++) + { + columns[i].State = i <= (columns.Count * progress) ? ColumnState.Lit : ColumnState.Dimmed; + } + + ForceRedraw(); + } + + private void recreateGraph() + { + RemoveAll(delegate { return true; }, true); + columns.RemoveAll(delegate { return true; }); + + // Random filled values used for testing + var random = new Random(); + for (int column = 0; column < DrawWidth; column += 3) + { + columns.Add(new SongProgressGraphColumn + { + Position = new Vector2(column + 1, 0), + Filled = random.Next(1, 11), + State = ColumnState.Dimmed + }); + + Add(columns[columns.Count - 1]); + } + + redrawProgress(); + } + + protected override void Update() + { + base.Update(); + + if (DrawWidth == lastDrawWidth) return; + recreateGraph(); + lastDrawWidth = DrawWidth; + } + public SongProgressGraph() { CacheDrawnFrameBuffer = true; PixelSnapping = true; - - Margin = new MarginPadding - { - Left = 1, - Right = 1 - }; - - var random = new Random(); - for (int column = 0; column < 1200; column += 3) - { - columns.Add(new SongProgressGraphColumn - { - Position = new Vector2(column, 0), - Filled = random.Next(1, 11), - State = SongProgressGraphColumnState.Dimmed - }); - - Add(columns[columns.Count - 1]); - } } } } diff --git a/osu.Game/Graphics/UserInterface/SongProgressGraphColumn.cs b/osu.Game/Graphics/UserInterface/SongProgressGraphColumn.cs index c14e0ba634..7bf1169641 100644 --- a/osu.Game/Graphics/UserInterface/SongProgressGraphColumn.cs +++ b/osu.Game/Graphics/UserInterface/SongProgressGraphColumn.cs @@ -30,8 +30,8 @@ namespace osu.Game.Graphics.UserInterface } } - private SongProgressGraphColumnState state; - public SongProgressGraphColumnState State + private ColumnState state; + public ColumnState State { get { @@ -42,7 +42,7 @@ namespace osu.Game.Graphics.UserInterface if (value == state) return; state = value; - fillActive(value == SongProgressGraphColumnState.Lit ? lit_colour : dimmed_colour); + fillActive(value == ColumnState.Lit ? lit_colour : dimmed_colour); } } @@ -74,7 +74,7 @@ namespace osu.Game.Graphics.UserInterface } } - public enum SongProgressGraphColumnState + public enum ColumnState { Lit, Dimmed } From 02ddaf336e9d94e151c6c6d3228262651578c1e4 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 7 Feb 2017 13:26:17 -0400 Subject: [PATCH 004/442] Added license headers --- osu.Desktop.VisualTests/Tests/TestCaseSongProgressBar.cs | 5 ++++- osu.Game/Graphics/UserInterface/SongProgressBar.cs | 5 ++++- osu.Game/Graphics/UserInterface/SongProgressGraph.cs | 5 ++++- osu.Game/Graphics/UserInterface/SongProgressGraphColumn.cs | 5 ++++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgressBar.cs b/osu.Desktop.VisualTests/Tests/TestCaseSongProgressBar.cs index dbb9ad0e49..d8696db680 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSongProgressBar.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSongProgressBar.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; using OpenTK.Graphics; using osu.Game.Graphics.UserInterface; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/UserInterface/SongProgressBar.cs b/osu.Game/Graphics/UserInterface/SongProgressBar.cs index 95c53bdd5e..14f57d17d2 100644 --- a/osu.Game/Graphics/UserInterface/SongProgressBar.cs +++ b/osu.Game/Graphics/UserInterface/SongProgressBar.cs @@ -1,4 +1,7 @@ -using OpenTK.Graphics; +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Graphics/UserInterface/SongProgressGraph.cs b/osu.Game/Graphics/UserInterface/SongProgressGraph.cs index 27f60992c0..deaab3cc74 100644 --- a/osu.Game/Graphics/UserInterface/SongProgressGraph.cs +++ b/osu.Game/Graphics/UserInterface/SongProgressGraph.cs @@ -1,4 +1,7 @@ -using OpenTK; +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; using System; using System.Collections.Generic; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Graphics/UserInterface/SongProgressGraphColumn.cs b/osu.Game/Graphics/UserInterface/SongProgressGraphColumn.cs index 7bf1169641..cb7af44c0b 100644 --- a/osu.Game/Graphics/UserInterface/SongProgressGraphColumn.cs +++ b/osu.Game/Graphics/UserInterface/SongProgressGraphColumn.cs @@ -1,4 +1,7 @@ -using OpenTK; +// 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 System.Collections.Generic; using osu.Framework.Graphics; From 50f93bc2153e1e6875bdf9e4727a74eb58481097 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 8 Feb 2017 16:22:31 -0400 Subject: [PATCH 005/442] Refactoring to SongProgress in osu.Game.Screens.Play, moving out progress bar into it's own class --- ...ProgressBar.cs => TestCaseSongProgress.cs} | 10 +- .../osu.Desktop.VisualTests.csproj | 2 +- .../Graphics/UserInterface/SongProgressBar.cs | 158 ------------------ osu.Game/Screens/Play/SongProgress.cs | 113 +++++++++++++ osu.Game/Screens/Play/SongProgressBar.cs | 15 ++ .../Play}/SongProgressGraph.cs | 13 +- .../Play}/SongProgressGraphColumn.cs | 5 +- osu.Game/osu.Game.csproj | 7 +- 8 files changed, 148 insertions(+), 175 deletions(-) rename osu.Desktop.VisualTests/Tests/{TestCaseSongProgressBar.cs => TestCaseSongProgress.cs} (74%) delete mode 100644 osu.Game/Graphics/UserInterface/SongProgressBar.cs create mode 100644 osu.Game/Screens/Play/SongProgress.cs create mode 100644 osu.Game/Screens/Play/SongProgressBar.cs rename osu.Game/{Graphics/UserInterface => Screens/Play}/SongProgressGraph.cs (83%) rename osu.Game/{Graphics/UserInterface => Screens/Play}/SongProgressGraphColumn.cs (91%) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgressBar.cs b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs similarity index 74% rename from osu.Desktop.VisualTests/Tests/TestCaseSongProgressBar.cs rename to osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs index d8696db680..2f9183bf65 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSongProgressBar.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs @@ -3,7 +3,7 @@ using System; using OpenTK.Graphics; -using osu.Game.Graphics.UserInterface; +using osu.Game.Screens.Play; using osu.Framework.Graphics; using osu.Framework.GameModes.Testing; using osu.Framework.Graphics.Sprites; @@ -12,11 +12,11 @@ using osu.Framework.Graphics.Colour; namespace osu.Desktop.VisualTests { - public class TestCaseSongProgressBar : TestCase + public class TestCaseSongProgress : TestCase { - public override string Name => @"SongProgressBar"; + public override string Name => @"Song Progress"; - public override string Description => @"Tests the song progress bar"; + public override string Description => @"With real data"; public override void Reset() { @@ -27,7 +27,7 @@ namespace osu.Desktop.VisualTests ColourInfo = ColourInfo.GradientVertical(Color4.WhiteSmoke, Color4.Gray), RelativeSizeAxes = Framework.Graphics.Axes.Both, }); - Add(new SongProgressBar + Add(new SongProgress { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index 1619c18e4c..b9c092b12a 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -188,7 +188,7 @@ - + diff --git a/osu.Game/Graphics/UserInterface/SongProgressBar.cs b/osu.Game/Graphics/UserInterface/SongProgressBar.cs deleted file mode 100644 index 14f57d17d2..0000000000 --- a/osu.Game/Graphics/UserInterface/SongProgressBar.cs +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using OpenTK.Graphics; -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Containers; -using osu.Game.Beatmaps; -using osu.Framework.Graphics.Primitives; -using OpenTK; - -namespace osu.Game.Graphics.UserInterface -{ - public class SongProgressBar : Container - { - private const int bar_height = 5; - private const int graph_height = 34; - private const int handle_height = 25; - private const int handle_width = 14; - private Color4 fill_colour = new Color4(221, 255, 255, 255); - private Color4 glow_colour = new Color4(221, 255, 255, 150); - - private Container fill; - private SongProgressGraph progressGraph; - private WorkingBeatmap current; - - [BackgroundDependencyLoader] - private void load(OsuGameBase osuGame) - { - current = osuGame.Beatmap.Value; - } - - protected override void Update() - { - base.Update(); - - if (current?.TrackLoaded ?? false) - { - fill.Width = (float)(current.Track.CurrentTime / current.Track.Length); - progressGraph.Progress = fill.Width; - } - } - - public SongProgressBar() - { - RelativeSizeAxes = Axes.X; - Height = bar_height + graph_height + handle_height; - - Children = new Drawable[] - { - progressGraph = new SongProgressGraph - { - RelativeSizeAxes = Axes.X, - Origin = Anchor.BottomCentre, - Anchor = Anchor.BottomCentre, - Height = graph_height, - Margin = new MarginPadding - { - Bottom = bar_height - } - }, - new Container - { - Origin = Anchor.BottomRight, - Anchor = Anchor.BottomRight, - RelativeSizeAxes = Axes.X, - Height = bar_height, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = Color4.Black, - Alpha = 0.5f - } - } - }, - fill = new Container - { - RelativeSizeAxes = Axes.X, - Origin = Anchor.BottomLeft, - Anchor = Anchor.BottomLeft, - Width = 0, - Height = bar_height + graph_height + handle_height, - Children = new Drawable[] - { - new Container - { - RelativeSizeAxes = Axes.Both, - Origin = Anchor.BottomLeft, - Anchor = Anchor.BottomLeft, - Masking = true, - Children = new Drawable[] - { - new Container - { - Origin = Anchor.BottomLeft, - Anchor = Anchor.BottomLeft, - RelativeSizeAxes = Axes.X, - Height = bar_height, - Masking = true, - EdgeEffect = new EdgeEffect - { - Type = EdgeEffectType.Glow, - Colour = glow_colour, - Radius = 5 - }, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = fill_colour - } - } - } - } - }, - new Container - { - Origin = Anchor.BottomRight, - Anchor = Anchor.BottomRight, - Width = 2, - Height = bar_height + graph_height, - Position = new Vector2(2, 0), - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = Color4.White - }, - new Container - { - Origin = Anchor.BottomCentre, - Anchor = Anchor.TopCentre, - Width = handle_width, - Height = handle_height, - CornerRadius = 5, - Masking = true, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = Color4.White - } - } - } - } - } - } - } - }; - } - } -} diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs new file mode 100644 index 0000000000..85ce79dbf0 --- /dev/null +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -0,0 +1,113 @@ +// 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.Game.Beatmaps; +using osu.Game.Screens.Play; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Primitives; +using osu.Game.Overlays; + +namespace osu.Game.Screens.Play +{ + public class SongProgress : Container + { + private const int graph_height = 34; + private const int handle_height = 25; + private const int handle_width = 14; + public static readonly Color4 FILL_COLOUR = new Color4(221, 255, 255, 255); + public static readonly Color4 GLOW_COLOUR = new Color4(221, 255, 255, 150); + + private SongProgressBar progress; + private SongProgressGraph graph; + private WorkingBeatmap current; + + [BackgroundDependencyLoader] + private void load(OsuGameBase osuGame) + { + current = osuGame.Beatmap.Value; + } + + protected override void Update() + { + base.Update(); + + if (current?.TrackLoaded ?? false) + { + float currentProgress = (float)(current.Track.CurrentTime / current.Track.Length); + + progress.UpdatePosition(currentProgress); + graph.Progress = (int)(graph.ColumnCount * currentProgress); + } + } + + public SongProgress() + { + RelativeSizeAxes = Axes.X; + Height = SongProgressBar.BAR_HEIGHT + graph_height + handle_height; + + Children = new Drawable[] + { + graph = new SongProgressGraph + { + RelativeSizeAxes = Axes.X, + Origin = Anchor.BottomCentre, + Anchor = Anchor.BottomCentre, + Height = graph_height, + Margin = new MarginPadding + { + Bottom = SongProgressBar.BAR_HEIGHT + } + }, + progress = new SongProgressBar + { + Origin = Anchor.BottomCentre, + Anchor = Anchor.BottomCentre, + IsEnabled = true, + SeekRequested = delegate (float position) + { + Framework.Logging.Logger.Log($@"Seeked to {position}"); + } + } + + //handle = new Container + // { + // Origin = Anchor.BottomLeft, + // Anchor = Anchor.BottomLeft, + // Width = 2, + // Height = bar_height + graph_height, + // Position = new Vector2(2, 0), + // Children = new Drawable[] + // { + // new Box + // { + // RelativeSizeAxes = Axes.Both, + // Colour = Color4.White + // }, + // new Container + // { + // Origin = Anchor.BottomCentre, + // Anchor = Anchor.TopCentre, + // Width = handle_width, + // Height = handle_height, + // CornerRadius = 5, + // Masking = true, + // Children = new Drawable[] + // { + // new Box + // { + // RelativeSizeAxes = Axes.Both, + // Colour = Color4.White + // } + // } + // } + // } + // } + }; + } + } +} diff --git a/osu.Game/Screens/Play/SongProgressBar.cs b/osu.Game/Screens/Play/SongProgressBar.cs new file mode 100644 index 0000000000..7b29dd2ac0 --- /dev/null +++ b/osu.Game/Screens/Play/SongProgressBar.cs @@ -0,0 +1,15 @@ +using System; +using osu.Game.Overlays; +namespace osu.Game.Screens.Play +{ + public class SongProgressBar : DragBar + { + public static readonly int BAR_HEIGHT = 5; + + public SongProgressBar() + { + Colour = SongProgress.FILL_COLOUR; + Height = BAR_HEIGHT; + } + } +} diff --git a/osu.Game/Graphics/UserInterface/SongProgressGraph.cs b/osu.Game/Screens/Play/SongProgressGraph.cs similarity index 83% rename from osu.Game/Graphics/UserInterface/SongProgressGraph.cs rename to osu.Game/Screens/Play/SongProgressGraph.cs index deaab3cc74..19dc61e0f2 100644 --- a/osu.Game/Graphics/UserInterface/SongProgressGraph.cs +++ b/osu.Game/Screens/Play/SongProgressGraph.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics; -namespace osu.Game.Graphics.UserInterface +namespace osu.Game.Screens.Play { public class SongProgressGraph : BufferedContainer { @@ -16,9 +16,10 @@ namespace osu.Game.Graphics.UserInterface private float lastDrawWidth; public override bool HandleInput => false; + public int ColumnCount => columns.Count; - private float progress; - public float Progress + private int progress; + public int Progress { get { @@ -37,7 +38,7 @@ namespace osu.Game.Graphics.UserInterface { for (int i = 0; i < columns.Count; i++) { - columns[i].State = i <= (columns.Count * progress) ? ColumnState.Lit : ColumnState.Dimmed; + columns[i].State = i <= progress ? ColumnState.Lit : ColumnState.Dimmed; } ForceRedraw(); @@ -48,7 +49,7 @@ namespace osu.Game.Graphics.UserInterface RemoveAll(delegate { return true; }, true); columns.RemoveAll(delegate { return true; }); - // Random filled values used for testing + // Random filled values used for testing for now var random = new Random(); for (int column = 0; column < DrawWidth; column += 3) { @@ -70,7 +71,7 @@ namespace osu.Game.Graphics.UserInterface base.Update(); if (DrawWidth == lastDrawWidth) return; - recreateGraph(); + //recreateGraph(); lastDrawWidth = DrawWidth; } diff --git a/osu.Game/Graphics/UserInterface/SongProgressGraphColumn.cs b/osu.Game/Screens/Play/SongProgressGraphColumn.cs similarity index 91% rename from osu.Game/Graphics/UserInterface/SongProgressGraphColumn.cs rename to osu.Game/Screens/Play/SongProgressGraphColumn.cs index cb7af44c0b..892c758bf1 100644 --- a/osu.Game/Graphics/UserInterface/SongProgressGraphColumn.cs +++ b/osu.Game/Screens/Play/SongProgressGraphColumn.cs @@ -4,17 +4,18 @@ using OpenTK; using OpenTK.Graphics; using System.Collections.Generic; +using osu.Game.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -namespace osu.Game.Graphics.UserInterface +namespace osu.Game.Screens.Play { public class SongProgressGraphColumn : Container { private int rows = 11; private Color4 empty_colour = Color4.White.Opacity(50); - private Color4 lit_colour = new Color4(221, 255, 255, 255); + private Color4 lit_colour = SongProgress.FILL_COLOUR; private Color4 dimmed_colour = Color4.White.Opacity(175); private List drawableRows = new List(); diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index c43bba96bd..3f84a9eb80 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -255,9 +255,10 @@ - - - + + + + From 7fea2331812471e8e0df1bf9b92515221934361e Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 9 Feb 2017 16:28:40 -0400 Subject: [PATCH 006/442] Removed gradient from test case, modified DragBar to allow access to what's needed in the progress bar, styled the progress bar --- .../Tests/TestCaseSongProgress.cs | 5 -- osu.Game/Overlays/DragBar.cs | 24 +++++--- osu.Game/Screens/Play/SongProgress.cs | 54 ++++------------ osu.Game/Screens/Play/SongProgressBar.cs | 61 +++++++++++++++++-- osu.Game/Screens/Play/SongProgressGraph.cs | 2 +- .../Screens/Play/SongProgressGraphColumn.cs | 1 + 6 files changed, 86 insertions(+), 61 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs index 2f9183bf65..bd6943bece 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs @@ -22,11 +22,6 @@ namespace osu.Desktop.VisualTests { base.Reset(); - Add(new Box - { - ColourInfo = ColourInfo.GradientVertical(Color4.WhiteSmoke, Color4.Gray), - RelativeSizeAxes = Framework.Graphics.Axes.Both, - }); Add(new SongProgress { Anchor = Anchor.BottomCentre, diff --git a/osu.Game/Overlays/DragBar.cs b/osu.Game/Overlays/DragBar.cs index 32a1ed4933..5b1c9c5a37 100644 --- a/osu.Game/Overlays/DragBar.cs +++ b/osu.Game/Overlays/DragBar.cs @@ -11,7 +11,8 @@ namespace osu.Game.Overlays { public class DragBar : Container { - private Box fill; + protected Container fillContainer; + protected Box fill; public Action SeekRequested; private bool isDragging; @@ -24,7 +25,7 @@ namespace osu.Game.Overlays { enabled = value; if (!enabled) - fill.Width = 0; + fillContainer.Width = 0; } } @@ -34,12 +35,19 @@ namespace osu.Game.Overlays Children = new Drawable[] { - fill = new Box() + fillContainer = new Container { - Origin = Anchor.CentreLeft, - Anchor = Anchor.CentreLeft, + Origin = Anchor.BottomLeft, + Anchor = Anchor.BottomLeft, RelativeSizeAxes = Axes.Both, - Width = 0 + Width = 0, + Children = new Drawable[] + { + fill = new Box + { + RelativeSizeAxes = Axes.Both + } + } } }; } @@ -48,7 +56,7 @@ namespace osu.Game.Overlays { if (isDragging || !IsEnabled) return; - fill.Width = position; + fillContainer.Width = position; } private void seek(InputState state) @@ -56,7 +64,7 @@ namespace osu.Game.Overlays if (!IsEnabled) return; float seekLocation = state.Mouse.Position.X / DrawWidth; SeekRequested?.Invoke(seekLocation); - fill.Width = seekLocation; + fillContainer.Width = seekLocation; } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 85ce79dbf0..7e87df75e5 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -16,9 +16,8 @@ namespace osu.Game.Screens.Play { public class SongProgress : Container { - private const int graph_height = 34; - private const int handle_height = 25; - private const int handle_width = 14; + public static readonly int BAR_HEIGHT = 5; + public static readonly int GRAPH_HEIGHT = 34; public static readonly Color4 FILL_COLOUR = new Color4(221, 255, 255, 255); public static readonly Color4 GLOW_COLOUR = new Color4(221, 255, 255, 150); @@ -40,15 +39,20 @@ namespace osu.Game.Screens.Play { float currentProgress = (float)(current.Track.CurrentTime / current.Track.Length); + progress.IsEnabled = true; progress.UpdatePosition(currentProgress); graph.Progress = (int)(graph.ColumnCount * currentProgress); } + else + { + progress.IsEnabled = false; + } } public SongProgress() { RelativeSizeAxes = Axes.X; - Height = SongProgressBar.BAR_HEIGHT + graph_height + handle_height; + Height = BAR_HEIGHT + GRAPH_HEIGHT + SongProgressBar.HANDLE_SIZE.Y; Children = new Drawable[] { @@ -57,56 +61,22 @@ namespace osu.Game.Screens.Play RelativeSizeAxes = Axes.X, Origin = Anchor.BottomCentre, Anchor = Anchor.BottomCentre, - Height = graph_height, + Height = GRAPH_HEIGHT, Margin = new MarginPadding { - Bottom = SongProgressBar.BAR_HEIGHT + Bottom = BAR_HEIGHT } }, progress = new SongProgressBar { Origin = Anchor.BottomCentre, Anchor = Anchor.BottomCentre, - IsEnabled = true, SeekRequested = delegate (float position) { - Framework.Logging.Logger.Log($@"Seeked to {position}"); + current?.Track?.Seek(current.Track.Length * position); + current?.Track?.Start(); } } - - //handle = new Container - // { - // Origin = Anchor.BottomLeft, - // Anchor = Anchor.BottomLeft, - // Width = 2, - // Height = bar_height + graph_height, - // Position = new Vector2(2, 0), - // Children = new Drawable[] - // { - // new Box - // { - // RelativeSizeAxes = Axes.Both, - // Colour = Color4.White - // }, - // new Container - // { - // Origin = Anchor.BottomCentre, - // Anchor = Anchor.TopCentre, - // Width = handle_width, - // Height = handle_height, - // CornerRadius = 5, - // Masking = true, - // Children = new Drawable[] - // { - // new Box - // { - // RelativeSizeAxes = Axes.Both, - // Colour = Color4.White - // } - // } - // } - // } - // } }; } } diff --git a/osu.Game/Screens/Play/SongProgressBar.cs b/osu.Game/Screens/Play/SongProgressBar.cs index 7b29dd2ac0..9c6d46b79c 100644 --- a/osu.Game/Screens/Play/SongProgressBar.cs +++ b/osu.Game/Screens/Play/SongProgressBar.cs @@ -1,15 +1,66 @@ -using System; -using osu.Game.Overlays; +// 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.Game.Overlays; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Primitives; + namespace osu.Game.Screens.Play { public class SongProgressBar : DragBar { - public static readonly int BAR_HEIGHT = 5; + public static readonly Vector2 HANDLE_SIZE = new Vector2(14, 25); + + private Container handle; public SongProgressBar() { - Colour = SongProgress.FILL_COLOUR; - Height = BAR_HEIGHT; + fill.Colour = SongProgress.FILL_COLOUR; + Height = SongProgress.BAR_HEIGHT; + + Add(new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, + Alpha = 0.5f, + Depth = 1 + }); + fillContainer.Add(handle = new Container + { + Origin = Anchor.BottomRight, + Anchor = Anchor.BottomRight, + Width = 2, + Height = SongProgress.BAR_HEIGHT + SongProgress.GRAPH_HEIGHT, + Colour = Color4.White, + Position = new Vector2(2, 0), + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + }, + new Container + { + Origin = Anchor.BottomCentre, + Anchor = Anchor.TopCentre, + Size = HANDLE_SIZE, + CornerRadius = 5, + Masking = true, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.White + } + } + } + } + }); } } } diff --git a/osu.Game/Screens/Play/SongProgressGraph.cs b/osu.Game/Screens/Play/SongProgressGraph.cs index 19dc61e0f2..20a7608ffe 100644 --- a/osu.Game/Screens/Play/SongProgressGraph.cs +++ b/osu.Game/Screens/Play/SongProgressGraph.cs @@ -71,7 +71,7 @@ namespace osu.Game.Screens.Play base.Update(); if (DrawWidth == lastDrawWidth) return; - //recreateGraph(); + recreateGraph(); lastDrawWidth = DrawWidth; } diff --git a/osu.Game/Screens/Play/SongProgressGraphColumn.cs b/osu.Game/Screens/Play/SongProgressGraphColumn.cs index 892c758bf1..894e7009c2 100644 --- a/osu.Game/Screens/Play/SongProgressGraphColumn.cs +++ b/osu.Game/Screens/Play/SongProgressGraphColumn.cs @@ -8,6 +8,7 @@ using osu.Game.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Transformations; namespace osu.Game.Screens.Play { From 4d7766b92bced8d96af023271e0c1420d9a68dc5 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 9 Feb 2017 18:51:05 -0400 Subject: [PATCH 007/442] Added displaying given values to the graph --- osu.Game/Screens/Play/SongProgress.cs | 20 ++++++++- osu.Game/Screens/Play/SongProgressGraph.cs | 51 ++++++++++++++++++---- 2 files changed, 62 insertions(+), 9 deletions(-) diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 7e87df75e5..3cbf70b612 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -11,6 +11,8 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Game.Overlays; +using System.Collections.Generic; +using System; namespace osu.Game.Screens.Play { @@ -49,6 +51,11 @@ namespace osu.Game.Screens.Play } } + public void DisplayValues(List values) + { + graph.Values = values; + } + public SongProgress() { RelativeSizeAxes = Axes.X; @@ -77,7 +84,18 @@ namespace osu.Game.Screens.Play current?.Track?.Start(); } } - }; + }; + + // TODO: Remove + var random = new Random(); + + List newValues = new List(); + for (int i = 0; i < 1000; i++) + { + newValues.Add(random.Next(1, 11)); + } + + DisplayValues(newValues); } } } diff --git a/osu.Game/Screens/Play/SongProgressGraph.cs b/osu.Game/Screens/Play/SongProgressGraph.cs index 20a7608ffe..13bae892d7 100644 --- a/osu.Game/Screens/Play/SongProgressGraph.cs +++ b/osu.Game/Screens/Play/SongProgressGraph.cs @@ -2,11 +2,9 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; -using System; using System.Collections.Generic; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Primitives; -using osu.Framework.Graphics; +using System; namespace osu.Game.Screens.Play { @@ -34,6 +32,22 @@ namespace osu.Game.Screens.Play } } + private List calculatedValues = new List(); // values but adjusted to fit the amount of columns + private List values; + public List Values + { + get + { + return values; + } + set + { + if (value == values) return; + values = value; + recreateGraph(); + } + } + private void redrawProgress() { for (int i = 0; i < columns.Count; i++) @@ -44,25 +58,46 @@ namespace osu.Game.Screens.Play ForceRedraw(); } + private void redrawFilled() + { + for (int i = 0; i < ColumnCount; i++) + { + columns[i].Filled = calculatedValues[i]; + } + + ForceRedraw(); + } + + private void recalculateValues() + { + calculatedValues.RemoveAll(delegate { return true; }); + + float step = (float)values.Count / (float)ColumnCount; + + for (float i = 0; i < values.Count; i += step) + { + calculatedValues.Add(values[(int)i]); + } + } + private void recreateGraph() { RemoveAll(delegate { return true; }, true); columns.RemoveAll(delegate { return true; }); - // Random filled values used for testing for now - var random = new Random(); - for (int column = 0; column < DrawWidth; column += 3) + for (int x = 0; x < DrawWidth; x += 3) { columns.Add(new SongProgressGraphColumn { - Position = new Vector2(column + 1, 0), - Filled = random.Next(1, 11), + Position = new Vector2(x + 1, 0), State = ColumnState.Dimmed }); Add(columns[columns.Count - 1]); } + recalculateValues(); + redrawFilled(); redrawProgress(); } From ac6726ee2ea050f1a240191ed1fb85b0e2ae52b8 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 9 Feb 2017 18:56:50 -0400 Subject: [PATCH 008/442] Fixed setting column filled values not updating visually, added gray background to visual test --- osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs | 5 +++++ osu.Game/Screens/Play/SongProgressGraphColumn.cs | 10 +++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs index bd6943bece..36dd789709 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs @@ -22,6 +22,11 @@ namespace osu.Desktop.VisualTests { base.Reset(); + Add(new Box + { + Colour = Color4.Gray, + RelativeSizeAxes = Axes.Both + }); Add(new SongProgress { Anchor = Anchor.BottomCentre, diff --git a/osu.Game/Screens/Play/SongProgressGraphColumn.cs b/osu.Game/Screens/Play/SongProgressGraphColumn.cs index 894e7009c2..b92cf63865 100644 --- a/osu.Game/Screens/Play/SongProgressGraphColumn.cs +++ b/osu.Game/Screens/Play/SongProgressGraphColumn.cs @@ -32,6 +32,8 @@ namespace osu.Game.Screens.Play { if (value == filled) return; filled = value; + + fillActive(); } } @@ -47,15 +49,17 @@ namespace osu.Game.Screens.Play if (value == state) return; state = value; - fillActive(value == ColumnState.Lit ? lit_colour : dimmed_colour); + fillActive(); } } - private void fillActive(Color4 color) + private void fillActive() { + Color4 colour = State == ColumnState.Lit ? lit_colour : dimmed_colour; + for (int i = 0; i < drawableRows.Count; i++) { - drawableRows[i].Colour = i <= Filled ? color : empty_colour; + drawableRows[i].Colour = i <= Filled ? colour : empty_colour; } } From 843b58c8f4a12dd8ba400a9dbe37c1890572b0c4 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 9 Feb 2017 19:08:23 -0400 Subject: [PATCH 009/442] Moved random graph values to test case, added null handling for graph values --- .../Tests/TestCaseSongProgress.cs | 16 ++++++++++++++-- osu.Game/Screens/Play/SongProgress.cs | 13 +------------ osu.Game/Screens/Play/SongProgressGraph.cs | 10 ++++++++++ 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs index 36dd789709..6fa91a46c4 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs @@ -9,15 +9,17 @@ using osu.Framework.GameModes.Testing; using osu.Framework.Graphics.Sprites; using osu.Framework.GameModes.Testing; using osu.Framework.Graphics.Colour; +using System.Collections.Generic; namespace osu.Desktop.VisualTests { public class TestCaseSongProgress : TestCase { public override string Name => @"Song Progress"; - public override string Description => @"With real data"; + private SongProgress progress; + public override void Reset() { base.Reset(); @@ -27,12 +29,22 @@ namespace osu.Desktop.VisualTests Colour = Color4.Gray, RelativeSizeAxes = Axes.Both }); - Add(new SongProgress + Add(progress = new SongProgress { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, RelativeSizeAxes = Axes.X }); + + var random = new Random(); + + List newValues = new List(); + for (int i = 0; i < 1000; i++) + { + newValues.Add(random.Next(1, 11)); + } + + progress.DisplayValues(newValues); } } } diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 3cbf70b612..8568d30d38 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -84,18 +84,7 @@ namespace osu.Game.Screens.Play current?.Track?.Start(); } } - }; - - // TODO: Remove - var random = new Random(); - - List newValues = new List(); - for (int i = 0; i < 1000; i++) - { - newValues.Add(random.Next(1, 11)); - } - - DisplayValues(newValues); + }; } } } diff --git a/osu.Game/Screens/Play/SongProgressGraph.cs b/osu.Game/Screens/Play/SongProgressGraph.cs index 13bae892d7..06810c7d07 100644 --- a/osu.Game/Screens/Play/SongProgressGraph.cs +++ b/osu.Game/Screens/Play/SongProgressGraph.cs @@ -72,6 +72,16 @@ namespace osu.Game.Screens.Play { calculatedValues.RemoveAll(delegate { return true; }); + if (values == null) + { + for (float i = 0; i < ColumnCount; i++) + { + calculatedValues.Add(0); + } + + return; + } + float step = (float)values.Count / (float)ColumnCount; for (float i = 0; i < values.Count; i += step) From 0327c46d36df0d1950c54536262ff38988712480 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 9 Feb 2017 19:29:12 -0400 Subject: [PATCH 010/442] Fixed columns not being able to have zero fill --- osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs | 2 +- osu.Game/Screens/Play/SongProgressGraph.cs | 3 +++ osu.Game/Screens/Play/SongProgressGraphColumn.cs | 9 ++++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs index 6fa91a46c4..1f0b993fee 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs @@ -41,7 +41,7 @@ namespace osu.Desktop.VisualTests List newValues = new List(); for (int i = 0; i < 1000; i++) { - newValues.Add(random.Next(1, 11)); + newValues.Add(random.Next(0, 11)); } progress.DisplayValues(newValues); diff --git a/osu.Game/Screens/Play/SongProgressGraph.cs b/osu.Game/Screens/Play/SongProgressGraph.cs index 06810c7d07..921b630db3 100644 --- a/osu.Game/Screens/Play/SongProgressGraph.cs +++ b/osu.Game/Screens/Play/SongProgressGraph.cs @@ -70,6 +70,9 @@ namespace osu.Game.Screens.Play private void recalculateValues() { + // Resizes values to fit the amount of columns and stores it in calculatedValues + // Defaults to all zeros if values is null + calculatedValues.RemoveAll(delegate { return true; }); if (values == null) diff --git a/osu.Game/Screens/Play/SongProgressGraphColumn.cs b/osu.Game/Screens/Play/SongProgressGraphColumn.cs index b92cf63865..95fcf5ad36 100644 --- a/osu.Game/Screens/Play/SongProgressGraphColumn.cs +++ b/osu.Game/Screens/Play/SongProgressGraphColumn.cs @@ -59,7 +59,14 @@ namespace osu.Game.Screens.Play for (int i = 0; i < drawableRows.Count; i++) { - drawableRows[i].Colour = i <= Filled ? colour : empty_colour; + if (Filled == 0) // i <= Filled doesn't work for zero fill + { + drawableRows[i].Colour = empty_colour; + } + else + { + drawableRows[i].Colour = i <= Filled ? colour : empty_colour; + } } } From c61052d62e1215b79ed67ba98ee3ca2ed9f28b56 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 9 Feb 2017 20:12:15 -0400 Subject: [PATCH 011/442] Added toggling the progress bar, added buttons to the visual test --- .../Tests/TestCaseSongProgress.cs | 13 ++++++++----- osu.Game/Screens/Play/SongProgress.cs | 16 +++++++++++++++- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs index 1f0b993fee..9706348494 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs @@ -24,11 +24,6 @@ namespace osu.Desktop.VisualTests { base.Reset(); - Add(new Box - { - Colour = Color4.Gray, - RelativeSizeAxes = Axes.Both - }); Add(progress = new SongProgress { Anchor = Anchor.BottomCentre, @@ -36,6 +31,14 @@ namespace osu.Desktop.VisualTests RelativeSizeAxes = Axes.X }); + AddButton("Toggle Bar", progress.ToggleVisibility); + AddButton("New Values", displayNewValues); + + displayNewValues(); + } + + private void displayNewValues() + { var random = new Random(); List newValues = new List(); diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 8568d30d38..55888d72f3 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -13,15 +13,17 @@ using osu.Framework.Graphics.Primitives; using osu.Game.Overlays; using System.Collections.Generic; using System; +using osu.Framework.Graphics.Transformations; namespace osu.Game.Screens.Play { - public class SongProgress : Container + public class SongProgress : OverlayContainer { public static readonly int BAR_HEIGHT = 5; public static readonly int GRAPH_HEIGHT = 34; public static readonly Color4 FILL_COLOUR = new Color4(221, 255, 255, 255); public static readonly Color4 GLOW_COLOUR = new Color4(221, 255, 255, 150); + private float progress_transition_duration = 100; private SongProgressBar progress; private SongProgressGraph graph; @@ -56,6 +58,18 @@ namespace osu.Game.Screens.Play graph.Values = values; } + protected override void PopIn() + { + progress.FadeTo(1f, progress_transition_duration, EasingTypes.In); + MoveTo(Vector2.Zero, progress_transition_duration, EasingTypes.In); + } + + protected override void PopOut() + { + progress.FadeTo(0f, progress_transition_duration, EasingTypes.In); + MoveTo(new Vector2(0f, BAR_HEIGHT), progress_transition_duration, EasingTypes.In); + } + public SongProgress() { RelativeSizeAxes = Axes.X; From 536925c77a51631ee8e3c69d99716f71cae3d43e Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 2 Mar 2017 09:15:53 -0400 Subject: [PATCH 012/442] Comply to naming conventions --- osu.Game/Overlays/DragBar.cs | 14 +++++++------- osu.Game/Screens/Play/SongProgressBar.cs | 4 ++-- osu.Game/Screens/Play/SongProgressGraphColumn.cs | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/osu.Game/Overlays/DragBar.cs b/osu.Game/Overlays/DragBar.cs index 44106d387a..908616ed6a 100644 --- a/osu.Game/Overlays/DragBar.cs +++ b/osu.Game/Overlays/DragBar.cs @@ -11,8 +11,8 @@ namespace osu.Game.Overlays { public class DragBar : Container { - protected Container fillContainer; - protected Box fill; + protected Container FillContainer; + protected Box Fill; public Action SeekRequested; private bool isDragging; @@ -25,7 +25,7 @@ namespace osu.Game.Overlays { enabled = value; if (!enabled) - fillContainer.Width = 0; + FillContainer.Width = 0; } } @@ -35,7 +35,7 @@ namespace osu.Game.Overlays Children = new Drawable[] { - fillContainer = new Container + FillContainer = new Container { Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, @@ -43,7 +43,7 @@ namespace osu.Game.Overlays Width = 0, Children = new Drawable[] { - fill = new Box + Fill = new Box { RelativeSizeAxes = Axes.Both } @@ -56,7 +56,7 @@ namespace osu.Game.Overlays { if (isDragging || !IsEnabled) return; - fillContainer.Width = position; + FillContainer.Width = position; } private void seek(InputState state) @@ -64,7 +64,7 @@ namespace osu.Game.Overlays if (!IsEnabled) return; float seekLocation = state.Mouse.Position.X / DrawWidth; SeekRequested?.Invoke(seekLocation); - fillContainer.Width = seekLocation; + FillContainer.Width = seekLocation; } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) diff --git a/osu.Game/Screens/Play/SongProgressBar.cs b/osu.Game/Screens/Play/SongProgressBar.cs index 9c6d46b79c..dc3a761742 100644 --- a/osu.Game/Screens/Play/SongProgressBar.cs +++ b/osu.Game/Screens/Play/SongProgressBar.cs @@ -19,7 +19,7 @@ namespace osu.Game.Screens.Play public SongProgressBar() { - fill.Colour = SongProgress.FILL_COLOUR; + Fill.Colour = SongProgress.FILL_COLOUR; Height = SongProgress.BAR_HEIGHT; Add(new Box @@ -29,7 +29,7 @@ namespace osu.Game.Screens.Play Alpha = 0.5f, Depth = 1 }); - fillContainer.Add(handle = new Container + FillContainer.Add(handle = new Container { Origin = Anchor.BottomRight, Anchor = Anchor.BottomRight, diff --git a/osu.Game/Screens/Play/SongProgressGraphColumn.cs b/osu.Game/Screens/Play/SongProgressGraphColumn.cs index a4a647f60c..e676007dc2 100644 --- a/osu.Game/Screens/Play/SongProgressGraphColumn.cs +++ b/osu.Game/Screens/Play/SongProgressGraphColumn.cs @@ -13,9 +13,9 @@ namespace osu.Game.Screens.Play public class SongProgressGraphColumn : Container { private int rows = 11; - private Color4 empty_colour = Color4.White.Opacity(50); - private Color4 lit_colour = SongProgress.FILL_COLOUR; - private Color4 dimmed_colour = Color4.White.Opacity(175); + private readonly Color4 empty_colour = Color4.White.Opacity(50); + private readonly Color4 lit_colour = SongProgress.FILL_COLOUR; + private readonly Color4 dimmed_colour = Color4.White.Opacity(175); private List drawableRows = new List(); From 1eeb4aa8759df15f3f9a2a8500812fcd07a76769 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 2 Mar 2017 09:21:16 -0400 Subject: [PATCH 013/442] Missed some --- osu.Game/Screens/Play/SongProgressGraphColumn.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Play/SongProgressGraphColumn.cs b/osu.Game/Screens/Play/SongProgressGraphColumn.cs index e676007dc2..6a9be707a5 100644 --- a/osu.Game/Screens/Play/SongProgressGraphColumn.cs +++ b/osu.Game/Screens/Play/SongProgressGraphColumn.cs @@ -13,9 +13,9 @@ namespace osu.Game.Screens.Play public class SongProgressGraphColumn : Container { private int rows = 11; - private readonly Color4 empty_colour = Color4.White.Opacity(50); - private readonly Color4 lit_colour = SongProgress.FILL_COLOUR; - private readonly Color4 dimmed_colour = Color4.White.Opacity(175); + private readonly Color4 emptyColour = Color4.White.Opacity(50); + private readonly Color4 litColour = SongProgress.FILL_COLOUR; + private readonly Color4 dimmedColour = Color4.White.Opacity(175); private List drawableRows = new List(); From 223962121ed208f6bb5b45322e6de9af5bcb8ee2 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 2 Mar 2017 09:26:29 -0400 Subject: [PATCH 014/442] Refactor not just rename --- osu.Game/Screens/Play/SongProgressGraphColumn.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Play/SongProgressGraphColumn.cs b/osu.Game/Screens/Play/SongProgressGraphColumn.cs index 6a9be707a5..a296779359 100644 --- a/osu.Game/Screens/Play/SongProgressGraphColumn.cs +++ b/osu.Game/Screens/Play/SongProgressGraphColumn.cs @@ -53,17 +53,17 @@ namespace osu.Game.Screens.Play private void fillActive() { - Color4 colour = State == ColumnState.Lit ? lit_colour : dimmed_colour; + Color4 colour = State == ColumnState.Lit ? litColour : dimmedColour; for (int i = 0; i < drawableRows.Count; i++) { if (Filled == 0) // i <= Filled doesn't work for zero fill { - drawableRows[i].Colour = empty_colour; + drawableRows[i].Colour = emptyColour; } else { - drawableRows[i].Colour = i <= Filled ? colour : empty_colour; + drawableRows[i].Colour = i <= Filled ? colour : emptyColour; } } } From 340ddb59cd55e8197c631c05f9d734274ee8a1b7 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 22 Mar 2017 08:54:21 -0300 Subject: [PATCH 015/442] License headers --- osu.Game/Screens/Play/SongProgress.cs | 2 +- osu.Game/Screens/Play/SongProgressBar.cs | 110 +++++++++++------------ 2 files changed, 56 insertions(+), 56 deletions(-) diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 261b1d0a9a..54e3cc5730 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -19,7 +19,7 @@ namespace osu.Game.Screens.Play public static readonly int GRAPH_HEIGHT = 34; public static readonly Color4 FILL_COLOUR = new Color4(221, 255, 255, 255); public static readonly Color4 GLOW_COLOUR = new Color4(221, 255, 255, 150); - private float progress_transition_duration = 100; + private const float progress_transition_duration = 100; private SongProgressBar progress; private SongProgressGraph graph; diff --git a/osu.Game/Screens/Play/SongProgressBar.cs b/osu.Game/Screens/Play/SongProgressBar.cs index dc3a761742..aa0e2a4bb0 100644 --- a/osu.Game/Screens/Play/SongProgressBar.cs +++ b/osu.Game/Screens/Play/SongProgressBar.cs @@ -1,66 +1,66 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using OpenTK; +// 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.Game.Overlays; -using osu.Framework.Graphics.Containers; +using osu.Game.Overlays; +using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Primitives; -namespace osu.Game.Screens.Play -{ - public class SongProgressBar : DragBar - { - public static readonly Vector2 HANDLE_SIZE = new Vector2(14, 25); - - private Container handle; - - public SongProgressBar() - { - Fill.Colour = SongProgress.FILL_COLOUR; - Height = SongProgress.BAR_HEIGHT; - - Add(new Box - { - RelativeSizeAxes = Axes.Both, - Colour = Color4.Black, - Alpha = 0.5f, - Depth = 1 - }); +namespace osu.Game.Screens.Play +{ + public class SongProgressBar : DragBar + { + public static readonly Vector2 HANDLE_SIZE = new Vector2(14, 25); + + private Container handle; + + public SongProgressBar() + { + Fill.Colour = SongProgress.FILL_COLOUR; + Height = SongProgress.BAR_HEIGHT; + + Add(new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, + Alpha = 0.5f, + Depth = 1 + }); FillContainer.Add(handle = new Container { Origin = Anchor.BottomRight, Anchor = Anchor.BottomRight, Width = 2, - Height = SongProgress.BAR_HEIGHT + SongProgress.GRAPH_HEIGHT, - Colour = Color4.White, + Height = SongProgress.BAR_HEIGHT + SongProgress.GRAPH_HEIGHT, + Colour = Color4.White, Position = new Vector2(2, 0), - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - }, - new Container - { - Origin = Anchor.BottomCentre, - Anchor = Anchor.TopCentre, - Size = HANDLE_SIZE, - CornerRadius = 5, - Masking = true, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = Color4.White - } - } - } - } - }); - } - } -} + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + }, + new Container + { + Origin = Anchor.BottomCentre, + Anchor = Anchor.TopCentre, + Size = HANDLE_SIZE, + CornerRadius = 5, + Masking = true, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.White + } + } + } + } + }); + } + } +} From 333008e26d50ff0853c6dad981d20002ed4abd84 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 22 Mar 2017 08:59:44 -0300 Subject: [PATCH 016/442] Formatting --- osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs | 2 +- osu.Game/Screens/Play/SongProgressBar.cs | 5 +---- osu.Game/Screens/Play/SongProgressGraph.cs | 6 ++---- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs index 037bc0754f..9038e198cb 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs @@ -11,7 +11,7 @@ namespace osu.Desktop.VisualTests.Tests { internal class TestCaseSongProgress : TestCase { - public override string Description => @"With real data"; + public override string Description => @"With (half)real data"; private SongProgress progress; diff --git a/osu.Game/Screens/Play/SongProgressBar.cs b/osu.Game/Screens/Play/SongProgressBar.cs index aa0e2a4bb0..18454c7200 100644 --- a/osu.Game/Screens/Play/SongProgressBar.cs +++ b/osu.Game/Screens/Play/SongProgressBar.cs @@ -7,7 +7,6 @@ using osu.Game.Overlays; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Primitives; namespace osu.Game.Screens.Play { @@ -15,8 +14,6 @@ namespace osu.Game.Screens.Play { public static readonly Vector2 HANDLE_SIZE = new Vector2(14, 25); - private Container handle; - public SongProgressBar() { Fill.Colour = SongProgress.FILL_COLOUR; @@ -29,7 +26,7 @@ namespace osu.Game.Screens.Play Alpha = 0.5f, Depth = 1 }); - FillContainer.Add(handle = new Container + FillContainer.Add(new Container { Origin = Anchor.BottomRight, Anchor = Anchor.BottomRight, diff --git a/osu.Game/Screens/Play/SongProgressGraph.cs b/osu.Game/Screens/Play/SongProgressGraph.cs index f4bd21ae45..20934fab17 100644 --- a/osu.Game/Screens/Play/SongProgressGraph.cs +++ b/osu.Game/Screens/Play/SongProgressGraph.cs @@ -4,7 +4,6 @@ using OpenTK; using System.Collections.Generic; using osu.Framework.Graphics.Containers; -using System; namespace osu.Game.Screens.Play { @@ -85,8 +84,7 @@ namespace osu.Game.Screens.Play return; } - float step = (float)values.Count / (float)ColumnCount; - + float step = values.Count / ColumnCount; for (float i = 0; i < values.Count; i += step) { calculatedValues.Add(values[(int)i]); @@ -103,7 +101,7 @@ namespace osu.Game.Screens.Play columns.Add(new SongProgressGraphColumn { Position = new Vector2(x + 1, 0), - State = ColumnState.Dimmed + State = ColumnState.Dimmed, }); Add(columns[columns.Count - 1]); From 818bdd8e88c86a0a3ce08efae42d467c22e3ad6a Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 22 Mar 2017 09:27:04 -0300 Subject: [PATCH 017/442] SongProgress in HudOverlay --- .../Tests/TestCaseSongProgress.cs | 7 +++---- osu.Game/Modes/UI/HudOverlay.cs | 3 +++ osu.Game/Modes/UI/StandardHudOverlay.cs | 12 ++++++++++++ osu.Game/Screens/Play/Player.cs | 2 ++ osu.Game/Screens/Play/SongProgress.cs | 4 ++-- osu.Game/Screens/Play/SongProgressGraph.cs | 8 ++++---- osu.Game/Screens/Play/SongProgressGraphColumn.cs | 7 ++++--- 7 files changed, 30 insertions(+), 13 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs index 9038e198cb..976e4a2431 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using osu.Framework.Graphics; +using osu.Framework.MathUtils; using osu.Framework.Screens.Testing; using osu.Game.Screens.Play; @@ -34,15 +35,13 @@ namespace osu.Desktop.VisualTests.Tests private void displayNewValues() { - var random = new Random(); - List newValues = new List(); for (int i = 0; i < 1000; i++) { - newValues.Add(random.Next(0, 11)); + newValues.Add(RNG.Next(0, 11)); } - progress.DisplayValues(newValues); + progress.DisplayValues(newValues.ToArray()); } } } diff --git a/osu.Game/Modes/UI/HudOverlay.cs b/osu.Game/Modes/UI/HudOverlay.cs index 4b454797ce..30e6c6e737 100644 --- a/osu.Game/Modes/UI/HudOverlay.cs +++ b/osu.Game/Modes/UI/HudOverlay.cs @@ -19,6 +19,7 @@ namespace osu.Game.Modes.UI public readonly ScoreCounter ScoreCounter; public readonly PercentageCounter AccuracyCounter; public readonly HealthDisplay HealthDisplay; + public readonly SongProgress Progress; private Bindable showKeyCounter; @@ -27,6 +28,7 @@ namespace osu.Game.Modes.UI protected abstract PercentageCounter CreateAccuracyCounter(); protected abstract ScoreCounter CreateScoreCounter(); protected abstract HealthDisplay CreateHealthDisplay(); + protected abstract SongProgress CreateProgress(); protected HudOverlay() { @@ -39,6 +41,7 @@ namespace osu.Game.Modes.UI ScoreCounter = CreateScoreCounter(), AccuracyCounter = CreateAccuracyCounter(), HealthDisplay = CreateHealthDisplay(), + Progress = CreateProgress(), }; } diff --git a/osu.Game/Modes/UI/StandardHudOverlay.cs b/osu.Game/Modes/UI/StandardHudOverlay.cs index f77191adf7..d86498208a 100644 --- a/osu.Game/Modes/UI/StandardHudOverlay.cs +++ b/osu.Game/Modes/UI/StandardHudOverlay.cs @@ -50,5 +50,17 @@ namespace osu.Game.Modes.UI Position = new Vector2(0, 30), Margin = new MarginPadding { Right = 5 }, }; + + protected override SongProgress CreateProgress() + { + var p = new SongProgress() + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + RelativeSizeAxes = Axes.X, + }; + + return p; + } } } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index bd54e6e263..31f7d3c0b7 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -125,6 +125,7 @@ namespace osu.Game.Screens.Play Depth = -1, OnResume = delegate { + hudOverlay.Progress.State = Visibility.Visible; Delay(400); Schedule(Resume); }, @@ -212,6 +213,7 @@ namespace osu.Game.Screens.Play { lastPauseActionTime = Time.Current; hudOverlay.KeyCounter.IsCounting = true; + hudOverlay.Progress.State = Visibility.Hidden; pauseOverlay.Hide(); sourceClock.Start(); IsPaused = false; diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 54e3cc5730..52b45a9fc8 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -28,7 +28,7 @@ namespace osu.Game.Screens.Play [BackgroundDependencyLoader] private void load(OsuGameBase osuGame) { - current = osuGame.Beatmap.Value; + current = osuGame.Beatmap.Value; } protected override void Update() @@ -49,7 +49,7 @@ namespace osu.Game.Screens.Play } } - public void DisplayValues(List values) + public void DisplayValues(int[] values) { graph.Values = values; } diff --git a/osu.Game/Screens/Play/SongProgressGraph.cs b/osu.Game/Screens/Play/SongProgressGraph.cs index 20934fab17..d0caa1201f 100644 --- a/osu.Game/Screens/Play/SongProgressGraph.cs +++ b/osu.Game/Screens/Play/SongProgressGraph.cs @@ -32,8 +32,8 @@ namespace osu.Game.Screens.Play } private List calculatedValues = new List(); // values but adjusted to fit the amount of columns - private List values; - public List Values + private int[] values; + public int[] Values { get { @@ -84,8 +84,8 @@ namespace osu.Game.Screens.Play return; } - float step = values.Count / ColumnCount; - for (float i = 0; i < values.Count; i += step) + float step = values.Length / (float)ColumnCount; + for (float i = 0; i < values.Length; i += step) { calculatedValues.Add(values[(int)i]); } diff --git a/osu.Game/Screens/Play/SongProgressGraphColumn.cs b/osu.Game/Screens/Play/SongProgressGraphColumn.cs index 9d7dd3bc34..514fdcf82a 100644 --- a/osu.Game/Screens/Play/SongProgressGraphColumn.cs +++ b/osu.Game/Screens/Play/SongProgressGraphColumn.cs @@ -12,8 +12,8 @@ namespace osu.Game.Screens.Play { public class SongProgressGraphColumn : Container { - private int rows = 11; - private readonly Color4 emptyColour = Color4.White.Opacity(50); + private readonly int rows = 11; + private readonly Color4 emptyColour = Color4.White.Opacity(100); private readonly Color4 litColour = SongProgress.FILL_COLOUR; private readonly Color4 dimmedColour = Color4.White.Opacity(175); @@ -90,6 +90,7 @@ namespace osu.Game.Screens.Play public enum ColumnState { - Lit, Dimmed + Lit, + Dimmed } } From 5ebbc2c0ba46cc02c1a273d67a3a0b418bf466bf Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 22 Mar 2017 09:33:01 -0300 Subject: [PATCH 018/442] Formatting --- osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs | 1 - osu.Game/Screens/Play/SongProgress.cs | 1 - 2 files changed, 2 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs index 976e4a2431..3dce7034b1 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using System.Collections.Generic; using osu.Framework.Graphics; using osu.Framework.MathUtils; diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 52b45a9fc8..c10565e7e0 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -8,7 +8,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; -using System.Collections.Generic; using osu.Framework.Graphics.Transforms; namespace osu.Game.Screens.Play From 8703e5a9623611028f82d85df54e52661aaaa195 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 22 Mar 2017 09:35:08 -0300 Subject: [PATCH 019/442] More formatting --- osu.Game/Modes/UI/StandardHudOverlay.cs | 127 ++++++++++++------------ 1 file changed, 61 insertions(+), 66 deletions(-) diff --git a/osu.Game/Modes/UI/StandardHudOverlay.cs b/osu.Game/Modes/UI/StandardHudOverlay.cs index d86498208a..7ecffc41d0 100644 --- a/osu.Game/Modes/UI/StandardHudOverlay.cs +++ b/osu.Game/Modes/UI/StandardHudOverlay.cs @@ -1,66 +1,61 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using OpenTK; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Primitives; -using osu.Game.Graphics.UserInterface; -using osu.Game.Screens.Play; - -namespace osu.Game.Modes.UI -{ - public class StandardHudOverlay : HudOverlay - { - protected override PercentageCounter CreateAccuracyCounter() => new PercentageCounter - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Position = new Vector2(0, 65), - TextSize = 20, - Margin = new MarginPadding { Right = 5 }, - }; - - protected override ComboCounter CreateComboCounter() => new StandardComboCounter - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - }; - - protected override HealthDisplay CreateHealthDisplay() => new StandardHealthDisplay - { - Size = new Vector2(1, 5), - RelativeSizeAxes = Axes.X, - Margin = new MarginPadding { Top = 20 } - }; - - protected override KeyCounterCollection CreateKeyCounter() => new KeyCounterCollection - { - IsCounting = true, - FadeTime = 50, - Anchor = Anchor.BottomRight, - Origin = Anchor.BottomRight, - Margin = new MarginPadding(10), - }; - - protected override ScoreCounter CreateScoreCounter() => new ScoreCounter(6) - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - TextSize = 40, - Position = new Vector2(0, 30), - Margin = new MarginPadding { Right = 5 }, - }; - - protected override SongProgress CreateProgress() - { - var p = new SongProgress() - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - RelativeSizeAxes = Axes.X, - }; - - return p; - } - } -} +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Primitives; +using osu.Game.Graphics.UserInterface; +using osu.Game.Screens.Play; + +namespace osu.Game.Modes.UI +{ + public class StandardHudOverlay : HudOverlay + { + protected override PercentageCounter CreateAccuracyCounter() => new PercentageCounter + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Position = new Vector2(0, 65), + TextSize = 20, + Margin = new MarginPadding { Right = 5 }, + }; + + protected override ComboCounter CreateComboCounter() => new StandardComboCounter + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + }; + + protected override HealthDisplay CreateHealthDisplay() => new StandardHealthDisplay + { + Size = new Vector2(1, 5), + RelativeSizeAxes = Axes.X, + Margin = new MarginPadding { Top = 20 } + }; + + protected override KeyCounterCollection CreateKeyCounter() => new KeyCounterCollection + { + IsCounting = true, + FadeTime = 50, + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + Margin = new MarginPadding(10), + }; + + protected override ScoreCounter CreateScoreCounter() => new ScoreCounter(6) + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + TextSize = 40, + Position = new Vector2(0, 30), + Margin = new MarginPadding { Right = 5 }, + }; + + protected override SongProgress CreateProgress() => new SongProgress() + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + RelativeSizeAxes = Axes.X, + }; + } +} From e4af30bd154c263de860b9bbacbb6dd932ebb7ec Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Wed, 22 Mar 2017 09:38:40 -0300 Subject: [PATCH 020/442] Line endings --- osu.Game/Modes/UI/StandardHudOverlay.cs | 122 ++++++++++++------------ 1 file changed, 61 insertions(+), 61 deletions(-) diff --git a/osu.Game/Modes/UI/StandardHudOverlay.cs b/osu.Game/Modes/UI/StandardHudOverlay.cs index 7ecffc41d0..63f978f66a 100644 --- a/osu.Game/Modes/UI/StandardHudOverlay.cs +++ b/osu.Game/Modes/UI/StandardHudOverlay.cs @@ -1,61 +1,61 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using OpenTK; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Primitives; -using osu.Game.Graphics.UserInterface; -using osu.Game.Screens.Play; - -namespace osu.Game.Modes.UI -{ - public class StandardHudOverlay : HudOverlay - { - protected override PercentageCounter CreateAccuracyCounter() => new PercentageCounter - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Position = new Vector2(0, 65), - TextSize = 20, - Margin = new MarginPadding { Right = 5 }, - }; - - protected override ComboCounter CreateComboCounter() => new StandardComboCounter - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - }; - - protected override HealthDisplay CreateHealthDisplay() => new StandardHealthDisplay - { - Size = new Vector2(1, 5), - RelativeSizeAxes = Axes.X, - Margin = new MarginPadding { Top = 20 } - }; - - protected override KeyCounterCollection CreateKeyCounter() => new KeyCounterCollection - { - IsCounting = true, - FadeTime = 50, - Anchor = Anchor.BottomRight, - Origin = Anchor.BottomRight, - Margin = new MarginPadding(10), - }; - - protected override ScoreCounter CreateScoreCounter() => new ScoreCounter(6) - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - TextSize = 40, - Position = new Vector2(0, 30), - Margin = new MarginPadding { Right = 5 }, - }; - - protected override SongProgress CreateProgress() => new SongProgress() - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - RelativeSizeAxes = Axes.X, - }; - } -} +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Primitives; +using osu.Game.Graphics.UserInterface; +using osu.Game.Screens.Play; + +namespace osu.Game.Modes.UI +{ + public class StandardHudOverlay : HudOverlay + { + protected override PercentageCounter CreateAccuracyCounter() => new PercentageCounter + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Position = new Vector2(0, 65), + TextSize = 20, + Margin = new MarginPadding { Right = 5 }, + }; + + protected override ComboCounter CreateComboCounter() => new StandardComboCounter + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + }; + + protected override HealthDisplay CreateHealthDisplay() => new StandardHealthDisplay + { + Size = new Vector2(1, 5), + RelativeSizeAxes = Axes.X, + Margin = new MarginPadding { Top = 20 } + }; + + protected override KeyCounterCollection CreateKeyCounter() => new KeyCounterCollection + { + IsCounting = true, + FadeTime = 50, + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + Margin = new MarginPadding(10), + }; + + protected override ScoreCounter CreateScoreCounter() => new ScoreCounter(6) + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + TextSize = 40, + Position = new Vector2(0, 30), + Margin = new MarginPadding { Right = 5 }, + }; + + protected override SongProgress CreateProgress() => new SongProgress() + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + RelativeSizeAxes = Axes.X, + }; + } +} From b5d661b53a2dd02deb3c83ce1a516d8e2104496a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Mar 2017 18:20:00 +0900 Subject: [PATCH 021/442] some fixing and restyling. --- .../Tests/TestCaseSongProgress.cs | 4 +- osu.Game/Screens/Play/SongProgress.cs | 5 +- osu.Game/Screens/Play/SongProgressBar.cs | 2 +- osu.Game/Screens/Play/SongProgressGraph.cs | 8 +-- .../Screens/Play/SongProgressGraphColumn.cs | 50 +++++++++++-------- 5 files changed, 38 insertions(+), 31 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs index 3dce7034b1..07648d3428 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs @@ -21,8 +21,8 @@ namespace osu.Desktop.VisualTests.Tests Add(progress = new SongProgress { - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.X }); diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index c10565e7e0..9629d8d1e7 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -15,7 +15,6 @@ namespace osu.Game.Screens.Play public class SongProgress : OverlayContainer { public static readonly int BAR_HEIGHT = 5; - public static readonly int GRAPH_HEIGHT = 34; public static readonly Color4 FILL_COLOUR = new Color4(221, 255, 255, 255); public static readonly Color4 GLOW_COLOUR = new Color4(221, 255, 255, 150); private const float progress_transition_duration = 100; @@ -68,7 +67,7 @@ namespace osu.Game.Screens.Play public SongProgress() { RelativeSizeAxes = Axes.X; - Height = BAR_HEIGHT + GRAPH_HEIGHT + SongProgressBar.HANDLE_SIZE.Y; + Height = BAR_HEIGHT + SongProgressGraphColumn.HEIGHT + SongProgressBar.HANDLE_SIZE.Y; Children = new Drawable[] { @@ -77,7 +76,7 @@ namespace osu.Game.Screens.Play RelativeSizeAxes = Axes.X, Origin = Anchor.BottomCentre, Anchor = Anchor.BottomCentre, - Height = GRAPH_HEIGHT, + Height = SongProgressGraphColumn.HEIGHT, Margin = new MarginPadding { Bottom = BAR_HEIGHT diff --git a/osu.Game/Screens/Play/SongProgressBar.cs b/osu.Game/Screens/Play/SongProgressBar.cs index 18454c7200..76ec5d3c6c 100644 --- a/osu.Game/Screens/Play/SongProgressBar.cs +++ b/osu.Game/Screens/Play/SongProgressBar.cs @@ -31,7 +31,7 @@ namespace osu.Game.Screens.Play Origin = Anchor.BottomRight, Anchor = Anchor.BottomRight, Width = 2, - Height = SongProgress.BAR_HEIGHT + SongProgress.GRAPH_HEIGHT, + Height = SongProgress.BAR_HEIGHT + SongProgressGraphColumn.HEIGHT, Colour = Color4.White, Position = new Vector2(2, 0), Children = new Drawable[] diff --git a/osu.Game/Screens/Play/SongProgressGraph.cs b/osu.Game/Screens/Play/SongProgressGraph.cs index d0caa1201f..30858baae1 100644 --- a/osu.Game/Screens/Play/SongProgressGraph.cs +++ b/osu.Game/Screens/Play/SongProgressGraph.cs @@ -93,14 +93,14 @@ namespace osu.Game.Screens.Play private void recreateGraph() { - RemoveAll(delegate { return true; }); - columns.RemoveAll(delegate { return true; }); + Clear(); + columns.Clear(); - for (int x = 0; x < DrawWidth; x += 3) + for (float x = 0; x < DrawWidth; x += SongProgressGraphColumn.WIDTH) { columns.Add(new SongProgressGraphColumn { - Position = new Vector2(x + 1, 0), + Position = new Vector2(x, 0), State = ColumnState.Dimmed, }); diff --git a/osu.Game/Screens/Play/SongProgressGraphColumn.cs b/osu.Game/Screens/Play/SongProgressGraphColumn.cs index 514fdcf82a..aad5013462 100644 --- a/osu.Game/Screens/Play/SongProgressGraphColumn.cs +++ b/osu.Game/Screens/Play/SongProgressGraphColumn.cs @@ -12,12 +12,19 @@ namespace osu.Game.Screens.Play { public class SongProgressGraphColumn : Container { - private readonly int rows = 11; + private const float cube_count = 6; + private const float cube_size = 4; + private const float padding = 2; + + public const float WIDTH = cube_size + padding; + + public const float HEIGHT = cube_count * WIDTH; + private readonly Color4 emptyColour = Color4.White.Opacity(100); private readonly Color4 litColour = SongProgress.FILL_COLOUR; private readonly Color4 dimmedColour = Color4.White.Opacity(175); - private List drawableRows = new List(); + private readonly List drawableRows = new List(); private int filled; public int Filled @@ -51,6 +58,26 @@ namespace osu.Game.Screens.Play } } + public SongProgressGraphColumn() + { + Size = new Vector2(WIDTH, HEIGHT); + + for (int r = 0; r < cube_count; r++) + { + drawableRows.Add(new Box + { + EdgeSmoothness = new Vector2(padding / 4), + Size = new Vector2(cube_size), + Position = new Vector2(0, r * WIDTH + padding) + }); + + Add(drawableRows[drawableRows.Count - 1]); + } + + // Reverse drawableRows so when iterating through them they start at the bottom + drawableRows.Reverse(); + } + private void fillActive() { Color4 colour = State == ColumnState.Lit ? litColour : dimmedColour; @@ -67,25 +94,6 @@ namespace osu.Game.Screens.Play } } } - - public SongProgressGraphColumn() - { - Size = new Vector2(4, rows * 3); - - for (int row = 0; row < rows * 3; row += 3) - { - drawableRows.Add(new Box - { - Size = new Vector2(2), - Position = new Vector2(0, row + 1) - }); - - Add(drawableRows[drawableRows.Count - 1]); - } - - // Reverse drawableRows so when iterating through them they start at the bottom - drawableRows.Reverse(); - } } public enum ColumnState From 0337f18fb9951dce66e3e47c2fa3caf9966d04e7 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 23 Mar 2017 06:37:12 -0300 Subject: [PATCH 022/442] Cleaning --- osu.Game/Modes/UI/StandardHudOverlay.cs | 1 + osu.Game/Screens/Play/SongProgress.cs | 101 ++++++------ osu.Game/Screens/Play/SongProgressBar.cs | 11 +- osu.Game/Screens/Play/SongProgressGraph.cs | 153 ++++++++++++++---- .../Screens/Play/SongProgressGraphColumn.cs | 96 ----------- osu.Game/osu.Game.csproj | 1 - 6 files changed, 178 insertions(+), 185 deletions(-) delete mode 100644 osu.Game/Screens/Play/SongProgressGraphColumn.cs diff --git a/osu.Game/Modes/UI/StandardHudOverlay.cs b/osu.Game/Modes/UI/StandardHudOverlay.cs index 63f978f66a..bb679252c2 100644 --- a/osu.Game/Modes/UI/StandardHudOverlay.cs +++ b/osu.Game/Modes/UI/StandardHudOverlay.cs @@ -56,6 +56,7 @@ namespace osu.Game.Modes.UI Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.X, + Depth = -2, //make it on top of the pause overlay }; } } diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index c10565e7e0..415594fa88 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -3,72 +3,53 @@ using OpenTK; using OpenTK.Graphics; -using osu.Game.Beatmaps; -using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Transforms; +using System; namespace osu.Game.Screens.Play { public class SongProgress : OverlayContainer { - public static readonly int BAR_HEIGHT = 5; - public static readonly int GRAPH_HEIGHT = 34; - public static readonly Color4 FILL_COLOUR = new Color4(221, 255, 255, 255); - public static readonly Color4 GLOW_COLOUR = new Color4(221, 255, 255, 150); - private const float progress_transition_duration = 100; + private readonly int bar_height = 5; + private readonly int graph_height = 34; + private readonly Vector2 handle_size = new Vector2(14, 25); + private readonly Color4 fill_colour = new Color4(221, 255, 255, 255); + private const float transition_duration = 100; - private SongProgressBar progress; + private SongProgressBar bar; private SongProgressGraph graph; - private WorkingBeatmap current; - [BackgroundDependencyLoader] - private void load(OsuGameBase osuGame) + public Action OnSeek; + + private double currentTime; + public double CurrentTime { - current = osuGame.Beatmap.Value; - } - - protected override void Update() - { - base.Update(); - - if (current?.TrackLoaded ?? false) + get { return currentTime; } + set { - float currentProgress = (float)(current.Track.CurrentTime / current.Track.Length); - - progress.IsEnabled = true; - progress.UpdatePosition(currentProgress); - graph.Progress = (int)(graph.ColumnCount * currentProgress); - } - else - { - progress.IsEnabled = false; + currentTime = value; + updateProgress(); } } - public void DisplayValues(int[] values) + private double duration; + public double Duration { - graph.Values = values; - } - - protected override void PopIn() - { - progress.FadeTo(1f, progress_transition_duration, EasingTypes.In); - MoveTo(Vector2.Zero, progress_transition_duration, EasingTypes.In); - } - - protected override void PopOut() - { - progress.FadeTo(0f, progress_transition_duration, EasingTypes.In); - MoveTo(new Vector2(0f, BAR_HEIGHT), progress_transition_duration, EasingTypes.In); + get { return duration; } + set + { + duration = value; + updateProgress(); + } } public SongProgress() { RelativeSizeAxes = Axes.X; - Height = BAR_HEIGHT + GRAPH_HEIGHT + SongProgressBar.HANDLE_SIZE.Y; + Height = bar_height + graph_height + handle_size.Y; Children = new Drawable[] { @@ -77,23 +58,47 @@ namespace osu.Game.Screens.Play RelativeSizeAxes = Axes.X, Origin = Anchor.BottomCentre, Anchor = Anchor.BottomCentre, - Height = GRAPH_HEIGHT, + Height = graph_height, Margin = new MarginPadding { - Bottom = BAR_HEIGHT + Bottom = bar_height } }, - progress = new SongProgressBar + bar = new SongProgressBar(bar_height + graph_height, handle_size, fill_colour) { Origin = Anchor.BottomCentre, Anchor = Anchor.BottomCentre, + Height = bar_height, SeekRequested = delegate (float position) { - current?.Track?.Seek(current.Track.Length * position); - current?.Track?.Start(); + OnSeek?.Invoke(Duration * position); } } }; } + + public void DisplayValues(int[] values) + { + graph.Values = values; + } + + private void updateProgress() + { + float currentProgress = (float)(CurrentTime / Duration); + bar.UpdatePosition(currentProgress); + graph.Progress = (int)(graph.ColumnCount * currentProgress); + } + + protected override void PopIn() + { + bar.FadeTo(1f, transition_duration, EasingTypes.In); + MoveTo(Vector2.Zero, transition_duration, EasingTypes.In); + } + + protected override void PopOut() + { + bar.FadeTo(0f, transition_duration, EasingTypes.In); + MoveTo(new Vector2(0f, bar_height), transition_duration, EasingTypes.In); + } } } diff --git a/osu.Game/Screens/Play/SongProgressBar.cs b/osu.Game/Screens/Play/SongProgressBar.cs index 18454c7200..31acb1354f 100644 --- a/osu.Game/Screens/Play/SongProgressBar.cs +++ b/osu.Game/Screens/Play/SongProgressBar.cs @@ -12,12 +12,9 @@ namespace osu.Game.Screens.Play { public class SongProgressBar : DragBar { - public static readonly Vector2 HANDLE_SIZE = new Vector2(14, 25); - - public SongProgressBar() + public SongProgressBar(float barHeight, Vector2 handleSize, Color4 fillColour) { - Fill.Colour = SongProgress.FILL_COLOUR; - Height = SongProgress.BAR_HEIGHT; + Fill.Colour = fillColour; Add(new Box { @@ -31,7 +28,7 @@ namespace osu.Game.Screens.Play Origin = Anchor.BottomRight, Anchor = Anchor.BottomRight, Width = 2, - Height = SongProgress.BAR_HEIGHT + SongProgress.GRAPH_HEIGHT, + Height = barHeight, Colour = Color4.White, Position = new Vector2(2, 0), Children = new Drawable[] @@ -44,7 +41,7 @@ namespace osu.Game.Screens.Play { Origin = Anchor.BottomCentre, Anchor = Anchor.TopCentre, - Size = HANDLE_SIZE, + Size = handleSize, CornerRadius = 5, Masking = true, Children = new Drawable[] diff --git a/osu.Game/Screens/Play/SongProgressGraph.cs b/osu.Game/Screens/Play/SongProgressGraph.cs index d0caa1201f..617c47fe70 100644 --- a/osu.Game/Screens/Play/SongProgressGraph.cs +++ b/osu.Game/Screens/Play/SongProgressGraph.cs @@ -4,24 +4,26 @@ using OpenTK; using System.Collections.Generic; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using OpenTK.Graphics; +using osu.Framework; +using osu.Framework.Extensions.Color4Extensions; namespace osu.Game.Screens.Play { public class SongProgressGraph : BufferedContainer { - private List columns = new List(); + private Column[] columns; private float lastDrawWidth; + public int ColumnCount => columns.Length; + public override bool HandleInput => false; - public int ColumnCount => columns.Count; private int progress; public int Progress { - get - { - return progress; - } + get { return progress; } set { if (value == progress) return; @@ -31,14 +33,11 @@ namespace osu.Game.Screens.Play } } - private List calculatedValues = new List(); // values but adjusted to fit the amount of columns + private int[] calculatedValues = { }; // values but adjusted to fit the amount of columns private int[] values; public int[] Values { - get - { - return values; - } + get { return values; } set { if (value == values) return; @@ -47,9 +46,28 @@ namespace osu.Game.Screens.Play } } + public SongProgressGraph() + { + CacheDrawnFrameBuffer = true; + PixelSnapping = true; + } + + protected override void Update() + { + base.Update(); + + // todo: Recreating in update is probably not the best idea + if (DrawWidth == lastDrawWidth) return; + recreateGraph(); + lastDrawWidth = DrawWidth; + } + + /// + /// Redraws all the columns to match their lit/dimmed state. + /// private void redrawProgress() { - for (int i = 0; i < columns.Count; i++) + for (int i = 0; i < columns.Length; i++) { columns[i].State = i <= progress ? ColumnState.Lit : ColumnState.Dimmed; } @@ -57,28 +75,29 @@ namespace osu.Game.Screens.Play ForceRedraw(); } + /// + /// Redraws the filled amount of all the columns. + /// private void redrawFilled() { for (int i = 0; i < ColumnCount; i++) { columns[i].Filled = calculatedValues[i]; } - - ForceRedraw(); } + /// + /// Takes and adjusts it to fit the amount of columns. + /// private void recalculateValues() { - // Resizes values to fit the amount of columns and stores it in calculatedValues - // Defaults to all zeros if values is null - - calculatedValues.RemoveAll(delegate { return true; }); + var newValues = new List(); if (values == null) { for (float i = 0; i < ColumnCount; i++) { - calculatedValues.Add(0); + newValues.Add(0); } return; @@ -87,44 +106,112 @@ namespace osu.Game.Screens.Play float step = values.Length / (float)ColumnCount; for (float i = 0; i < values.Length; i += step) { - calculatedValues.Add(values[(int)i]); + newValues.Add(values[(int)i]); } + + calculatedValues = newValues.ToArray(); } + /// + /// Recreates the entire graph. + /// private void recreateGraph() { - RemoveAll(delegate { return true; }); - columns.RemoveAll(delegate { return true; }); + var newColumns = new List(); for (int x = 0; x < DrawWidth; x += 3) { - columns.Add(new SongProgressGraphColumn + newColumns.Add(new Column { Position = new Vector2(x + 1, 0), State = ColumnState.Dimmed, }); - - Add(columns[columns.Count - 1]); } + columns = newColumns.ToArray(); + Children = columns; + recalculateValues(); redrawFilled(); redrawProgress(); } - protected override void Update() + private class Column : Container, IStateful { - base.Update(); + private readonly int rows = 11; + private readonly Color4 emptyColour = Color4.White.Opacity(100); + private readonly Color4 litColour = new Color4(221, 255, 255, 255); + private readonly Color4 dimmedColour = Color4.White.Opacity(175); - if (DrawWidth == lastDrawWidth) return; - recreateGraph(); - lastDrawWidth = DrawWidth; + private List drawableRows = new List(); + + private int filled; + public int Filled + { + get { return filled; } + set + { + if (value == filled) return; + filled = value; + + fillActive(); + } + } + + private ColumnState state; + public ColumnState State + { + get { return state; } + set + { + if (value == state) return; + state = value; + + fillActive(); + } + } + + public Column() + { + Size = new Vector2(4, rows * 3); + + for (int row = 0; row < rows * 3; row += 3) + { + drawableRows.Add(new Box + { + Size = new Vector2(2), + Position = new Vector2(0, row + 1) + }); + + Add(drawableRows[drawableRows.Count - 1]); + } + + // Reverse drawableRows so when iterating through them they start at the bottom + drawableRows.Reverse(); + } + + private void fillActive() + { + Color4 colour = State == ColumnState.Lit ? litColour : dimmedColour; + + for (int i = 0; i < drawableRows.Count; i++) + { + if (Filled == 0) // i <= Filled doesn't work for zero fill + { + drawableRows[i].Colour = emptyColour; + } + else + { + drawableRows[i].Colour = i <= Filled ? colour : emptyColour; + } + } + } } - public SongProgressGraph() + private enum ColumnState { - CacheDrawnFrameBuffer = true; - PixelSnapping = true; + Lit, + Dimmed } } } diff --git a/osu.Game/Screens/Play/SongProgressGraphColumn.cs b/osu.Game/Screens/Play/SongProgressGraphColumn.cs deleted file mode 100644 index 514fdcf82a..0000000000 --- a/osu.Game/Screens/Play/SongProgressGraphColumn.cs +++ /dev/null @@ -1,96 +0,0 @@ -// 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 System.Collections.Generic; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Extensions.Color4Extensions; - -namespace osu.Game.Screens.Play -{ - public class SongProgressGraphColumn : Container - { - private readonly int rows = 11; - private readonly Color4 emptyColour = Color4.White.Opacity(100); - private readonly Color4 litColour = SongProgress.FILL_COLOUR; - private readonly Color4 dimmedColour = Color4.White.Opacity(175); - - private List drawableRows = new List(); - - private int filled; - public int Filled - { - get - { - return filled; - } - set - { - if (value == filled) return; - filled = value; - - fillActive(); - } - } - - private ColumnState state; - public ColumnState State - { - get - { - return state; - } - set - { - if (value == state) return; - state = value; - - fillActive(); - } - } - - private void fillActive() - { - Color4 colour = State == ColumnState.Lit ? litColour : dimmedColour; - - for (int i = 0; i < drawableRows.Count; i++) - { - if (Filled == 0) // i <= Filled doesn't work for zero fill - { - drawableRows[i].Colour = emptyColour; - } - else - { - drawableRows[i].Colour = i <= Filled ? colour : emptyColour; - } - } - } - - public SongProgressGraphColumn() - { - Size = new Vector2(4, rows * 3); - - for (int row = 0; row < rows * 3; row += 3) - { - drawableRows.Add(new Box - { - Size = new Vector2(2), - Position = new Vector2(0, row + 1) - }); - - Add(drawableRows[drawableRows.Count - 1]); - } - - // Reverse drawableRows so when iterating through them they start at the bottom - drawableRows.Reverse(); - } - } - - public enum ColumnState - { - Lit, - Dimmed - } -} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index a1dc99d11c..a35f7b9f59 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -333,7 +333,6 @@ - From 39238928635034d85add25cc69df16b945803fbb Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 23 Mar 2017 07:20:16 -0300 Subject: [PATCH 023/442] Delete SongProgressGraphColumn.cs --- .../Screens/Play/SongProgressGraphColumn.cs | 104 ------------------ 1 file changed, 104 deletions(-) delete mode 100644 osu.Game/Screens/Play/SongProgressGraphColumn.cs diff --git a/osu.Game/Screens/Play/SongProgressGraphColumn.cs b/osu.Game/Screens/Play/SongProgressGraphColumn.cs deleted file mode 100644 index aad5013462..0000000000 --- a/osu.Game/Screens/Play/SongProgressGraphColumn.cs +++ /dev/null @@ -1,104 +0,0 @@ -// 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 System.Collections.Generic; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Extensions.Color4Extensions; - -namespace osu.Game.Screens.Play -{ - public class SongProgressGraphColumn : Container - { - private const float cube_count = 6; - private const float cube_size = 4; - private const float padding = 2; - - public const float WIDTH = cube_size + padding; - - public const float HEIGHT = cube_count * WIDTH; - - private readonly Color4 emptyColour = Color4.White.Opacity(100); - private readonly Color4 litColour = SongProgress.FILL_COLOUR; - private readonly Color4 dimmedColour = Color4.White.Opacity(175); - - private readonly List drawableRows = new List(); - - private int filled; - public int Filled - { - get - { - return filled; - } - set - { - if (value == filled) return; - filled = value; - - fillActive(); - } - } - - private ColumnState state; - public ColumnState State - { - get - { - return state; - } - set - { - if (value == state) return; - state = value; - - fillActive(); - } - } - - public SongProgressGraphColumn() - { - Size = new Vector2(WIDTH, HEIGHT); - - for (int r = 0; r < cube_count; r++) - { - drawableRows.Add(new Box - { - EdgeSmoothness = new Vector2(padding / 4), - Size = new Vector2(cube_size), - Position = new Vector2(0, r * WIDTH + padding) - }); - - Add(drawableRows[drawableRows.Count - 1]); - } - - // Reverse drawableRows so when iterating through them they start at the bottom - drawableRows.Reverse(); - } - - private void fillActive() - { - Color4 colour = State == ColumnState.Lit ? litColour : dimmedColour; - - for (int i = 0; i < drawableRows.Count; i++) - { - if (Filled == 0) // i <= Filled doesn't work for zero fill - { - drawableRows[i].Colour = emptyColour; - } - else - { - drawableRows[i].Colour = i <= Filled ? colour : emptyColour; - } - } - } - } - - public enum ColumnState - { - Lit, - Dimmed - } -} From ca2816f9c8554d04af1b40b66178592547aa5ad1 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 23 Mar 2017 07:24:43 -0300 Subject: [PATCH 024/442] Formatting --- osu.Game/Modes/UI/StandardHudOverlay.cs | 2 +- osu.Game/Screens/Play/SongProgress.cs | 16 ++++++++-------- osu.Game/Screens/Play/SongProgressGraph.cs | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/osu.Game/Modes/UI/StandardHudOverlay.cs b/osu.Game/Modes/UI/StandardHudOverlay.cs index 86e94049f6..d51ffab06b 100644 --- a/osu.Game/Modes/UI/StandardHudOverlay.cs +++ b/osu.Game/Modes/UI/StandardHudOverlay.cs @@ -57,7 +57,7 @@ namespace osu.Game.Modes.UI Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.X, Depth = -2, //todo: find out why this doesn't put progress on top of PauseOverlay - Values = new int[] { 3 }, //todo: removeme + Values = new[] { 3 }, //todo: removeme }; } } diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 678a1b8c92..b99fb429dd 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -13,14 +13,14 @@ namespace osu.Game.Screens.Play { public class SongProgress : OverlayContainer { - private readonly int bar_height = 5; - private readonly int graph_height = 34; - private readonly Vector2 handle_size = new Vector2(14, 25); - private readonly Color4 fill_colour = new Color4(221, 255, 255, 255); + private const int bar_height = 5; + private const int graph_height = 34; + private readonly Vector2 handleSize = new Vector2(14, 25); + private readonly Color4 fillColour = new Color4(221, 255, 255, 255); private const float transition_duration = 200; - private SongProgressBar bar; - private SongProgressGraph graph; + private readonly SongProgressBar bar; + private readonly SongProgressGraph graph; public Action OnSeek; @@ -55,7 +55,7 @@ namespace osu.Game.Screens.Play public SongProgress() { RelativeSizeAxes = Axes.X; - Height = bar_height + graph_height + SongProgressGraph.Column.HEIGHT + handle_size.Y; + Height = bar_height + graph_height + SongProgressGraph.Column.HEIGHT + handleSize.Y; Children = new Drawable[] { @@ -70,7 +70,7 @@ namespace osu.Game.Screens.Play Bottom = bar_height } }, - bar = new SongProgressBar(bar_height + graph_height, handle_size, fill_colour) + bar = new SongProgressBar(bar_height + graph_height, handleSize, fillColour) { Origin = Anchor.BottomCentre, Anchor = Anchor.BottomCentre, diff --git a/osu.Game/Screens/Play/SongProgressGraph.cs b/osu.Game/Screens/Play/SongProgressGraph.cs index 387309041f..14e7f55a05 100644 --- a/osu.Game/Screens/Play/SongProgressGraph.cs +++ b/osu.Game/Screens/Play/SongProgressGraph.cs @@ -88,7 +88,7 @@ namespace osu.Game.Screens.Play } /// - /// Takes and adjusts it to fit the amount of columns. + /// Takes and adjusts it to fit the amount of columns. /// private void recalculateValues() { From 938f5eaf589f13b4a6f69fe1970310abe5ff92a5 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 23 Mar 2017 07:38:08 -0300 Subject: [PATCH 025/442] Dragging --- .../Tests/TestCaseSongProgress.cs | 1 + osu.Game/Screens/Play/Player.cs | 6 ++++++ osu.Game/Screens/Play/SongProgress.cs | 3 +-- osu.Game/Screens/Play/SongProgressBar.cs | 12 +++++++++--- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs index 80ca040ef8..b66a6a4ec1 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs @@ -25,6 +25,7 @@ namespace osu.Desktop.VisualTests.Tests Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.X, Length = 100, + OnSeek = (time) => progress.CurrentTime = time, }); AddButton("Toggle Bar", progress.ToggleVisibility); diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 2dde50f492..22eb157cc9 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -140,6 +140,12 @@ namespace osu.Game.Screens.Play hudOverlay.BindHitRenderer(hitRenderer); hudOverlay.Progress.Length = Beatmap.Track.Length; + hudOverlay.Progress.OnSeek = (time) => + { + //todo: temporary + Beatmap.Track.Seek(time); + Beatmap.Track.Start(); + }; //bind HitRenderer to ScoreProcessor and ourselves (for a pass situation) hitRenderer.OnAllJudged += onCompletion; diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index b99fb429dd..6f50381a4f 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -70,11 +70,10 @@ namespace osu.Game.Screens.Play Bottom = bar_height } }, - bar = new SongProgressBar(bar_height + graph_height, handleSize, fillColour) + bar = new SongProgressBar(bar_height, graph_height, handleSize, fillColour) { Origin = Anchor.BottomCentre, Anchor = Anchor.BottomCentre, - Height = bar_height, SeekRequested = delegate (float position) { OnSeek?.Invoke(Length * position); diff --git a/osu.Game/Screens/Play/SongProgressBar.cs b/osu.Game/Screens/Play/SongProgressBar.cs index 31acb1354f..f720e2bf96 100644 --- a/osu.Game/Screens/Play/SongProgressBar.cs +++ b/osu.Game/Screens/Play/SongProgressBar.cs @@ -12,13 +12,19 @@ namespace osu.Game.Screens.Play { public class SongProgressBar : DragBar { - public SongProgressBar(float barHeight, Vector2 handleSize, Color4 fillColour) + public SongProgressBar(float barHeight, float handleBarHeight, Vector2 handleSize, Color4 fillColour) { Fill.Colour = fillColour; + Height = barHeight + handleBarHeight + handleSize.Y; + FillContainer.RelativeSizeAxes = Axes.X; + FillContainer.Height = barHeight; Add(new Box { - RelativeSizeAxes = Axes.Both, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + RelativeSizeAxes = Axes.X, + Height = barHeight, Colour = Color4.Black, Alpha = 0.5f, Depth = 1 @@ -28,7 +34,7 @@ namespace osu.Game.Screens.Play Origin = Anchor.BottomRight, Anchor = Anchor.BottomRight, Width = 2, - Height = barHeight, + Height = barHeight + handleBarHeight, Colour = Color4.White, Position = new Vector2(2, 0), Children = new Drawable[] From bbca6cf602316d5f9969fe7cb888cde304c7cb29 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 23 Mar 2017 08:13:03 -0300 Subject: [PATCH 026/442] Fix bottom square being clipped --- .../Tests/TestCaseSongProgress.cs | 2 +- osu.Game/Screens/Play/SongProgress.cs | 23 +++++++++---------- osu.Game/Screens/Play/SongProgressGraph.cs | 13 +++++++---- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs index b66a6a4ec1..5563f3f9ea 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs @@ -39,7 +39,7 @@ namespace osu.Desktop.VisualTests.Tests List newValues = new List(); for (int i = 0; i < 1000; i++) { - newValues.Add(RNG.Next(0, 11)); + newValues.Add(RNG.Next(0, 6)); } progress.Values = newValues.ToArray(); diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 6f50381a4f..8ab5492179 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -14,7 +14,6 @@ namespace osu.Game.Screens.Play public class SongProgress : OverlayContainer { private const int bar_height = 5; - private const int graph_height = 34; private readonly Vector2 handleSize = new Vector2(14, 25); private readonly Color4 fillColour = new Color4(221, 255, 255, 255); private const float transition_duration = 200; @@ -55,30 +54,30 @@ namespace osu.Game.Screens.Play public SongProgress() { RelativeSizeAxes = Axes.X; - Height = bar_height + graph_height + SongProgressGraph.Column.HEIGHT + handleSize.Y; + Height = bar_height + SongProgressGraph.Column.HEIGHT + handleSize.Y; Children = new Drawable[] { graph = new SongProgressGraph { RelativeSizeAxes = Axes.X, - Origin = Anchor.BottomCentre, - Anchor = Anchor.BottomCentre, - Height = graph_height, + Origin = Anchor.BottomLeft, + Anchor = Anchor.BottomLeft, + Height = SongProgressGraph.Column.HEIGHT, Margin = new MarginPadding { - Bottom = bar_height - } + Bottom = bar_height, + }, }, - bar = new SongProgressBar(bar_height, graph_height, handleSize, fillColour) + bar = new SongProgressBar(bar_height, SongProgressGraph.Column.HEIGHT, handleSize, fillColour) { - Origin = Anchor.BottomCentre, - Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomLeft, + Anchor = Anchor.BottomLeft, SeekRequested = delegate (float position) { OnSeek?.Invoke(Length * position); - } - } + }, + }, }; } diff --git a/osu.Game/Screens/Play/SongProgressGraph.cs b/osu.Game/Screens/Play/SongProgressGraph.cs index 14e7f55a05..e3d6aa785e 100644 --- a/osu.Game/Screens/Play/SongProgressGraph.cs +++ b/osu.Game/Screens/Play/SongProgressGraph.cs @@ -5,10 +5,12 @@ using OpenTK; using OpenTK.Graphics; using System.Linq; using System.Collections.Generic; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Framework; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Containers; using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics.Primitives; namespace osu.Game.Screens.Play { @@ -124,6 +126,8 @@ namespace osu.Game.Screens.Play { newColumns.Add(new Column { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, Position = new Vector2(x, 0), State = ColumnState.Dimmed, }); @@ -180,14 +184,15 @@ namespace osu.Game.Screens.Play public Column() { Size = new Vector2(WIDTH, HEIGHT); + Margin = new MarginPadding { Bottom = 1 }; //todo: probably find a better fix, not quite sure why this works - for (int r = 0; r Date: Thu, 23 Mar 2017 08:32:24 -0300 Subject: [PATCH 027/442] Fix for the fix --- osu.Game/Screens/Play/SongProgress.cs | 4 ++-- osu.Game/Screens/Play/SongProgressGraph.cs | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 8ab5492179..13219323f4 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -93,14 +93,14 @@ namespace osu.Game.Screens.Play bar.IsEnabled = true; updateProgress(); //in case progress was changed while the bar was hidden - bar.FadeTo(1f, transition_duration, EasingTypes.In); + bar.FadeIn(transition_duration, EasingTypes.In); MoveTo(Vector2.Zero, transition_duration, EasingTypes.In); } protected override void PopOut() { bar.IsEnabled = false; - bar.FadeTo(0f, transition_duration, EasingTypes.In); + bar.FadeOut(transition_duration, EasingTypes.In); MoveTo(new Vector2(0f, bar_height), transition_duration, EasingTypes.In); } } diff --git a/osu.Game/Screens/Play/SongProgressGraph.cs b/osu.Game/Screens/Play/SongProgressGraph.cs index e3d6aa785e..45da103d6a 100644 --- a/osu.Game/Screens/Play/SongProgressGraph.cs +++ b/osu.Game/Screens/Play/SongProgressGraph.cs @@ -151,7 +151,7 @@ namespace osu.Game.Screens.Play private const float cube_size = 4; private const float padding = 2; public const float WIDTH = cube_size + padding; - public const float HEIGHT = cube_count * WIDTH; + public const float HEIGHT = (cube_count * WIDTH) + padding + 1; private readonly List drawableRows = new List(); @@ -184,7 +184,6 @@ namespace osu.Game.Screens.Play public Column() { Size = new Vector2(WIDTH, HEIGHT); - Margin = new MarginPadding { Bottom = 1 }; //todo: probably find a better fix, not quite sure why this works for (int r = 0; r < cube_count; r++) { @@ -192,7 +191,7 @@ namespace osu.Game.Screens.Play { EdgeSmoothness = new Vector2(padding / 4), Size = new Vector2(cube_size), - Position = new Vector2(0, r * WIDTH), + Position = new Vector2(0, r * WIDTH + padding), }); Add(drawableRows[drawableRows.Count - 1]); From b429d8f1b3ed22b04acc2563dd63654a713f4314 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 23 Mar 2017 09:05:53 -0300 Subject: [PATCH 028/442] More proper fix --- osu.Game/Screens/Play/SongProgressGraph.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/SongProgressGraph.cs b/osu.Game/Screens/Play/SongProgressGraph.cs index 45da103d6a..a57253e517 100644 --- a/osu.Game/Screens/Play/SongProgressGraph.cs +++ b/osu.Game/Screens/Play/SongProgressGraph.cs @@ -151,7 +151,7 @@ namespace osu.Game.Screens.Play private const float cube_size = 4; private const float padding = 2; public const float WIDTH = cube_size + padding; - public const float HEIGHT = (cube_count * WIDTH) + padding + 1; + public const float HEIGHT = cube_count * WIDTH + padding; private readonly List drawableRows = new List(); From 0a11d035fe4eba959def8b9db09ae62c1d275568 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 23 Mar 2017 09:07:13 -0300 Subject: [PATCH 029/442] Formatting --- osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs | 2 +- osu.Game/Screens/Play/Player.cs | 6 ------ osu.Game/Screens/Play/SongProgressGraph.cs | 1 - 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs index 5563f3f9ea..626bf5c87f 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs @@ -25,7 +25,7 @@ namespace osu.Desktop.VisualTests.Tests Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.X, Length = 100, - OnSeek = (time) => progress.CurrentTime = time, + OnSeek = time => progress.CurrentTime = time, }); AddButton("Toggle Bar", progress.ToggleVisibility); diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 22eb157cc9..2dde50f492 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -140,12 +140,6 @@ namespace osu.Game.Screens.Play hudOverlay.BindHitRenderer(hitRenderer); hudOverlay.Progress.Length = Beatmap.Track.Length; - hudOverlay.Progress.OnSeek = (time) => - { - //todo: temporary - Beatmap.Track.Seek(time); - Beatmap.Track.Start(); - }; //bind HitRenderer to ScoreProcessor and ourselves (for a pass situation) hitRenderer.OnAllJudged += onCompletion; diff --git a/osu.Game/Screens/Play/SongProgressGraph.cs b/osu.Game/Screens/Play/SongProgressGraph.cs index a57253e517..198799efa1 100644 --- a/osu.Game/Screens/Play/SongProgressGraph.cs +++ b/osu.Game/Screens/Play/SongProgressGraph.cs @@ -10,7 +10,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Containers; using osu.Framework.Extensions.Color4Extensions; -using osu.Framework.Graphics.Primitives; namespace osu.Game.Screens.Play { From b56fb310bf0780e7ee8fd9e727e47a563988f6ba Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 23 Mar 2017 23:38:23 -0300 Subject: [PATCH 030/442] More cleanup --- .../Tests/TestCaseSongProgress.cs | 2 +- osu.Game/Screens/Play/SongProgress.cs | 10 +++++----- osu.Game/Screens/Play/SongProgressGraph.cs | 12 +++--------- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs index 626bf5c87f..efce867c3f 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs @@ -11,7 +11,7 @@ namespace osu.Desktop.VisualTests.Tests { internal class TestCaseSongProgress : TestCase { - public override string Description => @"With (half)real data"; + public override string Description => @"With fake data"; private SongProgress progress; diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 13219323f4..09e0c7cfba 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -13,7 +13,7 @@ namespace osu.Game.Screens.Play { public class SongProgress : OverlayContainer { - private const int bar_height = 5; + private const int progress_height = 5; private readonly Vector2 handleSize = new Vector2(14, 25); private readonly Color4 fillColour = new Color4(221, 255, 255, 255); private const float transition_duration = 200; @@ -54,7 +54,7 @@ namespace osu.Game.Screens.Play public SongProgress() { RelativeSizeAxes = Axes.X; - Height = bar_height + SongProgressGraph.Column.HEIGHT + handleSize.Y; + Height = progress_height + SongProgressGraph.Column.HEIGHT + handleSize.Y; Children = new Drawable[] { @@ -66,10 +66,10 @@ namespace osu.Game.Screens.Play Height = SongProgressGraph.Column.HEIGHT, Margin = new MarginPadding { - Bottom = bar_height, + Bottom = progress_height, }, }, - bar = new SongProgressBar(bar_height, SongProgressGraph.Column.HEIGHT, handleSize, fillColour) + bar = new SongProgressBar(progress_height, SongProgressGraph.Column.HEIGHT, handleSize, fillColour) { Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, @@ -101,7 +101,7 @@ namespace osu.Game.Screens.Play { bar.IsEnabled = false; bar.FadeOut(transition_duration, EasingTypes.In); - MoveTo(new Vector2(0f, bar_height), transition_duration, EasingTypes.In); + MoveTo(new Vector2(0f, progress_height), transition_duration, EasingTypes.In); } } } diff --git a/osu.Game/Screens/Play/SongProgressGraph.cs b/osu.Game/Screens/Play/SongProgressGraph.cs index 198799efa1..f6dfbc2715 100644 --- a/osu.Game/Screens/Play/SongProgressGraph.cs +++ b/osu.Game/Screens/Play/SongProgressGraph.cs @@ -16,7 +16,6 @@ namespace osu.Game.Screens.Play public class SongProgressGraph : BufferedContainer { private Column[] columns = { }; - private float lastDrawWidth; public int ColumnCount => columns.Length; @@ -54,6 +53,7 @@ namespace osu.Game.Screens.Play PixelSnapping = true; } + private float lastDrawWidth; protected override void Update() { base.Update(); @@ -98,9 +98,7 @@ namespace osu.Game.Screens.Play if (values == null) { for (float i = 0; i < ColumnCount; i++) - { newValues.Add(0); - } return; } @@ -192,10 +190,10 @@ namespace osu.Game.Screens.Play Size = new Vector2(cube_size), Position = new Vector2(0, r * WIDTH + padding), }); - - Add(drawableRows[drawableRows.Count - 1]); } + Children = drawableRows; + // Reverse drawableRows so when iterating through them they start at the bottom drawableRows.Reverse(); } @@ -207,13 +205,9 @@ namespace osu.Game.Screens.Play for (int i = 0; i < drawableRows.Count; i++) { if (Filled == 0) // i <= Filled doesn't work for zero fill - { drawableRows[i].Colour = emptyColour; - } else - { drawableRows[i].Colour = i <= Filled ? colour : emptyColour; - } } } } From f1f6f2041f73882a412d3be1336590c1116d8c63 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 23 Mar 2017 23:57:33 -0300 Subject: [PATCH 031/442] Null track handling in player --- osu.Game/Screens/Play/Player.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 2dde50f492..bdd6949618 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -139,7 +139,7 @@ namespace osu.Game.Screens.Play hitRenderer.InputManager.ReplayInputHandler = ReplayInputHandler; hudOverlay.BindHitRenderer(hitRenderer); - hudOverlay.Progress.Length = Beatmap.Track.Length; + hudOverlay.Progress.Length = Beatmap?.Track?.Length ?? 0; //bind HitRenderer to ScoreProcessor and ourselves (for a pass situation) hitRenderer.OnAllJudged += onCompletion; From 0edee042008c8de0a48b681317eb72bdacd5086f Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Fri, 24 Mar 2017 00:41:14 -0300 Subject: [PATCH 032/442] Use OsuColour instead of static colours --- osu.Game/Screens/Play/SongProgress.cs | 20 ++++++++++++-------- osu.Game/Screens/Play/SongProgressBar.cs | 9 +++++++-- osu.Game/Screens/Play/SongProgressGraph.cs | 20 +++++++++++++++++--- 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 09e0c7cfba..5f1fd974ed 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -8,6 +8,8 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Transforms; using System; +using osu.Game.Graphics; +using osu.Framework.Allocation; namespace osu.Game.Screens.Play { @@ -15,11 +17,10 @@ namespace osu.Game.Screens.Play { private const int progress_height = 5; private readonly Vector2 handleSize = new Vector2(14, 25); - private readonly Color4 fillColour = new Color4(221, 255, 255, 255); private const float transition_duration = 200; - private readonly SongProgressBar bar; - private readonly SongProgressGraph graph; + private SongProgressBar bar; + private SongProgressGraph graph; public Action OnSeek; @@ -51,6 +52,12 @@ namespace osu.Game.Screens.Play set { graph.Values = value; } } + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + graph.FillColour = bar.FillColour = colours.BlueLighter; + } + public SongProgress() { RelativeSizeAxes = Axes.X; @@ -64,12 +71,9 @@ namespace osu.Game.Screens.Play Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, Height = SongProgressGraph.Column.HEIGHT, - Margin = new MarginPadding - { - Bottom = progress_height, - }, + Margin = new MarginPadding { Bottom = progress_height }, }, - bar = new SongProgressBar(progress_height, SongProgressGraph.Column.HEIGHT, handleSize, fillColour) + bar = new SongProgressBar(progress_height, SongProgressGraph.Column.HEIGHT, handleSize) { Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, diff --git a/osu.Game/Screens/Play/SongProgressBar.cs b/osu.Game/Screens/Play/SongProgressBar.cs index f720e2bf96..f8ee030d21 100644 --- a/osu.Game/Screens/Play/SongProgressBar.cs +++ b/osu.Game/Screens/Play/SongProgressBar.cs @@ -12,9 +12,14 @@ namespace osu.Game.Screens.Play { public class SongProgressBar : DragBar { - public SongProgressBar(float barHeight, float handleBarHeight, Vector2 handleSize, Color4 fillColour) + public Color4 FillColour + { + get { return Fill.Colour; } + set { Fill.Colour = value; } + } + + public SongProgressBar(float barHeight, float handleBarHeight, Vector2 handleSize) { - Fill.Colour = fillColour; Height = barHeight + handleBarHeight + handleSize.Y; FillContainer.RelativeSizeAxes = Axes.X; FillContainer.Height = barHeight; diff --git a/osu.Game/Screens/Play/SongProgressGraph.cs b/osu.Game/Screens/Play/SongProgressGraph.cs index f6dfbc2715..9bac81a721 100644 --- a/osu.Game/Screens/Play/SongProgressGraph.cs +++ b/osu.Game/Screens/Play/SongProgressGraph.cs @@ -47,6 +47,19 @@ namespace osu.Game.Screens.Play } } + private Color4 fillColour; + public Color4 FillColour + { + get { return fillColour; } + set + { + if (value == fillColour) return; + fillColour = value; + + redrawFilled(); + } + } + public SongProgressGraph() { CacheDrawnFrameBuffer = true; @@ -121,7 +134,7 @@ namespace osu.Game.Screens.Play for (float x = 0; x < DrawWidth; x += Column.WIDTH) { - newColumns.Add(new Column + newColumns.Add(new Column(fillColour) { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, @@ -141,7 +154,7 @@ namespace osu.Game.Screens.Play public class Column : Container, IStateful { private readonly Color4 emptyColour = Color4.White.Opacity(100); - private readonly Color4 litColour = new Color4(221, 255, 255, 255); + private readonly Color4 litColour; private readonly Color4 dimmedColour = Color4.White.Opacity(175); private const float cube_count = 6; @@ -178,9 +191,10 @@ namespace osu.Game.Screens.Play } } - public Column() + public Column(Color4 litColour) { Size = new Vector2(WIDTH, HEIGHT); + this.litColour = litColour; for (int r = 0; r < cube_count; r++) { From a6dfed9668f368ae2e04513222020c5a2e9e6f95 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Fri, 24 Mar 2017 00:41:56 -0300 Subject: [PATCH 033/442] Formatting --- osu.Game/Screens/Play/SongProgress.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 5f1fd974ed..e0b48b0ec0 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -19,8 +19,8 @@ namespace osu.Game.Screens.Play private readonly Vector2 handleSize = new Vector2(14, 25); private const float transition_duration = 200; - private SongProgressBar bar; - private SongProgressGraph graph; + private readonly SongProgressBar bar; + private readonly SongProgressGraph graph; public Action OnSeek; From f0035659dbcbaf7b470f61d22dca220cb6d0c979 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Fri, 24 Mar 2017 00:45:19 -0300 Subject: [PATCH 034/442] Unused using --- osu.Game/Screens/Play/SongProgress.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index e0b48b0ec0..af677c9471 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; -using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; From d8724e5e3e3fe5a7ac303ca14846462be4a20824 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Fri, 24 Mar 2017 23:02:24 +0100 Subject: [PATCH 035/442] Add metadata details --- .../Tests/TestCaseDetails.cs | 31 +++++++ .../osu.Desktop.VisualTests.csproj | 5 +- osu.Game/Screens/Select/BeatmapDetailArea.cs | 29 +++++-- osu.Game/Screens/Select/Details.cs | 87 +++++++++++++++++++ osu.Game/osu.Game.csproj | 1 + 5 files changed, 145 insertions(+), 8 deletions(-) create mode 100644 osu.Desktop.VisualTests/Tests/TestCaseDetails.cs create mode 100644 osu.Game/Screens/Select/Details.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs new file mode 100644 index 0000000000..b97c61218f --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs @@ -0,0 +1,31 @@ +using osu.Framework.Graphics; +using osu.Framework.Screens.Testing; +using osu.Game.Database; +using osu.Game.Screens.Select; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace osu.Desktop.VisualTests.Tests +{ + class TestCaseDetails : TestCase + { + + public override void Reset() + { + base.Reset(); + + Add(new Details + { + RelativeSizeAxes = Axes.Both, + Metadata = new BeatmapMetadata + { + Source = "Some guy", + Tags = "beatmap metadata example with a very very long list of tags and not much creativity", + }, + }); + } + } +} diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index f1b4a99510..d94358a6a1 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -1,4 +1,4 @@ - + {69051C69-12AE-4E7D-A3E6-460D2E282312} @@ -183,6 +183,7 @@ + @@ -211,7 +212,7 @@ - + diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index 21e4d643f2..c7ee57e36c 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -17,8 +18,9 @@ namespace osu.Game.Screens.Select private readonly Container content; protected override Container Content => content; - public readonly Container Details; //todo: replace with a real details view when added + public readonly Details Details; public readonly Leaderboard Leaderboard; + private BeatmapDetailTab currentTab; private APIAccess api; @@ -32,7 +34,11 @@ namespace osu.Game.Screens.Select set { beatmap = value; - if (IsLoaded) Schedule(updateScores); + if (IsLoaded) + if(currentTab == BeatmapDetailTab.Details) + Schedule(updateDetails); + else + Schedule(updateScores); } } @@ -50,15 +56,15 @@ namespace osu.Game.Screens.Select case BeatmapDetailTab.Details: Details.Show(); Leaderboard.Hide(); + updateDetails(); break; default: Details.Hide(); Leaderboard.Show(); + updateScores(); break; } - - //for now let's always update scores. - updateScores(); + currentTab = tab; }, }, content = new Container @@ -70,7 +76,7 @@ namespace osu.Game.Screens.Select Add(new Drawable[] { - Details = new Container + Details = new Details { RelativeSizeAxes = Axes.Both, }, @@ -107,5 +113,16 @@ namespace osu.Game.Screens.Select getScoresRequest.Success += r => Leaderboard.Scores = r.Scores; api.Queue(getScoresRequest); } + + + + private void updateDetails() + { + if (!IsLoaded) return; + + if (api == null || beatmap?.BeatmapInfo == null) return; + + Details.Metadata = beatmap.Beatmap.Metadata; + } } } diff --git a/osu.Game/Screens/Select/Details.cs b/osu.Game/Screens/Select/Details.cs new file mode 100644 index 0000000000..7748bcd1b5 --- /dev/null +++ b/osu.Game/Screens/Select/Details.cs @@ -0,0 +1,87 @@ +// 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.Graphics.Containers; +using osu.Framework.Graphics; +using osu.Game.Database; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Primitives; +using osu.Game.Graphics; +using OpenTK; +using osu.Framework.Allocation; + +namespace osu.Game.Screens.Select +{ + public class Details : Container + { + private FillFlowContainer metadataContainer; + private SpriteText description; + private SpriteText source; + private FillFlowContainer tags; + private BeatmapMetadata metadata; + public BeatmapMetadata Metadata + { + get + { + return metadata; + } + + set + { + if (metadata == value) return; + metadata = value; + source.Text = metadata.Source; + tags.Children = metadata.Tags.Split(' ').ToList().Select(text => new SpriteText { Text = text }); + } + } + + public Details() + { + Children = new[] + { + metadataContainer = new FillFlowContainer() + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Width = 0.4f, + Direction = FillDirection.Vertical, + Children = new Drawable[] + { + new SpriteText + { + Text = "Description", + }, + description = new SpriteText(), + new SpriteText + { + Text = "Source", + Margin = new MarginPadding { Top = 20 }, + }, + source = new SpriteText(), + new SpriteText + { + Text = "Tags", + Margin = new MarginPadding { Top = 20 }, + }, + tags = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + Spacing = new Vector2(3,0), + }, + }, + } + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colour) + { + description.Colour = colour.GrayB; + source.Colour = colour.GrayB; + tags.Colour = colour.Yellow; + } + } +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 989e605c16..9d7627b5f2 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -201,6 +201,7 @@ + From 775fd63d0fa6a03184d77e556f1c17416359908e Mon Sep 17 00:00:00 2001 From: Jorolf Date: Sat, 25 Mar 2017 23:33:03 +0100 Subject: [PATCH 036/442] Added difficulty container --- .../Tests/TestCaseDetails.cs | 23 +- osu.Game/Screens/Select/BeatmapDetailArea.cs | 5 +- osu.Game/Screens/Select/Details.cs | 239 ++++++++++++++++-- osu.Game/Screens/Select/DetailsBar.cs | 68 +++++ osu.Game/osu.Game.csproj | 1 + 5 files changed, 309 insertions(+), 27 deletions(-) create mode 100644 osu.Game/Screens/Select/DetailsBar.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs index b97c61218f..36e52717e4 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs @@ -1,4 +1,7 @@ -using osu.Framework.Graphics; +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; using osu.Framework.Screens.Testing; using osu.Game.Database; using osu.Game.Screens.Select; @@ -20,10 +23,22 @@ namespace osu.Desktop.VisualTests.Tests Add(new Details { RelativeSizeAxes = Axes.Both, - Metadata = new BeatmapMetadata + Beatmap = new BeatmapInfo { - Source = "Some guy", - Tags = "beatmap metadata example with a very very long list of tags and not much creativity", + Version = "VisualTest", + Metadata = new BeatmapMetadata + { + Source = "Some guy", + Tags = "beatmap metadata example with a very very long list of tags and not much creativity", + }, + Difficulty = new BeatmapDifficulty + { + CircleSize = 7, + ApproachRate = 3.5f, + OverallDifficulty = 5.7f, + DrainRate = 1, + }, + StarDifficulty = 5.3f, }, }); } diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index c7ee57e36c..f2e5388d0c 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -79,6 +79,7 @@ namespace osu.Game.Screens.Select Details = new Details { RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding(5), }, Leaderboard = new Leaderboard { @@ -121,8 +122,8 @@ namespace osu.Game.Screens.Select if (!IsLoaded) return; if (api == null || beatmap?.BeatmapInfo == null) return; - - Details.Metadata = beatmap.Beatmap.Metadata; + + Details.Beatmap = beatmap.Beatmap.BeatmapInfo; } } } diff --git a/osu.Game/Screens/Select/Details.cs b/osu.Game/Screens/Select/Details.cs index 7748bcd1b5..2374d0a674 100644 --- a/osu.Game/Screens/Select/Details.cs +++ b/osu.Game/Screens/Select/Details.cs @@ -1,46 +1,72 @@ // 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.Graphics.Containers; -using osu.Framework.Graphics; -using osu.Game.Database; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Primitives; -using osu.Game.Graphics; using OpenTK; +using OpenTK.Graphics; using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Primitives; +using osu.Framework.Graphics.Sprites; +using osu.Game.Database; +using osu.Game.Graphics; +using System.Linq; namespace osu.Game.Screens.Select { public class Details : Container { - private FillFlowContainer metadataContainer; private SpriteText description; private SpriteText source; private FillFlowContainer tags; - private BeatmapMetadata metadata; - public BeatmapMetadata Metadata + + private DifficultyRow circleSize; + private DifficultyRow drainRate; + private DifficultyRow approachRate; + private DifficultyRow overallDifficulty; + private DifficultyRow stars; + + private BeatmapInfo beatmap; + public BeatmapInfo Beatmap { get { - return metadata; + return beatmap; } set { - if (metadata == value) return; - metadata = value; - source.Text = metadata.Source; - tags.Children = metadata.Tags.Split(' ').ToList().Select(text => new SpriteText { Text = text }); + if (beatmap == value) return; + beatmap = value; + description.Text = beatmap.Version; + source.Text = beatmap.Metadata.Source; + tags.Children = beatmap.Metadata.Tags.Split(' ').Select(text => new SpriteText + { + Text = text, + TextSize = 14, + Font = "Exo2.0-Medium", + }); + + circleSize.Value = beatmap.Difficulty.CircleSize; + drainRate.Value = beatmap.Difficulty.DrainRate; + approachRate.Value = beatmap.Difficulty.ApproachRate; + overallDifficulty.Value = beatmap.Difficulty.OverallDifficulty; + stars.Value = (float) beatmap.StarDifficulty; } } public Details() { - Children = new[] + Children = new Drawable[] { - metadataContainer = new FillFlowContainer() + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, + Alpha = 0.5f, + }, + new FillFlowContainer() { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, @@ -48,22 +74,39 @@ namespace osu.Game.Screens.Select AutoSizeAxes = Axes.Y, Width = 0.4f, Direction = FillDirection.Vertical, + Padding = new MarginPadding(5), Children = new Drawable[] { new SpriteText { Text = "Description", + TextSize = 14, + Font = @"Exo2.0-Bold", + }, + description = new SpriteText + { + TextSize = 14, + Font = @"Exo2.0-Medium", + Direction = FillDirection.Full, }, - description = new SpriteText(), new SpriteText { Text = "Source", + TextSize = 14, + Font = @"Exo2.0-Bold", Margin = new MarginPadding { Top = 20 }, }, - source = new SpriteText(), + source = new SpriteText + { + TextSize = 14, + Font = @"Exo2.0-Medium", + Direction = FillDirection.Full, + }, new SpriteText { Text = "Tags", + TextSize = 14, + Font = @"Exo2.0-Bold", Margin = new MarginPadding { Top = 20 }, }, tags = new FillFlowContainer @@ -72,7 +115,65 @@ namespace osu.Game.Screens.Select Spacing = new Vector2(3,0), }, }, - } + }, + new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Width = 0.6f, + Padding = new MarginPadding(5) { Top = 0 }, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, + Alpha = 0.5f, + }, + new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0,10), + Padding = new MarginPadding(7), + Children = new [] + { + circleSize = new DifficultyRow + { + DifficultyName = "Circle Size", + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + MaxValue = 7, + }, + drainRate = new DifficultyRow + { + DifficultyName = "HP Drain", + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + }, + approachRate = new DifficultyRow + { + DifficultyName = "Accuracy", + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + }, + overallDifficulty = new DifficultyRow + { + DifficultyName = "Limit Break", + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + }, + stars = new DifficultyRow + { + DifficultyName = "Star Difficulty", + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + }, + }, + }, + }, + }, }; } @@ -81,7 +182,103 @@ namespace osu.Game.Screens.Select { description.Colour = colour.GrayB; source.Colour = colour.GrayB; - tags.Colour = colour.Yellow; + tags.Colour = colour.YellowLight; + stars.BarColour = colour.YellowLight; + } + + private class DifficultyRow : Container + { + private SpriteText name; + private DetailsBar bar; + private SpriteText valueText; + + private float difficultyValue; + public float Value + { + get + { + return difficultyValue; + } + set + { + difficultyValue = value; + bar.Value = value/maxValue; + valueText.Text = value.ToString(); + } + } + + private float maxValue = 10; + public float MaxValue + { + get + { + return maxValue; + } + set + { + maxValue = value; + bar.Value = Value/value; + } + } + + public string DifficultyName + { + get + { + return name.Text; + } + set + { + name.Text = value; + } + } + + public SRGBColour BarColour + { + get + { + return bar.BarColour; + } + set + { + bar.BarColour = value; + } + } + + public DifficultyRow() + { + Children = new Drawable[] + { + name = new SpriteText + { + TextSize = 14, + Font = @"Exo2.0-Medium", + }, + bar = new DetailsBar + { + Origin = Anchor.CentreLeft, + Anchor = Anchor.CentreLeft, + RelativeSizeAxes = Axes.Both, + Size = new Vector2(1, 0.35f), + Padding = new MarginPadding { Left = 100, Right = 25 }, + }, + valueText = new SpriteText + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + TextSize = 14, + Font = @"Exo2.0-Medium", + }, + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colour) + { + name.Colour = colour.GrayB; + bar.BackgroundColour = colour.Gray7; + valueText.Colour = colour.GrayB; + } } } } diff --git a/osu.Game/Screens/Select/DetailsBar.cs b/osu.Game/Screens/Select/DetailsBar.cs new file mode 100644 index 0000000000..aabdf6809f --- /dev/null +++ b/osu.Game/Screens/Select/DetailsBar.cs @@ -0,0 +1,68 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; + +namespace osu.Game.Screens.Select +{ + class DetailsBar : Container + { + private Box background; + private Box bar; + + public float Value + { + get + { + return bar.Width; + } + set + { + bar.ResizeTo(new Vector2(value, 1), 200); + } + } + + public SRGBColour BackgroundColour + { + get + { + return background.Colour; + } + set + { + background.Colour = value; + } + } + + public SRGBColour BarColour + { + get + { + return bar.Colour; + } + set + { + bar.Colour = value; + } + } + + public DetailsBar() + { + Children = new [] + { + background = new Box + { + RelativeSizeAxes = Axes.Both, + }, + bar = new Box + { + RelativeSizeAxes = Axes.Both, + } + }; + } + } +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 9d7627b5f2..2198167c7d 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -202,6 +202,7 @@ + From 909fdb647c11b13ad24802e94bdb2361919f3c1a Mon Sep 17 00:00:00 2001 From: Jorolf Date: Tue, 28 Mar 2017 17:12:54 +0200 Subject: [PATCH 037/442] Added ratings and different bar rotations --- .../Tests/TestCaseDetails.cs | 4 + .../osu.Desktop.VisualTests.csproj | 2 +- osu.Game/Screens/Select/BeatmapDetailArea.cs | 1 + osu.Game/Screens/Select/Details.cs | 205 ++++++++++++++---- osu.Game/Screens/Select/DetailsBar.cs | 63 +++++- 5 files changed, 231 insertions(+), 44 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs index 36e52717e4..d0d7602831 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs @@ -40,6 +40,10 @@ namespace osu.Desktop.VisualTests.Tests }, StarDifficulty = 5.3f, }, + Ratings = new[] + { + 1,2,3,4,5,6,7,8,9,10 + } }); } } diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index d94358a6a1..19b679dc1c 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -212,7 +212,7 @@ - + diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index f2e5388d0c..337ad04e7d 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -124,6 +124,7 @@ namespace osu.Game.Screens.Select if (api == null || beatmap?.BeatmapInfo == null) return; Details.Beatmap = beatmap.Beatmap.BeatmapInfo; + } } } diff --git a/osu.Game/Screens/Select/Details.cs b/osu.Game/Screens/Select/Details.cs index 2374d0a674..54f3d5b519 100644 --- a/osu.Game/Screens/Select/Details.cs +++ b/osu.Game/Screens/Select/Details.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; using osu.Game.Database; using osu.Game.Graphics; +using System.Collections.Generic; using System.Linq; namespace osu.Game.Screens.Select @@ -23,10 +24,15 @@ namespace osu.Game.Screens.Select private DifficultyRow circleSize; private DifficultyRow drainRate; - private DifficultyRow approachRate; private DifficultyRow overallDifficulty; + private DifficultyRow approachRate; private DifficultyRow stars; + private DetailsBar ratingsBar; + private SpriteText negativeRatings; + private SpriteText positiveRatings; + private FillFlowContainer ratingsGraph; + private BeatmapInfo beatmap; public BeatmapInfo Beatmap { @@ -50,12 +56,43 @@ namespace osu.Game.Screens.Select circleSize.Value = beatmap.Difficulty.CircleSize; drainRate.Value = beatmap.Difficulty.DrainRate; - approachRate.Value = beatmap.Difficulty.ApproachRate; overallDifficulty.Value = beatmap.Difficulty.OverallDifficulty; + approachRate.Value = beatmap.Difficulty.ApproachRate; stars.Value = (float) beatmap.StarDifficulty; } } + private List ratings; + public IEnumerable Ratings + { + get + { + return ratings; + } + set + { + ratings = value.ToList(); + negativeRatings.Text = ratings.GetRange(0, 5).Sum().ToString(); + positiveRatings.Text = ratings.GetRange(5, 5).Sum().ToString(); + ratingsBar.Length = (float)ratings.GetRange(0, 5).Sum() / ratings.Sum(); + + List ratingsGraphBars = ratingsGraph.Children.ToList(); + for (int i = 0; i < 10; i++) + if(ratingsGraphBars.Count > i) + ratingsGraphBars[i].Length = (float)ratings[i] / ratings.Max(); + else + ratingsGraph.Add(new DetailsBar + { + RelativeSizeAxes = Axes.Both, + Width = 0.1f, + Length = (float)ratings[i] / ratings.Max(), + Direction = BarDirection.BottomToTop, + BackgroundColour = new Color4(0, 0, 0, 0), + }); + } + } + + public Details() { Children = new Drawable[] @@ -74,7 +111,7 @@ namespace osu.Game.Screens.Select AutoSizeAxes = Axes.Y, Width = 0.4f, Direction = FillDirection.Vertical, - Padding = new MarginPadding(5), + Padding = new MarginPadding(10) { Top = 25 }, Children = new Drawable[] { new SpriteText @@ -116,59 +153,143 @@ namespace osu.Game.Screens.Select }, }, }, - new Container + new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Width = 0.6f, - Padding = new MarginPadding(5) { Top = 0 }, - Children = new Drawable[] + Direction = FillDirection.Vertical, + Spacing = new Vector2(0,15), + Padding = new MarginPadding(10) { Top = 0 }, + Children = new [] { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = Color4.Black, - Alpha = 0.5f, - }, - new FillFlowContainer + new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - Spacing = new Vector2(0,10), - Padding = new MarginPadding(7), - Children = new [] + Children = new Drawable[] { - circleSize = new DifficultyRow + new Box { - DifficultyName = "Circle Size", - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - MaxValue = 7, + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, + Alpha = 0.5f, }, - drainRate = new DifficultyRow + new FillFlowContainer { - DifficultyName = "HP Drain", - AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0,10), + Padding = new MarginPadding(15) { Top = 25 }, + Children = new [] + { + circleSize = new DifficultyRow + { + DifficultyName = "Circle Size", + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + MaxValue = 7, + }, + drainRate = new DifficultyRow + { + DifficultyName = "HP Drain", + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + }, + overallDifficulty = new DifficultyRow + { + DifficultyName = "Accuracy", + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + }, + approachRate = new DifficultyRow + { + DifficultyName = "Approach Rate", + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + }, + stars = new DifficultyRow + { + DifficultyName = "Star Difficulty", + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + }, + }, }, - approachRate = new DifficultyRow + }, + }, + new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Children = new Drawable[] + { + new Box { - DifficultyName = "Accuracy", - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, + Alpha = 0.5f, }, - overallDifficulty = new DifficultyRow + new FillFlowContainer { - DifficultyName = "Limit Break", - AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, - }, - stars = new DifficultyRow - { - DifficultyName = "Star Difficulty", AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, + Direction = FillDirection.Vertical, + Padding = new MarginPadding(15) { Top = 25, Bottom = 0 }, + Children = new Drawable[] + { + new SpriteText + { + Text = "User Rating", + TextSize = 14, + Font = @"Exo2.0-Medium", + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + }, + ratingsBar = new DetailsBar + { + RelativeSizeAxes = Axes.X, + Height = 5, + Length = 0, + }, + new Container + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Children = new[] + { + negativeRatings = new SpriteText + { + TextSize = 14, + Font = @"Exo2.0-Medium", + Text = "0", + }, + positiveRatings = new SpriteText + { + TextSize = 14, + Font = @"Exo2.0-Medium", + Text = "0", + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + }, + }, + }, + new SpriteText + { + Text = "Rating Spread", + TextSize = 14, + Font = @"Exo2.0-Medium", + Anchor = Anchor.BottomCentre, + Origin = Anchor.TopCentre, + }, + ratingsGraph = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + Direction = FillDirection.Horizontal, + Height = 50, + } + }, }, }, }, @@ -183,7 +304,13 @@ namespace osu.Game.Screens.Select description.Colour = colour.GrayB; source.Colour = colour.GrayB; tags.Colour = colour.YellowLight; + stars.BarColour = colour.YellowLight; + + ratingsBar.BackgroundColour = colour.Green; + ratingsBar.BarColour = colour.YellowDark; + + ratingsGraph.Colour = colour.BlueDark; } private class DifficultyRow : Container @@ -202,7 +329,7 @@ namespace osu.Game.Screens.Select set { difficultyValue = value; - bar.Value = value/maxValue; + bar.Length = value/maxValue; valueText.Text = value.ToString(); } } @@ -217,7 +344,7 @@ namespace osu.Game.Screens.Select set { maxValue = value; - bar.Value = Value/value; + bar.Length = Value/value; } } diff --git a/osu.Game/Screens/Select/DetailsBar.cs b/osu.Game/Screens/Select/DetailsBar.cs index aabdf6809f..650d690a78 100644 --- a/osu.Game/Screens/Select/DetailsBar.cs +++ b/osu.Game/Screens/Select/DetailsBar.cs @@ -9,20 +9,24 @@ using osu.Framework.Graphics.Sprites; namespace osu.Game.Screens.Select { - class DetailsBar : Container + public class DetailsBar : Container { private Box background; private Box bar; - public float Value + private const int resizeDuration = 250; + + private float length; + public float Length { get { - return bar.Width; + return length; } set { - bar.ResizeTo(new Vector2(value, 1), 200); + length = value; + updateBarLength(); } } @@ -50,6 +54,20 @@ namespace osu.Game.Screens.Select } } + private BarDirection direction = BarDirection.LeftToRight; + public BarDirection Direction + { + get + { + return direction; + } + set + { + direction = value; + updateBarLength(); + } + } + public DetailsBar() { Children = new [] @@ -64,5 +82,42 @@ namespace osu.Game.Screens.Select } }; } + + private void updateBarLength() + { + switch (direction) + { + case BarDirection.LeftToRight: + case BarDirection.RightToLeft: + bar.ResizeTo(new Vector2(length, 1), resizeDuration); + break; + case BarDirection.TopToBottom: + case BarDirection.BottomToTop: + bar.ResizeTo(new Vector2(1, length), resizeDuration); + break; + } + + switch (direction) + { + case BarDirection.LeftToRight: + case BarDirection.TopToBottom: + bar.Anchor = Anchor.TopLeft; + bar.Origin = Anchor.TopLeft; + break; + case BarDirection.RightToLeft: + case BarDirection.BottomToTop: + bar.Anchor = Anchor.BottomRight; + bar.Origin = Anchor.BottomRight; + break; + } + } + } + + public enum BarDirection + { + LeftToRight, + RightToLeft, + TopToBottom, + BottomToTop, } } From 199c70ff95bed34a9140452ad42fe124ca6b58dd Mon Sep 17 00:00:00 2001 From: Jorolf Date: Tue, 28 Mar 2017 20:18:56 +0200 Subject: [PATCH 038/442] Added fails and retries --- .../Tests/TestCaseDetails.cs | 13 +- osu.Game/Screens/Select/Details.cs | 143 +++++++++++++++++- osu.Game/Screens/Select/DetailsBar.cs | 7 +- 3 files changed, 150 insertions(+), 13 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs index d0d7602831..3f50f4aaed 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; +using osu.Framework.Graphics.Primitives; using osu.Framework.Screens.Testing; using osu.Game.Database; using osu.Game.Screens.Select; @@ -20,9 +21,11 @@ namespace osu.Desktop.VisualTests.Tests { base.Reset(); - Add(new Details + Details details; + Add(details = new Details { RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding(150), Beatmap = new BeatmapInfo { Version = "VisualTest", @@ -40,11 +43,11 @@ namespace osu.Desktop.VisualTests.Tests }, StarDifficulty = 5.3f, }, - Ratings = new[] - { - 1,2,3,4,5,6,7,8,9,10 - } }); + + details.Ratings = Enumerable.Range(1, 10); + details.Fails = Enumerable.Range(1, 100).Select(i => (int)(Math.Cos(i) * 100)); + details.Retries = Enumerable.Range(1, 100).Select(i => (int)(Math.Sin(i) * 100)); } } } diff --git a/osu.Game/Screens/Select/Details.cs b/osu.Game/Screens/Select/Details.cs index 54f3d5b519..e99d218445 100644 --- a/osu.Game/Screens/Select/Details.cs +++ b/osu.Game/Screens/Select/Details.cs @@ -13,6 +13,7 @@ using osu.Game.Database; using osu.Game.Graphics; using System.Collections.Generic; using System.Linq; +using System; namespace osu.Game.Screens.Select { @@ -33,6 +34,8 @@ namespace osu.Game.Screens.Select private SpriteText positiveRatings; private FillFlowContainer ratingsGraph; + private FillFlowContainer retryAndFailGraph; + private BeatmapInfo beatmap; public BeatmapInfo Beatmap { @@ -91,7 +94,53 @@ namespace osu.Game.Screens.Select }); } } - + + private List retries = Enumerable.Repeat(0,100).ToList(); + public IEnumerable Retries + { + get + { + return retries; + } + set + { + retries = value.ToList(); + calcRetryAndFailBarLength(); + } + } + + private List fails = Enumerable.Repeat(0,100).ToList(); + public IEnumerable Fails + { + get + { + return fails; + } + set + { + fails = value.ToList(); + calcRetryAndFailBarLength(); + } + } + + private void calcRetryAndFailBarLength() + { + List retryAndFailGraphBars = retryAndFailGraph.Children.ToList(); + for (int i = 0; i < 100; i++) + if (retryAndFailGraphBars.Count > i) + { + retryAndFailGraphBars[i].FailLength = (float)fails[i] / ((fails?.Max() ?? 0) + (retries?.Max() ?? 0)); + retryAndFailGraphBars[i].RetryLength = (float)retries[i] / ((fails?.Max() ?? 0) + (retries?.Max() ?? 0)); + } + else + retryAndFailGraph.Add(new RetryAndFailBar + { + RelativeSizeAxes = Axes.Both, + Width = 0.01f, + FailLength = (float)fails[i] / ((fails?.Max() ?? 0) + (retries?.Max() ?? 0)), + RetryLength = (float)retries[i] / ((fails?.Max() ?? 0) + (retries?.Max() ?? 0)), + }); + } public Details() { @@ -280,7 +329,7 @@ namespace osu.Game.Screens.Select Text = "Rating Spread", TextSize = 14, Font = @"Exo2.0-Medium", - Anchor = Anchor.BottomCentre, + Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, }, ratingsGraph = new FillFlowContainer @@ -288,13 +337,40 @@ namespace osu.Game.Screens.Select RelativeSizeAxes = Axes.X, Direction = FillDirection.Horizontal, Height = 50, - } + }, }, }, }, }, }, }, + new FillFlowContainer + { + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Direction = FillDirection.Vertical, + Padding = new MarginPadding { Left = 10, Right = 10 }, + Children = new Drawable[] + { + retryAndFailGraph = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + Direction = FillDirection.Horizontal, + Height = 50, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + }, + new SpriteText + { + Text = "Points of Failure", + TextSize = 14, + Font = @"Exo2.0-Medium", + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + }, + }, + }, }; } @@ -305,11 +381,10 @@ namespace osu.Game.Screens.Select source.Colour = colour.GrayB; tags.Colour = colour.YellowLight; - stars.BarColour = colour.YellowLight; + stars.BarColour = colour.Yellow; ratingsBar.BackgroundColour = colour.Green; ratingsBar.BarColour = colour.YellowDark; - ratingsGraph.Colour = colour.BlueDark; } @@ -407,5 +482,63 @@ namespace osu.Game.Screens.Select valueText.Colour = colour.GrayB; } } + + private class RetryAndFailBar : Container + { + private DetailsBar retryBar; + private DetailsBar failBar; + + public float RetryLength + { + get + { + return retryBar.Length; + } + set + { + retryBar.Length = value + FailLength; + } + } + + public float FailLength + { + get + { + return failBar.Length; + } + set + { + failBar.Length = value; + } + } + + public RetryAndFailBar() + { + Children = new[] + { + retryBar = new DetailsBar + { + RelativeSizeAxes = Axes.Both, + Direction = BarDirection.BottomToTop, + Length = 0, + BackgroundColour = new Color4(0,0,0,0), + }, + failBar = new DetailsBar + { + RelativeSizeAxes = Axes.Both, + Direction = BarDirection.BottomToTop, + Length = 0, + BackgroundColour = new Color4(0,0,0,0), + }, + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colour) + { + retryBar.Colour = colour.Yellow; + failBar.Colour = colour.YellowDarker; + } + } } } diff --git a/osu.Game/Screens/Select/DetailsBar.cs b/osu.Game/Screens/Select/DetailsBar.cs index 650d690a78..daefcc9a54 100644 --- a/osu.Game/Screens/Select/DetailsBar.cs +++ b/osu.Game/Screens/Select/DetailsBar.cs @@ -6,6 +6,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using System; namespace osu.Game.Screens.Select { @@ -14,7 +15,7 @@ namespace osu.Game.Screens.Select private Box background; private Box bar; - private const int resizeDuration = 250; + private const int resize_duration = 250; private float length; public float Length @@ -89,11 +90,11 @@ namespace osu.Game.Screens.Select { case BarDirection.LeftToRight: case BarDirection.RightToLeft: - bar.ResizeTo(new Vector2(length, 1), resizeDuration); + bar.ResizeTo(new Vector2(length, 1), resize_duration); break; case BarDirection.TopToBottom: case BarDirection.BottomToTop: - bar.ResizeTo(new Vector2(1, length), resizeDuration); + bar.ResizeTo(new Vector2(1, length), resize_duration); break; } From 7bd13d76a82c22a2d0e493de6eac679959245e46 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Wed, 29 Mar 2017 14:48:43 +0200 Subject: [PATCH 039/442] fixes + updates to DetailsBar and a button for the TestCaseDetails --- osu.Desktop.VisualTests/Tests/TestCaseDetails.cs | 13 ++++++++++++- osu.Game/Screens/Select/Details.cs | 2 +- osu.Game/Screens/Select/DetailsBar.cs | 10 ++++++---- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs index 3f50f4aaed..2d22009f21 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs @@ -16,12 +16,12 @@ namespace osu.Desktop.VisualTests.Tests { class TestCaseDetails : TestCase { + private Details details; public override void Reset() { base.Reset(); - Details details; Add(details = new Details { RelativeSizeAxes = Axes.Both, @@ -48,6 +48,17 @@ namespace osu.Desktop.VisualTests.Tests details.Ratings = Enumerable.Range(1, 10); details.Fails = Enumerable.Range(1, 100).Select(i => (int)(Math.Cos(i) * 100)); details.Retries = Enumerable.Range(1, 100).Select(i => (int)(Math.Sin(i) * 100)); + + AddButton("new retry/fail values", newRetryAndFailValues); + } + + private int lastRange = 1; + + private void newRetryAndFailValues() + { + lastRange += 100; + details.Fails = Enumerable.Range(lastRange, 100).Select(i => (int)(Math.Cos(i) * 100)); + details.Retries = Enumerable.Range(lastRange, 100).Select(i => (int)(Math.Sin(i) * 100)); } } } diff --git a/osu.Game/Screens/Select/Details.cs b/osu.Game/Screens/Select/Details.cs index e99d218445..c50cae0f4f 100644 --- a/osu.Game/Screens/Select/Details.cs +++ b/osu.Game/Screens/Select/Details.cs @@ -50,7 +50,7 @@ namespace osu.Game.Screens.Select beatmap = value; description.Text = beatmap.Version; source.Text = beatmap.Metadata.Source; - tags.Children = beatmap.Metadata.Tags.Split(' ').Select(text => new SpriteText + tags.Children = beatmap.Metadata.Tags?.Split(' ').Select(text => new SpriteText { Text = text, TextSize = 14, diff --git a/osu.Game/Screens/Select/DetailsBar.cs b/osu.Game/Screens/Select/DetailsBar.cs index daefcc9a54..b48b618fad 100644 --- a/osu.Game/Screens/Select/DetailsBar.cs +++ b/osu.Game/Screens/Select/DetailsBar.cs @@ -6,7 +6,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using System; +using osu.Framework.Graphics.Transforms; namespace osu.Game.Screens.Select { @@ -17,6 +17,8 @@ namespace osu.Game.Screens.Select private const int resize_duration = 250; + private const EasingTypes easing = EasingTypes.InOutCubic; + private float length; public float Length { @@ -26,7 +28,7 @@ namespace osu.Game.Screens.Select } set { - length = value; + length = MathHelper.Clamp(value,0,1); updateBarLength(); } } @@ -90,11 +92,11 @@ namespace osu.Game.Screens.Select { case BarDirection.LeftToRight: case BarDirection.RightToLeft: - bar.ResizeTo(new Vector2(length, 1), resize_duration); + bar.ResizeTo(new Vector2(length, 1), resize_duration, easing); break; case BarDirection.TopToBottom: case BarDirection.BottomToTop: - bar.ResizeTo(new Vector2(1, length), resize_duration); + bar.ResizeTo(new Vector2(1, length), resize_duration, easing); break; } From ab4d1c772574d301398a7c5721d1468147a08e36 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Wed, 29 Mar 2017 15:33:36 +0200 Subject: [PATCH 040/442] better maxValue calculation for the retry and fail graph --- osu.Game/Screens/Select/Details.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Select/Details.cs b/osu.Game/Screens/Select/Details.cs index c50cae0f4f..9ea474020b 100644 --- a/osu.Game/Screens/Select/Details.cs +++ b/osu.Game/Screens/Select/Details.cs @@ -13,7 +13,6 @@ using osu.Game.Database; using osu.Game.Graphics; using System.Collections.Generic; using System.Linq; -using System; namespace osu.Game.Screens.Select { @@ -126,19 +125,20 @@ namespace osu.Game.Screens.Select private void calcRetryAndFailBarLength() { List retryAndFailGraphBars = retryAndFailGraph.Children.ToList(); + float maxValue = fails.Select((value, index) => value + retries[index]).Max(); for (int i = 0; i < 100; i++) if (retryAndFailGraphBars.Count > i) { - retryAndFailGraphBars[i].FailLength = (float)fails[i] / ((fails?.Max() ?? 0) + (retries?.Max() ?? 0)); - retryAndFailGraphBars[i].RetryLength = (float)retries[i] / ((fails?.Max() ?? 0) + (retries?.Max() ?? 0)); + retryAndFailGraphBars[i].FailLength = fails[i] / maxValue; + retryAndFailGraphBars[i].RetryLength = retries[i] / maxValue; } else retryAndFailGraph.Add(new RetryAndFailBar { RelativeSizeAxes = Axes.Both, Width = 0.01f, - FailLength = (float)fails[i] / ((fails?.Max() ?? 0) + (retries?.Max() ?? 0)), - RetryLength = (float)retries[i] / ((fails?.Max() ?? 0) + (retries?.Max() ?? 0)), + FailLength = fails[i] / maxValue, + RetryLength = retries[i] / maxValue, }); } From 2f15653d463cf565faf86391eccc4b65c54433b4 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Wed, 29 Mar 2017 15:37:51 +0200 Subject: [PATCH 041/442] removed duplicate code --- osu.Desktop.VisualTests/Tests/TestCaseDetails.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs index 2d22009f21..0e281fdef5 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs @@ -46,8 +46,7 @@ namespace osu.Desktop.VisualTests.Tests }); details.Ratings = Enumerable.Range(1, 10); - details.Fails = Enumerable.Range(1, 100).Select(i => (int)(Math.Cos(i) * 100)); - details.Retries = Enumerable.Range(1, 100).Select(i => (int)(Math.Sin(i) * 100)); + newRetryAndFailValues(); AddButton("new retry/fail values", newRetryAndFailValues); } @@ -56,9 +55,9 @@ namespace osu.Desktop.VisualTests.Tests private void newRetryAndFailValues() { - lastRange += 100; details.Fails = Enumerable.Range(lastRange, 100).Select(i => (int)(Math.Cos(i) * 100)); details.Retries = Enumerable.Range(lastRange, 100).Select(i => (int)(Math.Sin(i) * 100)); + lastRange += 100; } } } From 866f72e653b4e4fbcf8e3a58b7087395bb70a9d8 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Wed, 29 Mar 2017 15:51:54 +0200 Subject: [PATCH 042/442] fix something the merge broke --- osu.Desktop.VisualTests/Tests/TestCaseDetails.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs index 0e281fdef5..0335e80e3a 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs @@ -3,7 +3,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Primitives; -using osu.Framework.Screens.Testing; +using osu.Framework.Testing; using osu.Game.Database; using osu.Game.Screens.Select; using System; From cdb3150c560ab6d82badfacb8a8f6657f3ce8362 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Wed, 29 Mar 2017 16:00:29 +0200 Subject: [PATCH 043/442] add readonlies and remove unused using directives --- .../Tests/TestCaseDetails.cs | 5 +-- osu.Game/Screens/Select/BeatmapDetailArea.cs | 1 - osu.Game/Screens/Select/Details.cs | 36 +++++++++---------- osu.Game/Screens/Select/DetailsBar.cs | 5 ++- 4 files changed, 21 insertions(+), 26 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs index 0335e80e3a..3bfc0b147b 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs @@ -7,14 +7,11 @@ using osu.Framework.Testing; using osu.Game.Database; using osu.Game.Screens.Select; using System; -using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace osu.Desktop.VisualTests.Tests { - class TestCaseDetails : TestCase + internal class TestCaseDetails : TestCase { private Details details; diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index 337ad04e7d..355b2958e7 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Select/Details.cs b/osu.Game/Screens/Select/Details.cs index 9ea474020b..1145e13338 100644 --- a/osu.Game/Screens/Select/Details.cs +++ b/osu.Game/Screens/Select/Details.cs @@ -18,22 +18,22 @@ namespace osu.Game.Screens.Select { public class Details : Container { - private SpriteText description; - private SpriteText source; - private FillFlowContainer tags; + private readonly SpriteText description; + private readonly SpriteText source; + private readonly FillFlowContainer tags; - private DifficultyRow circleSize; - private DifficultyRow drainRate; - private DifficultyRow overallDifficulty; - private DifficultyRow approachRate; - private DifficultyRow stars; + private readonly DifficultyRow circleSize; + private readonly DifficultyRow drainRate; + private readonly DifficultyRow overallDifficulty; + private readonly DifficultyRow approachRate; + private readonly DifficultyRow stars; - private DetailsBar ratingsBar; - private SpriteText negativeRatings; - private SpriteText positiveRatings; - private FillFlowContainer ratingsGraph; + private readonly DetailsBar ratingsBar; + private readonly SpriteText negativeRatings; + private readonly SpriteText positiveRatings; + private readonly FillFlowContainer ratingsGraph; - private FillFlowContainer retryAndFailGraph; + private readonly FillFlowContainer retryAndFailGraph; private BeatmapInfo beatmap; public BeatmapInfo Beatmap @@ -390,9 +390,9 @@ namespace osu.Game.Screens.Select private class DifficultyRow : Container { - private SpriteText name; - private DetailsBar bar; - private SpriteText valueText; + private readonly SpriteText name; + private readonly DetailsBar bar; + private readonly SpriteText valueText; private float difficultyValue; public float Value @@ -485,8 +485,8 @@ namespace osu.Game.Screens.Select private class RetryAndFailBar : Container { - private DetailsBar retryBar; - private DetailsBar failBar; + private readonly DetailsBar retryBar; + private readonly DetailsBar failBar; public float RetryLength { diff --git a/osu.Game/Screens/Select/DetailsBar.cs b/osu.Game/Screens/Select/DetailsBar.cs index b48b618fad..a7193cb822 100644 --- a/osu.Game/Screens/Select/DetailsBar.cs +++ b/osu.Game/Screens/Select/DetailsBar.cs @@ -6,14 +6,13 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; namespace osu.Game.Screens.Select { public class DetailsBar : Container { - private Box background; - private Box bar; + private readonly Box background; + private readonly Box bar; private const int resize_duration = 250; From a3430dd072a0ba38f43c488bdbe60c655102158b Mon Sep 17 00:00:00 2001 From: Jorolf Date: Wed, 29 Mar 2017 16:10:07 +0200 Subject: [PATCH 044/442] add culture info --- osu.Game/Screens/Select/Details.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/Details.cs b/osu.Game/Screens/Select/Details.cs index 1145e13338..38709057bb 100644 --- a/osu.Game/Screens/Select/Details.cs +++ b/osu.Game/Screens/Select/Details.cs @@ -12,6 +12,7 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Database; using osu.Game.Graphics; using System.Collections.Generic; +using System.Globalization; using System.Linq; namespace osu.Game.Screens.Select @@ -405,7 +406,7 @@ namespace osu.Game.Screens.Select { difficultyValue = value; bar.Length = value/maxValue; - valueText.Text = value.ToString(); + valueText.Text = value.ToString(CultureInfo.InvariantCulture); } } From 0d4f2c59a536b40192679524b78142d7c03ac651 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Thu, 30 Mar 2017 17:32:18 +0200 Subject: [PATCH 045/442] there's probably something in here I overlooked --- ...seDetails.cs => TestCaseBeatmapDetails.cs} | 9 +- .../osu.Desktop.VisualTests.csproj | 4 +- osu.Game/Screens/Select/BeatmapDetailArea.cs | 5 +- .../{Details.cs => Details/BeatmapDetails.cs} | 112 +++++++----------- .../BeatmapDetailsBar.cs} | 6 +- .../Select/Details/BeatmapDetailsGraph.cs | 38 ++++++ osu.Game/osu.Game.csproj | 5 +- 7 files changed, 98 insertions(+), 81 deletions(-) rename osu.Desktop.VisualTests/Tests/{TestCaseDetails.cs => TestCaseBeatmapDetails.cs} (84%) rename osu.Game/Screens/Select/{Details.cs => Details/BeatmapDetails.cs} (82%) rename osu.Game/Screens/Select/{DetailsBar.cs => Details/BeatmapDetailsBar.cs} (92%) create mode 100644 osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs similarity index 84% rename from osu.Desktop.VisualTests/Tests/TestCaseDetails.cs rename to osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs index 3bfc0b147b..dfd40e7d15 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs @@ -6,20 +6,23 @@ using osu.Framework.Graphics.Primitives; using osu.Framework.Testing; using osu.Game.Database; using osu.Game.Screens.Select; +using osu.Game.Screens.Select.Details; using System; using System.Linq; namespace osu.Desktop.VisualTests.Tests { - internal class TestCaseDetails : TestCase + internal class TestCaseBeatmapDetails : TestCase { - private Details details; + public override string Description => "BeatmapDetails tab of BeatmapDetailArea"; + + private BeatmapDetails details; public override void Reset() { base.Reset(); - Add(details = new Details + Add(details = new BeatmapDetails { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding(150), diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index e74ac8b166..aff1b2437f 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -1,4 +1,4 @@ - + {69051C69-12AE-4E7D-A3E6-460D2E282312} @@ -187,7 +187,7 @@ - + diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index 355b2958e7..d7a104b364 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -8,6 +8,7 @@ using osu.Framework.Graphics.Primitives; using osu.Game.Beatmaps; using osu.Game.Online.API; using osu.Game.Online.API.Requests; +using osu.Game.Screens.Select.Details; using osu.Game.Screens.Select.Leaderboards; namespace osu.Game.Screens.Select @@ -17,7 +18,7 @@ namespace osu.Game.Screens.Select private readonly Container content; protected override Container Content => content; - public readonly Details Details; + public readonly BeatmapDetails Details; public readonly Leaderboard Leaderboard; private BeatmapDetailTab currentTab; @@ -75,7 +76,7 @@ namespace osu.Game.Screens.Select Add(new Drawable[] { - Details = new Details + Details = new BeatmapDetails { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding(5), diff --git a/osu.Game/Screens/Select/Details.cs b/osu.Game/Screens/Select/Details/BeatmapDetails.cs similarity index 82% rename from osu.Game/Screens/Select/Details.cs rename to osu.Game/Screens/Select/Details/BeatmapDetails.cs index 38709057bb..8802d213b8 100644 --- a/osu.Game/Screens/Select/Details.cs +++ b/osu.Game/Screens/Select/Details/BeatmapDetails.cs @@ -15,9 +15,9 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; -namespace osu.Game.Screens.Select +namespace osu.Game.Screens.Select.Details { - public class Details : Container + public class BeatmapDetails : Container { private readonly SpriteText description; private readonly SpriteText source; @@ -29,12 +29,13 @@ namespace osu.Game.Screens.Select private readonly DifficultyRow approachRate; private readonly DifficultyRow stars; - private readonly DetailsBar ratingsBar; + private readonly BeatmapDetailsBar ratingsBar; private readonly SpriteText negativeRatings; private readonly SpriteText positiveRatings; - private readonly FillFlowContainer ratingsGraph; + private readonly BeatmapDetailsGraph ratingsGraph; - private readonly FillFlowContainer retryAndFailGraph; + private readonly BeatmapDetailsGraph retryGraph; + private readonly BeatmapDetailsGraph failGraph; private BeatmapInfo beatmap; public BeatmapInfo Beatmap @@ -79,19 +80,7 @@ namespace osu.Game.Screens.Select positiveRatings.Text = ratings.GetRange(5, 5).Sum().ToString(); ratingsBar.Length = (float)ratings.GetRange(0, 5).Sum() / ratings.Sum(); - List ratingsGraphBars = ratingsGraph.Children.ToList(); - for (int i = 0; i < 10; i++) - if(ratingsGraphBars.Count > i) - ratingsGraphBars[i].Length = (float)ratings[i] / ratings.Max(); - else - ratingsGraph.Add(new DetailsBar - { - RelativeSizeAxes = Axes.Both, - Width = 0.1f, - Length = (float)ratings[i] / ratings.Max(), - Direction = BarDirection.BottomToTop, - BackgroundColour = new Color4(0, 0, 0, 0), - }); + ratingsGraph.Values = ratings.Select(rating => (float)rating / ratings.Max()); } } @@ -105,7 +94,7 @@ namespace osu.Game.Screens.Select set { retries = value.ToList(); - calcRetryAndFailBarLength(); + calcRetryAndFailGraph(); } } @@ -119,31 +108,18 @@ namespace osu.Game.Screens.Select set { fails = value.ToList(); - calcRetryAndFailBarLength(); + calcRetryAndFailGraph(); } } - private void calcRetryAndFailBarLength() + private void calcRetryAndFailGraph() { - List retryAndFailGraphBars = retryAndFailGraph.Children.ToList(); - float maxValue = fails.Select((value, index) => value + retries[index]).Max(); - for (int i = 0; i < 100; i++) - if (retryAndFailGraphBars.Count > i) - { - retryAndFailGraphBars[i].FailLength = fails[i] / maxValue; - retryAndFailGraphBars[i].RetryLength = retries[i] / maxValue; - } - else - retryAndFailGraph.Add(new RetryAndFailBar - { - RelativeSizeAxes = Axes.Both, - Width = 0.01f, - FailLength = fails[i] / maxValue, - RetryLength = retries[i] / maxValue, - }); + failGraph.Values = fails.Select(fail => (float)fail / fails.Max()); + List retryAndFails = retries.Select((retry, index) => (float)retry + fails[index]).ToList(); + retryGraph.Values = retryAndFails.Select(value => value / retryAndFails.Max()); } - public Details() + public BeatmapDetails() { Children = new Drawable[] { @@ -211,7 +187,7 @@ namespace osu.Game.Screens.Select Direction = FillDirection.Vertical, Spacing = new Vector2(0,15), Padding = new MarginPadding(10) { Top = 0 }, - Children = new [] + Children = new Drawable[] { new Container { @@ -297,7 +273,7 @@ namespace osu.Game.Screens.Select Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, }, - ratingsBar = new DetailsBar + ratingsBar = new BeatmapDetailsBar { RelativeSizeAxes = Axes.X, Height = 5, @@ -333,7 +309,7 @@ namespace osu.Game.Screens.Select Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, }, - ratingsGraph = new FillFlowContainer + ratingsGraph = new BeatmapDetailsGraph { RelativeSizeAxes = Axes.X, Direction = FillDirection.Horizontal, @@ -343,32 +319,27 @@ namespace osu.Game.Screens.Select }, }, }, - }, - }, - new FillFlowContainer - { - RelativeSizeAxes = Axes.Both, - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Direction = FillDirection.Vertical, - Padding = new MarginPadding { Left = 10, Right = 10 }, - Children = new Drawable[] - { - retryAndFailGraph = new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - Direction = FillDirection.Horizontal, - Height = 50, - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - }, new SpriteText { Text = "Points of Failure", TextSize = 14, Font = @"Exo2.0-Medium", - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, + }, + new Container + { + RelativeSizeAxes = Axes.X, + Size = new Vector2(1/0.6f, 50), + Children = new[] + { + retryGraph = new BeatmapDetailsGraph + { + RelativeSizeAxes = Axes.Both, + }, + failGraph = new BeatmapDetailsGraph + { + RelativeSizeAxes = Axes.Both, + }, + }, }, }, }, @@ -387,12 +358,15 @@ namespace osu.Game.Screens.Select ratingsBar.BackgroundColour = colour.Green; ratingsBar.BarColour = colour.YellowDark; ratingsGraph.Colour = colour.BlueDark; + + failGraph.Colour = colour.YellowDarker; + retryGraph.Colour = colour.Yellow; } private class DifficultyRow : Container { private readonly SpriteText name; - private readonly DetailsBar bar; + private readonly BeatmapDetailsBar bar; private readonly SpriteText valueText; private float difficultyValue; @@ -457,7 +431,7 @@ namespace osu.Game.Screens.Select TextSize = 14, Font = @"Exo2.0-Medium", }, - bar = new DetailsBar + bar = new BeatmapDetailsBar { Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, @@ -484,10 +458,10 @@ namespace osu.Game.Screens.Select } } - private class RetryAndFailBar : Container + private class RetryAndFailBar : Container { - private readonly DetailsBar retryBar; - private readonly DetailsBar failBar; + private readonly BeatmapDetailsBar retryBar; + private readonly BeatmapDetailsBar failBar; public float RetryLength { @@ -517,14 +491,14 @@ namespace osu.Game.Screens.Select { Children = new[] { - retryBar = new DetailsBar + retryBar = new BeatmapDetailsBar { RelativeSizeAxes = Axes.Both, Direction = BarDirection.BottomToTop, Length = 0, BackgroundColour = new Color4(0,0,0,0), }, - failBar = new DetailsBar + failBar = new BeatmapDetailsBar { RelativeSizeAxes = Axes.Both, Direction = BarDirection.BottomToTop, diff --git a/osu.Game/Screens/Select/DetailsBar.cs b/osu.Game/Screens/Select/Details/BeatmapDetailsBar.cs similarity index 92% rename from osu.Game/Screens/Select/DetailsBar.cs rename to osu.Game/Screens/Select/Details/BeatmapDetailsBar.cs index a7193cb822..d637903754 100644 --- a/osu.Game/Screens/Select/DetailsBar.cs +++ b/osu.Game/Screens/Select/Details/BeatmapDetailsBar.cs @@ -7,9 +7,9 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -namespace osu.Game.Screens.Select +namespace osu.Game.Screens.Select.Details { - public class DetailsBar : Container + public class BeatmapDetailsBar : Container { private readonly Box background; private readonly Box bar; @@ -70,7 +70,7 @@ namespace osu.Game.Screens.Select } } - public DetailsBar() + public BeatmapDetailsBar() { Children = new [] { diff --git a/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs b/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs new file mode 100644 index 0000000000..5f462c0559 --- /dev/null +++ b/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs @@ -0,0 +1,38 @@ +using OpenTK.Graphics; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using System.Collections.Generic; +using System.Linq; + +namespace osu.Game.Screens.Select.Details +{ + public class BeatmapDetailsGraph : FillFlowContainer + { + + public IEnumerable Values + { + set + { + List values = value.ToList(); + List graphBars = Children.ToList(); + for (int i = 0; i < values.Count; i++) + if (graphBars.Count > i) + { + graphBars[i].Length = values[i] / values.Max(); + graphBars[i].Width = 1.0f / values.Count; + } + else + Add(new BeatmapDetailsBar + { + RelativeSizeAxes = Axes.Both, + Width = 1.0f / values.Count, + Length = values[i] / values.Max(), + Direction = BarDirection.BottomToTop, + BackgroundColour = new Color4(0, 0, 0, 0), + }); + + } + } + + } +} \ No newline at end of file diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 313db4e110..f5bb482d26 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -201,8 +201,9 @@ - - + + + From 50b85801413fe7f8c5338a629926cc29c05a735c Mon Sep 17 00:00:00 2001 From: Jorolf Date: Fri, 31 Mar 2017 21:13:20 +0200 Subject: [PATCH 046/442] add license header --- osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs b/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs index 5f462c0559..6a90ff60d1 100644 --- a/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs +++ b/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs @@ -1,4 +1,7 @@ -using OpenTK.Graphics; +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using System.Collections.Generic; @@ -35,4 +38,4 @@ namespace osu.Game.Screens.Select.Details } } -} \ No newline at end of file +} From d8bb72dd7811ecf1039ee8a377f30f8b995664c3 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Fri, 31 Mar 2017 21:19:23 +0200 Subject: [PATCH 047/442] remove unused using-directive --- osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs b/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs index 6a90ff60d1..67a44d4f9f 100644 --- a/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs +++ b/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs @@ -5,7 +5,6 @@ using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using System.Collections.Generic; -using System.Linq; namespace osu.Game.Screens.Select.Details { From 1f19d72474f43f18b374ffc0e6bc92c0f863aac4 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Fri, 31 Mar 2017 21:24:05 +0200 Subject: [PATCH 048/442] removed wrong using >.> --- osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs | 1 - osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs index dfd40e7d15..f517e04b4b 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs @@ -5,7 +5,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Primitives; using osu.Framework.Testing; using osu.Game.Database; -using osu.Game.Screens.Select; using osu.Game.Screens.Select.Details; using System; using System.Linq; diff --git a/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs b/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs index 67a44d4f9f..6a90ff60d1 100644 --- a/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs +++ b/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs @@ -5,6 +5,7 @@ using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using System.Collections.Generic; +using System.Linq; namespace osu.Game.Screens.Select.Details { From e380254386dde65c6428b2cb7f1c1bcc46abfe7c Mon Sep 17 00:00:00 2001 From: Jorolf Date: Fri, 31 Mar 2017 22:32:09 +0200 Subject: [PATCH 049/442] remove unnecessary code --- osu.Game/Screens/Select/Details/BeatmapDetails.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Select/Details/BeatmapDetails.cs b/osu.Game/Screens/Select/Details/BeatmapDetails.cs index 8802d213b8..de9897396f 100644 --- a/osu.Game/Screens/Select/Details/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/Details/BeatmapDetails.cs @@ -80,7 +80,7 @@ namespace osu.Game.Screens.Select.Details positiveRatings.Text = ratings.GetRange(5, 5).Sum().ToString(); ratingsBar.Length = (float)ratings.GetRange(0, 5).Sum() / ratings.Sum(); - ratingsGraph.Values = ratings.Select(rating => (float)rating / ratings.Max()); + ratingsGraph.Values = ratings.Select(rating => (float)rating); } } @@ -114,9 +114,9 @@ namespace osu.Game.Screens.Select.Details private void calcRetryAndFailGraph() { - failGraph.Values = fails.Select(fail => (float)fail / fails.Max()); - List retryAndFails = retries.Select((retry, index) => (float)retry + fails[index]).ToList(); - retryGraph.Values = retryAndFails.Select(value => value / retryAndFails.Max()); + failGraph.Values = fails.Select(fail => (float)fail); + retryGraph.Values = retries.Select((retry, index) => (float)retry + fails[index]); + } public BeatmapDetails() From d0b4f867258074176a7ee6a920a7bb514490e521 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Sat, 1 Apr 2017 14:16:18 +0200 Subject: [PATCH 050/442] fix errors from merge --- .../Tests/TestCaseBeatmapDetails.cs | 11 +++++++---- osu.Game/Screens/Select/BeatmapDetailArea.cs | 1 - 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs index f517e04b4b..3a57c1bc87 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs @@ -44,10 +44,8 @@ namespace osu.Desktop.VisualTests.Tests }, }); - details.Ratings = Enumerable.Range(1, 10); - newRetryAndFailValues(); - - AddButton("new retry/fail values", newRetryAndFailValues); + AddStep("new retry/fail values", newRetryAndFailValues); + AddStep("new ratings", newRatings); } private int lastRange = 1; @@ -58,5 +56,10 @@ namespace osu.Desktop.VisualTests.Tests details.Retries = Enumerable.Range(lastRange, 100).Select(i => (int)(Math.Sin(i) * 100)); lastRange += 100; } + + private void newRatings() + { + details.Ratings = Enumerable.Range(1, 10); + } } } diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index d7a104b364..c5dc7057bb 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -124,7 +124,6 @@ namespace osu.Game.Screens.Select if (api == null || beatmap?.BeatmapInfo == null) return; Details.Beatmap = beatmap.Beatmap.BeatmapInfo; - } } } From 017281246db3a8fbb549b11da7b6495d824087e0 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Sat, 1 Apr 2017 18:12:44 +0200 Subject: [PATCH 051/442] changed SpriteText to OsuSpriteText --- .../Screens/Select/Details/BeatmapDetails.cs | 55 ++++++++----------- 1 file changed, 22 insertions(+), 33 deletions(-) diff --git a/osu.Game/Screens/Select/Details/BeatmapDetails.cs b/osu.Game/Screens/Select/Details/BeatmapDetails.cs index de9897396f..cf50853691 100644 --- a/osu.Game/Screens/Select/Details/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/Details/BeatmapDetails.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; using osu.Game.Database; using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; using System.Collections.Generic; using System.Globalization; using System.Linq; @@ -19,9 +20,9 @@ namespace osu.Game.Screens.Select.Details { public class BeatmapDetails : Container { - private readonly SpriteText description; - private readonly SpriteText source; - private readonly FillFlowContainer tags; + private readonly OsuSpriteText description; + private readonly OsuSpriteText source; + private readonly FillFlowContainer tags; private readonly DifficultyRow circleSize; private readonly DifficultyRow drainRate; @@ -30,8 +31,8 @@ namespace osu.Game.Screens.Select.Details private readonly DifficultyRow stars; private readonly BeatmapDetailsBar ratingsBar; - private readonly SpriteText negativeRatings; - private readonly SpriteText positiveRatings; + private readonly OsuSpriteText negativeRatings; + private readonly OsuSpriteText positiveRatings; private readonly BeatmapDetailsGraph ratingsGraph; private readonly BeatmapDetailsGraph retryGraph; @@ -51,10 +52,9 @@ namespace osu.Game.Screens.Select.Details beatmap = value; description.Text = beatmap.Version; source.Text = beatmap.Metadata.Source; - tags.Children = beatmap.Metadata.Tags?.Split(' ').Select(text => new SpriteText + tags.Children = beatmap.Metadata.Tags?.Split(' ').Select(text => new OsuSpriteText { Text = text, - TextSize = 14, Font = "Exo2.0-Medium", }); @@ -140,39 +140,34 @@ namespace osu.Game.Screens.Select.Details Padding = new MarginPadding(10) { Top = 25 }, Children = new Drawable[] { - new SpriteText + new OsuSpriteText { Text = "Description", - TextSize = 14, Font = @"Exo2.0-Bold", }, - description = new SpriteText + description = new OsuSpriteText { - TextSize = 14, Font = @"Exo2.0-Medium", Direction = FillDirection.Full, }, - new SpriteText + new OsuSpriteText { Text = "Source", - TextSize = 14, Font = @"Exo2.0-Bold", Margin = new MarginPadding { Top = 20 }, }, - source = new SpriteText + source = new OsuSpriteText { - TextSize = 14, Font = @"Exo2.0-Medium", Direction = FillDirection.Full, }, - new SpriteText + new OsuSpriteText { Text = "Tags", - TextSize = 14, Font = @"Exo2.0-Bold", Margin = new MarginPadding { Top = 20 }, }, - tags = new FillFlowContainer + tags = new FillFlowContainer { RelativeSizeAxes = Axes.X, Spacing = new Vector2(3,0), @@ -265,10 +260,9 @@ namespace osu.Game.Screens.Select.Details Padding = new MarginPadding(15) { Top = 25, Bottom = 0 }, Children = new Drawable[] { - new SpriteText + new OsuSpriteText { Text = "User Rating", - TextSize = 14, Font = @"Exo2.0-Medium", Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, @@ -285,15 +279,13 @@ namespace osu.Game.Screens.Select.Details AutoSizeAxes = Axes.Y, Children = new[] { - negativeRatings = new SpriteText + negativeRatings = new OsuSpriteText { - TextSize = 14, Font = @"Exo2.0-Medium", Text = "0", }, - positiveRatings = new SpriteText + positiveRatings = new OsuSpriteText { - TextSize = 14, Font = @"Exo2.0-Medium", Text = "0", Anchor = Anchor.TopRight, @@ -301,7 +293,7 @@ namespace osu.Game.Screens.Select.Details }, }, }, - new SpriteText + new OsuSpriteText { Text = "Rating Spread", TextSize = 14, @@ -319,10 +311,9 @@ namespace osu.Game.Screens.Select.Details }, }, }, - new SpriteText + new OsuSpriteText { Text = "Points of Failure", - TextSize = 14, Font = @"Exo2.0-Medium", }, new Container @@ -365,9 +356,9 @@ namespace osu.Game.Screens.Select.Details private class DifficultyRow : Container { - private readonly SpriteText name; + private readonly OsuSpriteText name; private readonly BeatmapDetailsBar bar; - private readonly SpriteText valueText; + private readonly OsuSpriteText valueText; private float difficultyValue; public float Value @@ -426,9 +417,8 @@ namespace osu.Game.Screens.Select.Details { Children = new Drawable[] { - name = new SpriteText + name = new OsuSpriteText { - TextSize = 14, Font = @"Exo2.0-Medium", }, bar = new BeatmapDetailsBar @@ -439,11 +429,10 @@ namespace osu.Game.Screens.Select.Details Size = new Vector2(1, 0.35f), Padding = new MarginPadding { Left = 100, Right = 25 }, }, - valueText = new SpriteText + valueText = new OsuSpriteText { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, - TextSize = 14, Font = @"Exo2.0-Medium", }, }; From e835b19d4a17e35da28b640207df4617214df8c8 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Sun, 2 Apr 2017 18:19:59 +0200 Subject: [PATCH 052/442] add Tooltips --- .../Tests/TestCaseTooltip.cs | 47 ++++++++++++ .../osu.Desktop.VisualTests.csproj | 1 + osu.Game/Graphics/Cursor/MenuCursor.cs | 54 +++++++++++++- .../Graphics/UserInterface/IHasTooltip.cs | 10 +++ osu.Game/Graphics/UserInterface/Tooltip.cs | 71 +++++++++++++++++++ osu.Game/osu.Game.csproj | 2 + 6 files changed, 184 insertions(+), 1 deletion(-) create mode 100644 osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs create mode 100644 osu.Game/Graphics/UserInterface/IHasTooltip.cs create mode 100644 osu.Game/Graphics/UserInterface/Tooltip.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs b/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs new file mode 100644 index 0000000000..2d9cfcf4b1 --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs @@ -0,0 +1,47 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Testing; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; + +namespace osu.Desktop.VisualTests.Tests +{ + internal class TestCaseTooltip : TestCase + { + public override string Description => "tests tooltips on various elements"; + + public override void Reset() + { + base.Reset(); + + Children = new Drawable[] + { + new FillFlowContainer + { + RelativeSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Children = new[] + { + new TooltipSpriteText + { + Text = "Text with some tooltip", + }, + new TooltipSpriteText + { + Text = "and another one", + }, + + }, + }, + }; + } + + private class TooltipSpriteText : OsuSpriteText, IHasTooltip + { + public string Tooltip => Text; + } + } +} diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index 1baf322750..b117515433 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -202,6 +202,7 @@ + diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index 67b17fae5c..82422765a3 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -12,6 +12,11 @@ using osu.Framework.Input; using osu.Game.Configuration; using System; using osu.Framework.Graphics.Textures; +using osu.Game.Graphics.UserInterface; +using osu.Framework.Threading; +using System.Linq; +using osu.Framework.Screens; +using System.Collections.Generic; namespace osu.Game.Graphics.Cursor { @@ -19,10 +24,34 @@ namespace osu.Game.Graphics.Cursor { protected override Drawable CreateCursor() => new Cursor(); + [BackgroundDependencyLoader] + private void load(OsuGameBase game) + { + this.game = game; + } + private bool dragging; + private ScheduledDelegate show; + private OsuGameBase game; + protected override bool OnMouseMove(InputState state) { + if (state.Mouse.Position != state.Mouse.LastPosition) + { + Tooltip tooltip = ((Cursor)ActiveCursor).Tooltip; + show?.Cancel(); + tooltip.Hide(); + Delay(250); + show = Schedule(delegate + { + tooltip.TooltipText = ""; + searchTooltip(tooltip, ToScreenSpace(state.Mouse.Position), game); + if (tooltip.TooltipText != "") + tooltip.Show(); + }); + } + if (dragging) { Vector2 offset = state.Mouse.Position - state.Mouse.PositionMouseDown ?? state.Mouse.Delta; @@ -40,6 +69,23 @@ namespace osu.Game.Graphics.Cursor return base.OnMouseMove(state); } + private void searchTooltip(Tooltip tooltip, Vector2 mousePosition, IContainerEnumerable children) + { + IEnumerable next = children.Children.Where(drawable => drawable.Contains(mousePosition) && !(drawable is CursorContainer)); + + foreach (Drawable drawable in next) + { + string tooltipText = (drawable as IHasTooltip)?.Tooltip ?? ""; + if (tooltipText != "") tooltip.TooltipText = tooltipText; + + var childScreen = (drawable as Screen)?.ChildScreen; + if (childScreen != null) + searchTooltip(tooltip, mousePosition, childScreen); + else if (drawable is IContainer) + searchTooltip(tooltip, mousePosition, drawable as IContainerEnumerable); + } + } + protected override bool OnDragStart(InputState state) { dragging = true; @@ -94,6 +140,7 @@ namespace osu.Game.Graphics.Cursor public class Cursor : Container { private Container cursorContainer; + public Tooltip Tooltip; private Bindable cursorScale; public Sprite AdditiveLayer; @@ -127,7 +174,11 @@ namespace osu.Game.Graphics.Cursor Texture = textures.Get(@"Cursor/menu-cursor-additive"), }, } - } + }, + Tooltip = new Tooltip + { + Alpha = 0, + }, }; cursorScale = config.GetBindable(OsuConfig.MenuCursorSize); @@ -138,6 +189,7 @@ namespace osu.Game.Graphics.Cursor private void scaleChanged(object sender, EventArgs e) { cursorContainer.Scale = new Vector2((float)cursorScale); + Tooltip.Y = cursorContainer.Height * (float)cursorScale; } } } diff --git a/osu.Game/Graphics/UserInterface/IHasTooltip.cs b/osu.Game/Graphics/UserInterface/IHasTooltip.cs new file mode 100644 index 0000000000..d8997349bb --- /dev/null +++ b/osu.Game/Graphics/UserInterface/IHasTooltip.cs @@ -0,0 +1,10 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Graphics.UserInterface +{ + public interface IHasTooltip + { + string Tooltip { get; } + } +} diff --git a/osu.Game/Graphics/UserInterface/Tooltip.cs b/osu.Game/Graphics/UserInterface/Tooltip.cs new file mode 100644 index 0000000000..b392f89397 --- /dev/null +++ b/osu.Game/Graphics/UserInterface/Tooltip.cs @@ -0,0 +1,71 @@ +// 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.Allocation; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Primitives; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Input; +using osu.Framework.Threading; +using osu.Game.Graphics.Sprites; + +namespace osu.Game.Graphics.UserInterface +{ + public class Tooltip : Container + { + private readonly Container actualTooltip; + private readonly Box tooltipBackground; + private readonly OsuSpriteText text; + + public string TooltipText { + get => text.Text; + set => text.Text = value; + } + + public Vector2 TooltipOffset = new Vector2(); + + public Tooltip() + { + Depth = float.MinValue; + AlwaysReceiveInput = true; + Children = new[] + { + actualTooltip = new Container + { + AutoSizeAxes = Axes.Both, + CornerRadius = 5, + Masking = true, + AlwaysPresent = true, + EdgeEffect = new EdgeEffect + { + Type = EdgeEffectType.Shadow, + Colour = Color4.Black.Opacity(40), + Radius = 5, + }, + Children = new Drawable[] + { + tooltipBackground = new Box + { + RelativeSizeAxes = Axes.Both + }, + text = new OsuSpriteText + { + Padding = new MarginPadding(3), + Font = @"Exo2.0-Regular", + } + } + } + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colour, OsuGameBase game) + { + tooltipBackground.Colour = colour.Gray3; + } + } +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index ecb3f5084c..c29f3a49f2 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -87,12 +87,14 @@ + + From 679829daaecbf0bc78751df83b64b141f9b63fbd Mon Sep 17 00:00:00 2001 From: Jorolf Date: Sun, 2 Apr 2017 18:25:44 +0200 Subject: [PATCH 053/442] vs17 -> vs15 --- osu.Game/Graphics/UserInterface/Tooltip.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/Tooltip.cs b/osu.Game/Graphics/UserInterface/Tooltip.cs index b392f89397..b71860d6f6 100644 --- a/osu.Game/Graphics/UserInterface/Tooltip.cs +++ b/osu.Game/Graphics/UserInterface/Tooltip.cs @@ -9,8 +9,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; -using osu.Framework.Threading; using osu.Game.Graphics.Sprites; namespace osu.Game.Graphics.UserInterface @@ -22,8 +20,14 @@ namespace osu.Game.Graphics.UserInterface private readonly OsuSpriteText text; public string TooltipText { - get => text.Text; - set => text.Text = value; + get + { + return text.Text; + } + set + { + text.Text = value; + } } public Vector2 TooltipOffset = new Vector2(); From 8bc241da3d550627e696577a8f8096631cc95903 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Sun, 2 Apr 2017 18:31:19 +0200 Subject: [PATCH 054/442] make AppVeyor happy again --- osu.Game/Graphics/UserInterface/Tooltip.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/Tooltip.cs b/osu.Game/Graphics/UserInterface/Tooltip.cs index b71860d6f6..b2031a81d9 100644 --- a/osu.Game/Graphics/UserInterface/Tooltip.cs +++ b/osu.Game/Graphics/UserInterface/Tooltip.cs @@ -15,7 +15,6 @@ namespace osu.Game.Graphics.UserInterface { public class Tooltip : Container { - private readonly Container actualTooltip; private readonly Box tooltipBackground; private readonly OsuSpriteText text; @@ -38,7 +37,7 @@ namespace osu.Game.Graphics.UserInterface AlwaysReceiveInput = true; Children = new[] { - actualTooltip = new Container + new Container { AutoSizeAxes = Axes.Both, CornerRadius = 5, @@ -67,7 +66,7 @@ namespace osu.Game.Graphics.UserInterface } [BackgroundDependencyLoader] - private void load(OsuColour colour, OsuGameBase game) + private void load(OsuColour colour) { tooltipBackground.Colour = colour.Gray3; } From 9db3fee4b477eb6ec1db1f3a0f8524d26e902e25 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Sun, 2 Apr 2017 21:03:33 +0200 Subject: [PATCH 055/442] make Screens work --- osu.Game/Graphics/Cursor/MenuCursor.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index 82422765a3..ca462d78cc 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -71,17 +71,14 @@ namespace osu.Game.Graphics.Cursor private void searchTooltip(Tooltip tooltip, Vector2 mousePosition, IContainerEnumerable children) { - IEnumerable next = children.Children.Where(drawable => drawable.Contains(mousePosition) && !(drawable is CursorContainer)); + IEnumerable next = children.InternalChildren.Where(drawable => drawable.Contains(mousePosition) && !(drawable is CursorContainer)); foreach (Drawable drawable in next) { string tooltipText = (drawable as IHasTooltip)?.Tooltip ?? ""; if (tooltipText != "") tooltip.TooltipText = tooltipText; - - var childScreen = (drawable as Screen)?.ChildScreen; - if (childScreen != null) - searchTooltip(tooltip, mousePosition, childScreen); - else if (drawable is IContainer) + + if (drawable is IContainer) searchTooltip(tooltip, mousePosition, drawable as IContainerEnumerable); } } From a9baeddaa5988337520d2f5a8b8d5a8432d3be21 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Sun, 2 Apr 2017 21:12:49 +0200 Subject: [PATCH 056/442] remove unused code --- osu.Game/Graphics/Cursor/MenuCursor.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index ca462d78cc..cb6dcc451f 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -15,7 +15,6 @@ using osu.Framework.Graphics.Textures; using osu.Game.Graphics.UserInterface; using osu.Framework.Threading; using System.Linq; -using osu.Framework.Screens; using System.Collections.Generic; namespace osu.Game.Graphics.Cursor From 5a694e0c9d20909d9265c57c6f1d8de307bf445a Mon Sep 17 00:00:00 2001 From: Jorolf Date: Mon, 3 Apr 2017 19:28:05 +0200 Subject: [PATCH 057/442] changed location of BarGraph to be more generic --- .../Tests/TestCaseBeatmapDetails.cs | 2 +- .../UserInterface/BarGraph.cs} | 45 ++++++++++++++++--- osu.Game/Screens/Select/BeatmapDetailArea.cs | 1 - .../Select/{Details => }/BeatmapDetails.cs | 35 ++++++++------- .../Select/Details/BeatmapDetailsGraph.cs | 41 ----------------- osu.Game/osu.Game.csproj | 9 ++-- 6 files changed, 63 insertions(+), 70 deletions(-) rename osu.Game/{Screens/Select/Details/BeatmapDetailsBar.cs => Graphics/UserInterface/BarGraph.cs} (66%) rename osu.Game/Screens/Select/{Details => }/BeatmapDetails.cs (92%) delete mode 100644 osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs index 3a57c1bc87..1f7662306f 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs @@ -5,7 +5,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Primitives; using osu.Framework.Testing; using osu.Game.Database; -using osu.Game.Screens.Select.Details; +using osu.Game.Screens.Select; using System; using System.Linq; diff --git a/osu.Game/Screens/Select/Details/BeatmapDetailsBar.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs similarity index 66% rename from osu.Game/Screens/Select/Details/BeatmapDetailsBar.cs rename to osu.Game/Graphics/UserInterface/BarGraph.cs index d637903754..80412c41e5 100644 --- a/osu.Game/Screens/Select/Details/BeatmapDetailsBar.cs +++ b/osu.Game/Graphics/UserInterface/BarGraph.cs @@ -1,15 +1,48 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . +// Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; +using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using System.Collections.Generic; +using System.Linq; -namespace osu.Game.Screens.Select.Details +namespace osu.Game.Graphics.UserInterface { - public class BeatmapDetailsBar : Container + public class BarGraph : FillFlowContainer + { + + public IEnumerable Values + { + set + { + List values = value.ToList(); + List graphBars = Children.ToList(); + for (int i = 0; i < values.Count; i++) + if (graphBars.Count > i) + { + graphBars[i].Length = values[i] / values.Max(); + graphBars[i].Width = 1.0f / values.Count; + } + else + Add(new Bar + { + RelativeSizeAxes = Axes.Both, + Width = 1.0f / values.Count, + Length = values[i] / values.Max(), + Direction = BarDirection.BottomToTop, + BackgroundColour = new Color4(0, 0, 0, 0), + }); + + } + } + + } + + public class Bar : Container { private readonly Box background; private readonly Box bar; @@ -27,7 +60,7 @@ namespace osu.Game.Screens.Select.Details } set { - length = MathHelper.Clamp(value,0,1); + length = MathHelper.Clamp(value, 0, 1); updateBarLength(); } } @@ -70,9 +103,9 @@ namespace osu.Game.Screens.Select.Details } } - public BeatmapDetailsBar() + public Bar() { - Children = new [] + Children = new[] { background = new Box { diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index c5dc7057bb..8387e39f67 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics.Primitives; using osu.Game.Beatmaps; using osu.Game.Online.API; using osu.Game.Online.API.Requests; -using osu.Game.Screens.Select.Details; using osu.Game.Screens.Select.Leaderboards; namespace osu.Game.Screens.Select diff --git a/osu.Game/Screens/Select/Details/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs similarity index 92% rename from osu.Game/Screens/Select/Details/BeatmapDetails.cs rename to osu.Game/Screens/Select/BeatmapDetails.cs index cf50853691..6bc7fe5ca0 100644 --- a/osu.Game/Screens/Select/Details/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -12,11 +12,12 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; using System.Collections.Generic; using System.Globalization; using System.Linq; -namespace osu.Game.Screens.Select.Details +namespace osu.Game.Screens.Select { public class BeatmapDetails : Container { @@ -30,13 +31,13 @@ namespace osu.Game.Screens.Select.Details private readonly DifficultyRow approachRate; private readonly DifficultyRow stars; - private readonly BeatmapDetailsBar ratingsBar; + private readonly Bar ratingsBar; private readonly OsuSpriteText negativeRatings; private readonly OsuSpriteText positiveRatings; - private readonly BeatmapDetailsGraph ratingsGraph; + private readonly BarGraph ratingsGraph; - private readonly BeatmapDetailsGraph retryGraph; - private readonly BeatmapDetailsGraph failGraph; + private readonly BarGraph retryGraph; + private readonly BarGraph failGraph; private BeatmapInfo beatmap; public BeatmapInfo Beatmap @@ -267,7 +268,7 @@ namespace osu.Game.Screens.Select.Details Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, }, - ratingsBar = new BeatmapDetailsBar + ratingsBar = new Bar { RelativeSizeAxes = Axes.X, Height = 5, @@ -301,7 +302,7 @@ namespace osu.Game.Screens.Select.Details Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, }, - ratingsGraph = new BeatmapDetailsGraph + ratingsGraph = new BarGraph { RelativeSizeAxes = Axes.X, Direction = FillDirection.Horizontal, @@ -316,17 +317,17 @@ namespace osu.Game.Screens.Select.Details Text = "Points of Failure", Font = @"Exo2.0-Medium", }, - new Container + new Container { RelativeSizeAxes = Axes.X, Size = new Vector2(1/0.6f, 50), Children = new[] { - retryGraph = new BeatmapDetailsGraph + retryGraph = new BarGraph { RelativeSizeAxes = Axes.Both, }, - failGraph = new BeatmapDetailsGraph + failGraph = new BarGraph { RelativeSizeAxes = Axes.Both, }, @@ -357,7 +358,7 @@ namespace osu.Game.Screens.Select.Details private class DifficultyRow : Container { private readonly OsuSpriteText name; - private readonly BeatmapDetailsBar bar; + private readonly Bar bar; private readonly OsuSpriteText valueText; private float difficultyValue; @@ -421,7 +422,7 @@ namespace osu.Game.Screens.Select.Details { Font = @"Exo2.0-Medium", }, - bar = new BeatmapDetailsBar + bar = new Bar { Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, @@ -447,10 +448,10 @@ namespace osu.Game.Screens.Select.Details } } - private class RetryAndFailBar : Container + private class RetryAndFailBar : Container { - private readonly BeatmapDetailsBar retryBar; - private readonly BeatmapDetailsBar failBar; + private readonly Bar retryBar; + private readonly Bar failBar; public float RetryLength { @@ -480,14 +481,14 @@ namespace osu.Game.Screens.Select.Details { Children = new[] { - retryBar = new BeatmapDetailsBar + retryBar = new Bar { RelativeSizeAxes = Axes.Both, Direction = BarDirection.BottomToTop, Length = 0, BackgroundColour = new Color4(0,0,0,0), }, - failBar = new BeatmapDetailsBar + failBar = new Bar { RelativeSizeAxes = Axes.Both, Direction = BarDirection.BottomToTop, diff --git a/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs b/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs deleted file mode 100644 index 6a90ff60d1..0000000000 --- a/osu.Game/Screens/Select/Details/BeatmapDetailsGraph.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using OpenTK.Graphics; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using System.Collections.Generic; -using System.Linq; - -namespace osu.Game.Screens.Select.Details -{ - public class BeatmapDetailsGraph : FillFlowContainer - { - - public IEnumerable Values - { - set - { - List values = value.ToList(); - List graphBars = Children.ToList(); - for (int i = 0; i < values.Count; i++) - if (graphBars.Count > i) - { - graphBars[i].Length = values[i] / values.Max(); - graphBars[i].Width = 1.0f / values.Count; - } - else - Add(new BeatmapDetailsBar - { - RelativeSizeAxes = Axes.Both, - Width = 1.0f / values.Count, - Length = values[i] / values.Max(), - Direction = BarDirection.BottomToTop, - BackgroundColour = new Color4(0, 0, 0, 0), - }); - - } - } - - } -} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 360f8c9772..2e1ded6136 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -206,9 +206,8 @@ - - - + + @@ -391,7 +390,9 @@ - + + + From 8e689a06d8f113c743248387dc4491bb3c538ad4 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Mon, 3 Apr 2017 23:03:49 +0200 Subject: [PATCH 058/442] change font --- osu.Game/Screens/Select/BeatmapDetails.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 6bc7fe5ca0..2e9d78cced 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -56,7 +56,7 @@ namespace osu.Game.Screens.Select tags.Children = beatmap.Metadata.Tags?.Split(' ').Select(text => new OsuSpriteText { Text = text, - Font = "Exo2.0-Medium", + Font = "Exo2.0-Regular", }); circleSize.Value = beatmap.Difficulty.CircleSize; @@ -148,7 +148,7 @@ namespace osu.Game.Screens.Select }, description = new OsuSpriteText { - Font = @"Exo2.0-Medium", + Font = @"Exo2.0-Regular", Direction = FillDirection.Full, }, new OsuSpriteText @@ -159,7 +159,7 @@ namespace osu.Game.Screens.Select }, source = new OsuSpriteText { - Font = @"Exo2.0-Medium", + Font = @"Exo2.0-Regular", Direction = FillDirection.Full, }, new OsuSpriteText @@ -282,12 +282,12 @@ namespace osu.Game.Screens.Select { negativeRatings = new OsuSpriteText { - Font = @"Exo2.0-Medium", + Font = @"Exo2.0-Regular", Text = "0", }, positiveRatings = new OsuSpriteText { - Font = @"Exo2.0-Medium", + Font = @"Exo2.0-Regular", Text = "0", Anchor = Anchor.TopRight, Origin = Anchor.TopRight, @@ -298,7 +298,7 @@ namespace osu.Game.Screens.Select { Text = "Rating Spread", TextSize = 14, - Font = @"Exo2.0-Medium", + Font = @"Exo2.0-Regular", Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, }, @@ -315,7 +315,7 @@ namespace osu.Game.Screens.Select new OsuSpriteText { Text = "Points of Failure", - Font = @"Exo2.0-Medium", + Font = @"Exo2.0-Regular", }, new Container { @@ -420,7 +420,7 @@ namespace osu.Game.Screens.Select { name = new OsuSpriteText { - Font = @"Exo2.0-Medium", + Font = @"Exo2.0-Regular", }, bar = new Bar { @@ -434,7 +434,7 @@ namespace osu.Game.Screens.Select { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, - Font = @"Exo2.0-Medium", + Font = @"Exo2.0-Regular", }, }; } From 58f8dc82541775e28cf58a176ebd0b389837f225 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Tue, 4 Apr 2017 17:17:22 +0200 Subject: [PATCH 059/442] add direction to graphs --- osu.Game/Graphics/UserInterface/BarGraph.cs | 19 +++++++++++++++++-- osu.Game/Screens/Select/BeatmapDetails.cs | 1 - 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/BarGraph.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs index 80412c41e5..5ad14a92f5 100644 --- a/osu.Game/Graphics/UserInterface/BarGraph.cs +++ b/osu.Game/Graphics/UserInterface/BarGraph.cs @@ -14,6 +14,22 @@ namespace osu.Game.Graphics.UserInterface { public class BarGraph : FillFlowContainer { + private BarDirection direction = BarDirection.BottomToTop; + public new BarDirection Direction + { + get + { + return direction; + } + set + { + direction = value; + foreach (var bar in Children) + bar.Direction = direction; + base.Direction = direction == BarDirection.LeftToRight || direction == BarDirection.RightToLeft ? FillDirection.Vertical : FillDirection.Horizontal; + } + } + public IEnumerable Values { @@ -33,13 +49,12 @@ namespace osu.Game.Graphics.UserInterface RelativeSizeAxes = Axes.Both, Width = 1.0f / values.Count, Length = values[i] / values.Max(), - Direction = BarDirection.BottomToTop, + Direction = Direction, BackgroundColour = new Color4(0, 0, 0, 0), }); } } - } public class Bar : Container diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 2e9d78cced..5adced7c95 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -305,7 +305,6 @@ namespace osu.Game.Screens.Select ratingsGraph = new BarGraph { RelativeSizeAxes = Axes.X, - Direction = FillDirection.Horizontal, Height = 50, }, }, From 078d44aec31edce4bf7dd6fdc92d278c3f67f356 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Tue, 4 Apr 2017 17:17:37 +0200 Subject: [PATCH 060/442] some changes to the testcase --- osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs index 1f7662306f..72b27bb8b2 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs @@ -44,7 +44,7 @@ namespace osu.Desktop.VisualTests.Tests }, }); - AddStep("new retry/fail values", newRetryAndFailValues); + AddRepeatStep("new retry/fail values", newRetryAndFailValues, 10); AddStep("new ratings", newRatings); } @@ -57,9 +57,7 @@ namespace osu.Desktop.VisualTests.Tests lastRange += 100; } - private void newRatings() - { - details.Ratings = Enumerable.Range(1, 10); - } + private void newRatings() => details.Ratings = Enumerable.Range(1, 10); + } } From b2731bb0a130b26beaa0567a46e14e680a13b076 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Tue, 4 Apr 2017 17:27:08 +0200 Subject: [PATCH 061/442] some formatting --- .../Tests/TestCaseBeatmapDetails.cs | 3 +-- .../Tests/TestCaseGraphAndBar.cs | 11 +++++++++++ .../osu.Desktop.VisualTests.csproj | 1 + osu.Game/Graphics/UserInterface/BarGraph.cs | 6 +++--- osu.Game/Screens/Select/BeatmapDetailArea.cs | 13 +++++++------ osu.Game/Screens/Select/BeatmapDetails.cs | 19 ++++++++++++------- 6 files changed, 35 insertions(+), 18 deletions(-) create mode 100644 osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs index 72b27bb8b2..9af7329600 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs @@ -58,6 +58,5 @@ namespace osu.Desktop.VisualTests.Tests } private void newRatings() => details.Ratings = Enumerable.Range(1, 10); - } -} +} \ No newline at end of file diff --git a/osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs b/osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs new file mode 100644 index 0000000000..f43b6a557d --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs @@ -0,0 +1,11 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Testing; + +namespace osu.Desktop.VisualTests.Tests +{ + internal class TestCaseGraphAndBar : TestCase + { + } +} \ No newline at end of file diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index 38c574f61f..ce60d25ad3 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -190,6 +190,7 @@ + diff --git a/osu.Game/Graphics/UserInterface/BarGraph.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs index 5ad14a92f5..ce8a5f18b8 100644 --- a/osu.Game/Graphics/UserInterface/BarGraph.cs +++ b/osu.Game/Graphics/UserInterface/BarGraph.cs @@ -30,7 +30,6 @@ namespace osu.Game.Graphics.UserInterface } } - public IEnumerable Values { set @@ -52,7 +51,6 @@ namespace osu.Game.Graphics.UserInterface Direction = Direction, BackgroundColour = new Color4(0, 0, 0, 0), }); - } } } @@ -141,6 +139,7 @@ namespace osu.Game.Graphics.UserInterface case BarDirection.RightToLeft: bar.ResizeTo(new Vector2(length, 1), resize_duration, easing); break; + case BarDirection.TopToBottom: case BarDirection.BottomToTop: bar.ResizeTo(new Vector2(1, length), resize_duration, easing); @@ -154,6 +153,7 @@ namespace osu.Game.Graphics.UserInterface bar.Anchor = Anchor.TopLeft; bar.Origin = Anchor.TopLeft; break; + case BarDirection.RightToLeft: case BarDirection.BottomToTop: bar.Anchor = Anchor.BottomRight; @@ -170,4 +170,4 @@ namespace osu.Game.Graphics.UserInterface TopToBottom, BottomToTop, } -} +} \ No newline at end of file diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index 8387e39f67..cb697c31d0 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -24,6 +24,7 @@ namespace osu.Game.Screens.Select private APIAccess api; private WorkingBeatmap beatmap; + public WorkingBeatmap Beatmap { get @@ -34,7 +35,7 @@ namespace osu.Game.Screens.Select { beatmap = value; if (IsLoaded) - if(currentTab == BeatmapDetailTab.Details) + if (currentTab == BeatmapDetailTab.Details) Schedule(updateDetails); else Schedule(updateScores); @@ -48,7 +49,7 @@ namespace osu.Game.Screens.Select new BeatmapDetailAreaTabControl { RelativeSizeAxes = Axes.X, - OnFilter = (tab, mods) => + OnFilter = (tab, mods) => { switch (tab) { @@ -57,6 +58,7 @@ namespace osu.Game.Screens.Select Leaderboard.Hide(); updateDetails(); break; + default: Details.Hide(); Leaderboard.Show(); @@ -100,6 +102,7 @@ namespace osu.Game.Screens.Select } private GetScoresRequest getScoresRequest; + private void updateScores() { if (!IsLoaded) return; @@ -114,15 +117,13 @@ namespace osu.Game.Screens.Select api.Queue(getScoresRequest); } - - private void updateDetails() { if (!IsLoaded) return; if (api == null || beatmap?.BeatmapInfo == null) return; - + Details.Beatmap = beatmap.Beatmap.BeatmapInfo; } } -} +} \ No newline at end of file diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 5adced7c95..433374509b 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -40,6 +40,7 @@ namespace osu.Game.Screens.Select private readonly BarGraph failGraph; private BeatmapInfo beatmap; + public BeatmapInfo Beatmap { get @@ -63,11 +64,12 @@ namespace osu.Game.Screens.Select drainRate.Value = beatmap.Difficulty.DrainRate; overallDifficulty.Value = beatmap.Difficulty.OverallDifficulty; approachRate.Value = beatmap.Difficulty.ApproachRate; - stars.Value = (float) beatmap.StarDifficulty; + stars.Value = (float)beatmap.StarDifficulty; } } private List ratings; + public IEnumerable Ratings { get @@ -85,7 +87,8 @@ namespace osu.Game.Screens.Select } } - private List retries = Enumerable.Repeat(0,100).ToList(); + private List retries = Enumerable.Repeat(0, 100).ToList(); + public IEnumerable Retries { get @@ -99,7 +102,8 @@ namespace osu.Game.Screens.Select } } - private List fails = Enumerable.Repeat(0,100).ToList(); + private List fails = Enumerable.Repeat(0, 100).ToList(); + public IEnumerable Fails { get @@ -117,7 +121,6 @@ namespace osu.Game.Screens.Select { failGraph.Values = fails.Select(fail => (float)fail); retryGraph.Values = retries.Select((retry, index) => (float)retry + fails[index]); - } public BeatmapDetails() @@ -361,6 +364,7 @@ namespace osu.Game.Screens.Select private readonly OsuSpriteText valueText; private float difficultyValue; + public float Value { get @@ -370,12 +374,13 @@ namespace osu.Game.Screens.Select set { difficultyValue = value; - bar.Length = value/maxValue; + bar.Length = value / maxValue; valueText.Text = value.ToString(CultureInfo.InvariantCulture); } } private float maxValue = 10; + public float MaxValue { get @@ -385,7 +390,7 @@ namespace osu.Game.Screens.Select set { maxValue = value; - bar.Length = Value/value; + bar.Length = Value / value; } } @@ -505,4 +510,4 @@ namespace osu.Game.Screens.Select } } } -} +} \ No newline at end of file From 502afc0a4890e67c43f9c13c9780a8cc7714f297 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Tue, 4 Apr 2017 18:09:16 +0200 Subject: [PATCH 062/442] some fixes to BarGraph so Direction works properly --- osu.Game/Graphics/UserInterface/BarGraph.cs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/BarGraph.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs index ce8a5f18b8..2daa19bb4e 100644 --- a/osu.Game/Graphics/UserInterface/BarGraph.cs +++ b/osu.Game/Graphics/UserInterface/BarGraph.cs @@ -24,9 +24,12 @@ namespace osu.Game.Graphics.UserInterface set { direction = value; + base.Direction = (direction & BarDirection.Horizontal) > 0 ? FillDirection.Vertical : FillDirection.Horizontal; foreach (var bar in Children) + { + bar.Size = (direction & BarDirection.Horizontal) > 0 ? new Vector2(1, 1.0f / Children.Count()) : new Vector2(1.0f / Children.Count(), 1); bar.Direction = direction; - base.Direction = direction == BarDirection.LeftToRight || direction == BarDirection.RightToLeft ? FillDirection.Vertical : FillDirection.Horizontal; + } } } @@ -40,13 +43,13 @@ namespace osu.Game.Graphics.UserInterface if (graphBars.Count > i) { graphBars[i].Length = values[i] / values.Max(); - graphBars[i].Width = 1.0f / values.Count; + graphBars[i].Size = (direction & BarDirection.Horizontal) > 0 ? new Vector2(1, 1.0f / values.Count) : new Vector2(1.0f / values.Count, 1); } else Add(new Bar { RelativeSizeAxes = Axes.Both, - Width = 1.0f / values.Count, + Size = (direction & BarDirection.Horizontal) > 0 ? new Vector2(1, 1.0f / values.Count) : new Vector2(1.0f / values.Count, 1), Length = values[i] / values.Max(), Direction = Direction, BackgroundColour = new Color4(0, 0, 0, 0), @@ -165,9 +168,12 @@ namespace osu.Game.Graphics.UserInterface public enum BarDirection { - LeftToRight, - RightToLeft, - TopToBottom, - BottomToTop, + LeftToRight = 1 << 0, + RightToLeft = 1 << 1, + TopToBottom = 1 << 2, + BottomToTop = 1 << 3, + + Vertical = TopToBottom | BottomToTop, + Horizontal = LeftToRight | RightToLeft, } } \ No newline at end of file From cd2fc3148e1f323d78a5540b680162f362bf964c Mon Sep 17 00:00:00 2001 From: Jorolf Date: Tue, 4 Apr 2017 18:10:57 +0200 Subject: [PATCH 063/442] added TestCaseGraphAndBar --- .../Tests/TestCaseGraphAndBar.cs | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs b/osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs index f43b6a557d..571a5031c8 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs @@ -1,11 +1,42 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using OpenTK; +using osu.Framework.Graphics; using osu.Framework.Testing; +using osu.Game.Graphics.UserInterface; +using System.Collections.Generic; +using System.Linq; namespace osu.Desktop.VisualTests.Tests { internal class TestCaseGraphAndBar : TestCase { + public override string Description => "graphs and bars, bars and graphs"; + + private BarGraph graph; + + public override void Reset() + { + base.Reset(); + + Children = new[] + { + graph = new BarGraph + { + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(0.5f), + }, + }; + + AddStep("values from 1-10", () => graph.Values = Enumerable.Range(1,10).Select(i => (float)i)); + AddStep("reversed values from 1-10", () => graph.Values = Enumerable.Range(1, 10).Reverse().Select(i => (float)i)); + AddStep("Bottom to top", () => graph.Direction = BarDirection.BottomToTop); + AddStep("Top to bottom", () => graph.Direction = BarDirection.TopToBottom); + AddStep("Left to right", () => graph.Direction = BarDirection.LeftToRight); + AddStep("Right to left", () => graph.Direction = BarDirection.RightToLeft); + } } } \ No newline at end of file From f9bf1c69bf73b34f88154bcce074f9f2a59de56d Mon Sep 17 00:00:00 2001 From: Jorolf Date: Tue, 4 Apr 2017 18:23:29 +0200 Subject: [PATCH 064/442] add Flags to BarDirection and remove unused "using" --- osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs | 1 - osu.Game/Graphics/UserInterface/BarGraph.cs | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs b/osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs index 571a5031c8..5ae64b5e73 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs @@ -5,7 +5,6 @@ using OpenTK; using osu.Framework.Graphics; using osu.Framework.Testing; using osu.Game.Graphics.UserInterface; -using System.Collections.Generic; using System.Linq; namespace osu.Desktop.VisualTests.Tests diff --git a/osu.Game/Graphics/UserInterface/BarGraph.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs index 2daa19bb4e..8f02f14ea8 100644 --- a/osu.Game/Graphics/UserInterface/BarGraph.cs +++ b/osu.Game/Graphics/UserInterface/BarGraph.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using System; using System.Collections.Generic; using System.Linq; @@ -166,6 +167,7 @@ namespace osu.Game.Graphics.UserInterface } } + [Flags] public enum BarDirection { LeftToRight = 1 << 0, From 28193cbaaa8d50b24c0d2761b7049ac3ae6b278c Mon Sep 17 00:00:00 2001 From: Jorolf Date: Thu, 6 Apr 2017 15:39:23 +0200 Subject: [PATCH 065/442] hide BeatmapDetails on entering the Select screen --- osu.Game/Screens/Select/BeatmapDetailArea.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index cb697c31d0..3fd349da7f 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -81,6 +81,7 @@ namespace osu.Game.Screens.Select { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding(5), + Alpha = 0, }, Leaderboard = new Leaderboard { From 1842d80e282e6e40815c49f1074255f76e893ee2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 7 Apr 2017 09:40:35 +0900 Subject: [PATCH 066/442] Update test case. --- osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs | 6 +++--- osu.Game/Screens/Play/SongProgress.cs | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs index efce867c3f..13a77855d9 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using osu.Framework.Graphics; using osu.Framework.MathUtils; -using osu.Framework.Screens.Testing; +using osu.Framework.Testing; using osu.Game.Screens.Play; namespace osu.Desktop.VisualTests.Tests @@ -28,8 +28,8 @@ namespace osu.Desktop.VisualTests.Tests OnSeek = time => progress.CurrentTime = time, }); - AddButton("Toggle Bar", progress.ToggleVisibility); - AddButton("New Values", displayNewValues); + AddStep("Toggle Bar", progress.ToggleVisibility); + AddStep("New Values", displayNewValues); displayNewValues(); } diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index af677c9471..783b7611a2 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -5,7 +5,6 @@ using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; -using osu.Framework.Graphics.Transforms; using System; using osu.Game.Graphics; using osu.Framework.Allocation; From 7e99fc47e2bb154eb2f21e2691766254ff3a8aee Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 7 Apr 2017 15:20:39 +0900 Subject: [PATCH 067/442] wip --- .../Tests/TestCaseSongProgress.cs | 404 +++++++++++++++++- osu.Game/Overlays/DragBar.cs | 5 +- osu.Game/Screens/Play/Player.cs | 4 +- osu.Game/Screens/Play/SongProgress.cs | 41 +- osu.Game/Screens/Play/SongProgressBar.cs | 4 +- osu.Game/Screens/Play/SongProgressGraph.cs | 2 +- 6 files changed, 423 insertions(+), 37 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs index 13a77855d9..feb7aac0ce 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs @@ -1,11 +1,22 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using System.Collections.Generic; +using System.Linq; +using osu.Framework; +using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Primitives; +using osu.Framework.Graphics.Sprites; using osu.Framework.MathUtils; using osu.Framework.Testing; -using osu.Game.Screens.Play; +using osu.Game.Graphics; +using osu.Game.Overlays; +using OpenTK; +using OpenTK.Graphics; namespace osu.Desktop.VisualTests.Tests { @@ -24,12 +35,12 @@ namespace osu.Desktop.VisualTests.Tests Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.X, - Length = 100, - OnSeek = time => progress.CurrentTime = time, }); - AddStep("Toggle Bar", progress.ToggleVisibility); - AddStep("New Values", displayNewValues); + AddStep("Toggle Bar", progress.ToggleBar); + AddWaitStep(5); + //AddStep("Toggle Bar", progress.ToggleVisibility); + //AddStep("New Values", displayNewValues); displayNewValues(); } @@ -43,7 +54,388 @@ namespace osu.Desktop.VisualTests.Tests } progress.Values = newValues.ToArray(); - progress.CurrentTime = RNG.Next(0, 100); + progress.Progress = RNG.NextDouble(); + } + } + + public class SongProgress : OverlayContainer + { + private const int progress_height = 5; + + private static readonly Vector2 handle_size = new Vector2(14, 25); + + private const float transition_duration = 200; + + private readonly SongProgressBar bar; + private readonly SongProgressGraph graph; + + public Action OnSeek; + + private double progress; + public double Progress + { + get { return progress; } + set + { + progress = value; + updateProgress(); + } + } + + public int[] Values + { + get { return graph.Values; } + set { graph.Values = value; } + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + graph.FillColour = bar.FillColour = colours.BlueLighter; + } + + public SongProgress() + { + RelativeSizeAxes = Axes.X; + Height = progress_height + SongProgressGraph.Column.HEIGHT + handle_size.Y; + + Children = new Drawable[] + { + graph = new SongProgressGraph + { + RelativeSizeAxes = Axes.X, + Origin = Anchor.BottomLeft, + Anchor = Anchor.BottomLeft, + Height = SongProgressGraph.Column.HEIGHT, + Margin = new MarginPadding { Bottom = progress_height }, + }, + bar = new SongProgressBar(progress_height, SongProgressGraph.Column.HEIGHT, handle_size) + { + Origin = Anchor.BottomLeft, + Anchor = Anchor.BottomLeft, + Alpha = 0, + SeekRequested = delegate (float position) + { + OnSeek?.Invoke(position); + }, + }, + }; + } + + private void updateProgress() + { + bar.UpdatePosition((float)progress); + graph.Progress = (int)(graph.ColumnCount * progress); + } + + private bool barVisible; + + public void ToggleBar() + { + barVisible = !barVisible; + + updateBarVisibility(); + } + + private void updateBarVisibility() + { + bar.FadeTo(barVisible ? 1 : 0, transition_duration, EasingTypes.In); + MoveTo(new Vector2(0, barVisible ? 0 : progress_height), transition_duration, EasingTypes.In); + } + + protected override void PopIn() + { + updateBarVisibility(); + } + + protected override void PopOut() + { + } + + protected override void Update() + { + base.Update(); + + updateProgress(); + } + } + + public class SongProgressGraph : BufferedContainer + { + private Game.Screens.Play.SongProgressGraph.Column[] columns = { }; + + public int ColumnCount => columns.Length; + + public override bool HandleInput => false; + + private int progress; + public int Progress + { + get { return progress; } + set + { + if (value == progress) return; + progress = value; + + redrawProgress(); + } + } + + private int[] calculatedValues = { }; // values but adjusted to fit the amount of columns + private int[] values; + public int[] Values + { + get { return values; } + set + { + if (value == values) return; + values = value; + recreateGraph(); + } + } + + private Color4 fillColour; + public Color4 FillColour + { + get { return fillColour; } + set + { + if (value == fillColour) return; + fillColour = value; + + redrawFilled(); + } + } + + public SongProgressGraph() + { + CacheDrawnFrameBuffer = true; + PixelSnapping = true; + } + + private float lastDrawWidth; + protected override void Update() + { + base.Update(); + + // todo: Recreating in update is probably not the best idea + if (DrawWidth == lastDrawWidth) return; + recreateGraph(); + lastDrawWidth = DrawWidth; + } + + /// + /// Redraws all the columns to match their lit/dimmed state. + /// + private void redrawProgress() + { + for (int i = 0; i < columns.Length; i++) + { + columns[i].State = i <= progress ? Game.Screens.Play.SongProgressGraph.ColumnState.Lit : Game.Screens.Play.SongProgressGraph.ColumnState.Dimmed; + } + + ForceRedraw(); + } + + /// + /// Redraws the filled amount of all the columns. + /// + private void redrawFilled() + { + for (int i = 0; i < ColumnCount; i++) + { + columns[i].Filled = calculatedValues.ElementAtOrDefault(i); + } + } + + /// + /// Takes and adjusts it to fit the amount of columns. + /// + private void recalculateValues() + { + var newValues = new List(); + + if (values == null) + { + for (float i = 0; i < ColumnCount; i++) + newValues.Add(0); + + return; + } + + float step = values.Length / (float)ColumnCount; + for (float i = 0; i < values.Length; i += step) + { + newValues.Add(values[(int)i]); + } + + calculatedValues = newValues.ToArray(); + } + + /// + /// Recreates the entire graph. + /// + private void recreateGraph() + { + var newColumns = new List(); + + for (float x = 0; x < DrawWidth; x += Game.Screens.Play.SongProgressGraph.Column.WIDTH) + { + newColumns.Add(new Game.Screens.Play.SongProgressGraph.Column(fillColour) + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Position = new Vector2(x, 0), + State = Game.Screens.Play.SongProgressGraph.ColumnState.Dimmed, + }); + } + + columns = newColumns.ToArray(); + Children = columns; + + recalculateValues(); + redrawFilled(); + redrawProgress(); + } + + public class Column : Container, IStateful + { + private readonly Color4 emptyColour = Color4.White.Opacity(100); + private readonly Color4 litColour; + private readonly Color4 dimmedColour = Color4.White.Opacity(175); + + private const float cube_count = 6; + private const float cube_size = 4; + private const float padding = 2; + public const float WIDTH = cube_size + padding; + public const float HEIGHT = cube_count * WIDTH + padding; + + private readonly List drawableRows = new List(); + + private int filled; + public int Filled + { + get { return filled; } + set + { + if (value == filled) return; + filled = value; + + fillActive(); + } + } + + private Game.Screens.Play.SongProgressGraph.ColumnState state; + public Game.Screens.Play.SongProgressGraph.ColumnState State + { + get { return state; } + set + { + if (value == state) return; + state = value; + + fillActive(); + } + } + + public Column(Color4 litColour) + { + Size = new Vector2(WIDTH, HEIGHT); + this.litColour = litColour; + + for (int r = 0; r < cube_count; r++) + { + drawableRows.Add(new Box + { + EdgeSmoothness = new Vector2(padding / 4), + Size = new Vector2(cube_size), + Position = new Vector2(0, r * WIDTH + padding), + }); + } + + Children = drawableRows; + + // Reverse drawableRows so when iterating through them they start at the bottom + drawableRows.Reverse(); + } + + private void fillActive() + { + Color4 colour = State == Game.Screens.Play.SongProgressGraph.ColumnState.Lit ? litColour : dimmedColour; + + for (int i = 0; i < drawableRows.Count; i++) + { + if (Filled == 0) // i <= Filled doesn't work for zero fill + drawableRows[i].Colour = emptyColour; + else + drawableRows[i].Colour = i <= Filled ? colour : emptyColour; + } + } + } + + public enum ColumnState + { + Lit, + Dimmed + } + } + + public class SongProgressBar : DragBar + { + public Color4 FillColour + { + get { return FillContainer.Colour; } + set { FillContainer.Colour = value; } + } + + public SongProgressBar(float barHeight, float handleBarHeight, Vector2 handleSize) + { + Height = barHeight + handleBarHeight + handleSize.Y; + FillContainer.RelativeSizeAxes = Axes.X; + FillContainer.Height = barHeight; + + Add(new Box + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + RelativeSizeAxes = Axes.X, + Height = barHeight, + Colour = Color4.Black, + Alpha = 0.5f, + Depth = 1 + }); + FillContainer.Add(new Container + { + Origin = Anchor.BottomRight, + Anchor = Anchor.BottomRight, + Width = 2, + Height = barHeight + handleBarHeight, + Colour = Color4.White, + Position = new Vector2(2, 0), + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + }, + new Container + { + Origin = Anchor.BottomCentre, + Anchor = Anchor.TopCentre, + Size = handleSize, + CornerRadius = 5, + Masking = true, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.White + } + } + } + } + }); } } } diff --git a/osu.Game/Overlays/DragBar.cs b/osu.Game/Overlays/DragBar.cs index 2ee986cd29..123cd404c7 100644 --- a/osu.Game/Overlays/DragBar.cs +++ b/osu.Game/Overlays/DragBar.cs @@ -14,7 +14,6 @@ namespace osu.Game.Overlays public class DragBar : Container { protected readonly Container FillContainer; - protected readonly Box Fill; public Action SeekRequested; @@ -46,7 +45,7 @@ namespace osu.Game.Overlays Width = 0, Children = new Drawable[] { - Fill = new Box + new Box { RelativeSizeAxes = Axes.Both } @@ -73,7 +72,7 @@ namespace osu.Game.Overlays private void updatePosition(float position) { position = MathHelper.Clamp(position, 0, 1); - fill.TransformTo(fill.Width, position, 200, EasingTypes.OutQuint, new TransformSeek()); + FillContainer.TransformTo(FillContainer.Width, position, 200, EasingTypes.OutQuint, new TransformSeek()); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index df2645af7b..9b3ca0df26 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -121,8 +121,6 @@ namespace osu.Game.Screens.Play hudOverlay.BindHitRenderer(HitRenderer); hudOverlay.Progress.Hide(); - hudOverlay.Progress.Length = Beatmap?.Track?.Length ?? 0; - //bind HitRenderer to ScoreProcessor and ourselves (for a pass situation) HitRenderer.OnAllJudged += onCompletion; @@ -167,7 +165,7 @@ namespace osu.Game.Screens.Play { base.Update(); - hudOverlay.Progress.CurrentTime = Beatmap.Track.CurrentTime; + hudOverlay.Progress.Progress = Beatmap.Track.CurrentTime / Beatmap.Track.Length; } private void initializeSkipButton() diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 783b7611a2..b2e289c422 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -14,7 +14,9 @@ namespace osu.Game.Screens.Play public class SongProgress : OverlayContainer { private const int progress_height = 5; - private readonly Vector2 handleSize = new Vector2(14, 25); + + private static readonly Vector2 handle_size = new Vector2(14, 25); + private const float transition_duration = 200; private readonly SongProgressBar bar; @@ -22,24 +24,13 @@ namespace osu.Game.Screens.Play public Action OnSeek; - private double currentTime; - public double CurrentTime + private double progress; + public double Progress { - get { return currentTime; } + get { return progress; } set { - currentTime = value; - updateProgress(); - } - } - - private double length; - public double Length - { - get { return length; } - set - { - length = value; + progress = value; updateProgress(); } } @@ -59,7 +50,7 @@ namespace osu.Game.Screens.Play public SongProgress() { RelativeSizeAxes = Axes.X; - Height = progress_height + SongProgressGraph.Column.HEIGHT + handleSize.Y; + Height = progress_height + SongProgressGraph.Column.HEIGHT + handle_size.Y; Children = new Drawable[] { @@ -71,13 +62,13 @@ namespace osu.Game.Screens.Play Height = SongProgressGraph.Column.HEIGHT, Margin = new MarginPadding { Bottom = progress_height }, }, - bar = new SongProgressBar(progress_height, SongProgressGraph.Column.HEIGHT, handleSize) + bar = new SongProgressBar(progress_height, SongProgressGraph.Column.HEIGHT, handle_size) { Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, SeekRequested = delegate (float position) { - OnSeek?.Invoke(Length * position); + OnSeek?.Invoke(position); }, }, }; @@ -85,9 +76,8 @@ namespace osu.Game.Screens.Play private void updateProgress() { - float currentProgress = (float)(CurrentTime / Length); - bar.UpdatePosition(currentProgress); - graph.Progress = (int)(graph.ColumnCount * currentProgress); + bar.UpdatePosition((float)progress); + graph.Progress = (int)(graph.ColumnCount * progress); } protected override void PopIn() @@ -105,5 +95,12 @@ namespace osu.Game.Screens.Play bar.FadeOut(transition_duration, EasingTypes.In); MoveTo(new Vector2(0f, progress_height), transition_duration, EasingTypes.In); } + + protected override void Update() + { + base.Update(); + + updateProgress(); + } } } diff --git a/osu.Game/Screens/Play/SongProgressBar.cs b/osu.Game/Screens/Play/SongProgressBar.cs index f8ee030d21..a42122d9e1 100644 --- a/osu.Game/Screens/Play/SongProgressBar.cs +++ b/osu.Game/Screens/Play/SongProgressBar.cs @@ -14,8 +14,8 @@ namespace osu.Game.Screens.Play { public Color4 FillColour { - get { return Fill.Colour; } - set { Fill.Colour = value; } + get { return FillContainer.Colour; } + set { FillContainer.Colour = value; } } public SongProgressBar(float barHeight, float handleBarHeight, Vector2 handleSize) diff --git a/osu.Game/Screens/Play/SongProgressGraph.cs b/osu.Game/Screens/Play/SongProgressGraph.cs index 9bac81a721..4f0cdbf67a 100644 --- a/osu.Game/Screens/Play/SongProgressGraph.cs +++ b/osu.Game/Screens/Play/SongProgressGraph.cs @@ -117,7 +117,7 @@ namespace osu.Game.Screens.Play } float step = values.Length / (float)ColumnCount; - for (float i = 0; i < values.Length; i += step) + for (float i = 0; i < values.Length; i += step) { newValues.Add(values[(int)i]); } From eb4b3772e98218cf64ee041f5393908cd805941d Mon Sep 17 00:00:00 2001 From: Jorolf Date: Fri, 7 Apr 2017 18:13:55 +0200 Subject: [PATCH 068/442] put Bar into its own file and let it only add a background if BackgroundColour is changed --- osu.Game/Graphics/UserInterface/Bar.cs | 134 +++++++++++++++++++ osu.Game/Graphics/UserInterface/BarGraph.cs | 124 ----------------- osu.Game/Screens/Select/BeatmapDetailArea.cs | 2 +- osu.Game/osu.Game.csproj | 1 + 4 files changed, 136 insertions(+), 125 deletions(-) create mode 100644 osu.Game/Graphics/UserInterface/Bar.cs diff --git a/osu.Game/Graphics/UserInterface/Bar.cs b/osu.Game/Graphics/UserInterface/Bar.cs new file mode 100644 index 0000000000..7c2123a309 --- /dev/null +++ b/osu.Game/Graphics/UserInterface/Bar.cs @@ -0,0 +1,134 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using System; + +namespace osu.Game.Graphics.UserInterface +{ + public class Bar : Container + { + private Box background; + private readonly Box bar; + + private const int resize_duration = 250; + + private const EasingTypes easing = EasingTypes.InOutCubic; + + private float length; + public float Length + { + get + { + return length; + } + set + { + length = MathHelper.Clamp(value, 0, 1); + updateBarLength(); + } + } + + public SRGBColour BackgroundColour + { + get + { + return background?.Colour ?? default(SRGBColour); + } + set + { + if (background == null) + Add(background = new Box + { + RelativeSizeAxes = Axes.Both, + Depth = 1, + }); + background.Colour = value; + } + } + + public SRGBColour BarColour + { + get + { + return bar.Colour; + } + set + { + bar.Colour = value; + } + } + + private BarDirection direction = BarDirection.LeftToRight; + public BarDirection Direction + { + get + { + return direction; + } + set + { + direction = value; + updateBarLength(); + } + } + + public Bar() + { + Children = new[] + { + bar = new Box + { + RelativeSizeAxes = Axes.Both, + } + }; + } + + private void updateBarLength() + { + switch (direction) + { + case BarDirection.LeftToRight: + case BarDirection.RightToLeft: + bar.ResizeTo(new Vector2(length, 1), resize_duration, easing); + break; + + case BarDirection.TopToBottom: + case BarDirection.BottomToTop: + bar.ResizeTo(new Vector2(1, length), resize_duration, easing); + break; + } + + switch (direction) + { + case BarDirection.LeftToRight: + case BarDirection.TopToBottom: + bar.Anchor = Anchor.TopLeft; + bar.Origin = Anchor.TopLeft; + break; + + case BarDirection.RightToLeft: + case BarDirection.BottomToTop: + bar.Anchor = Anchor.BottomRight; + bar.Origin = Anchor.BottomRight; + break; + } + } + } + + [Flags] + public enum BarDirection + { + LeftToRight = 1 << 0, + RightToLeft = 1 << 1, + TopToBottom = 1 << 2, + BottomToTop = 1 << 3, + + Vertical = TopToBottom | BottomToTop, + Horizontal = LeftToRight | RightToLeft, + } +} \ No newline at end of file diff --git a/osu.Game/Graphics/UserInterface/BarGraph.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs index 8f02f14ea8..2b1ea7aacd 100644 --- a/osu.Game/Graphics/UserInterface/BarGraph.cs +++ b/osu.Game/Graphics/UserInterface/BarGraph.cs @@ -4,10 +4,7 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics; -using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; -using System; using System.Collections.Generic; using System.Linq; @@ -53,129 +50,8 @@ namespace osu.Game.Graphics.UserInterface Size = (direction & BarDirection.Horizontal) > 0 ? new Vector2(1, 1.0f / values.Count) : new Vector2(1.0f / values.Count, 1), Length = values[i] / values.Max(), Direction = Direction, - BackgroundColour = new Color4(0, 0, 0, 0), }); } } } - - public class Bar : Container - { - private readonly Box background; - private readonly Box bar; - - private const int resize_duration = 250; - - private const EasingTypes easing = EasingTypes.InOutCubic; - - private float length; - public float Length - { - get - { - return length; - } - set - { - length = MathHelper.Clamp(value, 0, 1); - updateBarLength(); - } - } - - public SRGBColour BackgroundColour - { - get - { - return background.Colour; - } - set - { - background.Colour = value; - } - } - - public SRGBColour BarColour - { - get - { - return bar.Colour; - } - set - { - bar.Colour = value; - } - } - - private BarDirection direction = BarDirection.LeftToRight; - public BarDirection Direction - { - get - { - return direction; - } - set - { - direction = value; - updateBarLength(); - } - } - - public Bar() - { - Children = new[] - { - background = new Box - { - RelativeSizeAxes = Axes.Both, - }, - bar = new Box - { - RelativeSizeAxes = Axes.Both, - } - }; - } - - private void updateBarLength() - { - switch (direction) - { - case BarDirection.LeftToRight: - case BarDirection.RightToLeft: - bar.ResizeTo(new Vector2(length, 1), resize_duration, easing); - break; - - case BarDirection.TopToBottom: - case BarDirection.BottomToTop: - bar.ResizeTo(new Vector2(1, length), resize_duration, easing); - break; - } - - switch (direction) - { - case BarDirection.LeftToRight: - case BarDirection.TopToBottom: - bar.Anchor = Anchor.TopLeft; - bar.Origin = Anchor.TopLeft; - break; - - case BarDirection.RightToLeft: - case BarDirection.BottomToTop: - bar.Anchor = Anchor.BottomRight; - bar.Origin = Anchor.BottomRight; - break; - } - } - } - - [Flags] - public enum BarDirection - { - LeftToRight = 1 << 0, - RightToLeft = 1 << 1, - TopToBottom = 1 << 2, - BottomToTop = 1 << 3, - - Vertical = TopToBottom | BottomToTop, - Horizontal = LeftToRight | RightToLeft, - } } \ No newline at end of file diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index 3fd349da7f..480814d013 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -56,7 +56,6 @@ namespace osu.Game.Screens.Select case BeatmapDetailTab.Details: Details.Show(); Leaderboard.Hide(); - updateDetails(); break; default: @@ -66,6 +65,7 @@ namespace osu.Game.Screens.Select break; } currentTab = tab; + updateDetails(); }, }, content = new Container diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index c669af1da6..3e7f7e4abe 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -87,6 +87,7 @@ + From 9881889f88c75cd2eed150fbd8a9ab9b4cc9ef01 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Fri, 7 Apr 2017 18:24:36 +0200 Subject: [PATCH 069/442] removed some unused stuff --- osu.Game/Graphics/UserInterface/BarGraph.cs | 1 - osu.Game/Screens/Select/BeatmapDetailArea.cs | 8 +-- osu.Game/Screens/Select/BeatmapDetails.cs | 58 -------------------- 3 files changed, 2 insertions(+), 65 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/BarGraph.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs index 2b1ea7aacd..e3f087b95c 100644 --- a/osu.Game/Graphics/UserInterface/BarGraph.cs +++ b/osu.Game/Graphics/UserInterface/BarGraph.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; -using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using System.Collections.Generic; diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index 480814d013..169530a0c2 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -24,7 +24,6 @@ namespace osu.Game.Screens.Select private APIAccess api; private WorkingBeatmap beatmap; - public WorkingBeatmap Beatmap { get @@ -34,11 +33,8 @@ namespace osu.Game.Screens.Select set { beatmap = value; - if (IsLoaded) - if (currentTab == BeatmapDetailTab.Details) - Schedule(updateDetails); - else - Schedule(updateScores); + Schedule(updateDetails); + Schedule(updateScores); } } diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 433374509b..56dda7fd89 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -451,63 +451,5 @@ namespace osu.Game.Screens.Select valueText.Colour = colour.GrayB; } } - - private class RetryAndFailBar : Container - { - private readonly Bar retryBar; - private readonly Bar failBar; - - public float RetryLength - { - get - { - return retryBar.Length; - } - set - { - retryBar.Length = value + FailLength; - } - } - - public float FailLength - { - get - { - return failBar.Length; - } - set - { - failBar.Length = value; - } - } - - public RetryAndFailBar() - { - Children = new[] - { - retryBar = new Bar - { - RelativeSizeAxes = Axes.Both, - Direction = BarDirection.BottomToTop, - Length = 0, - BackgroundColour = new Color4(0,0,0,0), - }, - failBar = new Bar - { - RelativeSizeAxes = Axes.Both, - Direction = BarDirection.BottomToTop, - Length = 0, - BackgroundColour = new Color4(0,0,0,0), - }, - }; - } - - [BackgroundDependencyLoader] - private void load(OsuColour colour) - { - retryBar.Colour = colour.Yellow; - failBar.Colour = colour.YellowDarker; - } - } } } \ No newline at end of file From 65d9f4fc4589628e601ba3a523cbd2073916678e Mon Sep 17 00:00:00 2001 From: Jorolf Date: Fri, 7 Apr 2017 19:27:14 +0200 Subject: [PATCH 070/442] hide MetadataSegments without content and remove fail/retry initialisations --- osu.Game/Screens/Select/BeatmapDetails.cs | 141 ++++++++++++++-------- 1 file changed, 92 insertions(+), 49 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 56dda7fd89..5acc5ccb56 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -21,9 +21,9 @@ namespace osu.Game.Screens.Select { public class BeatmapDetails : Container { - private readonly OsuSpriteText description; - private readonly OsuSpriteText source; - private readonly FillFlowContainer tags; + private readonly MetadataSegment description; + private readonly MetadataSegment source; + private readonly MetadataSegment tags; private readonly DifficultyRow circleSize; private readonly DifficultyRow drainRate; @@ -52,13 +52,10 @@ namespace osu.Game.Screens.Select { if (beatmap == value) return; beatmap = value; - description.Text = beatmap.Version; - source.Text = beatmap.Metadata.Source; - tags.Children = beatmap.Metadata.Tags?.Split(' ').Select(text => new OsuSpriteText - { - Text = text, - Font = "Exo2.0-Regular", - }); + + description.ContentText = beatmap.Version; + source.ContentText = beatmap.Metadata.Source; + tags.ContentText = beatmap.Metadata.Tags; circleSize.Value = beatmap.Difficulty.CircleSize; drainRate.Value = beatmap.Difficulty.DrainRate; @@ -87,8 +84,7 @@ namespace osu.Game.Screens.Select } } - private List retries = Enumerable.Repeat(0, 100).ToList(); - + private List retries; public IEnumerable Retries { get @@ -102,8 +98,7 @@ namespace osu.Game.Screens.Select } } - private List fails = Enumerable.Repeat(0, 100).ToList(); - + private List fails; public IEnumerable Fails { get @@ -120,7 +115,7 @@ namespace osu.Game.Screens.Select private void calcRetryAndFailGraph() { failGraph.Values = fails.Select(fail => (float)fail); - retryGraph.Values = retries.Select((retry, index) => (float)retry + fails[index]); + retryGraph.Values = retries?.Select((retry, index) => (float)retry + fails?[index] ?? 0) ?? new List(); } public BeatmapDetails() @@ -133,7 +128,7 @@ namespace osu.Game.Screens.Select Colour = Color4.Black, Alpha = 0.5f, }, - new FillFlowContainer() + new FillFlowContainer() { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, @@ -141,41 +136,29 @@ namespace osu.Game.Screens.Select AutoSizeAxes = Axes.Y, Width = 0.4f, Direction = FillDirection.Vertical, + LayoutDuration = 1, + LayoutEasing = EasingTypes.OutQuint, Padding = new MarginPadding(10) { Top = 25 }, - Children = new Drawable[] + Children = new [] { - new OsuSpriteText - { - Text = "Description", - Font = @"Exo2.0-Bold", - }, - description = new OsuSpriteText - { - Font = @"Exo2.0-Regular", - Direction = FillDirection.Full, - }, - new OsuSpriteText - { - Text = "Source", - Font = @"Exo2.0-Bold", - Margin = new MarginPadding { Top = 20 }, - }, - source = new OsuSpriteText - { - Font = @"Exo2.0-Regular", - Direction = FillDirection.Full, - }, - new OsuSpriteText - { - Text = "Tags", - Font = @"Exo2.0-Bold", - Margin = new MarginPadding { Top = 20 }, - }, - tags = new FillFlowContainer + description = new MetadataSegment { + HeaderText = "Description", RelativeSizeAxes = Axes.X, - Spacing = new Vector2(3,0), + AutoSizeAxes = Axes.Y, }, + source = new MetadataSegment + { + HeaderText = "Source", + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + }, + tags = new MetadataSegment + { + HeaderText = "Tags", + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + } }, }, new FillFlowContainer @@ -343,9 +326,9 @@ namespace osu.Game.Screens.Select [BackgroundDependencyLoader] private void load(OsuColour colour) { - description.Colour = colour.GrayB; - source.Colour = colour.GrayB; - tags.Colour = colour.YellowLight; + description.ContentColour = colour.GrayB; + source.ContentColour = colour.GrayB; + tags.ContentColour = colour.YellowLight; stars.BarColour = colour.Yellow; @@ -451,5 +434,65 @@ namespace osu.Game.Screens.Select valueText.Colour = colour.GrayB; } } + + private class MetadataSegment : Container + { + private readonly OsuSpriteText header; + private readonly FillFlowContainer content; + + private const int fade_time = 250; + + public string HeaderText + { + set + { + header.Text = value; + } + } + + public string ContentText + { + set + { + if (value == "") + FadeOut(fade_time); + else + { + FadeIn(fade_time); + content.Children = value.Split(' ').Select(text => new OsuSpriteText + { + Text = text + " ", + Font = "Exo2.0-Regular", + }); + } + } + } + + public SRGBColour ContentColour + { + set + { + content.Colour = value; + } + } + + public MetadataSegment() + { + Children = new Drawable[] + { + header = new OsuSpriteText + { + Font = @"Exo2.0-Bold", + }, + content = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Full, + Margin = new MarginPadding { Top = header.TextSize } + } + }; + } + } } } \ No newline at end of file From 899e559b5c3f93b1c313d1612ea7010f0d8505c3 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Fri, 7 Apr 2017 19:58:49 +0200 Subject: [PATCH 071/442] ratings hide now + remove unnessary stuff --- osu.Game/Screens/Select/BeatmapDetailArea.cs | 3 --- osu.Game/Screens/Select/BeatmapDetails.cs | 21 +++++++++++++------- osu.Game/osu.Game.csproj | 4 +--- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index 169530a0c2..15db451ea9 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -19,7 +19,6 @@ namespace osu.Game.Screens.Select public readonly BeatmapDetails Details; public readonly Leaderboard Leaderboard; - private BeatmapDetailTab currentTab; private APIAccess api; @@ -60,8 +59,6 @@ namespace osu.Game.Screens.Select updateScores(); break; } - currentTab = tab; - updateDetails(); }, }, content = new Container diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 5acc5ccb56..2655fce8c5 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -31,6 +31,7 @@ namespace osu.Game.Screens.Select private readonly DifficultyRow approachRate; private readonly DifficultyRow stars; + private readonly Container ratingsContainer; private readonly Bar ratingsBar; private readonly OsuSpriteText negativeRatings; private readonly OsuSpriteText positiveRatings; @@ -40,7 +41,6 @@ namespace osu.Game.Screens.Select private readonly BarGraph failGraph; private BeatmapInfo beatmap; - public BeatmapInfo Beatmap { get @@ -66,7 +66,6 @@ namespace osu.Game.Screens.Select } private List ratings; - public IEnumerable Ratings { get @@ -76,11 +75,17 @@ namespace osu.Game.Screens.Select set { ratings = value.ToList(); - negativeRatings.Text = ratings.GetRange(0, 5).Sum().ToString(); - positiveRatings.Text = ratings.GetRange(5, 5).Sum().ToString(); - ratingsBar.Length = (float)ratings.GetRange(0, 5).Sum() / ratings.Sum(); + if(ratings.Count == 0) + ratingsContainer.FadeOut(250); + else + { + ratingsContainer.FadeIn(250); + negativeRatings.Text = ratings.GetRange(0, 5).Sum().ToString(); + positiveRatings.Text = ratings.GetRange(5, 5).Sum().ToString(); + ratingsBar.Length = (float)ratings.GetRange(0, 5).Sum() / ratings.Sum(); - ratingsGraph.Values = ratings.Select(rating => (float)rating); + ratingsGraph.Values = ratings.Select(rating => (float)rating); + } } } @@ -227,10 +232,12 @@ namespace osu.Game.Screens.Select }, }, }, - new Container + ratingsContainer = new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, + Alpha = 0, + AlwaysPresent = true, Children = new Drawable[] { new Box diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 3e7f7e4abe..1888fda4a6 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -385,9 +385,7 @@ - - - + From 6a87fd611235afb6e61515dfaea096414fdac3f6 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Fri, 7 Apr 2017 20:19:03 +0200 Subject: [PATCH 072/442] retries and fails hide if they're not present --- osu.Game/Screens/Select/BeatmapDetails.cs | 46 +++++++++++++++-------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 2655fce8c5..23e3fcf0d5 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -37,6 +37,7 @@ namespace osu.Game.Screens.Select private readonly OsuSpriteText positiveRatings; private readonly BarGraph ratingsGraph; + private readonly FillFlowContainer retryAndFailContainer; private readonly BarGraph retryGraph; private readonly BarGraph failGraph; @@ -119,8 +120,14 @@ namespace osu.Game.Screens.Select private void calcRetryAndFailGraph() { - failGraph.Values = fails.Select(fail => (float)fail); - retryGraph.Values = retries?.Select((retry, index) => (float)retry + fails?[index] ?? 0) ?? new List(); + if ((fails?.Count ?? 0) == 0 || (retries?.Count ?? 0) == 0) + retryAndFailContainer.FadeOut(250); + else + { + retryAndFailContainer.FadeIn(250); + failGraph.Values = fails.Select(fail => (float)fail); + retryGraph.Values = retries?.Select((retry, index) => (float)retry + fails[index]) ?? new List(); + } } public BeatmapDetails() @@ -304,26 +311,35 @@ namespace osu.Game.Screens.Select }, }, }, - new OsuSpriteText - { - Text = "Points of Failure", - Font = @"Exo2.0-Regular", - }, - new Container + retryAndFailContainer = new FillFlowContainer { RelativeSizeAxes = Axes.X, - Size = new Vector2(1/0.6f, 50), - Children = new[] + AutoSizeAxes = Axes.Y, + Alpha = 0, + Children = new Drawable[] { - retryGraph = new BarGraph + new OsuSpriteText { - RelativeSizeAxes = Axes.Both, + Text = "Points of Failure", + Font = @"Exo2.0-Regular", }, - failGraph = new BarGraph + new Container { - RelativeSizeAxes = Axes.Both, + RelativeSizeAxes = Axes.X, + Size = new Vector2(1/0.6f, 50), + Children = new[] + { + retryGraph = new BarGraph + { + RelativeSizeAxes = Axes.Both, + }, + failGraph = new BarGraph + { + RelativeSizeAxes = Axes.Both, + }, + }, }, - }, + } }, }, }, From c60a55285c6d20838f11e6319033b2a7aec05eb7 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Fri, 7 Apr 2017 20:32:09 +0200 Subject: [PATCH 073/442] updated TestCase and some null checks --- osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs | 6 +++--- osu.Game/Graphics/UserInterface/BarGraph.cs | 2 +- osu.Game/Screens/Select/BeatmapDetails.cs | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs index 9af7329600..2885520106 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs @@ -45,7 +45,9 @@ namespace osu.Desktop.VisualTests.Tests }); AddRepeatStep("new retry/fail values", newRetryAndFailValues, 10); - AddStep("new ratings", newRatings); + AddStep("new ratings", () => details.Ratings = Enumerable.Range(1, 10)); + AddStep("remove retries and fails", () => details.Retries = null ); + AddStep("remove ratings", () => details.Ratings = null); } private int lastRange = 1; @@ -56,7 +58,5 @@ namespace osu.Desktop.VisualTests.Tests details.Retries = Enumerable.Range(lastRange, 100).Select(i => (int)(Math.Sin(i) * 100)); lastRange += 100; } - - private void newRatings() => details.Ratings = Enumerable.Range(1, 10); } } \ No newline at end of file diff --git a/osu.Game/Graphics/UserInterface/BarGraph.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs index e3f087b95c..832ba74b89 100644 --- a/osu.Game/Graphics/UserInterface/BarGraph.cs +++ b/osu.Game/Graphics/UserInterface/BarGraph.cs @@ -34,7 +34,7 @@ namespace osu.Game.Graphics.UserInterface { set { - List values = value.ToList(); + List values = value?.ToList() ?? new List(); List graphBars = Children.ToList(); for (int i = 0; i < values.Count; i++) if (graphBars.Count > i) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 23e3fcf0d5..a319d3841c 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -75,7 +75,7 @@ namespace osu.Game.Screens.Select } set { - ratings = value.ToList(); + ratings = value?.ToList() ?? new List(); if(ratings.Count == 0) ratingsContainer.FadeOut(250); else @@ -99,7 +99,7 @@ namespace osu.Game.Screens.Select } set { - retries = value.ToList(); + retries = value?.ToList() ?? new List(); calcRetryAndFailGraph(); } } @@ -113,7 +113,7 @@ namespace osu.Game.Screens.Select } set { - fails = value.ToList(); + fails = value?.ToList() ?? new List(); calcRetryAndFailGraph(); } } @@ -126,7 +126,7 @@ namespace osu.Game.Screens.Select { retryAndFailContainer.FadeIn(250); failGraph.Values = fails.Select(fail => (float)fail); - retryGraph.Values = retries?.Select((retry, index) => (float)retry + fails[index]) ?? new List(); + retryGraph.Values = retries?.Select((retry, index) => (float)retry + fails[index]); } } From 841d101be73026ef3c84bb5d585eced7d2ad311d Mon Sep 17 00:00:00 2001 From: Jorolf Date: Fri, 7 Apr 2017 20:41:03 +0200 Subject: [PATCH 074/442] renaming --- osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs index 2885520106..00f0d67e24 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs @@ -44,10 +44,10 @@ namespace osu.Desktop.VisualTests.Tests }, }); - AddRepeatStep("new retry/fail values", newRetryAndFailValues, 10); + AddRepeatStep("new fail values", newRetryAndFailValues, 10); AddStep("new ratings", () => details.Ratings = Enumerable.Range(1, 10)); - AddStep("remove retries and fails", () => details.Retries = null ); - AddStep("remove ratings", () => details.Ratings = null); + AddStep("remove fails", () => details.Fails = null ); + AddStep("remove ratings", () => details.Ratings = null ); } private int lastRange = 1; From 5e56e84c4a789cf5130cf69f26ee3f9508078c0b Mon Sep 17 00:00:00 2001 From: Jorolf Date: Sat, 8 Apr 2017 13:31:55 +0200 Subject: [PATCH 075/442] change SRGBColour to Color4 and use IHasAccentColour in some places --- osu.Game/Graphics/UserInterface/Bar.cs | 8 ++++---- osu.Game/Screens/Select/BeatmapDetails.cs | 21 ++++++++++++--------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/Bar.cs b/osu.Game/Graphics/UserInterface/Bar.cs index 7c2123a309..2320e48de8 100644 --- a/osu.Game/Graphics/UserInterface/Bar.cs +++ b/osu.Game/Graphics/UserInterface/Bar.cs @@ -2,8 +2,8 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; +using OpenTK.Graphics; using osu.Framework.Graphics; -using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using System; @@ -33,11 +33,11 @@ namespace osu.Game.Graphics.UserInterface } } - public SRGBColour BackgroundColour + public Color4 BackgroundColour { get { - return background?.Colour ?? default(SRGBColour); + return background?.Colour ?? default(Color4); } set { @@ -51,7 +51,7 @@ namespace osu.Game.Graphics.UserInterface } } - public SRGBColour BarColour + public Color4 BarColour { get { diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index a319d3841c..6be42a7759 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -5,7 +5,6 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; @@ -349,11 +348,11 @@ namespace osu.Game.Screens.Select [BackgroundDependencyLoader] private void load(OsuColour colour) { - description.ContentColour = colour.GrayB; - source.ContentColour = colour.GrayB; - tags.ContentColour = colour.YellowLight; + description.AccentColour = colour.GrayB; + source.AccentColour = colour.GrayB; + tags.AccentColour = colour.YellowLight; - stars.BarColour = colour.Yellow; + stars.AccentColour = colour.Yellow; ratingsBar.BackgroundColour = colour.Green; ratingsBar.BarColour = colour.YellowDark; @@ -363,7 +362,7 @@ namespace osu.Game.Screens.Select retryGraph.Colour = colour.Yellow; } - private class DifficultyRow : Container + private class DifficultyRow : Container, IHasAccentColour { private readonly OsuSpriteText name; private readonly Bar bar; @@ -412,7 +411,7 @@ namespace osu.Game.Screens.Select } } - public SRGBColour BarColour + public Color4 AccentColour { get { @@ -458,7 +457,7 @@ namespace osu.Game.Screens.Select } } - private class MetadataSegment : Container + private class MetadataSegment : Container, IHasAccentColour { private readonly OsuSpriteText header; private readonly FillFlowContainer content; @@ -491,8 +490,12 @@ namespace osu.Game.Screens.Select } } - public SRGBColour ContentColour + public Color4 AccentColour { + get + { + return content.Colour; + } set { content.Colour = value; From f7a9a11ae59441e7a493bbc851f11b43aa486e3d Mon Sep 17 00:00:00 2001 From: Jorolf Date: Sat, 8 Apr 2017 13:53:11 +0200 Subject: [PATCH 076/442] Bar uses AccentColour aswell --- osu.Game/Graphics/UserInterface/Bar.cs | 4 ++-- osu.Game/Screens/Select/BeatmapDetails.cs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/Bar.cs b/osu.Game/Graphics/UserInterface/Bar.cs index 2320e48de8..555d366f98 100644 --- a/osu.Game/Graphics/UserInterface/Bar.cs +++ b/osu.Game/Graphics/UserInterface/Bar.cs @@ -10,7 +10,7 @@ using System; namespace osu.Game.Graphics.UserInterface { - public class Bar : Container + public class Bar : Container, IHasAccentColour { private Box background; private readonly Box bar; @@ -51,7 +51,7 @@ namespace osu.Game.Graphics.UserInterface } } - public Color4 BarColour + public Color4 AccentColour { get { diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 6be42a7759..f1daf4eeb9 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -355,7 +355,7 @@ namespace osu.Game.Screens.Select stars.AccentColour = colour.Yellow; ratingsBar.BackgroundColour = colour.Green; - ratingsBar.BarColour = colour.YellowDark; + ratingsBar.AccentColour = colour.YellowDark; ratingsGraph.Colour = colour.BlueDark; failGraph.Colour = colour.YellowDarker; @@ -415,11 +415,11 @@ namespace osu.Game.Screens.Select { get { - return bar.BarColour; + return bar.AccentColour; } set { - bar.BarColour = value; + bar.AccentColour = value; } } From bcef1ce2b68f5c74bc140633cb4ad14ae8ed54ac Mon Sep 17 00:00:00 2001 From: Jorolf Date: Sat, 8 Apr 2017 13:59:22 +0200 Subject: [PATCH 077/442] replace space in text with Spacing in FillFlowContainer --- osu.Game/Screens/Select/BeatmapDetails.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index f1daf4eeb9..6bbe7a0858 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -483,7 +483,7 @@ namespace osu.Game.Screens.Select FadeIn(fade_time); content.Children = value.Split(' ').Select(text => new OsuSpriteText { - Text = text + " ", + Text = text, Font = "Exo2.0-Regular", }); } @@ -515,6 +515,7 @@ namespace osu.Game.Screens.Select RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Full, + Spacing = new Vector2(5,0), Margin = new MarginPadding { Top = header.TextSize } } }; From 667b52156a5338105b54cb94f7ea1c7880e05bba Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 9 Apr 2017 18:59:43 +0900 Subject: [PATCH 078/442] Bring vscode launch/task configurations up to date. --- .vscode/launch.json | 4 ++-- .vscode/tasks.json | 24 +++++++++++------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index b981556649..c836ff97bc 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -11,7 +11,7 @@ "preLaunchTask": "build", "runtimeExecutable": null, "env": {}, - "externalConsole": false + "console": "internalConsole" }, { "name": "Launch Desktop", @@ -23,7 +23,7 @@ "preLaunchTask": "build", "runtimeExecutable": null, "env": {}, - "externalConsole": false + "console": "internalConsole" }, { "name": "Attach", diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 0c0e79f7fb..03f5bc4c6c 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -2,25 +2,23 @@ // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "0.1.0", - "windows": { - "command": "msbuild" - }, - "linux": { - "command": "xbuild" - }, - "args": [ - // Ask msbuild to generate full paths for file names. - "/property:GenerateFullPaths=true" - ], "taskSelector": "/t:", - "showOutput": "silent", "tasks": [ { "taskName": "build", - // Show the output window only if unrecognized errors occur. + "isShellCommand": true, "showOutput": "silent", + "command": "xbuild", + "windows": { + "command": "msbuild" + }, + "args": [ + // Ask msbuild to generate full paths for file names. + "/property:GenerateFullPaths=true" + ], // Use the standard MS compiler pattern to detect errors, warnings and infos - "problemMatcher": "$msCompile" + "problemMatcher": "$msCompile", + "isBuildCommand": true } ] } \ No newline at end of file From 4ab4f65c83e04942f4865acabe7ce0c266d6152b Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Sun, 9 Apr 2017 16:26:31 +0300 Subject: [PATCH 079/442] Retry on Tilde key --- osu.Game/Screens/Play/Player.cs | 53 +++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 36ab1ab946..0af3dcecba 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -22,6 +22,10 @@ using System; using System.Linq; using osu.Framework.Threading; using osu.Game.Modes.Scoring; +using OpenTK.Input; +using osu.Framework.Audio.Sample; +using osu.Framework.Graphics.Sprites; +using OpenTK.Graphics; namespace osu.Game.Screens.Play { @@ -59,10 +63,16 @@ namespace osu.Game.Screens.Play private HudOverlay hudOverlay; private PauseOverlay pauseOverlay; private FailOverlay failOverlay; + private Box retryOverlay; + + private SampleChannel SampleClick; [BackgroundDependencyLoader] private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config) { + AlwaysPresent = true; + SampleClick = audio.Sample.Get(@"Menu/menuback"); + var beatmap = Beatmap.Beatmap; if (beatmap.BeatmapInfo?.Mode > PlayMode.Taiko) @@ -157,6 +167,13 @@ namespace osu.Game.Screens.Play { OnRetry = Restart, OnQuit = Exit, + }, + retryOverlay = new Box + { + Alpha = 0, + AlwaysPresent = true, + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, } }; } @@ -331,5 +348,41 @@ namespace osu.Game.Screens.Play private Bindable mouseWheelDisabled; protected override bool OnWheel(InputState state) => mouseWheelDisabled.Value && !IsPaused; + + private bool isHolded; + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + { + if (args.Repeat) return false; + + if (args.Key == Key.Tilde) + { + isHolded = true; + + retryOverlay.FadeIn(500); + + Delay(500).Schedule(() =>{ + if (isHolded) + { + SampleClick.Play(); + Restart(); + } + }); + return true; + } + + return base.OnKeyDown(state, args); + } + + protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) + { + if (args.Key == Key.Tilde) + { + isHolded = false; + retryOverlay.FadeOut(200); + return true; + } + + return base.OnKeyUp(state, args); + } } } \ No newline at end of file From 425e96c45cacbdbb07f6d60f4997f9a25014321c Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Sun, 9 Apr 2017 17:44:19 +0300 Subject: [PATCH 080/442] Moved logic to it's own class --- osu.Game/Screens/Play/Player.cs | 55 +++-------------------- osu.Game/Screens/Play/RetryOverlay.cs | 65 +++++++++++++++++++++++++++ osu.Game/osu.Game.csproj | 1 + 3 files changed, 71 insertions(+), 50 deletions(-) create mode 100644 osu.Game/Screens/Play/RetryOverlay.cs diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 0af3dcecba..3b67f8d6e6 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -22,9 +22,6 @@ using System; using System.Linq; using osu.Framework.Threading; using osu.Game.Modes.Scoring; -using OpenTK.Input; -using osu.Framework.Audio.Sample; -using osu.Framework.Graphics.Sprites; using OpenTK.Graphics; namespace osu.Game.Screens.Play @@ -63,16 +60,11 @@ namespace osu.Game.Screens.Play private HudOverlay hudOverlay; private PauseOverlay pauseOverlay; private FailOverlay failOverlay; - private Box retryOverlay; - - private SampleChannel SampleClick; + private RetryOverlay retryOverlay; [BackgroundDependencyLoader] private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config) { - AlwaysPresent = true; - SampleClick = audio.Sample.Get(@"Menu/menuback"); - var beatmap = Beatmap.Beatmap; if (beatmap.BeatmapInfo?.Mode > PlayMode.Taiko) @@ -168,12 +160,11 @@ namespace osu.Game.Screens.Play OnRetry = Restart, OnQuit = Exit, }, - retryOverlay = new Box + retryOverlay = new RetryOverlay { - Alpha = 0, - AlwaysPresent = true, - RelativeSizeAxes = Axes.Both, - Colour = Color4.Black, + Action = Restart, + OnKeyPressed = () => Content.FadeColour(Color4.Black, 500), + OnKeyReleased = () => Content.FadeColour(Color4.White, 200), } }; } @@ -348,41 +339,5 @@ namespace osu.Game.Screens.Play private Bindable mouseWheelDisabled; protected override bool OnWheel(InputState state) => mouseWheelDisabled.Value && !IsPaused; - - private bool isHolded; - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) - { - if (args.Repeat) return false; - - if (args.Key == Key.Tilde) - { - isHolded = true; - - retryOverlay.FadeIn(500); - - Delay(500).Schedule(() =>{ - if (isHolded) - { - SampleClick.Play(); - Restart(); - } - }); - return true; - } - - return base.OnKeyDown(state, args); - } - - protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) - { - if (args.Key == Key.Tilde) - { - isHolded = false; - retryOverlay.FadeOut(200); - return true; - } - - return base.OnKeyUp(state, args); - } } } \ No newline at end of file diff --git a/osu.Game/Screens/Play/RetryOverlay.cs b/osu.Game/Screens/Play/RetryOverlay.cs new file mode 100644 index 0000000000..e44f7d8914 --- /dev/null +++ b/osu.Game/Screens/Play/RetryOverlay.cs @@ -0,0 +1,65 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Input; +using OpenTK.Input; +using osu.Framework.Allocation; +using osu.Framework.Audio.Sample; +using osu.Framework.Audio; +using System; +using osu.Framework.Graphics.Containers; + +namespace osu.Game.Screens.Play +{ + public class RetryOverlay : Container + { + public Action Action; + public Action OnKeyPressed; + public Action OnKeyReleased; + + private SampleChannel retrySample; + private bool keyIsHeld; + + [BackgroundDependencyLoader] + private void load(AudioManager audio) + { + retrySample = audio.Sample.Get(@"Menu/menuback"); + AlwaysPresent = true; + } + + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + { + if (args.Repeat) return false; + + if (args.Key == Key.Tilde) + { + keyIsHeld = true; + OnKeyPressed(); + + Delay(500).Schedule(() => + { + if (keyIsHeld) + { + retrySample.Play(); + Action(); + } + }); + return true; + } + + return base.OnKeyDown(state, args); + } + + protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) + { + if (args.Key == Key.Tilde) + { + keyIsHeld = false; + OnKeyReleased(); + return true; + } + + return base.OnKeyUp(state, args); + } + } +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 6dd5ec3088..1777bf6dc2 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -180,6 +180,7 @@ + From a7264aa84cd86188379fd72e403172175e5094dc Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Sun, 9 Apr 2017 17:53:16 +0300 Subject: [PATCH 081/442] Warning fix --- osu.Game/Screens/Play/Player.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 3b67f8d6e6..af3da23231 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -60,7 +60,6 @@ namespace osu.Game.Screens.Play private HudOverlay hudOverlay; private PauseOverlay pauseOverlay; private FailOverlay failOverlay; - private RetryOverlay retryOverlay; [BackgroundDependencyLoader] private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config) @@ -160,7 +159,7 @@ namespace osu.Game.Screens.Play OnRetry = Restart, OnQuit = Exit, }, - retryOverlay = new RetryOverlay + new RetryOverlay { Action = Restart, OnKeyPressed = () => Content.FadeColour(Color4.Black, 500), From 1fe6b84dfc79827405cef05104303e4e5a0e287c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Apr 2017 01:24:50 +0900 Subject: [PATCH 082/442] Update with new input changes from framework. --- osu-framework | 2 +- osu.Game.Modes.Osu/OsuKeyConversionInputManager.cs | 8 ++++---- osu.Game/Modes/Replays/FramedReplayInputHandler.cs | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/osu-framework b/osu-framework index 45e75163b2..11b1c69d5f 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 45e75163b272b7aa023afec7801ea079aba4ee69 +Subproject commit 11b1c69d5ff2b212a69ee0bf5cc576a04e510044 diff --git a/osu.Game.Modes.Osu/OsuKeyConversionInputManager.cs b/osu.Game.Modes.Osu/OsuKeyConversionInputManager.cs index 986240b37f..567c7a35b1 100644 --- a/osu.Game.Modes.Osu/OsuKeyConversionInputManager.cs +++ b/osu.Game.Modes.Osu/OsuKeyConversionInputManager.cs @@ -42,14 +42,14 @@ namespace osu.Game.Modes.Osu { if (mouseDisabled.Value) { - mouse.PressedButtons.Remove(MouseButton.Left); - mouse.PressedButtons.Remove(MouseButton.Right); + mouse.SetPressed(MouseButton.Left, false); + mouse.SetPressed(MouseButton.Right, false); } if (leftViaKeyboard) - mouse.PressedButtons.Add(MouseButton.Left); + mouse.SetPressed(MouseButton.Left, true); if (rightViaKeyboard) - mouse.PressedButtons.Add(MouseButton.Right); + mouse.SetPressed(MouseButton.Right, true); } } } diff --git a/osu.Game/Modes/Replays/FramedReplayInputHandler.cs b/osu.Game/Modes/Replays/FramedReplayInputHandler.cs index ae20ece515..0c1e140ce4 100644 --- a/osu.Game/Modes/Replays/FramedReplayInputHandler.cs +++ b/osu.Game/Modes/Replays/FramedReplayInputHandler.cs @@ -136,7 +136,7 @@ namespace osu.Game.Modes.Replays public ReplayMouseState(Vector2 position, IEnumerable list) { Position = position; - list.ForEach(b => PressedButtons.Add(b)); + list.ForEach(b => SetPressed(b, true)); } } @@ -148,4 +148,4 @@ namespace osu.Game.Modes.Replays } } } -} \ No newline at end of file +} From c882b9bafd96f752433d0e596350cd58e6632559 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 10 Apr 2017 05:08:05 +0900 Subject: [PATCH 083/442] Make taiko playfield scale by height. --- .../Tests/TestCaseTaikoPlayfield.cs | 15 +++++++++++---- .../Objects/Drawables/DrawableDrumRoll.cs | 2 +- .../Drawables/DrawableTaikoHitObject.cs | 4 +++- osu.Game.Modes.Taiko/UI/HitTarget.cs | 6 +++--- osu.Game.Modes.Taiko/UI/InputDrum.cs | 2 +- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 18 +++++++++++++----- 6 files changed, 32 insertions(+), 15 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 88a037afee..a942535d06 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -61,17 +61,24 @@ namespace osu.Desktop.VisualTests.Tests { TaikoHitResult hitResult = RNG.Next(2) == 0 ? TaikoHitResult.Good : TaikoHitResult.Great; - playfield.OnJudgement(new DrawableTestHit(new Hit()) + var h = new DrawableTestHit(new Hit()) { X = RNG.NextSingle(hitResult == TaikoHitResult.Good ? -0.1f : -0.05f, hitResult == TaikoHitResult.Good ? 0.1f : 0.05f), Judgement = new TaikoJudgement { Result = HitResult.Hit, TaikoResult = hitResult, - TimeOffset = 0, - SecondHit = RNG.Next(10) == 0 + TimeOffset = 0 } - }); + }; + + playfield.OnJudgement(h); + + if (RNG.Next(10) == 0) + { + h.Judgement.SecondHit = true; + playfield.OnJudgement(h); + } } private void addMissJudgement() diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs index 0a0098dd34..695717ce9e 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs @@ -49,7 +49,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables protected override TaikoPiece CreateMainPiece() => new ElongatedCirclePiece(HitObject.IsStrong) { Length = (float)(HitObject.Duration / HitObject.ScrollTime), - PlayfieldLengthReference = () => Parent.DrawSize.X + PlayfieldLengthReference = () => Parent.DrawSize.X / DrawScale.X }; [BackgroundDependencyLoader] diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs index f15f2bd152..7cd9f9baa5 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs @@ -22,7 +22,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables /// private readonly List validKeys = new List(new[] { Key.D, Key.F, Key.J, Key.K }); - public override Vector2 OriginPosition => new Vector2(DrawHeight / 2); + public override Vector2 OriginPosition => new Vector2(bodyContainer.DrawHeight / 2f, DrawHeight / 2f); protected override Container Content => bodyContainer; @@ -46,6 +46,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables AddInternal(bodyContainer = new Container { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, AutoSizeAxes = Axes.Both, Children = new[] { diff --git a/osu.Game.Modes.Taiko/UI/HitTarget.cs b/osu.Game.Modes.Taiko/UI/HitTarget.cs index a17480628d..f5d6a3b797 100644 --- a/osu.Game.Modes.Taiko/UI/HitTarget.cs +++ b/osu.Game.Modes.Taiko/UI/HitTarget.cs @@ -37,7 +37,7 @@ namespace osu.Game.Modes.Taiko.UI public HitTarget() { - RelativeSizeAxes = Axes.Y; + Size = new Vector2(TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT); Children = new Drawable[] { @@ -47,7 +47,7 @@ namespace osu.Game.Modes.Taiko.UI Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Y = border_offset, - Size = new Vector2(border_thickness, (TaikoPlayfield.PLAYFIELD_HEIGHT - strong_hit_diameter) / 2f - border_offset), + Size = new Vector2(border_thickness, (TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT - strong_hit_diameter) / 2f - border_offset), Alpha = 0.1f }, new CircularContainer @@ -96,7 +96,7 @@ namespace osu.Game.Modes.Taiko.UI Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Y = -border_offset, - Size = new Vector2(border_thickness, (TaikoPlayfield.PLAYFIELD_HEIGHT - strong_hit_diameter) / 2f - border_offset), + Size = new Vector2(border_thickness, (TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT - strong_hit_diameter) / 2f - border_offset), Alpha = 0.1f }, }; diff --git a/osu.Game.Modes.Taiko/UI/InputDrum.cs b/osu.Game.Modes.Taiko/UI/InputDrum.cs index 0c1e1105cb..d238c38e74 100644 --- a/osu.Game.Modes.Taiko/UI/InputDrum.cs +++ b/osu.Game.Modes.Taiko/UI/InputDrum.cs @@ -21,7 +21,7 @@ namespace osu.Game.Modes.Taiko.UI { public InputDrum() { - Size = new Vector2(TaikoPlayfield.PLAYFIELD_HEIGHT); + Size = new Vector2(TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT); const float middle_split = 10; diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index 9e7eb571a1..0407cbc5fd 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -25,7 +25,7 @@ namespace osu.Game.Modes.Taiko.UI /// The play field height. This is relative to the size of hit objects /// such that the playfield is just a bit larger than strong hits. /// - public const float PLAYFIELD_HEIGHT = TaikoHitObject.CIRCLE_RADIUS * 2 * 2; + public const float DEFAULT_PLAYFIELD_HEIGHT = TaikoHitObject.CIRCLE_RADIUS * 2 * 2; /// /// The offset from which the center of the hit target lies at. @@ -53,7 +53,7 @@ namespace osu.Game.Modes.Taiko.UI public TaikoPlayfield() { RelativeSizeAxes = Axes.X; - Height = PLAYFIELD_HEIGHT; + Height = DEFAULT_PLAYFIELD_HEIGHT; AddInternal(new Drawable[] { @@ -93,7 +93,8 @@ namespace osu.Game.Modes.Taiko.UI { Anchor = Anchor.CentreLeft, Origin = Anchor.Centre, - Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2), + Size = new Vector2(DEFAULT_PLAYFIELD_HEIGHT), + FillMode = FillMode.Fit, BlendingMode = BlendingMode.Additive }, barLineContainer = new Container @@ -104,6 +105,7 @@ namespace osu.Game.Modes.Taiko.UI { Anchor = Anchor.CentreLeft, Origin = Anchor.Centre, + FillMode = FillMode.Fit }, hitObjectContainer = new Container { @@ -111,7 +113,8 @@ namespace osu.Game.Modes.Taiko.UI }, judgementContainer = new Container { - RelativeSizeAxes = Axes.Both, + Size = new Vector2(DEFAULT_PLAYFIELD_HEIGHT), + FillMode = FillMode.Fit, BlendingMode = BlendingMode.Additive }, }, @@ -120,7 +123,8 @@ namespace osu.Game.Modes.Taiko.UI }, leftBackgroundContainer = new Container { - Size = new Vector2(left_area_size, PLAYFIELD_HEIGHT), + RelativeSizeAxes = Axes.Y, + Width = left_area_size, BorderThickness = 1, Children = new Drawable[] { @@ -134,6 +138,7 @@ namespace osu.Game.Modes.Taiko.UI Origin = Anchor.Centre, RelativePositionAxes = Axes.X, Position = new Vector2(0.10f, 0), + FillMode = FillMode.Fit, Scale = new Vector2(0.9f) }, new Box @@ -164,6 +169,9 @@ namespace osu.Game.Modes.Taiko.UI public override void Add(DrawableHitObject h) { + h.AutoSizeAxes = h.AutoSizeAxes & ~Axes.Y; + h.Height = DEFAULT_PLAYFIELD_HEIGHT; + h.FillMode = FillMode.Fit; h.Depth = (float)h.HitObject.StartTime; base.Add(h); From 88666c865f3e673500c19f6e11cb61918f9a7997 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 10 Apr 2017 09:23:00 +0900 Subject: [PATCH 084/442] Make hit objects default size relative to play field size, not the other way around. --- .../Objects/Drawables/DrawableSwell.cs | 4 ++-- .../Objects/Drawables/Pieces/CirclePiece.cs | 11 +++------- .../Objects/Drawables/Pieces/TaikoPiece.cs | 2 +- .../Objects/Drawables/Pieces/TickPiece.cs | 4 ++-- .../Objects/TaikoHitObject.cs | 20 +++++++++++++++++-- osu.Game.Modes.Taiko/UI/HitExplosion.cs | 9 ++------- osu.Game.Modes.Taiko/UI/HitTarget.cs | 18 ++++------------- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 4 ++-- 8 files changed, 34 insertions(+), 38 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableSwell.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableSwell.cs index e1a590a025..1e440df69a 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableSwell.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableSwell.cs @@ -65,7 +65,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables Anchor = Anchor.Centre, Origin = Anchor.Centre, Alpha = 0, - Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2), + Size = new Vector2(TaikoHitObject.DEFAULT_CIRCLE_DIAMETER), BlendingMode = BlendingMode.Additive, Masking = true, Children = new [] @@ -82,7 +82,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables Name = "Target ring (thick border)", Anchor = Anchor.Centre, Origin = Anchor.Centre, - Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2), + Size = new Vector2(TaikoHitObject.DEFAULT_CIRCLE_DIAMETER), Masking = true, BorderThickness = target_ring_thick_border, BlendingMode = BlendingMode.Additive, diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CirclePiece.cs index f921511e22..216e05ebc4 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CirclePiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CirclePiece.cs @@ -19,15 +19,10 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces /// public class CirclePiece : TaikoPiece { - public const float SYMBOL_SIZE = TaikoHitObject.CIRCLE_RADIUS * 2f * 0.45f; + public const float SYMBOL_SIZE = TaikoHitObject.DEFAULT_CIRCLE_DIAMETER * 0.45f; public const float SYMBOL_BORDER = 8; public const float SYMBOL_INNER_SIZE = SYMBOL_SIZE - 2 * SYMBOL_BORDER; - /// - /// The amount to scale up the base circle to show it as a "strong" piece. - /// - private const float strong_scale = 1.5f; - /// /// The colour of the inner circle and outer glows. /// @@ -129,10 +124,10 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces if (isStrong) { - Size *= strong_scale; + Size *= TaikoHitObject.STRONG_CIRCLE_DIAMETER_SCALE; //default for symbols etc. - Content.Scale *= strong_scale; + Content.Scale *= TaikoHitObject.STRONG_CIRCLE_DIAMETER_SCALE; } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs index a0c8865c59..2220438a4a 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs @@ -39,7 +39,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces public TaikoPiece() { //just a default - Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2); + Size = new Vector2(TaikoHitObject.DEFAULT_CIRCLE_DIAMETER); } } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/TickPiece.cs b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/TickPiece.cs index 697102eb22..53e795e2e2 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/TickPiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/TickPiece.cs @@ -15,12 +15,12 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces /// Any tick that is not the first for a drumroll is not filled, but is instead displayed /// as a hollow circle. This is what controls the border width of that circle. /// - private const float tick_border_width = TaikoHitObject.CIRCLE_RADIUS / 2 / 4; + private const float tick_border_width = TaikoHitObject.DEFAULT_CIRCLE_DIAMETER / 16; /// /// The size of a tick. /// - private const float tick_size = TaikoHitObject.CIRCLE_RADIUS / 2; + private const float tick_size = TaikoHitObject.DEFAULT_CIRCLE_DIAMETER / 4; private bool filled; public bool Filled diff --git a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs index 54ab8c5300..ebc9b19d3a 100644 --- a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs @@ -4,15 +4,31 @@ using osu.Game.Beatmaps.Timing; using osu.Game.Database; using osu.Game.Modes.Objects; +using osu.Game.Modes.Taiko.UI; namespace osu.Game.Modes.Taiko.Objects { public abstract class TaikoHitObject : HitObject { /// - /// HitCircle radius. + /// Diameter of a circle relative to the size of the . /// - public const float CIRCLE_RADIUS = 42f; + public const float PLAYFIELD_RELATIVE_DIAMETER = 0.5f; + + /// + /// Scale multiplier for a strong circle. + /// + public const float STRONG_CIRCLE_DIAMETER_SCALE = 1.5f; + + /// + /// Default circle diameter. + /// + public const float DEFAULT_CIRCLE_DIAMETER = TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT * PLAYFIELD_RELATIVE_DIAMETER; + + /// + /// Default strong circle diameter. + /// + public const float DEFAULT_STRONG_CIRCLE_DIAMETER = DEFAULT_CIRCLE_DIAMETER * STRONG_CIRCLE_DIAMETER_SCALE; /// /// The time taken from the initial (off-screen) spawn position to the centre of the hit target for a of 1000ms. diff --git a/osu.Game.Modes.Taiko/UI/HitExplosion.cs b/osu.Game.Modes.Taiko/UI/HitExplosion.cs index eb43c1a5d0..e4e329523f 100644 --- a/osu.Game.Modes.Taiko/UI/HitExplosion.cs +++ b/osu.Game.Modes.Taiko/UI/HitExplosion.cs @@ -18,11 +18,6 @@ namespace osu.Game.Modes.Taiko.UI /// internal class HitExplosion : CircularContainer { - /// - /// The size multiplier of a hit explosion if a hit object has been hit with the second key. - /// - private const float secondhit_size_multiplier = 1.5f; - /// /// The judgement this hit explosion visualises. /// @@ -34,7 +29,7 @@ namespace osu.Game.Modes.Taiko.UI { Judgement = judgement; - Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2); + Size = new Vector2(TaikoHitObject.DEFAULT_CIRCLE_DIAMETER); Anchor = Anchor.Centre; Origin = Anchor.Centre; @@ -85,7 +80,7 @@ namespace osu.Game.Modes.Taiko.UI /// public void VisualiseSecondHit() { - ResizeTo(Size * secondhit_size_multiplier, 50); + ResizeTo(Size * TaikoHitObject.STRONG_CIRCLE_DIAMETER_SCALE, 50); } } } diff --git a/osu.Game.Modes.Taiko/UI/HitTarget.cs b/osu.Game.Modes.Taiko/UI/HitTarget.cs index f5d6a3b797..b22dc1d647 100644 --- a/osu.Game.Modes.Taiko/UI/HitTarget.cs +++ b/osu.Game.Modes.Taiko/UI/HitTarget.cs @@ -15,16 +15,6 @@ namespace osu.Game.Modes.Taiko.UI /// internal class HitTarget : Container { - /// - /// Diameter of normal hit object circles. - /// - private const float normal_diameter = TaikoHitObject.CIRCLE_RADIUS * 2; - - /// - /// Diameter of strong hit object circles. - /// - private const float strong_hit_diameter = normal_diameter * 1.5f; - /// /// The 1px inner border of the taiko playfield. /// @@ -47,7 +37,7 @@ namespace osu.Game.Modes.Taiko.UI Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Y = border_offset, - Size = new Vector2(border_thickness, (TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT - strong_hit_diameter) / 2f - border_offset), + Size = new Vector2(border_thickness, (TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT - TaikoHitObject.DEFAULT_STRONG_CIRCLE_DIAMETER) / 2f - border_offset), Alpha = 0.1f }, new CircularContainer @@ -55,7 +45,7 @@ namespace osu.Game.Modes.Taiko.UI Name = "Strong Hit Ring", Anchor = Anchor.Centre, Origin = Anchor.Centre, - Size = new Vector2(strong_hit_diameter), + Size = new Vector2(TaikoHitObject.DEFAULT_STRONG_CIRCLE_DIAMETER), Masking = true, BorderColour = Color4.White, BorderThickness = border_thickness, @@ -75,7 +65,7 @@ namespace osu.Game.Modes.Taiko.UI Name = "Normal Hit Ring", Anchor = Anchor.Centre, Origin = Anchor.Centre, - Size = new Vector2(normal_diameter), + Size = new Vector2(TaikoHitObject.DEFAULT_CIRCLE_DIAMETER), Masking = true, BorderColour = Color4.White, BorderThickness = border_thickness, @@ -96,7 +86,7 @@ namespace osu.Game.Modes.Taiko.UI Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Y = -border_offset, - Size = new Vector2(border_thickness, (TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT - strong_hit_diameter) / 2f - border_offset), + Size = new Vector2(border_thickness, (TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT - TaikoHitObject.DEFAULT_STRONG_CIRCLE_DIAMETER) / 2f - border_offset), Alpha = 0.1f }, }; diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index 0407cbc5fd..ad21f22d1e 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -25,12 +25,12 @@ namespace osu.Game.Modes.Taiko.UI /// The play field height. This is relative to the size of hit objects /// such that the playfield is just a bit larger than strong hits. /// - public const float DEFAULT_PLAYFIELD_HEIGHT = TaikoHitObject.CIRCLE_RADIUS * 2 * 2; + public const float DEFAULT_PLAYFIELD_HEIGHT = 168f; /// /// The offset from which the center of the hit target lies at. /// - private const float hit_target_offset = TaikoHitObject.CIRCLE_RADIUS * 1.5f + 40; + private const float hit_target_offset = TaikoHitObject.DEFAULT_STRONG_CIRCLE_DIAMETER / 2f + 40; /// /// The size of the left area of the playfield. This area contains the input drum. From e95c7dfa3731ccab60a4fd9b9ec312a4dd72f4a2 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 10 Apr 2017 09:33:46 +0900 Subject: [PATCH 085/442] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 45e75163b2..3d74f40e52 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 45e75163b272b7aa023afec7801ea079aba4ee69 +Subproject commit 3d74f40e524adac263ead7437894a7b11fbf5a20 From 39adb609526d7cfb010743b19e91a98052da8662 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 10 Apr 2017 10:16:07 +0900 Subject: [PATCH 086/442] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 11b1c69d5f..7ac3dbff36 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 11b1c69d5ff2b212a69ee0bf5cc576a04e510044 +Subproject commit 7ac3dbff3615fb410da1e330e6379b53a41292b6 From 05ac73edcb18241c7822a941deba83388d875aae Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 10 Apr 2017 10:33:52 +0900 Subject: [PATCH 087/442] Apply width modification to hit object container instead of hit objects, to preserve original size. --- osu-framework | 2 +- .../Drawables/DrawableTaikoHitObject.cs | 4 +--- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 23 +++++++++++++++---- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/osu-framework b/osu-framework index 3d74f40e52..49775b9d5e 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 3d74f40e524adac263ead7437894a7b11fbf5a20 +Subproject commit 49775b9d5e7a383d78ef1018532040823fe18e76 diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs index 7cd9f9baa5..13ea09aab0 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs @@ -22,7 +22,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables /// private readonly List validKeys = new List(new[] { Key.D, Key.F, Key.J, Key.K }); - public override Vector2 OriginPosition => new Vector2(bodyContainer.DrawHeight / 2f, DrawHeight / 2f); + public override Vector2 OriginPosition => new Vector2(DrawHeight / 2f); protected override Container Content => bodyContainer; @@ -46,8 +46,6 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables AddInternal(bodyContainer = new Container { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, AutoSizeAxes = Axes.Both, Children = new[] { diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index ad21f22d1e..0056592447 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -107,9 +107,10 @@ namespace osu.Game.Modes.Taiko.UI Origin = Anchor.Centre, FillMode = FillMode.Fit }, - hitObjectContainer = new Container + hitObjectContainer = new HitObjectContainer { - RelativeSizeAxes = Axes.Both, + Height = DEFAULT_PLAYFIELD_HEIGHT, + FillMode = FillMode.Fit }, judgementContainer = new Container { @@ -169,9 +170,6 @@ namespace osu.Game.Modes.Taiko.UI public override void Add(DrawableHitObject h) { - h.AutoSizeAxes = h.AutoSizeAxes & ~Axes.Y; - h.Height = DEFAULT_PLAYFIELD_HEIGHT; - h.FillMode = FillMode.Fit; h.Depth = (float)h.HitObject.StartTime; base.Add(h); @@ -216,5 +214,20 @@ namespace osu.Game.Modes.Taiko.UI else hitExplosionContainer.Children.FirstOrDefault(e => e.Judgement == judgedObject.Judgement)?.VisualiseSecondHit(); } + + private class HitObjectContainer : Container + { + public HitObjectContainer() + { + RelativeSizeAxes = Axes.X; + } + + protected override void Update() + { + base.Update(); + + Width = 1 / DrawScale.X; + } + } } } \ No newline at end of file From 30b5b6f7e2bcb0d018ea744b555df9178dfd3045 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 10 Apr 2017 11:54:01 +0900 Subject: [PATCH 088/442] General cleanup. --- osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs | 2 +- .../Objects/Drawables/DrawableTaikoHitObject.cs | 2 +- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs index 695717ce9e..0a0098dd34 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs @@ -49,7 +49,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables protected override TaikoPiece CreateMainPiece() => new ElongatedCirclePiece(HitObject.IsStrong) { Length = (float)(HitObject.Duration / HitObject.ScrollTime), - PlayfieldLengthReference = () => Parent.DrawSize.X / DrawScale.X + PlayfieldLengthReference = () => Parent.DrawSize.X }; [BackgroundDependencyLoader] diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs index 13ea09aab0..f15f2bd152 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs @@ -22,7 +22,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables /// private readonly List validKeys = new List(new[] { Key.D, Key.F, Key.J, Key.K }); - public override Vector2 OriginPosition => new Vector2(DrawHeight / 2f); + public override Vector2 OriginPosition => new Vector2(DrawHeight / 2); protected override Container Content => bodyContainer; diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index 0056592447..4cbae2c3aa 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -215,6 +215,9 @@ namespace osu.Game.Modes.Taiko.UI hitExplosionContainer.Children.FirstOrDefault(e => e.Judgement == judgedObject.Judgement)?.VisualiseSecondHit(); } + /// + /// Container for hit objects. Locks width to parent width even through scale. + /// private class HitObjectContainer : Container { public HitObjectContainer() From e73f543c4f02a140418da3b1e5bb517aafca2190 Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Mon, 10 Apr 2017 06:06:10 +0300 Subject: [PATCH 089/442] Applied suggestions --- ...{RetryOverlay.cs => HotkeyRetryOverlay.cs} | 45 ++++++++++++------- osu.Game/Screens/Play/Player.cs | 4 +- osu.Game/osu.Game.csproj | 2 +- 3 files changed, 32 insertions(+), 19 deletions(-) rename osu.Game/Screens/Play/{RetryOverlay.cs => HotkeyRetryOverlay.cs} (53%) diff --git a/osu.Game/Screens/Play/RetryOverlay.cs b/osu.Game/Screens/Play/HotkeyRetryOverlay.cs similarity index 53% rename from osu.Game/Screens/Play/RetryOverlay.cs rename to osu.Game/Screens/Play/HotkeyRetryOverlay.cs index e44f7d8914..4e383510fc 100644 --- a/osu.Game/Screens/Play/RetryOverlay.cs +++ b/osu.Game/Screens/Play/HotkeyRetryOverlay.cs @@ -8,23 +8,41 @@ using osu.Framework.Audio.Sample; using osu.Framework.Audio; using System; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Sprites; +using OpenTK.Graphics; +using osu.Framework.Threading; namespace osu.Game.Screens.Play { - public class RetryOverlay : Container + public class HotkeyRetryOverlay : Container { public Action Action; - public Action OnKeyPressed; - public Action OnKeyReleased; private SampleChannel retrySample; - private bool keyIsHeld; + private ScheduledDelegate task; + private Box overlay; + + private const int activate_delay = 500; + private const int fadeout_delay = 200; [BackgroundDependencyLoader] private void load(AudioManager audio) { retrySample = audio.Sample.Get(@"Menu/menuback"); + RelativeSizeAxes = Axes.Both; AlwaysPresent = true; + + Children = new Drawable[] + { + overlay = new Box + { + Alpha = 0, + AlwaysPresent = true, + Colour = Color4.Black, + RelativeSizeAxes = Axes.Both, + } + }; } protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) @@ -33,17 +51,14 @@ namespace osu.Game.Screens.Play if (args.Key == Key.Tilde) { - keyIsHeld = true; - OnKeyPressed(); + overlay.FadeIn(activate_delay); - Delay(500).Schedule(() => + task = Scheduler.AddDelayed(() => { - if (keyIsHeld) - { - retrySample.Play(); - Action(); - } - }); + retrySample.Play(); + Action(); + }, activate_delay); + return true; } @@ -54,8 +69,8 @@ namespace osu.Game.Screens.Play { if (args.Key == Key.Tilde) { - keyIsHeld = false; - OnKeyReleased(); + task?.Cancel(); + overlay.FadeOut(fadeout_delay); return true; } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index af3da23231..939895654b 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -159,11 +159,9 @@ namespace osu.Game.Screens.Play OnRetry = Restart, OnQuit = Exit, }, - new RetryOverlay + new HotkeyRetryOverlay { Action = Restart, - OnKeyPressed = () => Content.FadeColour(Color4.Black, 500), - OnKeyReleased = () => Content.FadeColour(Color4.White, 200), } }; } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 1777bf6dc2..d90fdda41a 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -180,7 +180,7 @@ - + From 1879a05c7beb31f1a3b69bb0234c47fa0235624e Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Mon, 10 Apr 2017 06:10:12 +0300 Subject: [PATCH 090/442] Removed using --- osu.Game/Screens/Play/Player.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 939895654b..a7108eda1b 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -22,7 +22,6 @@ using System; using System.Linq; using osu.Framework.Threading; using osu.Game.Modes.Scoring; -using OpenTK.Graphics; namespace osu.Game.Screens.Play { From d6f388f8fde4e18a2137d3b0426061a29652593b Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 10 Apr 2017 14:28:01 +0900 Subject: [PATCH 091/442] Add better scale adjustements to TaikoPlayfield. It will now keep the original width while scaling everything inside to match the playfield height. --- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 168 ++++++++++++++-------- 1 file changed, 105 insertions(+), 63 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index 4cbae2c3aa..6fe2282d88 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -16,14 +16,14 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics.Primitives; using System.Linq; using osu.Game.Modes.Taiko.Objects.Drawables; +using System; namespace osu.Game.Modes.Taiko.UI { public class TaikoPlayfield : Playfield { /// - /// The play field height. This is relative to the size of hit objects - /// such that the playfield is just a bit larger than strong hits. + /// The default play field height. /// public const float DEFAULT_PLAYFIELD_HEIGHT = 168f; @@ -53,12 +53,15 @@ namespace osu.Game.Modes.Taiko.UI public TaikoPlayfield() { RelativeSizeAxes = Axes.X; + + // Default height Height = DEFAULT_PLAYFIELD_HEIGHT; AddInternal(new Drawable[] { rightBackgroundContainer = new Container { + Name = "Transparent playfield background", RelativeSizeAxes = Axes.Both, BorderThickness = 2, Masking = true, @@ -77,82 +80,88 @@ namespace osu.Game.Modes.Taiko.UI }, } }, - new Container + new ScaleFixContainer { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Left = left_area_size }, - Children = new Drawable[] + RelativeSizeAxes = Axes.X, + Height = DEFAULT_PLAYFIELD_HEIGHT, + Children = new[] { new Container { - X = hit_target_offset, + Name = "Transparent playfield elements", RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Left = left_area_size }, Children = new Drawable[] { - hitExplosionContainer = new Container + new Container { - Anchor = Anchor.CentreLeft, - Origin = Anchor.Centre, - Size = new Vector2(DEFAULT_PLAYFIELD_HEIGHT), - FillMode = FillMode.Fit, - BlendingMode = BlendingMode.Additive + Name = "Hit target container", + X = hit_target_offset, + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + hitExplosionContainer = new Container + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Y, + BlendingMode = BlendingMode.Additive + }, + barLineContainer = new Container + { + RelativeSizeAxes = Axes.Both, + }, + new HitTarget + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.Centre, + }, + hitObjectContainer = new Container + { + RelativeSizeAxes = Axes.Both, + }, + judgementContainer = new Container + { + RelativeSizeAxes = Axes.Y, + BlendingMode = BlendingMode.Additive + }, + }, }, - barLineContainer = new Container + } + }, + leftBackgroundContainer = new Container + { + Name = "Left overlay", + Size = new Vector2(left_area_size, DEFAULT_PLAYFIELD_HEIGHT), + BorderThickness = 1, + Children = new Drawable[] + { + leftBackground = new Box { RelativeSizeAxes = Axes.Both, }, - new HitTarget + new InputDrum { - Anchor = Anchor.CentreLeft, + Anchor = Anchor.Centre, Origin = Anchor.Centre, - FillMode = FillMode.Fit + RelativePositionAxes = Axes.X, + Position = new Vector2(0.10f, 0), + Scale = new Vector2(0.9f) }, - hitObjectContainer = new HitObjectContainer + new Box { - Height = DEFAULT_PLAYFIELD_HEIGHT, - FillMode = FillMode.Fit + Anchor = Anchor.TopRight, + RelativeSizeAxes = Axes.Y, + Width = 10, + ColourInfo = Framework.Graphics.Colour.ColourInfo.GradientHorizontal(Color4.Black.Opacity(0.6f), Color4.Black.Opacity(0)), }, - judgementContainer = new Container - { - Size = new Vector2(DEFAULT_PLAYFIELD_HEIGHT), - FillMode = FillMode.Fit, - BlendingMode = BlendingMode.Additive - }, - }, - }, - } - }, - leftBackgroundContainer = new Container - { - RelativeSizeAxes = Axes.Y, - Width = left_area_size, - BorderThickness = 1, - Children = new Drawable[] - { - leftBackground = new Box - { - RelativeSizeAxes = Axes.Both, - }, - new InputDrum - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativePositionAxes = Axes.X, - Position = new Vector2(0.10f, 0), - FillMode = FillMode.Fit, - Scale = new Vector2(0.9f) - }, - new Box - { - Anchor = Anchor.TopRight, - RelativeSizeAxes = Axes.Y, - Width = 10, - ColourInfo = Framework.Graphics.Colour.ColourInfo.GradientHorizontal(Color4.Black.Opacity(0.6f), Color4.Black.Opacity(0)), + } }, } }, topLevelHitContainer = new Container { + Name = "Top level hit objects", RelativeSizeAxes = Axes.Both, } }); @@ -216,20 +225,53 @@ namespace osu.Game.Modes.Taiko.UI } /// - /// Container for hit objects. Locks width to parent width even through scale. + /// This is a very special type of container. It serves a similar purpose to , however unlike , + /// this will only adjust the scale relative to the height of its parent and will maintain the original width relative to its parent. + /// + /// + /// By adjusting the scale relative to the height of its parent, the aspect ratio of this container's children is maintained, however this is undesirable + /// in the case where the hit object container should not have its width adjusted by scale. To counteract this, another container is nested inside this + /// container which takes care of reversing the width adjustment while appearing transparent to the user. + /// /// - private class HitObjectContainer : Container + private class ScaleFixContainer : Container { - public HitObjectContainer() + protected override Container Content => widthAdjustmentContainer; + private readonly WidthAdjustmentContainer widthAdjustmentContainer; + + /// + /// We only want to apply DrawScale in the Y-axis to preserve aspect ratio and doesn't care about having its width adjusted. + /// + protected override Vector2 DrawScale => Scale * RelativeToAbsoluteFactor.Y / DrawHeight; + + public ScaleFixContainer() { - RelativeSizeAxes = Axes.X; + AddInternal(widthAdjustmentContainer = new WidthAdjustmentContainer { ParentDrawScaleReference = () => DrawScale.X }); } - protected override void Update() + /// + /// The container type that reverses the width adjustment. + /// + private class WidthAdjustmentContainer : Container { - base.Update(); + /// + /// This container needs to know its parent's so it can reverse the width adjustment caused by . + /// + public Func ParentDrawScaleReference; - Width = 1 / DrawScale.X; + public WidthAdjustmentContainer() + { + // This container doesn't care about height, it should always fill its parent + RelativeSizeAxes = Axes.Y; + } + + protected override void Update() + { + base.Update(); + + // Reverse the DrawScale adjustment + Width = Parent.DrawSize.X / ParentDrawScaleReference(); + } } } } From f4094fbde244901d1e4e159f8bf63831e1901bb2 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 10 Apr 2017 14:28:28 +0900 Subject: [PATCH 092/442] Extend TestCaseTaikoPlayfield a bit. --- .../Tests/TestCaseTaikoPlayfield.cs | 43 ++++++++++++++++--- 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index a942535d06..a8e4382ebb 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.MathUtils; @@ -11,20 +12,21 @@ using osu.Game.Modes.Taiko.Judgements; using osu.Game.Modes.Taiko.Objects; using osu.Game.Modes.Taiko.Objects.Drawables; using osu.Game.Modes.Taiko.UI; +using System; namespace osu.Desktop.VisualTests.Tests { internal class TestCaseTaikoPlayfield : TestCase { - public override string Description => "Taiko playfield"; + private const double default_duration = 300; + private const float scroll_time = 1000; - private TaikoPlayfield playfield; + public override string Description => "Taiko playfield"; protected override double TimePerAction => default_duration * 2; - private const double default_duration = 300; - - private const float scroll_time = 1000; + private readonly Random rng = new Random(1337); + private TaikoPlayfield playfield; public override void Reset() { @@ -41,7 +43,11 @@ namespace osu.Desktop.VisualTests.Tests AddStep("Strong Rim", () => addRimHit(true)); AddStep("Add bar line", () => addBarLine(false)); AddStep("Add major bar line", () => addBarLine(true)); - + AddStep("Height test 1", () => changePlayfieldSize(1)); + AddStep("Height test 2", () => changePlayfieldSize(2)); + AddStep("Height test 3", () => changePlayfieldSize(3)); + AddStep("Height test 4", () => changePlayfieldSize(4)); + AddStep("Height test 5", () => changePlayfieldSize(5)); var rateAdjustClock = new StopwatchClock(true) { Rate = 1 }; @@ -57,6 +63,31 @@ namespace osu.Desktop.VisualTests.Tests }); } + private void changePlayfieldSize(int step) + { + switch (step) + { + case 1: + addCentreHit(false); + break; + case 2: + addCentreHit(true); + break; + case 3: + addDrumRoll(false); + break; + case 4: + addDrumRoll(true); + break; + case 5: + addSwell(1000); + playfield.Delay(scroll_time - 100); + break; + } + + playfield.ResizeTo(new Vector2(1, rng.Next(25, 400)), 500); + } + private void addHitJudgement() { TaikoHitResult hitResult = RNG.Next(2) == 0 ? TaikoHitResult.Good : TaikoHitResult.Great; From b57351f6e301cd0a66c3ddc7905c38e3a49671c3 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 10 Apr 2017 14:43:13 +0900 Subject: [PATCH 093/442] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 49775b9d5e..7ac3dbff36 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 49775b9d5e7a383d78ef1018532040823fe18e76 +Subproject commit 7ac3dbff3615fb410da1e330e6379b53a41292b6 From bb4a909de5d912971aaad86a71d53cbdc0ed74de Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Apr 2017 14:31:08 +0900 Subject: [PATCH 094/442] Update UI control access in line with framework changes. --- osu-framework | 2 +- .../Tests/TestCaseTabControl.cs | 2 +- osu.Game/Graphics/UserInterface/Nub.cs | 40 +++++++--------- .../Graphics/UserInterface/OsuCheckbox.cs | 47 ++++--------------- .../Graphics/UserInterface/OsuDropdown.cs | 2 +- .../Graphics/UserInterface/OsuSliderBar.cs | 5 +- .../UserInterface/OsuTabControlCheckbox.cs | 35 +++++++------- osu.Game/Overlays/Options/OptionDropdown.cs | 2 +- osu.Game/Overlays/Options/OptionTextBox.cs | 30 +----------- .../Select/BeatmapDetailAreaTabControl.cs | 9 ++-- osu.Game/Screens/Select/FilterControl.cs | 11 ++--- 11 files changed, 58 insertions(+), 127 deletions(-) diff --git a/osu-framework b/osu-framework index 7ac3dbff36..bbfd0fc7a8 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 7ac3dbff3615fb410da1e330e6379b53a41292b6 +Subproject commit bbfd0fc7a8f5293a0f853f51040b40808abbb459 diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs b/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs index 2d3969b822..b72abd1992 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs @@ -36,7 +36,7 @@ namespace osu.Desktop.VisualTests.Tests filter.PinItem(GroupMode.All); filter.PinItem(GroupMode.RecentlyPlayed); - filter.SelectedItem.ValueChanged += newFilter => + filter.Current.ValueChanged += newFilter => { text.Text = "Currently Selected: " + newFilter.ToString(); }; diff --git a/osu.Game/Graphics/UserInterface/Nub.cs b/osu.Game/Graphics/UserInterface/Nub.cs index e150c7dc07..a5a4fab3e1 100644 --- a/osu.Game/Graphics/UserInterface/Nub.cs +++ b/osu.Game/Graphics/UserInterface/Nub.cs @@ -3,8 +3,8 @@ using OpenTK; using OpenTK.Graphics; -using osu.Framework; using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; @@ -12,18 +12,18 @@ using osu.Framework.Graphics.UserInterface; namespace osu.Game.Graphics.UserInterface { - public class Nub : CircularContainer, IStateful + public class Nub : CircularContainer, IHasCurrentValue { public const float COLLAPSED_SIZE = 20; public const float EXPANDED_SIZE = 40; - private readonly Box fill; - private const float border_width = 3; private Color4 glowingColour, idleColour; public Nub() { + Box fill; + Size = new Vector2(COLLAPSED_SIZE, 12); BorderColour = Color4.White; @@ -40,6 +40,14 @@ namespace osu.Game.Graphics.UserInterface AlwaysPresent = true, }, }; + + Current.ValueChanged += newValue => + { + if (newValue) + fill.FadeIn(200, EasingTypes.OutQuint); + else + fill.FadeTo(0.01f, 200, EasingTypes.OutQuint); //todo: remove once we figure why containers aren't drawing at all times + }; } [BackgroundDependencyLoader] @@ -84,28 +92,12 @@ namespace osu.Game.Graphics.UserInterface } } - private CheckboxState state; + private readonly Bindable current = new Bindable(); - public CheckboxState State + public Bindable Current { - get - { - return state; - } - set - { - state = value; - - switch (state) - { - case CheckboxState.Checked: - fill.FadeIn(200, EasingTypes.OutQuint); - break; - case CheckboxState.Unchecked: - fill.FadeTo(0.01f, 200, EasingTypes.OutQuint); //todo: remove once we figure why containers aren't drawing at all times - break; - } - } + get { return current; } + set { current.BindTo(value); } } } } diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs index 6a5151b90c..5d4760fec6 100644 --- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs @@ -23,16 +23,10 @@ namespace osu.Game.Graphics.UserInterface { set { - if (bindable != null) - bindable.ValueChanged -= bindableValueChanged; bindable = value; + if (bindable != null) - { - bool state = State == CheckboxState.Checked; - if (state != bindable.Value) - State = bindable.Value ? CheckboxState.Checked : CheckboxState.Unchecked; - bindable.ValueChanged += bindableValueChanged; - } + Current = bindable; if (bindable?.Disabled ?? true) Alpha = 0.3f; @@ -78,23 +72,20 @@ namespace osu.Game.Graphics.UserInterface labelSpriteText = new OsuSpriteText(), nub = new Nub { + Current = Current, Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, Margin = new MarginPadding { Right = 5 }, } }; - } - private void bindableValueChanged(bool isChecked) - { - State = isChecked ? CheckboxState.Checked : CheckboxState.Unchecked; - } - - protected override void Dispose(bool isDisposing) - { - if (bindable != null) - bindable.ValueChanged -= bindableValueChanged; - base.Dispose(isDisposing); + Current.ValueChanged += newValue => + { + if (newValue) + sampleChecked?.Play(); + else + sampleUnchecked?.Play(); + }; } protected override bool OnHover(InputState state) @@ -117,23 +108,5 @@ namespace osu.Game.Graphics.UserInterface sampleChecked = audio.Sample.Get(@"Checkbox/check-on"); sampleUnchecked = audio.Sample.Get(@"Checkbox/check-off"); } - - protected override void OnChecked() - { - sampleChecked?.Play(); - nub.State = CheckboxState.Checked; - - if (bindable != null) - bindable.Value = true; - } - - protected override void OnUnchecked() - { - sampleUnchecked?.Play(); - nub.State = CheckboxState.Unchecked; - - if (bindable != null) - bindable.Value = false; - } } } diff --git a/osu.Game/Graphics/UserInterface/OsuDropdown.cs b/osu.Game/Graphics/UserInterface/OsuDropdown.cs index 3466fb1a60..9bb0d15545 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropdown.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropdown.cs @@ -45,7 +45,7 @@ namespace osu.Game.Graphics.UserInterface private class OsuDropdownMenuItem : DropdownMenuItem { - public OsuDropdownMenuItem(string text, T value) : base(text, value) + public OsuDropdownMenuItem(string text, T current) : base(text, current) { Foreground.Padding = new MarginPadding(2); diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index 078c8564d7..91fb1c672a 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -50,7 +50,6 @@ namespace osu.Game.Graphics.UserInterface nub = new Nub { Origin = Anchor.TopCentre, - State = CheckboxState.Unchecked, Expanded = true, } }; @@ -94,13 +93,13 @@ namespace osu.Game.Graphics.UserInterface protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { - nub.State = CheckboxState.Checked; + nub.Current.Value = true; return base.OnMouseDown(state, args); } protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) { - nub.State = CheckboxState.Unchecked; + nub.Current.Value = false; return base.OnMouseUp(state, args); } diff --git a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs index 5914d0ba4c..f732916889 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; @@ -24,8 +23,6 @@ namespace osu.Game.Graphics.UserInterface private readonly SpriteText text; private readonly TextAwesome icon; - public event EventHandler Action; - private Color4? accentColour; public Color4 AccentColour { @@ -34,7 +31,7 @@ namespace osu.Game.Graphics.UserInterface { accentColour = value; - if (State != CheckboxState.Checked) + if (Current) { text.Colour = AccentColour; icon.Colour = AccentColour; @@ -48,20 +45,6 @@ namespace osu.Game.Graphics.UserInterface set { text.Text = value; } } - protected override void OnChecked() - { - fadeIn(); - icon.Icon = FontAwesome.fa_check_circle_o; - Action?.Invoke(this, State); - } - - protected override void OnUnchecked() - { - fadeOut(); - icon.Icon = FontAwesome.fa_circle_o; - Action?.Invoke(this, State); - } - private const float transition_length = 500; private void fadeIn() @@ -84,7 +67,7 @@ namespace osu.Game.Graphics.UserInterface protected override void OnHoverLost(InputState state) { - if (State == CheckboxState.Unchecked) + if (!Current) fadeOut(); base.OnHoverLost(state); @@ -134,6 +117,20 @@ namespace osu.Game.Graphics.UserInterface Anchor = Anchor.BottomLeft, } }; + + Current.ValueChanged += v => + { + if (v) + { + fadeIn(); + icon.Icon = FontAwesome.fa_check_circle_o; + } + else + { + fadeOut(); + icon.Icon = FontAwesome.fa_circle_o; + } + }; } } } diff --git a/osu.Game/Overlays/Options/OptionDropdown.cs b/osu.Game/Overlays/Options/OptionDropdown.cs index 9ae02a17d3..decf5896c2 100644 --- a/osu.Game/Overlays/Options/OptionDropdown.cs +++ b/osu.Game/Overlays/Options/OptionDropdown.cs @@ -33,7 +33,7 @@ namespace osu.Game.Overlays.Options set { bindable = value; - dropdown.SelectedValue.BindTo(bindable); + dropdown.Current = bindable; if (bindable.Disabled) Alpha = 0.3f; } diff --git a/osu.Game/Overlays/Options/OptionTextBox.cs b/osu.Game/Overlays/Options/OptionTextBox.cs index 722f24d50d..346c9f88f5 100644 --- a/osu.Game/Overlays/Options/OptionTextBox.cs +++ b/osu.Game/Overlays/Options/OptionTextBox.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Configuration; -using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Options @@ -15,38 +14,13 @@ namespace osu.Game.Overlays.Options { set { - if (bindable != null) - bindable.ValueChanged -= bindableValueChanged; bindable = value; - if (bindable != null) - { - Text = bindable.Value; - bindable.ValueChanged += bindableValueChanged; - } + + Current = bindable; if (bindable?.Disabled ?? true) Alpha = 0.3f; } } - - public OptionTextBox() - { - OnChange += onChange; - } - - private void onChange(TextBox sender, bool newText) - { - if (bindable != null) - bindable.Value = Text; - } - - private void bindableValueChanged(string newValue) => Text = newValue; - - protected override void Dispose(bool isDisposing) - { - if (bindable != null) - bindable.ValueChanged -= bindableValueChanged; - base.Dispose(isDisposing); - } } } \ No newline at end of file diff --git a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs index c52d0397ed..48a46f0b90 100644 --- a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs +++ b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs @@ -8,7 +8,6 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; @@ -24,7 +23,7 @@ namespace osu.Game.Screens.Select private void invokeOnFilter() { - OnFilter?.Invoke(tabs.SelectedItem, modsCheckbox.State == CheckboxState.Checked); + OnFilter?.Invoke(tabs.Current, modsCheckbox.Current); } [BackgroundDependencyLoader] @@ -61,10 +60,10 @@ namespace osu.Game.Screens.Select }, }; - tabs.SelectedItem.ValueChanged += item => invokeOnFilter(); - modsCheckbox.Action += (sender, e) => invokeOnFilter(); + tabs.Current.ValueChanged += item => invokeOnFilter(); + modsCheckbox.Current.ValueChanged += item => invokeOnFilter(); - tabs.SelectedItem.Value = BeatmapDetailTab.Global; + tabs.Current.Value = BeatmapDetailTab.Global; } } diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 6d92b35993..7596af1484 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -93,11 +93,6 @@ namespace osu.Game.Screens.Select searchTextBox = new SearchTextBox { RelativeSizeAxes = Axes.X, - OnChange = (sender, newText) => - { - if (newText) - FilterChanged?.Invoke(CreateCriteria()); - }, Exit = () => Exit?.Invoke(), }, new Box @@ -149,10 +144,12 @@ namespace osu.Game.Screens.Select } }; + searchTextBox.Current.ValueChanged += t => FilterChanged?.Invoke(CreateCriteria()); + groupTabs.PinItem(GroupMode.All); groupTabs.PinItem(GroupMode.RecentlyPlayed); - groupTabs.SelectedItem.ValueChanged += val => Group = val; - sortTabs.SelectedItem.ValueChanged += val => Sort = val; + groupTabs.Current.ValueChanged += val => Group = val; + sortTabs.Current.ValueChanged += val => Sort = val; } public void Deactivate() From b7cfdff8d13be4cde6640b638dd60b0579df0baa Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Apr 2017 15:30:17 +0900 Subject: [PATCH 095/442] Update SliderBar to use IHasCurrentValue. --- osu-framework | 2 +- osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs | 2 +- osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs | 2 +- osu.Game/Overlays/Options/OptionSlider.cs | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/osu-framework b/osu-framework index bbfd0fc7a8..561b24bed4 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit bbfd0fc7a8f5293a0f853f51040b40808abbb459 +Subproject commit 561b24bed48d3670b1d33acfc7ba5e11dcd3ac0c diff --git a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs index 99da7d1c73..b14607f235 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs @@ -112,7 +112,7 @@ namespace osu.Desktop.VisualTests.Tests Width = 150, Height = 10, SelectionColor = Color4.Orange, - Value = playbackSpeed + Current = playbackSpeed } } }); diff --git a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs index 7e7782662b..d41da04b3e 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs @@ -57,7 +57,7 @@ namespace osu.Desktop.VisualTests.Tests Width = 150, Height = 10, SelectionColor = Color4.Orange, - Value = bindable + Current = bindable } } }); diff --git a/osu.Game/Overlays/Options/OptionSlider.cs b/osu.Game/Overlays/Options/OptionSlider.cs index 8fa9bf063d..1cd9fdc60c 100644 --- a/osu.Game/Overlays/Options/OptionSlider.cs +++ b/osu.Game/Overlays/Options/OptionSlider.cs @@ -27,12 +27,12 @@ namespace osu.Game.Overlays.Options } } - public BindableNumber Bindable + public Bindable Bindable { - get { return slider.Value; } + get { return slider.Current; } set { - slider.Value = value; + slider.Current = value; if (value?.Disabled ?? true) Alpha = 0.3f; } From f12b5a8954306c7cb94a50d0248cb1d8ab523ee7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Apr 2017 16:22:36 +0900 Subject: [PATCH 096/442] Unify disable logic. --- osu.Game/Graphics/UserInterface/OsuCheckbox.cs | 7 ++----- osu.Game/Overlays/Options/OptionDropdown.cs | 2 +- osu.Game/Overlays/Options/OptionSlider.cs | 6 ++++-- osu.Game/Overlays/Options/OptionTextBox.cs | 4 +--- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs index 5d4760fec6..6dfbc931cf 100644 --- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs @@ -24,11 +24,8 @@ namespace osu.Game.Graphics.UserInterface set { bindable = value; - - if (bindable != null) - Current = bindable; - - if (bindable?.Disabled ?? true) + Current = bindable; + if (value?.Disabled ?? true) Alpha = 0.3f; } } diff --git a/osu.Game/Overlays/Options/OptionDropdown.cs b/osu.Game/Overlays/Options/OptionDropdown.cs index decf5896c2..332c95328b 100644 --- a/osu.Game/Overlays/Options/OptionDropdown.cs +++ b/osu.Game/Overlays/Options/OptionDropdown.cs @@ -34,7 +34,7 @@ namespace osu.Game.Overlays.Options { bindable = value; dropdown.Current = bindable; - if (bindable.Disabled) + if (value?.Disabled ?? true) Alpha = 0.3f; } } diff --git a/osu.Game/Overlays/Options/OptionSlider.cs b/osu.Game/Overlays/Options/OptionSlider.cs index 1cd9fdc60c..0b0a9b8b50 100644 --- a/osu.Game/Overlays/Options/OptionSlider.cs +++ b/osu.Game/Overlays/Options/OptionSlider.cs @@ -27,12 +27,14 @@ namespace osu.Game.Overlays.Options } } + private Bindable bindable; + public Bindable Bindable { - get { return slider.Current; } set { - slider.Current = value; + bindable = value; + slider.Current = bindable; if (value?.Disabled ?? true) Alpha = 0.3f; } diff --git a/osu.Game/Overlays/Options/OptionTextBox.cs b/osu.Game/Overlays/Options/OptionTextBox.cs index 346c9f88f5..c2c8e91016 100644 --- a/osu.Game/Overlays/Options/OptionTextBox.cs +++ b/osu.Game/Overlays/Options/OptionTextBox.cs @@ -15,10 +15,8 @@ namespace osu.Game.Overlays.Options set { bindable = value; - Current = bindable; - - if (bindable?.Disabled ?? true) + if (value?.Disabled ?? true) Alpha = 0.3f; } } From ba03a989925285ab0f979238de7711657fa5d04c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Apr 2017 16:39:10 +0900 Subject: [PATCH 097/442] Add missing config set. --- osu.Game/Configuration/OsuConfigManager.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 7d7c61b69a..e2f33479c0 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -46,6 +46,7 @@ namespace osu.Game.Configuration Set(OsuConfig.AutomaticDownload, true).Disabled = true; Set(OsuConfig.AutomaticDownloadNoVideo, false).Disabled = true; Set(OsuConfig.BlockNonFriendPM, false).Disabled = true; + Set(OsuConfig.Bloom, false).Disabled = true; Set(OsuConfig.BloomSoftening, false).Disabled = true; Set(OsuConfig.BossKeyFirstActivation, true).Disabled = true; Set(OsuConfig.ChatAudibleHighlight, true).Disabled = true; From 5af4259ab42f5576ff3dfd5f3aee0face56a3464 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Apr 2017 17:10:15 +0900 Subject: [PATCH 098/442] Add back explicit binds. --- osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs | 6 ++++-- osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs | 7 +++++-- osu.Game/Graphics/UserInterface/Nub.cs | 8 +------- osu.Game/Graphics/UserInterface/OsuCheckbox.cs | 5 +++-- osu.Game/Overlays/Options/OptionDropdown.cs | 2 +- osu.Game/Overlays/Options/OptionSlider.cs | 2 +- osu.Game/Overlays/Options/OptionTextBox.cs | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs index b14607f235..3d9f3aad79 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs @@ -99,6 +99,7 @@ namespace osu.Desktop.VisualTests.Tests AddToggleStep(@"auto", state => { auto = state; load(mode); }); + BasicSliderBar sliderBar; Add(new Container { Anchor = Anchor.TopRight, @@ -107,16 +108,17 @@ namespace osu.Desktop.VisualTests.Tests Children = new Drawable[] { new SpriteText { Text = "Playback Speed" }, - new BasicSliderBar + sliderBar = new BasicSliderBar { Width = 150, Height = 10, SelectionColor = Color4.Orange, - Current = playbackSpeed } } }); + sliderBar.Current.BindTo(playbackSpeed); + framedClock.ProcessFrame(); var clockAdjustContainer = new Container diff --git a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs index d41da04b3e..b1b9ddbcda 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs @@ -44,6 +44,8 @@ namespace osu.Desktop.VisualTests.Tests kc.Add(new KeyCounterKeyboard(key)); }); + TestSliderBar sliderBar; + Add(new Container { Anchor = Anchor.TopRight, @@ -52,16 +54,17 @@ namespace osu.Desktop.VisualTests.Tests Children = new Drawable[] { new SpriteText { Text = "FadeTime" }, - new TestSliderBar + sliderBar =new TestSliderBar { Width = 150, Height = 10, SelectionColor = Color4.Orange, - Current = bindable } } }); + sliderBar.Current.BindTo(bindable); + Add(kc); } private class TestSliderBar : SliderBar where T : struct diff --git a/osu.Game/Graphics/UserInterface/Nub.cs b/osu.Game/Graphics/UserInterface/Nub.cs index a5a4fab3e1..82ede8f079 100644 --- a/osu.Game/Graphics/UserInterface/Nub.cs +++ b/osu.Game/Graphics/UserInterface/Nub.cs @@ -92,12 +92,6 @@ namespace osu.Game.Graphics.UserInterface } } - private readonly Bindable current = new Bindable(); - - public Bindable Current - { - get { return current; } - set { current.BindTo(value); } - } + public Bindable Current { get; } = new Bindable(); } } diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs index 6dfbc931cf..d339388aa5 100644 --- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs @@ -24,7 +24,7 @@ namespace osu.Game.Graphics.UserInterface set { bindable = value; - Current = bindable; + Current.BindTo(bindable); if (value?.Disabled ?? true) Alpha = 0.3f; } @@ -69,13 +69,14 @@ namespace osu.Game.Graphics.UserInterface labelSpriteText = new OsuSpriteText(), nub = new Nub { - Current = Current, Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, Margin = new MarginPadding { Right = 5 }, } }; + nub.Current.BindTo(Current); + Current.ValueChanged += newValue => { if (newValue) diff --git a/osu.Game/Overlays/Options/OptionDropdown.cs b/osu.Game/Overlays/Options/OptionDropdown.cs index 332c95328b..ee12ba9b05 100644 --- a/osu.Game/Overlays/Options/OptionDropdown.cs +++ b/osu.Game/Overlays/Options/OptionDropdown.cs @@ -33,7 +33,7 @@ namespace osu.Game.Overlays.Options set { bindable = value; - dropdown.Current = bindable; + dropdown.Current.BindTo(bindable); if (value?.Disabled ?? true) Alpha = 0.3f; } diff --git a/osu.Game/Overlays/Options/OptionSlider.cs b/osu.Game/Overlays/Options/OptionSlider.cs index 0b0a9b8b50..1c4b54a080 100644 --- a/osu.Game/Overlays/Options/OptionSlider.cs +++ b/osu.Game/Overlays/Options/OptionSlider.cs @@ -34,7 +34,7 @@ namespace osu.Game.Overlays.Options set { bindable = value; - slider.Current = bindable; + slider.Current.BindTo(bindable); if (value?.Disabled ?? true) Alpha = 0.3f; } diff --git a/osu.Game/Overlays/Options/OptionTextBox.cs b/osu.Game/Overlays/Options/OptionTextBox.cs index c2c8e91016..b5ef39c8b2 100644 --- a/osu.Game/Overlays/Options/OptionTextBox.cs +++ b/osu.Game/Overlays/Options/OptionTextBox.cs @@ -15,7 +15,7 @@ namespace osu.Game.Overlays.Options set { bindable = value; - Current = bindable; + Current.BindTo(bindable); if (value?.Disabled ?? true) Alpha = 0.3f; } From 15c1013f5b68279f65e00b9657ac6df36b2e07a1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Apr 2017 17:25:46 +0900 Subject: [PATCH 099/442] Don't schedule event, it's unreliable and doesn't match the fade. --- osu.Game/Screens/Play/HotkeyRetryOverlay.cs | 25 ++++++++++++--------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/osu.Game/Screens/Play/HotkeyRetryOverlay.cs b/osu.Game/Screens/Play/HotkeyRetryOverlay.cs index 4e383510fc..3fcd773c19 100644 --- a/osu.Game/Screens/Play/HotkeyRetryOverlay.cs +++ b/osu.Game/Screens/Play/HotkeyRetryOverlay.cs @@ -11,7 +11,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using OpenTK.Graphics; -using osu.Framework.Threading; namespace osu.Game.Screens.Play { @@ -20,12 +19,13 @@ namespace osu.Game.Screens.Play public Action Action; private SampleChannel retrySample; - private ScheduledDelegate task; private Box overlay; private const int activate_delay = 500; private const int fadeout_delay = 200; + private bool fired; + [BackgroundDependencyLoader] private void load(AudioManager audio) { @@ -52,13 +52,6 @@ namespace osu.Game.Screens.Play if (args.Key == Key.Tilde) { overlay.FadeIn(activate_delay); - - task = Scheduler.AddDelayed(() => - { - retrySample.Play(); - Action(); - }, activate_delay); - return true; } @@ -67,14 +60,24 @@ namespace osu.Game.Screens.Play protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) { - if (args.Key == Key.Tilde) + if (args.Key == Key.Tilde && !fired) { - task?.Cancel(); overlay.FadeOut(fadeout_delay); return true; } return base.OnKeyUp(state, args); } + + protected override void Update() + { + base.Update(); + if (!fired && overlay.Alpha == 1) + { + fired = true; + retrySample.Play(); + Action?.Invoke(); + } + } } } From 3a01cfccee5db6e0fabf9e2eea7cb5e169131836 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Apr 2017 17:25:56 +0900 Subject: [PATCH 100/442] Adjust fade length and easing. --- osu.Game/Screens/Play/HotkeyRetryOverlay.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Play/HotkeyRetryOverlay.cs b/osu.Game/Screens/Play/HotkeyRetryOverlay.cs index 3fcd773c19..6b30644ab0 100644 --- a/osu.Game/Screens/Play/HotkeyRetryOverlay.cs +++ b/osu.Game/Screens/Play/HotkeyRetryOverlay.cs @@ -21,7 +21,7 @@ namespace osu.Game.Screens.Play private SampleChannel retrySample; private Box overlay; - private const int activate_delay = 500; + private const int activate_delay = 400; private const int fadeout_delay = 200; private bool fired; @@ -51,7 +51,7 @@ namespace osu.Game.Screens.Play if (args.Key == Key.Tilde) { - overlay.FadeIn(activate_delay); + overlay.FadeIn(activate_delay, EasingTypes.Out); return true; } @@ -62,7 +62,7 @@ namespace osu.Game.Screens.Play { if (args.Key == Key.Tilde && !fired) { - overlay.FadeOut(fadeout_delay); + overlay.FadeOut(fadeout_delay, EasingTypes.Out); return true; } From 43a46575404168ee8fd1e1b7ae99a6b9eb8b6ef7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Apr 2017 17:26:05 +0900 Subject: [PATCH 101/442] Remove unnecessary AlwaysPresent. --- osu.Game/Screens/Play/HotkeyRetryOverlay.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Play/HotkeyRetryOverlay.cs b/osu.Game/Screens/Play/HotkeyRetryOverlay.cs index 6b30644ab0..16062bebe5 100644 --- a/osu.Game/Screens/Play/HotkeyRetryOverlay.cs +++ b/osu.Game/Screens/Play/HotkeyRetryOverlay.cs @@ -38,7 +38,6 @@ namespace osu.Game.Screens.Play overlay = new Box { Alpha = 0, - AlwaysPresent = true, Colour = Color4.Black, RelativeSizeAxes = Axes.Both, } From 960ea27684610167124338fb41621f9b9ee7c9f9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Apr 2017 19:21:27 +0900 Subject: [PATCH 102/442] Make all Playfields completely relative. --- osu.Game.Modes.Catch/UI/CatchPlayfield.cs | 3 +-- osu.Game.Modes.Mania/UI/ManiaPlayfield.cs | 3 +-- osu.Game.Modes.Osu/UI/OsuPlayfield.cs | 2 -- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 5 ----- osu.Game/Modes/UI/Playfield.cs | 7 +++++++ 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/osu.Game.Modes.Catch/UI/CatchPlayfield.cs b/osu.Game.Modes.Catch/UI/CatchPlayfield.cs index cf1a665470..f8792a7fd5 100644 --- a/osu.Game.Modes.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Modes.Catch/UI/CatchPlayfield.cs @@ -14,8 +14,7 @@ namespace osu.Game.Modes.Catch.UI { public CatchPlayfield() { - RelativeSizeAxes = Axes.Y; - Size = new Vector2(512, 0.9f); + Size = new Vector2(1, 0.9f); Anchor = Anchor.BottomCentre; Origin = Anchor.BottomCentre; diff --git a/osu.Game.Modes.Mania/UI/ManiaPlayfield.cs b/osu.Game.Modes.Mania/UI/ManiaPlayfield.cs index 670d18f71f..deb4ebac25 100644 --- a/osu.Game.Modes.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Modes.Mania/UI/ManiaPlayfield.cs @@ -15,8 +15,7 @@ namespace osu.Game.Modes.Mania.UI { public ManiaPlayfield(int columns) { - RelativeSizeAxes = Axes.Both; - Size = new Vector2(columns / 20f, 1f); + Size = new Vector2(0.8f, 1f); Anchor = Anchor.BottomCentre; Origin = Anchor.BottomCentre; diff --git a/osu.Game.Modes.Osu/UI/OsuPlayfield.cs b/osu.Game.Modes.Osu/UI/OsuPlayfield.cs index d89bbfd131..4164607b4d 100644 --- a/osu.Game.Modes.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Modes.Osu/UI/OsuPlayfield.cs @@ -38,8 +38,6 @@ namespace osu.Game.Modes.Osu.UI { Anchor = Anchor.Centre; Origin = Anchor.Centre; - RelativeSizeAxes = Axes.Both; - Size = new Vector2(0.75f); Add(new Drawable[] { diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index 6fe2282d88..db3a1bc84e 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -52,11 +52,6 @@ namespace osu.Game.Modes.Taiko.UI public TaikoPlayfield() { - RelativeSizeAxes = Axes.X; - - // Default height - Height = DEFAULT_PLAYFIELD_HEIGHT; - AddInternal(new Drawable[] { rightBackgroundContainer = new Container diff --git a/osu.Game/Modes/UI/Playfield.cs b/osu.Game/Modes/UI/Playfield.cs index f31ee0f189..bf5f0acde5 100644 --- a/osu.Game/Modes/UI/Playfield.cs +++ b/osu.Game/Modes/UI/Playfield.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Modes.Objects; @@ -63,6 +64,12 @@ namespace osu.Game.Modes.UI Add(HitObjects); } + public override Axes RelativeSizeAxes + { + get { return Axes.Both; } + set { throw new InvalidOperationException($@"{nameof(Playfield)}'s {nameof(RelativeSizeAxes)} should never be changed from {Axes.Both}"); } + } + /// /// Performs post-processing tasks (if any) after all DrawableHitObjects are loaded into this Playfield. /// From b9ce98efd65965c495305158e07111a95ebec404 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Apr 2017 19:22:02 +0900 Subject: [PATCH 103/442] Add AspectAdjust to HitRenderer to allow playfield to consume ful HitRenderer size when needed. --- osu.Game.Modes.Osu/UI/OsuHitRenderer.cs | 3 +++ osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs | 12 ++++++++++++ osu.Game/Modes/UI/HitRenderer.cs | 19 +++++++++++++++++++ 3 files changed, 34 insertions(+) diff --git a/osu.Game.Modes.Osu/UI/OsuHitRenderer.cs b/osu.Game.Modes.Osu/UI/OsuHitRenderer.cs index ca9ff6fc61..7e314c5ba1 100644 --- a/osu.Game.Modes.Osu/UI/OsuHitRenderer.cs +++ b/osu.Game.Modes.Osu/UI/OsuHitRenderer.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using OpenTK; using osu.Game.Beatmaps; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Osu.Beatmaps; @@ -46,5 +47,7 @@ namespace osu.Game.Modes.Osu.UI return new DrawableSpinner(spinner); return null; } + + protected override Vector2 GetPlayfieldAspectAdjust() => new Vector2(0.75f); } } diff --git a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs b/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs index 29fa693d58..32476dff7f 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs @@ -17,6 +17,7 @@ using osu.Game.Modes.Taiko.Objects.Drawables; using osu.Game.Modes.Taiko.Scoring; using osu.Game.Modes.UI; using osu.Game.Modes.Taiko.Replays; +using OpenTK; namespace osu.Game.Modes.Taiko.UI { @@ -100,6 +101,17 @@ namespace osu.Game.Modes.Taiko.UI } } + protected override Vector2 GetPlayfieldAspectAdjust() + { + const float default_relative_height = TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT / 768; + const float default_aspect = 16f / 9f; + + float aspectAdjust = MathHelper.Clamp(DrawWidth / DrawHeight, 0.4f, 4) / default_aspect; + + return new Vector2(1, default_relative_height * aspectAdjust); + } + + public override ScoreProcessor CreateScoreProcessor() => new TaikoScoreProcessor(this); protected override IBeatmapConverter CreateBeatmapConverter() => new TaikoBeatmapConverter(); diff --git a/osu.Game/Modes/UI/HitRenderer.cs b/osu.Game/Modes/UI/HitRenderer.cs index a958c61c68..afc525d686 100644 --- a/osu.Game/Modes/UI/HitRenderer.cs +++ b/osu.Game/Modes/UI/HitRenderer.cs @@ -16,6 +16,7 @@ using System.Diagnostics; using System.Linq; using osu.Game.Modes.Replays; using osu.Game.Modes.Scoring; +using OpenTK; namespace osu.Game.Modes.UI { @@ -167,6 +168,11 @@ namespace osu.Game.Modes.UI { public event Action OnJudgement; + /// + /// Whether to apply adjustments to the child based on our own size. + /// + public bool AspectAdjust = true; + public sealed override bool ProvidingUserCursor => !HasReplayLoaded && Playfield.ProvidingUserCursor; protected override Container Content => content; @@ -219,6 +225,19 @@ namespace osu.Game.Modes.UI Playfield.PostProcess(); } + protected override void Update() + { + base.Update(); + + Playfield.Size = AspectAdjust ? GetPlayfieldAspectAdjust() : Vector2.One; + } + + /// + /// In some cases we want to apply changes to the relative size of our contained based on custom conditions. + /// + /// + protected virtual Vector2 GetPlayfieldAspectAdjust() => new Vector2(0.75f); //a sane default + /// /// Triggered when an object's Judgement is updated. /// From b1d5a563099f89ee9fa2afaf1dbb572aa8791ffb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 10 Apr 2017 19:44:45 +0900 Subject: [PATCH 104/442] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 561b24bed4..1490f00327 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 561b24bed48d3670b1d33acfc7ba5e11dcd3ac0c +Subproject commit 1490f003273d7aab6589e489f6e4b02d204c9f27 From 24b4b3ad7d8011a27c01f619158f27f4c3ab620d Mon Sep 17 00:00:00 2001 From: Jorolf Date: Mon, 10 Apr 2017 16:42:23 +0200 Subject: [PATCH 105/442] update to everything --- .../Tests/TestCaseBeatmapDetails.cs | 36 ++- osu.Game/Database/BeatmapInfo.cs | 3 + osu.Game/Database/BeatmapMetric.cs | 23 ++ osu.Game/Graphics/UserInterface/Bar.cs | 16 +- osu.Game/Graphics/UserInterface/BarGraph.cs | 13 +- osu.Game/Screens/Select/BeatmapDetails.cs | 221 +++++------------- osu.Game/osu.Game.csproj | 1 + 7 files changed, 140 insertions(+), 173 deletions(-) create mode 100644 osu.Game/Database/BeatmapMetric.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs index 00f0d67e24..3394a6498e 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs @@ -41,21 +41,45 @@ namespace osu.Desktop.VisualTests.Tests DrainRate = 1, }, StarDifficulty = 5.3f, + Metric = new BeatmapMetric + { + Ratings = Enumerable.Range(0,10).ToArray(), + Fails = Enumerable.Range(lastRange, 100).Select(i => (i % 12) - 6).ToArray(), + Retries = Enumerable.Range(lastRange - 3, 100).Select(i => (i % 12) - 6).ToArray(), + }, }, }); - AddRepeatStep("new fail values", newRetryAndFailValues, 10); - AddStep("new ratings", () => details.Ratings = Enumerable.Range(1, 10)); - AddStep("remove fails", () => details.Fails = null ); - AddStep("remove ratings", () => details.Ratings = null ); + AddRepeatStep("fail values", newRetryAndFailValues, 10); } private int lastRange = 1; private void newRetryAndFailValues() { - details.Fails = Enumerable.Range(lastRange, 100).Select(i => (int)(Math.Cos(i) * 100)); - details.Retries = Enumerable.Range(lastRange, 100).Select(i => (int)(Math.Sin(i) * 100)); + details.Beatmap = new BeatmapInfo + { + Version = "VisualTest", + Metadata = new BeatmapMetadata + { + Source = "Some guy", + Tags = "beatmap metadata example with a very very long list of tags and not much creativity", + }, + Difficulty = new BeatmapDifficulty + { + CircleSize = 7, + ApproachRate = 3.5f, + OverallDifficulty = 5.7f, + DrainRate = 1, + }, + StarDifficulty = 5.3f, + Metric = new BeatmapMetric + { + Ratings = Enumerable.Range(0, 10).ToArray(), + Fails = Enumerable.Range(lastRange, 100).Select(i => (i % 12) - 6).ToArray(), + Retries = Enumerable.Range(lastRange - 3, 100).Select(i => (i % 12) - 6).ToArray(), + }, + }; lastRange += 100; } } diff --git a/osu.Game/Database/BeatmapInfo.cs b/osu.Game/Database/BeatmapInfo.cs index bc6e077633..252d52a744 100644 --- a/osu.Game/Database/BeatmapInfo.cs +++ b/osu.Game/Database/BeatmapInfo.cs @@ -41,6 +41,9 @@ namespace osu.Game.Database [OneToOne(CascadeOperations = CascadeOperation.All)] public BeatmapDifficulty Difficulty { get; set; } + [Ignore] + public BeatmapMetric Metric { get; set; } + public string Path { get; set; } public string Hash { get; set; } diff --git a/osu.Game/Database/BeatmapMetric.cs b/osu.Game/Database/BeatmapMetric.cs new file mode 100644 index 0000000000..2302289047 --- /dev/null +++ b/osu.Game/Database/BeatmapMetric.cs @@ -0,0 +1,23 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Database +{ + public class BeatmapMetric + { + /// + /// Ratings for a beatmap, length should be 10 + /// + public int[] Ratings { get; set; } + + /// + /// Fails for a beatmap, length should be 100 + /// + public int[] Fails { get; set; } + + /// + /// Retries for a beatmap, length should be 100 + /// + public int[] Retries { get; set; } + } +} diff --git a/osu.Game/Graphics/UserInterface/Bar.cs b/osu.Game/Graphics/UserInterface/Bar.cs index 555d366f98..c9733b807d 100644 --- a/osu.Game/Graphics/UserInterface/Bar.cs +++ b/osu.Game/Graphics/UserInterface/Bar.cs @@ -20,6 +20,9 @@ namespace osu.Game.Graphics.UserInterface private const EasingTypes easing = EasingTypes.InOutCubic; private float length; + /// + /// Length of the bar, ranges from 0 to 1 + /// public float Length { get @@ -41,12 +44,6 @@ namespace osu.Game.Graphics.UserInterface } set { - if (background == null) - Add(background = new Box - { - RelativeSizeAxes = Axes.Both, - Depth = 1, - }); background.Colour = value; } } @@ -81,10 +78,15 @@ namespace osu.Game.Graphics.UserInterface { Children = new[] { + background = new Box + { + RelativeSizeAxes = Axes.Both, + Colour = new Color4(0,0,0,0) + }, bar = new Box { RelativeSizeAxes = Axes.Both, - } + }, }; } diff --git a/osu.Game/Graphics/UserInterface/BarGraph.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs index 832ba74b89..b29726ab1c 100644 --- a/osu.Game/Graphics/UserInterface/BarGraph.cs +++ b/osu.Game/Graphics/UserInterface/BarGraph.cs @@ -11,6 +11,11 @@ namespace osu.Game.Graphics.UserInterface { public class BarGraph : FillFlowContainer { + /// + /// Manually sets the max value, if null is instead used + /// + public float? MaxValue { get; set; } + private BarDirection direction = BarDirection.BottomToTop; public new BarDirection Direction { @@ -30,6 +35,9 @@ namespace osu.Game.Graphics.UserInterface } } + /// + /// A list of floats that defines the length of each + /// public IEnumerable Values { set @@ -39,7 +47,7 @@ namespace osu.Game.Graphics.UserInterface for (int i = 0; i < values.Count; i++) if (graphBars.Count > i) { - graphBars[i].Length = values[i] / values.Max(); + graphBars[i].Length = values[i] / (MaxValue ?? values.Max()); graphBars[i].Size = (direction & BarDirection.Horizontal) > 0 ? new Vector2(1, 1.0f / values.Count) : new Vector2(1.0f / values.Count, 1); } else @@ -47,9 +55,10 @@ namespace osu.Game.Graphics.UserInterface { RelativeSizeAxes = Axes.Both, Size = (direction & BarDirection.Horizontal) > 0 ? new Vector2(1, 1.0f / values.Count) : new Vector2(1.0f / values.Count, 1), - Length = values[i] / values.Max(), + Length = values[i] / (MaxValue ?? values.Max()), Direction = Direction, }); + Remove(Children.Where((bar, index) => index >= values.Count)); } } } diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 6bbe7a0858..e33f42e5b1 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -47,85 +47,49 @@ namespace osu.Game.Screens.Select { return beatmap; } - set { if (beatmap == value) return; beatmap = value; - description.ContentText = beatmap.Version; - source.ContentText = beatmap.Metadata.Source; - tags.ContentText = beatmap.Metadata.Tags; + description.Text = beatmap.Version; + source.Text = beatmap.Metadata.Source; + tags.Text = beatmap.Metadata.Tags; circleSize.Value = beatmap.Difficulty.CircleSize; drainRate.Value = beatmap.Difficulty.DrainRate; overallDifficulty.Value = beatmap.Difficulty.OverallDifficulty; approachRate.Value = beatmap.Difficulty.ApproachRate; stars.Value = (float)beatmap.StarDifficulty; - } - } - private List ratings; - public IEnumerable Ratings - { - get - { - return ratings; - } - set - { - ratings = value?.ToList() ?? new List(); - if(ratings.Count == 0) - ratingsContainer.FadeOut(250); + + List ratings = beatmap.Metric?.Ratings?.ToList() ?? new List(); + if (ratings.Count == 0) + ratingsContainer.Hide(); else { - ratingsContainer.FadeIn(250); + ratingsContainer.Show(); negativeRatings.Text = ratings.GetRange(0, 5).Sum().ToString(); positiveRatings.Text = ratings.GetRange(5, 5).Sum().ToString(); ratingsBar.Length = (float)ratings.GetRange(0, 5).Sum() / ratings.Sum(); ratingsGraph.Values = ratings.Select(rating => (float)rating); } - } - } - private List retries; - public IEnumerable Retries - { - get - { - return retries; - } - set - { - retries = value?.ToList() ?? new List(); - calcRetryAndFailGraph(); - } - } + List retries = beatmap.Metric?.Retries?.ToList() ?? new List(); + List fails = beatmap.Metric?.Fails?.ToList() ?? new List(); - private List fails; - public IEnumerable Fails - { - get - { - return fails; - } - set - { - fails = value?.ToList() ?? new List(); - calcRetryAndFailGraph(); - } - } - - private void calcRetryAndFailGraph() - { - if ((fails?.Count ?? 0) == 0 || (retries?.Count ?? 0) == 0) - retryAndFailContainer.FadeOut(250); - else - { - retryAndFailContainer.FadeIn(250); - failGraph.Values = fails.Select(fail => (float)fail); - retryGraph.Values = retries?.Select((retry, index) => (float)retry + fails[index]); + if ((fails?.Count ?? 0) == 0 || (retries?.Count ?? 0) == 0) + retryAndFailContainer.Hide(); + else + { + retryAndFailContainer.Show(); + float maxValue = fails.Select((fail, index) => fail + retries[index]).Max(); + failGraph.MaxValue = maxValue; + retryGraph.MaxValue = maxValue; + failGraph.Values = fails.Select(fail => (float)fail); + retryGraph.Values = retries.Select((retry, index) => retry + MathHelper.Clamp(fails[index], 0, maxValue)); + } } } @@ -152,24 +116,9 @@ namespace osu.Game.Screens.Select Padding = new MarginPadding(10) { Top = 25 }, Children = new [] { - description = new MetadataSegment - { - HeaderText = "Description", - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - }, - source = new MetadataSegment - { - HeaderText = "Source", - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - }, - tags = new MetadataSegment - { - HeaderText = "Tags", - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - } + description = new MetadataSegment("Description"), + source = new MetadataSegment("Source"), + tags = new MetadataSegment("Tags") }, }, new FillFlowContainer @@ -178,7 +127,7 @@ namespace osu.Game.Screens.Select AutoSizeAxes = Axes.Y, Width = 0.6f, Direction = FillDirection.Vertical, - Spacing = new Vector2(0,15), + Spacing = new Vector2(0, 15), Padding = new MarginPadding(10) { Top = 0 }, Children = new Drawable[] { @@ -203,37 +152,11 @@ namespace osu.Game.Screens.Select Padding = new MarginPadding(15) { Top = 25 }, Children = new [] { - circleSize = new DifficultyRow - { - DifficultyName = "Circle Size", - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - MaxValue = 7, - }, - drainRate = new DifficultyRow - { - DifficultyName = "HP Drain", - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - }, - overallDifficulty = new DifficultyRow - { - DifficultyName = "Accuracy", - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - }, - approachRate = new DifficultyRow - { - DifficultyName = "Approach Rate", - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - }, - stars = new DifficultyRow - { - DifficultyName = "Star Difficulty", - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - }, + circleSize = new DifficultyRow("Circle Size", 7), + drainRate = new DifficultyRow("HP Drain"), + overallDifficulty = new DifficultyRow("Accuracy"), + approachRate = new DifficultyRow("Approach Rate"), + stars = new DifficultyRow("Star Diffculty"), }, }, }, @@ -320,7 +243,7 @@ namespace osu.Game.Screens.Select new OsuSpriteText { Text = "Points of Failure", - Font = @"Exo2.0-Regular", + Font = @"Exo2.0-Regular", }, new Container { @@ -341,7 +264,7 @@ namespace osu.Game.Screens.Select } }, }, - }, + } }; } @@ -368,8 +291,9 @@ namespace osu.Game.Screens.Select private readonly Bar bar; private readonly OsuSpriteText valueText; - private float difficultyValue; + private readonly float maxValue; + private float difficultyValue; public float Value { get @@ -384,33 +308,6 @@ namespace osu.Game.Screens.Select } } - private float maxValue = 10; - - public float MaxValue - { - get - { - return maxValue; - } - set - { - maxValue = value; - bar.Length = Value / value; - } - } - - public string DifficultyName - { - get - { - return name.Text; - } - set - { - name.Text = value; - } - } - public Color4 AccentColour { get @@ -423,13 +320,17 @@ namespace osu.Game.Screens.Select } } - public DifficultyRow() + public DifficultyRow(string difficultyName, float maxValue = 10) { + this.maxValue = maxValue; + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; Children = new Drawable[] { name = new OsuSpriteText { Font = @"Exo2.0-Regular", + Text = difficultyName, }, bar = new Bar { @@ -462,30 +363,30 @@ namespace osu.Game.Screens.Select private readonly OsuSpriteText header; private readonly FillFlowContainer content; - private const int fade_time = 250; - - public string HeaderText + public string Text { set { - header.Text = value; - } - } - - public string ContentText - { - set - { - if (value == "") - FadeOut(fade_time); + if (string.IsNullOrEmpty(value)) + Hide(); else { - FadeIn(fade_time); - content.Children = value.Split(' ').Select(text => new OsuSpriteText - { - Text = text, - Font = "Exo2.0-Regular", - }); + Show(); + if (header.Text == "Tags") + content.Children = value.Split(' ').Select(text => new OsuSpriteText + { + Text = text, + Font = "Exo2.0-Regular", + }); + else + content.Children = new[] + { + new OsuSpriteText + { + Text = value, + Font = "Exo2.0-Regular", + } + }; } } } @@ -502,13 +403,17 @@ namespace osu.Game.Screens.Select } } - public MetadataSegment() + public MetadataSegment(string headerText) { + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + Margin = new MarginPadding { Top = 10 }; Children = new Drawable[] { header = new OsuSpriteText { Font = @"Exo2.0-Bold", + Text = headerText, }, content = new FillFlowContainer { diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 1888fda4a6..7f01efbe70 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -79,6 +79,7 @@ + From 412d6a14ca01fbe1e43e7f1baca9df0bc2544cf6 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Mon, 10 Apr 2017 16:45:34 +0200 Subject: [PATCH 106/442] removed something unnecessary --- osu.Game/Graphics/UserInterface/Bar.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/UserInterface/Bar.cs b/osu.Game/Graphics/UserInterface/Bar.cs index c9733b807d..4647adb91c 100644 --- a/osu.Game/Graphics/UserInterface/Bar.cs +++ b/osu.Game/Graphics/UserInterface/Bar.cs @@ -40,7 +40,7 @@ namespace osu.Game.Graphics.UserInterface { get { - return background?.Colour ?? default(Color4); + return background.Colour; } set { From ad41fd5c1a91eb54ff203104fbdecc6e3a0c589d Mon Sep 17 00:00:00 2001 From: Jorolf Date: Mon, 10 Apr 2017 16:49:48 +0200 Subject: [PATCH 107/442] more unnecessary stuff --- osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs | 9 ++++----- osu.Game/Graphics/UserInterface/Bar.cs | 2 +- osu.Game/Screens/Select/BeatmapDetails.cs | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs index 3394a6498e..200c2ba786 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs @@ -6,7 +6,6 @@ using osu.Framework.Graphics.Primitives; using osu.Framework.Testing; using osu.Game.Database; using osu.Game.Screens.Select; -using System; using System.Linq; namespace osu.Desktop.VisualTests.Tests @@ -44,8 +43,8 @@ namespace osu.Desktop.VisualTests.Tests Metric = new BeatmapMetric { Ratings = Enumerable.Range(0,10).ToArray(), - Fails = Enumerable.Range(lastRange, 100).Select(i => (i % 12) - 6).ToArray(), - Retries = Enumerable.Range(lastRange - 3, 100).Select(i => (i % 12) - 6).ToArray(), + Fails = Enumerable.Range(lastRange, 100).Select(i => i % 12 - 6).ToArray(), + Retries = Enumerable.Range(lastRange - 3, 100).Select(i => i % 12 - 6).ToArray(), }, }, }); @@ -76,8 +75,8 @@ namespace osu.Desktop.VisualTests.Tests Metric = new BeatmapMetric { Ratings = Enumerable.Range(0, 10).ToArray(), - Fails = Enumerable.Range(lastRange, 100).Select(i => (i % 12) - 6).ToArray(), - Retries = Enumerable.Range(lastRange - 3, 100).Select(i => (i % 12) - 6).ToArray(), + Fails = Enumerable.Range(lastRange, 100).Select(i => i % 12 - 6).ToArray(), + Retries = Enumerable.Range(lastRange - 3, 100).Select(i => i % 12 - 6).ToArray(), }, }; lastRange += 100; diff --git a/osu.Game/Graphics/UserInterface/Bar.cs b/osu.Game/Graphics/UserInterface/Bar.cs index 4647adb91c..07aafbb655 100644 --- a/osu.Game/Graphics/UserInterface/Bar.cs +++ b/osu.Game/Graphics/UserInterface/Bar.cs @@ -12,7 +12,7 @@ namespace osu.Game.Graphics.UserInterface { public class Bar : Container, IHasAccentColour { - private Box background; + private readonly Box background; private readonly Box bar; private const int resize_duration = 250; diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index e33f42e5b1..2414122d7b 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -79,7 +79,7 @@ namespace osu.Game.Screens.Select List retries = beatmap.Metric?.Retries?.ToList() ?? new List(); List fails = beatmap.Metric?.Fails?.ToList() ?? new List(); - if ((fails?.Count ?? 0) == 0 || (retries?.Count ?? 0) == 0) + if (fails.Count == 0 || retries.Count == 0) retryAndFailContainer.Hide(); else { From 24fea2809b47e50c92a824957d7577f66a5c4ed3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Apr 2017 13:44:55 +0900 Subject: [PATCH 108/442] Map beatmap md5 from online response to BeatmapInfo. --- osu.Game/Database/BeatmapInfo.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Database/BeatmapInfo.cs b/osu.Game/Database/BeatmapInfo.cs index bc6e077633..798540bdd8 100644 --- a/osu.Game/Database/BeatmapInfo.cs +++ b/osu.Game/Database/BeatmapInfo.cs @@ -43,6 +43,7 @@ namespace osu.Game.Database public string Path { get; set; } + [JsonProperty("file_md5")] public string Hash { get; set; } // General From ecfe68d6fba14bf6915182e52e049e6639bf0a46 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Apr 2017 13:47:30 +0900 Subject: [PATCH 109/442] Hide deprecated API storage variables and populate Score.User automatically. --- osu.Game/Modes/Scoring/Score.cs | 23 ++++++++++++++++--- .../Select/Leaderboards/LeaderboardScore.cs | 4 ++-- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/osu.Game/Modes/Scoring/Score.cs b/osu.Game/Modes/Scoring/Score.cs index c998b11f77..e49907e7a8 100644 --- a/osu.Game/Modes/Scoring/Score.cs +++ b/osu.Game/Modes/Scoring/Score.cs @@ -27,7 +27,24 @@ namespace osu.Game.Modes.Scoring public int Combo { get; set; } public Mod[] Mods { get; set; } - public User User { get; set; } + private User user; + + public User User + { + get + { + return user ?? new User + { + Username = temporaryUsername, + Id = temporaryUserID + }; + } + + set + { + user = value; + } + } [JsonProperty(@"replay_data")] public Replay Replay; @@ -38,10 +55,10 @@ namespace osu.Game.Modes.Scoring public long OnlineScoreID; [JsonProperty(@"username")] - public string Username; + private string temporaryUsername; [JsonProperty(@"user_id")] - public long UserID; + private long temporaryUserID; [JsonProperty(@"date")] public DateTime Date; diff --git a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs index 2bac387c5c..493f351b75 100644 --- a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs @@ -142,7 +142,7 @@ namespace osu.Game.Screens.Select.Leaderboards Children = new Drawable[] { avatar = new DelayedLoadWrapper( - new Avatar(Score.User ?? new User { Id = Score.UserID }) + new Avatar(Score.User) { RelativeSizeAxes = Axes.Both, CornerRadius = corner_radius, @@ -169,7 +169,7 @@ namespace osu.Game.Screens.Select.Leaderboards { nameLabel = new OsuSpriteText { - Text = Score.User?.Username ?? Score.Username, + Text = Score.User.Username, Font = @"Exo2.0-BoldItalic", TextSize = 23, }, From dc3a2d45fe15aa1c8be2bda54797d7ce69eef17b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Apr 2017 13:48:43 +0900 Subject: [PATCH 110/442] Move API lookup from BeatmapDetailArea to Leaderboard. --- osu.Game/Screens/Select/BeatmapDetailArea.cs | 38 +----------------- .../Select/Leaderboards/Leaderboard.cs | 40 +++++++++++++++++++ 2 files changed, 42 insertions(+), 36 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index dae909f2b7..186739c3cb 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -1,13 +1,10 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Game.Beatmaps; -using osu.Game.Online.API; -using osu.Game.Online.API.Requests; using osu.Game.Screens.Select.Leaderboards; namespace osu.Game.Screens.Select @@ -20,8 +17,6 @@ namespace osu.Game.Screens.Select public readonly Container Details; //todo: replace with a real details view when added public readonly Leaderboard Leaderboard; - private APIAccess api; - private WorkingBeatmap beatmap; public WorkingBeatmap Beatmap { @@ -32,7 +27,7 @@ namespace osu.Game.Screens.Select set { beatmap = value; - if (IsLoaded) Schedule(updateScores); + Leaderboard.Beatmap = beatmap?.BeatmapInfo; } } @@ -56,9 +51,6 @@ namespace osu.Game.Screens.Select Leaderboard.Show(); break; } - - //for now let's always update scores. - updateScores(); }, }, content = new Container @@ -77,35 +69,9 @@ namespace osu.Game.Screens.Select Leaderboard = new Leaderboard { RelativeSizeAxes = Axes.Both, + } }); } - - protected override void LoadComplete() - { - base.LoadComplete(); - updateScores(); - } - - [BackgroundDependencyLoader(permitNulls: true)] - private void load(APIAccess api) - { - this.api = api; - } - - private GetScoresRequest getScoresRequest; - private void updateScores() - { - if (!IsLoaded) return; - - Leaderboard.Scores = null; - getScoresRequest?.Cancel(); - - if (api == null || beatmap?.BeatmapInfo == null || !Leaderboard.IsPresent) return; - - getScoresRequest = new GetScoresRequest(beatmap.BeatmapInfo); - getScoresRequest.Success += r => Leaderboard.Scores = r.Scores; - api.Queue(getScoresRequest); - } } } diff --git a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs index 12ff096d16..315611a60c 100644 --- a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs @@ -10,7 +10,11 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using System; +using osu.Framework.Allocation; +using osu.Game.Database; using osu.Game.Modes.Scoring; +using osu.Game.Online.API; +using osu.Game.Online.API.Requests; namespace osu.Game.Screens.Select.Leaderboards { @@ -26,6 +30,7 @@ namespace osu.Game.Screens.Select.Leaderboards set { scores = value; + getScoresRequest?.Cancel(); int i = 150; if (scores == null) @@ -81,6 +86,41 @@ namespace osu.Game.Screens.Select.Leaderboards }; } + private APIAccess api; + + private BeatmapInfo beatmap; + + public BeatmapInfo Beatmap + { + get { return beatmap; } + set + { + beatmap = value; + Schedule(updateScores); + } + } + + [BackgroundDependencyLoader(permitNulls: true)] + private void load(APIAccess api) + { + this.api = api; + } + + private GetScoresRequest getScoresRequest; + private void updateScores() + { + if (!IsLoaded) return; + + Scores = null; + getScoresRequest?.Cancel(); + + if (api == null || Beatmap == null) return; + + getScoresRequest = new GetScoresRequest(Beatmap); + getScoresRequest.Success += r => Scores = r.Scores; + api.Queue(getScoresRequest); + } + protected override void Update() { base.Update(); From f8c6ce15c395a6faadeaa2fde8f1c7a9d1ef6f4c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Apr 2017 13:45:16 +0900 Subject: [PATCH 111/442] Fix weird RollingCounter behaviour. --- osu.Game/Graphics/UserInterface/RollingCounter.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs index 12eeb771dd..869ee37e11 100644 --- a/osu.Game/Graphics/UserInterface/RollingCounter.cs +++ b/osu.Game/Graphics/UserInterface/RollingCounter.cs @@ -108,8 +108,6 @@ namespace osu.Game.Graphics.UserInterface { base.LoadComplete(); - Flush(false, TransformType); - DisplayedCountSpriteText.Text = FormatCount(Current); DisplayedCountSpriteText.Anchor = Anchor; DisplayedCountSpriteText.Origin = Origin; @@ -205,8 +203,8 @@ namespace osu.Game.Graphics.UserInterface ? GetProportionalDuration(currentValue, newValue) : RollingDuration; - transform.StartTime = Time.Current; - transform.EndTime = Time.Current + rollingTotalDuration; + transform.StartTime = TransformStartTime; + transform.EndTime = TransformStartTime + rollingTotalDuration; transform.StartValue = currentValue; transform.EndValue = newValue; transform.Easing = RollingEasing; From 7ca0d6d11738975945e7a2b0798e12e137badf05 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Apr 2017 16:44:12 +0900 Subject: [PATCH 112/442] Adjust cursor popin/out to make it less ugly. --- osu.Game/Graphics/Cursor/MenuCursor.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index 0fb7f59212..ceb3296bdf 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -80,14 +80,12 @@ namespace osu.Game.Graphics.Cursor protected override void PopIn() { ActiveCursor.FadeTo(1, 250, EasingTypes.OutQuint); - ActiveCursor.ScaleTo(1, 1000, EasingTypes.OutElastic); + ActiveCursor.ScaleTo(1, 400, EasingTypes.OutQuint); } protected override void PopOut() { - ActiveCursor.FadeTo(0, 1400, EasingTypes.OutQuint); - ActiveCursor.ScaleTo(1.1f, 100, EasingTypes.Out); - ActiveCursor.Delay(100); + ActiveCursor.FadeTo(0, 900, EasingTypes.OutQuint); ActiveCursor.ScaleTo(0, 500, EasingTypes.In); } From 001836f535e799545575dd6595bccb1fb359fe5c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Apr 2017 16:48:11 +0900 Subject: [PATCH 113/442] Rename variables and make public for now. --- osu.Game/Modes/Scoring/Score.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Modes/Scoring/Score.cs b/osu.Game/Modes/Scoring/Score.cs index e49907e7a8..b0c123f438 100644 --- a/osu.Game/Modes/Scoring/Score.cs +++ b/osu.Game/Modes/Scoring/Score.cs @@ -35,8 +35,8 @@ namespace osu.Game.Modes.Scoring { return user ?? new User { - Username = temporaryUsername, - Id = temporaryUserID + Username = LegacyUsername, + Id = LegacyUserID }; } @@ -55,10 +55,10 @@ namespace osu.Game.Modes.Scoring public long OnlineScoreID; [JsonProperty(@"username")] - private string temporaryUsername; + public string LegacyUsername; [JsonProperty(@"user_id")] - private long temporaryUserID; + public long LegacyUserID; [JsonProperty(@"date")] public DateTime Date; From 9732110bd95b1435ab9010217d7d509943ac27f2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Apr 2017 17:25:56 +0900 Subject: [PATCH 114/442] Update TransformTo methods in line with framework changes. --- osu.Game/Graphics/IHasAccentColour.cs | 2 +- osu.Game/Overlays/DragBar.cs | 2 +- osu.Game/Screens/Tournament/ScrollingTeamContainer.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Graphics/IHasAccentColour.cs b/osu.Game/Graphics/IHasAccentColour.cs index f959bc8760..e4647f22fd 100644 --- a/osu.Game/Graphics/IHasAccentColour.cs +++ b/osu.Game/Graphics/IHasAccentColour.cs @@ -28,7 +28,7 @@ namespace osu.Game.Graphics /// The tween easing. public static void FadeAccent(this IHasAccentColour accentedDrawable, Color4 newColour, double duration = 0, EasingTypes easing = EasingTypes.None) { - accentedDrawable.TransformTo(accentedDrawable.AccentColour, newColour, duration, easing, new TransformAccent()); + accentedDrawable.TransformTo(() => accentedDrawable.AccentColour, newColour, duration, easing, new TransformAccent()); } } } diff --git a/osu.Game/Overlays/DragBar.cs b/osu.Game/Overlays/DragBar.cs index 90991bb195..53a01c9e9c 100644 --- a/osu.Game/Overlays/DragBar.cs +++ b/osu.Game/Overlays/DragBar.cs @@ -65,7 +65,7 @@ namespace osu.Game.Overlays private void updatePosition(float position) { position = MathHelper.Clamp(position, 0, 1); - fill.TransformTo(fill.Width, position, 200, EasingTypes.OutQuint, new TransformSeek()); + fill.TransformTo(() => fill.Width, position, 200, EasingTypes.OutQuint, new TransformSeek()); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) diff --git a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs index b80f76d281..08f270741c 100644 --- a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs +++ b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs @@ -298,7 +298,7 @@ namespace osu.Game.Screens.Tournament private void speedTo(float value, double duration = 0, EasingTypes easing = EasingTypes.None) { DelayReset(); - TransformTo(speed, value, duration, easing, new TransformScrollSpeed()); + TransformTo(() => speed, value, duration, easing, new TransformScrollSpeed()); } private enum ScrollState From 7d7bea7198fd472e8c9243fef80a0ebddcbe1100 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Apr 2017 18:40:39 +0900 Subject: [PATCH 115/442] Fix crash on restart after update. Also make update process more graceful. --- osu.Desktop/Overlays/VersionManager.cs | 9 +++++++-- osu.Game/OsuGame.cs | 12 ++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index 70925f6cf4..9532652bfe 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -189,19 +189,24 @@ namespace osu.Desktop.Overlays private class UpdateProgressNotification : ProgressNotification { + private OsuGame game; + protected override Notification CreateCompletionNotification() => new ProgressCompletionNotification() { Text = @"Update ready to install. Click to restart!", Activated = () => { - UpdateManager.RestartApp(); + UpdateManager.RestartAppWhenExited(); + game.GracefullyExit(); return true; } }; [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OsuColour colours, OsuGame game) { + this.game = game; + IconContent.Add(new Drawable[] { new Box diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 7172aba3be..ccea6ef458 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -307,6 +307,18 @@ namespace osu.Game return base.OnExiting(); } + /// + /// Use to programatically exit the game as if the user was triggering via alt-f4. + /// Will keep persisting until an exit occurs (exit may be blocked multiple times). + /// + public void GracefullyExit() + { + if (!OnExiting()) + Exit(); + else + Scheduler.AddDelayed(GracefullyExit, 2000); + } + protected override void UpdateAfterChildren() { base.UpdateAfterChildren(); From c615762da6e571d127d5c92c4b2a1e20e91ad39c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 7 Apr 2017 21:20:31 +0900 Subject: [PATCH 116/442] wip --- .../UserInterface/PercentageCounter.cs | 7 ++ .../Graphics/UserInterface/RollingCounter.cs | 2 - .../Graphics/UserInterface/ScoreCounter.cs | 7 ++ .../UserInterface/SimpleComboCounter.cs | 68 +++++++++++++++++++ osu.Game/Modes/UI/HudOverlay.cs | 8 +-- osu.Game/Modes/UI/StandardHudOverlay.cs | 18 ++--- osu.Game/osu.Game.csproj | 1 + 7 files changed, 97 insertions(+), 14 deletions(-) create mode 100644 osu.Game/Graphics/UserInterface/SimpleComboCounter.cs diff --git a/osu.Game/Graphics/UserInterface/PercentageCounter.cs b/osu.Game/Graphics/UserInterface/PercentageCounter.cs index c32b654840..d9438af17e 100644 --- a/osu.Game/Graphics/UserInterface/PercentageCounter.cs +++ b/osu.Game/Graphics/UserInterface/PercentageCounter.cs @@ -5,6 +5,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Transforms; using osu.Framework.MathUtils; using System; +using osu.Framework.Allocation; namespace osu.Game.Graphics.UserInterface { @@ -30,6 +31,12 @@ namespace osu.Game.Graphics.UserInterface Current.Value = DisplayedCount = 1.0f; } + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + DisplayedCountSpriteText.Colour = colours.BlueLighter; + } + protected override string FormatCount(double count) { return $@"{count:P2}"; diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs index 12eeb771dd..4b244fc540 100644 --- a/osu.Game/Graphics/UserInterface/RollingCounter.cs +++ b/osu.Game/Graphics/UserInterface/RollingCounter.cs @@ -111,8 +111,6 @@ namespace osu.Game.Graphics.UserInterface Flush(false, TransformType); DisplayedCountSpriteText.Text = FormatCount(Current); - DisplayedCountSpriteText.Anchor = Anchor; - DisplayedCountSpriteText.Origin = Origin; } /// diff --git a/osu.Game/Graphics/UserInterface/ScoreCounter.cs b/osu.Game/Graphics/UserInterface/ScoreCounter.cs index c2b1b026b6..367e3bbb1a 100644 --- a/osu.Game/Graphics/UserInterface/ScoreCounter.cs +++ b/osu.Game/Graphics/UserInterface/ScoreCounter.cs @@ -5,6 +5,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Transforms; using osu.Framework.MathUtils; using System; +using osu.Framework.Allocation; namespace osu.Game.Graphics.UserInterface { @@ -34,6 +35,12 @@ namespace osu.Game.Graphics.UserInterface LeadingZeroes = leading; } + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + DisplayedCountSpriteText.Colour = colours.BlueLighter; + } + protected override double GetProportionalDuration(double currentValue, double newValue) { return currentValue > newValue ? currentValue - newValue : newValue - currentValue; diff --git a/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs b/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs new file mode 100644 index 0000000000..c9891885bd --- /dev/null +++ b/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs @@ -0,0 +1,68 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Transforms; +using osu.Framework.MathUtils; + +namespace osu.Game.Graphics.UserInterface +{ + /// + /// Used as an accuracy counter. Represented visually as a percentage. + /// + public class SimpleComboCounter : RollingCounter + { + protected override Type TransformType => typeof(TransformCount); + + protected override double RollingDuration => 750; + + public SimpleComboCounter() + { + Current.Value = DisplayedCount = 0; + } + + protected override string FormatCount(int count) + { + return $@"{count}x"; + } + + protected override double GetProportionalDuration(int currentValue, int newValue) + { + return Math.Abs(currentValue - newValue) * RollingDuration * 100.0f; + } + + public override void Increment(int amount) + { + Current.Value = Current + amount; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + DisplayedCountSpriteText.Colour = colours.BlueLighter; + } + + protected class TransformCount : Transform + { + public override int CurrentValue + { + get + { + double time = Time?.Current ?? 0; + if (time < StartTime) return StartValue; + if (time >= EndTime) return EndValue; + + return (int)Interpolation.ValueAt(time, StartValue, EndValue, StartTime, EndTime, Easing); + } + } + + public override void Apply(Drawable d) + { + base.Apply(d); + ((SimpleComboCounter)d).DisplayedCount = CurrentValue; + } + } + } +} \ No newline at end of file diff --git a/osu.Game/Modes/UI/HudOverlay.cs b/osu.Game/Modes/UI/HudOverlay.cs index 355b62bc57..0e1a3fb1c2 100644 --- a/osu.Game/Modes/UI/HudOverlay.cs +++ b/osu.Game/Modes/UI/HudOverlay.cs @@ -22,9 +22,9 @@ namespace osu.Game.Modes.UI private readonly Container content; public readonly KeyCounterCollection KeyCounter; - public readonly ComboCounter ComboCounter; + public readonly RollingCounter ComboCounter; public readonly ScoreCounter ScoreCounter; - public readonly PercentageCounter AccuracyCounter; + public readonly RollingCounter AccuracyCounter; public readonly HealthDisplay HealthDisplay; private Bindable showKeyCounter; @@ -33,8 +33,8 @@ namespace osu.Game.Modes.UI private static bool hasShownNotificationOnce; protected abstract KeyCounterCollection CreateKeyCounter(); - protected abstract ComboCounter CreateComboCounter(); - protected abstract PercentageCounter CreateAccuracyCounter(); + protected abstract RollingCounter CreateComboCounter(); + protected abstract RollingCounter CreateAccuracyCounter(); protected abstract ScoreCounter CreateScoreCounter(); protected abstract HealthDisplay CreateHealthDisplay(); diff --git a/osu.Game/Modes/UI/StandardHudOverlay.cs b/osu.Game/Modes/UI/StandardHudOverlay.cs index f07e421f00..87ec631b35 100644 --- a/osu.Game/Modes/UI/StandardHudOverlay.cs +++ b/osu.Game/Modes/UI/StandardHudOverlay.cs @@ -11,19 +11,22 @@ namespace osu.Game.Modes.UI { public class StandardHudOverlay : HudOverlay { - protected override PercentageCounter CreateAccuracyCounter() => new PercentageCounter + protected override RollingCounter CreateAccuracyCounter() => new PercentageCounter { Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Position = new Vector2(0, 65), + Origin = Anchor.TopRight, + Position = new Vector2(0, 35), TextSize = 20, - Margin = new MarginPadding { Right = 5 }, + Margin = new MarginPadding { Right = 140 }, }; - protected override ComboCounter CreateComboCounter() => new StandardComboCounter + protected override RollingCounter CreateComboCounter() => new SimpleComboCounter { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopLeft, + Position = new Vector2(0, 35), + Margin = new MarginPadding { Left = 140 }, + TextSize = 20, }; protected override HealthDisplay CreateHealthDisplay() => new StandardHealthDisplay @@ -49,7 +52,6 @@ namespace osu.Game.Modes.UI Origin = Anchor.TopCentre, TextSize = 40, Position = new Vector2(0, 30), - Margin = new MarginPadding { Right = 5 }, }; } } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index d90fdda41a..7b9d41a4e1 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -93,6 +93,7 @@ + From 3aefd502394a1c30ff301562795abb64ddb453a3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Apr 2017 19:19:54 +0900 Subject: [PATCH 117/442] Fix osu! mode adding combos twice. --- osu.Game.Modes.Osu/Scoring/OsuScoreProcessor.cs | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/osu.Game.Modes.Osu/Scoring/OsuScoreProcessor.cs b/osu.Game.Modes.Osu/Scoring/OsuScoreProcessor.cs index 0bd587e8ea..00c797e97d 100644 --- a/osu.Game.Modes.Osu/Scoring/OsuScoreProcessor.cs +++ b/osu.Game.Modes.Osu/Scoring/OsuScoreProcessor.cs @@ -30,21 +30,6 @@ namespace osu.Game.Modes.Osu.Scoring protected override void OnNewJudgement(OsuJudgement judgement) { - if (judgement != null) - { - switch (judgement.Result) - { - case HitResult.Hit: - Combo.Value++; - Health.Value += 0.1f; - break; - case HitResult.Miss: - Combo.Value = 0; - Health.Value -= 0.2f; - break; - } - } - int score = 0; int maxScore = 0; From 2bb50ff082b0a3a9c13e09f43320ebd80da34f43 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Apr 2017 19:21:05 +0900 Subject: [PATCH 118/442] Add commas to score counter. --- osu.Game/Graphics/UserInterface/ScoreCounter.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Graphics/UserInterface/ScoreCounter.cs b/osu.Game/Graphics/UserInterface/ScoreCounter.cs index 367e3bbb1a..a9f402b13d 100644 --- a/osu.Game/Graphics/UserInterface/ScoreCounter.cs +++ b/osu.Game/Graphics/UserInterface/ScoreCounter.cs @@ -48,7 +48,10 @@ namespace osu.Game.Graphics.UserInterface protected override string FormatCount(double count) { - return ((long)count).ToString("D" + LeadingZeroes); + string s = ((long)count).ToString("D" + LeadingZeroes); + for (int i = s.Length - 3; i > 0; i -= 3) + s = s.Insert(i, ","); + return s; } public override void Increment(double amount) From 1a2db87668d254315cbd2a1d52cbb9dc902354a3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Apr 2017 19:19:54 +0900 Subject: [PATCH 119/442] Fix osu! mode adding combos twice. --- osu.Game.Modes.Osu/Scoring/OsuScoreProcessor.cs | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/osu.Game.Modes.Osu/Scoring/OsuScoreProcessor.cs b/osu.Game.Modes.Osu/Scoring/OsuScoreProcessor.cs index 0bd587e8ea..00c797e97d 100644 --- a/osu.Game.Modes.Osu/Scoring/OsuScoreProcessor.cs +++ b/osu.Game.Modes.Osu/Scoring/OsuScoreProcessor.cs @@ -30,21 +30,6 @@ namespace osu.Game.Modes.Osu.Scoring protected override void OnNewJudgement(OsuJudgement judgement) { - if (judgement != null) - { - switch (judgement.Result) - { - case HitResult.Hit: - Combo.Value++; - Health.Value += 0.1f; - break; - case HitResult.Miss: - Combo.Value = 0; - Health.Value -= 0.2f; - break; - } - } - int score = 0; int maxScore = 0; From 9e6fa965b21003966c21372e4623280953dcf601 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Apr 2017 19:38:03 +0900 Subject: [PATCH 120/442] TestCasePlayer doesn't need a PlayerLoader. --- osu.Desktop.VisualTests/Tests/TestCasePlayer.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs index f36889b02a..624723ed35 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs @@ -83,10 +83,7 @@ namespace osu.Desktop.VisualTests.Tests Colour = Color4.Black, }); - Add(new PlayerLoader(Player = CreatePlayer(beatmap)) - { - Beatmap = beatmap - }); + Add(Player = CreatePlayer(beatmap)); } protected virtual Player CreatePlayer(WorkingBeatmap beatmap) From 1a1607aaaa0c0e240f6f0d5aa12650a556a079b1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Apr 2017 19:58:57 +0900 Subject: [PATCH 121/442] Improve the look of the transition on hotkey retry (and retry in general). --- osu.Game/Screens/Play/Player.cs | 35 ++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index a7108eda1b..94e82860f2 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -116,7 +116,12 @@ namespace osu.Game.Screens.Play scoreProcessor = HitRenderer.CreateScoreProcessor(); - hudOverlay = new StandardHudOverlay(); + hudOverlay = new StandardHudOverlay() + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre + }; + hudOverlay.KeyCounter.Add(ruleset.CreateGameplayKeys()); hudOverlay.BindProcessor(scoreProcessor); hudOverlay.BindHitRenderer(HitRenderer); @@ -160,7 +165,12 @@ namespace osu.Game.Screens.Play }, new HotkeyRetryOverlay { - Action = Restart, + Action = () => { + //we want to hide the hitrenderer immediately (looks better). + //we may be able to remove this once the mouse cursor trail is improved. + HitRenderer?.Hide(); + Restart(); + }, } }; } @@ -304,8 +314,7 @@ namespace osu.Game.Screens.Play protected override void OnSuspending(Screen next) { - Content.FadeOut(350); - Content.ScaleTo(0.7f, 750, EasingTypes.InQuint); + fadeOut(); base.OnSuspending(next); } @@ -324,14 +333,22 @@ namespace osu.Game.Screens.Play } } - HitRenderer?.FadeOut(60); - - FadeOut(250); - Content.ScaleTo(0.7f, 750, EasingTypes.InQuint); - Background?.FadeTo(1f, 200); + fadeOut(); return base.OnExiting(next); } + private void fadeOut() + { + const float fade_out_duration = 250; + + HitRenderer?.FadeOut(fade_out_duration); + Content.FadeOut(fade_out_duration); + + hudOverlay.ScaleTo(0.7f, fade_out_duration * 3, EasingTypes.In); + + Background?.FadeTo(1f, fade_out_duration); + } + private Bindable mouseWheelDisabled; protected override bool OnWheel(InputState state) => mouseWheelDisabled.Value && !IsPaused; From fb5952186c45a5526b625ae366c9d09961fcbed6 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Tue, 11 Apr 2017 14:02:56 +0200 Subject: [PATCH 122/442] changes and fixes --- .../Tests/TestCaseBeatmapDetails.cs | 12 ++++---- ...estCaseGraphAndBar.cs => TestCaseGraph.cs} | 5 ++-- .../osu.Desktop.VisualTests.csproj | 2 +- osu.Game/Database/BeatmapMetric.cs | 8 ++++-- osu.Game/Graphics/UserInterface/BarGraph.cs | 2 +- osu.Game/Screens/Select/BeatmapDetails.cs | 28 +++++++++---------- 6 files changed, 30 insertions(+), 27 deletions(-) rename osu.Desktop.VisualTests/Tests/{TestCaseGraphAndBar.cs => TestCaseGraph.cs} (84%) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs index 200c2ba786..9ea182c5c7 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs @@ -42,9 +42,9 @@ namespace osu.Desktop.VisualTests.Tests StarDifficulty = 5.3f, Metric = new BeatmapMetric { - Ratings = Enumerable.Range(0,10).ToArray(), - Fails = Enumerable.Range(lastRange, 100).Select(i => i % 12 - 6).ToArray(), - Retries = Enumerable.Range(lastRange - 3, 100).Select(i => i % 12 - 6).ToArray(), + Ratings = Enumerable.Range(0,10).ToList(), + Fails = Enumerable.Range(lastRange, 100).Select(i => i % 12 - 6).ToList(), + Retries = Enumerable.Range(lastRange - 3, 100).Select(i => i % 12 - 6).ToList(), }, }, }); @@ -74,9 +74,9 @@ namespace osu.Desktop.VisualTests.Tests StarDifficulty = 5.3f, Metric = new BeatmapMetric { - Ratings = Enumerable.Range(0, 10).ToArray(), - Fails = Enumerable.Range(lastRange, 100).Select(i => i % 12 - 6).ToArray(), - Retries = Enumerable.Range(lastRange - 3, 100).Select(i => i % 12 - 6).ToArray(), + Ratings = Enumerable.Range(0, 10).ToList(), + Fails = Enumerable.Range(lastRange, 100).Select(i => i % 12 - 6).ToList(), + Retries = Enumerable.Range(lastRange - 3, 100).Select(i => i % 12 - 6).ToList(), }, }; lastRange += 100; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs b/osu.Desktop.VisualTests/Tests/TestCaseGraph.cs similarity index 84% rename from osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs rename to osu.Desktop.VisualTests/Tests/TestCaseGraph.cs index 5ae64b5e73..7ac795f6f9 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseGraphAndBar.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseGraph.cs @@ -9,9 +9,9 @@ using System.Linq; namespace osu.Desktop.VisualTests.Tests { - internal class TestCaseGraphAndBar : TestCase + internal class TestCaseGraph : TestCase { - public override string Description => "graphs and bars, bars and graphs"; + public override string Description => "graph"; private BarGraph graph; @@ -31,6 +31,7 @@ namespace osu.Desktop.VisualTests.Tests }; AddStep("values from 1-10", () => graph.Values = Enumerable.Range(1,10).Select(i => (float)i)); + AddStep("values from 1-100", () => graph.Values = Enumerable.Range(1, 100).Select(i => (float)i)); AddStep("reversed values from 1-10", () => graph.Values = Enumerable.Range(1, 10).Reverse().Select(i => (float)i)); AddStep("Bottom to top", () => graph.Direction = BarDirection.BottomToTop); AddStep("Top to bottom", () => graph.Direction = BarDirection.TopToBottom); diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index 44d823e50d..455e04ccec 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -190,7 +190,7 @@ - + diff --git a/osu.Game/Database/BeatmapMetric.cs b/osu.Game/Database/BeatmapMetric.cs index 2302289047..6272e5d6b1 100644 --- a/osu.Game/Database/BeatmapMetric.cs +++ b/osu.Game/Database/BeatmapMetric.cs @@ -1,6 +1,8 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.Generic; + namespace osu.Game.Database { public class BeatmapMetric @@ -8,16 +10,16 @@ namespace osu.Game.Database /// /// Ratings for a beatmap, length should be 10 /// - public int[] Ratings { get; set; } + public List Ratings { get; set; } /// /// Fails for a beatmap, length should be 100 /// - public int[] Fails { get; set; } + public List Fails { get; set; } /// /// Retries for a beatmap, length should be 100 /// - public int[] Retries { get; set; } + public List Retries { get; set; } } } diff --git a/osu.Game/Graphics/UserInterface/BarGraph.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs index b29726ab1c..41a00d7fec 100644 --- a/osu.Game/Graphics/UserInterface/BarGraph.cs +++ b/osu.Game/Graphics/UserInterface/BarGraph.cs @@ -58,7 +58,7 @@ namespace osu.Game.Graphics.UserInterface Length = values[i] / (MaxValue ?? values.Max()), Direction = Direction, }); - Remove(Children.Where((bar, index) => index >= values.Count)); + Remove(Children.Where((bar, index) => index >= values.Count).ToList()); } } } diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 2414122d7b..fab36ba5a6 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -36,7 +36,7 @@ namespace osu.Game.Screens.Select private readonly OsuSpriteText positiveRatings; private readonly BarGraph ratingsGraph; - private readonly FillFlowContainer retryAndFailContainer; + private readonly FillFlowContainer retryFailContainer; private readonly BarGraph retryGraph; private readonly BarGraph failGraph; @@ -62,34 +62,34 @@ namespace osu.Game.Screens.Select approachRate.Value = beatmap.Difficulty.ApproachRate; stars.Value = (float)beatmap.StarDifficulty; - - List ratings = beatmap.Metric?.Ratings?.ToList() ?? new List(); - if (ratings.Count == 0) - ratingsContainer.Hide(); - else + if (beatmap.Metric?.Ratings.Count != 0) { + List ratings = beatmap.Metric?.Ratings; ratingsContainer.Show(); + negativeRatings.Text = ratings.GetRange(0, 5).Sum().ToString(); positiveRatings.Text = ratings.GetRange(5, 5).Sum().ToString(); ratingsBar.Length = (float)ratings.GetRange(0, 5).Sum() / ratings.Sum(); ratingsGraph.Values = ratings.Select(rating => (float)rating); } - - List retries = beatmap.Metric?.Retries?.ToList() ?? new List(); - List fails = beatmap.Metric?.Fails?.ToList() ?? new List(); - - if (fails.Count == 0 || retries.Count == 0) - retryAndFailContainer.Hide(); else + ratingsContainer.Hide(); + + if (beatmap.Metric?.Retries.Count != 0 && beatmap.Metric?.Fails.Count != 0) { - retryAndFailContainer.Show(); + List retries = beatmap.Metric?.Retries; + List fails = beatmap.Metric?.Fails; + + retryFailContainer.Show(); float maxValue = fails.Select((fail, index) => fail + retries[index]).Max(); failGraph.MaxValue = maxValue; retryGraph.MaxValue = maxValue; failGraph.Values = fails.Select(fail => (float)fail); retryGraph.Values = retries.Select((retry, index) => retry + MathHelper.Clamp(fails[index], 0, maxValue)); } + else + retryFailContainer.Hide(); } } @@ -233,7 +233,7 @@ namespace osu.Game.Screens.Select }, }, }, - retryAndFailContainer = new FillFlowContainer + retryFailContainer = new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, From bfebba3a206a7e818bf5aa3ad635d1144cd357ef Mon Sep 17 00:00:00 2001 From: Jorolf Date: Tue, 11 Apr 2017 14:12:23 +0200 Subject: [PATCH 123/442] null reference fixes --- osu.Game/Screens/Select/BeatmapDetails.cs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index fab36ba5a6..a76497b221 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -62,9 +62,11 @@ namespace osu.Game.Screens.Select approachRate.Value = beatmap.Difficulty.ApproachRate; stars.Value = (float)beatmap.StarDifficulty; - if (beatmap.Metric?.Ratings.Count != 0) + if (beatmap.Metric?.Ratings?.Count == 0) + ratingsContainer.Hide(); + else { - List ratings = beatmap.Metric?.Ratings; + List ratings = beatmap.Metric.Ratings; ratingsContainer.Show(); negativeRatings.Text = ratings.GetRange(0, 5).Sum().ToString(); @@ -73,23 +75,22 @@ namespace osu.Game.Screens.Select ratingsGraph.Values = ratings.Select(rating => (float)rating); } + + if (beatmap.Metric?.Retries?.Count == 0 && beatmap.Metric?.Fails?.Count == 0) + retryFailContainer.Hide(); else - ratingsContainer.Hide(); - - if (beatmap.Metric?.Retries.Count != 0 && beatmap.Metric?.Fails.Count != 0) { - List retries = beatmap.Metric?.Retries; - List fails = beatmap.Metric?.Fails; - + List retries = beatmap.Metric.Retries; + List fails = beatmap.Metric.Fails; retryFailContainer.Show(); + float maxValue = fails.Select((fail, index) => fail + retries[index]).Max(); failGraph.MaxValue = maxValue; retryGraph.MaxValue = maxValue; + failGraph.Values = fails.Select(fail => (float)fail); retryGraph.Values = retries.Select((retry, index) => retry + MathHelper.Clamp(fails[index], 0, maxValue)); } - else - retryFailContainer.Hide(); } } From 9dd8920c2ceda574835057667a773090ae5ae409 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Tue, 11 Apr 2017 14:22:13 +0200 Subject: [PATCH 124/442] :thinking: I hope this works --- osu.Game/Screens/Select/BeatmapDetails.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index a76497b221..811235ea13 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -62,7 +62,7 @@ namespace osu.Game.Screens.Select approachRate.Value = beatmap.Difficulty.ApproachRate; stars.Value = (float)beatmap.StarDifficulty; - if (beatmap.Metric?.Ratings?.Count == 0) + if (beatmap.Metric?.Ratings == null) ratingsContainer.Hide(); else { @@ -76,7 +76,7 @@ namespace osu.Game.Screens.Select ratingsGraph.Values = ratings.Select(rating => (float)rating); } - if (beatmap.Metric?.Retries?.Count == 0 && beatmap.Metric?.Fails?.Count == 0) + if (beatmap.Metric?.Retries == null && beatmap.Metric?.Fails == null) retryFailContainer.Hide(); else { From 9026880495e266540313d0d6e40c338f7f2fe01b Mon Sep 17 00:00:00 2001 From: Jorolf Date: Tue, 11 Apr 2017 14:40:12 +0200 Subject: [PATCH 125/442] fix --- osu.Game/Screens/Select/BeatmapDetails.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 811235ea13..559f159e49 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -76,7 +76,7 @@ namespace osu.Game.Screens.Select ratingsGraph.Values = ratings.Select(rating => (float)rating); } - if (beatmap.Metric?.Retries == null && beatmap.Metric?.Fails == null) + if (beatmap.Metric?.Retries == null || beatmap.Metric?.Fails == null) retryFailContainer.Hide(); else { From f64af9bce3b3ca839f3efebd4410028b774dc911 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Apr 2017 23:59:08 +0900 Subject: [PATCH 126/442] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 1490f00327..4caf0c918e 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 1490f003273d7aab6589e489f6e4b02d204c9f27 +Subproject commit 4caf0c918edfd9d3be0358e2b2cfc4d40908e330 From a1aed44f109c0e38d9da85bea51f2e6a4ed6094c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 12 Apr 2017 00:05:21 +0900 Subject: [PATCH 127/442] Fix health not being calculated in osu! mode (regression). --- osu.Game.Modes.Osu/Scoring/OsuScoreProcessor.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/osu.Game.Modes.Osu/Scoring/OsuScoreProcessor.cs b/osu.Game.Modes.Osu/Scoring/OsuScoreProcessor.cs index 00c797e97d..3b798a2fad 100644 --- a/osu.Game.Modes.Osu/Scoring/OsuScoreProcessor.cs +++ b/osu.Game.Modes.Osu/Scoring/OsuScoreProcessor.cs @@ -30,6 +30,19 @@ namespace osu.Game.Modes.Osu.Scoring protected override void OnNewJudgement(OsuJudgement judgement) { + if (judgement != null) + { + switch (judgement.Result) + { + case HitResult.Hit: + Health.Value += 0.1f; + break; + case HitResult.Miss: + Health.Value -= 0.2f; + break; + } + } + int score = 0; int maxScore = 0; From bc98e53aff3c5aa934942950fff73fb815a3d74f Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 12 Apr 2017 00:09:45 +0900 Subject: [PATCH 128/442] I helped. --- osu.Game/Screens/Play/Player.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 94e82860f2..e2712a64e4 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -168,7 +168,7 @@ namespace osu.Game.Screens.Play Action = () => { //we want to hide the hitrenderer immediately (looks better). //we may be able to remove this once the mouse cursor trail is improved. - HitRenderer?.Hide(); + HitRenderer?.Hide(); Restart(); }, } @@ -353,4 +353,4 @@ namespace osu.Game.Screens.Play protected override bool OnWheel(InputState state) => mouseWheelDisabled.Value && !IsPaused; } -} \ No newline at end of file +} From d4e5f550914dfb0b3f1104b1cf0ade75fc3b5802 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Tue, 11 Apr 2017 18:43:48 +0200 Subject: [PATCH 129/442] the power of linq --- .../Tests/TestCaseBeatmapDetails.cs | 32 ++++--------------- osu.Game/Database/BeatmapMetric.cs | 6 ++-- osu.Game/Graphics/UserInterface/BarGraph.cs | 17 +++++----- osu.Game/Screens/Select/BeatmapDetails.cs | 23 +++++++------ 4 files changed, 28 insertions(+), 50 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs index 9ea182c5c7..7cf42b966a 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs @@ -42,9 +42,9 @@ namespace osu.Desktop.VisualTests.Tests StarDifficulty = 5.3f, Metric = new BeatmapMetric { - Ratings = Enumerable.Range(0,10).ToList(), - Fails = Enumerable.Range(lastRange, 100).Select(i => i % 12 - 6).ToList(), - Retries = Enumerable.Range(lastRange - 3, 100).Select(i => i % 12 - 6).ToList(), + Ratings = Enumerable.Range(0,10), + Fails = Enumerable.Range(lastRange, 100).Select(i => i % 12 - 6), + Retries = Enumerable.Range(lastRange - 3, 100).Select(i => i % 12 - 6), }, }, }); @@ -56,29 +56,9 @@ namespace osu.Desktop.VisualTests.Tests private void newRetryAndFailValues() { - details.Beatmap = new BeatmapInfo - { - Version = "VisualTest", - Metadata = new BeatmapMetadata - { - Source = "Some guy", - Tags = "beatmap metadata example with a very very long list of tags and not much creativity", - }, - Difficulty = new BeatmapDifficulty - { - CircleSize = 7, - ApproachRate = 3.5f, - OverallDifficulty = 5.7f, - DrainRate = 1, - }, - StarDifficulty = 5.3f, - Metric = new BeatmapMetric - { - Ratings = Enumerable.Range(0, 10).ToList(), - Fails = Enumerable.Range(lastRange, 100).Select(i => i % 12 - 6).ToList(), - Retries = Enumerable.Range(lastRange - 3, 100).Select(i => i % 12 - 6).ToList(), - }, - }; + details.Beatmap.Metric.Fails = Enumerable.Range(lastRange, 100).Select(i => i % 12 - 6); + details.Beatmap.Metric.Retries = Enumerable.Range(lastRange - 3, 100).Select(i => i % 12 - 6); + details.Beatmap = details.Beatmap; lastRange += 100; } } diff --git a/osu.Game/Database/BeatmapMetric.cs b/osu.Game/Database/BeatmapMetric.cs index 6272e5d6b1..e40da27d1d 100644 --- a/osu.Game/Database/BeatmapMetric.cs +++ b/osu.Game/Database/BeatmapMetric.cs @@ -10,16 +10,16 @@ namespace osu.Game.Database /// /// Ratings for a beatmap, length should be 10 /// - public List Ratings { get; set; } + public IEnumerable Ratings { get; set; } /// /// Fails for a beatmap, length should be 100 /// - public List Fails { get; set; } + public IEnumerable Fails { get; set; } /// /// Retries for a beatmap, length should be 100 /// - public List Retries { get; set; } + public IEnumerable Retries { get; set; } } } diff --git a/osu.Game/Graphics/UserInterface/BarGraph.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs index 41a00d7fec..0b249d857b 100644 --- a/osu.Game/Graphics/UserInterface/BarGraph.cs +++ b/osu.Game/Graphics/UserInterface/BarGraph.cs @@ -42,23 +42,22 @@ namespace osu.Game.Graphics.UserInterface { set { - List values = value?.ToList() ?? new List(); - List graphBars = Children.ToList(); - for (int i = 0; i < values.Count; i++) - if (graphBars.Count > i) + List bars = Children.ToList(); + foreach (var bar in value.Select((length, index) => new { Value = length, Bar = bars.Count > index ? bars[index] : null })) + if (bar.Bar != null) { - graphBars[i].Length = values[i] / (MaxValue ?? values.Max()); - graphBars[i].Size = (direction & BarDirection.Horizontal) > 0 ? new Vector2(1, 1.0f / values.Count) : new Vector2(1.0f / values.Count, 1); + bar.Bar.Length = bar.Value / (MaxValue ?? value.Max()); + bar.Bar.Size = (direction & BarDirection.Horizontal) > 0 ? new Vector2(1, 1.0f / value.Count()) : new Vector2(1.0f / value.Count(), 1); } else Add(new Bar { RelativeSizeAxes = Axes.Both, - Size = (direction & BarDirection.Horizontal) > 0 ? new Vector2(1, 1.0f / values.Count) : new Vector2(1.0f / values.Count, 1), - Length = values[i] / (MaxValue ?? values.Max()), + Size = (direction & BarDirection.Horizontal) > 0 ? new Vector2(1, 1.0f / value.Count()) : new Vector2(1.0f / value.Count(), 1), + Length = bar.Value / (MaxValue ?? value.Max()), Direction = Direction, }); - Remove(Children.Where((bar, index) => index >= values.Count).ToList()); + Remove(Children.Where((bar, index) => index >= value.Count()).ToList()); } } } diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 559f159e49..b5a666e556 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -49,7 +49,6 @@ namespace osu.Game.Screens.Select } set { - if (beatmap == value) return; beatmap = value; description.Text = beatmap.Version; @@ -62,11 +61,9 @@ namespace osu.Game.Screens.Select approachRate.Value = beatmap.Difficulty.ApproachRate; stars.Value = (float)beatmap.StarDifficulty; - if (beatmap.Metric?.Ratings == null) - ratingsContainer.Hide(); - else + if (beatmap.Metric?.Ratings.Count() > 0) { - List ratings = beatmap.Metric.Ratings; + List ratings = beatmap.Metric.Ratings.ToList(); ratingsContainer.Show(); negativeRatings.Text = ratings.GetRange(0, 5).Sum().ToString(); @@ -75,22 +72,24 @@ namespace osu.Game.Screens.Select ratingsGraph.Values = ratings.Select(rating => (float)rating); } - - if (beatmap.Metric?.Retries == null || beatmap.Metric?.Fails == null) - retryFailContainer.Hide(); else + ratingsContainer.Hide(); + + if (beatmap.Metric?.Retries.Count() > 0 && beatmap.Metric?.Retries.Count() > 0) { - List retries = beatmap.Metric.Retries; - List fails = beatmap.Metric.Fails; + IEnumerable retries = beatmap.Metric.Retries; + IEnumerable fails = beatmap.Metric.Fails; retryFailContainer.Show(); - float maxValue = fails.Select((fail, index) => fail + retries[index]).Max(); + float maxValue = fails.Zip(retries, (fail, retry) => fail + retry).Max(); failGraph.MaxValue = maxValue; retryGraph.MaxValue = maxValue; failGraph.Values = fails.Select(fail => (float)fail); - retryGraph.Values = retries.Select((retry, index) => retry + MathHelper.Clamp(fails[index], 0, maxValue)); + retryGraph.Values = retries.Zip(fails, (retry, fail) => retry + MathHelper.Clamp(fail, 0, maxValue)); } + else + retryFailContainer.Hide(); } } From ed2f5d210efe96beac035156f46d5d7c0a2a838c Mon Sep 17 00:00:00 2001 From: Jorolf Date: Tue, 11 Apr 2017 22:48:53 +0200 Subject: [PATCH 130/442] condensed some commits because they were small or already reversed --- osu.Game/Graphics/UserInterface/BarGraph.cs | 1 + osu.Game/Screens/Select/BeatmapDetailArea.cs | 2 +- osu.Game/Screens/Select/BeatmapDetails.cs | 14 +++++++------- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/BarGraph.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs index 0b249d857b..d0965a1861 100644 --- a/osu.Game/Graphics/UserInterface/BarGraph.cs +++ b/osu.Game/Graphics/UserInterface/BarGraph.cs @@ -57,6 +57,7 @@ namespace osu.Game.Graphics.UserInterface Length = bar.Value / (MaxValue ?? value.Max()), Direction = Direction, }); + //I'm using ToList() here because Where() returns an Enumerable which can change it's elements afterwards Remove(Children.Where((bar, index) => index >= value.Count()).ToList()); } } diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index 23d40e0260..ae117254fa 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -28,7 +28,7 @@ namespace osu.Game.Screens.Select { beatmap = value; Leaderboard.Beatmap = beatmap?.BeatmapInfo; - Details.Beatmap = beatmap.Beatmap.BeatmapInfo; + Details.Beatmap = beatmap?.Beatmap.BeatmapInfo; } } diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index b5a666e556..6f6b2f5880 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -12,7 +12,6 @@ using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; -using System.Collections.Generic; using System.Globalization; using System.Linq; @@ -50,6 +49,7 @@ namespace osu.Game.Screens.Select set { beatmap = value; + if (beatmap == null) return; description.Text = beatmap.Version; source.Text = beatmap.Metadata.Source; @@ -61,9 +61,9 @@ namespace osu.Game.Screens.Select approachRate.Value = beatmap.Difficulty.ApproachRate; stars.Value = (float)beatmap.StarDifficulty; - if (beatmap.Metric?.Ratings.Count() > 0) + if (beatmap.Metric?.Ratings.Count() == 10) { - List ratings = beatmap.Metric.Ratings.ToList(); + var ratings = beatmap.Metric.Ratings.ToList(); ratingsContainer.Show(); negativeRatings.Text = ratings.GetRange(0, 5).Sum().ToString(); @@ -75,10 +75,10 @@ namespace osu.Game.Screens.Select else ratingsContainer.Hide(); - if (beatmap.Metric?.Retries.Count() > 0 && beatmap.Metric?.Retries.Count() > 0) + if (beatmap.Metric?.Retries.Count() == 100 && beatmap.Metric?.Fails.Count() == 100) { - IEnumerable retries = beatmap.Metric.Retries; - IEnumerable fails = beatmap.Metric.Fails; + var retries = beatmap.Metric.Retries; + var fails = beatmap.Metric.Fails; retryFailContainer.Show(); float maxValue = fails.Zip(retries, (fail, retry) => fail + retry).Max(); @@ -111,7 +111,7 @@ namespace osu.Game.Screens.Select AutoSizeAxes = Axes.Y, Width = 0.4f, Direction = FillDirection.Vertical, - LayoutDuration = 1, + LayoutDuration = 200, LayoutEasing = EasingTypes.OutQuint, Padding = new MarginPadding(10) { Top = 25 }, Children = new [] From 50cb9e0fe7968a1f74e758163b080b0aeceb87ea Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Tue, 11 Apr 2017 18:07:54 -0500 Subject: [PATCH 131/442] Match stable search parameters --- osu.Game/Screens/Select/FilterCriteria.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/FilterCriteria.cs b/osu.Game/Screens/Select/FilterCriteria.cs index acf0954418..2654129a44 100644 --- a/osu.Game/Screens/Select/FilterCriteria.cs +++ b/osu.Game/Screens/Select/FilterCriteria.cs @@ -31,7 +31,9 @@ namespace osu.Game.Screens.Select || (set.Metadata.Artist ?? string.Empty).IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) != -1 || (set.Metadata.ArtistUnicode ?? string.Empty).IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) != -1 || (set.Metadata.Title ?? string.Empty).IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) != -1 - || (set.Metadata.TitleUnicode ?? string.Empty).IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) != -1; + || (set.Metadata.TitleUnicode ?? string.Empty).IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) != -1 + || (set.Metadata.Tags ?? string.Empty).IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) != -1 + || (set.Metadata.Source ?? string.Empty).IndexOf(SearchText, StringComparison.InvariantCultureIgnoreCase) != -1; switch (g.State) { From dffdb100ab877d6eb241632564886cea37e52dd9 Mon Sep 17 00:00:00 2001 From: Poliwrath Date: Tue, 11 Apr 2017 21:35:49 -0400 Subject: [PATCH 132/442] Small fix to the chat overlay to prevent crashing on the test --- osu.Game/Overlays/ChatOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 0bb3d3dc71..fc12789b05 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -93,7 +93,7 @@ namespace osu.Game.Overlays { var postText = sender.Text; - if (!string.IsNullOrEmpty(postText)) + if (!string.IsNullOrEmpty(postText) && api.LocalUser.Value != null) { //todo: actually send to server careChannels.FirstOrDefault()?.AddNewMessages(new[] From 4e2ae72126c304ccbaa69d9ef170370be53889c2 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 12 Apr 2017 12:03:51 +0900 Subject: [PATCH 133/442] Implement proper masking support for taiko hit objects. --- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 36 ++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index db3a1bc84e..5e5344eb6f 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -17,6 +17,7 @@ using osu.Framework.Graphics.Primitives; using System.Linq; using osu.Game.Modes.Taiko.Objects.Drawables; using System; +using osu.Framework.Graphics.OpenGL; namespace osu.Game.Modes.Taiko.UI { @@ -111,9 +112,11 @@ namespace osu.Game.Modes.Taiko.UI Anchor = Anchor.CentreLeft, Origin = Anchor.Centre, }, - hitObjectContainer = new Container + hitObjectContainer = new ExternalMaskingRectangleContainer { RelativeSizeAxes = Axes.Both, + Masking = true, + MaskingReference = () => this }, judgementContainer = new Container { @@ -269,5 +272,36 @@ namespace osu.Game.Modes.Taiko.UI } } } + + private class ExternalMaskingRectangleContainer : Container + { + public Func MaskingReference; + + protected override void ApplyDrawNode(DrawNode node) + { + base.ApplyDrawNode(node); + + Drawable maskingReference = MaskingReference?.Invoke(); + + if (MaskingReference == null) + return; + + var cn = node as ContainerDrawNode; + + cn.MaskingInfo = !Masking + ? (MaskingInfo?)null + : new MaskingInfo + { + ScreenSpaceAABB = maskingReference.ScreenSpaceDrawQuad.AABB, + MaskingRect = maskingReference.DrawRectangle, + ToMaskingSpace = cn.MaskingInfo.Value.ToMaskingSpace, + CornerRadius = cn.MaskingInfo.Value.CornerRadius, + BorderThickness = cn.MaskingInfo.Value.BorderThickness, + BorderColour = cn.MaskingInfo.Value.BorderColour, + BlendRange = cn.MaskingInfo.Value.BlendRange, + AlphaExponent = cn.MaskingInfo.Value.AlphaExponent + }; + } + } } } \ No newline at end of file From a922e677547210566ebf3441a3b6987093f200ea Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 12 Apr 2017 12:04:23 +0900 Subject: [PATCH 134/442] Because Ruleset only exposes HitRenderer, we need to have AspectAdjust in the base class. --- osu.Game/Modes/UI/HitRenderer.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Modes/UI/HitRenderer.cs b/osu.Game/Modes/UI/HitRenderer.cs index afc525d686..dd5eff5a95 100644 --- a/osu.Game/Modes/UI/HitRenderer.cs +++ b/osu.Game/Modes/UI/HitRenderer.cs @@ -33,6 +33,11 @@ namespace osu.Game.Modes.UI /// public event Action OnAllJudged; + /// + /// Whether to apply adjustments to the child based on our own size. + /// + public bool AspectAdjust = true; + /// /// The input manager for this HitRenderer. /// @@ -168,11 +173,6 @@ namespace osu.Game.Modes.UI { public event Action OnJudgement; - /// - /// Whether to apply adjustments to the child based on our own size. - /// - public bool AspectAdjust = true; - public sealed override bool ProvidingUserCursor => !HasReplayLoaded && Playfield.ProvidingUserCursor; protected override Container Content => content; From d6fa51dc5cf355168babe725dd87224a39bd894d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 12 Apr 2017 12:06:24 +0900 Subject: [PATCH 135/442] Update SliderBar to use OnUserChange method. --- .../Graphics/UserInterface/OsuSliderBar.cs | 37 ++++++------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index 91fb1c672a..38cf8dcef9 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -63,15 +63,6 @@ namespace osu.Game.Graphics.UserInterface rightBox.Colour = colours.Pink; } - private void playSample() - { - if (Clock == null || Clock.CurrentTime - lastSampleTime <= 50) - return; - lastSampleTime = Clock.CurrentTime; - sample.Frequency.Value = 1 + NormalizedValue * 0.2f; - sample.Play(); - } - protected override bool OnHover(InputState state) { nub.Glowing = true; @@ -84,11 +75,19 @@ namespace osu.Game.Graphics.UserInterface base.OnHoverLost(state); } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override void OnUserChange() { - if (args.Key == Key.Left || args.Key == Key.Right) - playSample(); - return base.OnKeyDown(state, args); + base.OnUserChange(); + playSample(); + } + + private void playSample() + { + if (Clock == null || Clock.CurrentTime - lastSampleTime <= 50) + return; + lastSampleTime = Clock.CurrentTime; + sample.Frequency.Value = 1 + NormalizedValue * 0.2f; + sample.Play(); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) @@ -103,18 +102,6 @@ namespace osu.Game.Graphics.UserInterface return base.OnMouseUp(state, args); } - protected override bool OnClick(InputState state) - { - playSample(); - return base.OnClick(state); - } - - protected override bool OnDrag(InputState state) - { - playSample(); - return base.OnDrag(state); - } - protected override void UpdateAfterChildren() { base.UpdateAfterChildren(); From 2964c04c148b5c1fc39b469de5bdbcf76edd1b49 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 12 Apr 2017 12:06:56 +0900 Subject: [PATCH 136/442] Add special SliderBar sound behaviour when at extents. --- osu.Game/Graphics/UserInterface/OsuSliderBar.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index 38cf8dcef9..9781a507cc 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -87,6 +87,17 @@ namespace osu.Game.Graphics.UserInterface return; lastSampleTime = Clock.CurrentTime; sample.Frequency.Value = 1 + NormalizedValue * 0.2f; + + switch (NormalizedValue) + { + case 0: + sample.Frequency.Value -= 0.4f; + break; + case 1: + sample.Frequency.Value += 0.4f; + break; + } + sample.Play(); } From 0c90ef79fa7e710253a48bae685ed5480c5fca47 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 12 Apr 2017 12:36:31 +0900 Subject: [PATCH 137/442] Make TestCaseTaikoPlayfield work again. --- .../Tests/TestCaseTaikoPlayfield.cs | 14 +++++++++----- osu.Game/Modes/UI/Playfield.cs | 3 +++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index a8e4382ebb..e886af6b83 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -27,6 +27,7 @@ namespace osu.Desktop.VisualTests.Tests private readonly Random rng = new Random(1337); private TaikoPlayfield playfield; + private Container playfieldContainer; public override void Reset() { @@ -51,11 +52,14 @@ namespace osu.Desktop.VisualTests.Tests var rateAdjustClock = new StopwatchClock(true) { Rate = 1 }; - Add(new Container + Add(playfieldContainer = new Container { - Clock = new FramedClock(rateAdjustClock), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, RelativeSizeAxes = Axes.X, - Y = 200, + Height = TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT, + Width = 0.8f, + Clock = new FramedClock(rateAdjustClock), Children = new[] { playfield = new TaikoPlayfield() @@ -81,11 +85,11 @@ namespace osu.Desktop.VisualTests.Tests break; case 5: addSwell(1000); - playfield.Delay(scroll_time - 100); + playfieldContainer.Delay(scroll_time - 100); break; } - playfield.ResizeTo(new Vector2(1, rng.Next(25, 400)), 500); + playfieldContainer.ResizeTo(new Vector2(1, rng.Next(25, 400)), 500); } private void addHitJudgement() diff --git a/osu.Game/Modes/UI/Playfield.cs b/osu.Game/Modes/UI/Playfield.cs index bf5f0acde5..e8e53ab1f0 100644 --- a/osu.Game/Modes/UI/Playfield.cs +++ b/osu.Game/Modes/UI/Playfield.cs @@ -38,6 +38,9 @@ namespace osu.Game.Modes.UI protected Playfield(float? customWidth = null) { AlwaysReceiveInput = true; + + // Default height since we force RelativeSizeAxes = Both + Size = Vector2.One; AddInternal(ScaledContent = new ScaledContainer { From 04baa9eb7227f94b8de0bf979449d4df01556300 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 12 Apr 2017 12:37:20 +0900 Subject: [PATCH 138/442] Reset stage to normal height after tests. --- .../Tests/TestCaseTaikoPlayfield.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index e886af6b83..a79790f8f8 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -49,6 +49,7 @@ namespace osu.Desktop.VisualTests.Tests AddStep("Height test 3", () => changePlayfieldSize(3)); AddStep("Height test 4", () => changePlayfieldSize(4)); AddStep("Height test 5", () => changePlayfieldSize(5)); + AddStep("Reset height", () => changePlayfieldSize(6)); var rateAdjustClock = new StopwatchClock(true) { Rate = 1 }; @@ -69,6 +70,7 @@ namespace osu.Desktop.VisualTests.Tests private void changePlayfieldSize(int step) { + // Add new hits switch (step) { case 1: @@ -89,7 +91,16 @@ namespace osu.Desktop.VisualTests.Tests break; } + // Tween playfield height + switch (step) + { + default: playfieldContainer.ResizeTo(new Vector2(1, rng.Next(25, 400)), 500); + break; + case 6: + playfieldContainer.ResizeTo(new Vector2(1, TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT), 500); + break; + } } private void addHitJudgement() From 5d5040ee7326ff389e75d22b8949bd135fca6a6b Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 12 Apr 2017 14:34:49 +0900 Subject: [PATCH 139/442] Better masking. --- .../Tests/TestCaseTaikoPlayfield.cs | 8 ++- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 53 +++++++------------ 2 files changed, 26 insertions(+), 35 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index a79790f8f8..c8c264083c 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -4,6 +4,7 @@ using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Primitives; using osu.Framework.MathUtils; using osu.Framework.Testing; using osu.Framework.Timing; @@ -63,7 +64,12 @@ namespace osu.Desktop.VisualTests.Tests Clock = new FramedClock(rateAdjustClock), Children = new[] { - playfield = new TaikoPlayfield() + playfield = new TaikoPlayfield + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Height = 0.75f + } } }); } diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index 5e5344eb6f..eccf4aff09 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -53,6 +53,8 @@ namespace osu.Game.Modes.Taiko.UI public TaikoPlayfield() { + Masking = true; + AddInternal(new Drawable[] { rightBackgroundContainer = new Container @@ -112,11 +114,9 @@ namespace osu.Game.Modes.Taiko.UI Anchor = Anchor.CentreLeft, Origin = Anchor.Centre, }, - hitObjectContainer = new ExternalMaskingRectangleContainer + hitObjectContainer = new Container { RelativeSizeAxes = Axes.Both, - Masking = true, - MaskingReference = () => this }, judgementContainer = new Container { @@ -222,6 +222,22 @@ namespace osu.Game.Modes.Taiko.UI hitExplosionContainer.Children.FirstOrDefault(e => e.Judgement == judgedObject.Judgement)?.VisualiseSecondHit(); } + protected override void ApplyDrawNode(DrawNode node) + { + base.ApplyDrawNode(node); + + var cn = node as ContainerDrawNode; + + if (!Masking) + return; + + MaskingInfo old = cn.MaskingInfo.Value; + old.MaskingRect = new RectangleF(old.MaskingRect.X, old.MaskingRect.Y - 2000, old.MaskingRect.Width, old.MaskingRect.Height + 4000); + old.ScreenSpaceAABB = new System.Drawing.Rectangle(old.ScreenSpaceAABB.X, old.ScreenSpaceAABB.Y - 2000, old.ScreenSpaceAABB.Width, old.ScreenSpaceAABB.Height + 4000); + + cn.MaskingInfo = old; + } + /// /// This is a very special type of container. It serves a similar purpose to , however unlike , /// this will only adjust the scale relative to the height of its parent and will maintain the original width relative to its parent. @@ -272,36 +288,5 @@ namespace osu.Game.Modes.Taiko.UI } } } - - private class ExternalMaskingRectangleContainer : Container - { - public Func MaskingReference; - - protected override void ApplyDrawNode(DrawNode node) - { - base.ApplyDrawNode(node); - - Drawable maskingReference = MaskingReference?.Invoke(); - - if (MaskingReference == null) - return; - - var cn = node as ContainerDrawNode; - - cn.MaskingInfo = !Masking - ? (MaskingInfo?)null - : new MaskingInfo - { - ScreenSpaceAABB = maskingReference.ScreenSpaceDrawQuad.AABB, - MaskingRect = maskingReference.DrawRectangle, - ToMaskingSpace = cn.MaskingInfo.Value.ToMaskingSpace, - CornerRadius = cn.MaskingInfo.Value.CornerRadius, - BorderThickness = cn.MaskingInfo.Value.BorderThickness, - BorderColour = cn.MaskingInfo.Value.BorderColour, - BlendRange = cn.MaskingInfo.Value.BlendRange, - AlphaExponent = cn.MaskingInfo.Value.AlphaExponent - }; - } - } } } \ No newline at end of file From 7a24e5f5090a5bfe0c7b80bde70d15be187f7b82 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 12 Apr 2017 15:00:18 +0900 Subject: [PATCH 140/442] Revert "Implement proper masking support for taiko hit objects." This reverts commit 4e2ae72126c304ccbaa69d9ef170370be53889c2. --- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index eccf4aff09..cc5dad84cd 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -17,7 +17,6 @@ using osu.Framework.Graphics.Primitives; using System.Linq; using osu.Game.Modes.Taiko.Objects.Drawables; using System; -using osu.Framework.Graphics.OpenGL; namespace osu.Game.Modes.Taiko.UI { From 32c3e34eb77758f4f03fe5671ae2380417ef3fd5 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 12 Apr 2017 15:00:26 +0900 Subject: [PATCH 141/442] Revert "Better masking." This reverts commit 5d5040ee7326ff389e75d22b8949bd135fca6a6b. --- .../Tests/TestCaseTaikoPlayfield.cs | 8 +-- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 53 ++++++++++++------- 2 files changed, 35 insertions(+), 26 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index c8c264083c..a79790f8f8 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -4,7 +4,6 @@ using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Primitives; using osu.Framework.MathUtils; using osu.Framework.Testing; using osu.Framework.Timing; @@ -64,12 +63,7 @@ namespace osu.Desktop.VisualTests.Tests Clock = new FramedClock(rateAdjustClock), Children = new[] { - playfield = new TaikoPlayfield - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Height = 0.75f - } + playfield = new TaikoPlayfield() } }); } diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index cc5dad84cd..a809cf338d 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -52,8 +52,6 @@ namespace osu.Game.Modes.Taiko.UI public TaikoPlayfield() { - Masking = true; - AddInternal(new Drawable[] { rightBackgroundContainer = new Container @@ -113,9 +111,11 @@ namespace osu.Game.Modes.Taiko.UI Anchor = Anchor.CentreLeft, Origin = Anchor.Centre, }, - hitObjectContainer = new Container + hitObjectContainer = new ExternalMaskingRectangleContainer { RelativeSizeAxes = Axes.Both, + Masking = true, + MaskingReference = () => this }, judgementContainer = new Container { @@ -221,22 +221,6 @@ namespace osu.Game.Modes.Taiko.UI hitExplosionContainer.Children.FirstOrDefault(e => e.Judgement == judgedObject.Judgement)?.VisualiseSecondHit(); } - protected override void ApplyDrawNode(DrawNode node) - { - base.ApplyDrawNode(node); - - var cn = node as ContainerDrawNode; - - if (!Masking) - return; - - MaskingInfo old = cn.MaskingInfo.Value; - old.MaskingRect = new RectangleF(old.MaskingRect.X, old.MaskingRect.Y - 2000, old.MaskingRect.Width, old.MaskingRect.Height + 4000); - old.ScreenSpaceAABB = new System.Drawing.Rectangle(old.ScreenSpaceAABB.X, old.ScreenSpaceAABB.Y - 2000, old.ScreenSpaceAABB.Width, old.ScreenSpaceAABB.Height + 4000); - - cn.MaskingInfo = old; - } - /// /// This is a very special type of container. It serves a similar purpose to , however unlike , /// this will only adjust the scale relative to the height of its parent and will maintain the original width relative to its parent. @@ -287,5 +271,36 @@ namespace osu.Game.Modes.Taiko.UI } } } + + private class ExternalMaskingRectangleContainer : Container + { + public Func MaskingReference; + + protected override void ApplyDrawNode(DrawNode node) + { + base.ApplyDrawNode(node); + + Drawable maskingReference = MaskingReference?.Invoke(); + + if (MaskingReference == null) + return; + + var cn = node as ContainerDrawNode; + + cn.MaskingInfo = !Masking + ? (MaskingInfo?)null + : new MaskingInfo + { + ScreenSpaceAABB = maskingReference.ScreenSpaceDrawQuad.AABB, + MaskingRect = maskingReference.DrawRectangle, + ToMaskingSpace = cn.MaskingInfo.Value.ToMaskingSpace, + CornerRadius = cn.MaskingInfo.Value.CornerRadius, + BorderThickness = cn.MaskingInfo.Value.BorderThickness, + BorderColour = cn.MaskingInfo.Value.BorderColour, + BlendRange = cn.MaskingInfo.Value.BlendRange, + AlphaExponent = cn.MaskingInfo.Value.AlphaExponent + }; + } + } } } \ No newline at end of file From 50a598dd05cbd3dd77a8cdea41a647c42f7ad438 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 12 Apr 2017 15:01:17 +0900 Subject: [PATCH 142/442] Revert another masking container. --- .../Tests/TestCaseTaikoPlayfield.cs | 1 - osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 35 +------------------ 2 files changed, 1 insertion(+), 35 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index a79790f8f8..4e9ff4980e 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -59,7 +59,6 @@ namespace osu.Desktop.VisualTests.Tests Origin = Anchor.Centre, RelativeSizeAxes = Axes.X, Height = TaikoPlayfield.DEFAULT_PLAYFIELD_HEIGHT, - Width = 0.8f, Clock = new FramedClock(rateAdjustClock), Children = new[] { diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index a809cf338d..db3a1bc84e 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -111,11 +111,9 @@ namespace osu.Game.Modes.Taiko.UI Anchor = Anchor.CentreLeft, Origin = Anchor.Centre, }, - hitObjectContainer = new ExternalMaskingRectangleContainer + hitObjectContainer = new Container { RelativeSizeAxes = Axes.Both, - Masking = true, - MaskingReference = () => this }, judgementContainer = new Container { @@ -271,36 +269,5 @@ namespace osu.Game.Modes.Taiko.UI } } } - - private class ExternalMaskingRectangleContainer : Container - { - public Func MaskingReference; - - protected override void ApplyDrawNode(DrawNode node) - { - base.ApplyDrawNode(node); - - Drawable maskingReference = MaskingReference?.Invoke(); - - if (MaskingReference == null) - return; - - var cn = node as ContainerDrawNode; - - cn.MaskingInfo = !Masking - ? (MaskingInfo?)null - : new MaskingInfo - { - ScreenSpaceAABB = maskingReference.ScreenSpaceDrawQuad.AABB, - MaskingRect = maskingReference.DrawRectangle, - ToMaskingSpace = cn.MaskingInfo.Value.ToMaskingSpace, - CornerRadius = cn.MaskingInfo.Value.CornerRadius, - BorderThickness = cn.MaskingInfo.Value.BorderThickness, - BorderColour = cn.MaskingInfo.Value.BorderColour, - BlendRange = cn.MaskingInfo.Value.BlendRange, - AlphaExponent = cn.MaskingInfo.Value.AlphaExponent - }; - } - } } } \ No newline at end of file From f8076ec79252132b62c509e5986dcae0ba463e5b Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 12 Apr 2017 15:04:11 +0900 Subject: [PATCH 143/442] Better comment. --- osu.Game/Modes/UI/Playfield.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Modes/UI/Playfield.cs b/osu.Game/Modes/UI/Playfield.cs index e8e53ab1f0..27bc3baa3e 100644 --- a/osu.Game/Modes/UI/Playfield.cs +++ b/osu.Game/Modes/UI/Playfield.cs @@ -39,7 +39,7 @@ namespace osu.Game.Modes.UI { AlwaysReceiveInput = true; - // Default height since we force RelativeSizeAxes = Both + // Default height since we force relative size axes Size = Vector2.One; AddInternal(ScaledContent = new ScaledContainer From 6ab274abc0cd5f4128ac07976753c9c50188182f Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 12 Apr 2017 15:06:46 +0900 Subject: [PATCH 144/442] Trim whitespace --- osu.Game/Modes/UI/Playfield.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Modes/UI/Playfield.cs b/osu.Game/Modes/UI/Playfield.cs index 27bc3baa3e..1e7cf6579c 100644 --- a/osu.Game/Modes/UI/Playfield.cs +++ b/osu.Game/Modes/UI/Playfield.cs @@ -38,7 +38,7 @@ namespace osu.Game.Modes.UI protected Playfield(float? customWidth = null) { AlwaysReceiveInput = true; - + // Default height since we force relative size axes Size = Vector2.One; From 8cad09370d527dd421c2383790459f1fc258943e Mon Sep 17 00:00:00 2001 From: ocboogie Date: Wed, 12 Apr 2017 00:20:41 -0700 Subject: [PATCH 145/442] Fixed pause and fail screen overlap --- osu.Game/Screens/Play/Player.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index e2712a64e4..2a18d44248 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -273,6 +273,11 @@ namespace osu.Game.Screens.Play private void onFail() { + if (IsPaused) + { + pauseOverlay.Hide(); + IsPaused = false; + } sourceClock.Stop(); Delay(500); From d2affe68675131ced3e0354607c4bb917e01bf5b Mon Sep 17 00:00:00 2001 From: Jorolf Date: Wed, 12 Apr 2017 10:52:24 +0200 Subject: [PATCH 146/442] requested changes --- osu.Game/Graphics/UserInterface/Bar.cs | 1 + osu.Game/Screens/Select/BeatmapDetails.cs | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/Bar.cs b/osu.Game/Graphics/UserInterface/Bar.cs index 07aafbb655..76b75f1084 100644 --- a/osu.Game/Graphics/UserInterface/Bar.cs +++ b/osu.Game/Graphics/UserInterface/Bar.cs @@ -86,6 +86,7 @@ namespace osu.Game.Graphics.UserInterface bar = new Box { RelativeSizeAxes = Axes.Both, + Width = 0, }, }; } diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 6f6b2f5880..990ecabdb5 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -180,7 +180,12 @@ namespace osu.Game.Screens.Select RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, - Padding = new MarginPadding(15) { Top = 25, Bottom = 0 }, + Padding = new MarginPadding + { + Top = 25, + Left = 15, + Right = 15, + }, Children = new Drawable[] { new OsuSpriteText @@ -194,7 +199,6 @@ namespace osu.Game.Screens.Select { RelativeSizeAxes = Axes.X, Height = 5, - Length = 0, }, new Container { From e285d33f8cfe0658f458541805a32a3f7d775a14 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Wed, 12 Apr 2017 11:05:10 +0200 Subject: [PATCH 147/442] fails, retries and size not enforced --- osu.Game/Screens/Select/BeatmapDetails.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 990ecabdb5..1479ef35ce 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -61,21 +61,21 @@ namespace osu.Game.Screens.Select approachRate.Value = beatmap.Difficulty.ApproachRate; stars.Value = (float)beatmap.StarDifficulty; - if (beatmap.Metric?.Ratings.Count() == 10) + if (beatmap.Metric?.Ratings.Any() ?? false) { var ratings = beatmap.Metric.Ratings.ToList(); ratingsContainer.Show(); - negativeRatings.Text = ratings.GetRange(0, 5).Sum().ToString(); - positiveRatings.Text = ratings.GetRange(5, 5).Sum().ToString(); - ratingsBar.Length = (float)ratings.GetRange(0, 5).Sum() / ratings.Sum(); + negativeRatings.Text = ratings.GetRange(0, ratings.Count / 2).Sum().ToString(); + positiveRatings.Text = ratings.GetRange(ratings.Count / 2, ratings.Count / 2).Sum().ToString(); + ratingsBar.Length = (float)ratings.GetRange(0, ratings.Count / 2).Sum() / ratings.Sum(); ratingsGraph.Values = ratings.Select(rating => (float)rating); } else ratingsContainer.Hide(); - if (beatmap.Metric?.Retries.Count() == 100 && beatmap.Metric?.Fails.Count() == 100) + if ((beatmap.Metric?.Retries.Any() ?? false) && (beatmap.Metric?.Fails.Any() ?? false)) { var retries = beatmap.Metric.Retries; var fails = beatmap.Metric.Fails; From 98ce9e072410554620f4082748d4f4d209cc65e4 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Wed, 12 Apr 2017 11:25:32 +0200 Subject: [PATCH 148/442] remove ?? --- osu.Game/Screens/Select/BeatmapDetails.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 1479ef35ce..0d3a9ba9ee 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -75,7 +75,7 @@ namespace osu.Game.Screens.Select else ratingsContainer.Hide(); - if ((beatmap.Metric?.Retries.Any() ?? false) && (beatmap.Metric?.Fails.Any() ?? false)) + if ((beatmap.Metric?.Retries.Any() ?? false) && beatmap.Metric.Fails.Any()) { var retries = beatmap.Metric.Retries; var fails = beatmap.Metric.Fails; From 348dd7140662e164d103afeda23c621363c1e443 Mon Sep 17 00:00:00 2001 From: ocboogie Date: Wed, 12 Apr 2017 02:43:42 -0700 Subject: [PATCH 149/442] Fixed repeat keys working for resuming --- osu.Game/Screens/Play/PauseOverlay.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Play/PauseOverlay.cs b/osu.Game/Screens/Play/PauseOverlay.cs index f9706d263e..6088e2fea5 100644 --- a/osu.Game/Screens/Play/PauseOverlay.cs +++ b/osu.Game/Screens/Play/PauseOverlay.cs @@ -20,6 +20,7 @@ namespace osu.Game.Screens.Play protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { + if (args.Repeat) return false; if (args.Key == Key.Escape) { if (State == Visibility.Hidden) return false; From d250dde537ff671321c5f845da50cff64790af58 Mon Sep 17 00:00:00 2001 From: ocboogie Date: Wed, 12 Apr 2017 02:50:03 -0700 Subject: [PATCH 150/442] Fixed repeat keys working for retrying --- osu.Game/Screens/Play/FailOverlay.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Play/FailOverlay.cs b/osu.Game/Screens/Play/FailOverlay.cs index 7a32e19338..1cd34e45e7 100644 --- a/osu.Game/Screens/Play/FailOverlay.cs +++ b/osu.Game/Screens/Play/FailOverlay.cs @@ -17,6 +17,7 @@ namespace osu.Game.Screens.Play public override string Description => "you're dead, try again?"; protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { + if (args.Repeat) return false; if (args.Key == Key.Escape) { if (State == Visibility.Hidden) return false; From c0338a82e76424fafc128c72d63491b8a12b5d7e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 12 Apr 2017 19:20:30 +0900 Subject: [PATCH 151/442] Update nuget packages. Includes fix in OpenTK for focus issues. --- osu-framework | 2 +- osu.Desktop.Deploy/App.config | 12 ++++++++++++ osu.Desktop.Deploy/osu.Desktop.Deploy.csproj | 7 +++---- osu.Desktop.Deploy/packages.config | 2 +- osu.Desktop.Tests/osu.Desktop.Tests.csproj | 11 +++++------ osu.Desktop.Tests/packages.config | 5 ++--- .../osu.Desktop.VisualTests.csproj | 16 +++++++--------- osu.Desktop.VisualTests/packages.config | 6 +++--- osu.Desktop/osu.Desktop.csproj | 3 +-- osu.Desktop/packages.config | 2 +- osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj | 5 ++--- osu.Game.Modes.Catch/packages.config | 2 +- osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj | 5 ++--- osu.Game.Modes.Mania/packages.config | 2 +- osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj | 5 ++--- osu.Game.Modes.Osu/packages.config | 2 +- osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj | 5 ++--- osu.Game.Modes.Taiko/packages.config | 2 +- osu.Game.Tests/osu.Game.Tests.csproj | 8 +++----- osu.Game.Tests/packages.config | 5 ++--- osu.Game/osu.Game.csproj | 15 ++++++--------- osu.Game/packages.config | 7 +++---- 22 files changed, 62 insertions(+), 67 deletions(-) diff --git a/osu-framework b/osu-framework index 4caf0c918e..34ac837eeb 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 4caf0c918edfd9d3be0358e2b2cfc4d40908e330 +Subproject commit 34ac837eebeecd0b6f35829780f2123f6b8cc698 diff --git a/osu.Desktop.Deploy/App.config b/osu.Desktop.Deploy/App.config index d1da144f50..45685a74a8 100644 --- a/osu.Desktop.Deploy/App.config +++ b/osu.Desktop.Deploy/App.config @@ -21,4 +21,16 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste + + + + + + + + + + + + \ No newline at end of file diff --git a/osu.Desktop.Deploy/osu.Desktop.Deploy.csproj b/osu.Desktop.Deploy/osu.Desktop.Deploy.csproj index 7a3719a25b..901117b026 100644 --- a/osu.Desktop.Deploy/osu.Desktop.Deploy.csproj +++ b/osu.Desktop.Deploy/osu.Desktop.Deploy.csproj @@ -68,9 +68,8 @@ $(SolutionDir)\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.Rocks.dll True - - $(SolutionDir)\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll - True + + $(SolutionDir)\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll $(SolutionDir)\packages\squirrel.windows.1.5.2\lib\Net45\NuGet.Squirrel.dll @@ -120,7 +119,7 @@ - - - + + diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index da068c5557..f0c137578a 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -83,22 +83,20 @@ - - $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1340\lib\net45\OpenTK.dll - True + + $(SolutionDir)\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll - - ..\packages\SharpCompress.0.15.1\lib\net45\SharpCompress.dll - True + + $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1341\lib\net45\OpenTK.dll + + + $(SolutionDir)\packages\SharpCompress.0.15.2\lib\net45\SharpCompress.dll False $(SolutionDir)\packages\SQLite.Net.Core-PCL.3.1.1\lib\portable-win8+net45+wp8+wpa81+MonoAndroid1+MonoTouch1\SQLite.Net.dll - - $(SolutionDir)\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll - $(SolutionDir)\packages\SQLiteNetExtensions.1.3.0\lib\portable-net45+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1\SQLiteNetExtensions.dll diff --git a/osu.Desktop.VisualTests/packages.config b/osu.Desktop.VisualTests/packages.config index 5a30c50600..cad2ffff0d 100644 --- a/osu.Desktop.VisualTests/packages.config +++ b/osu.Desktop.VisualTests/packages.config @@ -4,9 +4,9 @@ Copyright (c) 2007-2017 ppy Pty Ltd . Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE --> - - - + + + diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index fbc342d695..dbd26b4640 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -124,8 +124,7 @@ True - $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1340\lib\net45\OpenTK.dll - True + $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1341\lib\net45\OpenTK.dll $(SolutionDir)\packages\Splat.2.0.0\lib\Net45\Splat.dll diff --git a/osu.Desktop/packages.config b/osu.Desktop/packages.config index be9b65f0c6..60e8182c82 100644 --- a/osu.Desktop/packages.config +++ b/osu.Desktop/packages.config @@ -7,7 +7,7 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste - + \ No newline at end of file diff --git a/osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj b/osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj index 593d8db4f6..50b1a095af 100644 --- a/osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj +++ b/osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj @@ -33,8 +33,7 @@ - $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1340\lib\net45\OpenTK.dll - True + $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1341\lib\net45\OpenTK.dll @@ -84,7 +83,7 @@ - - + \ No newline at end of file diff --git a/osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj b/osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj index cc925d417a..896e9c68c6 100644 --- a/osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj +++ b/osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj @@ -33,8 +33,7 @@ - $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1340\lib\net45\OpenTK.dll - True + $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1341\lib\net45\OpenTK.dll @@ -89,7 +88,7 @@ - - + \ No newline at end of file diff --git a/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj b/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj index 55322e855e..21f0f03d8c 100644 --- a/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj +++ b/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj @@ -34,8 +34,7 @@ - $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1340\lib\net45\OpenTK.dll - True + $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1341\lib\net45\OpenTK.dll @@ -104,7 +103,7 @@ - - + \ No newline at end of file diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index d0981c2500..19ba5c77e4 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -33,8 +33,7 @@ - $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1340\lib\net45\OpenTK.dll - True + $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1341\lib\net45\OpenTK.dll @@ -112,7 +111,7 @@ - - + \ No newline at end of file diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index d01aa77e02..2844528d0c 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -29,13 +29,11 @@ false - - $(SolutionDir)\packages\NUnit.3.5.0\lib\net45\nunit.framework.dll - True + + $(SolutionDir)\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll - $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1340\lib\net45\OpenTK.dll - True + $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1341\lib\net45\OpenTK.dll diff --git a/osu.Game.Tests/packages.config b/osu.Game.Tests/packages.config index ca53ef08b0..9972fb41a1 100644 --- a/osu.Game.Tests/packages.config +++ b/osu.Game.Tests/packages.config @@ -1,12 +1,11 @@  - - - + + \ No newline at end of file diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index d90fdda41a..12410563cd 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -35,17 +35,14 @@ false - - $(SolutionDir)\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll - True + + $(SolutionDir)\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll - $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1340\lib\net45\OpenTK.dll - True + $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1341\lib\net45\OpenTK.dll - - ..\packages\SharpCompress.0.15.1\lib\net45\SharpCompress.dll - True + + $(SolutionDir)\packages\SharpCompress.0.15.2\lib\net45\SharpCompress.dll $(SolutionDir)\packages\SQLite.Net.Core-PCL.3.1.1\lib\portable-win8+net45+wp8+wpa81+MonoAndroid1+MonoTouch1\SQLite.Net.dll @@ -389,7 +386,7 @@ - - - - + + + From ec6267c5b2a97873cfc3f47d5343bb1ed66b66d7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 12 Apr 2017 19:41:11 +0900 Subject: [PATCH 152/442] switch -> if. --- osu.Game/Graphics/UserInterface/OsuSliderBar.cs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index 9781a507cc..7895ae0aa4 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -88,15 +88,10 @@ namespace osu.Game.Graphics.UserInterface lastSampleTime = Clock.CurrentTime; sample.Frequency.Value = 1 + NormalizedValue * 0.2f; - switch (NormalizedValue) - { - case 0: - sample.Frequency.Value -= 0.4f; - break; - case 1: - sample.Frequency.Value += 0.4f; - break; - } + if (NormalizedValue == 0) + sample.Frequency.Value -= 0.4f; + else if (NormalizedValue == 1) + sample.Frequency.Value += 0.4f; sample.Play(); } From 6c6ef946bde3fc2cdd357d1dfb0b361af49919fe Mon Sep 17 00:00:00 2001 From: ocboogie Date: Wed, 12 Apr 2017 04:01:52 -0700 Subject: [PATCH 153/442] Some more clean up --- osu.Game/Screens/Play/FailOverlay.cs | 12 --------- osu.Game/Screens/Play/PauseOverlay.cs | 1 - osu.Game/Screens/Play/Player.cs | 36 +++++++-------------------- 3 files changed, 9 insertions(+), 40 deletions(-) diff --git a/osu.Game/Screens/Play/FailOverlay.cs b/osu.Game/Screens/Play/FailOverlay.cs index 1cd34e45e7..1c0e01201e 100644 --- a/osu.Game/Screens/Play/FailOverlay.cs +++ b/osu.Game/Screens/Play/FailOverlay.cs @@ -15,18 +15,6 @@ namespace osu.Game.Screens.Play public override string Header => "failed"; public override string Description => "you're dead, try again?"; - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) - { - if (args.Repeat) return false; - if (args.Key == Key.Escape) - { - if (State == Visibility.Hidden) return false; - OnQuit(); - return true; - } - - return base.OnKeyDown(state, args); - } [BackgroundDependencyLoader] private void load(OsuColour colours) diff --git a/osu.Game/Screens/Play/PauseOverlay.cs b/osu.Game/Screens/Play/PauseOverlay.cs index 6088e2fea5..c8439b33e0 100644 --- a/osu.Game/Screens/Play/PauseOverlay.cs +++ b/osu.Game/Screens/Play/PauseOverlay.cs @@ -23,7 +23,6 @@ namespace osu.Game.Screens.Play if (args.Repeat) return false; if (args.Key == Key.Escape) { - if (State == Visibility.Hidden) return false; OnResume(); return true; } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 2a18d44248..2ae809a7c2 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -35,7 +35,7 @@ namespace osu.Game.Screens.Play public BeatmapInfo BeatmapInfo; - public bool IsPaused { get; private set; } + public bool IsPaused => !sourceClock.IsRunning; public bool HasFailed { get; private set; } @@ -204,19 +204,13 @@ namespace osu.Game.Screens.Play public void Pause(bool force = false) { - if (canPause || force) - { - lastPauseActionTime = Time.Current; - hudOverlay.KeyCounter.IsCounting = false; - pauseOverlay.Retries = RestartCount; - pauseOverlay.Show(); - sourceClock.Stop(); - IsPaused = true; - } - else - { - IsPaused = false; - } + if (!canPause && !force) return; + + lastPauseActionTime = Time.Current; + hudOverlay.KeyCounter.IsCounting = false; + pauseOverlay.Retries = RestartCount; + pauseOverlay.Show(); + sourceClock.Stop(); } public void Resume() @@ -225,13 +219,6 @@ namespace osu.Game.Screens.Play hudOverlay.KeyCounter.IsCounting = true; pauseOverlay.Hide(); sourceClock.Start(); - IsPaused = false; - } - - public void TogglePaused() - { - IsPaused = !IsPaused; - if (IsPaused) Pause(); else Resume(); } public void Restart() @@ -273,11 +260,6 @@ namespace osu.Game.Screens.Play private void onFail() { - if (IsPaused) - { - pauseOverlay.Hide(); - IsPaused = false; - } sourceClock.Stop(); Delay(500); @@ -331,7 +313,7 @@ namespace osu.Game.Screens.Play //pause screen override logic. if (pauseOverlay?.State == Visibility.Hidden && !canPause) return true; - if (!IsPaused && sourceClock.IsRunning) // For if the user presses escape quickly when entering the map + if (!IsPaused) // For if the user presses escape quickly when entering the map { Pause(); return true; From 5bf71aae9c96fef30a8615eecbb3143129c9803d Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 12 Apr 2017 20:14:12 +0900 Subject: [PATCH 154/442] Remove unused using. --- osu.Game/Graphics/UserInterface/OsuSliderBar.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index 7895ae0aa4..180cb88707 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; -using OpenTK.Input; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; From 2987a575888f155d3753cac0026259d70bc7cd93 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 12 Apr 2017 20:28:04 +0900 Subject: [PATCH 155/442] Use formatter to add zeroes. --- osu.Game/Graphics/UserInterface/ScoreCounter.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/ScoreCounter.cs b/osu.Game/Graphics/UserInterface/ScoreCounter.cs index a9f402b13d..1221d2b0c2 100644 --- a/osu.Game/Graphics/UserInterface/ScoreCounter.cs +++ b/osu.Game/Graphics/UserInterface/ScoreCounter.cs @@ -48,10 +48,11 @@ namespace osu.Game.Graphics.UserInterface protected override string FormatCount(double count) { - string s = ((long)count).ToString("D" + LeadingZeroes); - for (int i = s.Length - 3; i > 0; i -= 3) - s = s.Insert(i, ","); - return s; + string format = new string('0', (int)LeadingZeroes); + for (int i = format.Length - 3; i > 0; i -= 3) + format = format.Insert(i, @","); + + return ((long)count).ToString(format); } public override void Increment(double amount) From 32b87d12b58ce23133f83fcd437e7ceca2e5d2ca Mon Sep 17 00:00:00 2001 From: ocboogie Date: Wed, 12 Apr 2017 04:54:24 -0700 Subject: [PATCH 156/442] Removed unneeded `using` --- osu.Game/Screens/Play/FailOverlay.cs | 3 --- osu.Game/Screens/Play/PauseOverlay.cs | 1 - 2 files changed, 4 deletions(-) diff --git a/osu.Game/Screens/Play/FailOverlay.cs b/osu.Game/Screens/Play/FailOverlay.cs index 1c0e01201e..3225695cb7 100644 --- a/osu.Game/Screens/Play/FailOverlay.cs +++ b/osu.Game/Screens/Play/FailOverlay.cs @@ -1,9 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Graphics.Containers; -using osu.Framework.Input; -using OpenTK.Input; using osu.Game.Graphics; using OpenTK.Graphics; using osu.Framework.Allocation; diff --git a/osu.Game/Screens/Play/PauseOverlay.cs b/osu.Game/Screens/Play/PauseOverlay.cs index c8439b33e0..3b06b1c84f 100644 --- a/osu.Game/Screens/Play/PauseOverlay.cs +++ b/osu.Game/Screens/Play/PauseOverlay.cs @@ -5,7 +5,6 @@ using System; using osu.Framework.Input; using osu.Game.Graphics; using OpenTK.Input; -using osu.Framework.Graphics.Containers; using OpenTK.Graphics; using osu.Framework.Allocation; From 00cd2c8372a0a50058a2f01f00a9cdc978915950 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 12 Apr 2017 21:08:28 +0900 Subject: [PATCH 157/442] Better comments. --- osu.Game/Database/BeatmapMetric.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Database/BeatmapMetric.cs b/osu.Game/Database/BeatmapMetric.cs index e40da27d1d..ae21bc4170 100644 --- a/osu.Game/Database/BeatmapMetric.cs +++ b/osu.Game/Database/BeatmapMetric.cs @@ -8,17 +8,17 @@ namespace osu.Game.Database public class BeatmapMetric { /// - /// Ratings for a beatmap, length should be 10 + /// Total vote counts of user ratings on a scale of 0..length. /// public IEnumerable Ratings { get; set; } /// - /// Fails for a beatmap, length should be 100 + /// Points of failure on a relative time scale (usually 0..100). /// public IEnumerable Fails { get; set; } /// - /// Retries for a beatmap, length should be 100 + /// Points of retry on a relative time scale (usually 0..100). /// public IEnumerable Retries { get; set; } } From 2c3fa303862e93c539fc6789d0b8d18fda6ff134 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 12 Apr 2017 21:09:39 +0900 Subject: [PATCH 158/442] Metric -> Metrics. --- .../Tests/TestCaseBeatmapDetails.cs | 6 +++--- osu.Game/Database/BeatmapInfo.cs | 2 +- .../Database/{BeatmapMetric.cs => BeatmapMetrics.cs} | 5 ++++- osu.Game/Screens/Select/BeatmapDetails.cs | 10 +++++----- osu.Game/osu.Game.csproj | 2 +- 5 files changed, 14 insertions(+), 11 deletions(-) rename osu.Game/Database/{BeatmapMetric.cs => BeatmapMetrics.cs} (80%) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs index 7cf42b966a..4a59ad9534 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs @@ -40,7 +40,7 @@ namespace osu.Desktop.VisualTests.Tests DrainRate = 1, }, StarDifficulty = 5.3f, - Metric = new BeatmapMetric + Metrics = new BeatmapMetrics { Ratings = Enumerable.Range(0,10), Fails = Enumerable.Range(lastRange, 100).Select(i => i % 12 - 6), @@ -56,8 +56,8 @@ namespace osu.Desktop.VisualTests.Tests private void newRetryAndFailValues() { - details.Beatmap.Metric.Fails = Enumerable.Range(lastRange, 100).Select(i => i % 12 - 6); - details.Beatmap.Metric.Retries = Enumerable.Range(lastRange - 3, 100).Select(i => i % 12 - 6); + details.Beatmap.Metrics.Fails = Enumerable.Range(lastRange, 100).Select(i => i % 12 - 6); + details.Beatmap.Metrics.Retries = Enumerable.Range(lastRange - 3, 100).Select(i => i % 12 - 6); details.Beatmap = details.Beatmap; lastRange += 100; } diff --git a/osu.Game/Database/BeatmapInfo.cs b/osu.Game/Database/BeatmapInfo.cs index 7dc62d64e8..3e84825919 100644 --- a/osu.Game/Database/BeatmapInfo.cs +++ b/osu.Game/Database/BeatmapInfo.cs @@ -42,7 +42,7 @@ namespace osu.Game.Database public BeatmapDifficulty Difficulty { get; set; } [Ignore] - public BeatmapMetric Metric { get; set; } + public BeatmapMetrics Metrics { get; set; } public string Path { get; set; } diff --git a/osu.Game/Database/BeatmapMetric.cs b/osu.Game/Database/BeatmapMetrics.cs similarity index 80% rename from osu.Game/Database/BeatmapMetric.cs rename to osu.Game/Database/BeatmapMetrics.cs index ae21bc4170..91320110d0 100644 --- a/osu.Game/Database/BeatmapMetric.cs +++ b/osu.Game/Database/BeatmapMetrics.cs @@ -5,7 +5,10 @@ using System.Collections.Generic; namespace osu.Game.Database { - public class BeatmapMetric + /// + /// Beatmap metrics based on acculumated online data from community plays. + /// + public class BeatmapMetrics { /// /// Total vote counts of user ratings on a scale of 0..length. diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 0d3a9ba9ee..a0d15101e0 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -61,9 +61,9 @@ namespace osu.Game.Screens.Select approachRate.Value = beatmap.Difficulty.ApproachRate; stars.Value = (float)beatmap.StarDifficulty; - if (beatmap.Metric?.Ratings.Any() ?? false) + if (beatmap.Metrics?.Ratings.Any() ?? false) { - var ratings = beatmap.Metric.Ratings.ToList(); + var ratings = beatmap.Metrics.Ratings.ToList(); ratingsContainer.Show(); negativeRatings.Text = ratings.GetRange(0, ratings.Count / 2).Sum().ToString(); @@ -75,10 +75,10 @@ namespace osu.Game.Screens.Select else ratingsContainer.Hide(); - if ((beatmap.Metric?.Retries.Any() ?? false) && beatmap.Metric.Fails.Any()) + if ((beatmap.Metrics?.Retries.Any() ?? false) && beatmap.Metrics.Fails.Any()) { - var retries = beatmap.Metric.Retries; - var fails = beatmap.Metric.Fails; + var retries = beatmap.Metrics.Retries; + var fails = beatmap.Metrics.Fails; retryFailContainer.Show(); float maxValue = fails.Zip(retries, (fail, retry) => fail + retry).Max(); diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 76ec4d3387..578704f4f8 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -76,7 +76,7 @@ - + From 3054697f988fda25d8f8f2883b0751f4fb198843 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 13 Apr 2017 10:04:12 +0900 Subject: [PATCH 159/442] Expose AccentColour/GlowColour from hud elements, and set from HudOverlay. --- .../UserInterface/PercentageCounter.cs | 6 --- .../Graphics/UserInterface/RollingCounter.cs | 9 ++++- .../Graphics/UserInterface/ScoreCounter.cs | 6 --- .../UserInterface/SimpleComboCounter.cs | 7 +--- osu.Game/Modes/UI/StandardHealthDisplay.cs | 40 +++++++++++++------ osu.Game/Modes/UI/StandardHudOverlay.cs | 18 +++++++++ 6 files changed, 54 insertions(+), 32 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/PercentageCounter.cs b/osu.Game/Graphics/UserInterface/PercentageCounter.cs index d9438af17e..63c27426c0 100644 --- a/osu.Game/Graphics/UserInterface/PercentageCounter.cs +++ b/osu.Game/Graphics/UserInterface/PercentageCounter.cs @@ -31,12 +31,6 @@ namespace osu.Game.Graphics.UserInterface Current.Value = DisplayedCount = 1.0f; } - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - DisplayedCountSpriteText.Colour = colours.BlueLighter; - } - protected override string FormatCount(double count) { return $@"{count:P2}"; diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs index 4b244fc540..f8ab9f0ff3 100644 --- a/osu.Game/Graphics/UserInterface/RollingCounter.cs +++ b/osu.Game/Graphics/UserInterface/RollingCounter.cs @@ -10,10 +10,11 @@ using osu.Game.Graphics.Sprites; using System; using System.Collections.Generic; using System.Diagnostics; +using OpenTK.Graphics; namespace osu.Game.Graphics.UserInterface { - public abstract class RollingCounter : Container + public abstract class RollingCounter : Container, IHasAccentColour { /// /// The current value. @@ -80,6 +81,12 @@ namespace osu.Game.Graphics.UserInterface } } + public Color4 AccentColour + { + get { return DisplayedCountSpriteText.Colour; } + set { DisplayedCountSpriteText.Colour = value; } + } + /// /// Skeleton of a numeric counter which value rolls over time. /// diff --git a/osu.Game/Graphics/UserInterface/ScoreCounter.cs b/osu.Game/Graphics/UserInterface/ScoreCounter.cs index 1221d2b0c2..b035dbb547 100644 --- a/osu.Game/Graphics/UserInterface/ScoreCounter.cs +++ b/osu.Game/Graphics/UserInterface/ScoreCounter.cs @@ -35,12 +35,6 @@ namespace osu.Game.Graphics.UserInterface LeadingZeroes = leading; } - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - DisplayedCountSpriteText.Colour = colours.BlueLighter; - } - protected override double GetProportionalDuration(double currentValue, double newValue) { return currentValue > newValue ? currentValue - newValue : newValue - currentValue; diff --git a/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs b/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs index c9891885bd..1b0526a668 100644 --- a/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs +++ b/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Transforms; @@ -38,12 +39,6 @@ namespace osu.Game.Graphics.UserInterface Current.Value = Current + amount; } - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - DisplayedCountSpriteText.Colour = colours.BlueLighter; - } - protected class TransformCount : Transform { public override int CurrentValue diff --git a/osu.Game/Modes/UI/StandardHealthDisplay.cs b/osu.Game/Modes/UI/StandardHealthDisplay.cs index d49e32ea8b..2fdfd02194 100644 --- a/osu.Game/Modes/UI/StandardHealthDisplay.cs +++ b/osu.Game/Modes/UI/StandardHealthDisplay.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; @@ -12,10 +13,35 @@ using osu.Game.Graphics; namespace osu.Game.Modes.UI { - public class StandardHealthDisplay : HealthDisplay + public class StandardHealthDisplay : HealthDisplay, IHasAccentColour { private readonly Container fill; + public Color4 AccentColour + { + get { return fill.Colour; } + set { fill.Colour = value; } + } + + private Color4 glowColour; + public Color4 GlowColour + { + get { return glowColour; } + set + { + if (glowColour == value) + return; + glowColour = value; + + fill.EdgeEffect = new EdgeEffect + { + Colour = glowColour, + Radius = 8, + Type = EdgeEffectType.Glow + }; + } + } + public StandardHealthDisplay() { Children = new Drawable[] @@ -41,18 +67,6 @@ namespace osu.Game.Modes.UI }; } - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - fill.Colour = colours.BlueLighter; - fill.EdgeEffect = new EdgeEffect - { - Colour = colours.BlueDarker.Opacity(0.6f), - Radius = 8, - Type = EdgeEffectType.Glow - }; - } - protected override void SetHealth(float value) => fill.ScaleTo(new Vector2(value, 1), 200, EasingTypes.OutQuint); } } diff --git a/osu.Game/Modes/UI/StandardHudOverlay.cs b/osu.Game/Modes/UI/StandardHudOverlay.cs index 87ec631b35..cb8e6c1808 100644 --- a/osu.Game/Modes/UI/StandardHudOverlay.cs +++ b/osu.Game/Modes/UI/StandardHudOverlay.cs @@ -2,8 +2,11 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; +using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Primitives; +using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Play; @@ -53,5 +56,20 @@ namespace osu.Game.Modes.UI TextSize = 40, Position = new Vector2(0, 30), }; + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + ComboCounter.AccentColour = colours.BlueLighter; + AccuracyCounter.AccentColour = colours.BlueLighter; + ScoreCounter.AccentColour = colours.BlueLighter; + + var shd = HealthDisplay as StandardHealthDisplay; + if (shd != null) + { + shd.AccentColour = colours.BlueLighter; + shd.GlowColour = colours.BlueDarker.Opacity(0.6f); + } + } } } From 94bf1d65b617a8d3c9d40078be0b51440bf14f80 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Apr 2017 11:41:08 +0900 Subject: [PATCH 160/442] Fix thread race conditions on pausing close to a fail. --- osu.Game/Screens/Play/Player.cs | 36 ++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 2ae809a7c2..1bab7cddde 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -44,7 +44,7 @@ namespace osu.Game.Screens.Play private const double pause_cooldown = 1000; private double lastPauseActionTime; - private bool canPause => Time.Current >= lastPauseActionTime + pause_cooldown; + private bool canPause => ValidForResume && !HasFailed && Time.Current >= lastPauseActionTime + pause_cooldown; private IAdjustableClock sourceClock; private IFrameBasedClock interpolatedSourceClock; @@ -206,11 +206,28 @@ namespace osu.Game.Screens.Play { if (!canPause && !force) return; - lastPauseActionTime = Time.Current; - hudOverlay.KeyCounter.IsCounting = false; - pauseOverlay.Retries = RestartCount; - pauseOverlay.Show(); sourceClock.Stop(); + + // the actual pausing is potentially happening on a different thread. + // we want to wait for the source clock to stop so we can be sure all components are in a stable state. + if (!IsPaused) + { + Schedule(() => Pause(force)); + return; + } + + // we need to do a final check after all of our children have processed up to the paused clock time. + // this is to cover cases where, for instance, the player fails in the last processed frame (which would change canPause). + // as the scheduler runs before children updates, let's schedule for the next frame. + Schedule(() => + { + if (!canPause) return; + + lastPauseActionTime = Time.Current; + hudOverlay.KeyCounter.IsCounting = false; + pauseOverlay.Retries = RestartCount; + pauseOverlay.Show(); + }); } public void Resume() @@ -227,11 +244,11 @@ namespace osu.Game.Screens.Play var newPlayer = new Player(); + ValidForResume = false; + LoadComponentAsync(newPlayer, delegate { newPlayer.RestartCount = RestartCount + 1; - ValidForResume = false; - if (!Push(newPlayer)) { // Error(?) @@ -247,10 +264,11 @@ namespace osu.Game.Screens.Play if (scoreProcessor.HasFailed || onCompletionEvent != null) return; + ValidForResume = false; + Delay(1000); onCompletionEvent = Schedule(delegate { - ValidForResume = false; Push(new Results { Score = scoreProcessor.CreateScore() @@ -262,8 +280,6 @@ namespace osu.Game.Screens.Play { sourceClock.Stop(); - Delay(500); - HasFailed = true; failOverlay.Retries = RestartCount; failOverlay.Show(); From 359fea7e25f40013fdff1797e70710e01ec80e89 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Apr 2017 11:35:36 +0900 Subject: [PATCH 161/442] Improve "escape" pressing logic in pause/fail menus. --- osu.Game/Screens/Play/FailOverlay.cs | 25 ++++++++++++------------- osu.Game/Screens/Play/MenuOverlay.cs | 7 ++++--- osu.Game/Screens/Play/PauseOverlay.cs | 8 +++----- 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/osu.Game/Screens/Play/FailOverlay.cs b/osu.Game/Screens/Play/FailOverlay.cs index 7a32e19338..faff687ddb 100644 --- a/osu.Game/Screens/Play/FailOverlay.cs +++ b/osu.Game/Screens/Play/FailOverlay.cs @@ -1,31 +1,19 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Graphics.Containers; using osu.Framework.Input; using OpenTK.Input; using osu.Game.Graphics; using OpenTK.Graphics; using osu.Framework.Allocation; +using System.Linq; namespace osu.Game.Screens.Play { public class FailOverlay : MenuOverlay { - public override string Header => "failed"; public override string Description => "you're dead, try again?"; - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) - { - if (args.Key == Key.Escape) - { - if (State == Visibility.Hidden) return false; - OnQuit(); - return true; - } - - return base.OnKeyDown(state, args); - } [BackgroundDependencyLoader] private void load(OsuColour colours) @@ -33,5 +21,16 @@ namespace osu.Game.Screens.Play AddButton("Retry", colours.YellowDark, OnRetry); AddButton("Quit", new Color4(170, 27, 39, 255), OnQuit); } + + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + { + if (!args.Repeat && args.Key == Key.Escape) + { + Buttons.Children.Last().TriggerClick(); + return true; + } + + return base.OnKeyDown(state, args); + } } } diff --git a/osu.Game/Screens/Play/MenuOverlay.cs b/osu.Game/Screens/Play/MenuOverlay.cs index ede49065a7..379df0a2a2 100644 --- a/osu.Game/Screens/Play/MenuOverlay.cs +++ b/osu.Game/Screens/Play/MenuOverlay.cs @@ -13,6 +13,7 @@ using OpenTK; using OpenTK.Graphics; using osu.Game.Graphics; using osu.Framework.Allocation; +using osu.Game.Graphics.UserInterface; namespace osu.Game.Screens.Play { @@ -30,7 +31,7 @@ namespace osu.Game.Screens.Play public abstract string Header { get; } public abstract string Description { get; } - private FillFlowContainer buttons; + protected FillFlowContainer Buttons; public int Retries { @@ -84,7 +85,7 @@ namespace osu.Game.Screens.Play protected void AddButton(string text, Color4 colour, Action action) { - buttons.Add(new PauseButton + Buttons.Add(new PauseButton { Text = text, ButtonColour = colour, @@ -151,7 +152,7 @@ namespace osu.Game.Screens.Play } } }, - buttons = new FillFlowContainer + Buttons = new FillFlowContainer { Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, diff --git a/osu.Game/Screens/Play/PauseOverlay.cs b/osu.Game/Screens/Play/PauseOverlay.cs index f9706d263e..9561979751 100644 --- a/osu.Game/Screens/Play/PauseOverlay.cs +++ b/osu.Game/Screens/Play/PauseOverlay.cs @@ -2,10 +2,10 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Linq; using osu.Framework.Input; using osu.Game.Graphics; using OpenTK.Input; -using osu.Framework.Graphics.Containers; using OpenTK.Graphics; using osu.Framework.Allocation; @@ -20,10 +20,9 @@ namespace osu.Game.Screens.Play protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { - if (args.Key == Key.Escape) + if (!args.Repeat && args.Key == Key.Escape) { - if (State == Visibility.Hidden) return false; - OnResume(); + Buttons.Children.First().TriggerClick(); return true; } @@ -39,4 +38,3 @@ namespace osu.Game.Screens.Play } } } - \ No newline at end of file From 1f4e0b0251c09a6f38c70f229b6b651792706de6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Apr 2017 12:41:08 +0900 Subject: [PATCH 162/442] Fix MosueUp and HighResolution events not being handled by MenuOverlays. --- osu.Game/Screens/Play/MenuOverlay.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/MenuOverlay.cs b/osu.Game/Screens/Play/MenuOverlay.cs index 379df0a2a2..738e5cc35d 100644 --- a/osu.Game/Screens/Play/MenuOverlay.cs +++ b/osu.Game/Screens/Play/MenuOverlay.cs @@ -17,7 +17,7 @@ using osu.Game.Graphics.UserInterface; namespace osu.Game.Screens.Play { - public abstract class MenuOverlay : OverlayContainer + public abstract class MenuOverlay : OverlayContainer, IRequireHighFrequencyMousePosition { private const int transition_duration = 200; private const int button_height = 70; @@ -81,6 +81,8 @@ namespace osu.Game.Screens.Play // Don't let mouse down events through the overlay or people can click circles while paused. protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; + protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) => true; + protected override bool OnMouseMove(InputState state) => true; protected void AddButton(string text, Color4 colour, Action action) From 13f057f900b36bf78b15cd3d9385e9777da40b83 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Apr 2017 14:13:53 +0900 Subject: [PATCH 163/442] Give CursorTrail its own clock for the time being. --- osu.Game/Graphics/Cursor/CursorTrail.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Cursor/CursorTrail.cs b/osu.Game/Graphics/Cursor/CursorTrail.cs index 4b5610e840..09d1b99d13 100644 --- a/osu.Game/Graphics/Cursor/CursorTrail.cs +++ b/osu.Game/Graphics/Cursor/CursorTrail.cs @@ -13,6 +13,7 @@ using osu.Framework.Graphics.OpenGL.Buffers; using OpenTK.Graphics.ES30; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Colour; +using osu.Framework.Timing; namespace osu.Game.Graphics.Cursor { @@ -58,6 +59,9 @@ namespace osu.Game.Graphics.Cursor public CursorTrail() { + // as we are currently very dependent on having a running clock, let's make our own clock for the time being. + Clock = new FramedClock(); + AlwaysReceiveInput = true; RelativeSizeAxes = Axes.Both; @@ -231,4 +235,4 @@ namespace osu.Game.Graphics.Cursor } } } -} \ No newline at end of file +} From 5f8baf874dd6907d612fdde8b7d6485d24678e93 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Apr 2017 18:31:23 +0900 Subject: [PATCH 164/442] Use interpolatedSourceClock's IsRunning value for consistency. --- osu.Game/Screens/Play/Player.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 1bab7cddde..7f43ae2ac3 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -35,7 +35,7 @@ namespace osu.Game.Screens.Play public BeatmapInfo BeatmapInfo; - public bool IsPaused => !sourceClock.IsRunning; + public bool IsPaused => !interpolatedSourceClock.IsRunning; public bool HasFailed { get; private set; } @@ -206,12 +206,12 @@ namespace osu.Game.Screens.Play { if (!canPause && !force) return; - sourceClock.Stop(); - // the actual pausing is potentially happening on a different thread. // we want to wait for the source clock to stop so we can be sure all components are in a stable state. if (!IsPaused) { + sourceClock.Stop(); + Schedule(() => Pause(force)); return; } From 262a2c9f0e093b416d1f0b61083ec5dae119624c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Apr 2017 19:01:15 +0900 Subject: [PATCH 165/442] Add exception for failing. --- osu.Game/Screens/Play/Player.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 7f43ae2ac3..01d5d0770a 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -324,6 +324,9 @@ namespace osu.Game.Screens.Play protected override bool OnExiting(Screen next) { + if (HasFailed || !ValidForResume) + return false; + if (pauseOverlay != null && !HitRenderer.HasReplayLoaded) { //pause screen override logic. From e62922ba6454eadc85988b25b93a2a4dc43c5704 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Apr 2017 00:57:57 +0900 Subject: [PATCH 166/442] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 34ac837eeb..2234013e59 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 34ac837eebeecd0b6f35829780f2123f6b8cc698 +Subproject commit 2234013e59a99116ee9f9e56a95ff8a6667db2a7 From c2b2e5ec19f1e408d62b9ba8fb5a792877595d7a Mon Sep 17 00:00:00 2001 From: Jorolf Date: Thu, 13 Apr 2017 23:00:49 +0200 Subject: [PATCH 167/442] changed way the tool tip is found and displayed --- .../Tests/TestCaseTooltip.cs | 67 +++++++++++++++++-- osu.Game/Graphics/Cursor/IHasTooltip.cs | 24 +++++++ osu.Game/Graphics/Cursor/MenuCursor.cs | 37 +++++----- .../{UserInterface => Cursor}/Tooltip.cs | 9 +-- .../Graphics/UserInterface/IHasTooltip.cs | 10 --- osu.Game/osu.Game.csproj | 4 +- 6 files changed, 108 insertions(+), 43 deletions(-) create mode 100644 osu.Game/Graphics/Cursor/IHasTooltip.cs rename osu.Game/Graphics/{UserInterface => Cursor}/Tooltip.cs (89%) delete mode 100644 osu.Game/Graphics/UserInterface/IHasTooltip.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs b/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs index 2d9cfcf4b1..dd77eb8fb6 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs @@ -1,11 +1,16 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Framework.Configuration; +using osu.Framework.Input; +using osu.Game.Graphics.Cursor; +using OpenTK; namespace osu.Desktop.VisualTests.Tests { @@ -23,25 +28,73 @@ namespace osu.Desktop.VisualTests.Tests { RelativeSizeAxes = Axes.Both, Direction = FillDirection.Vertical, - Children = new[] + Children = new Drawable[] { - new TooltipSpriteText + new TooltipContainer("Text with some tooltip"), + new TooltipContainer("and another one"), + new TooltipTextbox { - Text = "Text with some tooltip", + Text = "a box with a tooltip", + Width = 300, }, - new TooltipSpriteText + new TooltipSlider { - Text = "and another one", + Bindable = new BindableInt(5) + { + MaxValue = 10, + MinValue = 0, + }, + Size = new Vector2(300,16), }, - }, }, }; } - private class TooltipSpriteText : OsuSpriteText, IHasTooltip + private class TooltipContainer : Container, IHasTooltip + { + private readonly OsuSpriteText text; + + public string Tooltip => text.Text; + + public TooltipContainer(string tooltipText) + { + AutoSizeAxes = Axes.Both; + Children = new[] + { + text = new OsuSpriteText + { + Text = tooltipText, + } + }; + } + + } + + private class TooltipTextbox : OsuTextBox, IHasTooltip { public string Tooltip => Text; } + + private class TooltipSlider : OsuSliderBar, IHasDelayedTooltip + { + public string Tooltip => Bindable.Value.ToString(); + + int IHasDelayedTooltip.Delay => mousePressed ? 0 : 250; + + private bool mousePressed; + + protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + { + mousePressed = true; + return base.OnMouseDown(state, args); + } + + protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + { + mousePressed = false; + return base.OnMouseUp(state, args); + } + } } } diff --git a/osu.Game/Graphics/Cursor/IHasTooltip.cs b/osu.Game/Graphics/Cursor/IHasTooltip.cs new file mode 100644 index 0000000000..d6748236b5 --- /dev/null +++ b/osu.Game/Graphics/Cursor/IHasTooltip.cs @@ -0,0 +1,24 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Graphics.Cursor +{ + public interface IHasTooltip + { + /// + /// Tooltip that shows when hovering the object + /// + string Tooltip { get; } + } + + /// + /// Interface of with custom appear time + /// + public interface IHasDelayedTooltip : IHasTooltip + { + /// + /// Time until the tooltip appears (in milliseconds) + /// + int Delay { get; } + } +} diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index cb6dcc451f..361d0cc1ef 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -12,10 +12,8 @@ using osu.Framework.Input; using osu.Game.Configuration; using System; using osu.Framework.Graphics.Textures; -using osu.Game.Graphics.UserInterface; using osu.Framework.Threading; using System.Linq; -using System.Collections.Generic; namespace osu.Game.Graphics.Cursor { @@ -40,15 +38,16 @@ namespace osu.Game.Graphics.Cursor { Tooltip tooltip = ((Cursor)ActiveCursor).Tooltip; show?.Cancel(); - tooltip.Hide(); - Delay(250); - show = Schedule(delegate + tooltip.TooltipText = string.Empty; + IHasTooltip hasTooltip = null; + if (game.InternalChildren.OfType().Any(child => (hasTooltip = searchTooltip(child as IContainerEnumerable)) != null)) { - tooltip.TooltipText = ""; - searchTooltip(tooltip, ToScreenSpace(state.Mouse.Position), game); - if (tooltip.TooltipText != "") - tooltip.Show(); - }); + IHasDelayedTooltip delayedTooltip = hasTooltip as IHasDelayedTooltip; + show = Scheduler.AddDelayed(delegate + { + tooltip.TooltipText = hasTooltip.Tooltip; + }, delayedTooltip?.Delay ?? 250); + } } if (dragging) @@ -68,18 +67,16 @@ namespace osu.Game.Graphics.Cursor return base.OnMouseMove(state); } - private void searchTooltip(Tooltip tooltip, Vector2 mousePosition, IContainerEnumerable children) + private IHasTooltip searchTooltip(IContainerEnumerable children) { - IEnumerable next = children.InternalChildren.Where(drawable => drawable.Contains(mousePosition) && !(drawable is CursorContainer)); + Drawable next = children.InternalChildren.OrderBy(drawable => drawable.Depth).FirstOrDefault(drawable => drawable.Hovering && !(drawable is CursorContainer)); - foreach (Drawable drawable in next) - { - string tooltipText = (drawable as IHasTooltip)?.Tooltip ?? ""; - if (tooltipText != "") tooltip.TooltipText = tooltipText; - - if (drawable is IContainer) - searchTooltip(tooltip, mousePosition, drawable as IContainerEnumerable); - } + IHasTooltip tooltipText = next as IHasTooltip; + if (tooltipText != null) return tooltipText; + + if (next is IContainer) + return searchTooltip(next as IContainerEnumerable); + return null; } protected override bool OnDragStart(InputState state) diff --git a/osu.Game/Graphics/UserInterface/Tooltip.cs b/osu.Game/Graphics/Cursor/Tooltip.cs similarity index 89% rename from osu.Game/Graphics/UserInterface/Tooltip.cs rename to osu.Game/Graphics/Cursor/Tooltip.cs index b2031a81d9..d57b83e05f 100644 --- a/osu.Game/Graphics/UserInterface/Tooltip.cs +++ b/osu.Game/Graphics/Cursor/Tooltip.cs @@ -1,7 +1,6 @@ // 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.Allocation; using osu.Framework.Extensions.Color4Extensions; @@ -11,7 +10,7 @@ using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics.Sprites; -namespace osu.Game.Graphics.UserInterface +namespace osu.Game.Graphics.Cursor { public class Tooltip : Container { @@ -26,11 +25,13 @@ namespace osu.Game.Graphics.UserInterface set { text.Text = value; + if (string.IsNullOrEmpty(value)) + Hide(); + else + Show(); } } - public Vector2 TooltipOffset = new Vector2(); - public Tooltip() { Depth = float.MinValue; diff --git a/osu.Game/Graphics/UserInterface/IHasTooltip.cs b/osu.Game/Graphics/UserInterface/IHasTooltip.cs deleted file mode 100644 index d8997349bb..0000000000 --- a/osu.Game/Graphics/UserInterface/IHasTooltip.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -namespace osu.Game.Graphics.UserInterface -{ - public interface IHasTooltip - { - string Tooltip { get; } - } -} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index c29f3a49f2..e84c55db0b 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -87,14 +87,14 @@ - + - + From 7f08c3c417968fb7c62abb07037543f823639fb2 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Fri, 14 Apr 2017 00:18:17 +0200 Subject: [PATCH 168/442] add IHasOverhangingTooltip --- .../Tests/TestCaseTooltip.cs | 32 +++++++++++-------- osu.Game/Graphics/Cursor/IHasTooltip.cs | 13 +++++++- osu.Game/Graphics/Cursor/MenuCursor.cs | 13 ++++++-- osu.Game/Graphics/Cursor/Tooltip.cs | 2 -- 4 files changed, 41 insertions(+), 19 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs b/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs index dd77eb8fb6..604b31de8d 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs @@ -21,6 +21,7 @@ namespace osu.Desktop.VisualTests.Tests public override void Reset() { base.Reset(); + TooltipSlider slider; Children = new Drawable[] { @@ -28,6 +29,7 @@ namespace osu.Desktop.VisualTests.Tests { RelativeSizeAxes = Axes.Both, Direction = FillDirection.Vertical, + Spacing = new Vector2(0,10), Children = new Drawable[] { new TooltipContainer("Text with some tooltip"), @@ -35,20 +37,22 @@ namespace osu.Desktop.VisualTests.Tests new TooltipTextbox { Text = "a box with a tooltip", - Width = 300, + Size = new Vector2(300,30), }, - new TooltipSlider + slider = new TooltipSlider { - Bindable = new BindableInt(5) - { - MaxValue = 10, - MinValue = 0, - }, - Size = new Vector2(300,16), + Width = 300, }, }, }, }; + + + slider.Current.BindTo(new BindableInt(5) + { + MaxValue = 10, + MinValue = 0 + }); } private class TooltipContainer : Container, IHasTooltip @@ -76,23 +80,23 @@ namespace osu.Desktop.VisualTests.Tests public string Tooltip => Text; } - private class TooltipSlider : OsuSliderBar, IHasDelayedTooltip + private class TooltipSlider : OsuSliderBar, IHasDelayedTooltip, IHasOverhangingTooltip { - public string Tooltip => Bindable.Value.ToString(); + public string Tooltip => Current.Value.ToString(); - int IHasDelayedTooltip.Delay => mousePressed ? 0 : 250; + int IHasDelayedTooltip.Delay => Overhanging ? 0 : 250; - private bool mousePressed; + public bool Overhanging { get; set; } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { - mousePressed = true; + Overhanging = true; return base.OnMouseDown(state, args); } protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) { - mousePressed = false; + Overhanging = false; return base.OnMouseUp(state, args); } } diff --git a/osu.Game/Graphics/Cursor/IHasTooltip.cs b/osu.Game/Graphics/Cursor/IHasTooltip.cs index d6748236b5..576175ff93 100644 --- a/osu.Game/Graphics/Cursor/IHasTooltip.cs +++ b/osu.Game/Graphics/Cursor/IHasTooltip.cs @@ -12,7 +12,7 @@ namespace osu.Game.Graphics.Cursor } /// - /// Interface of with custom appear time + /// Tooltip with custom appear time /// public interface IHasDelayedTooltip : IHasTooltip { @@ -21,4 +21,15 @@ namespace osu.Game.Graphics.Cursor /// int Delay { get; } } + + /// + /// Tooltip which can show after hovering over the object + /// + public interface IHasOverhangingTooltip : IHasTooltip + { + /// + /// Should the tooltip still show? + /// + bool Overhanging { get; } + } } diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index 4d5e0848cb..255fa2ca99 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -31,24 +31,33 @@ namespace osu.Game.Graphics.Cursor private ScheduledDelegate show; private OsuGameBase game; + private IHasOverhangingTooltip overhang; protected override bool OnMouseMove(InputState state) { - if (state.Mouse.Position != state.Mouse.LastPosition) + Tooltip tooltip = ((Cursor)ActiveCursor).Tooltip; + if (overhang?.Overhanging ?? false) + tooltip.TooltipText = overhang.Tooltip; + else if (state.Mouse.Position != state.Mouse.LastPosition) { - Tooltip tooltip = ((Cursor)ActiveCursor).Tooltip; show?.Cancel(); tooltip.TooltipText = string.Empty; IHasTooltip hasTooltip = null; if (game.InternalChildren.OfType().Any(child => (hasTooltip = searchTooltip(child as IContainerEnumerable)) != null)) { IHasDelayedTooltip delayedTooltip = hasTooltip as IHasDelayedTooltip; + overhang = hasTooltip as IHasOverhangingTooltip; show = Scheduler.AddDelayed(delegate { tooltip.TooltipText = hasTooltip.Tooltip; }, delayedTooltip?.Delay ?? 250); } } + else if(overhang != null) + { + overhang = null; + tooltip.TooltipText = string.Empty; + } if (dragging) { diff --git a/osu.Game/Graphics/Cursor/Tooltip.cs b/osu.Game/Graphics/Cursor/Tooltip.cs index d57b83e05f..5cde7464f0 100644 --- a/osu.Game/Graphics/Cursor/Tooltip.cs +++ b/osu.Game/Graphics/Cursor/Tooltip.cs @@ -34,8 +34,6 @@ namespace osu.Game.Graphics.Cursor public Tooltip() { - Depth = float.MinValue; - AlwaysReceiveInput = true; Children = new[] { new Container From 8c41707ac798c94bd2c3e06bfc9c44ba48727457 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Apr 2017 14:40:52 +0900 Subject: [PATCH 169/442] Fix incorrect default state. Handle input better. --- .../Tests/TestCaseSongProgress.cs | 395 +----------------- osu.Game/Overlays/DragBar.cs | 13 +- osu.Game/Screens/Play/SongProgress.cs | 36 +- osu.Game/Screens/Play/SongProgressBar.cs | 13 +- 4 files changed, 43 insertions(+), 414 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs index feb7aac0ce..aafd1753e5 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs @@ -1,22 +1,11 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using System.Collections.Generic; -using System.Linq; -using osu.Framework; -using osu.Framework.Allocation; -using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Primitives; -using osu.Framework.Graphics.Sprites; using osu.Framework.MathUtils; using osu.Framework.Testing; -using osu.Game.Graphics; -using osu.Game.Overlays; -using OpenTK; -using OpenTK.Graphics; +using osu.Game.Screens.Play; namespace osu.Desktop.VisualTests.Tests { @@ -34,7 +23,6 @@ namespace osu.Desktop.VisualTests.Tests { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, - RelativeSizeAxes = Axes.X, }); AddStep("Toggle Bar", progress.ToggleBar); @@ -57,385 +45,4 @@ namespace osu.Desktop.VisualTests.Tests progress.Progress = RNG.NextDouble(); } } - - public class SongProgress : OverlayContainer - { - private const int progress_height = 5; - - private static readonly Vector2 handle_size = new Vector2(14, 25); - - private const float transition_duration = 200; - - private readonly SongProgressBar bar; - private readonly SongProgressGraph graph; - - public Action OnSeek; - - private double progress; - public double Progress - { - get { return progress; } - set - { - progress = value; - updateProgress(); - } - } - - public int[] Values - { - get { return graph.Values; } - set { graph.Values = value; } - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - graph.FillColour = bar.FillColour = colours.BlueLighter; - } - - public SongProgress() - { - RelativeSizeAxes = Axes.X; - Height = progress_height + SongProgressGraph.Column.HEIGHT + handle_size.Y; - - Children = new Drawable[] - { - graph = new SongProgressGraph - { - RelativeSizeAxes = Axes.X, - Origin = Anchor.BottomLeft, - Anchor = Anchor.BottomLeft, - Height = SongProgressGraph.Column.HEIGHT, - Margin = new MarginPadding { Bottom = progress_height }, - }, - bar = new SongProgressBar(progress_height, SongProgressGraph.Column.HEIGHT, handle_size) - { - Origin = Anchor.BottomLeft, - Anchor = Anchor.BottomLeft, - Alpha = 0, - SeekRequested = delegate (float position) - { - OnSeek?.Invoke(position); - }, - }, - }; - } - - private void updateProgress() - { - bar.UpdatePosition((float)progress); - graph.Progress = (int)(graph.ColumnCount * progress); - } - - private bool barVisible; - - public void ToggleBar() - { - barVisible = !barVisible; - - updateBarVisibility(); - } - - private void updateBarVisibility() - { - bar.FadeTo(barVisible ? 1 : 0, transition_duration, EasingTypes.In); - MoveTo(new Vector2(0, barVisible ? 0 : progress_height), transition_duration, EasingTypes.In); - } - - protected override void PopIn() - { - updateBarVisibility(); - } - - protected override void PopOut() - { - } - - protected override void Update() - { - base.Update(); - - updateProgress(); - } - } - - public class SongProgressGraph : BufferedContainer - { - private Game.Screens.Play.SongProgressGraph.Column[] columns = { }; - - public int ColumnCount => columns.Length; - - public override bool HandleInput => false; - - private int progress; - public int Progress - { - get { return progress; } - set - { - if (value == progress) return; - progress = value; - - redrawProgress(); - } - } - - private int[] calculatedValues = { }; // values but adjusted to fit the amount of columns - private int[] values; - public int[] Values - { - get { return values; } - set - { - if (value == values) return; - values = value; - recreateGraph(); - } - } - - private Color4 fillColour; - public Color4 FillColour - { - get { return fillColour; } - set - { - if (value == fillColour) return; - fillColour = value; - - redrawFilled(); - } - } - - public SongProgressGraph() - { - CacheDrawnFrameBuffer = true; - PixelSnapping = true; - } - - private float lastDrawWidth; - protected override void Update() - { - base.Update(); - - // todo: Recreating in update is probably not the best idea - if (DrawWidth == lastDrawWidth) return; - recreateGraph(); - lastDrawWidth = DrawWidth; - } - - /// - /// Redraws all the columns to match their lit/dimmed state. - /// - private void redrawProgress() - { - for (int i = 0; i < columns.Length; i++) - { - columns[i].State = i <= progress ? Game.Screens.Play.SongProgressGraph.ColumnState.Lit : Game.Screens.Play.SongProgressGraph.ColumnState.Dimmed; - } - - ForceRedraw(); - } - - /// - /// Redraws the filled amount of all the columns. - /// - private void redrawFilled() - { - for (int i = 0; i < ColumnCount; i++) - { - columns[i].Filled = calculatedValues.ElementAtOrDefault(i); - } - } - - /// - /// Takes and adjusts it to fit the amount of columns. - /// - private void recalculateValues() - { - var newValues = new List(); - - if (values == null) - { - for (float i = 0; i < ColumnCount; i++) - newValues.Add(0); - - return; - } - - float step = values.Length / (float)ColumnCount; - for (float i = 0; i < values.Length; i += step) - { - newValues.Add(values[(int)i]); - } - - calculatedValues = newValues.ToArray(); - } - - /// - /// Recreates the entire graph. - /// - private void recreateGraph() - { - var newColumns = new List(); - - for (float x = 0; x < DrawWidth; x += Game.Screens.Play.SongProgressGraph.Column.WIDTH) - { - newColumns.Add(new Game.Screens.Play.SongProgressGraph.Column(fillColour) - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Position = new Vector2(x, 0), - State = Game.Screens.Play.SongProgressGraph.ColumnState.Dimmed, - }); - } - - columns = newColumns.ToArray(); - Children = columns; - - recalculateValues(); - redrawFilled(); - redrawProgress(); - } - - public class Column : Container, IStateful - { - private readonly Color4 emptyColour = Color4.White.Opacity(100); - private readonly Color4 litColour; - private readonly Color4 dimmedColour = Color4.White.Opacity(175); - - private const float cube_count = 6; - private const float cube_size = 4; - private const float padding = 2; - public const float WIDTH = cube_size + padding; - public const float HEIGHT = cube_count * WIDTH + padding; - - private readonly List drawableRows = new List(); - - private int filled; - public int Filled - { - get { return filled; } - set - { - if (value == filled) return; - filled = value; - - fillActive(); - } - } - - private Game.Screens.Play.SongProgressGraph.ColumnState state; - public Game.Screens.Play.SongProgressGraph.ColumnState State - { - get { return state; } - set - { - if (value == state) return; - state = value; - - fillActive(); - } - } - - public Column(Color4 litColour) - { - Size = new Vector2(WIDTH, HEIGHT); - this.litColour = litColour; - - for (int r = 0; r < cube_count; r++) - { - drawableRows.Add(new Box - { - EdgeSmoothness = new Vector2(padding / 4), - Size = new Vector2(cube_size), - Position = new Vector2(0, r * WIDTH + padding), - }); - } - - Children = drawableRows; - - // Reverse drawableRows so when iterating through them they start at the bottom - drawableRows.Reverse(); - } - - private void fillActive() - { - Color4 colour = State == Game.Screens.Play.SongProgressGraph.ColumnState.Lit ? litColour : dimmedColour; - - for (int i = 0; i < drawableRows.Count; i++) - { - if (Filled == 0) // i <= Filled doesn't work for zero fill - drawableRows[i].Colour = emptyColour; - else - drawableRows[i].Colour = i <= Filled ? colour : emptyColour; - } - } - } - - public enum ColumnState - { - Lit, - Dimmed - } - } - - public class SongProgressBar : DragBar - { - public Color4 FillColour - { - get { return FillContainer.Colour; } - set { FillContainer.Colour = value; } - } - - public SongProgressBar(float barHeight, float handleBarHeight, Vector2 handleSize) - { - Height = barHeight + handleBarHeight + handleSize.Y; - FillContainer.RelativeSizeAxes = Axes.X; - FillContainer.Height = barHeight; - - Add(new Box - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - RelativeSizeAxes = Axes.X, - Height = barHeight, - Colour = Color4.Black, - Alpha = 0.5f, - Depth = 1 - }); - FillContainer.Add(new Container - { - Origin = Anchor.BottomRight, - Anchor = Anchor.BottomRight, - Width = 2, - Height = barHeight + handleBarHeight, - Colour = Color4.White, - Position = new Vector2(2, 0), - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - }, - new Container - { - Origin = Anchor.BottomCentre, - Anchor = Anchor.TopCentre, - Size = handleSize, - CornerRadius = 5, - Masking = true, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = Color4.White - } - } - } - } - }); - } - } } diff --git a/osu.Game/Overlays/DragBar.cs b/osu.Game/Overlays/DragBar.cs index 8690388127..16e399deae 100644 --- a/osu.Game/Overlays/DragBar.cs +++ b/osu.Game/Overlays/DragBar.cs @@ -13,7 +13,7 @@ namespace osu.Game.Overlays { public class DragBar : Container { - protected readonly Container FillContainer; + protected readonly Container Fill; public Action SeekRequested; @@ -27,7 +27,7 @@ namespace osu.Game.Overlays { enabled = value; if (!enabled) - FillContainer.Width = 0; + Fill.Width = 0; } } @@ -37,8 +37,9 @@ namespace osu.Game.Overlays Children = new Drawable[] { - FillContainer = new Container + Fill = new Container { + Name = "FillContainer", Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, RelativeSizeAxes = Axes.Both, @@ -63,8 +64,10 @@ namespace osu.Game.Overlays private void seek(InputState state) { - if (!IsEnabled) return; float seekLocation = state.Mouse.Position.X / DrawWidth; + + if (!IsEnabled) return; + SeekRequested?.Invoke(seekLocation); updatePosition(seekLocation); } @@ -72,7 +75,7 @@ namespace osu.Game.Overlays private void updatePosition(float position) { position = MathHelper.Clamp(position, 0, 1); - FillContainer.TransformTo(() => FillContainer.Width, position, 200, EasingTypes.OutQuint, new TransformSeek()); + Fill.TransformTo(() => Fill.Width, position, 200, EasingTypes.OutQuint, new TransformSeek()); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index b2e289c422..1cb4ebd380 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -11,7 +11,7 @@ using osu.Framework.Allocation; namespace osu.Game.Screens.Play { - public class SongProgress : OverlayContainer + public class SongProgress : OverlayContainer { private const int progress_height = 5; @@ -51,6 +51,7 @@ namespace osu.Game.Screens.Play { RelativeSizeAxes = Axes.X; Height = progress_height + SongProgressGraph.Column.HEIGHT + handle_size.Y; + Y = progress_height; Children = new Drawable[] { @@ -64,8 +65,9 @@ namespace osu.Game.Screens.Play }, bar = new SongProgressBar(progress_height, SongProgressGraph.Column.HEIGHT, handle_size) { - Origin = Anchor.BottomLeft, + Alpha = 0, Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, SeekRequested = delegate (float position) { OnSeek?.Invoke(position); @@ -74,26 +76,40 @@ namespace osu.Game.Screens.Play }; } + protected override void LoadComplete() + { + State = Visibility.Visible; + } + private void updateProgress() { bar.UpdatePosition((float)progress); graph.Progress = (int)(graph.ColumnCount * progress); } + private bool barVisible; + + public void ToggleBar() + { + barVisible = !barVisible; + updateBarVisibility(); + } + + private void updateBarVisibility() + { + bar.FadeTo(barVisible ? 1 : 0, transition_duration, EasingTypes.In); + MoveTo(new Vector2(0, barVisible ? 0 : progress_height), transition_duration, EasingTypes.In); + } + protected override void PopIn() { - bar.IsEnabled = true; - updateProgress(); //in case progress was changed while the bar was hidden - - bar.FadeIn(transition_duration, EasingTypes.In); - MoveTo(Vector2.Zero, transition_duration, EasingTypes.In); + updateBarVisibility(); + FadeIn(100); } protected override void PopOut() { - bar.IsEnabled = false; - bar.FadeOut(transition_duration, EasingTypes.In); - MoveTo(new Vector2(0f, progress_height), transition_duration, EasingTypes.In); + FadeOut(100); } protected override void Update() diff --git a/osu.Game/Screens/Play/SongProgressBar.cs b/osu.Game/Screens/Play/SongProgressBar.cs index a42122d9e1..d0fb3c8a3d 100644 --- a/osu.Game/Screens/Play/SongProgressBar.cs +++ b/osu.Game/Screens/Play/SongProgressBar.cs @@ -14,18 +14,20 @@ namespace osu.Game.Screens.Play { public Color4 FillColour { - get { return FillContainer.Colour; } - set { FillContainer.Colour = value; } + get { return Fill.Colour; } + set { Fill.Colour = value; } } public SongProgressBar(float barHeight, float handleBarHeight, Vector2 handleSize) { Height = barHeight + handleBarHeight + handleSize.Y; - FillContainer.RelativeSizeAxes = Axes.X; - FillContainer.Height = barHeight; + + Fill.RelativeSizeAxes = Axes.X; + Fill.Height = barHeight; Add(new Box { + Name = "Background", Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.X, @@ -34,7 +36,8 @@ namespace osu.Game.Screens.Play Alpha = 0.5f, Depth = 1 }); - FillContainer.Add(new Container + + Fill.Add(new Container { Origin = Anchor.BottomRight, Anchor = Anchor.BottomRight, From 6421f040dd747f55c7e70ec5d4d96116244b65a5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Apr 2017 15:27:24 +0900 Subject: [PATCH 170/442] Fix SongProgress handling escape. --- osu.Game/Screens/Play/SongProgress.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 1cb4ebd380..b5f9b7b822 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -15,6 +15,8 @@ namespace osu.Game.Screens.Play { private const int progress_height = 5; + protected override bool HideOnEscape => false; + private static readonly Vector2 handle_size = new Vector2(14, 25); private const float transition_duration = 200; @@ -104,7 +106,7 @@ namespace osu.Game.Screens.Play protected override void PopIn() { updateBarVisibility(); - FadeIn(100); + FadeIn(500, EasingTypes.OutQuint); } protected override void PopOut() From acd7a5b254721a6955dacc8e31e8b3e68ca62a23 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Apr 2017 17:58:30 +0900 Subject: [PATCH 171/442] Hook up beatmap object density to progress display. --- .../Tests/TestCaseSongProgress.cs | 11 +++---- osu.Game/Modes/UI/HitRenderer.cs | 4 +++ osu.Game/Modes/UI/StandardHudOverlay.cs | 2 -- osu.Game/Screens/Play/Player.cs | 7 ++--- osu.Game/Screens/Play/SongProgress.cs | 31 +++++++++++++++++-- 5 files changed, 40 insertions(+), 15 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs index aafd1753e5..5563c0170d 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using osu.Framework.Graphics; using osu.Framework.MathUtils; using osu.Framework.Testing; +using osu.Game.Modes.Objects; using osu.Game.Screens.Play; namespace osu.Desktop.VisualTests.Tests @@ -35,13 +36,11 @@ namespace osu.Desktop.VisualTests.Tests private void displayNewValues() { - List newValues = new List(); - for (int i = 0; i < 1000; i++) - { - newValues.Add(RNG.Next(0, 6)); - } + List objects = new List(); + for (double i = 0; i < 2000; i += RNG.NextDouble() * 10 + i / 1000) + objects.Add(new HitObject { StartTime = i }); - progress.Values = newValues.ToArray(); + progress.Objects = objects; progress.Progress = RNG.NextDouble(); } } diff --git a/osu.Game/Modes/UI/HitRenderer.cs b/osu.Game/Modes/UI/HitRenderer.cs index dd5eff5a95..6962c80d87 100644 --- a/osu.Game/Modes/UI/HitRenderer.cs +++ b/osu.Game/Modes/UI/HitRenderer.cs @@ -58,6 +58,8 @@ namespace osu.Game.Modes.UI /// public bool HasReplayLoaded => InputManager.ReplayInputHandler != null; + public abstract IEnumerable Objects { get; } + /// /// Whether all the HitObjects have been judged. /// @@ -185,6 +187,8 @@ namespace osu.Game.Modes.UI private readonly Container content; + public override IEnumerable Objects => Beatmap.HitObjects; + protected HitRenderer(WorkingBeatmap beatmap) : base(beatmap) { diff --git a/osu.Game/Modes/UI/StandardHudOverlay.cs b/osu.Game/Modes/UI/StandardHudOverlay.cs index e2eda4a168..2ff5d327df 100644 --- a/osu.Game/Modes/UI/StandardHudOverlay.cs +++ b/osu.Game/Modes/UI/StandardHudOverlay.cs @@ -57,8 +57,6 @@ namespace osu.Game.Modes.UI Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.X, - Depth = -2, //todo: find out why this doesn't put progress on top of PauseOverlay - Values = new[] { 3 }, //todo: removeme }; } } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 570c1831c0..1e3555f798 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -63,9 +63,7 @@ namespace osu.Game.Screens.Play [BackgroundDependencyLoader] private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config) { - var beatmap = Beatmap.Beatmap; - - if (beatmap.BeatmapInfo?.Mode > PlayMode.Taiko) + if (Beatmap.Beatmap.BeatmapInfo?.Mode > PlayMode.Taiko) { //we only support osu! mode for now because the hitobject parsing is crappy and needs a refactor. Exit(); @@ -125,7 +123,8 @@ namespace osu.Game.Screens.Play hudOverlay.KeyCounter.Add(ruleset.CreateGameplayKeys()); hudOverlay.BindProcessor(scoreProcessor); hudOverlay.BindHitRenderer(HitRenderer); - hudOverlay.Progress.Hide(); + + hudOverlay.Progress.Objects = HitRenderer.Objects; //bind HitRenderer to ScoreProcessor and ourselves (for a pass situation) HitRenderer.OnAllJudged += onCompletion; diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index b5f9b7b822..4efd05ccb7 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -6,8 +6,12 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using System; +using System.Collections.Generic; using osu.Game.Graphics; using osu.Framework.Allocation; +using System.Linq; +using osu.Game.Modes.Objects; +using osu.Game.Modes.Objects.Types; namespace osu.Game.Screens.Play { @@ -37,10 +41,31 @@ namespace osu.Game.Screens.Play } } - public int[] Values + public IEnumerable Objects { - get { return graph.Values; } - set { graph.Values = value; } + set + { + var objects = value; + + const int granularity = 200; + + var lastHit = ((objects.Last() as IHasEndTime)?.EndTime ?? objects.Last().StartTime) + 1; + var interval = lastHit / granularity; + + var values = new int[granularity]; + + foreach (var h in objects) + { + IHasEndTime end = h as IHasEndTime; + + int startRange = (int)(h.StartTime / interval); + int endRange = (int)((end?.EndTime ?? h.StartTime) / interval); + for (int i = startRange; i <= endRange; i++) + values[i]++; + } + + graph.Values = values; + } } [BackgroundDependencyLoader] From ea0631ede8008a38b09f50e2babf80a2dd0f7458 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Apr 2017 18:23:34 +0900 Subject: [PATCH 172/442] Encapsulate progress update logic better. --- .../Tests/TestCaseSongProgress.cs | 1 - osu.Game/Screens/Play/Player.cs | 8 +---- osu.Game/Screens/Play/SongProgress.cs | 35 ++++++++----------- 3 files changed, 15 insertions(+), 29 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs index 5563c0170d..50d6918faa 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs @@ -41,7 +41,6 @@ namespace osu.Desktop.VisualTests.Tests objects.Add(new HitObject { StartTime = i }); progress.Objects = objects; - progress.Progress = RNG.NextDouble(); } } } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 1e3555f798..666c3e41a4 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -125,6 +125,7 @@ namespace osu.Game.Screens.Play hudOverlay.BindHitRenderer(HitRenderer); hudOverlay.Progress.Objects = HitRenderer.Objects; + hudOverlay.Progress.AudioClock = interpolatedSourceClock; //bind HitRenderer to ScoreProcessor and ourselves (for a pass situation) HitRenderer.OnAllJudged += onCompletion; @@ -175,13 +176,6 @@ namespace osu.Game.Screens.Play }; } - protected override void Update() - { - base.Update(); - - hudOverlay.Progress.Progress = Beatmap.Track.CurrentTime / Beatmap.Track.Length; - } - private void initializeSkipButton() { const double skip_required_cutoff = 3000; diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 4efd05ccb7..52f3b9e1ae 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -10,12 +10,13 @@ using System.Collections.Generic; using osu.Game.Graphics; using osu.Framework.Allocation; using System.Linq; +using osu.Framework.Timing; using osu.Game.Modes.Objects; using osu.Game.Modes.Objects.Types; namespace osu.Game.Screens.Play { - public class SongProgress : OverlayContainer + public class SongProgress : OverlayContainer { private const int progress_height = 5; @@ -30,27 +31,21 @@ namespace osu.Game.Screens.Play public Action OnSeek; - private double progress; - public double Progress - { - get { return progress; } - set - { - progress = value; - updateProgress(); - } - } + public IClock AudioClock; + + private double lastHitTime => ((objects.Last() as IHasEndTime)?.EndTime ?? objects.Last().StartTime) + 1; + + private IEnumerable objects; public IEnumerable Objects { set { - var objects = value; + objects = value; const int granularity = 200; - var lastHit = ((objects.Last() as IHasEndTime)?.EndTime ?? objects.Last().StartTime) + 1; - var interval = lastHit / granularity; + var interval = lastHitTime / granularity; var values = new int[granularity]; @@ -108,12 +103,6 @@ namespace osu.Game.Screens.Play State = Visibility.Visible; } - private void updateProgress() - { - bar.UpdatePosition((float)progress); - graph.Progress = (int)(graph.ColumnCount * progress); - } - private bool barVisible; public void ToggleBar() @@ -143,7 +132,11 @@ namespace osu.Game.Screens.Play { base.Update(); - updateProgress(); + double progress = (AudioClock?.CurrentTime ?? Time.Current) / lastHitTime; + + bar.UpdatePosition((float)progress); + graph.Progress = (int)(graph.ColumnCount * progress); + } } } From 98544a807776c349cb34d816c4947ee46567d187 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Apr 2017 19:20:07 +0900 Subject: [PATCH 173/442] Fix unsynchronised tweening. --- osu.Game/Overlays/DragBar.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/DragBar.cs b/osu.Game/Overlays/DragBar.cs index 16e399deae..bb28f08553 100644 --- a/osu.Game/Overlays/DragBar.cs +++ b/osu.Game/Overlays/DragBar.cs @@ -59,7 +59,7 @@ namespace osu.Game.Overlays { if (IsSeeking || !IsEnabled) return; - updatePosition(position); + updatePosition(position, false); } private void seek(InputState state) @@ -72,10 +72,10 @@ namespace osu.Game.Overlays updatePosition(seekLocation); } - private void updatePosition(float position) + private void updatePosition(float position, bool easing = true) { position = MathHelper.Clamp(position, 0, 1); - Fill.TransformTo(() => Fill.Width, position, 200, EasingTypes.OutQuint, new TransformSeek()); + Fill.TransformTo(() => Fill.Width, position, easing ? 200 : 0, EasingTypes.OutQuint, new TransformSeek()); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) From 627114abeca6f0d6d7e5e0e0a5f9e463270bd59b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Apr 2017 19:23:33 +0900 Subject: [PATCH 174/442] Improve test case. --- osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs index 50d6918faa..363b0b481e 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using osu.Framework.Graphics; using osu.Framework.MathUtils; using osu.Framework.Testing; +using osu.Framework.Timing; using osu.Game.Modes.Objects; using osu.Game.Screens.Play; @@ -22,14 +23,16 @@ namespace osu.Desktop.VisualTests.Tests Add(progress = new SongProgress { + AudioClock = new StopwatchClock(true), Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, }); AddStep("Toggle Bar", progress.ToggleBar); AddWaitStep(5); - //AddStep("Toggle Bar", progress.ToggleVisibility); - //AddStep("New Values", displayNewValues); + AddStep("Toggle Bar", progress.ToggleBar); + AddWaitStep(2); + AddRepeatStep("New Values", displayNewValues, 5); displayNewValues(); } @@ -37,7 +40,7 @@ namespace osu.Desktop.VisualTests.Tests private void displayNewValues() { List objects = new List(); - for (double i = 0; i < 2000; i += RNG.NextDouble() * 10 + i / 1000) + for (double i = 0; i < 5000; i += RNG.NextDouble() * 10 + i / 1000) objects.Add(new HitObject { StartTime = i }); progress.Objects = objects; From ed3956eca534f94f30bdccb9f9699f7ba0159e61 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Apr 2017 20:09:01 +0900 Subject: [PATCH 175/442] Make comma separators optional. --- osu.Game/Graphics/UserInterface/ScoreCounter.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/ScoreCounter.cs b/osu.Game/Graphics/UserInterface/ScoreCounter.cs index b035dbb547..3e01b9e4f4 100644 --- a/osu.Game/Graphics/UserInterface/ScoreCounter.cs +++ b/osu.Game/Graphics/UserInterface/ScoreCounter.cs @@ -5,7 +5,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Transforms; using osu.Framework.MathUtils; using System; -using osu.Framework.Allocation; namespace osu.Game.Graphics.UserInterface { @@ -16,6 +15,8 @@ namespace osu.Game.Graphics.UserInterface protected override double RollingDuration => 1000; protected override EasingTypes RollingEasing => EasingTypes.Out; + public bool UseCommaSeparator; + /// /// How many leading zeroes the counter has. /// @@ -43,8 +44,9 @@ namespace osu.Game.Graphics.UserInterface protected override string FormatCount(double count) { string format = new string('0', (int)LeadingZeroes); - for (int i = format.Length - 3; i > 0; i -= 3) - format = format.Insert(i, @","); + if (UseCommaSeparator) + for (int i = format.Length - 3; i > 0; i -= 3) + format = format.Insert(i, @","); return ((long)count).ToString(format); } From 52ddc414d5b5eec3b1bf5e217a9715b65f23bef2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Apr 2017 20:17:17 +0900 Subject: [PATCH 176/442] Fix errors. --- osu.Game/Graphics/UserInterface/PercentageCounter.cs | 1 - osu.Game/Graphics/UserInterface/SimpleComboCounter.cs | 6 ++---- osu.Game/Modes/UI/StandardHealthDisplay.cs | 3 --- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/PercentageCounter.cs b/osu.Game/Graphics/UserInterface/PercentageCounter.cs index 63c27426c0..c32b654840 100644 --- a/osu.Game/Graphics/UserInterface/PercentageCounter.cs +++ b/osu.Game/Graphics/UserInterface/PercentageCounter.cs @@ -5,7 +5,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Transforms; using osu.Framework.MathUtils; using System; -using osu.Framework.Allocation; namespace osu.Game.Graphics.UserInterface { diff --git a/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs b/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs index 1b0526a668..8537e80f63 100644 --- a/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs +++ b/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs @@ -2,8 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using OpenTK.Graphics; -using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Transforms; using osu.Framework.MathUtils; @@ -15,7 +13,7 @@ namespace osu.Game.Graphics.UserInterface /// public class SimpleComboCounter : RollingCounter { - protected override Type TransformType => typeof(TransformCount); + protected override Type TransformType => typeof(TransformCounterCount); protected override double RollingDuration => 750; @@ -39,7 +37,7 @@ namespace osu.Game.Graphics.UserInterface Current.Value = Current + amount; } - protected class TransformCount : Transform + private class TransformCounterCount : Transform { public override int CurrentValue { diff --git a/osu.Game/Modes/UI/StandardHealthDisplay.cs b/osu.Game/Modes/UI/StandardHealthDisplay.cs index 2fdfd02194..12d0f841a2 100644 --- a/osu.Game/Modes/UI/StandardHealthDisplay.cs +++ b/osu.Game/Modes/UI/StandardHealthDisplay.cs @@ -1,11 +1,8 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using OpenTK; using OpenTK.Graphics; -using osu.Framework.Allocation; -using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; From 31ce66bfdcd19141148c3a8fd8db1946bda09e8a Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Sat, 15 Apr 2017 01:31:42 +0900 Subject: [PATCH 177/442] Trim whitespace. --- osu.Game/Modes/UI/StandardHudOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Modes/UI/StandardHudOverlay.cs b/osu.Game/Modes/UI/StandardHudOverlay.cs index 6e9d5fb805..161a700bef 100644 --- a/osu.Game/Modes/UI/StandardHudOverlay.cs +++ b/osu.Game/Modes/UI/StandardHudOverlay.cs @@ -63,7 +63,7 @@ namespace osu.Game.Modes.UI Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.X, }; - + [BackgroundDependencyLoader] private void load(OsuColour colours) { From 2a9f4e6950b2bd8d98c99a5bbc70e95130f48477 Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Fri, 14 Apr 2017 12:42:42 -0500 Subject: [PATCH 178/442] Get MenuMusic and MenuVoice woking --- osu.Game/Configuration/OsuConfigManager.cs | 5 +- osu.Game/Screens/Menu/Intro.cs | 60 ++++++++++++++++++---- 2 files changed, 52 insertions(+), 13 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index e2f33479c0..38fe739a12 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -35,6 +35,9 @@ namespace osu.Game.Configuration Set(OsuConfig.MenuParallax, true); + Set(OsuConfig.MenuVoice, true); + Set(OsuConfig.MenuMusic, true); + Set(OsuConfig.ShowInterface, true); Set(OsuConfig.KeyOverlay, false); //todo: implement all settings below this line (remove the Disabled set when doing so). @@ -145,8 +148,6 @@ namespace osu.Game.Configuration Set(OsuConfig.YahooIntegration, false).Disabled = true; Set(OsuConfig.ForceFrameFlush, false).Disabled = true; Set(OsuConfig.DetectPerformanceIssues, true).Disabled = true; - Set(OsuConfig.MenuMusic, true).Disabled = true; - Set(OsuConfig.MenuVoice, true).Disabled = true; Set(OsuConfig.RawInput, false).Disabled = true; Set(OsuConfig.AbsoluteToOsuWindow, Get(OsuConfig.RawInput)).Disabled = true; Set(OsuConfig.ShowMenuTips, true).Disabled = true; diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index ac926cba0c..b65c221fa3 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -1,12 +1,18 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Audio.Track; +using osu.Framework.Configuration; +using osu.Framework.MathUtils; using osu.Framework.Screens; using osu.Framework.Graphics; +using osu.Game.Beatmaps; +using osu.Game.Configuration; +using osu.Game.Database; using osu.Game.Graphics.Containers; using osu.Game.Screens.Backgrounds; using OpenTK.Graphics; @@ -56,30 +62,60 @@ namespace osu.Game.Screens.Menu }; } + private Bindable menuVoice; + private Bindable osuBGM; + private BeatmapDatabase beatmaps; + private TrackManager trackManager; + private BeatmapInfo beatmap; + private WorkingBeatmap song; + [BackgroundDependencyLoader] - private void load(AudioManager audio) + private void load(OsuGameBase game, AudioManager audio, OsuConfigManager config, BeatmapDatabase beatmaps) { + menuVoice = config.GetBindable(OsuConfig.MenuVoice); + osuBGM = config.GetBindable(OsuConfig.MenuMusic); + + if (osuBGM) + { + bgm = audio.Track.Get(@"circles"); + bgm.Looping = true; + } + else + { + this.beatmaps = beatmaps; + trackManager = game.Audio.Track; + beatmap = beatmaps.GetWithChildren(RNG.Next(0, beatmaps.Query().Count() - 1)).Beatmaps[0]; + song = beatmaps.GetWorkingBeatmap(beatmap, null); + } + welcome = audio.Sample.Get(@"welcome"); + seeya = audio.Sample.Get(@"seeya"); - bgm = audio.Track.Get(@"circles"); - bgm.Looping = true; } protected override void OnEntering(Screen last) { base.OnEntering(last); - welcome.Play(); - + if(menuVoice) + welcome.Play(); Scheduler.AddDelayed(delegate { - bgm.Start(); + if(osuBGM) + bgm.Start(); LoadComponentAsync(mainMenu = new MainMenu()); Scheduler.AddDelayed(delegate { + if (!osuBGM) + Task.Run(() => + { + trackManager.SetExclusive(song.Track); + song.Track.Seek(beatmap.Metadata.PreviewTime); + song.Track.Start(); + }); DidLoadMenu = true; Push(mainMenu); }, 2300); @@ -109,15 +145,17 @@ namespace osu.Game.Screens.Menu if (!(last is MainMenu)) Content.FadeIn(300); + double fadeOutTime = 2000; //we also handle the exit transition. - seeya.Play(); + if (menuVoice) + seeya.Play(); + else + fadeOutTime = 500; - const double fade_out_time = 2000; - - Scheduler.AddDelayed(Exit, fade_out_time); + Scheduler.AddDelayed(Exit, fadeOutTime); //don't want to fade out completely else we will stop running updates and shit will hit the fan. - Game.FadeTo(0.01f, fade_out_time); + Game.FadeTo(0.01f, fadeOutTime); base.OnResuming(last); } From 2eb73a7c701d0df5294eda590626507fdc8aa15f Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Fri, 14 Apr 2017 12:58:47 -0500 Subject: [PATCH 179/442] More smoothness when MenuMusic is false --- osu.Game/Screens/Menu/Intro.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index b65c221fa3..e42e9ce475 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -104,18 +104,23 @@ namespace osu.Game.Screens.Menu { if(osuBGM) bgm.Start(); + else + { + Task.Run(() => + { + trackManager.SetExclusive(song.Track); + song.Track.Seek(beatmap.Metadata.PreviewTime); + if (beatmap.Metadata.PreviewTime == -1) + song.Track.Seek(song.Track.Length * .4f); + }); + } LoadComponentAsync(mainMenu = new MainMenu()); Scheduler.AddDelayed(delegate { if (!osuBGM) - Task.Run(() => - { - trackManager.SetExclusive(song.Track); - song.Track.Seek(beatmap.Metadata.PreviewTime); - song.Track.Start(); - }); + Task.Run(() => song.Track.Start()); DidLoadMenu = true; Push(mainMenu); }, 2300); From b5fc84087fd0bfc51f9fc2f53c8eae5116d5f97c Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Fri, 14 Apr 2017 12:59:15 -0500 Subject: [PATCH 180/442] Show song in MusicController and SongSelect --- osu.Game/Screens/Menu/Intro.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index e42e9ce475..0ec7ed13d3 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -86,6 +86,7 @@ namespace osu.Game.Screens.Menu trackManager = game.Audio.Track; beatmap = beatmaps.GetWithChildren(RNG.Next(0, beatmaps.Query().Count() - 1)).Beatmaps[0]; song = beatmaps.GetWorkingBeatmap(beatmap, null); + Beatmap = song; } welcome = audio.Sample.Get(@"welcome"); From b7d61add45555ce9bcd14722e66da91e9336d86d Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Fri, 14 Apr 2017 13:10:59 -0500 Subject: [PATCH 181/442] Cleanup + AppVeyor fixes --- osu.Game/Screens/Menu/Intro.cs | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index 0ec7ed13d3..faacb04876 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -63,8 +63,7 @@ namespace osu.Game.Screens.Menu } private Bindable menuVoice; - private Bindable osuBGM; - private BeatmapDatabase beatmaps; + private Bindable menuMusic; private TrackManager trackManager; private BeatmapInfo beatmap; private WorkingBeatmap song; @@ -73,24 +72,19 @@ namespace osu.Game.Screens.Menu private void load(OsuGameBase game, AudioManager audio, OsuConfigManager config, BeatmapDatabase beatmaps) { menuVoice = config.GetBindable(OsuConfig.MenuVoice); - osuBGM = config.GetBindable(OsuConfig.MenuMusic); - - if (osuBGM) + menuMusic = config.GetBindable(OsuConfig.MenuMusic); + if (!menuMusic) { - bgm = audio.Track.Get(@"circles"); - bgm.Looping = true; - } - else - { - this.beatmaps = beatmaps; trackManager = game.Audio.Track; - beatmap = beatmaps.GetWithChildren(RNG.Next(0, beatmaps.Query().Count() - 1)).Beatmaps[0]; - song = beatmaps.GetWorkingBeatmap(beatmap, null); + beatmap = beatmaps.GetWithChildren(RNG.Next(beatmaps.Query().Count() - 1)).Beatmaps[0]; + song = beatmaps.GetWorkingBeatmap(beatmap); Beatmap = song; } - welcome = audio.Sample.Get(@"welcome"); + bgm = audio.Track.Get(@"circles"); + bgm.Looping = true; + welcome = audio.Sample.Get(@"welcome"); seeya = audio.Sample.Get(@"seeya"); } @@ -103,7 +97,7 @@ namespace osu.Game.Screens.Menu welcome.Play(); Scheduler.AddDelayed(delegate { - if(osuBGM) + if(menuMusic) bgm.Start(); else { @@ -120,7 +114,7 @@ namespace osu.Game.Screens.Menu Scheduler.AddDelayed(delegate { - if (!osuBGM) + if (!menuMusic) Task.Run(() => song.Track.Start()); DidLoadMenu = true; Push(mainMenu); From 59bfc7abad4c043fcae479017ad46c258e897018 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 15 Apr 2017 04:53:37 +0900 Subject: [PATCH 182/442] Move statics to RulesetCollection to avoid conflicts later on. --- osu.Desktop.Tests/VisualTests.cs | 8 ++-- osu.Desktop.VisualTests/Program.cs | 8 ++-- osu.Desktop/Program.cs | 8 ++-- .../Beatmaps/Formats/OsuLegacyDecoderTest.cs | 2 +- .../Beatmaps/IO/ImportBeatmapTest.cs | 8 ++-- .../Beatmaps/IO/OszArchiveReaderTest.cs | 2 +- osu.Game/Beatmaps/Beatmap.cs | 2 +- osu.Game/Beatmaps/Drawables/DifficultyIcon.cs | 2 +- osu.Game/Database/ScoreDatabase.cs | 2 +- osu.Game/Modes/Ruleset.cs | 17 -------- osu.Game/Modes/RulesetCollection.cs | 41 +++++++++++++++++++ osu.Game/Overlays/Mods/ModSelectOverlay.cs | 2 +- osu.Game/Overlays/Options/OptionsFooter.cs | 2 +- osu.Game/Screens/Play/Player.cs | 2 +- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 2 +- osu.Game/osu.Game.csproj | 1 + 16 files changed, 67 insertions(+), 42 deletions(-) create mode 100644 osu.Game/Modes/RulesetCollection.cs diff --git a/osu.Desktop.Tests/VisualTests.cs b/osu.Desktop.Tests/VisualTests.cs index 6519dbe917..36dce18b05 100644 --- a/osu.Desktop.Tests/VisualTests.cs +++ b/osu.Desktop.Tests/VisualTests.cs @@ -20,10 +20,10 @@ namespace osu.Desktop.Tests { using (var host = new HeadlessGameHost()) { - Ruleset.Register(new OsuRuleset()); - Ruleset.Register(new TaikoRuleset()); - Ruleset.Register(new ManiaRuleset()); - Ruleset.Register(new CatchRuleset()); + RulesetCollection.Register(typeof(OsuRuleset)); + RulesetCollection.Register(typeof(TaikoRuleset)); + RulesetCollection.Register(typeof(ManiaRuleset)); + RulesetCollection.Register(typeof(CatchRuleset)); host.Run(new AutomatedVisualTestGame()); } diff --git a/osu.Desktop.VisualTests/Program.cs b/osu.Desktop.VisualTests/Program.cs index fe1cdfd7f0..912034a927 100644 --- a/osu.Desktop.VisualTests/Program.cs +++ b/osu.Desktop.VisualTests/Program.cs @@ -21,10 +21,10 @@ namespace osu.Desktop.VisualTests using (GameHost host = Host.GetSuitableHost(@"osu")) { - Ruleset.Register(new OsuRuleset()); - Ruleset.Register(new TaikoRuleset()); - Ruleset.Register(new ManiaRuleset()); - Ruleset.Register(new CatchRuleset()); + RulesetCollection.Register(typeof(OsuRuleset)); + RulesetCollection.Register(typeof(TaikoRuleset)); + RulesetCollection.Register(typeof(ManiaRuleset)); + RulesetCollection.Register(typeof(CatchRuleset)); if (benchmark) host.Run(new AutomatedVisualTestGame()); diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index ddf58ac363..e9117cf533 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -41,10 +41,10 @@ namespace osu.Desktop } else { - Ruleset.Register(new OsuRuleset()); - Ruleset.Register(new TaikoRuleset()); - Ruleset.Register(new ManiaRuleset()); - Ruleset.Register(new CatchRuleset()); + RulesetCollection.Register(typeof(OsuRuleset)); + RulesetCollection.Register(typeof(TaikoRuleset)); + RulesetCollection.Register(typeof(ManiaRuleset)); + RulesetCollection.Register(typeof(CatchRuleset)); host.Run(new OsuGameDesktop(args)); } diff --git a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs index 8183bc952e..59a5790bea 100644 --- a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs @@ -22,7 +22,7 @@ namespace osu.Game.Tests.Beatmaps.Formats public void SetUp() { OsuLegacyDecoder.Register(); - Ruleset.Register(new OsuRuleset()); + RulesetCollection.Register(typeof(OsuRuleset)); } [Test] diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs index 5d15b43761..66ed27adbb 100644 --- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs @@ -28,10 +28,10 @@ namespace osu.Game.Tests.Beatmaps.IO [OneTimeSetUp] public void SetUp() { - Ruleset.Register(new OsuRuleset()); - Ruleset.Register(new TaikoRuleset()); - Ruleset.Register(new ManiaRuleset()); - Ruleset.Register(new CatchRuleset()); + RulesetCollection.Register(typeof(OsuRuleset)); + RulesetCollection.Register(typeof(TaikoRuleset)); + RulesetCollection.Register(typeof(ManiaRuleset)); + RulesetCollection.Register(typeof(CatchRuleset)); } [Test] diff --git a/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs b/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs index b9c4cf780a..add00d8f4d 100644 --- a/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs @@ -19,7 +19,7 @@ namespace osu.Game.Tests.Beatmaps.IO public void SetUp() { OszArchiveReader.Register(); - Ruleset.Register(new OsuRuleset()); + RulesetCollection.Register(typeof(OsuRuleset)); } [Test] diff --git a/osu.Game/Beatmaps/Beatmap.cs b/osu.Game/Beatmaps/Beatmap.cs index 5709bdc8c5..420b23eb62 100644 --- a/osu.Game/Beatmaps/Beatmap.cs +++ b/osu.Game/Beatmaps/Beatmap.cs @@ -54,7 +54,7 @@ namespace osu.Game.Beatmaps /// Calculates the star difficulty for this Beatmap. /// /// The star difficulty. - public double CalculateStarDifficulty() => Ruleset.GetRuleset(BeatmapInfo.Mode).CreateDifficultyCalculator(this).Calculate(); + public double CalculateStarDifficulty() => RulesetCollection.GetRuleset(BeatmapInfo.Mode).CreateDifficultyCalculator(this).Calculate(); /// /// Constructs a new beatmap. diff --git a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs index 47ae4d7985..3fb5194382 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs @@ -45,7 +45,7 @@ namespace osu.Game.Beatmaps.Drawables Origin = Anchor.Centre, TextSize = Size.X, Colour = Color4.White, - Icon = Ruleset.GetRuleset(beatmap.Mode).Icon + Icon = RulesetCollection.GetRuleset((int)beatmap.Mode).Icon } }; } diff --git a/osu.Game/Database/ScoreDatabase.cs b/osu.Game/Database/ScoreDatabase.cs index 642bb4aff6..e602b2373e 100644 --- a/osu.Game/Database/ScoreDatabase.cs +++ b/osu.Game/Database/ScoreDatabase.cs @@ -39,7 +39,7 @@ namespace osu.Game.Database using (Stream s = storage.GetStream(Path.Combine(replay_folder, replayFilename))) using (SerializationReader sr = new SerializationReader(s)) { - var ruleset = Ruleset.GetRuleset((PlayMode)sr.ReadByte()); + var ruleset = RulesetCollection.GetRuleset((PlayMode)sr.ReadByte()); score = ruleset.CreateScoreProcessor().CreateScore(); /* score.Pass = true;*/ diff --git a/osu.Game/Modes/Ruleset.cs b/osu.Game/Modes/Ruleset.cs index c97420fbe3..42f2fe789f 100644 --- a/osu.Game/Modes/Ruleset.cs +++ b/osu.Game/Modes/Ruleset.cs @@ -22,10 +22,6 @@ namespace osu.Game.Modes public abstract class Ruleset { - private static readonly ConcurrentDictionary available_rulesets = new ConcurrentDictionary(); - - public static IEnumerable PlayModes => available_rulesets.Keys; - public virtual IEnumerable GetBeatmapStatistics(WorkingBeatmap beatmap) => new BeatmapStatistic[] { }; public abstract IEnumerable GetModsFor(ModType type); @@ -36,8 +32,6 @@ namespace osu.Game.Modes public abstract ScoreProcessor CreateScoreProcessor(); - public static void Register(Ruleset ruleset) => available_rulesets.TryAdd(ruleset.PlayMode, ruleset.GetType()); - protected abstract PlayMode PlayMode { get; } public virtual FontAwesome Icon => FontAwesome.fa_question_circle; @@ -45,16 +39,5 @@ namespace osu.Game.Modes public abstract string Description { get; } public abstract IEnumerable CreateGameplayKeys(); - - public static Ruleset GetRuleset(PlayMode mode) - { - Type type; - - if (!available_rulesets.TryGetValue(mode, out type)) - return null; - - return Activator.CreateInstance(type) as Ruleset; - } - } } diff --git a/osu.Game/Modes/RulesetCollection.cs b/osu.Game/Modes/RulesetCollection.cs new file mode 100644 index 0000000000..95d0df4e6a --- /dev/null +++ b/osu.Game/Modes/RulesetCollection.cs @@ -0,0 +1,41 @@ +// 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.Concurrent; +using System.Collections.Generic; + +namespace osu.Game.Modes +{ + public static class RulesetCollection + { + private static readonly ConcurrentDictionary available_rulesets = new ConcurrentDictionary(); + + public static void Register(Type type) + { + Ruleset ruleset = Activator.CreateInstance(type) as Ruleset; + + if (ruleset == null) + return; + + available_rulesets.TryAdd(available_rulesets.Count, ruleset); + } + + public static Ruleset GetRuleset(PlayMode playMode) + { + return GetRuleset((int)playMode); + } + + public static Ruleset GetRuleset(int rulesetId) + { + Ruleset ruleset; + + if (!available_rulesets.TryGetValue(rulesetId, out ruleset)) + throw new InvalidOperationException($"Ruleset id {rulesetId} doesn't exist. How did you trigger this?"); + + return ruleset; + } + + public static IEnumerable AllRulesets => available_rulesets.Values; + } +} diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 2b9f8e86a9..7a21b36da9 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -41,7 +41,7 @@ namespace osu.Game.Overlays.Mods private void modeChanged(PlayMode newMode) { - var ruleset = Ruleset.GetRuleset(newMode); + var ruleset = RulesetCollection.GetRuleset(newMode); foreach (ModSection section in modSectionsContainer.Children) section.Buttons = ruleset.GetModsFor(section.ModType).Select(m => new ModButton(m)).ToArray(); refreshSelectedMods(); diff --git a/osu.Game/Overlays/Options/OptionsFooter.cs b/osu.Game/Overlays/Options/OptionsFooter.cs index c42fe42428..fde4d8a925 100644 --- a/osu.Game/Overlays/Options/OptionsFooter.cs +++ b/osu.Game/Overlays/Options/OptionsFooter.cs @@ -30,7 +30,7 @@ namespace osu.Game.Overlays.Options foreach (PlayMode m in Enum.GetValues(typeof(PlayMode))) modes.Add(new TextAwesome { - Icon = Ruleset.GetRuleset(m).Icon, + Icon = RulesetCollection.GetRuleset(m).Icon, Colour = Color4.Gray, TextSize = 20 }); diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index fa564cdd61..e43eb6cd73 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -109,7 +109,7 @@ namespace osu.Game.Screens.Play sourceClock.Reset(); }); - ruleset = Ruleset.GetRuleset(Beatmap.PlayMode); + ruleset = RulesetCollection.GetRuleset(Beatmap.PlayMode); HitRenderer = ruleset.CreateHitRendererWith(Beatmap); scoreProcessor = HitRenderer.CreateScoreProcessor(); diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 768cef4645..586100c47d 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -100,7 +100,7 @@ namespace osu.Game.Screens.Select })); //get statistics fromt he current ruleset. - labels.AddRange(Ruleset.GetRuleset(beatmap.BeatmapInfo.Mode).GetBeatmapStatistics(beatmap).Select(s => new InfoLabel(s))); + labels.AddRange(RulesetCollection.GetRuleset(beatmap.BeatmapInfo.Mode).GetBeatmapStatistics(beatmap).Select(s => new InfoLabel(s))); } AlwaysPresent = true; diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index f810eeec96..b89f7a3b65 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -131,6 +131,7 @@ + From a89af273be58b7b7388ef34edd9ad999d97e2cea Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 15 Apr 2017 05:01:36 +0900 Subject: [PATCH 183/442] Make BeatmapInfo expose Ruleset instead of PlayMode. --- osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs | 7 +++---- osu.Desktop.VisualTests/Tests/TestCasePlayer.cs | 4 ++-- osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs | 2 +- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 2 +- osu.Game/Beatmaps/WorkingBeatmap.cs | 2 +- osu.Game/Database/BeatmapInfo.cs | 5 ++++- osu.Game/Screens/Play/Player.cs | 2 +- osu.Game/Screens/Select/FilterCriteria.cs | 2 +- 8 files changed, 14 insertions(+), 12 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs index 1a43425dda..4047c4b95f 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs @@ -6,7 +6,6 @@ using osu.Desktop.VisualTests.Platform; using osu.Framework.Testing; using osu.Framework.MathUtils; using osu.Game.Database; -using osu.Game.Modes; using osu.Game.Screens.Select; using osu.Game.Screens.Select.Filter; @@ -72,7 +71,7 @@ namespace osu.Desktop.VisualTests.Tests new BeatmapInfo { OnlineBeatmapID = 1234 + i, - Mode = PlayMode.Osu, + Mode = 0, Path = "normal.osu", Version = "Normal", Difficulty = new BeatmapDifficulty @@ -83,7 +82,7 @@ namespace osu.Desktop.VisualTests.Tests new BeatmapInfo { OnlineBeatmapID = 1235 + i, - Mode = PlayMode.Osu, + Mode = 0, Path = "hard.osu", Version = "Hard", Difficulty = new BeatmapDifficulty @@ -94,7 +93,7 @@ namespace osu.Desktop.VisualTests.Tests new BeatmapInfo { OnlineBeatmapID = 1236 + i, - Mode = PlayMode.Osu, + Mode = 0, Path = "insane.osu", Version = "Insane", Difficulty = new BeatmapDifficulty diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs index 624723ed35..2a9c31b2e9 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs @@ -9,12 +9,12 @@ using osu.Game.Beatmaps; using OpenTK; using osu.Framework.Graphics.Sprites; using osu.Game.Database; -using osu.Game.Modes; using osu.Game.Modes.Objects; using osu.Game.Modes.Osu.Objects; using osu.Game.Screens.Play; using OpenTK.Graphics; using osu.Desktop.VisualTests.Beatmaps; +using osu.Game.Modes.Osu; namespace osu.Desktop.VisualTests.Tests { @@ -37,7 +37,7 @@ namespace osu.Desktop.VisualTests.Tests WorkingBeatmap beatmap = null; - var beatmapInfo = db.Query().FirstOrDefault(b => b.Mode == PlayMode.Osu); + var beatmapInfo = db.Query().FirstOrDefault(b => b.Ruleset is OsuRuleset); if (beatmapInfo != null) beatmap = db.GetWorkingBeatmap(beatmapInfo); diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs index 66ed27adbb..e110da59b9 100644 --- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs @@ -166,7 +166,7 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.IsTrue(set.Beatmaps.Count > 0); - var beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.Mode == PlayMode.Osu))?.Beatmap; + var beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.Ruleset is OsuRuleset))?.Beatmap; Assert.IsTrue(beatmap?.HitObjects.Count > 0); } diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index 35d81311d2..4e39b48f96 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -84,7 +84,7 @@ namespace osu.Game.Beatmaps.Formats beatmap.BeatmapInfo.StackLeniency = float.Parse(val, NumberFormatInfo.InvariantInfo); break; case @"Mode": - beatmap.BeatmapInfo.Mode = (PlayMode)int.Parse(val); + beatmap.BeatmapInfo.Mode = int.Parse(val); break; case @"LetterboxInBreaks": beatmap.BeatmapInfo.LetterboxInBreaks = int.Parse(val) == 1; diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 5bea1d0986..dd0bdef3b7 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -24,7 +24,7 @@ namespace osu.Game.Beatmaps /// public PlayMode? PreferredPlayMode; - public PlayMode PlayMode => Beatmap?.BeatmapInfo?.Mode > PlayMode.Osu ? Beatmap.BeatmapInfo.Mode : PreferredPlayMode ?? PlayMode.Osu; + public PlayMode PlayMode => Beatmap?.BeatmapInfo?.Mode > (int)PlayMode.Osu ? (PlayMode)Beatmap.BeatmapInfo.Mode : PreferredPlayMode ?? PlayMode.Osu; public readonly Bindable> Mods = new Bindable>(); diff --git a/osu.Game/Database/BeatmapInfo.cs b/osu.Game/Database/BeatmapInfo.cs index 3e84825919..72ff078d9e 100644 --- a/osu.Game/Database/BeatmapInfo.cs +++ b/osu.Game/Database/BeatmapInfo.cs @@ -54,7 +54,10 @@ namespace osu.Game.Database public bool Countdown { get; set; } public float StackLeniency { get; set; } public bool SpecialStyle { get; set; } - public PlayMode Mode { get; set; } + + public int Mode { get; set; } + public Ruleset Ruleset => RulesetCollection.GetRuleset(Mode); + public bool LetterboxInBreaks { get; set; } public bool WidescreenStoryboard { get; set; } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index e43eb6cd73..134400d531 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -63,7 +63,7 @@ namespace osu.Game.Screens.Play [BackgroundDependencyLoader] private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config) { - if (Beatmap.Beatmap.BeatmapInfo?.Mode > PlayMode.Taiko) + if (Beatmap.Beatmap.BeatmapInfo?.Mode > (int)PlayMode.Taiko) { //we only support osu! mode for now because the hitobject parsing is crappy and needs a refactor. Exit(); diff --git a/osu.Game/Screens/Select/FilterCriteria.cs b/osu.Game/Screens/Select/FilterCriteria.cs index 2654129a44..19d3645e45 100644 --- a/osu.Game/Screens/Select/FilterCriteria.cs +++ b/osu.Game/Screens/Select/FilterCriteria.cs @@ -23,7 +23,7 @@ namespace osu.Game.Screens.Select { var set = g.BeatmapSet; - bool hasCurrentMode = set.Beatmaps.Any(bm => bm.Mode == Mode); + bool hasCurrentMode = set.Beatmaps.Any(bm => bm.Mode == (int)Mode); bool match = hasCurrentMode; From 0a1376c2db4bbdd1a2b667843f4ec0ffaf39537f Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 15 Apr 2017 05:22:41 +0900 Subject: [PATCH 184/442] Remove PlayMode game-wide. --- .../Tests/TestCaseModSelectOverlay.cs | 7 +++---- osu.Game.Modes.Catch/CatchRuleset.cs | 2 -- osu.Game.Modes.Mania/ManiaRuleset.cs | 2 -- osu.Game.Modes.Osu/OsuRuleset.cs | 2 -- osu.Game.Modes.Taiko/TaikoRuleset.cs | 2 -- .../Beatmaps/Formats/OsuLegacyDecoderTest.cs | 2 +- osu.Game/Beatmaps/WorkingBeatmap.cs | 8 -------- osu.Game/Configuration/OsuConfigManager.cs | 4 +--- osu.Game/Database/ScoreDatabase.cs | 2 +- osu.Game/Modes/PlayMode.cs | 13 ------------- osu.Game/Modes/Ruleset.cs | 2 -- osu.Game/Modes/RulesetCollection.cs | 5 ----- osu.Game/OsuGame.cs | 11 ++++++----- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 13 ++++++------- osu.Game/Overlays/Options/OptionsFooter.cs | 6 ++++-- osu.Game/Overlays/Toolbar/Toolbar.cs | 8 ++++---- osu.Game/Overlays/Toolbar/ToolbarModeButton.cs | 14 +++++++------- osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs | 14 +++++++------- osu.Game/Screens/Play/Player.cs | 9 +-------- osu.Game/Screens/Select/FilterControl.cs | 11 ++++++----- osu.Game/Screens/Select/FilterCriteria.cs | 4 ++-- osu.Game/Screens/Select/SongSelect.cs | 7 +++---- osu.Game/osu.Game.csproj | 1 - 23 files changed, 52 insertions(+), 97 deletions(-) delete mode 100644 osu.Game/Modes/PlayMode.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs index 7677682ac8..c569f5f64a 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs @@ -26,10 +26,9 @@ namespace osu.Desktop.VisualTests.Tests }); AddStep("Toggle", modSelect.ToggleVisibility); - AddStep("osu!", () => modSelect.PlayMode.Value = PlayMode.Osu); - AddStep("osu!taiko", () => modSelect.PlayMode.Value = PlayMode.Taiko); - AddStep("osu!catch", () => modSelect.PlayMode.Value = PlayMode.Catch); - AddStep("osu!mania", () => modSelect.PlayMode.Value = PlayMode.Mania); + + foreach (var ruleset in RulesetCollection.AllRulesets) + AddStep(ruleset.Description, () => modSelect.Ruleset.Value = ruleset); } } } diff --git a/osu.Game.Modes.Catch/CatchRuleset.cs b/osu.Game.Modes.Catch/CatchRuleset.cs index 09d8bdb9e5..02c170d0ac 100644 --- a/osu.Game.Modes.Catch/CatchRuleset.cs +++ b/osu.Game.Modes.Catch/CatchRuleset.cs @@ -76,8 +76,6 @@ namespace osu.Game.Modes.Catch } } - protected override PlayMode PlayMode => PlayMode.Catch; - public override string Description => "osu!catch"; public override FontAwesome Icon => FontAwesome.fa_osu_fruits_o; diff --git a/osu.Game.Modes.Mania/ManiaRuleset.cs b/osu.Game.Modes.Mania/ManiaRuleset.cs index bd995d87d6..7d25ea93c9 100644 --- a/osu.Game.Modes.Mania/ManiaRuleset.cs +++ b/osu.Game.Modes.Mania/ManiaRuleset.cs @@ -96,8 +96,6 @@ namespace osu.Game.Modes.Mania } } - protected override PlayMode PlayMode => PlayMode.Mania; - public override string Description => "osu!mania"; public override FontAwesome Icon => FontAwesome.fa_osu_mania_o; diff --git a/osu.Game.Modes.Osu/OsuRuleset.cs b/osu.Game.Modes.Osu/OsuRuleset.cs index 12df7d3f3c..6ca19bb5bb 100644 --- a/osu.Game.Modes.Osu/OsuRuleset.cs +++ b/osu.Game.Modes.Osu/OsuRuleset.cs @@ -99,8 +99,6 @@ namespace osu.Game.Modes.Osu public override DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap) => new OsuDifficultyCalculator(beatmap); - protected override PlayMode PlayMode => PlayMode.Osu; - public override string Description => "osu!"; public override IEnumerable CreateGameplayKeys() => new KeyCounter[] diff --git a/osu.Game.Modes.Taiko/TaikoRuleset.cs b/osu.Game.Modes.Taiko/TaikoRuleset.cs index 1b3c3fc0eb..e88b50bb95 100644 --- a/osu.Game.Modes.Taiko/TaikoRuleset.cs +++ b/osu.Game.Modes.Taiko/TaikoRuleset.cs @@ -76,8 +76,6 @@ namespace osu.Game.Modes.Taiko } } - protected override PlayMode PlayMode => PlayMode.Taiko; - public override string Description => "osu!taiko"; public override FontAwesome Icon => FontAwesome.fa_osu_taiko_o; diff --git a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs index 59a5790bea..9d783c7e91 100644 --- a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs @@ -58,7 +58,7 @@ namespace osu.Game.Tests.Beatmaps.Formats Assert.AreEqual(false, beatmapInfo.Countdown); Assert.AreEqual(0.7f, beatmapInfo.StackLeniency); Assert.AreEqual(false, beatmapInfo.SpecialStyle); - Assert.AreEqual(PlayMode.Osu, beatmapInfo.Mode); + Assert.IsTrue(beatmapInfo.Ruleset is OsuRuleset); Assert.AreEqual(false, beatmapInfo.LetterboxInBreaks); Assert.AreEqual(false, beatmapInfo.WidescreenStoryboard); } diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index dd0bdef3b7..47f31ddffc 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -18,14 +18,6 @@ namespace osu.Game.Beatmaps public readonly BeatmapSetInfo BeatmapSetInfo; - /// - /// A play mode that is preferred for this beatmap. PlayMode will become this mode where conversion is feasible, - /// or otherwise to the beatmap's default. - /// - public PlayMode? PreferredPlayMode; - - public PlayMode PlayMode => Beatmap?.BeatmapInfo?.Mode > (int)PlayMode.Osu ? (PlayMode)Beatmap.BeatmapInfo.Mode : PreferredPlayMode ?? PlayMode.Osu; - public readonly Bindable> Mods = new Bindable>(); public readonly bool WithStoryboard; diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index e2f33479c0..2f37717286 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -17,8 +17,6 @@ namespace osu.Game.Configuration Set(OsuConfig.Username, string.Empty); Set(OsuConfig.Token, string.Empty); - Set(OsuConfig.PlayMode, PlayMode.Osu); - Set(OsuConfig.AudioDevice, string.Empty); Set(OsuConfig.SavePassword, false); Set(OsuConfig.SaveUsername, true); @@ -196,7 +194,7 @@ namespace osu.Game.Configuration public enum OsuConfig { // New osu: - PlayMode, + Ruleset, Token, // Imported from old osu: BeatmapDirectory, diff --git a/osu.Game/Database/ScoreDatabase.cs b/osu.Game/Database/ScoreDatabase.cs index e602b2373e..3b5c0575d5 100644 --- a/osu.Game/Database/ScoreDatabase.cs +++ b/osu.Game/Database/ScoreDatabase.cs @@ -39,7 +39,7 @@ namespace osu.Game.Database using (Stream s = storage.GetStream(Path.Combine(replay_folder, replayFilename))) using (SerializationReader sr = new SerializationReader(s)) { - var ruleset = RulesetCollection.GetRuleset((PlayMode)sr.ReadByte()); + var ruleset = RulesetCollection.GetRuleset((int)sr.ReadByte()); score = ruleset.CreateScoreProcessor().CreateScore(); /* score.Pass = true;*/ diff --git a/osu.Game/Modes/PlayMode.cs b/osu.Game/Modes/PlayMode.cs deleted file mode 100644 index fa6d94a650..0000000000 --- a/osu.Game/Modes/PlayMode.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -namespace osu.Game.Modes -{ - public enum PlayMode - { - Osu = 0, - Taiko = 1, - Catch = 2, - Mania = 3 - } -} diff --git a/osu.Game/Modes/Ruleset.cs b/osu.Game/Modes/Ruleset.cs index 42f2fe789f..9a5099c675 100644 --- a/osu.Game/Modes/Ruleset.cs +++ b/osu.Game/Modes/Ruleset.cs @@ -32,8 +32,6 @@ namespace osu.Game.Modes public abstract ScoreProcessor CreateScoreProcessor(); - protected abstract PlayMode PlayMode { get; } - public virtual FontAwesome Icon => FontAwesome.fa_question_circle; public abstract string Description { get; } diff --git a/osu.Game/Modes/RulesetCollection.cs b/osu.Game/Modes/RulesetCollection.cs index 95d0df4e6a..a8cb8f8e26 100644 --- a/osu.Game/Modes/RulesetCollection.cs +++ b/osu.Game/Modes/RulesetCollection.cs @@ -21,11 +21,6 @@ namespace osu.Game.Modes available_rulesets.TryAdd(available_rulesets.Count, ruleset); } - public static Ruleset GetRuleset(PlayMode playMode) - { - return GetRuleset((int)playMode); - } - public static Ruleset GetRuleset(int rulesetId) { Ruleset ruleset; diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index ccea6ef458..44c1188ab3 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -58,7 +58,7 @@ namespace osu.Game private VolumeControl volume; - public Bindable PlayMode; + public Bindable Ruleset; private readonly string[] args; @@ -88,7 +88,8 @@ namespace osu.Game Dependencies.Cache(this); - PlayMode = LocalConfig.GetBindable(OsuConfig.PlayMode); + // Todo: I don't think this'll work, need BindableRuleset + Ruleset = new Bindable(); } private ScheduledDelegate scoreLoad; @@ -199,11 +200,11 @@ namespace osu.Game { Depth = -3, OnHome = delegate { intro?.ChildScreen?.MakeCurrent(); }, - OnPlayModeChange = m => PlayMode.Value = m, + OnRulesetChange = r => Ruleset.Value = r, }, t => { - PlayMode.ValueChanged += delegate { Toolbar.SetGameMode(PlayMode.Value); }; - PlayMode.TriggerChange(); + Ruleset.ValueChanged += delegate { Toolbar.SetGameMode(Ruleset.Value); }; + Ruleset.TriggerChange(); overlayContent.Add(Toolbar); }); diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 7a21b36da9..5041ab237c 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -37,13 +37,12 @@ namespace osu.Game.Overlays.Mods public readonly Bindable> SelectedMods = new Bindable>(); - public readonly Bindable PlayMode = new Bindable(); + public readonly Bindable Ruleset = new Bindable(); - private void modeChanged(PlayMode newMode) + private void rulesetChanged(Ruleset newRuleset) { - var ruleset = RulesetCollection.GetRuleset(newMode); foreach (ModSection section in modSectionsContainer.Children) - section.Buttons = ruleset.GetModsFor(section.ModType).Select(m => new ModButton(m)).ToArray(); + section.Buttons = newRuleset.GetModsFor(section.ModType).Select(m => new ModButton(m)).ToArray(); refreshSelectedMods(); } @@ -54,9 +53,9 @@ namespace osu.Game.Overlays.Mods highMultiplierColour = colours.Green; if (osu != null) - PlayMode.BindTo(osu.PlayMode); - PlayMode.ValueChanged += modeChanged; - PlayMode.TriggerChange(); + Ruleset.BindTo(osu.Ruleset); + Ruleset.ValueChanged += rulesetChanged; + Ruleset.TriggerChange(); } protected override void PopOut() diff --git a/osu.Game/Overlays/Options/OptionsFooter.cs b/osu.Game/Overlays/Options/OptionsFooter.cs index fde4d8a925..d68fe18f36 100644 --- a/osu.Game/Overlays/Options/OptionsFooter.cs +++ b/osu.Game/Overlays/Options/OptionsFooter.cs @@ -27,13 +27,15 @@ namespace osu.Game.Overlays.Options var modes = new List(); - foreach (PlayMode m in Enum.GetValues(typeof(PlayMode))) + foreach (var ruleset in RulesetCollection.AllRulesets) + { modes.Add(new TextAwesome { - Icon = RulesetCollection.GetRuleset(m).Icon, + Icon = ruleset.Icon, Colour = Color4.Gray, TextSize = 20 }); + } Children = new Drawable[] { diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index 9e7b4f1519..ec76a37e6e 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -20,7 +20,7 @@ namespace osu.Game.Overlays.Toolbar public const float TOOLTIP_HEIGHT = 30; public Action OnHome; - public Action OnPlayModeChange; + public Action OnRulesetChange; private readonly ToolbarModeSelector modeSelector; private readonly ToolbarUserArea userArea; @@ -55,9 +55,9 @@ namespace osu.Game.Overlays.Toolbar }, modeSelector = new ToolbarModeSelector { - OnPlayModeChange = mode => + OnRulesetChange = mode => { - OnPlayModeChange?.Invoke(mode); + OnRulesetChange?.Invoke(mode); } } } @@ -129,7 +129,7 @@ namespace osu.Game.Overlays.Toolbar } } - public void SetGameMode(PlayMode mode) => modeSelector.SetGameMode(mode); + public void SetGameMode(Ruleset ruleset) => modeSelector.SetGameMode(ruleset); protected override void PopIn() { diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs b/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs index 62359b05ae..6ace90bcb4 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs @@ -9,16 +9,16 @@ namespace osu.Game.Overlays.Toolbar { public class ToolbarModeButton : ToolbarButton { - private PlayMode mode; - public PlayMode Mode + private Ruleset ruleset; + public Ruleset Ruleset { - get { return mode; } + get { return ruleset; } set { - mode = value; - TooltipMain = Ruleset.GetRuleset(mode).Description; - TooltipSub = $"Play some {Ruleset.GetRuleset(mode).Description}"; - Icon = Ruleset.GetRuleset(mode).Icon; + ruleset = value; + TooltipMain = ruleset.Description; + TooltipSub = $"Play some {ruleset.Description}"; + Icon = ruleset.Icon; } } diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs index e117089166..0d673eb3fe 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs @@ -22,7 +22,7 @@ namespace osu.Game.Overlays.Toolbar private readonly Drawable modeButtonLine; private ToolbarModeButton activeButton; - public Action OnPlayModeChange; + public Action OnRulesetChange; public ToolbarModeSelector() { @@ -63,15 +63,15 @@ namespace osu.Game.Overlays.Toolbar } }; - foreach (PlayMode m in Ruleset.PlayModes) + foreach (var ruleset in RulesetCollection.AllRulesets) { modeButtons.Add(new ToolbarModeButton { - Mode = m, + Ruleset = ruleset, Action = delegate { - SetGameMode(m); - OnPlayModeChange?.Invoke(m); + SetGameMode(ruleset); + OnRulesetChange?.Invoke(ruleset); } }); } @@ -84,11 +84,11 @@ namespace osu.Game.Overlays.Toolbar Size = new Vector2(modeButtons.DrawSize.X, 1); } - public void SetGameMode(PlayMode mode) + public void SetGameMode(Ruleset ruleset) { foreach (ToolbarModeButton m in modeButtons.Children.Cast()) { - bool isActive = m.Mode == mode; + bool isActive = m.Ruleset == ruleset; m.Active = isActive; if (isActive) activeButton = m; diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 134400d531..2887e7fa70 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -63,13 +63,6 @@ namespace osu.Game.Screens.Play [BackgroundDependencyLoader] private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config) { - if (Beatmap.Beatmap.BeatmapInfo?.Mode > (int)PlayMode.Taiko) - { - //we only support osu! mode for now because the hitobject parsing is crappy and needs a refactor. - Exit(); - return; - } - dimLevel = config.GetBindable(OsuConfig.DimLevel); mouseWheelDisabled = config.GetBindable(OsuConfig.MouseDisableWheel); @@ -109,7 +102,7 @@ namespace osu.Game.Screens.Play sourceClock.Reset(); }); - ruleset = RulesetCollection.GetRuleset(Beatmap.PlayMode); + ruleset = Beatmap.BeatmapInfo.Ruleset; HitRenderer = ruleset.CreateHitRendererWith(Beatmap); scoreProcessor = HitRenderer.CreateScoreProcessor(); diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 7596af1484..b2c53c9126 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -61,7 +61,7 @@ namespace osu.Game.Screens.Select Group = group, Sort = sort, SearchText = searchTextBox.Text, - Mode = playMode + Ruleset = ruleset }; public Action Exit; @@ -163,16 +163,17 @@ namespace osu.Game.Screens.Select searchTextBox.HoldFocus = true; } - private readonly Bindable playMode = new Bindable(); + private readonly Bindable ruleset = new Bindable(); [BackgroundDependencyLoader(permitNulls:true)] private void load(OsuColour colours, OsuGame osu) { sortTabs.AccentColour = colours.GreenLight; - if (osu != null) playMode.BindTo(osu.PlayMode); - playMode.ValueChanged += val => FilterChanged?.Invoke(CreateCriteria()); - playMode.TriggerChange(); + if (osu != null) + ruleset.BindTo(osu.Ruleset); + ruleset.ValueChanged += val => FilterChanged?.Invoke(CreateCriteria()); + ruleset.TriggerChange(); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; diff --git a/osu.Game/Screens/Select/FilterCriteria.cs b/osu.Game/Screens/Select/FilterCriteria.cs index 19d3645e45..0b750ef8d3 100644 --- a/osu.Game/Screens/Select/FilterCriteria.cs +++ b/osu.Game/Screens/Select/FilterCriteria.cs @@ -15,7 +15,7 @@ namespace osu.Game.Screens.Select public GroupMode Group; public SortMode Sort; public string SearchText; - public PlayMode Mode; + public Ruleset Ruleset; public void Filter(List groups) { @@ -23,7 +23,7 @@ namespace osu.Game.Screens.Select { var set = g.BeatmapSet; - bool hasCurrentMode = set.Beatmaps.Any(bm => bm.Mode == (int)Mode); + bool hasCurrentMode = set.Beatmaps.Any(bm => bm.Ruleset == Ruleset); bool match = hasCurrentMode; diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 3e8ddc0f64..f25d3d4df9 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -29,7 +29,7 @@ namespace osu.Game.Screens.Select { public abstract class SongSelect : OsuScreen { - private readonly Bindable playMode = new Bindable(); + private readonly Bindable ruleset = new Bindable(); private BeatmapDatabase database; protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap); @@ -170,8 +170,8 @@ namespace osu.Game.Screens.Select if (database == null) database = beatmaps; - playMode.ValueChanged += val => { if (Beatmap != null) Beatmap.PreferredPlayMode = val; }; - if (osu != null) playMode.BindTo(osu.PlayMode); + if (osu != null) + ruleset.BindTo(osu.Ruleset); database.BeatmapSetAdded += onBeatmapSetAdded; database.BeatmapSetRemoved += onBeatmapSetRemoved; @@ -200,7 +200,6 @@ namespace osu.Game.Screens.Select { if (Beatmap == null) return; - Beatmap.PreferredPlayMode = playMode.Value; OnSelected(); } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index b89f7a3b65..7d20668f26 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -217,7 +217,6 @@ - From 6dbc75283cdc8261812620bf61c3388f358c3490 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 15 Apr 2017 05:52:46 +0900 Subject: [PATCH 185/442] Re-implement config value. --- osu.Game/Configuration/OsuConfigManager.cs | 2 ++ osu.Game/Modes/RulesetCollection.cs | 3 +++ osu.Game/OsuGame.cs | 8 +++++--- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 2f37717286..8e82406dee 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -17,6 +17,8 @@ namespace osu.Game.Configuration Set(OsuConfig.Username, string.Empty); Set(OsuConfig.Token, string.Empty); + Set(OsuConfig.Ruleset, 0, 0, int.MaxValue); + Set(OsuConfig.AudioDevice, string.Empty); Set(OsuConfig.SavePassword, false); Set(OsuConfig.SaveUsername, true); diff --git a/osu.Game/Modes/RulesetCollection.cs b/osu.Game/Modes/RulesetCollection.cs index a8cb8f8e26..d699bbfabe 100644 --- a/osu.Game/Modes/RulesetCollection.cs +++ b/osu.Game/Modes/RulesetCollection.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; +using System.Linq; namespace osu.Game.Modes { @@ -31,6 +32,8 @@ namespace osu.Game.Modes return ruleset; } + public static int GetId(Ruleset ruleset) => available_rulesets.First(kvp => kvp.Value == ruleset).Key; + public static IEnumerable AllRulesets => available_rulesets.Values; } } diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 44c1188ab3..3379787d6d 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -58,7 +58,8 @@ namespace osu.Game private VolumeControl volume; - public Bindable Ruleset; + private Bindable configRuleset; + public Bindable Ruleset = new Bindable(); private readonly string[] args; @@ -88,8 +89,9 @@ namespace osu.Game Dependencies.Cache(this); - // Todo: I don't think this'll work, need BindableRuleset - Ruleset = new Bindable(); + configRuleset = LocalConfig.GetBindable(OsuConfig.Ruleset); + Ruleset.Value = RulesetCollection.GetRuleset(configRuleset.Value); + Ruleset.ValueChanged += r => configRuleset.Value = RulesetCollection.GetId(r); } private ScheduledDelegate scoreLoad; From 3845ab2a72c91247d319c3ea9a366596f1aa5dcd Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 15 Apr 2017 05:55:38 +0900 Subject: [PATCH 186/442] Add comment. --- osu.Game/Screens/Play/Player.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 2887e7fa70..b59b3bf0c1 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -103,6 +103,9 @@ namespace osu.Game.Screens.Play }); ruleset = Beatmap.BeatmapInfo.Ruleset; + + // Todo: This should be done as early as possible, and should check if the hit renderer + // can actually convert the hit objects... Somehow... HitRenderer = ruleset.CreateHitRendererWith(Beatmap); scoreProcessor = HitRenderer.CreateScoreProcessor(); From 0333e1a05003d2f30ebba3ff288101c0e66b5b47 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 15 Apr 2017 05:57:18 +0900 Subject: [PATCH 187/442] Remove unused usings. --- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 1 - osu.Game/Beatmaps/WorkingBeatmap.cs | 1 - osu.Game/Configuration/OsuConfigManager.cs | 1 - osu.Game/Modes/Ruleset.cs | 2 -- osu.Game/Overlays/Options/OptionsFooter.cs | 1 - 5 files changed, 6 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index 4e39b48f96..36f025d1ff 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -7,7 +7,6 @@ using System.IO; using OpenTK.Graphics; using osu.Game.Beatmaps.Events; using osu.Game.Beatmaps.Timing; -using osu.Game.Modes; using osu.Game.Modes.Objects; using osu.Game.Beatmaps.Legacy; diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 47f31ddffc..8ffec25882 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -5,7 +5,6 @@ using osu.Framework.Audio.Track; using osu.Framework.Configuration; using osu.Framework.Graphics.Textures; using osu.Game.Database; -using osu.Game.Modes; using osu.Game.Modes.Mods; using System; using System.Collections.Generic; diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 8e82406dee..a31c1f882d 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -4,7 +4,6 @@ using System; using osu.Framework.Configuration; using osu.Framework.Platform; -using osu.Game.Modes; namespace osu.Game.Configuration { diff --git a/osu.Game/Modes/Ruleset.cs b/osu.Game/Modes/Ruleset.cs index 9a5099c675..284a71d518 100644 --- a/osu.Game/Modes/Ruleset.cs +++ b/osu.Game/Modes/Ruleset.cs @@ -6,8 +6,6 @@ using osu.Game.Graphics; using osu.Game.Modes.Mods; using osu.Game.Modes.UI; using osu.Game.Screens.Play; -using System; -using System.Collections.Concurrent; using System.Collections.Generic; using osu.Game.Modes.Scoring; diff --git a/osu.Game/Overlays/Options/OptionsFooter.cs b/osu.Game/Overlays/Options/OptionsFooter.cs index d68fe18f36..ad184c8838 100644 --- a/osu.Game/Overlays/Options/OptionsFooter.cs +++ b/osu.Game/Overlays/Options/OptionsFooter.cs @@ -1,7 +1,6 @@ // 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.Allocation; using osu.Framework.Graphics; From 4a149c4ab80c0f435543691cf6c80b67315d2391 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 15 Apr 2017 06:14:31 +0900 Subject: [PATCH 188/442] Better default values + don't set Mode from outside. --- osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs | 7 ++++--- osu.Game/Database/BeatmapInfo.cs | 8 +++++++- osu.Game/Modes/RulesetCollection.cs | 9 ++++++--- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 2 +- osu.Game/Screens/Select/FilterControl.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 2 +- 6 files changed, 20 insertions(+), 10 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs index 4047c4b95f..c22726491d 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs @@ -8,6 +8,7 @@ using osu.Framework.MathUtils; using osu.Game.Database; using osu.Game.Screens.Select; using osu.Game.Screens.Select.Filter; +using osu.Game.Modes; namespace osu.Desktop.VisualTests.Tests { @@ -71,7 +72,7 @@ namespace osu.Desktop.VisualTests.Tests new BeatmapInfo { OnlineBeatmapID = 1234 + i, - Mode = 0, + Ruleset = RulesetCollection.GetRuleset(0), Path = "normal.osu", Version = "Normal", Difficulty = new BeatmapDifficulty @@ -82,7 +83,7 @@ namespace osu.Desktop.VisualTests.Tests new BeatmapInfo { OnlineBeatmapID = 1235 + i, - Mode = 0, + Ruleset = RulesetCollection.GetRuleset(0), Path = "hard.osu", Version = "Hard", Difficulty = new BeatmapDifficulty @@ -93,7 +94,7 @@ namespace osu.Desktop.VisualTests.Tests new BeatmapInfo { OnlineBeatmapID = 1236 + i, - Mode = 0, + Ruleset = RulesetCollection.GetRuleset(0), Path = "insane.osu", Version = "Insane", Difficulty = new BeatmapDifficulty diff --git a/osu.Game/Database/BeatmapInfo.cs b/osu.Game/Database/BeatmapInfo.cs index 72ff078d9e..be4faebde2 100644 --- a/osu.Game/Database/BeatmapInfo.cs +++ b/osu.Game/Database/BeatmapInfo.cs @@ -56,7 +56,13 @@ namespace osu.Game.Database public bool SpecialStyle { get; set; } public int Mode { get; set; } - public Ruleset Ruleset => RulesetCollection.GetRuleset(Mode); + + [Ignore] + public Ruleset Ruleset + { + get { return RulesetCollection.GetRuleset(Mode); } + set { Mode = RulesetCollection.GetId(value); } + } public bool LetterboxInBreaks { get; set; } public bool WidescreenStoryboard { get; set; } diff --git a/osu.Game/Modes/RulesetCollection.cs b/osu.Game/Modes/RulesetCollection.cs index d699bbfabe..221fa6f5ba 100644 --- a/osu.Game/Modes/RulesetCollection.cs +++ b/osu.Game/Modes/RulesetCollection.cs @@ -8,13 +8,16 @@ using System.Linq; namespace osu.Game.Modes { + /// + /// Todo: All of this needs to be moved to a RulesetDatabase. + /// public static class RulesetCollection { private static readonly ConcurrentDictionary available_rulesets = new ConcurrentDictionary(); public static void Register(Type type) { - Ruleset ruleset = Activator.CreateInstance(type) as Ruleset; + var ruleset = Activator.CreateInstance(type) as Ruleset; if (ruleset == null) return; @@ -25,9 +28,9 @@ namespace osu.Game.Modes public static Ruleset GetRuleset(int rulesetId) { Ruleset ruleset; - + if (!available_rulesets.TryGetValue(rulesetId, out ruleset)) - throw new InvalidOperationException($"Ruleset id {rulesetId} doesn't exist. How did you trigger this?"); + return null; return ruleset; } diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 5041ab237c..02df95ff8a 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -37,7 +37,7 @@ namespace osu.Game.Overlays.Mods public readonly Bindable> SelectedMods = new Bindable>(); - public readonly Bindable Ruleset = new Bindable(); + public readonly Bindable Ruleset = new Bindable(RulesetCollection.GetRuleset(0)); private void rulesetChanged(Ruleset newRuleset) { diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index b2c53c9126..1e2f074939 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -163,7 +163,7 @@ namespace osu.Game.Screens.Select searchTextBox.HoldFocus = true; } - private readonly Bindable ruleset = new Bindable(); + private readonly Bindable ruleset = new Bindable(RulesetCollection.GetRuleset(0)); [BackgroundDependencyLoader(permitNulls:true)] private void load(OsuColour colours, OsuGame osu) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index f25d3d4df9..183eb7de32 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -29,7 +29,7 @@ namespace osu.Game.Screens.Select { public abstract class SongSelect : OsuScreen { - private readonly Bindable ruleset = new Bindable(); + private readonly Bindable ruleset = new Bindable(RulesetCollection.GetRuleset(0)); private BeatmapDatabase database; protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap); From ddce3c157f084a80e9f72c702bb9f538f38e7f79 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 15 Apr 2017 06:15:55 +0900 Subject: [PATCH 189/442] Clean up a few remaining stragglers. --- osu.Game/Beatmaps/Beatmap.cs | 2 +- osu.Game/Beatmaps/Drawables/DifficultyIcon.cs | 2 +- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Beatmaps/Beatmap.cs b/osu.Game/Beatmaps/Beatmap.cs index 420b23eb62..221cd5a37c 100644 --- a/osu.Game/Beatmaps/Beatmap.cs +++ b/osu.Game/Beatmaps/Beatmap.cs @@ -54,7 +54,7 @@ namespace osu.Game.Beatmaps /// Calculates the star difficulty for this Beatmap. /// /// The star difficulty. - public double CalculateStarDifficulty() => RulesetCollection.GetRuleset(BeatmapInfo.Mode).CreateDifficultyCalculator(this).Calculate(); + public double CalculateStarDifficulty() => BeatmapInfo.Ruleset.CreateDifficultyCalculator(this).Calculate(); /// /// Constructs a new beatmap. diff --git a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs index 3fb5194382..252965fee5 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs @@ -45,7 +45,7 @@ namespace osu.Game.Beatmaps.Drawables Origin = Anchor.Centre, TextSize = Size.X, Colour = Color4.White, - Icon = RulesetCollection.GetRuleset((int)beatmap.Mode).Icon + Icon = beatmap.Ruleset.Icon } }; } diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 586100c47d..775efd5a40 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -100,7 +100,7 @@ namespace osu.Game.Screens.Select })); //get statistics fromt he current ruleset. - labels.AddRange(RulesetCollection.GetRuleset(beatmap.BeatmapInfo.Mode).GetBeatmapStatistics(beatmap).Select(s => new InfoLabel(s))); + labels.AddRange(beatmap.BeatmapInfo.Ruleset.GetBeatmapStatistics(beatmap).Select(s => new InfoLabel(s))); } AlwaysPresent = true; From 984c7092a6b18252993656bde25cf6bd7f939aed Mon Sep 17 00:00:00 2001 From: Javier Flores Date: Fri, 14 Apr 2017 16:33:58 -0500 Subject: [PATCH 190/442] Pls AppVeyor don't die --- osu.Game/Screens/Menu/Intro.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index faacb04876..62fe2431bf 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -95,6 +95,7 @@ namespace osu.Game.Screens.Menu if(menuVoice) welcome.Play(); + Scheduler.AddDelayed(delegate { if(menuMusic) From 2c6327fca9ff5b940b6545a9ecd818e02d6e37fb Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Fri, 14 Apr 2017 17:17:51 -0500 Subject: [PATCH 191/442] Build for real this time --- osu.Game/Screens/Menu/Intro.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index 62fe2431bf..1fbb9b7197 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -95,7 +95,7 @@ namespace osu.Game.Screens.Menu if(menuVoice) welcome.Play(); - + Scheduler.AddDelayed(delegate { if(menuMusic) From ca1f89f2cf391599528b0fc1c5cf69e292f63dc6 Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Fri, 14 Apr 2017 17:48:27 -0500 Subject: [PATCH 192/442] Fix crash when there's no beatmaps --- osu.Game/Screens/Menu/Intro.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index 1fbb9b7197..60493ff356 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -67,6 +67,7 @@ namespace osu.Game.Screens.Menu private TrackManager trackManager; private BeatmapInfo beatmap; private WorkingBeatmap song; + private int choosableBeatmapsetAmmout; [BackgroundDependencyLoader] private void load(OsuGameBase game, AudioManager audio, OsuConfigManager config, BeatmapDatabase beatmaps) @@ -76,9 +77,13 @@ namespace osu.Game.Screens.Menu if (!menuMusic) { trackManager = game.Audio.Track; - beatmap = beatmaps.GetWithChildren(RNG.Next(beatmaps.Query().Count() - 1)).Beatmaps[0]; - song = beatmaps.GetWorkingBeatmap(beatmap); - Beatmap = song; + choosableBeatmapsetAmmout = beatmaps.Query().Count(); + if (choosableBeatmapsetAmmout > 0) + { + beatmap = beatmaps.GetWithChildren(RNG.Next(1, choosableBeatmapsetAmmout)).Beatmaps[0]; + song = beatmaps.GetWorkingBeatmap(beatmap); + Beatmap = song; + } } bgm = audio.Track.Get(@"circles"); @@ -100,7 +105,7 @@ namespace osu.Game.Screens.Menu { if(menuMusic) bgm.Start(); - else + else if (song != null) { Task.Run(() => { @@ -115,7 +120,7 @@ namespace osu.Game.Screens.Menu Scheduler.AddDelayed(delegate { - if (!menuMusic) + if (!menuMusic && song != null) Task.Run(() => song.Track.Start()); DidLoadMenu = true; Push(mainMenu); From 60f7879875b18260e65feae1308f5c5fc2ca5fa6 Mon Sep 17 00:00:00 2001 From: Adrian Kaz Scherzinger Date: Sun, 16 Apr 2017 06:44:08 +0900 Subject: [PATCH 193/442] Explicitly set C# 6.0 for now. --- osu.Desktop.Deploy/osu.Desktop.Deploy.csproj | 1 + osu.Desktop.Tests/osu.Desktop.Tests.csproj | 1 + osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj | 1 + osu.Desktop/osu.Desktop.csproj | 1 + osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj | 1 + osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj | 1 + osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj | 1 + osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj | 1 + osu.Game.Tests/osu.Game.Tests.csproj | 1 + osu.Game/osu.Game.csproj | 1 + 10 files changed, 10 insertions(+) diff --git a/osu.Desktop.Deploy/osu.Desktop.Deploy.csproj b/osu.Desktop.Deploy/osu.Desktop.Deploy.csproj index 901117b026..1f9726b573 100644 --- a/osu.Desktop.Deploy/osu.Desktop.Deploy.csproj +++ b/osu.Desktop.Deploy/osu.Desktop.Deploy.csproj @@ -22,6 +22,7 @@ DEBUG;TRACE prompt 4 + 6 AnyCPU diff --git a/osu.Desktop.Tests/osu.Desktop.Tests.csproj b/osu.Desktop.Tests/osu.Desktop.Tests.csproj index ccb979afaa..8afd632bd1 100644 --- a/osu.Desktop.Tests/osu.Desktop.Tests.csproj +++ b/osu.Desktop.Tests/osu.Desktop.Tests.csproj @@ -21,6 +21,7 @@ prompt 4 false + 6 pdbonly diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index d75bb94308..4fc0a93fb4 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -61,6 +61,7 @@ false false false + 6 none diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index dbd26b4640..553dff6c6f 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -63,6 +63,7 @@ false + 6 none diff --git a/osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj b/osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj index 50b1a095af..b3e847a5be 100644 --- a/osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj +++ b/osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj @@ -21,6 +21,7 @@ prompt 4 false + 6 pdbonly diff --git a/osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj b/osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj index 896e9c68c6..6c666fd6ea 100644 --- a/osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj +++ b/osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj @@ -21,6 +21,7 @@ prompt 4 false + 6 pdbonly diff --git a/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj b/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj index 21f0f03d8c..c98f554ba5 100644 --- a/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj +++ b/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj @@ -22,6 +22,7 @@ prompt 4 false + 6 pdbonly diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index 19ba5c77e4..03137802d4 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -21,6 +21,7 @@ prompt 4 false + 6 pdbonly diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index 2844528d0c..ddaf33c0fc 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -19,6 +19,7 @@ 4 false false + 6 true diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index f810eeec96..d73e6d0b61 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -24,6 +24,7 @@ prompt 4 false + 6 pdbonly From fbda18176941d911e76161a73599a3ce53198a4d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 16 Apr 2017 20:15:36 +0900 Subject: [PATCH 194/442] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 2234013e59..979fb1ffdf 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 2234013e59a99116ee9f9e56a95ff8a6667db2a7 +Subproject commit 979fb1ffdfaa08c39ff4f0cdda42e5b313d70534 From 6239eab233c8f3d4866b1b70d9ecbf63c6f46a8d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 16 Apr 2017 22:40:29 +0900 Subject: [PATCH 195/442] Update forgotten submodule. --- osu-resources | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-resources b/osu-resources index 0cba3cbc16..ce76f812d3 160000 --- a/osu-resources +++ b/osu-resources @@ -1 +1 @@ -Subproject commit 0cba3cbc167cfe94e07fe5b629c925e190be939e +Subproject commit ce76f812d3e059233e1dea395b125352f638b2da From 78273d76e3cef6fe52b011e4a5392586031ee236 Mon Sep 17 00:00:00 2001 From: ocboogie Date: Sun, 16 Apr 2017 20:18:41 -0700 Subject: [PATCH 196/442] Added basic loading screen and test case --- .../Tests/TestCasePlayerLoadingScreen.cs | 31 ++++++++++++++++ osu.Game/Screens/Play/LoadingScreen.cs | 37 +++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 osu.Desktop.VisualTests/Tests/TestCasePlayerLoadingScreen.cs create mode 100644 osu.Game/Screens/Play/LoadingScreen.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlayerLoadingScreen.cs b/osu.Desktop.VisualTests/Tests/TestCasePlayerLoadingScreen.cs new file mode 100644 index 0000000000..9e0ba161c9 --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCasePlayerLoadingScreen.cs @@ -0,0 +1,31 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Primitives; +using osu.Framework.Testing; +using osu.Game.Database; +using osu.Game.Screens.Select; +using System.Linq; +using osu.Game.Screens.Play; +using OpenTK; + +namespace osu.Desktop.VisualTests.Tests +{ + public class TestCasePlayerLoadingScreen : TestCase + { + public override string Description => @"Loading screen in player"; + + public override void Reset() + { + base.Reset(); + + Add(new LoadingScreen + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }); + } + } +} + diff --git a/osu.Game/Screens/Play/LoadingScreen.cs b/osu.Game/Screens/Play/LoadingScreen.cs new file mode 100644 index 0000000000..7ac6b83cd8 --- /dev/null +++ b/osu.Game/Screens/Play/LoadingScreen.cs @@ -0,0 +1,37 @@ +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Primitives; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Screens; +using osu.Game.Beatmaps; +using osu.Game.Database; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Screens.Backgrounds; +using osu.Game.Screens.Menu; +using OpenTK; + +namespace osu.Game.Screens.Play +{ + public class LoadingScreen : OsuScreen + { + + private string loadingText = "loading..."; + + [BackgroundDependencyLoader] + private void load() + { + Add( + new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Text = loadingText, + TextSize = 48, + Font = @"Exo2.0-MediumItalic" + } + ); + } + } +} From 83b083ce64c99c5c6e945533b2a8e213169a9017 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 17 Apr 2017 14:37:52 +0900 Subject: [PATCH 197/442] Move SQLite connections out of database classes; make abstract Database. --- .../Tests/TestCasePlaySongSelect.cs | 2 +- osu.Game/Beatmaps/Beatmap.cs | 1 - osu.Game/Beatmaps/Drawables/DifficultyIcon.cs | 1 - osu.Game/Database/BeatmapDatabase.cs | 110 +++++++----------- osu.Game/Database/Database.cs | 44 +++++++ osu.Game/Database/ScoreDatabase.cs | 15 ++- osu.Game/OsuGameBase.cs | 8 +- osu.Game/osu.Game.csproj | 1 + 8 files changed, 105 insertions(+), 77 deletions(-) create mode 100644 osu.Game/Database/Database.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs index c22726491d..dd17d62739 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs @@ -26,7 +26,7 @@ namespace osu.Desktop.VisualTests.Tests if (db == null) { storage = new TestStorage(@"TestCasePlaySongSelect"); - db = new BeatmapDatabase(storage); + db = new BeatmapDatabase(storage, storage.GetDatabase(@"client")); var sets = new List(); diff --git a/osu.Game/Beatmaps/Beatmap.cs b/osu.Game/Beatmaps/Beatmap.cs index 221cd5a37c..6099b1e115 100644 --- a/osu.Game/Beatmaps/Beatmap.cs +++ b/osu.Game/Beatmaps/Beatmap.cs @@ -4,7 +4,6 @@ using OpenTK.Graphics; using osu.Game.Beatmaps.Timing; using osu.Game.Database; -using osu.Game.Modes; using osu.Game.Modes.Objects; using System.Collections.Generic; diff --git a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs index 252965fee5..02595df77a 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs @@ -6,7 +6,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Database; using osu.Game.Graphics; -using osu.Game.Modes; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game/Database/BeatmapDatabase.cs b/osu.Game/Database/BeatmapDatabase.cs index 41ddd8df39..9695ba8bd0 100644 --- a/osu.Game/Database/BeatmapDatabase.cs +++ b/osu.Game/Database/BeatmapDatabase.cs @@ -18,37 +18,19 @@ using SQLiteNetExtensions.Extensions; namespace osu.Game.Database { - public class BeatmapDatabase + public class BeatmapDatabase : Database { - private SQLiteConnection connection { get; } - private readonly Storage storage; + public event Action BeatmapSetAdded; public event Action BeatmapSetRemoved; // ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised) private BeatmapIPCChannel ipc; - public BeatmapDatabase(Storage storage, IIpcHost importHost = null) + public BeatmapDatabase(Storage storage, SQLiteConnection connection, IIpcHost importHost = null) : base(storage, connection) { - this.storage = storage; - if (importHost != null) ipc = new BeatmapIPCChannel(importHost, this); - - if (connection == null) - { - try - { - connection = prepareConnection(); - deletePending(); - } - catch (Exception e) - { - Logger.Error(e, @"Failed to initialise the beatmap database! Trying again with a clean database..."); - storage.DeleteDatabase(@"beatmaps"); - connection = prepareConnection(); - } - } } private void deletePending() @@ -57,20 +39,20 @@ namespace osu.Game.Database { try { - storage.Delete(b.Path); + Storage.Delete(b.Path); GetChildren(b, true); foreach (var i in b.Beatmaps) { - if (i.Metadata != null) connection.Delete(i.Metadata); - if (i.Difficulty != null) connection.Delete(i.Difficulty); + if (i.Metadata != null) Connection.Delete(i.Metadata); + if (i.Difficulty != null) Connection.Delete(i.Difficulty); - connection.Delete(i); + Connection.Delete(i); } - if (b.Metadata != null) connection.Delete(b.Metadata); - connection.Delete(b); + if (b.Metadata != null) Connection.Delete(b.Metadata); + Connection.Delete(b); } catch (Exception e) { @@ -80,41 +62,31 @@ namespace osu.Game.Database //this is required because sqlite migrations don't work, initially inserting nulls into this field. //see https://github.com/praeclarum/sqlite-net/issues/326 - connection.Query("UPDATE BeatmapSetInfo SET DeletePending = 0 WHERE DeletePending IS NULL"); + Connection.Query("UPDATE BeatmapSetInfo SET DeletePending = 0 WHERE DeletePending IS NULL"); } - private SQLiteConnection prepareConnection() + protected override void Prepare() { - var conn = storage.GetDatabase(@"beatmaps"); + Connection.CreateTable(); + Connection.CreateTable(); + Connection.CreateTable(); + Connection.CreateTable(); - try - { - conn.CreateTable(); - conn.CreateTable(); - conn.CreateTable(); - conn.CreateTable(); - } - catch - { - conn.Close(); - throw; - } - - return conn; + deletePending(); } - public void Reset() + public override void Reset() { foreach (var setInfo in Query()) { - if (storage.Exists(setInfo.Path)) - storage.Delete(setInfo.Path); + if (Storage.Exists(setInfo.Path)) + Storage.Delete(setInfo.Path); } - connection.DeleteAll(); - connection.DeleteAll(); - connection.DeleteAll(); - connection.DeleteAll(); + Connection.DeleteAll(); + Connection.DeleteAll(); + Connection.DeleteAll(); + Connection.DeleteAll(); } /// @@ -174,7 +146,7 @@ namespace osu.Game.Database BeatmapMetadata metadata; - using (var reader = ArchiveReader.GetReader(storage, path)) + using (var reader = ArchiveReader.GetReader(Storage, path)) { using (var stream = new StreamReader(reader.GetStream(reader.BeatmapFilenames[0]))) metadata = BeatmapDecoder.GetDecoder(stream).Decode(stream).Metadata; @@ -182,18 +154,18 @@ namespace osu.Game.Database if (File.Exists(path)) // Not always the case, i.e. for LegacyFilesystemReader { - using (var input = storage.GetStream(path)) + using (var input = Storage.GetStream(path)) { hash = input.GetMd5Hash(); input.Seek(0, SeekOrigin.Begin); path = Path.Combine(@"beatmaps", hash.Remove(1), hash.Remove(2), hash); - if (!storage.Exists(path)) - using (var output = storage.GetStream(path, FileAccess.Write)) + if (!Storage.Exists(path)) + using (var output = Storage.GetStream(path, FileAccess.Write)) input.CopyTo(output); } } - var existing = connection.Table().FirstOrDefault(b => b.Hash == hash); + var existing = Connection.Table().FirstOrDefault(b => b.Hash == hash); if (existing != null) { @@ -216,7 +188,7 @@ namespace osu.Game.Database Metadata = metadata }; - using (var archive = ArchiveReader.GetReader(storage, path)) + using (var archive = ArchiveReader.GetReader(Storage, path)) { string[] mapNames = archive.BeatmapFilenames; foreach (var name in mapNames) @@ -248,17 +220,17 @@ namespace osu.Game.Database public void Import(IEnumerable beatmapSets) { - lock (connection) + lock (Connection) { - connection.BeginTransaction(); + Connection.BeginTransaction(); foreach (var s in beatmapSets) { - connection.InsertWithChildren(s, true); + Connection.InsertWithChildren(s, true); BeatmapSetAdded?.Invoke(s); } - connection.Commit(); + Connection.Commit(); } } @@ -275,7 +247,7 @@ namespace osu.Game.Database if (string.IsNullOrEmpty(beatmapSet.Path)) return null; - return ArchiveReader.GetReader(storage, beatmapSet.Path); + return ArchiveReader.GetReader(Storage, beatmapSet.Path); } public BeatmapSetInfo GetBeatmapSet(int id) @@ -305,25 +277,25 @@ namespace osu.Game.Database public TableQuery Query() where T : class { - return connection.Table(); + return Connection.Table(); } public T GetWithChildren(object id) where T : class { - return connection.GetWithChildren(id); + return Connection.GetWithChildren(id); } public List GetAllWithChildren(Expression> filter = null, bool recursive = true) where T : class { - return connection.GetAllWithChildren(filter, recursive); + return Connection.GetAllWithChildren(filter, recursive); } public T GetChildren(T item, bool recursive = false) { if (item == null) return default(T); - connection.GetChildren(item, recursive); + Connection.GetChildren(item, recursive); return item; } @@ -339,11 +311,11 @@ namespace osu.Game.Database if (validTypes.All(t => t != typeof(T))) throw new ArgumentException("Must be a type managed by BeatmapDatabase", nameof(T)); if (cascade) - connection.UpdateWithChildren(record); + Connection.UpdateWithChildren(record); else - connection.Update(record); + Connection.Update(record); } - public bool Exists(BeatmapSetInfo beatmapSet) => storage.Exists(beatmapSet.Path); + public bool Exists(BeatmapSetInfo beatmapSet) => Storage.Exists(beatmapSet.Path); } } diff --git a/osu.Game/Database/Database.cs b/osu.Game/Database/Database.cs new file mode 100644 index 0000000000..6f8e902663 --- /dev/null +++ b/osu.Game/Database/Database.cs @@ -0,0 +1,44 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using osu.Framework.Logging; +using osu.Framework.Platform; +using SQLite.Net; + +namespace osu.Game.Database +{ + public abstract class Database + { + protected SQLiteConnection Connection { get; } + protected Storage Storage { get; } + + protected Database(Storage storage, SQLiteConnection connection) + { + Storage = storage; + Connection = connection; + + try + { + Prepare(); + } + catch (Exception e) + { + Logger.Error(e, @"Failed to initialise the beatmap database! Trying again with a clean database..."); + storage.DeleteDatabase(@"beatmaps"); + Reset(); + Prepare(); + } + } + + /// + /// Prepare this database for use. + /// + protected abstract void Prepare(); + + /// + /// Reset this database to a default state. Undo all changes to database and storage backings. + /// + public abstract void Reset(); + } +} \ No newline at end of file diff --git a/osu.Game/Database/ScoreDatabase.cs b/osu.Game/Database/ScoreDatabase.cs index 3b5c0575d5..240b4fa8e6 100644 --- a/osu.Game/Database/ScoreDatabase.cs +++ b/osu.Game/Database/ScoreDatabase.cs @@ -10,10 +10,11 @@ using osu.Game.IPC; using osu.Game.Modes; using osu.Game.Modes.Scoring; using SharpCompress.Compressors.LZMA; +using SQLite.Net; namespace osu.Game.Database { - public class ScoreDatabase + public class ScoreDatabase : Database { private readonly Storage storage; private readonly BeatmapDatabase beatmaps; @@ -23,7 +24,7 @@ namespace osu.Game.Database // ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised) private ScoreIPCChannel ipc; - public ScoreDatabase(Storage storage, IIpcHost importHost = null, BeatmapDatabase beatmaps = null) + public ScoreDatabase(Storage storage, SQLiteConnection connection, IIpcHost importHost = null, BeatmapDatabase beatmaps = null) : base(storage, connection) { this.storage = storage; this.beatmaps = beatmaps; @@ -39,7 +40,7 @@ namespace osu.Game.Database using (Stream s = storage.GetStream(Path.Combine(replay_folder, replayFilename))) using (SerializationReader sr = new SerializationReader(s)) { - var ruleset = RulesetCollection.GetRuleset((int)sr.ReadByte()); + var ruleset = RulesetCollection.GetRuleset(sr.ReadByte()); score = ruleset.CreateScoreProcessor().CreateScore(); /* score.Pass = true;*/ @@ -107,5 +108,13 @@ namespace osu.Game.Database return score; } + + protected override void Prepare() + { + } + + public override void Reset() + { + } } } diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index f95e8c3ac6..c37d2b83eb 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -18,6 +18,7 @@ using osu.Game.Graphics; using osu.Game.Graphics.Cursor; using osu.Game.Graphics.Processing; using osu.Game.Online.API; +using SQLite.Net; namespace osu.Game { @@ -80,8 +81,11 @@ namespace osu.Game { Dependencies.Cache(this); Dependencies.Cache(LocalConfig); - Dependencies.Cache(BeatmapDatabase = new BeatmapDatabase(Host.Storage, Host)); - Dependencies.Cache(ScoreDatabase = new ScoreDatabase(Host.Storage, Host, BeatmapDatabase)); + + SQLiteConnection connection = Host.Storage.GetDatabase(@"client"); + + Dependencies.Cache(BeatmapDatabase = new BeatmapDatabase(Host.Storage, connection, Host)); + Dependencies.Cache(ScoreDatabase = new ScoreDatabase(Host.Storage, connection, Host, BeatmapDatabase)); Dependencies.Cache(new OsuColour()); //this completely overrides the framework default. will need to change once we make a proper FontStore. diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 866d3ddacb..a450125e48 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -78,6 +78,7 @@ + From a4e2f34ee73ecca2d19cd2b37d52faa631698b47 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 17 Apr 2017 17:43:48 +0900 Subject: [PATCH 198/442] Make a RulesetDatabase. --- osu.Desktop.Tests/VisualTests.cs | 10 -- osu.Desktop.VisualTests/Program.cs | 10 -- .../Tests/TestCaseModSelectOverlay.cs | 14 ++- .../Tests/TestCasePlaySongSelect.cs | 16 ++- .../Tests/TestCasePlayer.cs | 2 +- osu.Desktop/Program.cs | 10 -- osu.Game.Modes.Catch/CatchRuleset.cs | 2 + osu.Game.Modes.Mania/ManiaRuleset.cs | 2 + osu.Game.Modes.Osu/OsuRuleset.cs | 2 + osu.Game.Modes.Taiko/TaikoRuleset.cs | 2 + .../Beatmaps/Formats/OsuLegacyDecoderTest.cs | 4 +- .../Beatmaps/IO/ImportBeatmapTest.cs | 15 +-- .../Beatmaps/IO/OszArchiveReaderTest.cs | 3 - osu.Game/Beatmaps/Beatmap.cs | 2 +- osu.Game/Beatmaps/Drawables/DifficultyIcon.cs | 2 +- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 2 +- osu.Game/Database/BeatmapDatabase.cs | 51 ++------- osu.Game/Database/BeatmapInfo.cs | 14 +-- osu.Game/Database/Database.cs | 43 ++++++- osu.Game/Database/RulesetDatabase.cs | 107 ++++++++++++++++++ osu.Game/Database/RulesetInfo.cs | 24 ++++ osu.Game/Database/ScoreDatabase.cs | 10 +- osu.Game/Modes/BeatmapStatistic.cs | 14 +++ osu.Game/Modes/Ruleset.cs | 12 +- osu.Game/Modes/RulesetCollection.cs | 42 ------- osu.Game/OsuGame.cs | 8 +- osu.Game/OsuGameBase.cs | 3 + osu.Game/Overlays/Mods/ModSelectOverlay.cs | 10 +- osu.Game/Overlays/Options/OptionsFooter.cs | 8 +- osu.Game/Overlays/Toolbar/Toolbar.cs | 6 +- .../Overlays/Toolbar/ToolbarModeButton.cs | 15 ++- .../Overlays/Toolbar/ToolbarModeSelector.cs | 15 ++- osu.Game/Screens/Play/Player.cs | 2 +- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 2 +- osu.Game/Screens/Select/FilterControl.cs | 4 +- osu.Game/Screens/Select/FilterCriteria.cs | 4 +- osu.Game/Screens/Select/SongSelect.cs | 3 +- osu.Game/osu.Game.csproj | 4 +- 38 files changed, 298 insertions(+), 201 deletions(-) create mode 100644 osu.Game/Database/RulesetDatabase.cs create mode 100644 osu.Game/Database/RulesetInfo.cs create mode 100644 osu.Game/Modes/BeatmapStatistic.cs delete mode 100644 osu.Game/Modes/RulesetCollection.cs diff --git a/osu.Desktop.Tests/VisualTests.cs b/osu.Desktop.Tests/VisualTests.cs index 36dce18b05..6ef924e873 100644 --- a/osu.Desktop.Tests/VisualTests.cs +++ b/osu.Desktop.Tests/VisualTests.cs @@ -4,11 +4,6 @@ using NUnit.Framework; using osu.Desktop.VisualTests; using osu.Framework.Desktop.Platform; -using osu.Game.Modes; -using osu.Game.Modes.Catch; -using osu.Game.Modes.Mania; -using osu.Game.Modes.Osu; -using osu.Game.Modes.Taiko; namespace osu.Desktop.Tests { @@ -20,11 +15,6 @@ namespace osu.Desktop.Tests { using (var host = new HeadlessGameHost()) { - RulesetCollection.Register(typeof(OsuRuleset)); - RulesetCollection.Register(typeof(TaikoRuleset)); - RulesetCollection.Register(typeof(ManiaRuleset)); - RulesetCollection.Register(typeof(CatchRuleset)); - host.Run(new AutomatedVisualTestGame()); } } diff --git a/osu.Desktop.VisualTests/Program.cs b/osu.Desktop.VisualTests/Program.cs index 912034a927..03d1588b78 100644 --- a/osu.Desktop.VisualTests/Program.cs +++ b/osu.Desktop.VisualTests/Program.cs @@ -4,11 +4,6 @@ using System; using osu.Framework.Desktop; using osu.Framework.Platform; -using osu.Game.Modes; -using osu.Game.Modes.Catch; -using osu.Game.Modes.Mania; -using osu.Game.Modes.Osu; -using osu.Game.Modes.Taiko; namespace osu.Desktop.VisualTests { @@ -21,11 +16,6 @@ namespace osu.Desktop.VisualTests using (GameHost host = Host.GetSuitableHost(@"osu")) { - RulesetCollection.Register(typeof(OsuRuleset)); - RulesetCollection.Register(typeof(TaikoRuleset)); - RulesetCollection.Register(typeof(ManiaRuleset)); - RulesetCollection.Register(typeof(CatchRuleset)); - if (benchmark) host.Run(new AutomatedVisualTestGame()); else diff --git a/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs index c569f5f64a..d1c137191f 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs @@ -1,10 +1,11 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Overlays.Mods; using osu.Framework.Testing; -using osu.Game.Modes; +using osu.Game.Database; namespace osu.Desktop.VisualTests.Tests { @@ -13,6 +14,13 @@ namespace osu.Desktop.VisualTests.Tests public override string Description => @"Tests the mod select overlay"; private ModSelectOverlay modSelect; + private RulesetDatabase rulesets; + + [BackgroundDependencyLoader] + private void load(RulesetDatabase rulesets) + { + this.rulesets = rulesets; + } public override void Reset() { @@ -27,8 +35,8 @@ namespace osu.Desktop.VisualTests.Tests AddStep("Toggle", modSelect.ToggleVisibility); - foreach (var ruleset in RulesetCollection.AllRulesets) - AddStep(ruleset.Description, () => modSelect.Ruleset.Value = ruleset); + foreach (var ruleset in rulesets.AllRulesets) + AddStep(ruleset.CreateInstance().Description, () => modSelect.Ruleset.Value = ruleset); } } } diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs index dd17d62739..85ccebef77 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs @@ -3,12 +3,12 @@ using System.Collections.Generic; using osu.Desktop.VisualTests.Platform; +using osu.Framework.Allocation; using osu.Framework.Testing; using osu.Framework.MathUtils; using osu.Game.Database; using osu.Game.Screens.Select; using osu.Game.Screens.Select.Filter; -using osu.Game.Modes; namespace osu.Desktop.VisualTests.Tests { @@ -20,6 +20,14 @@ namespace osu.Desktop.VisualTests.Tests public override string Description => @"with fake data"; + private RulesetDatabase rulesets; + + [BackgroundDependencyLoader] + private void load(RulesetDatabase rulesets) + { + this.rulesets = rulesets; + } + public override void Reset() { base.Reset(); @@ -72,7 +80,7 @@ namespace osu.Desktop.VisualTests.Tests new BeatmapInfo { OnlineBeatmapID = 1234 + i, - Ruleset = RulesetCollection.GetRuleset(0), + Ruleset = rulesets.Query().First(), Path = "normal.osu", Version = "Normal", Difficulty = new BeatmapDifficulty @@ -83,7 +91,7 @@ namespace osu.Desktop.VisualTests.Tests new BeatmapInfo { OnlineBeatmapID = 1235 + i, - Ruleset = RulesetCollection.GetRuleset(0), + Ruleset = rulesets.Query().First(), Path = "hard.osu", Version = "Hard", Difficulty = new BeatmapDifficulty @@ -94,7 +102,7 @@ namespace osu.Desktop.VisualTests.Tests new BeatmapInfo { OnlineBeatmapID = 1236 + i, - Ruleset = RulesetCollection.GetRuleset(0), + Ruleset = rulesets.Query().First(), Path = "insane.osu", Version = "Insane", Difficulty = new BeatmapDifficulty diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs index 2a9c31b2e9..924e753e2d 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs @@ -37,7 +37,7 @@ namespace osu.Desktop.VisualTests.Tests WorkingBeatmap beatmap = null; - var beatmapInfo = db.Query().FirstOrDefault(b => b.Ruleset is OsuRuleset); + var beatmapInfo = db.Query().FirstOrDefault(b => b.Ruleset.CreateInstance() is OsuRuleset); if (beatmapInfo != null) beatmap = db.GetWorkingBeatmap(beatmapInfo); diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index e9117cf533..210f780078 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -7,11 +7,6 @@ using osu.Desktop.Beatmaps.IO; using osu.Framework.Desktop; using osu.Framework.Desktop.Platform; using osu.Game.IPC; -using osu.Game.Modes; -using osu.Game.Modes.Catch; -using osu.Game.Modes.Mania; -using osu.Game.Modes.Osu; -using osu.Game.Modes.Taiko; namespace osu.Desktop { @@ -41,11 +36,6 @@ namespace osu.Desktop } else { - RulesetCollection.Register(typeof(OsuRuleset)); - RulesetCollection.Register(typeof(TaikoRuleset)); - RulesetCollection.Register(typeof(ManiaRuleset)); - RulesetCollection.Register(typeof(CatchRuleset)); - host.Run(new OsuGameDesktop(args)); } return 0; diff --git a/osu.Game.Modes.Catch/CatchRuleset.cs b/osu.Game.Modes.Catch/CatchRuleset.cs index 02c170d0ac..6aafb2a3c6 100644 --- a/osu.Game.Modes.Catch/CatchRuleset.cs +++ b/osu.Game.Modes.Catch/CatchRuleset.cs @@ -90,5 +90,7 @@ namespace osu.Game.Modes.Catch public override DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap) => new CatchDifficultyCalculator(beatmap); public override ScoreProcessor CreateScoreProcessor() => new CatchScoreProcessor(); + + public override int LegacyID => 2; } } diff --git a/osu.Game.Modes.Mania/ManiaRuleset.cs b/osu.Game.Modes.Mania/ManiaRuleset.cs index 7d25ea93c9..030cea7344 100644 --- a/osu.Game.Modes.Mania/ManiaRuleset.cs +++ b/osu.Game.Modes.Mania/ManiaRuleset.cs @@ -105,5 +105,7 @@ namespace osu.Game.Modes.Mania public override DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap) => new ManiaDifficultyCalculator(beatmap); public override ScoreProcessor CreateScoreProcessor() => new ManiaScoreProcessor(); + + public override int LegacyID => 3; } } diff --git a/osu.Game.Modes.Osu/OsuRuleset.cs b/osu.Game.Modes.Osu/OsuRuleset.cs index 6ca19bb5bb..4de890ac5f 100644 --- a/osu.Game.Modes.Osu/OsuRuleset.cs +++ b/osu.Game.Modes.Osu/OsuRuleset.cs @@ -110,5 +110,7 @@ namespace osu.Game.Modes.Osu }; public override ScoreProcessor CreateScoreProcessor() => new OsuScoreProcessor(); + + public override int LegacyID => 0; } } diff --git a/osu.Game.Modes.Taiko/TaikoRuleset.cs b/osu.Game.Modes.Taiko/TaikoRuleset.cs index e88b50bb95..b93c25c55d 100644 --- a/osu.Game.Modes.Taiko/TaikoRuleset.cs +++ b/osu.Game.Modes.Taiko/TaikoRuleset.cs @@ -91,5 +91,7 @@ namespace osu.Game.Modes.Taiko public override DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap) => new TaikoDifficultyCalculator(beatmap); public override ScoreProcessor CreateScoreProcessor() => new TaikoScoreProcessor(); + + public override int LegacyID => 1; } } diff --git a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs index 9d783c7e91..91b673dc4c 100644 --- a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs @@ -6,7 +6,6 @@ using NUnit.Framework; using OpenTK; using OpenTK.Graphics; using osu.Game.Beatmaps.Formats; -using osu.Game.Modes; using osu.Game.Tests.Resources; using osu.Game.Modes.Osu; using osu.Game.Modes.Objects.Legacy; @@ -22,7 +21,6 @@ namespace osu.Game.Tests.Beatmaps.Formats public void SetUp() { OsuLegacyDecoder.Register(); - RulesetCollection.Register(typeof(OsuRuleset)); } [Test] @@ -58,7 +56,7 @@ namespace osu.Game.Tests.Beatmaps.Formats Assert.AreEqual(false, beatmapInfo.Countdown); Assert.AreEqual(0.7f, beatmapInfo.StackLeniency); Assert.AreEqual(false, beatmapInfo.SpecialStyle); - Assert.IsTrue(beatmapInfo.Ruleset is OsuRuleset); + Assert.IsTrue(beatmapInfo.Ruleset.CreateInstance() is OsuRuleset); Assert.AreEqual(false, beatmapInfo.LetterboxInBreaks); Assert.AreEqual(false, beatmapInfo.WidescreenStoryboard); } diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs index e110da59b9..0d27a6a650 100644 --- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs @@ -12,11 +12,7 @@ using osu.Framework.Desktop.Platform; using osu.Framework.Platform; using osu.Game.Database; using osu.Game.IPC; -using osu.Game.Modes; -using osu.Game.Modes.Catch; -using osu.Game.Modes.Mania; using osu.Game.Modes.Osu; -using osu.Game.Modes.Taiko; namespace osu.Game.Tests.Beatmaps.IO { @@ -25,15 +21,6 @@ namespace osu.Game.Tests.Beatmaps.IO { private const string osz_path = @"../../../osu-resources/osu.Game.Resources/Beatmaps/241526 Soleily - Renatus.osz"; - [OneTimeSetUp] - public void SetUp() - { - RulesetCollection.Register(typeof(OsuRuleset)); - RulesetCollection.Register(typeof(TaikoRuleset)); - RulesetCollection.Register(typeof(ManiaRuleset)); - RulesetCollection.Register(typeof(CatchRuleset)); - } - [Test] public void TestImportWhenClosed() { @@ -166,7 +153,7 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.IsTrue(set.Beatmaps.Count > 0); - var beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.Ruleset is OsuRuleset))?.Beatmap; + var beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.Ruleset.CreateInstance() is OsuRuleset))?.Beatmap; Assert.IsTrue(beatmap?.HitObjects.Count > 0); } diff --git a/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs b/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs index add00d8f4d..03d09e24e0 100644 --- a/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs @@ -4,8 +4,6 @@ using System.IO; using NUnit.Framework; using osu.Game.Beatmaps.IO; -using osu.Game.Modes; -using osu.Game.Modes.Osu; using osu.Game.Tests.Resources; using osu.Game.Beatmaps.Formats; using osu.Game.Database; @@ -19,7 +17,6 @@ namespace osu.Game.Tests.Beatmaps.IO public void SetUp() { OszArchiveReader.Register(); - RulesetCollection.Register(typeof(OsuRuleset)); } [Test] diff --git a/osu.Game/Beatmaps/Beatmap.cs b/osu.Game/Beatmaps/Beatmap.cs index 6099b1e115..3b57d4e7fe 100644 --- a/osu.Game/Beatmaps/Beatmap.cs +++ b/osu.Game/Beatmaps/Beatmap.cs @@ -53,7 +53,7 @@ namespace osu.Game.Beatmaps /// Calculates the star difficulty for this Beatmap. /// /// The star difficulty. - public double CalculateStarDifficulty() => BeatmapInfo.Ruleset.CreateDifficultyCalculator(this).Calculate(); + public double CalculateStarDifficulty() => BeatmapInfo.Ruleset.CreateInstance().CreateDifficultyCalculator(this).Calculate(); /// /// Constructs a new beatmap. diff --git a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs index 02595df77a..8a9183819c 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs @@ -44,7 +44,7 @@ namespace osu.Game.Beatmaps.Drawables Origin = Anchor.Centre, TextSize = Size.X, Colour = Color4.White, - Icon = beatmap.Ruleset.Icon + Icon = beatmap.Ruleset.CreateInstance().Icon } }; } diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index 36f025d1ff..8ad5f8e7c0 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -83,7 +83,7 @@ namespace osu.Game.Beatmaps.Formats beatmap.BeatmapInfo.StackLeniency = float.Parse(val, NumberFormatInfo.InvariantInfo); break; case @"Mode": - beatmap.BeatmapInfo.Mode = int.Parse(val); + beatmap.BeatmapInfo.RulesetID = int.Parse(val); break; case @"LetterboxInBreaks": beatmap.BeatmapInfo.LetterboxInBreaks = int.Parse(val) == 1; diff --git a/osu.Game/Database/BeatmapDatabase.cs b/osu.Game/Database/BeatmapDatabase.cs index 9695ba8bd0..f3f58ce8b0 100644 --- a/osu.Game/Database/BeatmapDatabase.cs +++ b/osu.Game/Database/BeatmapDatabase.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; -using System.Linq.Expressions; using osu.Framework.Extensions; using osu.Framework.Logging; using osu.Framework.Platform; @@ -77,6 +76,8 @@ namespace osu.Game.Database public override void Reset() { + Storage.DeleteDatabase(@"beatmaps"); + foreach (var setInfo in Query()) { if (Storage.Exists(setInfo.Path)) @@ -89,6 +90,13 @@ namespace osu.Game.Database Connection.DeleteAll(); } + protected override Type[] ValidTypes => new[] { + typeof(BeatmapSetInfo), + typeof(BeatmapInfo), + typeof(BeatmapMetadata), + typeof(BeatmapDifficulty), + }; + /// /// Import multiple from . /// @@ -275,47 +283,6 @@ namespace osu.Game.Database return working; } - public TableQuery Query() where T : class - { - return Connection.Table(); - } - - public T GetWithChildren(object id) where T : class - { - return Connection.GetWithChildren(id); - } - - public List GetAllWithChildren(Expression> filter = null, bool recursive = true) - where T : class - { - return Connection.GetAllWithChildren(filter, recursive); - } - - public T GetChildren(T item, bool recursive = false) - { - if (item == null) return default(T); - - Connection.GetChildren(item, recursive); - return item; - } - - private readonly Type[] validTypes = { - typeof(BeatmapSetInfo), - typeof(BeatmapInfo), - typeof(BeatmapMetadata), - typeof(BeatmapDifficulty), - }; - - public void Update(T record, bool cascade = true) where T : class - { - if (validTypes.All(t => t != typeof(T))) - throw new ArgumentException("Must be a type managed by BeatmapDatabase", nameof(T)); - if (cascade) - Connection.UpdateWithChildren(record); - else - Connection.Update(record); - } - public bool Exists(BeatmapSetInfo beatmapSet) => Storage.Exists(beatmapSet.Path); } } diff --git a/osu.Game/Database/BeatmapInfo.cs b/osu.Game/Database/BeatmapInfo.cs index be4faebde2..5097622deb 100644 --- a/osu.Game/Database/BeatmapInfo.cs +++ b/osu.Game/Database/BeatmapInfo.cs @@ -3,7 +3,6 @@ using Newtonsoft.Json; using osu.Game.IO.Serialization; -using osu.Game.Modes; using SQLite.Net.Attributes; using SQLiteNetExtensions.Attributes; using System; @@ -55,15 +54,12 @@ namespace osu.Game.Database public float StackLeniency { get; set; } public bool SpecialStyle { get; set; } - public int Mode { get; set; } + [ForeignKey(typeof(RulesetInfo))] + public int RulesetID { get; set; } + + [OneToOne(CascadeOperations = CascadeOperation.All)] + public RulesetInfo Ruleset { get; set; } - [Ignore] - public Ruleset Ruleset - { - get { return RulesetCollection.GetRuleset(Mode); } - set { Mode = RulesetCollection.GetId(value); } - } - public bool LetterboxInBreaks { get; set; } public bool WidescreenStoryboard { get; set; } diff --git a/osu.Game/Database/Database.cs b/osu.Game/Database/Database.cs index 6f8e902663..19bd78b39c 100644 --- a/osu.Game/Database/Database.cs +++ b/osu.Game/Database/Database.cs @@ -2,9 +2,13 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; using osu.Framework.Logging; using osu.Framework.Platform; using SQLite.Net; +using SQLiteNetExtensions.Extensions; namespace osu.Game.Database { @@ -24,8 +28,7 @@ namespace osu.Game.Database } catch (Exception e) { - Logger.Error(e, @"Failed to initialise the beatmap database! Trying again with a clean database..."); - storage.DeleteDatabase(@"beatmaps"); + Logger.Error(e, $@"Failed to initialise the {GetType()}! Trying again with a clean database..."); Reset(); Prepare(); } @@ -40,5 +43,41 @@ namespace osu.Game.Database /// Reset this database to a default state. Undo all changes to database and storage backings. /// public abstract void Reset(); + + public TableQuery Query() where T : class + { + return Connection.Table(); + } + + public T GetWithChildren(object id) where T : class + { + return Connection.GetWithChildren(id); + } + + public List GetAllWithChildren(Expression> filter = null, bool recursive = true) + where T : class + { + return Connection.GetAllWithChildren(filter, recursive); + } + + public T GetChildren(T item, bool recursive = false) + { + if (item == null) return default(T); + + Connection.GetChildren(item, recursive); + return item; + } + + protected abstract Type[] ValidTypes { get; } + + public void Update(T record, bool cascade = true) where T : class + { + if (ValidTypes.All(t => t != typeof(T))) + throw new ArgumentException("Must be a type managed by BeatmapDatabase", nameof(T)); + if (cascade) + Connection.UpdateWithChildren(record); + else + Connection.Update(record); + } } } \ No newline at end of file diff --git a/osu.Game/Database/RulesetDatabase.cs b/osu.Game/Database/RulesetDatabase.cs new file mode 100644 index 0000000000..45db5df26f --- /dev/null +++ b/osu.Game/Database/RulesetDatabase.cs @@ -0,0 +1,107 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using osu.Framework.Platform; +using osu.Game.Modes; +using SQLite.Net; + +namespace osu.Game.Database +{ + /// + /// Todo: All of this needs to be moved to a RulesetDatabase. + /// + public class RulesetDatabase : Database + { + public IEnumerable AllRulesets => Query().Where(r => r.Available); + + public RulesetDatabase(Storage storage, SQLiteConnection connection) + : base(storage, connection) + { + } + + protected override void Prepare() + { + Connection.CreateTable(); + + List instances = new List(); + + foreach (string file in Directory.GetFiles(Environment.CurrentDirectory, @"osu.Game.Modes.*.dll")) + { + try + { + var assembly = Assembly.LoadFile(file); + var rulesets = assembly.GetTypes().Where(t => t.IsSubclassOf(typeof(Ruleset))); + + if (rulesets.Count() != 1) + continue; + + Assembly.LoadFile(file); + + foreach (Type rulesetType in rulesets) + instances.Add((Ruleset)Activator.CreateInstance(rulesetType)); + } + catch (Exception) { } + } + + Connection.BeginTransaction(); + + //add all legacy modes in correct order + foreach (var r in instances.Where(r => r.LegacyID >= 0).OrderBy(r => r.LegacyID)) + { + Connection.InsertOrReplace(createRulesetInfo(r)); + } + + //add any other modes + foreach (var r in instances.Where(r => r.LegacyID < 0)) + { + var us = createRulesetInfo(r); + + var existing = Query().FirstOrDefault(ri => ri.InstantiationInfo == us.InstantiationInfo); + + if (existing == null) + Connection.Insert(us); + } + + //perform a consistency check + foreach (var r in Query()) + { + try + { + r.CreateInstance(); + r.Available = true; + } + catch + { + r.Available = false; + } + + Connection.Update(r); + } + + Connection.Commit(); + + + } + + private RulesetInfo createRulesetInfo(Ruleset ruleset) => new RulesetInfo + { + Name = ruleset.Description, + InstantiationInfo = ruleset.GetType().AssemblyQualifiedName, + ID = ruleset.LegacyID + }; + + public override void Reset() + { + Connection.DeleteAll(); + } + + protected override Type[] ValidTypes => new[] { typeof(RulesetInfo) }; + + public RulesetInfo GetRuleset(int id) => Query().First(r => r.ID == id); + } +} diff --git a/osu.Game/Database/RulesetInfo.cs b/osu.Game/Database/RulesetInfo.cs new file mode 100644 index 0000000000..6a0ee13e41 --- /dev/null +++ b/osu.Game/Database/RulesetInfo.cs @@ -0,0 +1,24 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using osu.Game.Modes; +using SQLite.Net.Attributes; + +namespace osu.Game.Database +{ + public class RulesetInfo + { + [PrimaryKey, AutoIncrement] + public int ID { get; set; } + + public string Name { get; set; } + + public string InstantiationInfo { get; set; } + + [Indexed] + public bool Available { get; set; } + + public Ruleset CreateInstance() => (Ruleset)Activator.CreateInstance(Type.GetType(InstantiationInfo)); + } +} \ No newline at end of file diff --git a/osu.Game/Database/ScoreDatabase.cs b/osu.Game/Database/ScoreDatabase.cs index 240b4fa8e6..91a52fba4a 100644 --- a/osu.Game/Database/ScoreDatabase.cs +++ b/osu.Game/Database/ScoreDatabase.cs @@ -7,7 +7,6 @@ using System.Linq; using osu.Framework.Platform; using osu.Game.IO.Legacy; using osu.Game.IPC; -using osu.Game.Modes; using osu.Game.Modes.Scoring; using SharpCompress.Compressors.LZMA; using SQLite.Net; @@ -17,17 +16,20 @@ namespace osu.Game.Database public class ScoreDatabase : Database { private readonly Storage storage; + private readonly BeatmapDatabase beatmaps; + private readonly RulesetDatabase rulesets; private const string replay_folder = @"replays"; // ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised) private ScoreIPCChannel ipc; - public ScoreDatabase(Storage storage, SQLiteConnection connection, IIpcHost importHost = null, BeatmapDatabase beatmaps = null) : base(storage, connection) + public ScoreDatabase(Storage storage, SQLiteConnection connection, IIpcHost importHost = null, BeatmapDatabase beatmaps = null, RulesetDatabase rulesets = null) : base(storage, connection) { this.storage = storage; this.beatmaps = beatmaps; + this.rulesets = rulesets; if (importHost != null) ipc = new ScoreIPCChannel(importHost, this); @@ -40,7 +42,7 @@ namespace osu.Game.Database using (Stream s = storage.GetStream(Path.Combine(replay_folder, replayFilename))) using (SerializationReader sr = new SerializationReader(s)) { - var ruleset = RulesetCollection.GetRuleset(sr.ReadByte()); + var ruleset = rulesets.GetRuleset(sr.ReadByte()).CreateInstance(); score = ruleset.CreateScoreProcessor().CreateScore(); /* score.Pass = true;*/ @@ -116,5 +118,7 @@ namespace osu.Game.Database public override void Reset() { } + + protected override Type[] ValidTypes => new[] { typeof(Score) }; } } diff --git a/osu.Game/Modes/BeatmapStatistic.cs b/osu.Game/Modes/BeatmapStatistic.cs new file mode 100644 index 0000000000..d598b81ff4 --- /dev/null +++ b/osu.Game/Modes/BeatmapStatistic.cs @@ -0,0 +1,14 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Graphics; + +namespace osu.Game.Modes +{ + public class BeatmapStatistic + { + public FontAwesome Icon; + public string Content; + public string Name; + } +} \ No newline at end of file diff --git a/osu.Game/Modes/Ruleset.cs b/osu.Game/Modes/Ruleset.cs index 284a71d518..cf0fbe5b6a 100644 --- a/osu.Game/Modes/Ruleset.cs +++ b/osu.Game/Modes/Ruleset.cs @@ -11,13 +11,6 @@ using osu.Game.Modes.Scoring; namespace osu.Game.Modes { - public class BeatmapStatistic - { - public FontAwesome Icon; - public string Content; - public string Name; - } - public abstract class Ruleset { public virtual IEnumerable GetBeatmapStatistics(WorkingBeatmap beatmap) => new BeatmapStatistic[] { }; @@ -35,5 +28,10 @@ namespace osu.Game.Modes public abstract string Description { get; } public abstract IEnumerable CreateGameplayKeys(); + + /// + /// Do not override this unless you are a legacy mode. + /// + public virtual int LegacyID => -1; } } diff --git a/osu.Game/Modes/RulesetCollection.cs b/osu.Game/Modes/RulesetCollection.cs deleted file mode 100644 index 221fa6f5ba..0000000000 --- a/osu.Game/Modes/RulesetCollection.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Linq; - -namespace osu.Game.Modes -{ - /// - /// Todo: All of this needs to be moved to a RulesetDatabase. - /// - public static class RulesetCollection - { - private static readonly ConcurrentDictionary available_rulesets = new ConcurrentDictionary(); - - public static void Register(Type type) - { - var ruleset = Activator.CreateInstance(type) as Ruleset; - - if (ruleset == null) - return; - - available_rulesets.TryAdd(available_rulesets.Count, ruleset); - } - - public static Ruleset GetRuleset(int rulesetId) - { - Ruleset ruleset; - - if (!available_rulesets.TryGetValue(rulesetId, out ruleset)) - return null; - - return ruleset; - } - - public static int GetId(Ruleset ruleset) => available_rulesets.First(kvp => kvp.Value == ruleset).Key; - - public static IEnumerable AllRulesets => available_rulesets.Values; - } -} diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 3379787d6d..6062f3fd59 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -15,7 +15,6 @@ using osu.Framework.Logging; using osu.Game.Graphics.UserInterface.Volume; using osu.Framework.Allocation; using osu.Framework.Timing; -using osu.Game.Modes; using osu.Game.Overlays.Toolbar; using osu.Game.Screens; using osu.Game.Screens.Menu; @@ -24,6 +23,7 @@ using System.Linq; using osu.Framework.Graphics.Primitives; using System.Threading.Tasks; using osu.Framework.Threading; +using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Modes.Scoring; using osu.Game.Overlays.Notifications; @@ -59,7 +59,7 @@ namespace osu.Game private VolumeControl volume; private Bindable configRuleset; - public Bindable Ruleset = new Bindable(); + public Bindable Ruleset = new Bindable(); private readonly string[] args; @@ -90,8 +90,8 @@ namespace osu.Game Dependencies.Cache(this); configRuleset = LocalConfig.GetBindable(OsuConfig.Ruleset); - Ruleset.Value = RulesetCollection.GetRuleset(configRuleset.Value); - Ruleset.ValueChanged += r => configRuleset.Value = RulesetCollection.GetId(r); + Ruleset.Value = RulesetDatabase.GetRuleset(configRuleset.Value); + Ruleset.ValueChanged += r => configRuleset.Value = r.ID; } private ScheduledDelegate scoreLoad; diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index c37d2b83eb..c6a5cbef1b 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -28,6 +28,8 @@ namespace osu.Game protected BeatmapDatabase BeatmapDatabase; + protected RulesetDatabase RulesetDatabase; + protected ScoreDatabase ScoreDatabase; protected override string MainResourceFile => @"osu.Game.Resources.dll"; @@ -85,6 +87,7 @@ namespace osu.Game SQLiteConnection connection = Host.Storage.GetDatabase(@"client"); Dependencies.Cache(BeatmapDatabase = new BeatmapDatabase(Host.Storage, connection, Host)); + Dependencies.Cache(RulesetDatabase = new RulesetDatabase(Host.Storage, connection)); Dependencies.Cache(ScoreDatabase = new ScoreDatabase(Host.Storage, connection, Host, BeatmapDatabase)); Dependencies.Cache(new OsuColour()); diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 02df95ff8a..30ccb2d005 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -13,11 +13,11 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Sprites; -using osu.Game.Modes; using osu.Game.Modes.Mods; using System; using System.Collections.Generic; using System.Linq; +using osu.Game.Database; namespace osu.Game.Overlays.Mods { @@ -37,12 +37,14 @@ namespace osu.Game.Overlays.Mods public readonly Bindable> SelectedMods = new Bindable>(); - public readonly Bindable Ruleset = new Bindable(RulesetCollection.GetRuleset(0)); + public readonly Bindable Ruleset = new Bindable(); - private void rulesetChanged(Ruleset newRuleset) + private void rulesetChanged(RulesetInfo newRuleset) { + var instance = newRuleset.CreateInstance(); + foreach (ModSection section in modSectionsContainer.Children) - section.Buttons = newRuleset.GetModsFor(section.ModType).Select(m => new ModButton(m)).ToArray(); + section.Buttons = instance.GetModsFor(section.ModType).Select(m => new ModButton(m)).ToArray(); refreshSelectedMods(); } diff --git a/osu.Game/Overlays/Options/OptionsFooter.cs b/osu.Game/Overlays/Options/OptionsFooter.cs index ad184c8838..c785f2d0c0 100644 --- a/osu.Game/Overlays/Options/OptionsFooter.cs +++ b/osu.Game/Overlays/Options/OptionsFooter.cs @@ -6,9 +6,9 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; +using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; -using osu.Game.Modes; using OpenTK; using OpenTK.Graphics; @@ -17,7 +17,7 @@ namespace osu.Game.Overlays.Options public class OptionsFooter : FillFlowContainer { [BackgroundDependencyLoader] - private void load(OsuGameBase game, OsuColour colours) + private void load(OsuGameBase game, OsuColour colours, RulesetDatabase rulesets) { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; @@ -26,11 +26,11 @@ namespace osu.Game.Overlays.Options var modes = new List(); - foreach (var ruleset in RulesetCollection.AllRulesets) + foreach (var ruleset in rulesets.AllRulesets) { modes.Add(new TextAwesome { - Icon = ruleset.Icon, + Icon = ruleset.CreateInstance().Icon, Colour = Color4.Gray, TextSize = 20 }); diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index ec76a37e6e..4632b55775 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -8,8 +8,8 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Input; +using osu.Game.Database; using osu.Game.Graphics; -using osu.Game.Modes; using OpenTK; namespace osu.Game.Overlays.Toolbar @@ -20,7 +20,7 @@ namespace osu.Game.Overlays.Toolbar public const float TOOLTIP_HEIGHT = 30; public Action OnHome; - public Action OnRulesetChange; + public Action OnRulesetChange; private readonly ToolbarModeSelector modeSelector; private readonly ToolbarUserArea userArea; @@ -129,7 +129,7 @@ namespace osu.Game.Overlays.Toolbar } } - public void SetGameMode(Ruleset ruleset) => modeSelector.SetGameMode(ruleset); + public void SetGameMode(RulesetInfo ruleset) => modeSelector.SetGameMode(ruleset); protected override void PopIn() { diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs b/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs index 6ace90bcb4..dd70289f7d 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs @@ -2,23 +2,26 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics.Containers; -using osu.Game.Modes; +using osu.Game.Database; using OpenTK.Graphics; namespace osu.Game.Overlays.Toolbar { public class ToolbarModeButton : ToolbarButton { - private Ruleset ruleset; - public Ruleset Ruleset + private RulesetInfo ruleset; + public RulesetInfo Ruleset { get { return ruleset; } set { ruleset = value; - TooltipMain = ruleset.Description; - TooltipSub = $"Play some {ruleset.Description}"; - Icon = ruleset.Icon; + + var rInstance = ruleset.CreateInstance(); + + TooltipMain = rInstance.Description; + TooltipSub = $"Play some {rInstance.Description}"; + Icon = rInstance.Icon; } } diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs index 0d673eb3fe..e4c9db7c5d 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs @@ -3,12 +3,13 @@ using System; using System.Linq; +using osu.Framework.Allocation; using osu.Framework.Caching; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; -using osu.Game.Modes; +using osu.Game.Database; using OpenTK; using OpenTK.Graphics; @@ -22,7 +23,7 @@ namespace osu.Game.Overlays.Toolbar private readonly Drawable modeButtonLine; private ToolbarModeButton activeButton; - public Action OnRulesetChange; + public Action OnRulesetChange; public ToolbarModeSelector() { @@ -62,8 +63,12 @@ namespace osu.Game.Overlays.Toolbar } } }; + } - foreach (var ruleset in RulesetCollection.AllRulesets) + [BackgroundDependencyLoader] + private void load(RulesetDatabase rulesets) + { + foreach (var ruleset in rulesets.AllRulesets) { modeButtons.Add(new ToolbarModeButton { @@ -84,11 +89,11 @@ namespace osu.Game.Overlays.Toolbar Size = new Vector2(modeButtons.DrawSize.X, 1); } - public void SetGameMode(Ruleset ruleset) + public void SetGameMode(RulesetInfo ruleset) { foreach (ToolbarModeButton m in modeButtons.Children.Cast()) { - bool isActive = m.Ruleset == ruleset; + bool isActive = m.Ruleset.ID == ruleset.ID; m.Active = isActive; if (isActive) activeButton = m; diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index b59b3bf0c1..b32548c31a 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -102,7 +102,7 @@ namespace osu.Game.Screens.Play sourceClock.Reset(); }); - ruleset = Beatmap.BeatmapInfo.Ruleset; + ruleset = Beatmap.BeatmapInfo.Ruleset.CreateInstance(); // Todo: This should be done as early as possible, and should check if the hit renderer // can actually convert the hit objects... Somehow... diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 775efd5a40..2d873d10ab 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -100,7 +100,7 @@ namespace osu.Game.Screens.Select })); //get statistics fromt he current ruleset. - labels.AddRange(beatmap.BeatmapInfo.Ruleset.GetBeatmapStatistics(beatmap).Select(s => new InfoLabel(s))); + labels.AddRange(beatmap.BeatmapInfo.Ruleset.CreateInstance().GetBeatmapStatistics(beatmap).Select(s => new InfoLabel(s))); } AlwaysPresent = true; diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 1e2f074939..e0b197e9ca 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -16,7 +16,7 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Select.Filter; using Container = osu.Framework.Graphics.Containers.Container; using osu.Framework.Input; -using osu.Game.Modes; +using osu.Game.Database; namespace osu.Game.Screens.Select { @@ -163,7 +163,7 @@ namespace osu.Game.Screens.Select searchTextBox.HoldFocus = true; } - private readonly Bindable ruleset = new Bindable(RulesetCollection.GetRuleset(0)); + private readonly Bindable ruleset = new Bindable(); [BackgroundDependencyLoader(permitNulls:true)] private void load(OsuColour colours, OsuGame osu) diff --git a/osu.Game/Screens/Select/FilterCriteria.cs b/osu.Game/Screens/Select/FilterCriteria.cs index 0b750ef8d3..1a32244deb 100644 --- a/osu.Game/Screens/Select/FilterCriteria.cs +++ b/osu.Game/Screens/Select/FilterCriteria.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; using osu.Game.Beatmaps.Drawables; -using osu.Game.Modes; +using osu.Game.Database; using osu.Game.Screens.Select.Filter; namespace osu.Game.Screens.Select @@ -15,7 +15,7 @@ namespace osu.Game.Screens.Select public GroupMode Group; public SortMode Sort; public string SearchText; - public Ruleset Ruleset; + public RulesetInfo Ruleset; public void Filter(List groups) { diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 183eb7de32..182158fa5d 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -20,7 +20,6 @@ using osu.Game.Beatmaps.Drawables; using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Containers; -using osu.Game.Modes; using osu.Game.Overlays; using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Select.Options; @@ -29,7 +28,7 @@ namespace osu.Game.Screens.Select { public abstract class SongSelect : OsuScreen { - private readonly Bindable ruleset = new Bindable(RulesetCollection.GetRuleset(0)); + private readonly Bindable ruleset = new Bindable(); private BeatmapDatabase database; protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap); diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index a450125e48..193c2c1179 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -79,6 +79,7 @@ + @@ -102,6 +103,7 @@ + @@ -133,7 +135,7 @@ - + From db6556a0f9459e71513e65b51b1113d0b0a556d7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 17 Apr 2017 17:44:02 +0900 Subject: [PATCH 199/442] Index DeletePending for better performance. --- osu.Game/Database/BeatmapSetInfo.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Database/BeatmapSetInfo.cs b/osu.Game/Database/BeatmapSetInfo.cs index 0ef0ba4c63..0875d3c01f 100644 --- a/osu.Game/Database/BeatmapSetInfo.cs +++ b/osu.Game/Database/BeatmapSetInfo.cs @@ -26,6 +26,7 @@ namespace osu.Game.Database public double MaxStarDifficulty => Beatmaps.Max(b => b.StarDifficulty); + [Indexed] public bool DeletePending { get; set; } public string Hash { get; set; } From c235a14e3e11f8f2daec4a7c9499714ae8364456 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Mon, 17 Apr 2017 17:08:01 +0800 Subject: [PATCH 200/442] Don't block input in BeatmapInfoWedge. --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 768cef4645..ac1f1837b7 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -47,6 +47,8 @@ namespace osu.Game.Screens.Select protected override bool HideOnEscape => false; + protected override bool BlockPassThroughInput => false; + protected override void PopIn() { MoveToX(0, 800, EasingTypes.OutQuint); From af13f97435f94be809de44031fbe0faa9a033332 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 17 Apr 2017 19:44:03 +0900 Subject: [PATCH 201/442] Fix regressions and test cases. --- .../Tests/TestCaseGamefield.cs | 10 +++++ .../Tests/TestCaseModSelectOverlay.cs | 1 + .../Tests/TestCasePlaySongSelect.cs | 12 +++--- .../Tests/TestCasePlayer.cs | 5 ++- .../Beatmaps/Formats/OsuLegacyDecoderTest.cs | 3 +- .../Beatmaps/IO/ImportBeatmapTest.cs | 6 +-- osu.Game/Beatmaps/Beatmap.cs | 6 --- osu.Game/Database/BeatmapDatabase.cs | 39 +++++++++++-------- osu.Game/Database/Database.cs | 7 ++-- osu.Game/Database/RulesetDatabase.cs | 16 +++----- osu.Game/Database/RulesetInfo.cs | 2 +- osu.Game/Database/ScoreDatabase.cs | 6 +-- osu.Game/OsuGame.cs | 2 +- osu.Game/OsuGameBase.cs | 2 +- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 5 ++- 15 files changed, 63 insertions(+), 59 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs index 3129cade63..d1519d0404 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs @@ -17,13 +17,22 @@ using osu.Game.Modes.Osu.UI; using osu.Game.Modes.Taiko.UI; using System.Collections.Generic; using osu.Desktop.VisualTests.Beatmaps; +using osu.Framework.Allocation; namespace osu.Desktop.VisualTests.Tests { internal class TestCaseGamefield : TestCase { + private RulesetDatabase rulesets; + public override string Description => @"Showing hitobjects and what not."; + [BackgroundDependencyLoader] + private void load(RulesetDatabase rulesets) + { + this.rulesets = rulesets; + } + public override void Reset() { base.Reset(); @@ -49,6 +58,7 @@ namespace osu.Desktop.VisualTests.Tests BeatmapInfo = new BeatmapInfo { Difficulty = new BeatmapDifficulty(), + Ruleset = rulesets.Query().First(), Metadata = new BeatmapMetadata { Artist = @"Unknown", diff --git a/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs index d1c137191f..a2d7b3ad99 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Overlays.Mods; diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs index 85ccebef77..db21556cda 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs @@ -22,19 +22,17 @@ namespace osu.Desktop.VisualTests.Tests private RulesetDatabase rulesets; - [BackgroundDependencyLoader] - private void load(RulesetDatabase rulesets) - { - this.rulesets = rulesets; - } - public override void Reset() { base.Reset(); if (db == null) { storage = new TestStorage(@"TestCasePlaySongSelect"); - db = new BeatmapDatabase(storage, storage.GetDatabase(@"client")); + + var backingDatabase = storage.GetDatabase(@"client"); + + rulesets = new RulesetDatabase(storage, backingDatabase); + db = new BeatmapDatabase(storage, backingDatabase, rulesets); var sets = new List(); diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs index 924e753e2d..a21c09a9d0 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs @@ -22,12 +22,14 @@ namespace osu.Desktop.VisualTests.Tests { 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) + private void load(BeatmapDatabase db, RulesetDatabase rulesets) { + this.rulesets = rulesets; this.db = db; } @@ -65,6 +67,7 @@ namespace osu.Desktop.VisualTests.Tests BeatmapInfo = new BeatmapInfo { Difficulty = new BeatmapDifficulty(), + Ruleset = rulesets.Query().First(), Metadata = new BeatmapMetadata { Artist = @"Unknown", diff --git a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs index 91b673dc4c..5e94a4dd77 100644 --- a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs @@ -7,7 +7,6 @@ using OpenTK; using OpenTK.Graphics; using osu.Game.Beatmaps.Formats; using osu.Game.Tests.Resources; -using osu.Game.Modes.Osu; using osu.Game.Modes.Objects.Legacy; using System.Linq; using osu.Game.Audio; @@ -56,7 +55,7 @@ namespace osu.Game.Tests.Beatmaps.Formats Assert.AreEqual(false, beatmapInfo.Countdown); Assert.AreEqual(0.7f, beatmapInfo.StackLeniency); Assert.AreEqual(false, beatmapInfo.SpecialStyle); - Assert.IsTrue(beatmapInfo.Ruleset.CreateInstance() is OsuRuleset); + Assert.IsTrue(beatmapInfo.RulesetID == 0); Assert.AreEqual(false, beatmapInfo.LetterboxInBreaks); Assert.AreEqual(false, beatmapInfo.WidescreenStoryboard); } diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs index 0d27a6a650..0e03a443cc 100644 --- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs @@ -12,7 +12,6 @@ using osu.Framework.Desktop.Platform; using osu.Framework.Platform; using osu.Game.Database; using osu.Game.IPC; -using osu.Game.Modes.Osu; namespace osu.Game.Tests.Beatmaps.IO { @@ -106,6 +105,7 @@ namespace osu.Game.Tests.Beatmaps.IO Thread.Sleep(1); //reset beatmap database (sqlite and storage backing) + osu.Dependencies.Get().Reset(); osu.Dependencies.Get().Reset(); return osu; @@ -122,7 +122,7 @@ namespace osu.Game.Tests.Beatmaps.IO Thread.Sleep(50); }; - Assert.IsTrue(waitAction.BeginInvoke(null, null).AsyncWaitHandle.WaitOne(timeout), + Assert.IsTrue(waitAction.BeginInvoke(null, null).AsyncWaitHandle.WaitOne(999999999), @"BeatmapSet did not import to the database in allocated time."); //ensure we were stored to beatmap database backing... @@ -153,7 +153,7 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.IsTrue(set.Beatmaps.Count > 0); - var beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.Ruleset.CreateInstance() is OsuRuleset))?.Beatmap; + var beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 0))?.Beatmap; Assert.IsTrue(beatmap?.HitObjects.Count > 0); } diff --git a/osu.Game/Beatmaps/Beatmap.cs b/osu.Game/Beatmaps/Beatmap.cs index 3b57d4e7fe..e3a7a81d0d 100644 --- a/osu.Game/Beatmaps/Beatmap.cs +++ b/osu.Game/Beatmaps/Beatmap.cs @@ -49,12 +49,6 @@ namespace osu.Game.Beatmaps /// public class Beatmap : Beatmap { - /// - /// Calculates the star difficulty for this Beatmap. - /// - /// The star difficulty. - public double CalculateStarDifficulty() => BeatmapInfo.Ruleset.CreateInstance().CreateDifficultyCalculator(this).Calculate(); - /// /// Constructs a new beatmap. /// diff --git a/osu.Game/Database/BeatmapDatabase.cs b/osu.Game/Database/BeatmapDatabase.cs index f3f58ce8b0..7789096067 100644 --- a/osu.Game/Database/BeatmapDatabase.cs +++ b/osu.Game/Database/BeatmapDatabase.cs @@ -19,6 +19,7 @@ namespace osu.Game.Database { public class BeatmapDatabase : Database { + private readonly RulesetDatabase rulesets; public event Action BeatmapSetAdded; public event Action BeatmapSetRemoved; @@ -26,8 +27,9 @@ namespace osu.Game.Database // ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised) private BeatmapIPCChannel ipc; - public BeatmapDatabase(Storage storage, SQLiteConnection connection, IIpcHost importHost = null) : base(storage, connection) + public BeatmapDatabase(Storage storage, SQLiteConnection connection, RulesetDatabase rulesets, IIpcHost importHost = null) : base(storage, connection) { + this.rulesets = rulesets; if (importHost != null) ipc = new BeatmapIPCChannel(importHost, this); } @@ -64,30 +66,30 @@ namespace osu.Game.Database Connection.Query("UPDATE BeatmapSetInfo SET DeletePending = 0 WHERE DeletePending IS NULL"); } - protected override void Prepare() + protected override void Prepare(bool reset = false) { Connection.CreateTable(); Connection.CreateTable(); Connection.CreateTable(); Connection.CreateTable(); - deletePending(); - } - - public override void Reset() - { - Storage.DeleteDatabase(@"beatmaps"); - - foreach (var setInfo in Query()) + if (reset) { - if (Storage.Exists(setInfo.Path)) - Storage.Delete(setInfo.Path); + Storage.DeleteDatabase(@"beatmaps"); + + foreach (var setInfo in Query()) + { + if (Storage.Exists(setInfo.Path)) + Storage.Delete(setInfo.Path); + } + + Connection.DeleteAll(); + Connection.DeleteAll(); + Connection.DeleteAll(); + Connection.DeleteAll(); } - Connection.DeleteAll(); - Connection.DeleteAll(); - Connection.DeleteAll(); - Connection.DeleteAll(); + deletePending(); } protected override Type[] ValidTypes => new[] { @@ -216,7 +218,10 @@ namespace osu.Game.Database // TODO: Diff beatmap metadata with set metadata and leave it here if necessary beatmap.BeatmapInfo.Metadata = null; - beatmap.BeatmapInfo.StarDifficulty = beatmap.CalculateStarDifficulty(); + // TODO: this should be done in a better place once we actually need to dynamically update it. + beatmap.BeatmapInfo.StarDifficulty = rulesets.Query().FirstOrDefault(r => r.ID == beatmap.BeatmapInfo.RulesetID)?.CreateInstance()?.CreateDifficultyCalculator(beatmap).Calculate() ?? 0; + + beatmap.BeatmapInfo.Ruleset = null; beatmapSet.Beatmaps.Add(beatmap.BeatmapInfo); } diff --git a/osu.Game/Database/Database.cs b/osu.Game/Database/Database.cs index 19bd78b39c..23851b3b2e 100644 --- a/osu.Game/Database/Database.cs +++ b/osu.Game/Database/Database.cs @@ -29,20 +29,19 @@ namespace osu.Game.Database catch (Exception e) { Logger.Error(e, $@"Failed to initialise the {GetType()}! Trying again with a clean database..."); - Reset(); - Prepare(); + Prepare(true); } } /// /// Prepare this database for use. /// - protected abstract void Prepare(); + protected abstract void Prepare(bool reset = false); /// /// Reset this database to a default state. Undo all changes to database and storage backings. /// - public abstract void Reset(); + public void Reset() => Prepare(true); public TableQuery Query() where T : class { diff --git a/osu.Game/Database/RulesetDatabase.cs b/osu.Game/Database/RulesetDatabase.cs index 45db5df26f..d19fe56345 100644 --- a/osu.Game/Database/RulesetDatabase.cs +++ b/osu.Game/Database/RulesetDatabase.cs @@ -24,10 +24,15 @@ namespace osu.Game.Database { } - protected override void Prepare() + protected override void Prepare(bool reset = false) { Connection.CreateTable(); + if (reset) + { + Connection.DeleteAll(); + } + List instances = new List(); foreach (string file in Directory.GetFiles(Environment.CurrentDirectory, @"osu.Game.Modes.*.dll")) @@ -40,8 +45,6 @@ namespace osu.Game.Database if (rulesets.Count() != 1) continue; - Assembly.LoadFile(file); - foreach (Type rulesetType in rulesets) instances.Add((Ruleset)Activator.CreateInstance(rulesetType)); } @@ -84,8 +87,6 @@ namespace osu.Game.Database } Connection.Commit(); - - } private RulesetInfo createRulesetInfo(Ruleset ruleset) => new RulesetInfo @@ -95,11 +96,6 @@ namespace osu.Game.Database ID = ruleset.LegacyID }; - public override void Reset() - { - Connection.DeleteAll(); - } - protected override Type[] ValidTypes => new[] { typeof(RulesetInfo) }; public RulesetInfo GetRuleset(int id) => Query().First(r => r.ID == id); diff --git a/osu.Game/Database/RulesetInfo.cs b/osu.Game/Database/RulesetInfo.cs index 6a0ee13e41..d7bab39b97 100644 --- a/osu.Game/Database/RulesetInfo.cs +++ b/osu.Game/Database/RulesetInfo.cs @@ -10,7 +10,7 @@ namespace osu.Game.Database public class RulesetInfo { [PrimaryKey, AutoIncrement] - public int ID { get; set; } + public int? ID { get; set; } public string Name { get; set; } diff --git a/osu.Game/Database/ScoreDatabase.cs b/osu.Game/Database/ScoreDatabase.cs index 91a52fba4a..a2fff7f795 100644 --- a/osu.Game/Database/ScoreDatabase.cs +++ b/osu.Game/Database/ScoreDatabase.cs @@ -111,11 +111,7 @@ namespace osu.Game.Database return score; } - protected override void Prepare() - { - } - - public override void Reset() + protected override void Prepare(bool reset = false) { } diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 6062f3fd59..1006008afc 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -91,7 +91,7 @@ namespace osu.Game configRuleset = LocalConfig.GetBindable(OsuConfig.Ruleset); Ruleset.Value = RulesetDatabase.GetRuleset(configRuleset.Value); - Ruleset.ValueChanged += r => configRuleset.Value = r.ID; + Ruleset.ValueChanged += r => configRuleset.Value = r.ID ?? 0; } private ScheduledDelegate scoreLoad; diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index c6a5cbef1b..371699eab3 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -86,8 +86,8 @@ namespace osu.Game SQLiteConnection connection = Host.Storage.GetDatabase(@"client"); - Dependencies.Cache(BeatmapDatabase = new BeatmapDatabase(Host.Storage, connection, Host)); Dependencies.Cache(RulesetDatabase = new RulesetDatabase(Host.Storage, connection)); + Dependencies.Cache(BeatmapDatabase = new BeatmapDatabase(Host.Storage, connection, RulesetDatabase, Host)); Dependencies.Cache(ScoreDatabase = new ScoreDatabase(Host.Storage, connection, Host, BeatmapDatabase)); Dependencies.Cache(new OsuColour()); diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 30ccb2d005..bf7117edf1 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -49,13 +49,16 @@ namespace osu.Game.Overlays.Mods } [BackgroundDependencyLoader(permitNulls: true)] - private void load(OsuColour colours, OsuGame osu) + private void load(OsuColour colours, OsuGame osu, RulesetDatabase rulesets) { lowMultiplierColour = colours.Red; highMultiplierColour = colours.Green; if (osu != null) Ruleset.BindTo(osu.Ruleset); + else + Ruleset.Value = rulesets.AllRulesets.First(); + Ruleset.ValueChanged += rulesetChanged; Ruleset.TriggerChange(); } From fe0d18777e3c5e4db82908e87efc01ed14eaf31f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 17 Apr 2017 19:52:07 +0900 Subject: [PATCH 202/442] Fix appveyor issues. --- osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs | 1 - osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs | 1 - 2 files changed, 2 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs index a2d7b3ad99..d1c137191f 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs @@ -1,7 +1,6 @@ // 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 osu.Framework.Graphics; using osu.Game.Overlays.Mods; diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs index db21556cda..35eb6d0ff9 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using osu.Desktop.VisualTests.Platform; -using osu.Framework.Allocation; using osu.Framework.Testing; using osu.Framework.MathUtils; using osu.Game.Database; From eaa171baf47fbc82ef77c44135aa9042091bd581 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 17 Apr 2017 20:02:36 +0900 Subject: [PATCH 203/442] Rewrite bar lines to make sure they're centered at their beat's start position. --- osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs | 64 +++++++-------------- 1 file changed, 22 insertions(+), 42 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs b/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs index 32476dff7f..a7968a10dd 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs @@ -2,10 +2,8 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; -using osu.Framework.MathUtils; using osu.Framework.Graphics; using osu.Game.Beatmaps; -using osu.Game.Beatmaps.Timing; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Objects.Types; using osu.Game.Modes.Replays; @@ -49,55 +47,37 @@ namespace osu.Game.Modes.Taiko.UI if (timingPoints.Count == 0) return; - int currentIndex = 0; - - while (currentIndex < timingPoints.Count && Precision.AlmostEquals(timingPoints[currentIndex].BeatLength, 0)) - currentIndex++; - - double time = timingPoints[currentIndex].Time; - double measureLength = timingPoints[currentIndex].BeatLength * (int)timingPoints[currentIndex].TimeSignature; - - // Find the bar line time closest to 0 - time -= measureLength * (int)(time / measureLength); - - // Always start barlines from a positive time - while (time < 0) - time += measureLength; - + int currentTimingPoint = 0; int currentBeat = 0; + double time = timingPoints[currentTimingPoint].Time; while (time <= lastHitTime) - { - ControlPoint current = timingPoints[currentIndex]; - - if (time > current.Time || current.OmitFirstBarLine) + { + int nextTimingPoint = currentTimingPoint + 1; + if (nextTimingPoint < timingPoints.Count && time > timingPoints[nextTimingPoint].Time) { - bool isMajor = currentBeat % (int)current.TimeSignature == 0; - - var barLine = new BarLine - { - StartTime = time, - }; - - barLine.ApplyDefaults(Beatmap.TimingInfo, Beatmap.BeatmapInfo.Difficulty); - - taikoPlayfield.AddBarLine(isMajor ? new DrawableBarLineMajor(barLine) : new DrawableBarLine(barLine)); - - currentBeat++; + currentTimingPoint = nextTimingPoint; + time = timingPoints[currentTimingPoint].Time; + currentBeat = 0; } - double bl = current.BeatLength; + var currentPoint = timingPoints[currentTimingPoint]; + var barLine = new BarLine + { + StartTime = time, + }; + + barLine.ApplyDefaults(Beatmap.TimingInfo, Beatmap.BeatmapInfo.Difficulty); + + bool isMajor = currentBeat % (int)currentPoint.TimeSignature == 0; + taikoPlayfield.AddBarLine(isMajor ? new DrawableBarLineMajor(barLine) : new DrawableBarLine(barLine)); + + double bl = currentPoint.BeatLength; if (bl < 800) - bl *= (int)current.TimeSignature; + bl *= (int)currentPoint.TimeSignature; time += bl; - - if (currentIndex + 1 >= timingPoints.Count || time < timingPoints[currentIndex + 1].Time) - continue; - - currentBeat = 0; - currentIndex++; - time = timingPoints[currentIndex].Time; + currentBeat++; } } From 4b6ba565f861b5ccef15916c70d0c372fd00ef3d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 17 Apr 2017 20:10:51 +0900 Subject: [PATCH 204/442] Fix forgotten revert. --- osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs index 0e03a443cc..0c64c47a63 100644 --- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs @@ -122,7 +122,7 @@ namespace osu.Game.Tests.Beatmaps.IO Thread.Sleep(50); }; - Assert.IsTrue(waitAction.BeginInvoke(null, null).AsyncWaitHandle.WaitOne(999999999), + Assert.IsTrue(waitAction.BeginInvoke(null, null).AsyncWaitHandle.WaitOne(timeout), @"BeatmapSet did not import to the database in allocated time."); //ensure we were stored to beatmap database backing... From 773e6a29119e02df9d4cf3434df113f30fcb0385 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Mon, 17 Apr 2017 17:04:48 +0200 Subject: [PATCH 205/442] moved tooltip stuff to Tooltip instead of MenuCursor --- osu.Game/Graphics/Cursor/MenuCursor.cs | 63 ++++---------------------- osu.Game/Graphics/Cursor/Tooltip.cs | 34 +++++++++++++- 2 files changed, 42 insertions(+), 55 deletions(-) diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index 255fa2ca99..6f208219ae 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -12,8 +12,6 @@ using osu.Framework.Input; using osu.Game.Configuration; using System; using osu.Framework.Graphics.Textures; -using osu.Framework.Threading; -using System.Linq; namespace osu.Game.Graphics.Cursor { @@ -21,44 +19,16 @@ namespace osu.Game.Graphics.Cursor { protected override Drawable CreateCursor() => new Cursor(); - [BackgroundDependencyLoader] - private void load(OsuGameBase game) - { - this.game = game; - } - private bool dragging; + private Tooltip tooltip; - private ScheduledDelegate show; - private OsuGameBase game; - private IHasOverhangingTooltip overhang; + public MenuCursor() + { + Add(tooltip = new Tooltip()); + } protected override bool OnMouseMove(InputState state) { - Tooltip tooltip = ((Cursor)ActiveCursor).Tooltip; - if (overhang?.Overhanging ?? false) - tooltip.TooltipText = overhang.Tooltip; - else if (state.Mouse.Position != state.Mouse.LastPosition) - { - show?.Cancel(); - tooltip.TooltipText = string.Empty; - IHasTooltip hasTooltip = null; - if (game.InternalChildren.OfType().Any(child => (hasTooltip = searchTooltip(child as IContainerEnumerable)) != null)) - { - IHasDelayedTooltip delayedTooltip = hasTooltip as IHasDelayedTooltip; - overhang = hasTooltip as IHasOverhangingTooltip; - show = Scheduler.AddDelayed(delegate - { - tooltip.TooltipText = hasTooltip.Tooltip; - }, delayedTooltip?.Delay ?? 250); - } - } - else if(overhang != null) - { - overhang = null; - tooltip.TooltipText = string.Empty; - } - if (dragging) { Vector2 offset = state.Mouse.Position - state.Mouse.PositionMouseDown ?? state.Mouse.Delta; @@ -73,21 +43,12 @@ namespace osu.Game.Graphics.Cursor ActiveCursor.RotateTo(degrees, 600, EasingTypes.OutQuint); } + tooltip.Position = new Vector2(state.Mouse.Position.X,ActiveCursor.BoundingBox.Bottom); + tooltip.UpdateTooltip(state); + return base.OnMouseMove(state); } - private IHasTooltip searchTooltip(IContainerEnumerable children) - { - Drawable next = children.InternalChildren.OrderBy(drawable => drawable.Depth).FirstOrDefault(drawable => drawable.Hovering && !(drawable is CursorContainer)); - - IHasTooltip tooltipText = next as IHasTooltip; - if (tooltipText != null) return tooltipText; - - if (next is IContainer) - return searchTooltip(next as IContainerEnumerable); - return null; - } - protected override bool OnDragStart(InputState state) { dragging = true; @@ -140,14 +101,13 @@ namespace osu.Game.Graphics.Cursor public class Cursor : Container { private Container cursorContainer; - public Tooltip Tooltip; private Bindable cursorScale; public Sprite AdditiveLayer; public Cursor() { - Size = new Vector2(42); + AutoSizeAxes = Axes.Both; } [BackgroundDependencyLoader] @@ -175,15 +135,10 @@ namespace osu.Game.Graphics.Cursor }, } }, - Tooltip = new Tooltip - { - Alpha = 0, - }, }; cursorScale = config.GetBindable(OsuConfig.MenuCursorSize); cursorScale.ValueChanged += newScale => cursorContainer.Scale = new Vector2((float)newScale); - cursorScale.ValueChanged += newScale => Tooltip.Y = cursorContainer.Height * (float)newScale; cursorScale.TriggerChange(); } } diff --git a/osu.Game/Graphics/Cursor/Tooltip.cs b/osu.Game/Graphics/Cursor/Tooltip.cs index 5cde7464f0..5960e83763 100644 --- a/osu.Game/Graphics/Cursor/Tooltip.cs +++ b/osu.Game/Graphics/Cursor/Tooltip.cs @@ -8,7 +8,10 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; +using osu.Framework.Input; +using osu.Framework.Threading; using osu.Game.Graphics.Sprites; +using System.Linq; namespace osu.Game.Graphics.Cursor { @@ -17,6 +20,10 @@ namespace osu.Game.Graphics.Cursor private readonly Box tooltipBackground; private readonly OsuSpriteText text; + private ScheduledDelegate show; + private UserInputManager input; + private IHasOverhangingTooltip overhang; + public string TooltipText { get { @@ -65,9 +72,34 @@ namespace osu.Game.Graphics.Cursor } [BackgroundDependencyLoader] - private void load(OsuColour colour) + private void load(OsuColour colour, UserInputManager input) { + this.input = input; tooltipBackground.Colour = colour.Gray3; } + + public void UpdateTooltip(InputState state) + { + Scheduler.Update(); + if (overhang?.Overhanging ?? false) + TooltipText = overhang.Tooltip; + else if (state.Mouse.Position != state.Mouse.LastPosition) + { + show?.Cancel(); + TooltipText = string.Empty; + IHasTooltip hasTooltip = input.HoveredDrawables.OfType().FirstOrDefault(); + if (hasTooltip != null) + { + IHasDelayedTooltip delayedTooltip = hasTooltip as IHasDelayedTooltip; + overhang = hasTooltip as IHasOverhangingTooltip; + show = Scheduler.AddDelayed(() => TooltipText = hasTooltip.Tooltip, delayedTooltip?.Delay ?? 250); + } + } + else if (overhang != null) + { + overhang = null; + TooltipText = string.Empty; + } + } } } From 5d828a20e0e4fb7a415ebdc631de81a264b7083c Mon Sep 17 00:00:00 2001 From: Jorolf Date: Mon, 17 Apr 2017 17:09:17 +0200 Subject: [PATCH 206/442] some formatting --- osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs b/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs index 604b31de8d..870a9f3397 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs @@ -47,7 +47,6 @@ namespace osu.Desktop.VisualTests.Tests }, }; - slider.Current.BindTo(new BindableInt(5) { MaxValue = 10, @@ -72,7 +71,6 @@ namespace osu.Desktop.VisualTests.Tests } }; } - } private class TooltipTextbox : OsuTextBox, IHasTooltip From d4ac3c5e9c2e59d066bb785c6cefbb0eefa73516 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Mon, 17 Apr 2017 17:10:55 +0200 Subject: [PATCH 207/442] Update MenuCursor.cs --- osu.Game/Graphics/Cursor/MenuCursor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index 6f208219ae..5fb45e3fe0 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -134,7 +134,7 @@ namespace osu.Game.Graphics.Cursor Texture = textures.Get(@"Cursor/menu-cursor-additive"), }, } - }, + } }; cursorScale = config.GetBindable(OsuConfig.MenuCursorSize); From 25fd1d2b72a5d77224b6a7f63bd4fac28200dd81 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Mon, 17 Apr 2017 17:43:44 +0200 Subject: [PATCH 208/442] made method into property --- osu.Game/Graphics/Cursor/MenuCursor.cs | 2 +- osu.Game/Graphics/Cursor/Tooltip.cs | 35 +++++++++++++++----------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index 6f208219ae..6e63ac97d3 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -44,7 +44,7 @@ namespace osu.Game.Graphics.Cursor } tooltip.Position = new Vector2(state.Mouse.Position.X,ActiveCursor.BoundingBox.Bottom); - tooltip.UpdateTooltip(state); + tooltip.MouseState = state.Mouse; return base.OnMouseMove(state); } diff --git a/osu.Game/Graphics/Cursor/Tooltip.cs b/osu.Game/Graphics/Cursor/Tooltip.cs index 5960e83763..9e6a0695d6 100644 --- a/osu.Game/Graphics/Cursor/Tooltip.cs +++ b/osu.Game/Graphics/Cursor/Tooltip.cs @@ -39,8 +39,28 @@ namespace osu.Game.Graphics.Cursor } } + public IMouseState MouseState + { + set + { + if (value.Position != value.LastPosition && overhang?.Overhanging != true) + { + show?.Cancel(); + TooltipText = string.Empty; + IHasTooltip hasTooltip = input.HoveredDrawables.OfType().FirstOrDefault(); + if (hasTooltip != null) + { + IHasDelayedTooltip delayedTooltip = hasTooltip as IHasDelayedTooltip; + overhang = hasTooltip as IHasOverhangingTooltip; + show = Scheduler.AddDelayed(() => TooltipText = hasTooltip.Tooltip, delayedTooltip?.Delay ?? 250); + } + } + } + } + public Tooltip() { + AlwaysPresent = true; Children = new[] { new Container @@ -48,7 +68,6 @@ namespace osu.Game.Graphics.Cursor AutoSizeAxes = Axes.Both, CornerRadius = 5, Masking = true, - AlwaysPresent = true, EdgeEffect = new EdgeEffect { Type = EdgeEffectType.Shadow, @@ -78,23 +97,11 @@ namespace osu.Game.Graphics.Cursor tooltipBackground.Colour = colour.Gray3; } - public void UpdateTooltip(InputState state) + protected override void Update() { Scheduler.Update(); if (overhang?.Overhanging ?? false) TooltipText = overhang.Tooltip; - else if (state.Mouse.Position != state.Mouse.LastPosition) - { - show?.Cancel(); - TooltipText = string.Empty; - IHasTooltip hasTooltip = input.HoveredDrawables.OfType().FirstOrDefault(); - if (hasTooltip != null) - { - IHasDelayedTooltip delayedTooltip = hasTooltip as IHasDelayedTooltip; - overhang = hasTooltip as IHasOverhangingTooltip; - show = Scheduler.AddDelayed(() => TooltipText = hasTooltip.Tooltip, delayedTooltip?.Delay ?? 250); - } - } else if (overhang != null) { overhang = null; From 095b6fded6d53132150a8730e5d58d4cb573f71f Mon Sep 17 00:00:00 2001 From: Jorolf Date: Mon, 17 Apr 2017 19:50:34 +0200 Subject: [PATCH 209/442] removed unused stuff and change the tooltip y coordinate --- osu.Game/Graphics/Cursor/MenuCursor.cs | 2 +- osu.Game/Graphics/Cursor/Tooltip.cs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index 26d6b22c30..21d64b795a 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -43,7 +43,7 @@ namespace osu.Game.Graphics.Cursor ActiveCursor.RotateTo(degrees, 600, EasingTypes.OutQuint); } - tooltip.Position = new Vector2(state.Mouse.Position.X,ActiveCursor.BoundingBox.Bottom); + tooltip.Position = new Vector2(state.Mouse.Position.X,Math.Min(ActiveCursor.BoundingBox.Bottom, state.Mouse.Position.Y + ActiveCursor.DrawHeight)); tooltip.MouseState = state.Mouse; return base.OnMouseMove(state); diff --git a/osu.Game/Graphics/Cursor/Tooltip.cs b/osu.Game/Graphics/Cursor/Tooltip.cs index 9e6a0695d6..86751ddd65 100644 --- a/osu.Game/Graphics/Cursor/Tooltip.cs +++ b/osu.Game/Graphics/Cursor/Tooltip.cs @@ -99,7 +99,6 @@ namespace osu.Game.Graphics.Cursor protected override void Update() { - Scheduler.Update(); if (overhang?.Overhanging ?? false) TooltipText = overhang.Tooltip; else if (overhang != null) From 2767fbd81a41014311ff8c38d8e1e0d940da4d86 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 17 Apr 2017 15:44:46 +0900 Subject: [PATCH 210/442] Implement Beatmap conversion testing. --- .../Beatmaps/CatchBeatmapConverter.cs | 4 ++++ .../Beatmaps/ManiaBeatmapConverter.cs | 4 ++++ .../Beatmaps/OsuBeatmapConverter.cs | 8 +++++-- .../Beatmaps/TaikoBeatmapConverter.cs | 2 ++ osu.Game/Beatmaps/IBeatmapConverter.cs | 21 +++++++++++++++++ .../Modes/Objects/Legacy/LegacySpinner.cs | 7 ++++-- .../Modes/Objects/LegacyHitObjectParser.cs | 1 + osu.Game/Modes/UI/HitRenderer.cs | 13 ++++++++++- osu.Game/Screens/Play/Player.cs | 23 ++++++++++++------- 9 files changed, 70 insertions(+), 13 deletions(-) diff --git a/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs b/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs index 9791554f02..c2e77d60ed 100644 --- a/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs +++ b/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs @@ -4,11 +4,15 @@ using osu.Game.Beatmaps; using osu.Game.Modes.Catch.Objects; using System.Collections.Generic; +using System; +using osu.Game.Modes.Objects; namespace osu.Game.Modes.Catch.Beatmaps { internal class CatchBeatmapConverter : IBeatmapConverter { + public IEnumerable ValidConversionTypes { get; } = new[] { typeof(HitObject) }; + public Beatmap Convert(Beatmap original) { return new Beatmap(original) diff --git a/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs index 3ff210c1cc..21a324fc1c 100644 --- a/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -4,11 +4,15 @@ using osu.Game.Beatmaps; using osu.Game.Modes.Mania.Objects; using System.Collections.Generic; +using System; +using osu.Game.Modes.Objects; namespace osu.Game.Modes.Mania.Beatmaps { internal class ManiaBeatmapConverter : IBeatmapConverter { + public IEnumerable ValidConversionTypes { get; } = new[] { typeof(HitObject) }; + public Beatmap Convert(Beatmap original) { return new Beatmap(original) diff --git a/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs b/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs index bae12a98e3..20ebebd521 100644 --- a/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs +++ b/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs @@ -9,11 +9,14 @@ using osu.Game.Modes.Osu.Objects.Drawables; using System.Collections.Generic; using osu.Game.Modes.Objects.Types; using System.Linq; +using System; namespace osu.Game.Modes.Osu.Beatmaps { internal class OsuBeatmapConverter : IBeatmapConverter { + public IEnumerable ValidConversionTypes { get; } = new[] { typeof(IHasPosition) }; + public Beatmap Convert(Beatmap original) { return new Beatmap(original) @@ -56,8 +59,9 @@ namespace osu.Game.Modes.Osu.Beatmaps { StartTime = original.StartTime, Samples = original.Samples, - Position = new Vector2(512, 384) / 2, - EndTime = endTimeData.EndTime + EndTime = endTimeData.EndTime, + + Position = positionData?.Position ?? new Vector2(512, 384) / 2, }; } diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index aee06ad796..a56ca43805 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -38,6 +38,8 @@ namespace osu.Game.Modes.Taiko.Beatmaps /// private const float taiko_base_distance = 100; + public IEnumerable ValidConversionTypes { get; } = new[] { typeof(HitObject) }; + public Beatmap Convert(Beatmap original) { BeatmapInfo info = original.BeatmapInfo.DeepClone(); diff --git a/osu.Game/Beatmaps/IBeatmapConverter.cs b/osu.Game/Beatmaps/IBeatmapConverter.cs index 72b248cfba..fbd6a60327 100644 --- a/osu.Game/Beatmaps/IBeatmapConverter.cs +++ b/osu.Game/Beatmaps/IBeatmapConverter.cs @@ -1,6 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; +using System.Collections.Generic; +using System.Linq; using osu.Game.Modes.Objects; namespace osu.Game.Beatmaps @@ -11,6 +14,12 @@ namespace osu.Game.Beatmaps /// The type of HitObject stored in the Beatmap. public interface IBeatmapConverter where T : HitObject { + /// + /// The type of HitObjects that can be converted to be used for this Beatmap. + /// + /// + IEnumerable ValidConversionTypes { get; } + /// /// Converts a Beatmap to another mode. /// @@ -18,4 +27,16 @@ namespace osu.Game.Beatmaps /// The converted Beatmap. Beatmap Convert(Beatmap original); } + + public static class BeatmapConverterExtensions + { + /// + /// Checks if a Beatmap can be converted using a Beatmap Converter. + /// + /// The Converter to use. + /// The Beatmap to check. + /// Whether the Beatmap can be converted using . + public static bool CanConvert(this IBeatmapConverter converter, Beatmap beatmap) where TObject : HitObject + => converter.ValidConversionTypes.All(t => beatmap.HitObjects.Any(h => t.IsAssignableFrom(h.GetType()))); + } } diff --git a/osu.Game/Modes/Objects/Legacy/LegacySpinner.cs b/osu.Game/Modes/Objects/Legacy/LegacySpinner.cs index 8f65d5e8a1..196706f157 100644 --- a/osu.Game/Modes/Objects/Legacy/LegacySpinner.cs +++ b/osu.Game/Modes/Objects/Legacy/LegacySpinner.cs @@ -1,4 +1,5 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . +using OpenTK; +// Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Modes.Objects.Types; @@ -8,10 +9,12 @@ namespace osu.Game.Modes.Objects.Legacy /// /// Legacy Spinner-type, used for parsing Beatmaps. /// - internal class LegacySpinner : HitObject, IHasEndTime + internal class LegacySpinner : HitObject, IHasEndTime, IHasPosition { public double EndTime { get; set; } public double Duration => EndTime - StartTime; + + public Vector2 Position { get; set; } } } diff --git a/osu.Game/Modes/Objects/LegacyHitObjectParser.cs b/osu.Game/Modes/Objects/LegacyHitObjectParser.cs index 2316e5dc5d..580c09c646 100644 --- a/osu.Game/Modes/Objects/LegacyHitObjectParser.cs +++ b/osu.Game/Modes/Objects/LegacyHitObjectParser.cs @@ -100,6 +100,7 @@ namespace osu.Game.Modes.Objects { result = new LegacySpinner { + Position = new Vector2(512, 384) / 2, EndTime = Convert.ToDouble(split[5], CultureInfo.InvariantCulture) }; diff --git a/osu.Game/Modes/UI/HitRenderer.cs b/osu.Game/Modes/UI/HitRenderer.cs index 6962c80d87..98a6c35135 100644 --- a/osu.Game/Modes/UI/HitRenderer.cs +++ b/osu.Game/Modes/UI/HitRenderer.cs @@ -122,6 +122,10 @@ namespace osu.Game.Modes.UI IBeatmapConverter converter = CreateBeatmapConverter(); IBeatmapProcessor processor = CreateBeatmapProcessor(); + // Check if the beatmap can be converted + if (!converter.CanConvert(beatmap.Beatmap)) + throw new BeatmapInvalidForModeException($"{nameof(Beatmap)} can't be converted to the current mode."); + // Convert the beatmap Beatmap = converter.Convert(beatmap.Beatmap); @@ -136,7 +140,6 @@ namespace osu.Game.Modes.UI applyMods(beatmap.Mods.Value); } - /// /// Applies the active mods to this HitRenderer. /// @@ -268,4 +271,12 @@ namespace osu.Game.Modes.UI /// The Playfield. protected abstract Playfield CreatePlayfield(); } + + public class BeatmapInvalidForModeException : Exception + { + public BeatmapInvalidForModeException(string text) + : base(text) + { + } + } } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index b32548c31a..7c95a09e31 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -60,8 +60,8 @@ namespace osu.Game.Screens.Play private PauseOverlay pauseOverlay; private FailOverlay failOverlay; - [BackgroundDependencyLoader] - private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config) + [BackgroundDependencyLoader(permitNulls: true)] + private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config, OsuGame osu) { dimLevel = config.GetBindable(OsuConfig.DimLevel); mouseWheelDisabled = config.GetBindable(OsuConfig.MouseDisableWheel); @@ -76,6 +76,19 @@ namespace osu.Game.Screens.Play if (Beatmap == null) throw new Exception("Beatmap was not loaded"); + + try + { + // Try using the preferred user ruleset + ruleset = osu == null ? Beatmap.BeatmapInfo.Ruleset : osu.Ruleset; + HitRenderer = ruleset.CreateHitRendererWith(Beatmap); + } + catch (BeatmapInvalidForModeException) + { + // Default to the beatmap ruleset + ruleset = Beatmap.BeatmapInfo.Ruleset; + HitRenderer = ruleset.CreateHitRendererWith(Beatmap); + } } catch (Exception e) { @@ -102,12 +115,6 @@ namespace osu.Game.Screens.Play sourceClock.Reset(); }); - ruleset = Beatmap.BeatmapInfo.Ruleset.CreateInstance(); - - // Todo: This should be done as early as possible, and should check if the hit renderer - // can actually convert the hit objects... Somehow... - HitRenderer = ruleset.CreateHitRendererWith(Beatmap); - scoreProcessor = HitRenderer.CreateScoreProcessor(); hudOverlay = new StandardHudOverlay() From 09208adf81543c9635bc95a82ee5a0da9b2ccc35 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 17 Apr 2017 17:23:11 +0900 Subject: [PATCH 211/442] Re-implement legacy hit object conversion. --- .../Beatmaps/OsuBeatmapConverter.cs | 4 ++ osu.Game.Modes.Osu/Objects/OsuHitObject.cs | 3 + .../Beatmaps/Formats/OsuLegacyDecoderTest.cs | 28 ++++++---- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 22 +++++++- osu.Game/Modes/Objects/Legacy/Catch/Hit.cs | 17 ++++++ .../Objects/Legacy/Catch/HitObjectParser.cs | 42 ++++++++++++++ osu.Game/Modes/Objects/Legacy/Catch/Slider.cs | 17 ++++++ .../Modes/Objects/Legacy/Catch/Spinner.cs | 17 ++++++ .../HitObjectParser.cs} | 55 +++++++------------ ...egacyHitObjectType.cs => HitObjectType.cs} | 2 +- .../Objects/Legacy/{LegacyHold.cs => Hold.cs} | 6 +- osu.Game/Modes/Objects/Legacy/Mania/Hit.cs | 17 ++++++ .../Objects/Legacy/Mania/HitObjectParser.cs | 40 ++++++++++++++ osu.Game/Modes/Objects/Legacy/Mania/Slider.cs | 17 ++++++ .../{LegacySpinner.cs => Mania/Spinner.cs} | 9 ++- .../Legacy/{LegacyHit.cs => Osu/Hit.cs} | 8 ++- .../Objects/Legacy/Osu/HitObjectParser.cs | 43 +++++++++++++++ .../Legacy/{LegacySlider.cs => Osu/Slider.cs} | 8 ++- osu.Game/Modes/Objects/Legacy/Osu/Spinner.cs | 24 ++++++++ osu.Game/Modes/Objects/Legacy/Taiko/Hit.cs | 15 +++++ .../Objects/Legacy/Taiko/HitObjectParser.cs | 40 ++++++++++++++ osu.Game/Modes/Objects/Legacy/Taiko/Slider.cs | 15 +++++ .../Modes/Objects/Legacy/Taiko/Spinner.cs | 17 ++++++ osu.Game/Modes/Objects/Types/IHasColumn.cs | 10 ++++ osu.Game/Modes/Objects/Types/IHasPosition.cs | 2 +- osu.Game/Modes/Objects/Types/IHasXPosition.cs | 14 +++++ osu.Game/Modes/Objects/Types/IHasYPosition.cs | 14 +++++ osu.Game/osu.Game.csproj | 28 ++++++++-- 28 files changed, 467 insertions(+), 67 deletions(-) create mode 100644 osu.Game/Modes/Objects/Legacy/Catch/Hit.cs create mode 100644 osu.Game/Modes/Objects/Legacy/Catch/HitObjectParser.cs create mode 100644 osu.Game/Modes/Objects/Legacy/Catch/Slider.cs create mode 100644 osu.Game/Modes/Objects/Legacy/Catch/Spinner.cs rename osu.Game/Modes/Objects/{LegacyHitObjectParser.cs => Legacy/HitObjectParser.cs} (73%) rename osu.Game/Modes/Objects/Legacy/{LegacyHitObjectType.cs => HitObjectType.cs} (87%) rename osu.Game/Modes/Objects/Legacy/{LegacyHold.cs => Hold.cs} (71%) create mode 100644 osu.Game/Modes/Objects/Legacy/Mania/Hit.cs create mode 100644 osu.Game/Modes/Objects/Legacy/Mania/HitObjectParser.cs create mode 100644 osu.Game/Modes/Objects/Legacy/Mania/Slider.cs rename osu.Game/Modes/Objects/Legacy/{LegacySpinner.cs => Mania/Spinner.cs} (57%) rename osu.Game/Modes/Objects/Legacy/{LegacyHit.cs => Osu/Hit.cs} (65%) create mode 100644 osu.Game/Modes/Objects/Legacy/Osu/HitObjectParser.cs rename osu.Game/Modes/Objects/Legacy/{LegacySlider.cs => Osu/Slider.cs} (64%) create mode 100644 osu.Game/Modes/Objects/Legacy/Osu/Spinner.cs create mode 100644 osu.Game/Modes/Objects/Legacy/Taiko/Hit.cs create mode 100644 osu.Game/Modes/Objects/Legacy/Taiko/HitObjectParser.cs create mode 100644 osu.Game/Modes/Objects/Legacy/Taiko/Slider.cs create mode 100644 osu.Game/Modes/Objects/Legacy/Taiko/Spinner.cs create mode 100644 osu.Game/Modes/Objects/Types/IHasColumn.cs create mode 100644 osu.Game/Modes/Objects/Types/IHasXPosition.cs create mode 100644 osu.Game/Modes/Objects/Types/IHasYPosition.cs diff --git a/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs b/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs index 20ebebd521..d5d02f9eda 100644 --- a/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs +++ b/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs @@ -36,6 +36,10 @@ namespace osu.Game.Modes.Osu.Beatmaps private OsuHitObject convertHitObject(HitObject original) { + OsuHitObject originalOsu = original as OsuHitObject; + if (originalOsu != null) + return originalOsu; + IHasCurve curveData = original as IHasCurve; IHasEndTime endTimeData = original as IHasEndTime; IHasPosition positionData = original as IHasPosition; diff --git a/osu.Game.Modes.Osu/Objects/OsuHitObject.cs b/osu.Game.Modes.Osu/Objects/OsuHitObject.cs index fa422834db..5e45d04390 100644 --- a/osu.Game.Modes.Osu/Objects/OsuHitObject.cs +++ b/osu.Game.Modes.Osu/Objects/OsuHitObject.cs @@ -8,6 +8,7 @@ using osu.Game.Modes.Objects.Types; using OpenTK.Graphics; using osu.Game.Beatmaps.Timing; using osu.Game.Database; +using System; namespace osu.Game.Modes.Osu.Objects { @@ -21,6 +22,8 @@ namespace osu.Game.Modes.Osu.Objects private const double hit_window_300 = 30; public Vector2 Position { get; set; } + public float X => Position.X; + public float Y => Position.Y; public Vector2 StackedPosition => Position + StackOffset; diff --git a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs index 5e94a4dd77..873f3f8559 100644 --- a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs @@ -10,6 +10,8 @@ using osu.Game.Tests.Resources; using osu.Game.Modes.Objects.Legacy; using System.Linq; using osu.Game.Audio; +using osu.Game.Modes.Objects; +using osu.Game.Modes.Objects.Types; namespace osu.Game.Tests.Beatmaps.Formats { @@ -130,16 +132,22 @@ namespace osu.Game.Tests.Beatmaps.Formats using (var stream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu")) { var beatmap = decoder.Decode(new StreamReader(stream)); - var slider = beatmap.HitObjects[0] as LegacySlider; - Assert.IsNotNull(slider); - Assert.AreEqual(new Vector2(192, 168), slider.Position); - Assert.AreEqual(956, slider.StartTime); - Assert.IsTrue(slider.Samples.Any(s => s.Name == SampleInfo.HIT_NORMAL)); - var hit = beatmap.HitObjects[1] as LegacyHit; - Assert.IsNotNull(hit); - Assert.AreEqual(new Vector2(304, 56), hit.Position); - Assert.AreEqual(1285, hit.StartTime); - Assert.IsTrue(hit.Samples.Any(s => s.Name == SampleInfo.HIT_CLAP)); + + var curveData = beatmap.HitObjects[0] as IHasCurve; + var positionData = beatmap.HitObjects[0] as IHasPosition; + + Assert.IsNotNull(positionData); + Assert.IsNotNull(curveData); + Assert.AreEqual(new Vector2(192, 168), positionData.Position); + Assert.AreEqual(956, beatmap.HitObjects[0].StartTime); + Assert.IsTrue(beatmap.HitObjects[0].Samples.Any(s => s.Name == SampleInfo.HIT_NORMAL)); + + positionData = beatmap.HitObjects[1] as IHasPosition; + + Assert.IsNotNull(positionData); + Assert.AreEqual(new Vector2(304, 56), positionData.Position); + Assert.AreEqual(1285, beatmap.HitObjects[1].StartTime); + Assert.IsTrue(beatmap.HitObjects[1].Samples.Any(s => s.Name == SampleInfo.HIT_CLAP)); } } } diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index 8ad5f8e7c0..11fa4825d2 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -7,8 +7,8 @@ using System.IO; using OpenTK.Graphics; using osu.Game.Beatmaps.Events; using osu.Game.Beatmaps.Timing; -using osu.Game.Modes.Objects; using osu.Game.Beatmaps.Legacy; +using osu.Game.Modes.Objects.Legacy; namespace osu.Game.Beatmaps.Formats { @@ -29,6 +29,8 @@ namespace osu.Game.Beatmaps.Formats // TODO: Not sure how far back to go, or differences between versions } + private HitObjectParser parser; + private LegacySampleBank defaultSampleBank; private int defaultSampleVolume = 100; @@ -84,6 +86,22 @@ namespace osu.Game.Beatmaps.Formats break; case @"Mode": beatmap.BeatmapInfo.RulesetID = int.Parse(val); + + switch (beatmap.BeatmapInfo.Mode) + { + case 0: + parser = new Modes.Objects.Legacy.Osu.HitObjectParser(); + break; + case 1: + parser = new Modes.Objects.Legacy.Taiko.HitObjectParser(); + break; + case 2: + parser = new Modes.Objects.Legacy.Catch.HitObjectParser(); + break; + case 3: + parser = new Modes.Objects.Legacy.Mania.HitObjectParser(); + break; + } break; case @"LetterboxInBreaks": beatmap.BeatmapInfo.LetterboxInBreaks = int.Parse(val) == 1; @@ -303,8 +321,6 @@ namespace osu.Game.Beatmaps.Formats { beatmap.BeatmapInfo.BeatmapVersion = beatmapVersion; - HitObjectParser parser = new LegacyHitObjectParser(); - Section section = Section.None; bool hasCustomColours = false; diff --git a/osu.Game/Modes/Objects/Legacy/Catch/Hit.cs b/osu.Game/Modes/Objects/Legacy/Catch/Hit.cs new file mode 100644 index 0000000000..1b44675c37 --- /dev/null +++ b/osu.Game/Modes/Objects/Legacy/Catch/Hit.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Modes.Objects.Types; + +namespace osu.Game.Modes.Objects.Legacy.Catch +{ + /// + /// Legacy Hit-type, used for parsing Beatmaps. + /// + internal sealed class Hit : HitObject, IHasCombo, IHasXPosition + { + public float X { get; set; } + + public bool NewCombo { get; set; } + } +} diff --git a/osu.Game/Modes/Objects/Legacy/Catch/HitObjectParser.cs b/osu.Game/Modes/Objects/Legacy/Catch/HitObjectParser.cs new file mode 100644 index 0000000000..f84b333d97 --- /dev/null +++ b/osu.Game/Modes/Objects/Legacy/Catch/HitObjectParser.cs @@ -0,0 +1,42 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using OpenTK; +using osu.Game.Modes.Objects.Types; + +namespace osu.Game.Modes.Objects.Legacy.Catch +{ + internal class HitObjectParser : Legacy.HitObjectParser + { + protected override HitObject CreateHit(Vector2 position, bool newCombo) + { + return new Hit + { + X = position.X, + NewCombo = newCombo, + }; + } + + protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount) + { + return new Slider + { + X = position.X, + NewCombo = newCombo, + ControlPoints = controlPoints, + Distance = length, + CurveType = curveType, + RepeatCount = repeatCount + }; + } + + protected override HitObject CreateSpinner(Vector2 position, double endTime) + { + return new Spinner + { + EndTime = endTime + }; + } + } +} diff --git a/osu.Game/Modes/Objects/Legacy/Catch/Slider.cs b/osu.Game/Modes/Objects/Legacy/Catch/Slider.cs new file mode 100644 index 0000000000..9216abd18a --- /dev/null +++ b/osu.Game/Modes/Objects/Legacy/Catch/Slider.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Modes.Objects.Types; + +namespace osu.Game.Modes.Objects.Legacy.Catch +{ + /// + /// Legacy Slider-type, used for parsing Beatmaps. + /// + internal sealed class Slider : CurvedHitObject, IHasXPosition, IHasCombo + { + public float X { get; set; } + + public bool NewCombo { get; set; } + } +} diff --git a/osu.Game/Modes/Objects/Legacy/Catch/Spinner.cs b/osu.Game/Modes/Objects/Legacy/Catch/Spinner.cs new file mode 100644 index 0000000000..c5e8f396c1 --- /dev/null +++ b/osu.Game/Modes/Objects/Legacy/Catch/Spinner.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Modes.Objects.Types; + +namespace osu.Game.Modes.Objects.Legacy.Catch +{ + /// + /// Legacy Spinner-type, used for parsing Beatmaps. + /// + internal class Spinner : HitObject, IHasEndTime + { + public double EndTime { get; set; } + + public double Duration => EndTime - StartTime; + } +} diff --git a/osu.Game/Modes/Objects/LegacyHitObjectParser.cs b/osu.Game/Modes/Objects/Legacy/HitObjectParser.cs similarity index 73% rename from osu.Game/Modes/Objects/LegacyHitObjectParser.cs rename to osu.Game/Modes/Objects/Legacy/HitObjectParser.cs index 580c09c646..6db7caeb3e 100644 --- a/osu.Game/Modes/Objects/LegacyHitObjectParser.cs +++ b/osu.Game/Modes/Objects/Legacy/HitObjectParser.cs @@ -6,20 +6,19 @@ using osu.Game.Modes.Objects.Types; using System; using System.Collections.Generic; using System.Globalization; -using osu.Game.Modes.Objects.Legacy; using osu.Game.Beatmaps.Formats; using osu.Game.Audio; -namespace osu.Game.Modes.Objects +namespace osu.Game.Modes.Objects.Legacy { - internal class LegacyHitObjectParser : HitObjectParser + internal abstract class HitObjectParser : Objects.HitObjectParser { public override HitObject Parse(string text) { string[] split = text.Split(','); - var type = (LegacyHitObjectType)int.Parse(split[3]) & ~LegacyHitObjectType.ColourHax; - bool combo = type.HasFlag(LegacyHitObjectType.NewCombo); - type &= ~LegacyHitObjectType.NewCombo; + var type = (HitObjectType)int.Parse(split[3]) & ~HitObjectType.ColourHax; + bool combo = type.HasFlag(HitObjectType.NewCombo); + type &= ~HitObjectType.NewCombo; int sampleVolume = 0; string normalSampleBank = null; @@ -27,22 +26,18 @@ namespace osu.Game.Modes.Objects HitObject result; - if ((type & LegacyHitObjectType.Circle) > 0) + if ((type & HitObjectType.Circle) > 0) { - result = new LegacyHit - { - Position = new Vector2(int.Parse(split[0]), int.Parse(split[1])), - NewCombo = combo - }; + result = CreateHit(new Vector2(int.Parse(split[0]), int.Parse(split[1])), combo); if (split.Length > 5) readCustomSampleBanks(split[5], ref normalSampleBank, ref addSampleBank, ref sampleVolume); } - else if ((type & LegacyHitObjectType.Slider) > 0) + else if ((type & HitObjectType.Slider) > 0) { CurveType curveType = CurveType.Catmull; double length = 0; - List points = new List { new Vector2(int.Parse(split[0]), int.Parse(split[1])) }; + var points = new List { new Vector2(int.Parse(split[0]), int.Parse(split[1])) }; string[] pointsplit = split[5].Split('|'); foreach (string t in pointsplit) @@ -68,11 +63,7 @@ namespace osu.Game.Modes.Objects } string[] temp = t.Split(':'); - Vector2 v = new Vector2( - (int)Convert.ToDouble(temp[0], CultureInfo.InvariantCulture), - (int)Convert.ToDouble(temp[1], CultureInfo.InvariantCulture) - ); - points.Add(v); + points.Add(new Vector2((int)Convert.ToDouble(temp[0], CultureInfo.InvariantCulture), (int)Convert.ToDouble(temp[1], CultureInfo.InvariantCulture))); } int repeatCount = Convert.ToInt32(split[6], CultureInfo.InvariantCulture); @@ -83,38 +74,26 @@ namespace osu.Game.Modes.Objects if (split.Length > 7) length = Convert.ToDouble(split[7], CultureInfo.InvariantCulture); - result = new LegacySlider - { - ControlPoints = points, - Distance = length, - CurveType = curveType, - RepeatCount = repeatCount, - Position = new Vector2(int.Parse(split[0]), int.Parse(split[1])), - NewCombo = combo - }; + result = CreateSlider(new Vector2(int.Parse(split[0]), int.Parse(split[1])), combo, points, length, curveType, repeatCount); if (split.Length > 10) readCustomSampleBanks(split[10], ref normalSampleBank, ref addSampleBank, ref sampleVolume); } - else if ((type & LegacyHitObjectType.Spinner) > 0) + else if ((type & HitObjectType.Spinner) > 0) { - result = new LegacySpinner - { - Position = new Vector2(512, 384) / 2, - EndTime = Convert.ToDouble(split[5], CultureInfo.InvariantCulture) - }; + result = CreateSpinner(new Vector2(512, 384) / 2, Convert.ToDouble(split[5], CultureInfo.InvariantCulture)); if (split.Length > 6) readCustomSampleBanks(split[6], ref normalSampleBank, ref addSampleBank, ref sampleVolume); } - else if ((type & LegacyHitObjectType.Hold) > 0) + else if ((type & HitObjectType.Hold) > 0) { // Note: Hold is generated by BMS converts // Todo: Apparently end time is determined by samples?? // Shouldn't need implementation until mania - result = new LegacyHold + result = new Hold { Position = new Vector2(int.Parse(split[0]), int.Parse(split[1])), NewCombo = combo @@ -167,6 +146,10 @@ namespace osu.Game.Modes.Objects return result; } + protected abstract HitObject CreateHit(Vector2 position, bool newCombo); + protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount); + protected abstract HitObject CreateSpinner(Vector2 position, double endTime); + private void readCustomSampleBanks(string str, ref string normalSampleBank, ref string addSampleBank, ref int sampleVolume) { if (string.IsNullOrEmpty(str)) diff --git a/osu.Game/Modes/Objects/Legacy/LegacyHitObjectType.cs b/osu.Game/Modes/Objects/Legacy/HitObjectType.cs similarity index 87% rename from osu.Game/Modes/Objects/Legacy/LegacyHitObjectType.cs rename to osu.Game/Modes/Objects/Legacy/HitObjectType.cs index 416e1abe76..e203b57c62 100644 --- a/osu.Game/Modes/Objects/Legacy/LegacyHitObjectType.cs +++ b/osu.Game/Modes/Objects/Legacy/HitObjectType.cs @@ -6,7 +6,7 @@ using System; namespace osu.Game.Modes.Objects.Legacy { [Flags] - public enum LegacyHitObjectType + public enum HitObjectType { Circle = 1 << 0, Slider = 1 << 1, diff --git a/osu.Game/Modes/Objects/Legacy/LegacyHold.cs b/osu.Game/Modes/Objects/Legacy/Hold.cs similarity index 71% rename from osu.Game/Modes/Objects/Legacy/LegacyHold.cs rename to osu.Game/Modes/Objects/Legacy/Hold.cs index 4f858c16f1..6014bf7201 100644 --- a/osu.Game/Modes/Objects/Legacy/LegacyHold.cs +++ b/osu.Game/Modes/Objects/Legacy/Hold.cs @@ -9,10 +9,14 @@ namespace osu.Game.Modes.Objects.Legacy /// /// Legacy Hold-type, used for parsing "specials" in beatmaps. /// - public sealed class LegacyHold : HitObject, IHasPosition, IHasCombo, IHasHold + internal sealed class Hold : HitObject, IHasPosition, IHasCombo, IHasHold { public Vector2 Position { get; set; } + public float X => Position.X; + + public float Y => Position.Y; + public bool NewCombo { get; set; } } } diff --git a/osu.Game/Modes/Objects/Legacy/Mania/Hit.cs b/osu.Game/Modes/Objects/Legacy/Mania/Hit.cs new file mode 100644 index 0000000000..b892434151 --- /dev/null +++ b/osu.Game/Modes/Objects/Legacy/Mania/Hit.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Modes.Objects.Types; + +namespace osu.Game.Modes.Objects.Legacy.Mania +{ + /// + /// Legacy Hit-type, used for parsing Beatmaps. + /// + internal sealed class Hit : HitObject, IHasColumn, IHasCombo + { + public int Column { get; set; } + + public bool NewCombo { get; set; } + } +} diff --git a/osu.Game/Modes/Objects/Legacy/Mania/HitObjectParser.cs b/osu.Game/Modes/Objects/Legacy/Mania/HitObjectParser.cs new file mode 100644 index 0000000000..572657fe9b --- /dev/null +++ b/osu.Game/Modes/Objects/Legacy/Mania/HitObjectParser.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.Collections.Generic; +using OpenTK; +using osu.Game.Modes.Objects.Types; + +namespace osu.Game.Modes.Objects.Legacy.Mania +{ + internal class HitObjectParser : Legacy.HitObjectParser + { + protected override HitObject CreateHit(Vector2 position, bool newCombo) + { + return new Hit + { + NewCombo = newCombo, + }; + } + + protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount) + { + return new Slider + { + NewCombo = newCombo, + ControlPoints = controlPoints, + Distance = length, + CurveType = curveType, + RepeatCount = repeatCount + }; + } + + protected override HitObject CreateSpinner(Vector2 position, double endTime) + { + return new Spinner + { + EndTime = endTime + }; + } + } +} diff --git a/osu.Game/Modes/Objects/Legacy/Mania/Slider.cs b/osu.Game/Modes/Objects/Legacy/Mania/Slider.cs new file mode 100644 index 0000000000..cd0f4e95cb --- /dev/null +++ b/osu.Game/Modes/Objects/Legacy/Mania/Slider.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Modes.Objects.Types; + +namespace osu.Game.Modes.Objects.Legacy.Mania +{ + /// + /// Legacy Slider-type, used for parsing Beatmaps. + /// + internal sealed class Slider : CurvedHitObject, IHasColumn, IHasCombo + { + public int Column { get; set; } + + public bool NewCombo { get; set; } + } +} diff --git a/osu.Game/Modes/Objects/Legacy/LegacySpinner.cs b/osu.Game/Modes/Objects/Legacy/Mania/Spinner.cs similarity index 57% rename from osu.Game/Modes/Objects/Legacy/LegacySpinner.cs rename to osu.Game/Modes/Objects/Legacy/Mania/Spinner.cs index 196706f157..7234ebc711 100644 --- a/osu.Game/Modes/Objects/Legacy/LegacySpinner.cs +++ b/osu.Game/Modes/Objects/Legacy/Mania/Spinner.cs @@ -1,20 +1,19 @@ -using OpenTK; -// Copyright (c) 2007-2017 ppy Pty Ltd . +// Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Modes.Objects.Types; -namespace osu.Game.Modes.Objects.Legacy +namespace osu.Game.Modes.Objects.Legacy.Mania { /// /// Legacy Spinner-type, used for parsing Beatmaps. /// - internal class LegacySpinner : HitObject, IHasEndTime, IHasPosition + internal class Spinner : HitObject, IHasEndTime, IHasColumn { public double EndTime { get; set; } public double Duration => EndTime - StartTime; - public Vector2 Position { get; set; } + public int Column { get; set; } } } diff --git a/osu.Game/Modes/Objects/Legacy/LegacyHit.cs b/osu.Game/Modes/Objects/Legacy/Osu/Hit.cs similarity index 65% rename from osu.Game/Modes/Objects/Legacy/LegacyHit.cs rename to osu.Game/Modes/Objects/Legacy/Osu/Hit.cs index 239c8982da..2b59497a0a 100644 --- a/osu.Game/Modes/Objects/Legacy/LegacyHit.cs +++ b/osu.Game/Modes/Objects/Legacy/Osu/Hit.cs @@ -4,15 +4,19 @@ using osu.Game.Modes.Objects.Types; using OpenTK; -namespace osu.Game.Modes.Objects.Legacy +namespace osu.Game.Modes.Objects.Legacy.Osu { /// /// Legacy Hit-type, used for parsing Beatmaps. /// - public sealed class LegacyHit : HitObject, IHasPosition, IHasCombo + internal sealed class Hit : HitObject, IHasPosition, IHasCombo { public Vector2 Position { get; set; } + public float X => Position.X; + + public float Y => Position.Y; + public bool NewCombo { get; set; } } } diff --git a/osu.Game/Modes/Objects/Legacy/Osu/HitObjectParser.cs b/osu.Game/Modes/Objects/Legacy/Osu/HitObjectParser.cs new file mode 100644 index 0000000000..362339ffd9 --- /dev/null +++ b/osu.Game/Modes/Objects/Legacy/Osu/HitObjectParser.cs @@ -0,0 +1,43 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using osu.Game.Modes.Objects.Types; +using System.Collections.Generic; + +namespace osu.Game.Modes.Objects.Legacy.Osu +{ + internal class HitObjectParser : Legacy.HitObjectParser + { + protected override HitObject CreateHit(Vector2 position, bool newCombo) + { + return new Hit + { + Position = position, + NewCombo = newCombo, + }; + } + + protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount) + { + return new Slider + { + Position = position, + NewCombo = newCombo, + ControlPoints = controlPoints, + Distance = length, + CurveType = curveType, + RepeatCount = repeatCount + }; + } + + protected override HitObject CreateSpinner(Vector2 position, double endTime) + { + return new Spinner + { + Position = position, + EndTime = endTime + }; + } + } +} diff --git a/osu.Game/Modes/Objects/Legacy/LegacySlider.cs b/osu.Game/Modes/Objects/Legacy/Osu/Slider.cs similarity index 64% rename from osu.Game/Modes/Objects/Legacy/LegacySlider.cs rename to osu.Game/Modes/Objects/Legacy/Osu/Slider.cs index bdfebb1983..5f7b5306ab 100644 --- a/osu.Game/Modes/Objects/Legacy/LegacySlider.cs +++ b/osu.Game/Modes/Objects/Legacy/Osu/Slider.cs @@ -4,15 +4,19 @@ using osu.Game.Modes.Objects.Types; using OpenTK; -namespace osu.Game.Modes.Objects.Legacy +namespace osu.Game.Modes.Objects.Legacy.Osu { /// /// Legacy Slider-type, used for parsing Beatmaps. /// - public sealed class LegacySlider : CurvedHitObject, IHasPosition, IHasCombo + internal sealed class Slider : CurvedHitObject, IHasPosition, IHasCombo { public Vector2 Position { get; set; } + public float X => Position.X; + + public float Y => Position.Y; + public bool NewCombo { get; set; } } } diff --git a/osu.Game/Modes/Objects/Legacy/Osu/Spinner.cs b/osu.Game/Modes/Objects/Legacy/Osu/Spinner.cs new file mode 100644 index 0000000000..8da93428c4 --- /dev/null +++ b/osu.Game/Modes/Objects/Legacy/Osu/Spinner.cs @@ -0,0 +1,24 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Modes.Objects.Types; +using OpenTK; + +namespace osu.Game.Modes.Objects.Legacy.Osu +{ + /// + /// Legacy Spinner-type, used for parsing Beatmaps. + /// + internal class Spinner : HitObject, IHasEndTime, IHasPosition + { + public double EndTime { get; set; } + + public double Duration => EndTime - StartTime; + + public Vector2 Position { get; set; } + + public float X => Position.X; + + public float Y => Position.Y; + } +} diff --git a/osu.Game/Modes/Objects/Legacy/Taiko/Hit.cs b/osu.Game/Modes/Objects/Legacy/Taiko/Hit.cs new file mode 100644 index 0000000000..7d0f7d88ee --- /dev/null +++ b/osu.Game/Modes/Objects/Legacy/Taiko/Hit.cs @@ -0,0 +1,15 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Modes.Objects.Types; + +namespace osu.Game.Modes.Objects.Legacy.Taiko +{ + /// + /// Legacy Hit-type, used for parsing Beatmaps. + /// + internal sealed class Hit : HitObject, IHasCombo + { + public bool NewCombo { get; set; } + } +} diff --git a/osu.Game/Modes/Objects/Legacy/Taiko/HitObjectParser.cs b/osu.Game/Modes/Objects/Legacy/Taiko/HitObjectParser.cs new file mode 100644 index 0000000000..6f98dad58d --- /dev/null +++ b/osu.Game/Modes/Objects/Legacy/Taiko/HitObjectParser.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 OpenTK; +using osu.Game.Modes.Objects.Types; +using System.Collections.Generic; + +namespace osu.Game.Modes.Objects.Legacy.Taiko +{ + internal class HitObjectParser : Legacy.HitObjectParser + { + protected override HitObject CreateHit(Vector2 position, bool newCombo) + { + return new Hit + { + NewCombo = newCombo, + }; + } + + protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount) + { + return new Slider + { + NewCombo = newCombo, + ControlPoints = controlPoints, + Distance = length, + CurveType = curveType, + RepeatCount = repeatCount + }; + } + + protected override HitObject CreateSpinner(Vector2 position, double endTime) + { + return new Spinner + { + EndTime = endTime + }; + } + } +} diff --git a/osu.Game/Modes/Objects/Legacy/Taiko/Slider.cs b/osu.Game/Modes/Objects/Legacy/Taiko/Slider.cs new file mode 100644 index 0000000000..ac7c7cb89e --- /dev/null +++ b/osu.Game/Modes/Objects/Legacy/Taiko/Slider.cs @@ -0,0 +1,15 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Modes.Objects.Types; + +namespace osu.Game.Modes.Objects.Legacy.Taiko +{ + /// + /// Legacy Slider-type, used for parsing Beatmaps. + /// + internal sealed class Slider : CurvedHitObject, IHasCombo + { + public bool NewCombo { get; set; } + } +} diff --git a/osu.Game/Modes/Objects/Legacy/Taiko/Spinner.cs b/osu.Game/Modes/Objects/Legacy/Taiko/Spinner.cs new file mode 100644 index 0000000000..62d827c435 --- /dev/null +++ b/osu.Game/Modes/Objects/Legacy/Taiko/Spinner.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Modes.Objects.Types; + +namespace osu.Game.Modes.Objects.Legacy.Taiko +{ + /// + /// Legacy Spinner-type, used for parsing Beatmaps. + /// + internal class Spinner : HitObject, IHasEndTime + { + public double EndTime { get; set; } + + public double Duration => EndTime - StartTime; + } +} diff --git a/osu.Game/Modes/Objects/Types/IHasColumn.cs b/osu.Game/Modes/Objects/Types/IHasColumn.cs new file mode 100644 index 0000000000..b446d9db53 --- /dev/null +++ b/osu.Game/Modes/Objects/Types/IHasColumn.cs @@ -0,0 +1,10 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Modes.Objects.Types +{ + public interface IHasColumn + { + int Column { get; } + } +} diff --git a/osu.Game/Modes/Objects/Types/IHasPosition.cs b/osu.Game/Modes/Objects/Types/IHasPosition.cs index 8138bf6662..094370a090 100644 --- a/osu.Game/Modes/Objects/Types/IHasPosition.cs +++ b/osu.Game/Modes/Objects/Types/IHasPosition.cs @@ -8,7 +8,7 @@ namespace osu.Game.Modes.Objects.Types /// /// A HitObject that has a starting position. /// - public interface IHasPosition + public interface IHasPosition : IHasXPosition, IHasYPosition { /// /// The starting position of the HitObject. diff --git a/osu.Game/Modes/Objects/Types/IHasXPosition.cs b/osu.Game/Modes/Objects/Types/IHasXPosition.cs new file mode 100644 index 0000000000..03a562c8b7 --- /dev/null +++ b/osu.Game/Modes/Objects/Types/IHasXPosition.cs @@ -0,0 +1,14 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + + +namespace osu.Game.Modes.Objects.Types +{ + /// + /// A HitObject that has a starting X-position. + /// + public interface IHasXPosition + { + float X { get; } + } +} diff --git a/osu.Game/Modes/Objects/Types/IHasYPosition.cs b/osu.Game/Modes/Objects/Types/IHasYPosition.cs new file mode 100644 index 0000000000..38ddd3bdf5 --- /dev/null +++ b/osu.Game/Modes/Objects/Types/IHasYPosition.cs @@ -0,0 +1,14 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + + +namespace osu.Game.Modes.Objects.Types +{ + /// + /// A HitObject that has a starting Y-position. + /// + public interface IHasYPosition + { + float Y { get; } + } +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 193c2c1179..f259a37bb0 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -104,6 +104,22 @@ + + + + + + + + + + + + + + + + @@ -115,11 +131,11 @@ - - - - - + + + + + @@ -132,7 +148,7 @@ - + From 04973ae65e26b9d0cc2fac113daa83712cfe093a Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 17 Apr 2017 17:25:29 +0900 Subject: [PATCH 212/442] Fix conversion types for Catch and Mania. --- osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs | 4 ++-- osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs | 4 ++-- osu.Game/Beatmaps/IBeatmapConverter.cs | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs b/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs index c2e77d60ed..59991af3ce 100644 --- a/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs +++ b/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs @@ -5,13 +5,13 @@ using osu.Game.Beatmaps; using osu.Game.Modes.Catch.Objects; using System.Collections.Generic; using System; -using osu.Game.Modes.Objects; +using osu.Game.Modes.Objects.Types; namespace osu.Game.Modes.Catch.Beatmaps { internal class CatchBeatmapConverter : IBeatmapConverter { - public IEnumerable ValidConversionTypes { get; } = new[] { typeof(HitObject) }; + public IEnumerable ValidConversionTypes { get; } = new[] { typeof(IHasXPosition) }; public Beatmap Convert(Beatmap original) { diff --git a/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs index 21a324fc1c..bbe39e6772 100644 --- a/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -5,13 +5,13 @@ using osu.Game.Beatmaps; using osu.Game.Modes.Mania.Objects; using System.Collections.Generic; using System; -using osu.Game.Modes.Objects; +using osu.Game.Modes.Objects.Types; namespace osu.Game.Modes.Mania.Beatmaps { internal class ManiaBeatmapConverter : IBeatmapConverter { - public IEnumerable ValidConversionTypes { get; } = new[] { typeof(HitObject) }; + public IEnumerable ValidConversionTypes { get; } = new[] { typeof(IHasColumn) }; public Beatmap Convert(Beatmap original) { diff --git a/osu.Game/Beatmaps/IBeatmapConverter.cs b/osu.Game/Beatmaps/IBeatmapConverter.cs index fbd6a60327..815eab9c71 100644 --- a/osu.Game/Beatmaps/IBeatmapConverter.cs +++ b/osu.Game/Beatmaps/IBeatmapConverter.cs @@ -15,9 +15,8 @@ namespace osu.Game.Beatmaps public interface IBeatmapConverter where T : HitObject { /// - /// The type of HitObjects that can be converted to be used for this Beatmap. + /// The types of HitObjects that can be converted to be used for this Beatmap. /// - /// IEnumerable ValidConversionTypes { get; } /// @@ -35,7 +34,7 @@ namespace osu.Game.Beatmaps /// /// The Converter to use. /// The Beatmap to check. - /// Whether the Beatmap can be converted using . + /// Whether the Beatmap can be converted using . public static bool CanConvert(this IBeatmapConverter converter, Beatmap beatmap) where TObject : HitObject => converter.ValidConversionTypes.All(t => beatmap.HitObjects.Any(h => t.IsAssignableFrom(h.GetType()))); } From 786446354ea5640a1d58d4f8ffda32dba2bc44ee Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 18 Apr 2017 09:00:53 +0900 Subject: [PATCH 213/442] Fix post-rebase errors. --- osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs | 2 -- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 2 +- osu.Game/Screens/Play/Player.cs | 4 ++-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs index 873f3f8559..f7a62fe999 100644 --- a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs @@ -7,10 +7,8 @@ using OpenTK; using OpenTK.Graphics; using osu.Game.Beatmaps.Formats; using osu.Game.Tests.Resources; -using osu.Game.Modes.Objects.Legacy; using System.Linq; using osu.Game.Audio; -using osu.Game.Modes.Objects; using osu.Game.Modes.Objects.Types; namespace osu.Game.Tests.Beatmaps.Formats diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index 11fa4825d2..758d2205ac 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -87,7 +87,7 @@ namespace osu.Game.Beatmaps.Formats case @"Mode": beatmap.BeatmapInfo.RulesetID = int.Parse(val); - switch (beatmap.BeatmapInfo.Mode) + switch (beatmap.BeatmapInfo.RulesetID) { case 0: parser = new Modes.Objects.Legacy.Osu.HitObjectParser(); diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 7c95a09e31..eea6775063 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -80,13 +80,13 @@ namespace osu.Game.Screens.Play try { // Try using the preferred user ruleset - ruleset = osu == null ? Beatmap.BeatmapInfo.Ruleset : osu.Ruleset; + ruleset = osu == null ? Beatmap.BeatmapInfo.Ruleset.CreateInstance() : osu.Ruleset.Value.CreateInstance(); HitRenderer = ruleset.CreateHitRendererWith(Beatmap); } catch (BeatmapInvalidForModeException) { // Default to the beatmap ruleset - ruleset = Beatmap.BeatmapInfo.Ruleset; + ruleset = Beatmap.BeatmapInfo.Ruleset.CreateInstance(); HitRenderer = ruleset.CreateHitRendererWith(Beatmap); } } From c61e3265bbc2e7aea740f3b8a136843422136c8c Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 18 Apr 2017 09:13:36 +0900 Subject: [PATCH 214/442] A few xmldoc additions/fixes. --- osu.Game/Beatmaps/IBeatmapConverter.cs | 4 +-- osu.Game/Modes/Objects/Legacy/Catch/Hit.cs | 2 +- .../Objects/Legacy/Catch/HitObjectParser.cs | 5 ++- osu.Game/Modes/Objects/Legacy/Catch/Slider.cs | 2 +- .../Modes/Objects/Legacy/Catch/Spinner.cs | 4 +-- .../Modes/Objects/Legacy/HitObjectParser.cs | 35 ++++++++++++++++--- osu.Game/Modes/Objects/Legacy/Mania/Hit.cs | 2 +- .../Objects/Legacy/Mania/HitObjectParser.cs | 5 ++- osu.Game/Modes/Objects/Legacy/Mania/Slider.cs | 2 +- .../Modes/Objects/Legacy/Mania/Spinner.cs | 4 +-- osu.Game/Modes/Objects/Legacy/Osu/Hit.cs | 2 +- .../Objects/Legacy/Osu/HitObjectParser.cs | 3 ++ osu.Game/Modes/Objects/Legacy/Osu/Slider.cs | 2 +- osu.Game/Modes/Objects/Legacy/Osu/Spinner.cs | 4 +-- osu.Game/Modes/Objects/Legacy/Taiko/Hit.cs | 2 +- .../Objects/Legacy/Taiko/HitObjectParser.cs | 3 ++ osu.Game/Modes/Objects/Legacy/Taiko/Slider.cs | 2 +- .../Modes/Objects/Legacy/Taiko/Spinner.cs | 4 +-- osu.Game/Modes/Objects/Types/IHasColumn.cs | 6 ++++ osu.Game/Modes/Objects/Types/IHasXPosition.cs | 3 ++ osu.Game/Modes/Objects/Types/IHasYPosition.cs | 3 ++ 21 files changed, 75 insertions(+), 24 deletions(-) diff --git a/osu.Game/Beatmaps/IBeatmapConverter.cs b/osu.Game/Beatmaps/IBeatmapConverter.cs index 815eab9c71..948e55967e 100644 --- a/osu.Game/Beatmaps/IBeatmapConverter.cs +++ b/osu.Game/Beatmaps/IBeatmapConverter.cs @@ -30,9 +30,9 @@ namespace osu.Game.Beatmaps public static class BeatmapConverterExtensions { /// - /// Checks if a Beatmap can be converted using a Beatmap Converter. + /// Checks if a Beatmap can be converted using this Beatmap Converter. /// - /// The Converter to use. + /// The Beatmap Converter. /// The Beatmap to check. /// Whether the Beatmap can be converted using . public static bool CanConvert(this IBeatmapConverter converter, Beatmap beatmap) where TObject : HitObject diff --git a/osu.Game/Modes/Objects/Legacy/Catch/Hit.cs b/osu.Game/Modes/Objects/Legacy/Catch/Hit.cs index 1b44675c37..dba7926a79 100644 --- a/osu.Game/Modes/Objects/Legacy/Catch/Hit.cs +++ b/osu.Game/Modes/Objects/Legacy/Catch/Hit.cs @@ -6,7 +6,7 @@ using osu.Game.Modes.Objects.Types; namespace osu.Game.Modes.Objects.Legacy.Catch { /// - /// Legacy Hit-type, used for parsing Beatmaps. + /// Legacy osu!catch Hit-type, used for parsing Beatmaps. /// internal sealed class Hit : HitObject, IHasCombo, IHasXPosition { diff --git a/osu.Game/Modes/Objects/Legacy/Catch/HitObjectParser.cs b/osu.Game/Modes/Objects/Legacy/Catch/HitObjectParser.cs index f84b333d97..0ef4ed0646 100644 --- a/osu.Game/Modes/Objects/Legacy/Catch/HitObjectParser.cs +++ b/osu.Game/Modes/Objects/Legacy/Catch/HitObjectParser.cs @@ -1,12 +1,15 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Collections.Generic; using OpenTK; using osu.Game.Modes.Objects.Types; +using System.Collections.Generic; namespace osu.Game.Modes.Objects.Legacy.Catch { + /// + /// A HitObjectParser to parse legacy osu!catch Beatmaps. + /// internal class HitObjectParser : Legacy.HitObjectParser { protected override HitObject CreateHit(Vector2 position, bool newCombo) diff --git a/osu.Game/Modes/Objects/Legacy/Catch/Slider.cs b/osu.Game/Modes/Objects/Legacy/Catch/Slider.cs index 9216abd18a..de71198851 100644 --- a/osu.Game/Modes/Objects/Legacy/Catch/Slider.cs +++ b/osu.Game/Modes/Objects/Legacy/Catch/Slider.cs @@ -6,7 +6,7 @@ using osu.Game.Modes.Objects.Types; namespace osu.Game.Modes.Objects.Legacy.Catch { /// - /// Legacy Slider-type, used for parsing Beatmaps. + /// Legacy osu!catch Slider-type, used for parsing Beatmaps. /// internal sealed class Slider : CurvedHitObject, IHasXPosition, IHasCombo { diff --git a/osu.Game/Modes/Objects/Legacy/Catch/Spinner.cs b/osu.Game/Modes/Objects/Legacy/Catch/Spinner.cs index c5e8f396c1..a99804a243 100644 --- a/osu.Game/Modes/Objects/Legacy/Catch/Spinner.cs +++ b/osu.Game/Modes/Objects/Legacy/Catch/Spinner.cs @@ -6,9 +6,9 @@ using osu.Game.Modes.Objects.Types; namespace osu.Game.Modes.Objects.Legacy.Catch { /// - /// Legacy Spinner-type, used for parsing Beatmaps. + /// Legacy osu!catch Spinner-type, used for parsing Beatmaps. /// - internal class Spinner : HitObject, IHasEndTime + internal sealed class Spinner : HitObject, IHasEndTime { public double EndTime { get; set; } diff --git a/osu.Game/Modes/Objects/Legacy/HitObjectParser.cs b/osu.Game/Modes/Objects/Legacy/HitObjectParser.cs index 6db7caeb3e..ec89a63c7a 100644 --- a/osu.Game/Modes/Objects/Legacy/HitObjectParser.cs +++ b/osu.Game/Modes/Objects/Legacy/HitObjectParser.cs @@ -11,6 +11,9 @@ using osu.Game.Audio; namespace osu.Game.Modes.Objects.Legacy { + /// + /// A HitObjectParser to parse legacy Beatmaps. + /// internal abstract class HitObjectParser : Objects.HitObjectParser { public override HitObject Parse(string text) @@ -146,10 +149,6 @@ namespace osu.Game.Modes.Objects.Legacy return result; } - protected abstract HitObject CreateHit(Vector2 position, bool newCombo); - protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount); - protected abstract HitObject CreateSpinner(Vector2 position, double endTime); - private void readCustomSampleBanks(string str, ref string normalSampleBank, ref string addSampleBank, ref int sampleVolume) { if (string.IsNullOrEmpty(str)) @@ -175,6 +174,34 @@ namespace osu.Game.Modes.Objects.Legacy sampleVolume = split.Length > 3 ? int.Parse(split[3]) : 0; } + /// + /// Creates a legacy Hit-type hit object. + /// + /// The position of the hit object. + /// Whether the hit object creates a new combo. + /// The hit object. + protected abstract HitObject CreateHit(Vector2 position, bool newCombo); + + /// + /// Creats a legacy Slider-type hit object. + /// + /// The position of the hit object. + /// Whether the hit object creates a new combo. + /// The slider control points. + /// The slider length. + /// The slider curve type. + /// The slider repeat count. + /// The hit object. + protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount); + + /// + /// Creates a legacy Spinner-type hit object. + /// + /// The position of the hit object. + /// The spinner end time. + /// The hit object. + protected abstract HitObject CreateSpinner(Vector2 position, double endTime); + [Flags] private enum LegacySoundType { diff --git a/osu.Game/Modes/Objects/Legacy/Mania/Hit.cs b/osu.Game/Modes/Objects/Legacy/Mania/Hit.cs index b892434151..acf9777fbf 100644 --- a/osu.Game/Modes/Objects/Legacy/Mania/Hit.cs +++ b/osu.Game/Modes/Objects/Legacy/Mania/Hit.cs @@ -6,7 +6,7 @@ using osu.Game.Modes.Objects.Types; namespace osu.Game.Modes.Objects.Legacy.Mania { /// - /// Legacy Hit-type, used for parsing Beatmaps. + /// Legacy osu!mania Hit-type, used for parsing Beatmaps. /// internal sealed class Hit : HitObject, IHasColumn, IHasCombo { diff --git a/osu.Game/Modes/Objects/Legacy/Mania/HitObjectParser.cs b/osu.Game/Modes/Objects/Legacy/Mania/HitObjectParser.cs index 572657fe9b..7ef923633c 100644 --- a/osu.Game/Modes/Objects/Legacy/Mania/HitObjectParser.cs +++ b/osu.Game/Modes/Objects/Legacy/Mania/HitObjectParser.cs @@ -1,12 +1,15 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Collections.Generic; using OpenTK; using osu.Game.Modes.Objects.Types; +using System.Collections.Generic; namespace osu.Game.Modes.Objects.Legacy.Mania { + /// + /// A HitObjectParser to parse legacy osu!mania Beatmaps. + /// internal class HitObjectParser : Legacy.HitObjectParser { protected override HitObject CreateHit(Vector2 position, bool newCombo) diff --git a/osu.Game/Modes/Objects/Legacy/Mania/Slider.cs b/osu.Game/Modes/Objects/Legacy/Mania/Slider.cs index cd0f4e95cb..f320ac1d59 100644 --- a/osu.Game/Modes/Objects/Legacy/Mania/Slider.cs +++ b/osu.Game/Modes/Objects/Legacy/Mania/Slider.cs @@ -6,7 +6,7 @@ using osu.Game.Modes.Objects.Types; namespace osu.Game.Modes.Objects.Legacy.Mania { /// - /// Legacy Slider-type, used for parsing Beatmaps. + /// Legacy osu!mania Slider-type, used for parsing Beatmaps. /// internal sealed class Slider : CurvedHitObject, IHasColumn, IHasCombo { diff --git a/osu.Game/Modes/Objects/Legacy/Mania/Spinner.cs b/osu.Game/Modes/Objects/Legacy/Mania/Spinner.cs index 7234ebc711..1df5907860 100644 --- a/osu.Game/Modes/Objects/Legacy/Mania/Spinner.cs +++ b/osu.Game/Modes/Objects/Legacy/Mania/Spinner.cs @@ -6,9 +6,9 @@ using osu.Game.Modes.Objects.Types; namespace osu.Game.Modes.Objects.Legacy.Mania { /// - /// Legacy Spinner-type, used for parsing Beatmaps. + /// Legacy osu!mania Spinner-type, used for parsing Beatmaps. /// - internal class Spinner : HitObject, IHasEndTime, IHasColumn + internal sealed class Spinner : HitObject, IHasEndTime, IHasColumn { public double EndTime { get; set; } diff --git a/osu.Game/Modes/Objects/Legacy/Osu/Hit.cs b/osu.Game/Modes/Objects/Legacy/Osu/Hit.cs index 2b59497a0a..397273391a 100644 --- a/osu.Game/Modes/Objects/Legacy/Osu/Hit.cs +++ b/osu.Game/Modes/Objects/Legacy/Osu/Hit.cs @@ -7,7 +7,7 @@ using OpenTK; namespace osu.Game.Modes.Objects.Legacy.Osu { /// - /// Legacy Hit-type, used for parsing Beatmaps. + /// Legacy osu! Hit-type, used for parsing Beatmaps. /// internal sealed class Hit : HitObject, IHasPosition, IHasCombo { diff --git a/osu.Game/Modes/Objects/Legacy/Osu/HitObjectParser.cs b/osu.Game/Modes/Objects/Legacy/Osu/HitObjectParser.cs index 362339ffd9..d063ef8c48 100644 --- a/osu.Game/Modes/Objects/Legacy/Osu/HitObjectParser.cs +++ b/osu.Game/Modes/Objects/Legacy/Osu/HitObjectParser.cs @@ -7,6 +7,9 @@ using System.Collections.Generic; namespace osu.Game.Modes.Objects.Legacy.Osu { + /// + /// A HitObjectParser to parse legacy osu! Beatmaps. + /// internal class HitObjectParser : Legacy.HitObjectParser { protected override HitObject CreateHit(Vector2 position, bool newCombo) diff --git a/osu.Game/Modes/Objects/Legacy/Osu/Slider.cs b/osu.Game/Modes/Objects/Legacy/Osu/Slider.cs index 5f7b5306ab..24deda85bf 100644 --- a/osu.Game/Modes/Objects/Legacy/Osu/Slider.cs +++ b/osu.Game/Modes/Objects/Legacy/Osu/Slider.cs @@ -7,7 +7,7 @@ using OpenTK; namespace osu.Game.Modes.Objects.Legacy.Osu { /// - /// Legacy Slider-type, used for parsing Beatmaps. + /// Legacy osu! Slider-type, used for parsing Beatmaps. /// internal sealed class Slider : CurvedHitObject, IHasPosition, IHasCombo { diff --git a/osu.Game/Modes/Objects/Legacy/Osu/Spinner.cs b/osu.Game/Modes/Objects/Legacy/Osu/Spinner.cs index 8da93428c4..c1c2b34b7c 100644 --- a/osu.Game/Modes/Objects/Legacy/Osu/Spinner.cs +++ b/osu.Game/Modes/Objects/Legacy/Osu/Spinner.cs @@ -7,9 +7,9 @@ using OpenTK; namespace osu.Game.Modes.Objects.Legacy.Osu { /// - /// Legacy Spinner-type, used for parsing Beatmaps. + /// Legacy osu! Spinner-type, used for parsing Beatmaps. /// - internal class Spinner : HitObject, IHasEndTime, IHasPosition + internal sealed class Spinner : HitObject, IHasEndTime, IHasPosition { public double EndTime { get; set; } diff --git a/osu.Game/Modes/Objects/Legacy/Taiko/Hit.cs b/osu.Game/Modes/Objects/Legacy/Taiko/Hit.cs index 7d0f7d88ee..73f9b67630 100644 --- a/osu.Game/Modes/Objects/Legacy/Taiko/Hit.cs +++ b/osu.Game/Modes/Objects/Legacy/Taiko/Hit.cs @@ -6,7 +6,7 @@ using osu.Game.Modes.Objects.Types; namespace osu.Game.Modes.Objects.Legacy.Taiko { /// - /// Legacy Hit-type, used for parsing Beatmaps. + /// Legacy osu!taiko Hit-type, used for parsing Beatmaps. /// internal sealed class Hit : HitObject, IHasCombo { diff --git a/osu.Game/Modes/Objects/Legacy/Taiko/HitObjectParser.cs b/osu.Game/Modes/Objects/Legacy/Taiko/HitObjectParser.cs index 6f98dad58d..80b5b9d1cb 100644 --- a/osu.Game/Modes/Objects/Legacy/Taiko/HitObjectParser.cs +++ b/osu.Game/Modes/Objects/Legacy/Taiko/HitObjectParser.cs @@ -7,6 +7,9 @@ using System.Collections.Generic; namespace osu.Game.Modes.Objects.Legacy.Taiko { + /// + /// A HitObjectParser to parse legacy osu!taiko Beatmaps. + /// internal class HitObjectParser : Legacy.HitObjectParser { protected override HitObject CreateHit(Vector2 position, bool newCombo) diff --git a/osu.Game/Modes/Objects/Legacy/Taiko/Slider.cs b/osu.Game/Modes/Objects/Legacy/Taiko/Slider.cs index ac7c7cb89e..b173101fce 100644 --- a/osu.Game/Modes/Objects/Legacy/Taiko/Slider.cs +++ b/osu.Game/Modes/Objects/Legacy/Taiko/Slider.cs @@ -6,7 +6,7 @@ using osu.Game.Modes.Objects.Types; namespace osu.Game.Modes.Objects.Legacy.Taiko { /// - /// Legacy Slider-type, used for parsing Beatmaps. + /// Legacy osu!taiko Slider-type, used for parsing Beatmaps. /// internal sealed class Slider : CurvedHitObject, IHasCombo { diff --git a/osu.Game/Modes/Objects/Legacy/Taiko/Spinner.cs b/osu.Game/Modes/Objects/Legacy/Taiko/Spinner.cs index 62d827c435..b22f4600c9 100644 --- a/osu.Game/Modes/Objects/Legacy/Taiko/Spinner.cs +++ b/osu.Game/Modes/Objects/Legacy/Taiko/Spinner.cs @@ -6,9 +6,9 @@ using osu.Game.Modes.Objects.Types; namespace osu.Game.Modes.Objects.Legacy.Taiko { /// - /// Legacy Spinner-type, used for parsing Beatmaps. + /// Legacy osu!taiko Spinner-type, used for parsing Beatmaps. /// - internal class Spinner : HitObject, IHasEndTime + internal sealed class Spinner : HitObject, IHasEndTime { public double EndTime { get; set; } diff --git a/osu.Game/Modes/Objects/Types/IHasColumn.cs b/osu.Game/Modes/Objects/Types/IHasColumn.cs index b446d9db53..7609a26773 100644 --- a/osu.Game/Modes/Objects/Types/IHasColumn.cs +++ b/osu.Game/Modes/Objects/Types/IHasColumn.cs @@ -3,8 +3,14 @@ namespace osu.Game.Modes.Objects.Types { + /// + /// A HitObject that lies in a column space. + /// public interface IHasColumn { + /// + /// The column which this HitObject lies in. + /// int Column { get; } } } diff --git a/osu.Game/Modes/Objects/Types/IHasXPosition.cs b/osu.Game/Modes/Objects/Types/IHasXPosition.cs index 03a562c8b7..1f75625e93 100644 --- a/osu.Game/Modes/Objects/Types/IHasXPosition.cs +++ b/osu.Game/Modes/Objects/Types/IHasXPosition.cs @@ -9,6 +9,9 @@ namespace osu.Game.Modes.Objects.Types /// public interface IHasXPosition { + /// + /// The starting X-position of this HitObject. + /// float X { get; } } } diff --git a/osu.Game/Modes/Objects/Types/IHasYPosition.cs b/osu.Game/Modes/Objects/Types/IHasYPosition.cs index 38ddd3bdf5..f746acb939 100644 --- a/osu.Game/Modes/Objects/Types/IHasYPosition.cs +++ b/osu.Game/Modes/Objects/Types/IHasYPosition.cs @@ -9,6 +9,9 @@ namespace osu.Game.Modes.Objects.Types /// public interface IHasYPosition { + /// + /// The starting Y-position of this HitObject. + /// float Y { get; } } } From 456aee63caa50e04e809af0eb31aaa9520f98f37 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 18 Apr 2017 09:32:22 +0900 Subject: [PATCH 215/442] Mode IBeatmapConverter and IBeatmapProcessor to osu.Game.Modes.Beatmaps namespace. --- osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs | 1 + osu.Game.Modes.Catch/Beatmaps/CatchBeatmapProcessor.cs | 1 + osu.Game.Modes.Catch/CatchDifficultyCalculator.cs | 1 + osu.Game.Modes.Catch/UI/CatchHitRenderer.cs | 1 + osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs | 1 + osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapProcessor.cs | 1 + osu.Game.Modes.Mania/ManiaDifficultyCalculator.cs | 1 + osu.Game.Modes.Mania/UI/ManiaHitRenderer.cs | 1 + osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs | 1 + osu.Game.Modes.Osu/Beatmaps/OsuBeatmapProcessor.cs | 1 + osu.Game.Modes.Osu/OsuDifficultyCalculator.cs | 1 + osu.Game.Modes.Osu/UI/OsuHitRenderer.cs | 1 + osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs | 1 + osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapProcessor.cs | 1 + osu.Game.Modes.Taiko/TaikoDifficultyCalculator.cs | 1 + osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs | 1 + osu.Game/Beatmaps/DifficultyCalculator.cs | 1 + osu.Game/{ => Modes}/Beatmaps/IBeatmapConverter.cs | 3 ++- osu.Game/{ => Modes}/Beatmaps/IBeatmapProcessor.cs | 3 ++- osu.Game/Modes/UI/HitRenderer.cs | 1 + osu.Game/osu.Game.csproj | 4 ++-- 21 files changed, 24 insertions(+), 4 deletions(-) rename osu.Game/{ => Modes}/Beatmaps/IBeatmapConverter.cs (94%) rename osu.Game/{ => Modes}/Beatmaps/IBeatmapProcessor.cs (90%) diff --git a/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs b/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs index 59991af3ce..e82b3f46ec 100644 --- a/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs +++ b/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs @@ -6,6 +6,7 @@ using osu.Game.Modes.Catch.Objects; using System.Collections.Generic; using System; using osu.Game.Modes.Objects.Types; +using osu.Game.Modes.Beatmaps; namespace osu.Game.Modes.Catch.Beatmaps { diff --git a/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapProcessor.cs b/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapProcessor.cs index ef585e2675..83e179dfce 100644 --- a/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapProcessor.cs +++ b/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapProcessor.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Beatmaps; +using osu.Game.Modes.Beatmaps; using osu.Game.Modes.Catch.Objects; namespace osu.Game.Modes.Catch.Beatmaps diff --git a/osu.Game.Modes.Catch/CatchDifficultyCalculator.cs b/osu.Game.Modes.Catch/CatchDifficultyCalculator.cs index 53c6f5c2ce..46f89b5575 100644 --- a/osu.Game.Modes.Catch/CatchDifficultyCalculator.cs +++ b/osu.Game.Modes.Catch/CatchDifficultyCalculator.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Beatmaps; +using osu.Game.Modes.Beatmaps; using osu.Game.Modes.Catch.Beatmaps; using osu.Game.Modes.Catch.Objects; using System.Collections.Generic; diff --git a/osu.Game.Modes.Catch/UI/CatchHitRenderer.cs b/osu.Game.Modes.Catch/UI/CatchHitRenderer.cs index 90bd61a39f..5b5f7ff2eb 100644 --- a/osu.Game.Modes.Catch/UI/CatchHitRenderer.cs +++ b/osu.Game.Modes.Catch/UI/CatchHitRenderer.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Beatmaps; +using osu.Game.Modes.Beatmaps; using osu.Game.Modes.Catch.Beatmaps; using osu.Game.Modes.Catch.Judgements; using osu.Game.Modes.Catch.Objects; diff --git a/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs index bbe39e6772..188679d47c 100644 --- a/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -6,6 +6,7 @@ using osu.Game.Modes.Mania.Objects; using System.Collections.Generic; using System; using osu.Game.Modes.Objects.Types; +using osu.Game.Modes.Beatmaps; namespace osu.Game.Modes.Mania.Beatmaps { diff --git a/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapProcessor.cs b/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapProcessor.cs index 5e85a8f864..a25f5652fc 100644 --- a/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapProcessor.cs +++ b/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapProcessor.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Beatmaps; +using osu.Game.Modes.Beatmaps; using osu.Game.Modes.Mania.Objects; namespace osu.Game.Modes.Mania.Beatmaps diff --git a/osu.Game.Modes.Mania/ManiaDifficultyCalculator.cs b/osu.Game.Modes.Mania/ManiaDifficultyCalculator.cs index 02a5a3acdc..629c5a3374 100644 --- a/osu.Game.Modes.Mania/ManiaDifficultyCalculator.cs +++ b/osu.Game.Modes.Mania/ManiaDifficultyCalculator.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Beatmaps; +using osu.Game.Modes.Beatmaps; using osu.Game.Modes.Mania.Beatmaps; using osu.Game.Modes.Mania.Objects; using System.Collections.Generic; diff --git a/osu.Game.Modes.Mania/UI/ManiaHitRenderer.cs b/osu.Game.Modes.Mania/UI/ManiaHitRenderer.cs index 0415bc961a..9cee3bff87 100644 --- a/osu.Game.Modes.Mania/UI/ManiaHitRenderer.cs +++ b/osu.Game.Modes.Mania/UI/ManiaHitRenderer.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Beatmaps; +using osu.Game.Modes.Beatmaps; using osu.Game.Modes.Mania.Beatmaps; using osu.Game.Modes.Mania.Judgements; using osu.Game.Modes.Mania.Objects; diff --git a/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs b/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs index d5d02f9eda..abb18e8236 100644 --- a/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs +++ b/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs @@ -10,6 +10,7 @@ using System.Collections.Generic; using osu.Game.Modes.Objects.Types; using System.Linq; using System; +using osu.Game.Modes.Beatmaps; namespace osu.Game.Modes.Osu.Beatmaps { diff --git a/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapProcessor.cs b/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapProcessor.cs index 08c9d94141..df8fb58f9e 100644 --- a/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapProcessor.cs +++ b/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapProcessor.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Beatmaps; +using osu.Game.Modes.Beatmaps; using osu.Game.Modes.Osu.Objects; namespace osu.Game.Modes.Osu.Beatmaps diff --git a/osu.Game.Modes.Osu/OsuDifficultyCalculator.cs b/osu.Game.Modes.Osu/OsuDifficultyCalculator.cs index 7696638082..9b4c6875c8 100644 --- a/osu.Game.Modes.Osu/OsuDifficultyCalculator.cs +++ b/osu.Game.Modes.Osu/OsuDifficultyCalculator.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Beatmaps; +using osu.Game.Modes.Beatmaps; using osu.Game.Modes.Objects.Types; using osu.Game.Modes.Osu.Beatmaps; using osu.Game.Modes.Osu.Objects; diff --git a/osu.Game.Modes.Osu/UI/OsuHitRenderer.cs b/osu.Game.Modes.Osu/UI/OsuHitRenderer.cs index 7e314c5ba1..0e7772bc11 100644 --- a/osu.Game.Modes.Osu/UI/OsuHitRenderer.cs +++ b/osu.Game.Modes.Osu/UI/OsuHitRenderer.cs @@ -3,6 +3,7 @@ using OpenTK; using osu.Game.Beatmaps; +using osu.Game.Modes.Beatmaps; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Osu.Beatmaps; using osu.Game.Modes.Osu.Judgements; diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index a56ca43805..25aa296eb7 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -11,6 +11,7 @@ using System.Linq; using osu.Game.Database; using osu.Game.IO.Serialization; using osu.Game.Audio; +using osu.Game.Modes.Beatmaps; namespace osu.Game.Modes.Taiko.Beatmaps { diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapProcessor.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapProcessor.cs index 84bc470e55..6f162c2816 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapProcessor.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapProcessor.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Beatmaps; +using osu.Game.Modes.Beatmaps; using osu.Game.Modes.Taiko.Objects; namespace osu.Game.Modes.Taiko.Beatmaps diff --git a/osu.Game.Modes.Taiko/TaikoDifficultyCalculator.cs b/osu.Game.Modes.Taiko/TaikoDifficultyCalculator.cs index 93dfc3d651..3cc0536fd3 100644 --- a/osu.Game.Modes.Taiko/TaikoDifficultyCalculator.cs +++ b/osu.Game.Modes.Taiko/TaikoDifficultyCalculator.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Beatmaps; +using osu.Game.Modes.Beatmaps; using osu.Game.Modes.Taiko.Beatmaps; using osu.Game.Modes.Taiko.Objects; using System.Collections.Generic; diff --git a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs b/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs index 32476dff7f..6ed43afe7d 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs @@ -18,6 +18,7 @@ using osu.Game.Modes.Taiko.Scoring; using osu.Game.Modes.UI; using osu.Game.Modes.Taiko.Replays; using OpenTK; +using osu.Game.Modes.Beatmaps; namespace osu.Game.Modes.Taiko.UI { diff --git a/osu.Game/Beatmaps/DifficultyCalculator.cs b/osu.Game/Beatmaps/DifficultyCalculator.cs index a9da5c589c..48fdf250f0 100644 --- a/osu.Game/Beatmaps/DifficultyCalculator.cs +++ b/osu.Game/Beatmaps/DifficultyCalculator.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Game.Modes.Beatmaps; using osu.Game.Modes.Objects; using System.Collections.Generic; diff --git a/osu.Game/Beatmaps/IBeatmapConverter.cs b/osu.Game/Modes/Beatmaps/IBeatmapConverter.cs similarity index 94% rename from osu.Game/Beatmaps/IBeatmapConverter.cs rename to osu.Game/Modes/Beatmaps/IBeatmapConverter.cs index 948e55967e..cfc27c5bdb 100644 --- a/osu.Game/Beatmaps/IBeatmapConverter.cs +++ b/osu.Game/Modes/Beatmaps/IBeatmapConverter.cs @@ -5,8 +5,9 @@ using System; using System.Collections.Generic; using System.Linq; using osu.Game.Modes.Objects; +using osu.Game.Beatmaps; -namespace osu.Game.Beatmaps +namespace osu.Game.Modes.Beatmaps { /// /// Converts a Beatmap for another mode. diff --git a/osu.Game/Beatmaps/IBeatmapProcessor.cs b/osu.Game/Modes/Beatmaps/IBeatmapProcessor.cs similarity index 90% rename from osu.Game/Beatmaps/IBeatmapProcessor.cs rename to osu.Game/Modes/Beatmaps/IBeatmapProcessor.cs index 9157a760b1..c40e7d1c41 100644 --- a/osu.Game/Beatmaps/IBeatmapProcessor.cs +++ b/osu.Game/Modes/Beatmaps/IBeatmapProcessor.cs @@ -1,9 +1,10 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Game.Beatmaps; using osu.Game.Modes.Objects; -namespace osu.Game.Beatmaps +namespace osu.Game.Modes.Beatmaps { /// /// Processes a post-converted Beatmap. diff --git a/osu.Game/Modes/UI/HitRenderer.cs b/osu.Game/Modes/UI/HitRenderer.cs index 98a6c35135..7ccd29a977 100644 --- a/osu.Game/Modes/UI/HitRenderer.cs +++ b/osu.Game/Modes/UI/HitRenderer.cs @@ -17,6 +17,7 @@ using System.Linq; using osu.Game.Modes.Replays; using osu.Game.Modes.Scoring; using OpenTK; +using osu.Game.Modes.Beatmaps; namespace osu.Game.Modes.UI { diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index f259a37bb0..84589e53a1 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -72,8 +72,8 @@ - - + + From efc050a95a3e69f15dca5c7d7af70a7c0633170c Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 18 Apr 2017 09:38:52 +0900 Subject: [PATCH 216/442] Make IBeatmapConverter an abstract class instead of an interface. --- .../Beatmaps/CatchBeatmapConverter.cs | 6 +++--- osu.Game.Modes.Catch/CatchDifficultyCalculator.cs | 2 +- osu.Game.Modes.Catch/UI/CatchHitRenderer.cs | 2 +- .../Beatmaps/ManiaBeatmapConverter.cs | 6 +++--- osu.Game.Modes.Mania/ManiaDifficultyCalculator.cs | 2 +- osu.Game.Modes.Mania/UI/ManiaHitRenderer.cs | 2 +- .../Beatmaps/OsuBeatmapConverter.cs | 6 +++--- osu.Game.Modes.Osu/OsuDifficultyCalculator.cs | 2 +- osu.Game.Modes.Osu/UI/OsuHitRenderer.cs | 2 +- .../Beatmaps/TaikoBeatmapConverter.cs | 6 +++--- osu.Game.Modes.Taiko/TaikoDifficultyCalculator.cs | 2 +- osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs | 2 +- osu.Game/Beatmaps/DifficultyCalculator.cs | 2 +- .../{IBeatmapConverter.cs => BeatmapConverter.cs} | 15 +++++---------- osu.Game/Modes/UI/HitRenderer.cs | 4 ++-- osu.Game/osu.Game.csproj | 2 +- 16 files changed, 29 insertions(+), 34 deletions(-) rename osu.Game/Modes/Beatmaps/{IBeatmapConverter.cs => BeatmapConverter.cs} (63%) diff --git a/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs b/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs index e82b3f46ec..3b7b1c3a29 100644 --- a/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs +++ b/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs @@ -10,11 +10,11 @@ using osu.Game.Modes.Beatmaps; namespace osu.Game.Modes.Catch.Beatmaps { - internal class CatchBeatmapConverter : IBeatmapConverter + internal class CatchBeatmapConverter : BeatmapConverter { - public IEnumerable ValidConversionTypes { get; } = new[] { typeof(IHasXPosition) }; + public override IEnumerable ValidConversionTypes { get; } = new[] { typeof(IHasXPosition) }; - public Beatmap Convert(Beatmap original) + public override Beatmap Convert(Beatmap original) { return new Beatmap(original) { diff --git a/osu.Game.Modes.Catch/CatchDifficultyCalculator.cs b/osu.Game.Modes.Catch/CatchDifficultyCalculator.cs index 46f89b5575..7e47db6259 100644 --- a/osu.Game.Modes.Catch/CatchDifficultyCalculator.cs +++ b/osu.Game.Modes.Catch/CatchDifficultyCalculator.cs @@ -20,6 +20,6 @@ namespace osu.Game.Modes.Catch return 0; } - protected override IBeatmapConverter CreateBeatmapConverter() => new CatchBeatmapConverter(); + protected override BeatmapConverter CreateBeatmapConverter() => new CatchBeatmapConverter(); } } \ No newline at end of file diff --git a/osu.Game.Modes.Catch/UI/CatchHitRenderer.cs b/osu.Game.Modes.Catch/UI/CatchHitRenderer.cs index 5b5f7ff2eb..4b2a93977f 100644 --- a/osu.Game.Modes.Catch/UI/CatchHitRenderer.cs +++ b/osu.Game.Modes.Catch/UI/CatchHitRenderer.cs @@ -22,7 +22,7 @@ namespace osu.Game.Modes.Catch.UI public override ScoreProcessor CreateScoreProcessor() => new CatchScoreProcessor(this); - protected override IBeatmapConverter CreateBeatmapConverter() => new CatchBeatmapConverter(); + protected override BeatmapConverter CreateBeatmapConverter() => new CatchBeatmapConverter(); protected override IBeatmapProcessor CreateBeatmapProcessor() => new CatchBeatmapProcessor(); diff --git a/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs index 188679d47c..6dbf4af6b1 100644 --- a/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -10,11 +10,11 @@ using osu.Game.Modes.Beatmaps; namespace osu.Game.Modes.Mania.Beatmaps { - internal class ManiaBeatmapConverter : IBeatmapConverter + internal class ManiaBeatmapConverter : BeatmapConverter { - public IEnumerable ValidConversionTypes { get; } = new[] { typeof(IHasColumn) }; + public override IEnumerable ValidConversionTypes { get; } = new[] { typeof(IHasColumn) }; - public Beatmap Convert(Beatmap original) + public override Beatmap Convert(Beatmap original) { return new Beatmap(original) { diff --git a/osu.Game.Modes.Mania/ManiaDifficultyCalculator.cs b/osu.Game.Modes.Mania/ManiaDifficultyCalculator.cs index 629c5a3374..84e5ee2d72 100644 --- a/osu.Game.Modes.Mania/ManiaDifficultyCalculator.cs +++ b/osu.Game.Modes.Mania/ManiaDifficultyCalculator.cs @@ -21,6 +21,6 @@ namespace osu.Game.Modes.Mania return 0; } - protected override IBeatmapConverter CreateBeatmapConverter() => new ManiaBeatmapConverter(); + protected override BeatmapConverter CreateBeatmapConverter() => new ManiaBeatmapConverter(); } } \ No newline at end of file diff --git a/osu.Game.Modes.Mania/UI/ManiaHitRenderer.cs b/osu.Game.Modes.Mania/UI/ManiaHitRenderer.cs index 9cee3bff87..6bc8ab0788 100644 --- a/osu.Game.Modes.Mania/UI/ManiaHitRenderer.cs +++ b/osu.Game.Modes.Mania/UI/ManiaHitRenderer.cs @@ -25,7 +25,7 @@ namespace osu.Game.Modes.Mania.UI public override ScoreProcessor CreateScoreProcessor() => new ManiaScoreProcessor(this); - protected override IBeatmapConverter CreateBeatmapConverter() => new ManiaBeatmapConverter(); + protected override BeatmapConverter CreateBeatmapConverter() => new ManiaBeatmapConverter(); protected override IBeatmapProcessor CreateBeatmapProcessor() => new ManiaBeatmapProcessor(); diff --git a/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs b/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs index abb18e8236..dd8dde5530 100644 --- a/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs +++ b/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs @@ -14,11 +14,11 @@ using osu.Game.Modes.Beatmaps; namespace osu.Game.Modes.Osu.Beatmaps { - internal class OsuBeatmapConverter : IBeatmapConverter + internal class OsuBeatmapConverter : BeatmapConverter { - public IEnumerable ValidConversionTypes { get; } = new[] { typeof(IHasPosition) }; + public override IEnumerable ValidConversionTypes { get; } = new[] { typeof(IHasPosition) }; - public Beatmap Convert(Beatmap original) + public override Beatmap Convert(Beatmap original) { return new Beatmap(original) { diff --git a/osu.Game.Modes.Osu/OsuDifficultyCalculator.cs b/osu.Game.Modes.Osu/OsuDifficultyCalculator.cs index 9b4c6875c8..f3ef47fe27 100644 --- a/osu.Game.Modes.Osu/OsuDifficultyCalculator.cs +++ b/osu.Game.Modes.Osu/OsuDifficultyCalculator.cs @@ -181,7 +181,7 @@ namespace osu.Game.Modes.Osu return difficulty; } - protected override IBeatmapConverter CreateBeatmapConverter() => new OsuBeatmapConverter(); + protected override BeatmapConverter CreateBeatmapConverter() => new OsuBeatmapConverter(); // Those values are used as array indices. Be careful when changing them! public enum DifficultyType diff --git a/osu.Game.Modes.Osu/UI/OsuHitRenderer.cs b/osu.Game.Modes.Osu/UI/OsuHitRenderer.cs index 0e7772bc11..0f73fcdb19 100644 --- a/osu.Game.Modes.Osu/UI/OsuHitRenderer.cs +++ b/osu.Game.Modes.Osu/UI/OsuHitRenderer.cs @@ -25,7 +25,7 @@ namespace osu.Game.Modes.Osu.UI public override ScoreProcessor CreateScoreProcessor() => new OsuScoreProcessor(this); - protected override IBeatmapConverter CreateBeatmapConverter() => new OsuBeatmapConverter(); + protected override BeatmapConverter CreateBeatmapConverter() => new OsuBeatmapConverter(); protected override IBeatmapProcessor CreateBeatmapProcessor() => new OsuBeatmapProcessor(); diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 25aa296eb7..c7ff225d0a 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -15,7 +15,7 @@ using osu.Game.Modes.Beatmaps; namespace osu.Game.Modes.Taiko.Beatmaps { - internal class TaikoBeatmapConverter : IBeatmapConverter + internal class TaikoBeatmapConverter : BeatmapConverter { /// /// osu! is generally slower than taiko, so a factor is added to increase @@ -39,9 +39,9 @@ namespace osu.Game.Modes.Taiko.Beatmaps /// private const float taiko_base_distance = 100; - public IEnumerable ValidConversionTypes { get; } = new[] { typeof(HitObject) }; + public override IEnumerable ValidConversionTypes { get; } = new[] { typeof(HitObject) }; - public Beatmap Convert(Beatmap original) + public override Beatmap Convert(Beatmap original) { BeatmapInfo info = original.BeatmapInfo.DeepClone(); info.Difficulty.SliderMultiplier *= legacy_velocity_multiplier; diff --git a/osu.Game.Modes.Taiko/TaikoDifficultyCalculator.cs b/osu.Game.Modes.Taiko/TaikoDifficultyCalculator.cs index 3cc0536fd3..453a937b9e 100644 --- a/osu.Game.Modes.Taiko/TaikoDifficultyCalculator.cs +++ b/osu.Game.Modes.Taiko/TaikoDifficultyCalculator.cs @@ -20,6 +20,6 @@ namespace osu.Game.Modes.Taiko return 0; } - protected override IBeatmapConverter CreateBeatmapConverter() => new TaikoBeatmapConverter(); + protected override BeatmapConverter CreateBeatmapConverter() => new TaikoBeatmapConverter(); } } \ No newline at end of file diff --git a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs b/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs index 6ed43afe7d..18cbd30776 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs @@ -115,7 +115,7 @@ namespace osu.Game.Modes.Taiko.UI public override ScoreProcessor CreateScoreProcessor() => new TaikoScoreProcessor(this); - protected override IBeatmapConverter CreateBeatmapConverter() => new TaikoBeatmapConverter(); + protected override BeatmapConverter CreateBeatmapConverter() => new TaikoBeatmapConverter(); protected override IBeatmapProcessor CreateBeatmapProcessor() => new TaikoBeatmapProcessor(); diff --git a/osu.Game/Beatmaps/DifficultyCalculator.cs b/osu.Game/Beatmaps/DifficultyCalculator.cs index 48fdf250f0..911aaa7189 100644 --- a/osu.Game/Beatmaps/DifficultyCalculator.cs +++ b/osu.Game/Beatmaps/DifficultyCalculator.cs @@ -42,6 +42,6 @@ namespace osu.Game.Beatmaps { } - protected abstract IBeatmapConverter CreateBeatmapConverter(); + protected abstract BeatmapConverter CreateBeatmapConverter(); } } diff --git a/osu.Game/Modes/Beatmaps/IBeatmapConverter.cs b/osu.Game/Modes/Beatmaps/BeatmapConverter.cs similarity index 63% rename from osu.Game/Modes/Beatmaps/IBeatmapConverter.cs rename to osu.Game/Modes/Beatmaps/BeatmapConverter.cs index cfc27c5bdb..4a8684864f 100644 --- a/osu.Game/Modes/Beatmaps/IBeatmapConverter.cs +++ b/osu.Game/Modes/Beatmaps/BeatmapConverter.cs @@ -13,30 +13,25 @@ namespace osu.Game.Modes.Beatmaps /// Converts a Beatmap for another mode. /// /// The type of HitObject stored in the Beatmap. - public interface IBeatmapConverter where T : HitObject + public abstract class BeatmapConverter where T : HitObject { /// /// The types of HitObjects that can be converted to be used for this Beatmap. /// - IEnumerable ValidConversionTypes { get; } + public abstract IEnumerable ValidConversionTypes { get; } /// /// Converts a Beatmap to another mode. /// /// The original Beatmap. /// The converted Beatmap. - Beatmap Convert(Beatmap original); - } + public abstract Beatmap Convert(Beatmap original); - public static class BeatmapConverterExtensions - { /// /// Checks if a Beatmap can be converted using this Beatmap Converter. /// - /// The Beatmap Converter. /// The Beatmap to check. - /// Whether the Beatmap can be converted using . - public static bool CanConvert(this IBeatmapConverter converter, Beatmap beatmap) where TObject : HitObject - => converter.ValidConversionTypes.All(t => beatmap.HitObjects.Any(h => t.IsAssignableFrom(h.GetType()))); + /// Whether the Beatmap can be converted using this Beatmap Converter. + public bool CanConvert(Beatmap beatmap) => ValidConversionTypes.All(t => beatmap.HitObjects.Any(h => t.IsAssignableFrom(h.GetType()))); } } diff --git a/osu.Game/Modes/UI/HitRenderer.cs b/osu.Game/Modes/UI/HitRenderer.cs index 7ccd29a977..46d05aa98f 100644 --- a/osu.Game/Modes/UI/HitRenderer.cs +++ b/osu.Game/Modes/UI/HitRenderer.cs @@ -120,7 +120,7 @@ namespace osu.Game.Modes.UI RelativeSizeAxes = Axes.Both; - IBeatmapConverter converter = CreateBeatmapConverter(); + BeatmapConverter converter = CreateBeatmapConverter(); IBeatmapProcessor processor = CreateBeatmapProcessor(); // Check if the beatmap can be converted @@ -158,7 +158,7 @@ namespace osu.Game.Modes.UI /// Creates a converter to convert Beatmap to a specific mode. /// /// The Beatmap converter. - protected abstract IBeatmapConverter CreateBeatmapConverter(); + protected abstract BeatmapConverter CreateBeatmapConverter(); /// /// Creates a processor to perform post-processing operations diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 84589e53a1..770008be5f 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -72,7 +72,7 @@ - + From 0e1ce333e36806e566002316de3f4ea136a6917c Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 18 Apr 2017 09:43:43 +0900 Subject: [PATCH 217/442] Make IBeatmapProcessor a class with virtual methods. --- .../Beatmaps/CatchBeatmapProcessor.cs | 20 ------------------- osu.Game.Modes.Catch/UI/CatchHitRenderer.cs | 2 -- .../osu.Game.Modes.Catch.csproj | 1 - .../Beatmaps/ManiaBeatmapProcessor.cs | 20 ------------------- osu.Game.Modes.Mania/UI/ManiaHitRenderer.cs | 2 -- .../osu.Game.Modes.Mania.csproj | 1 - .../Beatmaps/OsuBeatmapProcessor.cs | 4 ++-- osu.Game.Modes.Osu/UI/OsuHitRenderer.cs | 2 +- .../Beatmaps/TaikoBeatmapProcessor.cs | 20 ------------------- osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs | 2 -- .../osu.Game.Modes.Taiko.csproj | 1 - ...eatmapProcessor.cs => BeatmapProcessor.cs} | 4 ++-- osu.Game/Modes/UI/HitRenderer.cs | 16 +++++++-------- osu.Game/osu.Game.csproj | 2 +- 14 files changed, 14 insertions(+), 83 deletions(-) delete mode 100644 osu.Game.Modes.Catch/Beatmaps/CatchBeatmapProcessor.cs delete mode 100644 osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapProcessor.cs delete mode 100644 osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapProcessor.cs rename osu.Game/Modes/Beatmaps/{IBeatmapProcessor.cs => BeatmapProcessor.cs} (85%) diff --git a/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapProcessor.cs b/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapProcessor.cs deleted file mode 100644 index 83e179dfce..0000000000 --- a/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapProcessor.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Game.Beatmaps; -using osu.Game.Modes.Beatmaps; -using osu.Game.Modes.Catch.Objects; - -namespace osu.Game.Modes.Catch.Beatmaps -{ - internal class CatchBeatmapProcessor : IBeatmapProcessor - { - public void SetDefaults(CatchBaseHit hitObject, Beatmap beatmap) - { - } - - public void PostProcess(Beatmap beatmap) - { - } - } -} diff --git a/osu.Game.Modes.Catch/UI/CatchHitRenderer.cs b/osu.Game.Modes.Catch/UI/CatchHitRenderer.cs index 4b2a93977f..795904935d 100644 --- a/osu.Game.Modes.Catch/UI/CatchHitRenderer.cs +++ b/osu.Game.Modes.Catch/UI/CatchHitRenderer.cs @@ -24,8 +24,6 @@ namespace osu.Game.Modes.Catch.UI protected override BeatmapConverter CreateBeatmapConverter() => new CatchBeatmapConverter(); - protected override IBeatmapProcessor CreateBeatmapProcessor() => new CatchBeatmapProcessor(); - protected override Playfield CreatePlayfield() => new CatchPlayfield(); protected override DrawableHitObject GetVisualRepresentation(CatchBaseHit h) => null; diff --git a/osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj b/osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj index b3e847a5be..dc1ea5dc23 100644 --- a/osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj +++ b/osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj @@ -48,7 +48,6 @@ - diff --git a/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapProcessor.cs b/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapProcessor.cs deleted file mode 100644 index a25f5652fc..0000000000 --- a/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapProcessor.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Game.Beatmaps; -using osu.Game.Modes.Beatmaps; -using osu.Game.Modes.Mania.Objects; - -namespace osu.Game.Modes.Mania.Beatmaps -{ - internal class ManiaBeatmapProcessor : IBeatmapProcessor - { - public void SetDefaults(ManiaBaseHit hitObject, Beatmap beatmap) - { - } - - public void PostProcess(Beatmap beatmap) - { - } - } -} diff --git a/osu.Game.Modes.Mania/UI/ManiaHitRenderer.cs b/osu.Game.Modes.Mania/UI/ManiaHitRenderer.cs index 6bc8ab0788..ada79e992a 100644 --- a/osu.Game.Modes.Mania/UI/ManiaHitRenderer.cs +++ b/osu.Game.Modes.Mania/UI/ManiaHitRenderer.cs @@ -27,8 +27,6 @@ namespace osu.Game.Modes.Mania.UI protected override BeatmapConverter CreateBeatmapConverter() => new ManiaBeatmapConverter(); - protected override IBeatmapProcessor CreateBeatmapProcessor() => new ManiaBeatmapProcessor(); - protected override Playfield CreatePlayfield() => new ManiaPlayfield(columns); protected override DrawableHitObject GetVisualRepresentation(ManiaBaseHit h) => null; diff --git a/osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj b/osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj index 6c666fd6ea..a8366a465f 100644 --- a/osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj +++ b/osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj @@ -48,7 +48,6 @@ - diff --git a/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapProcessor.cs b/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapProcessor.cs index df8fb58f9e..fd506f3493 100644 --- a/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapProcessor.cs +++ b/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapProcessor.cs @@ -7,9 +7,9 @@ using osu.Game.Modes.Osu.Objects; namespace osu.Game.Modes.Osu.Beatmaps { - internal class OsuBeatmapProcessor : IBeatmapProcessor + internal class OsuBeatmapProcessor : BeatmapProcessor { - public void PostProcess(Beatmap beatmap) + public override void PostProcess(Beatmap beatmap) { if (beatmap.ComboColors.Count == 0) return; diff --git a/osu.Game.Modes.Osu/UI/OsuHitRenderer.cs b/osu.Game.Modes.Osu/UI/OsuHitRenderer.cs index 0f73fcdb19..a514ba6358 100644 --- a/osu.Game.Modes.Osu/UI/OsuHitRenderer.cs +++ b/osu.Game.Modes.Osu/UI/OsuHitRenderer.cs @@ -27,7 +27,7 @@ namespace osu.Game.Modes.Osu.UI protected override BeatmapConverter CreateBeatmapConverter() => new OsuBeatmapConverter(); - protected override IBeatmapProcessor CreateBeatmapProcessor() => new OsuBeatmapProcessor(); + protected override BeatmapProcessor CreateBeatmapProcessor() => new OsuBeatmapProcessor(); protected override Playfield CreatePlayfield() => new OsuPlayfield(); diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapProcessor.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapProcessor.cs deleted file mode 100644 index 6f162c2816..0000000000 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapProcessor.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Game.Beatmaps; -using osu.Game.Modes.Beatmaps; -using osu.Game.Modes.Taiko.Objects; - -namespace osu.Game.Modes.Taiko.Beatmaps -{ - internal class TaikoBeatmapProcessor : IBeatmapProcessor - { - public void SetDefaults(TaikoHitObject hitObject, Beatmap beatmap) - { - } - - public void PostProcess(Beatmap beatmap) - { - } - } -} diff --git a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs b/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs index 18cbd30776..48d4457a53 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs @@ -117,8 +117,6 @@ namespace osu.Game.Modes.Taiko.UI protected override BeatmapConverter CreateBeatmapConverter() => new TaikoBeatmapConverter(); - protected override IBeatmapProcessor CreateBeatmapProcessor() => new TaikoBeatmapProcessor(); - protected override Playfield CreatePlayfield() => new TaikoPlayfield { Anchor = Anchor.CentreLeft, diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index 03137802d4..ee7cb73431 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -48,7 +48,6 @@ - diff --git a/osu.Game/Modes/Beatmaps/IBeatmapProcessor.cs b/osu.Game/Modes/Beatmaps/BeatmapProcessor.cs similarity index 85% rename from osu.Game/Modes/Beatmaps/IBeatmapProcessor.cs rename to osu.Game/Modes/Beatmaps/BeatmapProcessor.cs index c40e7d1c41..ff675a4e5e 100644 --- a/osu.Game/Modes/Beatmaps/IBeatmapProcessor.cs +++ b/osu.Game/Modes/Beatmaps/BeatmapProcessor.cs @@ -10,7 +10,7 @@ namespace osu.Game.Modes.Beatmaps /// Processes a post-converted Beatmap. /// /// The type of HitObject contained in the Beatmap. - public interface IBeatmapProcessor + public class BeatmapProcessor where TObject : HitObject { /// @@ -20,6 +20,6 @@ namespace osu.Game.Modes.Beatmaps /// /// /// The Beatmap to process. - void PostProcess(Beatmap beatmap); + public virtual void PostProcess(Beatmap beatmap) { } } } diff --git a/osu.Game/Modes/UI/HitRenderer.cs b/osu.Game/Modes/UI/HitRenderer.cs index 46d05aa98f..72b67836f7 100644 --- a/osu.Game/Modes/UI/HitRenderer.cs +++ b/osu.Game/Modes/UI/HitRenderer.cs @@ -121,7 +121,7 @@ namespace osu.Game.Modes.UI RelativeSizeAxes = Axes.Both; BeatmapConverter converter = CreateBeatmapConverter(); - IBeatmapProcessor processor = CreateBeatmapProcessor(); + BeatmapProcessor processor = CreateBeatmapProcessor(); // Check if the beatmap can be converted if (!converter.CanConvert(beatmap.Beatmap)) @@ -154,18 +154,18 @@ namespace osu.Game.Modes.UI mod.Apply(this); } - /// - /// Creates a converter to convert Beatmap to a specific mode. - /// - /// The Beatmap converter. - protected abstract BeatmapConverter CreateBeatmapConverter(); - /// /// Creates a processor to perform post-processing operations /// on HitObjects in converted Beatmaps. /// /// The Beatmap processor. - protected abstract IBeatmapProcessor CreateBeatmapProcessor(); + protected virtual BeatmapProcessor CreateBeatmapProcessor() => new BeatmapProcessor(); + + /// + /// Creates a converter to convert Beatmap to a specific mode. + /// + /// The Beatmap converter. + protected abstract BeatmapConverter CreateBeatmapConverter(); } /// diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 770008be5f..9d1c3e527e 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -73,7 +73,7 @@ - + From 4393c2cb250d00233b1d6373d89e58a4e388883f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 09:46:14 +0900 Subject: [PATCH 218/442] Add unit tests to ensure all rulesets' beatmaps are added successfully. --- osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs index 0c64c47a63..b35f5901be 100644 --- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs @@ -154,7 +154,15 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.IsTrue(set.Beatmaps.Count > 0); var beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 0))?.Beatmap; + Assert.IsTrue(beatmap?.HitObjects.Count > 0); + beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 1))?.Beatmap; + Assert.IsTrue(beatmap?.HitObjects.Count > 0); + + beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 2))?.Beatmap; + Assert.IsTrue(beatmap?.HitObjects.Count > 0); + + beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 3))?.Beatmap; Assert.IsTrue(beatmap?.HitObjects.Count > 0); } } From 2734983564a3fa132242fbe55a794dd124d582ed Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 09:47:16 +0900 Subject: [PATCH 219/442] Add unique constraints on RulesetInfo table to ensure things stay sane. --- osu.Game/Database/RulesetInfo.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Database/RulesetInfo.cs b/osu.Game/Database/RulesetInfo.cs index d7bab39b97..c3c0d4343d 100644 --- a/osu.Game/Database/RulesetInfo.cs +++ b/osu.Game/Database/RulesetInfo.cs @@ -12,8 +12,10 @@ namespace osu.Game.Database [PrimaryKey, AutoIncrement] public int? ID { get; set; } + [Indexed(Unique = true)] public string Name { get; set; } + [Indexed(Unique = true)] public string InstantiationInfo { get; set; } [Indexed] From d3c1520a2d4f851d394b81f49613a25369cbcc53 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 09:47:29 +0900 Subject: [PATCH 220/442] Fix beatmaps not getting the correct ruleset on import. --- osu.Game/Database/BeatmapDatabase.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game/Database/BeatmapDatabase.cs b/osu.Game/Database/BeatmapDatabase.cs index 7789096067..e11ea797ca 100644 --- a/osu.Game/Database/BeatmapDatabase.cs +++ b/osu.Game/Database/BeatmapDatabase.cs @@ -219,10 +219,9 @@ namespace osu.Game.Database beatmap.BeatmapInfo.Metadata = null; // TODO: this should be done in a better place once we actually need to dynamically update it. + beatmap.BeatmapInfo.Ruleset = rulesets.Query().FirstOrDefault(r => r.ID == beatmap.BeatmapInfo.RulesetID); beatmap.BeatmapInfo.StarDifficulty = rulesets.Query().FirstOrDefault(r => r.ID == beatmap.BeatmapInfo.RulesetID)?.CreateInstance()?.CreateDifficultyCalculator(beatmap).Calculate() ?? 0; - beatmap.BeatmapInfo.Ruleset = null; - beatmapSet.Beatmaps.Add(beatmap.BeatmapInfo); } beatmapSet.StoryboardFile = archive.StoryboardFilename; @@ -239,7 +238,7 @@ namespace osu.Game.Database foreach (var s in beatmapSets) { - Connection.InsertWithChildren(s, true); + Connection.InsertOrReplaceWithChildren(s, true); BeatmapSetAdded?.Invoke(s); } From 0cef14ca63d4f23e466ff064c36a914f4f789aac Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 18 Apr 2017 09:51:02 +0900 Subject: [PATCH 221/442] CI fixes. --- osu.Game.Modes.Osu/Objects/OsuHitObject.cs | 1 - osu.Game/Modes/Beatmaps/BeatmapConverter.cs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game.Modes.Osu/Objects/OsuHitObject.cs b/osu.Game.Modes.Osu/Objects/OsuHitObject.cs index 5e45d04390..55fc99e41a 100644 --- a/osu.Game.Modes.Osu/Objects/OsuHitObject.cs +++ b/osu.Game.Modes.Osu/Objects/OsuHitObject.cs @@ -8,7 +8,6 @@ using osu.Game.Modes.Objects.Types; using OpenTK.Graphics; using osu.Game.Beatmaps.Timing; using osu.Game.Database; -using System; namespace osu.Game.Modes.Osu.Objects { diff --git a/osu.Game/Modes/Beatmaps/BeatmapConverter.cs b/osu.Game/Modes/Beatmaps/BeatmapConverter.cs index 4a8684864f..3da1dff001 100644 --- a/osu.Game/Modes/Beatmaps/BeatmapConverter.cs +++ b/osu.Game/Modes/Beatmaps/BeatmapConverter.cs @@ -32,6 +32,6 @@ namespace osu.Game.Modes.Beatmaps /// /// The Beatmap to check. /// Whether the Beatmap can be converted using this Beatmap Converter. - public bool CanConvert(Beatmap beatmap) => ValidConversionTypes.All(t => beatmap.HitObjects.Any(h => t.IsAssignableFrom(h.GetType()))); + public bool CanConvert(Beatmap beatmap) => ValidConversionTypes.All(t => beatmap.HitObjects.Any(h => h.GetType().IsInstanceOfType(t))); } } From f2174054ea0810a1dccb4b88c4760b23d0edfcce Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 10:04:32 +0900 Subject: [PATCH 222/442] Fix song select. --- osu.Game/Database/BeatmapDatabase.cs | 8 +++++--- osu.Game/Screens/Select/BeatmapCarousel.cs | 9 +++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/osu.Game/Database/BeatmapDatabase.cs b/osu.Game/Database/BeatmapDatabase.cs index e11ea797ca..ab2a612176 100644 --- a/osu.Game/Database/BeatmapDatabase.cs +++ b/osu.Game/Database/BeatmapDatabase.cs @@ -271,12 +271,14 @@ namespace osu.Game.Database { var beatmapSetInfo = Query().FirstOrDefault(s => s.ID == beatmapInfo.BeatmapSetInfoID); - //we need metadata - GetChildren(beatmapSetInfo); - if (beatmapSetInfo == null) throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetInfoID} is not in the local database."); + //we need metadata + GetChildren(beatmapSetInfo); + foreach (var b in beatmapSetInfo.Beatmaps) + GetChildren(b); + if (beatmapInfo.Metadata == null) beatmapInfo.Metadata = beatmapSetInfo.Metadata; diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index f104bf9a37..06aaea041a 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -145,7 +145,7 @@ namespace osu.Game.Screens.Select } } - int startIndex = groups.IndexOf(selectedGroup); + int startIndex = Math.Max(0, groups.IndexOf(selectedGroup)); int index = startIndex; do @@ -221,7 +221,12 @@ namespace osu.Game.Screens.Select private BeatmapGroup createGroup(BeatmapSetInfo beatmapSet) { database.GetChildren(beatmapSet); - beatmapSet.Beatmaps.ForEach(b => { if (b.Metadata == null) b.Metadata = beatmapSet.Metadata; }); + beatmapSet.Beatmaps.ForEach(b => + { + database.GetChildren(b); + if (b.Metadata == null) + b.Metadata = beatmapSet.Metadata; + }); return new BeatmapGroup(beatmapSet, database) { From 6b6690caf7989e566318ad949b22dadf83fc6b2f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 10:04:41 +0900 Subject: [PATCH 223/442] Fix filtering by ruleset. --- osu.Game/Screens/Select/FilterCriteria.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/FilterCriteria.cs b/osu.Game/Screens/Select/FilterCriteria.cs index 1a32244deb..11aea3eb4c 100644 --- a/osu.Game/Screens/Select/FilterCriteria.cs +++ b/osu.Game/Screens/Select/FilterCriteria.cs @@ -23,7 +23,7 @@ namespace osu.Game.Screens.Select { var set = g.BeatmapSet; - bool hasCurrentMode = set.Beatmaps.Any(bm => bm.Ruleset == Ruleset); + bool hasCurrentMode = set.Beatmaps.Any(bm => bm.RulesetID == Ruleset.ID); bool match = hasCurrentMode; From 5a78ce15a1718b3cf69e550e9facb74bbb39d1ce Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 18 Apr 2017 10:23:49 +0900 Subject: [PATCH 224/442] Fix CanConvert not returning correctly. --- osu.Game/Modes/Beatmaps/BeatmapConverter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Modes/Beatmaps/BeatmapConverter.cs b/osu.Game/Modes/Beatmaps/BeatmapConverter.cs index 3da1dff001..d08eff6583 100644 --- a/osu.Game/Modes/Beatmaps/BeatmapConverter.cs +++ b/osu.Game/Modes/Beatmaps/BeatmapConverter.cs @@ -32,6 +32,6 @@ namespace osu.Game.Modes.Beatmaps /// /// The Beatmap to check. /// Whether the Beatmap can be converted using this Beatmap Converter. - public bool CanConvert(Beatmap beatmap) => ValidConversionTypes.All(t => beatmap.HitObjects.Any(h => h.GetType().IsInstanceOfType(t))); + public bool CanConvert(Beatmap beatmap) => ValidConversionTypes.All(t => beatmap.HitObjects.Any(h => t.IsInstanceOfType(h))); } } From 3b9067e55e4f06015754e9f6fd165d5c947e8efb Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 18 Apr 2017 10:41:26 +0900 Subject: [PATCH 225/442] Convert chords to strong hits for osu!mania conversion. --- osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index c7ff225d0a..abba5316bb 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -49,7 +49,13 @@ namespace osu.Game.Modes.Taiko.Beatmaps return new Beatmap(original) { BeatmapInfo = info, - HitObjects = original.HitObjects.SelectMany(h => convertHitObject(h, original)).ToList() + HitObjects = original.HitObjects.SelectMany(h => convertHitObject(h, original)).GroupBy(t => t.StartTime).Select(x => + { + TaikoHitObject first = x.First(); + if (x.Skip(1).Any()) + first.IsStrong = true; + return first; + }).ToList() }; } From 5939ba9143cf410e32ce2d9b1cd9b3b4d59b34a9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 10:55:33 +0900 Subject: [PATCH 226/442] Fix ruleset not always being initialised correctly. --- osu.Desktop.VisualTests/Tests/TestCasePlayer.cs | 2 +- osu.Game/Database/BeatmapDatabase.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs index a21c09a9d0..8c3ac526f6 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs @@ -39,7 +39,7 @@ namespace osu.Desktop.VisualTests.Tests WorkingBeatmap beatmap = null; - var beatmapInfo = db.Query().FirstOrDefault(b => b.Ruleset.CreateInstance() is OsuRuleset); + var beatmapInfo = db.Query().FirstOrDefault(b => b.RulesetID == 0); if (beatmapInfo != null) beatmap = db.GetWorkingBeatmap(beatmapInfo); diff --git a/osu.Game/Database/BeatmapDatabase.cs b/osu.Game/Database/BeatmapDatabase.cs index ab2a612176..0e814dea82 100644 --- a/osu.Game/Database/BeatmapDatabase.cs +++ b/osu.Game/Database/BeatmapDatabase.cs @@ -276,8 +276,8 @@ namespace osu.Game.Database //we need metadata GetChildren(beatmapSetInfo); - foreach (var b in beatmapSetInfo.Beatmaps) - GetChildren(b); + //we also need a ruleset + GetChildren(beatmapInfo); if (beatmapInfo.Metadata == null) beatmapInfo.Metadata = beatmapSetInfo.Metadata; From 8ef675d9b3dab2730535eed3124b2737e9d1aac3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 10:55:45 +0900 Subject: [PATCH 227/442] Add fallback to allow FilterCriteria to run without a ruleset being set. --- osu.Game/Screens/Select/FilterCriteria.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/FilterCriteria.cs b/osu.Game/Screens/Select/FilterCriteria.cs index 11aea3eb4c..d49c7296ba 100644 --- a/osu.Game/Screens/Select/FilterCriteria.cs +++ b/osu.Game/Screens/Select/FilterCriteria.cs @@ -23,7 +23,7 @@ namespace osu.Game.Screens.Select { var set = g.BeatmapSet; - bool hasCurrentMode = set.Beatmaps.Any(bm => bm.RulesetID == Ruleset.ID); + bool hasCurrentMode = set.Beatmaps.Any(bm => bm.RulesetID == (Ruleset?.ID ?? 0)); bool match = hasCurrentMode; From 7d3a1c5658393f3ec8b50a9ee581752174b659df Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 10:59:50 +0900 Subject: [PATCH 228/442] Remove using. --- osu.Desktop.VisualTests/Tests/TestCasePlayer.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs index 8c3ac526f6..8e19419dbb 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs @@ -14,7 +14,6 @@ using osu.Game.Modes.Osu.Objects; using osu.Game.Screens.Play; using OpenTK.Graphics; using osu.Desktop.VisualTests.Beatmaps; -using osu.Game.Modes.Osu; namespace osu.Desktop.VisualTests.Tests { From d04353aed0652c9ec61bdf7e6c676e2e0711c6d0 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 18 Apr 2017 11:13:11 +0900 Subject: [PATCH 229/442] Legacy mania hit objects don't have a "column", this should be determined by the beatmap converter. --- .../Beatmaps/ManiaBeatmapConverter.cs | 2 +- osu.Game/Modes/Objects/Legacy/Mania/Hit.cs | 4 ++-- .../Objects/Legacy/Mania/HitObjectParser.cs | 3 +++ osu.Game/Modes/Objects/Legacy/Mania/Slider.cs | 4 ++-- osu.Game/Modes/Objects/Legacy/Mania/Spinner.cs | 4 ++-- osu.Game/Modes/Objects/Types/IHasColumn.cs | 16 ---------------- osu.Game/osu.Game.csproj | 1 - 7 files changed, 10 insertions(+), 24 deletions(-) delete mode 100644 osu.Game/Modes/Objects/Types/IHasColumn.cs diff --git a/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs index 6dbf4af6b1..d8ea7f322d 100644 --- a/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -12,7 +12,7 @@ namespace osu.Game.Modes.Mania.Beatmaps { internal class ManiaBeatmapConverter : BeatmapConverter { - public override IEnumerable ValidConversionTypes { get; } = new[] { typeof(IHasColumn) }; + public override IEnumerable ValidConversionTypes { get; } = new[] { typeof(IHasXPosition) }; public override Beatmap Convert(Beatmap original) { diff --git a/osu.Game/Modes/Objects/Legacy/Mania/Hit.cs b/osu.Game/Modes/Objects/Legacy/Mania/Hit.cs index acf9777fbf..3131bbd89d 100644 --- a/osu.Game/Modes/Objects/Legacy/Mania/Hit.cs +++ b/osu.Game/Modes/Objects/Legacy/Mania/Hit.cs @@ -8,9 +8,9 @@ namespace osu.Game.Modes.Objects.Legacy.Mania /// /// Legacy osu!mania Hit-type, used for parsing Beatmaps. /// - internal sealed class Hit : HitObject, IHasColumn, IHasCombo + internal sealed class Hit : HitObject, IHasXPosition, IHasCombo { - public int Column { get; set; } + public float X { get; set; } public bool NewCombo { get; set; } } diff --git a/osu.Game/Modes/Objects/Legacy/Mania/HitObjectParser.cs b/osu.Game/Modes/Objects/Legacy/Mania/HitObjectParser.cs index 7ef923633c..1ef01a06b9 100644 --- a/osu.Game/Modes/Objects/Legacy/Mania/HitObjectParser.cs +++ b/osu.Game/Modes/Objects/Legacy/Mania/HitObjectParser.cs @@ -16,6 +16,7 @@ namespace osu.Game.Modes.Objects.Legacy.Mania { return new Hit { + X = position.X, NewCombo = newCombo, }; } @@ -24,6 +25,7 @@ namespace osu.Game.Modes.Objects.Legacy.Mania { return new Slider { + X = position.X, NewCombo = newCombo, ControlPoints = controlPoints, Distance = length, @@ -36,6 +38,7 @@ namespace osu.Game.Modes.Objects.Legacy.Mania { return new Spinner { + X = position.X, EndTime = endTime }; } diff --git a/osu.Game/Modes/Objects/Legacy/Mania/Slider.cs b/osu.Game/Modes/Objects/Legacy/Mania/Slider.cs index f320ac1d59..bf8eaa561a 100644 --- a/osu.Game/Modes/Objects/Legacy/Mania/Slider.cs +++ b/osu.Game/Modes/Objects/Legacy/Mania/Slider.cs @@ -8,9 +8,9 @@ namespace osu.Game.Modes.Objects.Legacy.Mania /// /// Legacy osu!mania Slider-type, used for parsing Beatmaps. /// - internal sealed class Slider : CurvedHitObject, IHasColumn, IHasCombo + internal sealed class Slider : CurvedHitObject, IHasXPosition, IHasCombo { - public int Column { get; set; } + public float X { get; set; } public bool NewCombo { get; set; } } diff --git a/osu.Game/Modes/Objects/Legacy/Mania/Spinner.cs b/osu.Game/Modes/Objects/Legacy/Mania/Spinner.cs index 1df5907860..8183f1129b 100644 --- a/osu.Game/Modes/Objects/Legacy/Mania/Spinner.cs +++ b/osu.Game/Modes/Objects/Legacy/Mania/Spinner.cs @@ -8,12 +8,12 @@ namespace osu.Game.Modes.Objects.Legacy.Mania /// /// Legacy osu!mania Spinner-type, used for parsing Beatmaps. /// - internal sealed class Spinner : HitObject, IHasEndTime, IHasColumn + internal sealed class Spinner : HitObject, IHasEndTime, IHasXPosition { public double EndTime { get; set; } public double Duration => EndTime - StartTime; - public int Column { get; set; } + public float X { get; set; } } } diff --git a/osu.Game/Modes/Objects/Types/IHasColumn.cs b/osu.Game/Modes/Objects/Types/IHasColumn.cs deleted file mode 100644 index 7609a26773..0000000000 --- a/osu.Game/Modes/Objects/Types/IHasColumn.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -namespace osu.Game.Modes.Objects.Types -{ - /// - /// A HitObject that lies in a column space. - /// - public interface IHasColumn - { - /// - /// The column which this HitObject lies in. - /// - int Column { get; } - } -} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 9d1c3e527e..05fd0502ab 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -117,7 +117,6 @@ - From 8844ff7ab79ff2c68f5940192e6fb3e4ad08dfd7 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 18 Apr 2017 11:20:39 +0900 Subject: [PATCH 230/442] CI fixes. --- osu.Desktop.VisualTests/Tests/TestCasePlayer.cs | 1 - osu.Game/Modes/Beatmaps/BeatmapConverter.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 8c3ac526f6..8e19419dbb 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs @@ -14,7 +14,6 @@ using osu.Game.Modes.Osu.Objects; using osu.Game.Screens.Play; using OpenTK.Graphics; using osu.Desktop.VisualTests.Beatmaps; -using osu.Game.Modes.Osu; namespace osu.Desktop.VisualTests.Tests { diff --git a/osu.Game/Modes/Beatmaps/BeatmapConverter.cs b/osu.Game/Modes/Beatmaps/BeatmapConverter.cs index d08eff6583..ca7cb5a5bc 100644 --- a/osu.Game/Modes/Beatmaps/BeatmapConverter.cs +++ b/osu.Game/Modes/Beatmaps/BeatmapConverter.cs @@ -32,6 +32,6 @@ namespace osu.Game.Modes.Beatmaps /// /// The Beatmap to check. /// Whether the Beatmap can be converted using this Beatmap Converter. - public bool CanConvert(Beatmap beatmap) => ValidConversionTypes.All(t => beatmap.HitObjects.Any(h => t.IsInstanceOfType(h))); + public bool CanConvert(Beatmap beatmap) => ValidConversionTypes.All(t => beatmap.HitObjects.Any(t.IsInstanceOfType)); } } From ef5d50e7d841dc7a01f0c6d88004f1e83ba950f5 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 18 Apr 2017 11:29:27 +0900 Subject: [PATCH 231/442] mode -> ruleset. --- osu.Game/Modes/UI/HitRenderer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Modes/UI/HitRenderer.cs b/osu.Game/Modes/UI/HitRenderer.cs index 72b67836f7..3e51b2b44f 100644 --- a/osu.Game/Modes/UI/HitRenderer.cs +++ b/osu.Game/Modes/UI/HitRenderer.cs @@ -125,7 +125,7 @@ namespace osu.Game.Modes.UI // Check if the beatmap can be converted if (!converter.CanConvert(beatmap.Beatmap)) - throw new BeatmapInvalidForModeException($"{nameof(Beatmap)} can't be converted to the current mode."); + throw new BeatmapInvalidForModeException($"{nameof(Beatmap)} can't be converted for the current ruleset."); // Convert the beatmap Beatmap = converter.Convert(beatmap.Beatmap); From 2df21066e792d77859a7734db2630a95e2f8c779 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 12:19:39 +0900 Subject: [PATCH 232/442] Add constant for osu! playfield size. --- osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs | 2 +- osu.Desktop.VisualTests/Tests/TestCasePlayer.cs | 5 +++-- osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs | 3 ++- osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs | 3 ++- osu.Game.Modes.Osu/UI/OsuPlayfield.cs | 6 ++++-- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs index d1519d0404..87b201a8e8 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs @@ -45,7 +45,7 @@ namespace osu.Desktop.VisualTests.Tests objects.Add(new HitCircle { StartTime = time, - Position = new Vector2(RNG.Next(0, 512), RNG.Next(0, 384)), + Position = new Vector2(RNG.Next(0, (int)OsuPlayfield.BASE_SIZE.X), RNG.Next(0, (int)OsuPlayfield.BASE_SIZE.Y)), Scale = RNG.NextSingle(0.5f, 1.0f), }); diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs index 8e19419dbb..c196476545 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs @@ -14,6 +14,7 @@ using osu.Game.Modes.Osu.Objects; using osu.Game.Screens.Play; using OpenTK.Graphics; using osu.Desktop.VisualTests.Beatmaps; +using osu.Game.Modes.Osu.UI; namespace osu.Desktop.VisualTests.Tests { @@ -52,8 +53,8 @@ namespace osu.Desktop.VisualTests.Tests objects.Add(new HitCircle { StartTime = time, - Position = new Vector2(i % 4 == 0 || i % 4 == 2 ? 0 : 512, - i % 4 < 2 ? 0 : 384), + 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 }); diff --git a/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs b/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs index dd8dde5530..044c45b184 100644 --- a/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs +++ b/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs @@ -10,6 +10,7 @@ using System.Collections.Generic; using osu.Game.Modes.Objects.Types; using System.Linq; using System; +using osu.Game.Modes.Osu.UI; using osu.Game.Modes.Beatmaps; namespace osu.Game.Modes.Osu.Beatmaps @@ -66,7 +67,7 @@ namespace osu.Game.Modes.Osu.Beatmaps Samples = original.Samples, EndTime = endTimeData.EndTime, - Position = positionData?.Position ?? new Vector2(512, 384) / 2, + Position = positionData?.Position ?? OsuPlayfield.BASE_SIZE / 2, }; } diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs index d0136f717c..d921481290 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs @@ -9,6 +9,7 @@ using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Osu.Objects.Drawables.Pieces; using OpenTK; using OpenTK.Graphics; +using osu.Game.Modes.Osu.UI; namespace osu.Game.Modes.Osu.Objects.Drawables { @@ -29,7 +30,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables Position = s.Position; //take up full playfield. - Size = new Vector2(512); + Size = OsuPlayfield.BASE_SIZE; spinner = s; diff --git a/osu.Game.Modes.Osu/UI/OsuPlayfield.cs b/osu.Game.Modes.Osu/UI/OsuPlayfield.cs index 4164607b4d..47e2c1ed16 100644 --- a/osu.Game.Modes.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Modes.Osu/UI/OsuPlayfield.cs @@ -23,6 +23,8 @@ namespace osu.Game.Modes.Osu.UI public override bool ProvidingUserCursor => true; + public static readonly Vector2 BASE_SIZE = new Vector2(512, 384); + public override Vector2 Size { get @@ -34,7 +36,7 @@ namespace osu.Game.Modes.Osu.UI } } - public OsuPlayfield() : base(512) + public OsuPlayfield() : base(BASE_SIZE.X) { Anchor = Anchor.Centre; Origin = Anchor.Centre; @@ -94,4 +96,4 @@ namespace osu.Game.Modes.Osu.UI judgementLayer.Add(explosion); } } -} \ No newline at end of file +} From aa466d0e84d8b4c60deb98f27b5533999d3c08d1 Mon Sep 17 00:00:00 2001 From: ocboogie Date: Mon, 17 Apr 2017 21:30:51 -0700 Subject: [PATCH 233/442] PlayerLoader creates a new instance of the Player class on Restart --- .../Tests/TestCasePlayerLoadingScreen.cs | 31 ---------------- osu.Game/Screens/Play/LoadingScreen.cs | 37 ------------------- osu.Game/Screens/Play/Player.cs | 19 +++------- osu.Game/Screens/Play/PlayerLoader.cs | 34 ++++++++++++++++- 4 files changed, 38 insertions(+), 83 deletions(-) delete mode 100644 osu.Desktop.VisualTests/Tests/TestCasePlayerLoadingScreen.cs delete mode 100644 osu.Game/Screens/Play/LoadingScreen.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlayerLoadingScreen.cs b/osu.Desktop.VisualTests/Tests/TestCasePlayerLoadingScreen.cs deleted file mode 100644 index 9e0ba161c9..0000000000 --- a/osu.Desktop.VisualTests/Tests/TestCasePlayerLoadingScreen.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Graphics; -using osu.Framework.Graphics.Primitives; -using osu.Framework.Testing; -using osu.Game.Database; -using osu.Game.Screens.Select; -using System.Linq; -using osu.Game.Screens.Play; -using OpenTK; - -namespace osu.Desktop.VisualTests.Tests -{ - public class TestCasePlayerLoadingScreen : TestCase - { - public override string Description => @"Loading screen in player"; - - public override void Reset() - { - base.Reset(); - - Add(new LoadingScreen - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - }); - } - } -} - diff --git a/osu.Game/Screens/Play/LoadingScreen.cs b/osu.Game/Screens/Play/LoadingScreen.cs deleted file mode 100644 index 7ac6b83cd8..0000000000 --- a/osu.Game/Screens/Play/LoadingScreen.cs +++ /dev/null @@ -1,37 +0,0 @@ -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Primitives; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Screens; -using osu.Game.Beatmaps; -using osu.Game.Database; -using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; -using osu.Game.Screens.Backgrounds; -using osu.Game.Screens.Menu; -using OpenTK; - -namespace osu.Game.Screens.Play -{ - public class LoadingScreen : OsuScreen - { - - private string loadingText = "loading..."; - - [BackgroundDependencyLoader] - private void load() - { - Add( - new OsuSpriteText - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Text = loadingText, - TextSize = 48, - Font = @"Exo2.0-MediumItalic" - } - ); - } - } -} diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index fa564cdd61..6539fdb732 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -35,6 +35,8 @@ namespace osu.Game.Screens.Play public BeatmapInfo BeatmapInfo; + public Action OnRestart; + public bool IsPaused => !interpolatedSourceClock.IsRunning; public bool HasFailed { get; private set; } @@ -243,20 +245,9 @@ namespace osu.Game.Screens.Play public void Restart() { - sourceClock.Stop(); // If the clock is running and Restart is called the game will lag until relaunch - - var newPlayer = new Player(); - - ValidForResume = false; - - LoadComponentAsync(newPlayer, delegate - { - newPlayer.RestartCount = RestartCount + 1; - if (!Push(newPlayer)) - { - // Error(?) - } - }); + System.Diagnostics.Debug.WriteLine("TEST"); + OnRestart?.Invoke(); + Exit(); } private ScheduledDelegate onCompletionEvent; diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 64d17fd5bb..0841ec6afc 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -19,15 +19,22 @@ namespace osu.Game.Screens.Play { public class PlayerLoader : OsuScreen { - private readonly Player player; + private Player player; + private readonly OsuLogo logo; private BeatmapMetadataDisplay info; + private bool showOverlays = false; + internal override bool ShowOverlays => showOverlays; + protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap); public PlayerLoader(Player player) { ValidForResume = false; + + player.OnRestart = restart; + this.player = player; Children = new Drawable[] @@ -38,6 +45,7 @@ namespace osu.Game.Screens.Play Interactive = false, }, }; + } [BackgroundDependencyLoader] @@ -53,6 +61,30 @@ namespace osu.Game.Screens.Play LoadComponentAsync(player); } + protected override void OnResuming(Screen last) + { + base.OnResuming(last); + if (last != player) return; + var newPlayer = new Player + { + RestartCount = player.RestartCount + 1, + OnRestart = restart + }; + player = newPlayer; + LoadComponentAsync(newPlayer, delegate + { + if (!Push(newPlayer)) + Exit(); + ValidForResume = false; + }); + } + + private void restart() + { + showOverlays = false; + ValidForResume = true; + } + protected override void OnEntering(Screen last) { base.OnEntering(last); From 5c48fa6cb15320de4eaf414b15a73142fa226abb Mon Sep 17 00:00:00 2001 From: ocboogie Date: Mon, 17 Apr 2017 21:35:48 -0700 Subject: [PATCH 234/442] Removed testing line --- osu.Game/Screens/Play/Player.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 6539fdb732..60903d66c4 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -245,7 +245,6 @@ namespace osu.Game.Screens.Play public void Restart() { - System.Diagnostics.Debug.WriteLine("TEST"); OnRestart?.Invoke(); Exit(); } From 27ddf4b4755e0fa65294600a3da22e5014644af2 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 18 Apr 2017 14:24:16 +0900 Subject: [PATCH 235/442] Refactor beatmap converters. --- .../Beatmaps/CatchBeatmapConverter.cs | 10 +- .../Beatmaps/ManiaBeatmapConverter.cs | 10 +- .../Beatmaps/OsuBeatmapConverter.cs | 194 ++---------------- .../Beatmaps/OsuBeatmapProcessor.cs | 150 ++++++++++++++ .../Beatmaps/TaikoBeatmapConverter.cs | 33 ++- osu.Game/Beatmaps/Beatmap.cs | 1 + osu.Game/Modes/Beatmaps/BeatmapConverter.cs | 69 +++++-- 7 files changed, 243 insertions(+), 224 deletions(-) diff --git a/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs b/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs index 3b7b1c3a29..bd09e19ab8 100644 --- a/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs +++ b/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs @@ -7,19 +7,17 @@ using System.Collections.Generic; using System; using osu.Game.Modes.Objects.Types; using osu.Game.Modes.Beatmaps; +using osu.Game.Modes.Objects; namespace osu.Game.Modes.Catch.Beatmaps { internal class CatchBeatmapConverter : BeatmapConverter { - public override IEnumerable ValidConversionTypes { get; } = new[] { typeof(IHasXPosition) }; + protected override IEnumerable ValidConversionTypes { get; } = new[] { typeof(IHasXPosition) }; - public override Beatmap Convert(Beatmap original) + protected override IEnumerable ConvertHitObject(HitObject original, Beatmap beatmap) { - return new Beatmap(original) - { - HitObjects = new List() // Todo: Convert HitObjects - }; + yield return null; } } } diff --git a/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs index d8ea7f322d..c804fd4eeb 100644 --- a/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -7,19 +7,17 @@ using System.Collections.Generic; using System; using osu.Game.Modes.Objects.Types; using osu.Game.Modes.Beatmaps; +using osu.Game.Modes.Objects; namespace osu.Game.Modes.Mania.Beatmaps { internal class ManiaBeatmapConverter : BeatmapConverter { - public override IEnumerable ValidConversionTypes { get; } = new[] { typeof(IHasXPosition) }; + protected override IEnumerable ValidConversionTypes { get; } = new[] { typeof(IHasXPosition) }; - public override Beatmap Convert(Beatmap original) + protected override IEnumerable ConvertHitObject(HitObject original, Beatmap beatmap) { - return new Beatmap(original) - { - HitObjects = new List() // Todo: Implement - }; + yield return null; } } } diff --git a/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs b/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs index 044c45b184..0172112969 100644 --- a/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs +++ b/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs @@ -5,10 +5,8 @@ using OpenTK; using osu.Game.Beatmaps; using osu.Game.Modes.Objects; using osu.Game.Modes.Osu.Objects; -using osu.Game.Modes.Osu.Objects.Drawables; using System.Collections.Generic; using osu.Game.Modes.Objects.Types; -using System.Linq; using System; using osu.Game.Modes.Osu.UI; using osu.Game.Modes.Beatmaps; @@ -17,31 +15,10 @@ namespace osu.Game.Modes.Osu.Beatmaps { internal class OsuBeatmapConverter : BeatmapConverter { - public override IEnumerable ValidConversionTypes { get; } = new[] { typeof(IHasPosition) }; + protected override IEnumerable ValidConversionTypes { get; } = new[] { typeof(IHasPosition) }; - public override Beatmap Convert(Beatmap original) + protected override IEnumerable ConvertHitObject(HitObject original, Beatmap beatmap) { - return new Beatmap(original) - { - HitObjects = convertHitObjects(original.HitObjects, original.BeatmapInfo?.StackLeniency ?? 0.7f) - }; - } - - private List convertHitObjects(List hitObjects, float stackLeniency) - { - List converted = hitObjects.Select(convertHitObject).ToList(); - - updateStacking(converted, stackLeniency); - - return converted; - } - - private OsuHitObject convertHitObject(HitObject original) - { - OsuHitObject originalOsu = original as OsuHitObject; - if (originalOsu != null) - return originalOsu; - IHasCurve curveData = original as IHasCurve; IHasEndTime endTimeData = original as IHasEndTime; IHasPosition positionData = original as IHasPosition; @@ -49,7 +26,7 @@ namespace osu.Game.Modes.Osu.Beatmaps if (curveData != null) { - return new Slider + yield return new Slider { StartTime = original.StartTime, Samples = original.Samples, @@ -58,10 +35,9 @@ namespace osu.Game.Modes.Osu.Beatmaps NewCombo = comboData?.NewCombo ?? false }; } - - if (endTimeData != null) + else if (endTimeData != null) { - return new Spinner + yield return new Spinner { StartTime = original.StartTime, Samples = original.Samples, @@ -70,161 +46,15 @@ namespace osu.Game.Modes.Osu.Beatmaps Position = positionData?.Position ?? OsuPlayfield.BASE_SIZE / 2, }; } - - return new HitCircle + else { - StartTime = original.StartTime, - Samples = original.Samples, - Position = positionData?.Position ?? Vector2.Zero, - NewCombo = comboData?.NewCombo ?? false - }; - } - - private void updateStacking(List hitObjects, float stackLeniency, int startIndex = 0, int endIndex = -1) - { - if (endIndex == -1) - endIndex = hitObjects.Count - 1; - - const int stack_distance = 3; - float stackThreshold = DrawableOsuHitObject.TIME_PREEMPT * stackLeniency; - - // Reset stacking inside the update range - for (int i = startIndex; i <= endIndex; i++) - hitObjects[i].StackHeight = 0; - - // Extend the end index to include objects they are stacked on - int extendedEndIndex = endIndex; - for (int i = endIndex; i >= startIndex; i--) - { - int stackBaseIndex = i; - for (int n = stackBaseIndex + 1; n < hitObjects.Count; n++) + yield return new HitCircle { - OsuHitObject stackBaseObject = hitObjects[stackBaseIndex]; - if (stackBaseObject is Spinner) break; - - OsuHitObject objectN = hitObjects[n]; - if (objectN is Spinner) - continue; - - double endTime = (stackBaseObject as IHasEndTime)?.EndTime ?? stackBaseObject.StartTime; - - if (objectN.StartTime - endTime > stackThreshold) - //We are no longer within stacking range of the next object. - break; - - if (Vector2.Distance(stackBaseObject.Position, objectN.Position) < stack_distance || - stackBaseObject is Slider && Vector2.Distance(stackBaseObject.EndPosition, objectN.Position) < stack_distance) - { - stackBaseIndex = n; - - // HitObjects after the specified update range haven't been reset yet - objectN.StackHeight = 0; - } - } - - if (stackBaseIndex > extendedEndIndex) - { - extendedEndIndex = stackBaseIndex; - if (extendedEndIndex == hitObjects.Count - 1) - break; - } - } - - //Reverse pass for stack calculation. - int extendedStartIndex = startIndex; - for (int i = extendedEndIndex; i > startIndex; i--) - { - int n = i; - /* We should check every note which has not yet got a stack. - * Consider the case we have two interwound stacks and this will make sense. - * - * o <-1 o <-2 - * o <-3 o <-4 - * - * We first process starting from 4 and handle 2, - * then we come backwards on the i loop iteration until we reach 3 and handle 1. - * 2 and 1 will be ignored in the i loop because they already have a stack value. - */ - - OsuHitObject objectI = hitObjects[i]; - if (objectI.StackHeight != 0 || objectI is Spinner) continue; - - /* If this object is a hitcircle, then we enter this "special" case. - * It either ends with a stack of hitcircles only, or a stack of hitcircles that are underneath a slider. - * Any other case is handled by the "is Slider" code below this. - */ - if (objectI is HitCircle) - { - while (--n >= 0) - { - OsuHitObject objectN = hitObjects[n]; - if (objectN is Spinner) continue; - - double endTime = (objectN as IHasEndTime)?.EndTime ?? objectN.StartTime; - - if (objectI.StartTime - endTime > stackThreshold) - //We are no longer within stacking range of the previous object. - break; - - // HitObjects before the specified update range haven't been reset yet - if (n < extendedStartIndex) - { - objectN.StackHeight = 0; - extendedStartIndex = n; - } - - /* This is a special case where hticircles are moved DOWN and RIGHT (negative stacking) if they are under the *last* slider in a stacked pattern. - * o==o <- slider is at original location - * o <- hitCircle has stack of -1 - * o <- hitCircle has stack of -2 - */ - if (objectN is Slider && Vector2.Distance(objectN.EndPosition, objectI.Position) < stack_distance) - { - int offset = objectI.StackHeight - objectN.StackHeight + 1; - for (int j = n + 1; j <= i; j++) - { - //For each object which was declared under this slider, we will offset it to appear *below* the slider end (rather than above). - OsuHitObject objectJ = hitObjects[j]; - if (Vector2.Distance(objectN.EndPosition, objectJ.Position) < stack_distance) - objectJ.StackHeight -= offset; - } - - //We have hit a slider. We should restart calculation using this as the new base. - //Breaking here will mean that the slider still has StackCount of 0, so will be handled in the i-outer-loop. - break; - } - - if (Vector2.Distance(objectN.Position, objectI.Position) < stack_distance) - { - //Keep processing as if there are no sliders. If we come across a slider, this gets cancelled out. - //NOTE: Sliders with start positions stacking are a special case that is also handled here. - - objectN.StackHeight = objectI.StackHeight + 1; - objectI = objectN; - } - } - } - else if (objectI is Slider) - { - /* We have hit the first slider in a possible stack. - * From this point on, we ALWAYS stack positive regardless. - */ - while (--n >= startIndex) - { - OsuHitObject objectN = hitObjects[n]; - if (objectN is Spinner) continue; - - if (objectI.StartTime - objectN.StartTime > stackThreshold) - //We are no longer within stacking range of the previous object. - break; - - if (Vector2.Distance(objectN.EndPosition, objectI.Position) < stack_distance) - { - objectN.StackHeight = objectI.StackHeight + 1; - objectI = objectN; - } - } - } + StartTime = original.StartTime, + Samples = original.Samples, + Position = positionData?.Position ?? Vector2.Zero, + NewCombo = comboData?.NewCombo ?? false + }; } } } diff --git a/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapProcessor.cs b/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapProcessor.cs index fd506f3493..912da40f3d 100644 --- a/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapProcessor.cs +++ b/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapProcessor.cs @@ -1,9 +1,12 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using OpenTK; using osu.Game.Beatmaps; using osu.Game.Modes.Beatmaps; +using osu.Game.Modes.Objects.Types; using osu.Game.Modes.Osu.Objects; +using osu.Game.Modes.Osu.Objects.Drawables; namespace osu.Game.Modes.Osu.Beatmaps { @@ -11,6 +14,8 @@ namespace osu.Game.Modes.Osu.Beatmaps { public override void PostProcess(Beatmap beatmap) { + applyStacking(beatmap); + if (beatmap.ComboColors.Count == 0) return; @@ -29,5 +34,150 @@ namespace osu.Game.Modes.Osu.Beatmaps obj.ComboColour = beatmap.ComboColors[colourIndex]; } } + + private void applyStacking(Beatmap beatmap) + { + const int stack_distance = 3; + float stackThreshold = DrawableOsuHitObject.TIME_PREEMPT * beatmap.BeatmapInfo?.StackLeniency ?? 0.7f; + + // Reset stacking + for (int i = 0; i <= beatmap.HitObjects.Count - 1; i++) + beatmap.HitObjects[i].StackHeight = 0; + + // Extend the end index to include objects they are stacked on + int extendedEndIndex = beatmap.HitObjects.Count - 1; + for (int i = beatmap.HitObjects.Count - 1; i >= 0; i--) + { + int stackBaseIndex = i; + for (int n = stackBaseIndex + 1; n < beatmap.HitObjects.Count; n++) + { + OsuHitObject stackBaseObject = beatmap.HitObjects[stackBaseIndex]; + if (stackBaseObject is Spinner) break; + + OsuHitObject objectN = beatmap.HitObjects[n]; + if (objectN is Spinner) + continue; + + double endTime = (stackBaseObject as IHasEndTime)?.EndTime ?? stackBaseObject.StartTime; + + if (objectN.StartTime - endTime > stackThreshold) + //We are no longer within stacking range of the next object. + break; + + if (Vector2.Distance(stackBaseObject.Position, objectN.Position) < stack_distance || + stackBaseObject is Slider && Vector2.Distance(stackBaseObject.EndPosition, objectN.Position) < stack_distance) + { + stackBaseIndex = n; + + // HitObjects after the specified update range haven't been reset yet + objectN.StackHeight = 0; + } + } + + if (stackBaseIndex > extendedEndIndex) + { + extendedEndIndex = stackBaseIndex; + if (extendedEndIndex == beatmap.HitObjects.Count - 1) + break; + } + } + + //Reverse pass for stack calculation. + int extendedStartIndex = 0; + for (int i = extendedEndIndex; i > 0; i--) + { + int n = i; + /* We should check every note which has not yet got a stack. + * Consider the case we have two interwound stacks and this will make sense. + * + * o <-1 o <-2 + * o <-3 o <-4 + * + * We first process starting from 4 and handle 2, + * then we come backwards on the i loop iteration until we reach 3 and handle 1. + * 2 and 1 will be ignored in the i loop because they already have a stack value. + */ + + OsuHitObject objectI = beatmap.HitObjects[i]; + if (objectI.StackHeight != 0 || objectI is Spinner) continue; + + /* If this object is a hitcircle, then we enter this "special" case. + * It either ends with a stack of hitcircles only, or a stack of hitcircles that are underneath a slider. + * Any other case is handled by the "is Slider" code below this. + */ + if (objectI is HitCircle) + { + while (--n >= 0) + { + OsuHitObject objectN = beatmap.HitObjects[n]; + if (objectN is Spinner) continue; + + double endTime = (objectN as IHasEndTime)?.EndTime ?? objectN.StartTime; + + if (objectI.StartTime - endTime > stackThreshold) + //We are no longer within stacking range of the previous object. + break; + + // HitObjects before the specified update range haven't been reset yet + if (n < extendedStartIndex) + { + objectN.StackHeight = 0; + extendedStartIndex = n; + } + + /* This is a special case where hticircles are moved DOWN and RIGHT (negative stacking) if they are under the *last* slider in a stacked pattern. + * o==o <- slider is at original location + * o <- hitCircle has stack of -1 + * o <- hitCircle has stack of -2 + */ + if (objectN is Slider && Vector2.Distance(objectN.EndPosition, objectI.Position) < stack_distance) + { + int offset = objectI.StackHeight - objectN.StackHeight + 1; + for (int j = n + 1; j <= i; j++) + { + //For each object which was declared under this slider, we will offset it to appear *below* the slider end (rather than above). + OsuHitObject objectJ = beatmap.HitObjects[j]; + if (Vector2.Distance(objectN.EndPosition, objectJ.Position) < stack_distance) + objectJ.StackHeight -= offset; + } + + //We have hit a slider. We should restart calculation using this as the new base. + //Breaking here will mean that the slider still has StackCount of 0, so will be handled in the i-outer-loop. + break; + } + + if (Vector2.Distance(objectN.Position, objectI.Position) < stack_distance) + { + //Keep processing as if there are no sliders. If we come across a slider, this gets cancelled out. + //NOTE: Sliders with start positions stacking are a special case that is also handled here. + + objectN.StackHeight = objectI.StackHeight + 1; + objectI = objectN; + } + } + } + else if (objectI is Slider) + { + /* We have hit the first slider in a possible stack. + * From this point on, we ALWAYS stack positive regardless. + */ + while (--n >= 0) + { + OsuHitObject objectN = beatmap.HitObjects[n]; + if (objectN is Spinner) continue; + + if (objectI.StartTime - objectN.StartTime > stackThreshold) + //We are no longer within stacking range of the previous object. + break; + + if (Vector2.Distance(objectN.EndPosition, objectI.Position) < stack_distance) + { + objectN.StackHeight = objectI.StackHeight + 1; + objectI = objectN; + } + } + } + } + } } } diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index abba5316bb..d26cc8ab0b 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -39,33 +39,30 @@ namespace osu.Game.Modes.Taiko.Beatmaps /// private const float taiko_base_distance = 100; - public override IEnumerable ValidConversionTypes { get; } = new[] { typeof(HitObject) }; + protected override IEnumerable ValidConversionTypes { get; } = new[] { typeof(HitObject) }; - public override Beatmap Convert(Beatmap original) + protected override Beatmap ConvertBeatmap(Beatmap original) { + // Rewrite the beatmap info to add the slider velocity multiplier BeatmapInfo info = original.BeatmapInfo.DeepClone(); info.Difficulty.SliderMultiplier *= legacy_velocity_multiplier; - return new Beatmap(original) + Beatmap converted = base.ConvertBeatmap(original); + + // Post processing step to transform hit objects with the same start time into strong hits + converted.HitObjects = converted.HitObjects.GroupBy(t => t.StartTime).Select(x => { - BeatmapInfo = info, - HitObjects = original.HitObjects.SelectMany(h => convertHitObject(h, original)).GroupBy(t => t.StartTime).Select(x => - { - TaikoHitObject first = x.First(); - if (x.Skip(1).Any()) - first.IsStrong = true; - return first; - }).ToList() - }; + TaikoHitObject first = x.First(); + if (x.Skip(1).Any()) + first.IsStrong = true; + return first; + }).ToList(); + + return converted; } - private IEnumerable convertHitObject(HitObject obj, Beatmap beatmap) + protected override IEnumerable ConvertHitObject(HitObject obj, Beatmap beatmap) { - // Check if this HitObject is already a TaikoHitObject, and return it if so - var originalTaiko = obj as TaikoHitObject; - if (originalTaiko != null) - yield return originalTaiko; - var distanceData = obj as IHasDistance; var repeatsData = obj as IHasRepeats; var endTimeData = obj as IHasEndTime; diff --git a/osu.Game/Beatmaps/Beatmap.cs b/osu.Game/Beatmaps/Beatmap.cs index e3a7a81d0d..7ed0546747 100644 --- a/osu.Game/Beatmaps/Beatmap.cs +++ b/osu.Game/Beatmaps/Beatmap.cs @@ -56,6 +56,7 @@ namespace osu.Game.Beatmaps public Beatmap(Beatmap original = null) : base(original) { + HitObjects = original?.HitObjects; } } } diff --git a/osu.Game/Modes/Beatmaps/BeatmapConverter.cs b/osu.Game/Modes/Beatmaps/BeatmapConverter.cs index ca7cb5a5bc..ea75577e25 100644 --- a/osu.Game/Modes/Beatmaps/BeatmapConverter.cs +++ b/osu.Game/Modes/Beatmaps/BeatmapConverter.cs @@ -15,23 +15,68 @@ namespace osu.Game.Modes.Beatmaps /// The type of HitObject stored in the Beatmap. public abstract class BeatmapConverter where T : HitObject { - /// - /// The types of HitObjects that can be converted to be used for this Beatmap. - /// - public abstract IEnumerable ValidConversionTypes { get; } - - /// - /// Converts a Beatmap to another mode. - /// - /// The original Beatmap. - /// The converted Beatmap. - public abstract Beatmap Convert(Beatmap original); - /// /// Checks if a Beatmap can be converted using this Beatmap Converter. /// /// The Beatmap to check. /// Whether the Beatmap can be converted using this Beatmap Converter. public bool CanConvert(Beatmap beatmap) => ValidConversionTypes.All(t => beatmap.HitObjects.Any(t.IsInstanceOfType)); + + /// + /// Converts a Beatmap using this Beatmap Converter. + /// + /// The un-converted Beatmap. + /// The converted Beatmap. + public Beatmap Convert(Beatmap original) + { + // We always operate on a clone of the original beatmap, to not modify it game-wide + return ConvertBeatmap(new Beatmap(original)); + } + + /// + /// Performs the conversion of a Beatmap using this Beatmap Converter. + /// + /// The un-converted Beatmap. + /// The converted Beatmap. + protected virtual Beatmap ConvertBeatmap(Beatmap original) + { + return new Beatmap + { + BeatmapInfo = original.BeatmapInfo, + TimingInfo = original.TimingInfo, + HitObjects = original.HitObjects.SelectMany(h => convert(h, original)).ToList() + }; + } + + /// + /// Converts a hit object. + /// + /// The hit object to convert. + /// The un-converted Beatmap. + /// The converted hit object. + private IEnumerable convert(HitObject original, Beatmap beatmap) + { + // Check if the hitobject is already the converted type + T tObject = original as T; + if (tObject != null) + yield return tObject; + + // Convert the hit object + foreach (var obj in ConvertHitObject(original, beatmap)) + yield return obj; + } + + /// + /// The types of HitObjects that can be converted to be used for this Beatmap. + /// + protected abstract IEnumerable ValidConversionTypes { get; } + + /// + /// Performs the conversion of a hit object. + /// + /// The hit object to convert. + /// The un-converted Beatmap. + /// The converted hit object. + protected abstract IEnumerable ConvertHitObject(HitObject original, Beatmap beatmap); } } From 0dd97c433f3a2464fe35c218c072595ebe76d771 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 18 Apr 2017 14:34:39 +0900 Subject: [PATCH 236/442] Trim whitespace. --- osu.Game/Modes/Beatmaps/BeatmapConverter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Modes/Beatmaps/BeatmapConverter.cs b/osu.Game/Modes/Beatmaps/BeatmapConverter.cs index ea75577e25..253d4b3a93 100644 --- a/osu.Game/Modes/Beatmaps/BeatmapConverter.cs +++ b/osu.Game/Modes/Beatmaps/BeatmapConverter.cs @@ -60,7 +60,7 @@ namespace osu.Game.Modes.Beatmaps T tObject = original as T; if (tObject != null) yield return tObject; - + // Convert the hit object foreach (var obj in ConvertHitObject(original, beatmap)) yield return obj; From be8d32688b99c7aae8b7444ed4b021187c7ccd0a Mon Sep 17 00:00:00 2001 From: ocboogie Date: Mon, 17 Apr 2017 22:36:03 -0700 Subject: [PATCH 237/442] Fixed HotkeyRetryOverlay just going to a black screen --- osu.Game/Screens/Play/Player.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 60903d66c4..4275530187 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -46,6 +46,8 @@ namespace osu.Game.Screens.Play private const double pause_cooldown = 1000; private double lastPauseActionTime; + private bool restarting = false; + private bool canPause => ValidForResume && !HasFailed && Time.Current >= lastPauseActionTime + pause_cooldown; private IAdjustableClock sourceClock; @@ -245,6 +247,7 @@ namespace osu.Game.Screens.Play public void Restart() { + restarting = true; OnRestart?.Invoke(); Exit(); } @@ -320,7 +323,7 @@ namespace osu.Game.Screens.Play if (HasFailed || !ValidForResume) return false; - if (pauseOverlay != null && !HitRenderer.HasReplayLoaded) + if (pauseOverlay != null && !HitRenderer.HasReplayLoaded && !restarting) { //pause screen override logic. if (pauseOverlay?.State == Visibility.Hidden && !canPause) return true; From cf404b4bcf029c97879d84b80aea8281c715aebe Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 18 Apr 2017 14:46:56 +0900 Subject: [PATCH 238/442] We shouldn't be adding null hitobjects. --- osu.Game/Modes/Beatmaps/BeatmapConverter.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Modes/Beatmaps/BeatmapConverter.cs b/osu.Game/Modes/Beatmaps/BeatmapConverter.cs index 253d4b3a93..545c49e507 100644 --- a/osu.Game/Modes/Beatmaps/BeatmapConverter.cs +++ b/osu.Game/Modes/Beatmaps/BeatmapConverter.cs @@ -63,7 +63,12 @@ namespace osu.Game.Modes.Beatmaps // Convert the hit object foreach (var obj in ConvertHitObject(original, beatmap)) + { + if (obj == null) + continue; + yield return obj; + } } /// From 7a6b062e720c97b2eb6bab34d70575045a9ec6e0 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 18 Apr 2017 14:48:18 +0900 Subject: [PATCH 239/442] Fix adding duplicate hitobjects in the case where a hit object doesn't need to be converted. --- osu.Game/Modes/Beatmaps/BeatmapConverter.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Modes/Beatmaps/BeatmapConverter.cs b/osu.Game/Modes/Beatmaps/BeatmapConverter.cs index 545c49e507..c2e5b0affa 100644 --- a/osu.Game/Modes/Beatmaps/BeatmapConverter.cs +++ b/osu.Game/Modes/Beatmaps/BeatmapConverter.cs @@ -59,7 +59,10 @@ namespace osu.Game.Modes.Beatmaps // Check if the hitobject is already the converted type T tObject = original as T; if (tObject != null) + { yield return tObject; + yield break; + } // Convert the hit object foreach (var obj in ConvertHitObject(original, beatmap)) From 727086c0b2532bd8618897c95954a2ed9d08e6b2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 15:34:53 +0900 Subject: [PATCH 240/442] Updates in-line with framework. --- osu.Game/Overlays/Toolbar/Toolbar.cs | 2 +- osu.Game/Screens/Play/MenuOverlay.cs | 2 ++ osu.Game/Screens/Select/BeatmapInfoWedge.cs | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index 4632b55775..e1495827f9 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -27,7 +27,7 @@ namespace osu.Game.Overlays.Toolbar protected override bool HideOnEscape => false; - protected override bool BlockPassThroughInput => false; + protected override bool BlockPassThroughMouse => false; private const double transition_time = 500; diff --git a/osu.Game/Screens/Play/MenuOverlay.cs b/osu.Game/Screens/Play/MenuOverlay.cs index 738e5cc35d..fa522956f7 100644 --- a/osu.Game/Screens/Play/MenuOverlay.cs +++ b/osu.Game/Screens/Play/MenuOverlay.cs @@ -25,6 +25,8 @@ namespace osu.Game.Screens.Play protected override bool HideOnEscape => false; + protected override bool BlockPassThroughKeyboard => true; + public Action OnRetry; public Action OnQuit; diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index d15e5a9bb8..cc225659b4 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -47,7 +47,7 @@ namespace osu.Game.Screens.Select protected override bool HideOnEscape => false; - protected override bool BlockPassThroughInput => false; + protected override bool BlockPassThroughMouse => false; protected override void PopIn() { From c0f4cbcba6383177d2c763e03c47cef45ab9b874 Mon Sep 17 00:00:00 2001 From: ocboogie Date: Mon, 17 Apr 2017 23:36:11 -0700 Subject: [PATCH 241/442] Added back PlayerLoader overlays --- osu.Game/Screens/Play/PlayerLoader.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 0841ec6afc..9ee4c700d2 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -24,7 +24,7 @@ namespace osu.Game.Screens.Play private readonly OsuLogo logo; private BeatmapMetadataDisplay info; - private bool showOverlays = false; + private bool showOverlays = true; internal override bool ShowOverlays => showOverlays; protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap); From 2bd89e922fd1bd980f182b467b01c31330640a20 Mon Sep 17 00:00:00 2001 From: ocboogie Date: Mon, 17 Apr 2017 23:48:21 -0700 Subject: [PATCH 242/442] Removed unneeded newPlayer --- osu.Game/Screens/Play/PlayerLoader.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 9ee4c700d2..2f74cd854f 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -65,15 +65,14 @@ namespace osu.Game.Screens.Play { base.OnResuming(last); if (last != player) return; - var newPlayer = new Player + player = new Player { RestartCount = player.RestartCount + 1, OnRestart = restart }; - player = newPlayer; - LoadComponentAsync(newPlayer, delegate + LoadComponentAsync(player, delegate { - if (!Push(newPlayer)) + if (!Push(player)) Exit(); ValidForResume = false; }); From 1f7373db8f39dad52a43d651ba4c0da54e015aa6 Mon Sep 17 00:00:00 2001 From: ocboogie Date: Mon, 17 Apr 2017 23:52:38 -0700 Subject: [PATCH 243/442] Removed unneeded restarting variable --- osu.Game/Screens/Play/Player.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 4275530187..a6e5f56aa3 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -46,8 +46,6 @@ namespace osu.Game.Screens.Play private const double pause_cooldown = 1000; private double lastPauseActionTime; - private bool restarting = false; - private bool canPause => ValidForResume && !HasFailed && Time.Current >= lastPauseActionTime + pause_cooldown; private IAdjustableClock sourceClock; @@ -247,7 +245,7 @@ namespace osu.Game.Screens.Play public void Restart() { - restarting = true; + ValidForResume = false; OnRestart?.Invoke(); Exit(); } @@ -323,7 +321,7 @@ namespace osu.Game.Screens.Play if (HasFailed || !ValidForResume) return false; - if (pauseOverlay != null && !HitRenderer.HasReplayLoaded && !restarting) + if (pauseOverlay != null && !HitRenderer.HasReplayLoaded) { //pause screen override logic. if (pauseOverlay?.State == Visibility.Hidden && !canPause) return true; From fbd26a1d5eb5c94ac723e8e2bf32eeeb8960db38 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 16:05:58 +0900 Subject: [PATCH 244/442] Mode -> Ruleset. --- osu.Desktop.Tests/osu.Desktop.Tests.csproj | 16 +-- .../Tests/TestCaseGamefield.cs | 12 +- .../Tests/TestCaseHitObjects.cs | 10 +- .../Tests/TestCaseLeaderboard.cs | 6 +- .../Tests/TestCasePlayer.cs | 6 +- .../Tests/TestCaseReplay.cs | 4 +- .../Tests/TestCaseScoreCounter.cs | 2 +- .../Tests/TestCaseSongProgress.cs | 2 +- .../Tests/TestCaseTaikoHitObjects.cs | 2 +- .../Tests/TestCaseTaikoPlayfield.cs | 10 +- .../osu.Desktop.VisualTests.csproj | 16 +-- osu.Desktop/osu.Desktop.csproj | 16 +-- .../Beatmaps/CatchBeatmapConverter.cs | 10 +- .../CatchDifficultyCalculator.cs | 8 +- .../CatchRuleset.cs | 14 +- .../Judgements/CatchJudgement.cs | 4 +- .../Mods/CatchMod.cs | 4 +- .../Objects/CatchBaseHit.cs | 4 +- .../Objects/Drawable/DrawableFruit.cs | 2 +- .../Objects/Droplet.cs | 2 +- .../Objects/Fruit.cs | 2 +- .../OpenTK.dll.config | 0 .../Properties/AssemblyInfo.cs | 4 +- .../Scoring/CatchScoreProcessor.cs | 10 +- .../UI/CatchHitRenderer.cs | 18 +-- .../UI/CatchPlayfield.cs | 8 +- .../osu.Game.Rulesets.Catch.csproj | 8 +- .../packages.config | 0 .../Beatmaps/ManiaBeatmapConverter.cs | 10 +- .../Judgements/ManiaJudgement.cs | 4 +- .../ManiaDifficultyCalculator.cs | 8 +- .../ManiaRuleset.cs | 14 +- .../Mods/ManiaMod.cs | 4 +- .../Objects/Drawable/DrawableNote.cs | 2 +- .../Objects/HoldNote.cs | 2 +- .../Objects/ManiaBaseHit.cs | 4 +- .../Objects/Note.cs | 2 +- .../OpenTK.dll.config | 0 .../Properties/AssemblyInfo.cs | 4 +- .../Scoring/ManiaScoreProcessor.cs | 10 +- .../UI/ManiaHitRenderer.cs | 18 +-- .../UI/ManiaPlayfield.cs | 8 +- .../osu.Game.Rulesets.Mania.csproj | 12 +- .../packages.config | 0 .../Beatmaps/OsuBeatmapConverter.cs | 12 +- .../Beatmaps/OsuBeatmapProcessor.cs | 10 +- .../Judgements/OsuJudgement.cs | 6 +- .../Mods/OsuMod.cs | 8 +- .../Connections/ConnectionRenderer.cs | 4 +- .../Drawables/Connections/FollowPoint.cs | 2 +- .../Connections/FollowPointRenderer.cs | 4 +- .../Objects/Drawables/DrawableHitCircle.cs | 8 +- .../Objects/Drawables/DrawableOsuHitObject.cs | 6 +- .../Objects/Drawables/DrawableOsuJudgement.cs | 8 +- .../Objects/Drawables/DrawableSlider.cs | 6 +- .../Objects/Drawables/DrawableSliderTick.cs | 6 +- .../Objects/Drawables/DrawableSpinner.cs | 8 +- .../Drawables/Pieces/ApproachCircle.cs | 2 +- .../Objects/Drawables/Pieces/CirclePiece.cs | 2 +- .../Objects/Drawables/Pieces/ExplodePiece.cs | 2 +- .../Objects/Drawables/Pieces/FlashPiece.cs | 2 +- .../Objects/Drawables/Pieces/GlowPiece.cs | 2 +- .../Objects/Drawables/Pieces/NumberPiece.cs | 2 +- .../Objects/Drawables/Pieces/RingPiece.cs | 2 +- .../Objects/Drawables/Pieces/SliderBall.cs | 2 +- .../Objects/Drawables/Pieces/SliderBody.cs | 2 +- .../Objects/Drawables/Pieces/SliderBouncer.cs | 2 +- .../Drawables/Pieces/SpinnerBackground.cs | 2 +- .../Objects/Drawables/Pieces/SpinnerDisc.cs | 2 +- .../Drawables/Pieces/TrianglesPiece.cs | 2 +- .../Objects/HitCircle.cs | 2 +- .../Objects/OsuHitObject.cs | 8 +- .../Objects/OsuHitObjectDifficulty.cs | 2 +- .../Objects/Slider.cs | 6 +- .../Objects/SliderTick.cs | 2 +- .../Objects/Spinner.cs | 4 +- .../OpenTK.dll.config | 0 .../OsuAutoReplay.cs | 10 +- .../OsuDifficultyCalculator.cs | 10 +- .../OsuKeyConversionInputManager.cs | 2 +- .../OsuRuleset.cs | 16 +-- .../Properties/AssemblyInfo.cs | 0 .../Scoring/OsuScore.cs | 4 +- .../Scoring/OsuScoreProcessor.cs | 12 +- .../UI/OsuHitRenderer.cs | 20 +-- .../UI/OsuPlayfield.cs | 14 +- .../osu.Game.Rulesets.Osu.csproj | 4 +- .../packages.config | 0 .../Beatmaps/TaikoBeatmapConverter.cs | 10 +- .../Judgements/TaikoDrumRollTickJudgement.cs | 2 +- .../Judgements/TaikoHitResult.cs | 2 +- .../Judgements/TaikoJudgement.cs | 6 +- .../Judgements/TaikoStrongHitJudgement.cs | 4 +- .../Mods/TaikoMod.cs | 10 +- .../Objects/BarLine.cs | 2 +- .../Objects/CentreHit.cs | 2 +- .../Objects/Drawables/DrawableBarLine.cs | 2 +- .../Objects/Drawables/DrawableBarLineMajor.cs | 2 +- .../Objects/Drawables/DrawableCentreHit.cs | 4 +- .../Drawables/DrawableCentreHitStrong.cs | 4 +- .../Objects/Drawables/DrawableDrumRoll.cs | 8 +- .../Objects/Drawables/DrawableDrumRollTick.cs | 8 +- .../Objects/Drawables/DrawableHit.cs | 8 +- .../Objects/Drawables/DrawableHitStrong.cs | 8 +- .../Objects/Drawables/DrawableRimHit.cs | 4 +- .../Objects/Drawables/DrawableRimHitStrong.cs | 4 +- .../Objects/Drawables/DrawableSwell.cs | 8 +- .../Drawables/DrawableTaikoHitObject.cs | 8 +- .../Drawables/Pieces/CentreHitSymbolPiece.cs | 2 +- .../Objects/Drawables/Pieces/CirclePiece.cs | 2 +- .../Drawables/Pieces/ElongatedCirclePiece.cs | 4 +- .../Drawables/Pieces/RimHitSymbolPiece.cs | 2 +- .../Drawables/Pieces/SwellSymbolPiece.cs | 2 +- .../Objects/Drawables/Pieces/TaikoPiece.cs | 2 +- .../Objects/Drawables/Pieces/TickPiece.cs | 2 +- .../Objects/DrumRoll.cs | 4 +- .../Objects/DrumRollTick.cs | 2 +- .../Objects/Hit.cs | 2 +- .../Objects/RimHit.cs | 2 +- .../Objects/Swell.cs | 4 +- .../Objects/TaikoHitObject.cs | 6 +- .../OpenTK.dll.config | 0 .../Properties/AssemblyInfo.cs | 4 +- .../Replays/TaikoAutoReplay.cs | 8 +- .../Replays/TaikoFramedReplayInputHandler.cs | 4 +- .../Scoring/TaikoScoreProcessor.cs | 12 +- .../TaikoDifficultyCalculator.cs | 8 +- .../TaikoRuleset.cs | 14 +- .../UI/DrawableTaikoJudgement.cs | 8 +- .../UI/HitExplosion.cs | 6 +- .../UI/HitTarget.cs | 4 +- .../UI/InputDrum.cs | 2 +- .../UI/TaikoHitRenderer.cs | 26 ++-- .../UI/TaikoPlayfield.cs | 12 +- .../osu.Game.Rulesets.Taiko.csproj | 4 +- .../packages.config | 0 .../Beatmaps/Formats/OsuLegacyDecoderTest.cs | 2 +- osu.Game.Tests/osu.Game.Tests.csproj | 16 +-- osu.Game/Beatmaps/Beatmap.cs | 2 +- osu.Game/Beatmaps/DifficultyCalculator.cs | 4 +- osu.Game/Beatmaps/Formats/BeatmapDecoder.cs | 2 +- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 10 +- osu.Game/Beatmaps/WorkingBeatmap.cs | 2 +- osu.Game/Database/RulesetDatabase.cs | 4 +- osu.Game/Database/RulesetInfo.cs | 2 +- osu.Game/Database/ScoreDatabase.cs | 2 +- osu.Game/Graphics/TextAwesome.cs | 4 +- .../Online/API/Requests/GetScoresRequest.cs | 2 +- osu.Game/OsuGame.cs | 6 +- osu.Game/Overlays/Mods/AssistedSection.cs | 2 +- .../Mods/DifficultyIncreaseSection.cs | 2 +- .../Mods/DifficultyReductionSection.cs | 2 +- osu.Game/Overlays/Mods/ModButton.cs | 4 +- osu.Game/Overlays/Mods/ModSection.cs | 2 +- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 2 +- osu.Game/Overlays/Toolbar/Toolbar.cs | 2 +- .../Overlays/Toolbar/ToolbarModeSelector.cs | 4 +- .../{Modes => Rulesets}/BeatmapStatistic.cs | 2 +- .../Beatmaps/BeatmapConverter.cs | 4 +- .../Beatmaps/BeatmapProcessor.cs | 4 +- .../Judgements/DrawableJudgement.cs | 4 +- .../Judgements/IPartialJudgement.cs | 6 +- .../Judgements/Judgement.cs | 4 +- .../Mods/IApplicableMod.cs | 6 +- osu.Game/{Modes => Rulesets}/Mods/Mod.cs | 8 +- osu.Game/{Modes => Rulesets}/Mods/ModType.cs | 2 +- .../Objects/BezierApproximator.cs | 2 +- .../Objects/CircularArcApproximator.cs | 2 +- .../Objects/CurvedHitObject.cs | 4 +- .../Objects/Drawables/ArmedState.cs | 2 +- .../Objects/Drawables/DrawableHitObject.cs | 6 +- .../Objects/Drawables/HitResult.cs | 2 +- .../IDrawableHitObjectWithProxiedApproach.cs | 2 +- .../{Modes => Rulesets}/Objects/HitObject.cs | 2 +- .../Objects/HitObjectParser.cs | 2 +- .../Objects/Legacy/Catch/Hit.cs | 4 +- .../Objects/Legacy/Catch/HitObjectParser.cs | 4 +- .../Objects/Legacy/Catch/Slider.cs | 4 +- .../Objects/Legacy/Catch/Spinner.cs | 4 +- .../Objects/Legacy/HitObjectParser.cs | 4 +- .../Objects/Legacy/HitObjectType.cs | 2 +- .../Objects/Legacy/Hold.cs | 4 +- .../Objects/Legacy/Mania/Hit.cs | 4 +- .../Objects/Legacy/Mania/HitObjectParser.cs | 4 +- .../Objects/Legacy/Mania/Slider.cs | 4 +- .../Objects/Legacy/Mania/Spinner.cs | 4 +- .../Objects/Legacy/Osu/Hit.cs | 4 +- .../Objects/Legacy/Osu/HitObjectParser.cs | 4 +- .../Objects/Legacy/Osu/Slider.cs | 4 +- .../Objects/Legacy/Osu/Spinner.cs | 4 +- .../Objects/Legacy/Taiko/Hit.cs | 4 +- .../Objects/Legacy/Taiko/HitObjectParser.cs | 4 +- .../Objects/Legacy/Taiko/Slider.cs | 4 +- .../Objects/Legacy/Taiko/Spinner.cs | 4 +- .../Objects/SliderCurve.cs | 4 +- .../Objects/Types/CurveType.cs | 2 +- .../Objects/Types/IHasCombo.cs | 2 +- .../Objects/Types/IHasCurve.cs | 2 +- .../Objects/Types/IHasDistance.cs | 2 +- .../Objects/Types/IHasEndTime.cs | 2 +- .../Objects/Types/IHasHold.cs | 2 +- .../Objects/Types/IHasPosition.cs | 2 +- .../Objects/Types/IHasRepeats.cs | 2 +- .../Objects/Types/IHasXPosition.cs | 2 +- .../Objects/Types/IHasYPosition.cs | 2 +- .../Replays/FramedReplayInputHandler.cs | 2 +- .../{Modes => Rulesets}/Replays/Replay.cs | 2 +- .../Replays/ReplayButtonState.cs | 2 +- .../Replays/ReplayFrame.cs | 2 +- osu.Game/{Modes => Rulesets}/Ruleset.cs | 8 +- osu.Game/{Modes => Rulesets}/Scoring/Score.cs | 6 +- .../Scoring/ScoreProcessor.cs | 14 +- .../{Modes => Rulesets}/Scoring/ScoreRank.cs | 2 +- .../{Modes => Rulesets}/UI/ComboCounter.cs | 2 +- .../UI/ComboResultCounter.cs | 2 +- .../{Modes => Rulesets}/UI/HealthDisplay.cs | 2 +- .../{Modes => Rulesets}/UI/HitRenderer.cs | 16 +-- osu.Game/{Modes => Rulesets}/UI/HudOverlay.cs | 4 +- osu.Game/{Modes => Rulesets}/UI/ModIcon.cs | 2 +- osu.Game/{Modes => Rulesets}/UI/Playfield.cs | 8 +- .../UI/StandardComboCounter.cs | 2 +- .../UI/StandardHealthDisplay.cs | 2 +- .../UI/StandardHudOverlay.cs | 2 +- osu.Game/Screens/BackgroundScreen.cs | 4 +- osu.Game/Screens/OsuScreen.cs | 4 +- osu.Game/Screens/Play/Player.cs | 6 +- osu.Game/Screens/Play/ReplayPlayer.cs | 2 +- osu.Game/Screens/Play/SongProgress.cs | 4 +- osu.Game/Screens/Ranking/Results.cs | 2 +- osu.Game/Screens/ScreenWhiteBox.cs | 2 +- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 6 +- .../Select/Leaderboards/DrawableRank.cs | 2 +- .../Select/Leaderboards/Leaderboard.cs | 2 +- .../Select/Leaderboards/LeaderboardScore.cs | 4 +- osu.Game/osu.Game.csproj | 132 +++++++++--------- osu.sln | 8 +- 236 files changed, 642 insertions(+), 642 deletions(-) rename {osu.Game.Modes.Catch => osu.Game.Rulesets.Catch}/Beatmaps/CatchBeatmapConverter.cs (73%) rename {osu.Game.Modes.Catch => osu.Game.Rulesets.Catch}/CatchDifficultyCalculator.cs (79%) rename {osu.Game.Modes.Catch => osu.Game.Rulesets.Catch}/CatchRuleset.cs (90%) rename {osu.Game.Modes.Catch => osu.Game.Rulesets.Catch}/Judgements/CatchJudgement.cs (78%) rename {osu.Game.Modes.Catch => osu.Game.Rulesets.Catch}/Mods/CatchMod.cs (91%) rename {osu.Game.Modes.Catch => osu.Game.Rulesets.Catch}/Objects/CatchBaseHit.cs (75%) rename {osu.Game.Modes.Catch => osu.Game.Rulesets.Catch}/Objects/Drawable/DrawableFruit.cs (93%) rename {osu.Game.Modes.Catch => osu.Game.Rulesets.Catch}/Objects/Droplet.cs (80%) rename {osu.Game.Modes.Catch => osu.Game.Rulesets.Catch}/Objects/Fruit.cs (80%) rename {osu.Game.Modes.Catch => osu.Game.Rulesets.Catch}/OpenTK.dll.config (100%) rename {osu.Game.Modes.Catch => osu.Game.Rulesets.Catch}/Properties/AssemblyInfo.cs (90%) rename {osu.Game.Modes.Catch => osu.Game.Rulesets.Catch}/Scoring/CatchScoreProcessor.cs (72%) rename {osu.Game.Modes.Catch => osu.Game.Rulesets.Catch}/UI/CatchHitRenderer.cs (69%) rename {osu.Game.Modes.Catch => osu.Game.Rulesets.Catch}/UI/CatchPlayfield.cs (77%) rename osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj => osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj (92%) rename {osu.Game.Modes.Catch => osu.Game.Rulesets.Catch}/packages.config (100%) rename {osu.Game.Modes.Mania => osu.Game.Rulesets.Mania}/Beatmaps/ManiaBeatmapConverter.cs (73%) rename {osu.Game.Modes.Mania => osu.Game.Rulesets.Mania}/Judgements/ManiaJudgement.cs (78%) rename {osu.Game.Modes.Mania => osu.Game.Rulesets.Mania}/ManiaDifficultyCalculator.cs (79%) rename {osu.Game.Modes.Mania => osu.Game.Rulesets.Mania}/ManiaRuleset.cs (91%) rename {osu.Game.Modes.Mania => osu.Game.Rulesets.Mania}/Mods/ManiaMod.cs (94%) rename {osu.Game.Modes.Mania => osu.Game.Rulesets.Mania}/Objects/Drawable/DrawableNote.cs (93%) rename {osu.Game.Modes.Mania => osu.Game.Rulesets.Mania}/Objects/HoldNote.cs (79%) rename {osu.Game.Modes.Mania => osu.Game.Rulesets.Mania}/Objects/ManiaBaseHit.cs (74%) rename {osu.Game.Modes.Mania => osu.Game.Rulesets.Mania}/Objects/Note.cs (80%) rename {osu.Game.Modes.Mania => osu.Game.Rulesets.Mania}/OpenTK.dll.config (100%) rename {osu.Game.Modes.Mania => osu.Game.Rulesets.Mania}/Properties/AssemblyInfo.cs (90%) rename {osu.Game.Modes.Mania => osu.Game.Rulesets.Mania}/Scoring/ManiaScoreProcessor.cs (72%) rename {osu.Game.Modes.Mania => osu.Game.Rulesets.Mania}/UI/ManiaHitRenderer.cs (71%) rename {osu.Game.Modes.Mania => osu.Game.Rulesets.Mania}/UI/ManiaPlayfield.cs (84%) rename osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj => osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj (89%) rename {osu.Game.Modes.Mania => osu.Game.Rulesets.Mania}/packages.config (100%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Beatmaps/OsuBeatmapConverter.cs (87%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Beatmaps/OsuBeatmapProcessor.cs (95%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Judgements/OsuJudgement.cs (89%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Mods/OsuMod.cs (93%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Objects/Drawables/Connections/ConnectionRenderer.cs (83%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Objects/Drawables/Connections/FollowPoint.cs (93%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Objects/Drawables/Connections/FollowPointRenderer.cs (94%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Objects/Drawables/DrawableHitCircle.cs (93%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Objects/Drawables/DrawableOsuHitObject.cs (89%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Objects/Drawables/DrawableOsuJudgement.cs (76%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Objects/Drawables/DrawableSlider.cs (95%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Objects/Drawables/DrawableSliderTick.cs (92%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Objects/Drawables/DrawableSpinner.cs (93%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Objects/Drawables/Pieces/ApproachCircle.cs (90%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Objects/Drawables/Pieces/CirclePiece.cs (93%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Objects/Drawables/Pieces/ExplodePiece.cs (90%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Objects/Drawables/Pieces/FlashPiece.cs (89%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Objects/Drawables/Pieces/GlowPiece.cs (91%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Objects/Drawables/Pieces/NumberPiece.cs (93%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Objects/Drawables/Pieces/RingPiece.cs (90%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Objects/Drawables/Pieces/SliderBall.cs (95%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Objects/Drawables/Pieces/SliderBody.cs (96%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Objects/Drawables/Pieces/SliderBouncer.cs (93%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Objects/Drawables/Pieces/SpinnerBackground.cs (80%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Objects/Drawables/Pieces/SpinnerDisc.cs (95%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Objects/Drawables/Pieces/TrianglesPiece.cs (89%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Objects/HitCircle.cs (81%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Objects/OsuHitObject.cs (91%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Objects/OsuHitObjectDifficulty.cs (97%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Objects/Slider.cs (94%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Objects/SliderTick.cs (83%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Objects/Spinner.cs (79%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/OpenTK.dll.config (100%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/OsuAutoReplay.cs (96%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/OsuDifficultyCalculator.cs (96%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/OsuKeyConversionInputManager.cs (95%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/OsuRuleset.cs (90%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Properties/AssemblyInfo.cs (100%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Scoring/OsuScore.cs (71%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/Scoring/OsuScoreProcessor.cs (83%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/UI/OsuHitRenderer.cs (78%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/UI/OsuPlayfield.cs (88%) rename osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj => osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj (96%) rename {osu.Game.Modes.Osu => osu.Game.Rulesets.Osu}/packages.config (100%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Beatmaps/TaikoBeatmapConverter.cs (95%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Judgements/TaikoDrumRollTickJudgement.cs (92%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Judgements/TaikoHitResult.cs (84%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Judgements/TaikoJudgement.cs (93%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Judgements/TaikoStrongHitJudgement.cs (84%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Mods/TaikoMod.cs (87%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Objects/BarLine.cs (80%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Objects/CentreHit.cs (79%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Objects/Drawables/DrawableBarLine.cs (94%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Objects/Drawables/DrawableBarLineMajor.cs (94%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Objects/Drawables/DrawableCentreHit.cs (83%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Objects/Drawables/DrawableCentreHitStrong.cs (83%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Objects/Drawables/DrawableDrumRoll.cs (92%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Objects/Drawables/DrawableDrumRollTick.cs (87%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Objects/Drawables/DrawableHit.cs (91%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Objects/Drawables/DrawableHitStrong.cs (90%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Objects/Drawables/DrawableRimHit.cs (83%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Objects/Drawables/DrawableRimHitStrong.cs (83%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Objects/Drawables/DrawableSwell.cs (95%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Objects/Drawables/DrawableTaikoHitObject.cs (91%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Objects/Drawables/Pieces/CentreHitSymbolPiece.cs (90%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Objects/Drawables/Pieces/CirclePiece.cs (95%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Objects/Drawables/Pieces/ElongatedCirclePiece.cs (90%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Objects/Drawables/Pieces/RimHitSymbolPiece.cs (91%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Objects/Drawables/Pieces/SwellSymbolPiece.cs (88%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Objects/Drawables/Pieces/TaikoPiece.cs (91%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Objects/Drawables/Pieces/TickPiece.cs (93%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Objects/DrumRoll.cs (94%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Objects/DrumRollTick.cs (91%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Objects/Hit.cs (93%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Objects/RimHit.cs (79%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Objects/Swell.cs (83%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Objects/TaikoHitObject.cs (93%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/OpenTK.dll.config (100%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Properties/AssemblyInfo.cs (90%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Replays/TaikoAutoReplay.cs (93%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Replays/TaikoFramedReplayInputHandler.cs (90%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/Scoring/TaikoScoreProcessor.cs (95%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/TaikoDifficultyCalculator.cs (79%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/TaikoRuleset.cs (90%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/UI/DrawableTaikoJudgement.cs (88%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/UI/HitExplosion.cs (91%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/UI/HitTarget.cs (95%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/UI/InputDrum.cs (96%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/UI/TaikoHitRenderer.cs (88%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/UI/TaikoPlayfield.cs (95%) rename osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj => osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj (96%) rename {osu.Game.Modes.Taiko => osu.Game.Rulesets.Taiko}/packages.config (100%) rename osu.Game/{Modes => Rulesets}/BeatmapStatistic.cs (88%) rename osu.Game/{Modes => Rulesets}/Beatmaps/BeatmapConverter.cs (95%) rename osu.Game/{Modes => Rulesets}/Beatmaps/BeatmapProcessor.cs (89%) rename osu.Game/{Modes => Rulesets}/Judgements/DrawableJudgement.cs (94%) rename osu.Game/{Modes => Rulesets}/Judgements/IPartialJudgement.cs (87%) rename osu.Game/{Modes => Rulesets}/Judgements/Judgement.cs (88%) rename osu.Game/{Modes => Rulesets}/Mods/IApplicableMod.cs (85%) rename osu.Game/{Modes => Rulesets}/Mods/Mod.cs (95%) rename osu.Game/{Modes => Rulesets}/Mods/ModType.cs (85%) rename osu.Game/{Modes => Rulesets}/Objects/BezierApproximator.cs (97%) rename osu.Game/{Modes => Rulesets}/Objects/CircularArcApproximator.cs (96%) rename osu.Game/{Modes => Rulesets}/Objects/CurvedHitObject.cs (91%) rename osu.Game/{Modes => Rulesets}/Objects/Drawables/ArmedState.cs (80%) rename osu.Game/{Modes => Rulesets}/Objects/Drawables/DrawableHitObject.cs (94%) rename osu.Game/{Modes => Rulesets}/Objects/Drawables/HitResult.cs (90%) rename osu.Game/{Modes => Rulesets}/Objects/Drawables/IDrawableHitObjectWithProxiedApproach.cs (83%) rename osu.Game/{Modes => Rulesets}/Objects/HitObject.cs (95%) rename osu.Game/{Modes => Rulesets}/Objects/HitObjectParser.cs (85%) rename osu.Game/{Modes => Rulesets}/Objects/Legacy/Catch/Hit.cs (79%) rename osu.Game/{Modes => Rulesets}/Objects/Legacy/Catch/HitObjectParser.cs (90%) rename osu.Game/{Modes => Rulesets}/Objects/Legacy/Catch/Slider.cs (80%) rename osu.Game/{Modes => Rulesets}/Objects/Legacy/Catch/Spinner.cs (80%) rename osu.Game/{Modes => Rulesets}/Objects/Legacy/HitObjectParser.cs (96%) rename osu.Game/{Modes => Rulesets}/Objects/Legacy/HitObjectType.cs (86%) rename osu.Game/{Modes => Rulesets}/Objects/Legacy/Hold.cs (83%) rename osu.Game/{Modes => Rulesets}/Objects/Legacy/Mania/Hit.cs (79%) rename osu.Game/{Modes => Rulesets}/Objects/Legacy/Mania/HitObjectParser.cs (90%) rename osu.Game/{Modes => Rulesets}/Objects/Legacy/Mania/Slider.cs (80%) rename osu.Game/{Modes => Rulesets}/Objects/Legacy/Mania/Spinner.cs (81%) rename osu.Game/{Modes => Rulesets}/Objects/Legacy/Osu/Hit.cs (82%) rename osu.Game/{Modes => Rulesets}/Objects/Legacy/Osu/HitObjectParser.cs (90%) rename osu.Game/{Modes => Rulesets}/Objects/Legacy/Osu/Slider.cs (82%) rename osu.Game/{Modes => Rulesets}/Objects/Legacy/Osu/Spinner.cs (84%) rename osu.Game/{Modes => Rulesets}/Objects/Legacy/Taiko/Hit.cs (78%) rename osu.Game/{Modes => Rulesets}/Objects/Legacy/Taiko/HitObjectParser.cs (90%) rename osu.Game/{Modes => Rulesets}/Objects/Legacy/Taiko/Slider.cs (78%) rename osu.Game/{Modes => Rulesets}/Objects/Legacy/Taiko/Spinner.cs (80%) rename osu.Game/{Modes => Rulesets}/Objects/SliderCurve.cs (96%) rename osu.Game/{Modes => Rulesets}/Objects/Types/CurveType.cs (82%) rename osu.Game/{Modes => Rulesets}/Objects/Types/IHasCombo.cs (87%) rename osu.Game/{Modes => Rulesets}/Objects/Types/IHasCurve.cs (95%) rename osu.Game/{Modes => Rulesets}/Objects/Types/IHasDistance.cs (88%) rename osu.Game/{Modes => Rulesets}/Objects/Types/IHasEndTime.cs (89%) rename osu.Game/{Modes => Rulesets}/Objects/Types/IHasHold.cs (85%) rename osu.Game/{Modes => Rulesets}/Objects/Types/IHasPosition.cs (88%) rename osu.Game/{Modes => Rulesets}/Objects/Types/IHasRepeats.cs (88%) rename osu.Game/{Modes => Rulesets}/Objects/Types/IHasXPosition.cs (87%) rename osu.Game/{Modes => Rulesets}/Objects/Types/IHasYPosition.cs (87%) rename osu.Game/{Modes => Rulesets}/Replays/FramedReplayInputHandler.cs (96%) rename osu.Game/{Modes => Rulesets}/Replays/Replay.cs (86%) rename osu.Game/{Modes => Rulesets}/Replays/ReplayButtonState.cs (86%) rename osu.Game/{Modes => Rulesets}/Replays/ReplayFrame.cs (95%) rename osu.Game/{Modes => Rulesets}/Ruleset.cs (87%) rename osu.Game/{Modes => Rulesets}/Scoring/Score.cs (93%) rename osu.Game/{Modes => Rulesets}/Scoring/ScoreProcessor.cs (92%) rename osu.Game/{Modes => Rulesets}/Scoring/ScoreRank.cs (90%) rename osu.Game/{Modes => Rulesets}/UI/ComboCounter.cs (96%) rename osu.Game/{Modes => Rulesets}/UI/ComboResultCounter.cs (95%) rename osu.Game/{Modes => Rulesets}/UI/HealthDisplay.cs (91%) rename osu.Game/{Modes => Rulesets}/UI/HitRenderer.cs (94%) rename osu.Game/{Modes => Rulesets}/UI/HudOverlay.cs (95%) rename osu.Game/{Modes => Rulesets}/UI/ModIcon.cs (94%) rename osu.Game/{Modes => Rulesets}/UI/Playfield.cs (93%) rename osu.Game/{Modes => Rulesets}/UI/StandardComboCounter.cs (96%) rename osu.Game/{Modes => Rulesets}/UI/StandardHealthDisplay.cs (95%) rename osu.Game/{Modes => Rulesets}/UI/StandardHudOverlay.cs (96%) diff --git a/osu.Desktop.Tests/osu.Desktop.Tests.csproj b/osu.Desktop.Tests/osu.Desktop.Tests.csproj index 8afd632bd1..f0620c98ef 100644 --- a/osu.Desktop.Tests/osu.Desktop.Tests.csproj +++ b/osu.Desktop.Tests/osu.Desktop.Tests.csproj @@ -75,21 +75,21 @@ {69051C69-12AE-4E7D-A3E6-460D2E282312} osu.Desktop.VisualTests - + {58F6C80C-1253-4A0E-A465-B8C85EBEADF3} - osu.Game.Modes.Catch + osu.Game.Rulesets.Catch - + {48F4582B-7687-4621-9CBE-5C24197CB536} - osu.Game.Modes.Mania + osu.Game.Rulesets.Mania - + {C92A607B-1FDD-4954-9F92-03FF547D9080} - osu.Game.Modes.Osu + osu.Game.Rulesets.Osu - + {F167E17A-7DE6-4AF5-B920-A5112296C695} - osu.Game.Modes.Taiko + osu.Game.Rulesets.Taiko {0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D} diff --git a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs index 87b201a8e8..cb15558ec3 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs @@ -9,12 +9,12 @@ using osu.Framework.Testing; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Database; -using osu.Game.Modes.Catch.UI; -using osu.Game.Modes.Mania.UI; -using osu.Game.Modes.Objects; -using osu.Game.Modes.Osu.Objects; -using osu.Game.Modes.Osu.UI; -using osu.Game.Modes.Taiko.UI; +using osu.Game.Rulesets.Catch.UI; +using osu.Game.Rulesets.Mania.UI; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.UI; +using osu.Game.Rulesets.Taiko.UI; using System.Collections.Generic; using osu.Desktop.VisualTests.Beatmaps; using osu.Framework.Allocation; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs index 3d9f3aad79..15b38b3e83 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs @@ -10,11 +10,11 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Framework.Testing; using osu.Framework.Timing; -using osu.Game.Modes.Objects; -using osu.Game.Modes.Objects.Drawables; -using osu.Game.Modes.Osu.Judgements; -using osu.Game.Modes.Osu.Objects; -using osu.Game.Modes.Osu.Objects.Drawables; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Osu.Judgements; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables; using System.Collections.Generic; namespace osu.Desktop.VisualTests.Tests diff --git a/osu.Desktop.VisualTests/Tests/TestCaseLeaderboard.cs b/osu.Desktop.VisualTests/Tests/TestCaseLeaderboard.cs index 44e52c237e..39010baf91 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseLeaderboard.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseLeaderboard.cs @@ -4,9 +4,9 @@ using OpenTK; using osu.Framework.Graphics; using osu.Framework.Testing; -using osu.Game.Modes.Mods; -using osu.Game.Modes.Osu.Mods; -using osu.Game.Modes.Scoring; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Osu.Mods; +using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Select.Leaderboards; using osu.Game.Users; diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs index c196476545..f28cdd6a7e 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs @@ -9,12 +9,12 @@ using osu.Game.Beatmaps; using OpenTK; using osu.Framework.Graphics.Sprites; using osu.Game.Database; -using osu.Game.Modes.Objects; -using osu.Game.Modes.Osu.Objects; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Osu.Objects; using osu.Game.Screens.Play; using OpenTK.Graphics; using osu.Desktop.VisualTests.Beatmaps; -using osu.Game.Modes.Osu.UI; +using osu.Game.Rulesets.Osu.UI; namespace osu.Desktop.VisualTests.Tests { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseReplay.cs b/osu.Desktop.VisualTests/Tests/TestCaseReplay.cs index ffdca25bb3..e00a912278 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseReplay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseReplay.cs @@ -2,8 +2,8 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Beatmaps; -using osu.Game.Modes.Mods; -using osu.Game.Modes.Osu.Mods; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Osu.Mods; using osu.Game.Screens.Play; namespace osu.Desktop.VisualTests.Tests diff --git a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs index f3cca16678..d8dac63980 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.MathUtils; using osu.Framework.Testing; using osu.Game.Graphics.UserInterface; -using osu.Game.Modes.UI; +using osu.Game.Rulesets.UI; namespace osu.Desktop.VisualTests.Tests { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs index 363b0b481e..a75d70acaf 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs @@ -6,7 +6,7 @@ using osu.Framework.Graphics; using osu.Framework.MathUtils; using osu.Framework.Testing; using osu.Framework.Timing; -using osu.Game.Modes.Objects; +using osu.Game.Rulesets.Objects; using osu.Game.Screens.Play; namespace osu.Desktop.VisualTests.Tests diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs index b3cb8c3457..d769071bd9 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs @@ -6,7 +6,7 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; -using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; +using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; namespace osu.Desktop.VisualTests.Tests { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 4e9ff4980e..259d0267db 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -7,11 +7,11 @@ using osu.Framework.Graphics.Containers; using osu.Framework.MathUtils; using osu.Framework.Testing; using osu.Framework.Timing; -using osu.Game.Modes.Objects.Drawables; -using osu.Game.Modes.Taiko.Judgements; -using osu.Game.Modes.Taiko.Objects; -using osu.Game.Modes.Taiko.Objects.Drawables; -using osu.Game.Modes.Taiko.UI; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Taiko.Judgements; +using osu.Game.Rulesets.Taiko.Objects; +using osu.Game.Rulesets.Taiko.Objects.Drawables; +using osu.Game.Rulesets.Taiko.UI; using System; namespace osu.Desktop.VisualTests.Tests diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index 4fc0a93fb4..80b18c4a9b 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -161,21 +161,21 @@ {d9a367c9-4c1a-489f-9b05-a0cea2b53b58} osu.Game.Resources - + {c92a607b-1fdd-4954-9f92-03ff547d9080} - osu.Game.Modes.Osu + osu.Game.Rulesets.Osu - + {58f6c80c-1253-4a0e-a465-b8c85ebeadf3} - osu.Game.Modes.Catch + osu.Game.Rulesets.Catch - + {48f4582b-7687-4621-9cbe-5c24197cb536} - osu.Game.Modes.Mania + osu.Game.Rulesets.Mania - + {f167e17a-7de6-4af5-b920-a5112296c695} - osu.Game.Modes.Taiko + osu.Game.Rulesets.Taiko {0d3fbf8a-7464-4cf7-8c90-3e7886df2d4d} diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index 553dff6c6f..4f66dfd3eb 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -198,21 +198,21 @@ {d9a367c9-4c1a-489f-9b05-a0cea2b53b58} osu.Game.Resources - + {c92a607b-1fdd-4954-9f92-03ff547d9080} - osu.Game.Modes.Osu + osu.Game.Rulesets.Osu - + {58f6c80c-1253-4a0e-a465-b8c85ebeadf3} - osu.Game.Modes.Catch + osu.Game.Rulesets.Catch - + {48f4582b-7687-4621-9cbe-5c24197cb536} - osu.Game.Modes.Mania + osu.Game.Rulesets.Mania - + {f167e17a-7de6-4af5-b920-a5112296c695} - osu.Game.Modes.Taiko + osu.Game.Rulesets.Taiko {0d3fbf8a-7464-4cf7-8c90-3e7886df2d4d} diff --git a/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs similarity index 73% rename from osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs rename to osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs index bd09e19ab8..f9859cd244 100644 --- a/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs +++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs @@ -2,14 +2,14 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Beatmaps; -using osu.Game.Modes.Catch.Objects; +using osu.Game.Rulesets.Catch.Objects; using System.Collections.Generic; using System; -using osu.Game.Modes.Objects.Types; -using osu.Game.Modes.Beatmaps; -using osu.Game.Modes.Objects; +using osu.Game.Rulesets.Objects.Types; +using osu.Game.Rulesets.Beatmaps; +using osu.Game.Rulesets.Objects; -namespace osu.Game.Modes.Catch.Beatmaps +namespace osu.Game.Rulesets.Catch.Beatmaps { internal class CatchBeatmapConverter : BeatmapConverter { diff --git a/osu.Game.Modes.Catch/CatchDifficultyCalculator.cs b/osu.Game.Rulesets.Catch/CatchDifficultyCalculator.cs similarity index 79% rename from osu.Game.Modes.Catch/CatchDifficultyCalculator.cs rename to osu.Game.Rulesets.Catch/CatchDifficultyCalculator.cs index 7e47db6259..a865299cff 100644 --- a/osu.Game.Modes.Catch/CatchDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Catch/CatchDifficultyCalculator.cs @@ -2,12 +2,12 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Beatmaps; -using osu.Game.Modes.Beatmaps; -using osu.Game.Modes.Catch.Beatmaps; -using osu.Game.Modes.Catch.Objects; +using osu.Game.Rulesets.Beatmaps; +using osu.Game.Rulesets.Catch.Beatmaps; +using osu.Game.Rulesets.Catch.Objects; using System.Collections.Generic; -namespace osu.Game.Modes.Catch +namespace osu.Game.Rulesets.Catch { public class CatchDifficultyCalculator : DifficultyCalculator { diff --git a/osu.Game.Modes.Catch/CatchRuleset.cs b/osu.Game.Rulesets.Catch/CatchRuleset.cs similarity index 90% rename from osu.Game.Modes.Catch/CatchRuleset.cs rename to osu.Game.Rulesets.Catch/CatchRuleset.cs index 6aafb2a3c6..a6faf13d51 100644 --- a/osu.Game.Modes.Catch/CatchRuleset.cs +++ b/osu.Game.Rulesets.Catch/CatchRuleset.cs @@ -4,16 +4,16 @@ using OpenTK.Input; using osu.Game.Beatmaps; using osu.Game.Graphics; -using osu.Game.Modes.Catch.Mods; -using osu.Game.Modes.Catch.UI; -using osu.Game.Modes.Mods; -using osu.Game.Modes.UI; +using osu.Game.Rulesets.Catch.Mods; +using osu.Game.Rulesets.Catch.UI; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.UI; using osu.Game.Screens.Play; using System.Collections.Generic; -using osu.Game.Modes.Catch.Scoring; -using osu.Game.Modes.Scoring; +using osu.Game.Rulesets.Catch.Scoring; +using osu.Game.Rulesets.Scoring; -namespace osu.Game.Modes.Catch +namespace osu.Game.Rulesets.Catch { public class CatchRuleset : Ruleset { diff --git a/osu.Game.Modes.Catch/Judgements/CatchJudgement.cs b/osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs similarity index 78% rename from osu.Game.Modes.Catch/Judgements/CatchJudgement.cs rename to osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs index eaacedd7e0..f0125b4c3a 100644 --- a/osu.Game.Modes.Catch/Judgements/CatchJudgement.cs +++ b/osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs @@ -1,9 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Judgements; +using osu.Game.Rulesets.Judgements; -namespace osu.Game.Modes.Catch.Judgements +namespace osu.Game.Rulesets.Catch.Judgements { public class CatchJudgement : Judgement { diff --git a/osu.Game.Modes.Catch/Mods/CatchMod.cs b/osu.Game.Rulesets.Catch/Mods/CatchMod.cs similarity index 91% rename from osu.Game.Modes.Catch/Mods/CatchMod.cs rename to osu.Game.Rulesets.Catch/Mods/CatchMod.cs index 97e4e58a5d..64a0c51b72 100644 --- a/osu.Game.Modes.Catch/Mods/CatchMod.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchMod.cs @@ -1,9 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Mods; +using osu.Game.Rulesets.Mods; -namespace osu.Game.Modes.Catch.Mods +namespace osu.Game.Rulesets.Catch.Mods { public class CatchModNoFail : ModNoFail { diff --git a/osu.Game.Modes.Catch/Objects/CatchBaseHit.cs b/osu.Game.Rulesets.Catch/Objects/CatchBaseHit.cs similarity index 75% rename from osu.Game.Modes.Catch/Objects/CatchBaseHit.cs rename to osu.Game.Rulesets.Catch/Objects/CatchBaseHit.cs index ee66894d31..de0547580f 100644 --- a/osu.Game.Modes.Catch/Objects/CatchBaseHit.cs +++ b/osu.Game.Rulesets.Catch/Objects/CatchBaseHit.cs @@ -1,9 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Objects; +using osu.Game.Rulesets.Objects; -namespace osu.Game.Modes.Catch.Objects +namespace osu.Game.Rulesets.Catch.Objects { public abstract class CatchBaseHit : HitObject { diff --git a/osu.Game.Modes.Catch/Objects/Drawable/DrawableFruit.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs similarity index 93% rename from osu.Game.Modes.Catch/Objects/Drawable/DrawableFruit.cs rename to osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs index 885048b938..ae6585bdb2 100644 --- a/osu.Game.Modes.Catch/Objects/Drawable/DrawableFruit.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Transforms; using OpenTK; -namespace osu.Game.Modes.Catch.Objects.Drawable +namespace osu.Game.Rulesets.Catch.Objects.Drawable { internal class DrawableFruit : Sprite { diff --git a/osu.Game.Modes.Catch/Objects/Droplet.cs b/osu.Game.Rulesets.Catch/Objects/Droplet.cs similarity index 80% rename from osu.Game.Modes.Catch/Objects/Droplet.cs rename to osu.Game.Rulesets.Catch/Objects/Droplet.cs index dd58fec7e8..b1206e0d75 100644 --- a/osu.Game.Modes.Catch/Objects/Droplet.cs +++ b/osu.Game.Rulesets.Catch/Objects/Droplet.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 -namespace osu.Game.Modes.Catch.Objects +namespace osu.Game.Rulesets.Catch.Objects { public class Droplet : CatchBaseHit { diff --git a/osu.Game.Modes.Catch/Objects/Fruit.cs b/osu.Game.Rulesets.Catch/Objects/Fruit.cs similarity index 80% rename from osu.Game.Modes.Catch/Objects/Fruit.cs rename to osu.Game.Rulesets.Catch/Objects/Fruit.cs index 15363a7031..fc55f83969 100644 --- a/osu.Game.Modes.Catch/Objects/Fruit.cs +++ b/osu.Game.Rulesets.Catch/Objects/Fruit.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 -namespace osu.Game.Modes.Catch.Objects +namespace osu.Game.Rulesets.Catch.Objects { public class Fruit : CatchBaseHit { diff --git a/osu.Game.Modes.Catch/OpenTK.dll.config b/osu.Game.Rulesets.Catch/OpenTK.dll.config similarity index 100% rename from osu.Game.Modes.Catch/OpenTK.dll.config rename to osu.Game.Rulesets.Catch/OpenTK.dll.config diff --git a/osu.Game.Modes.Catch/Properties/AssemblyInfo.cs b/osu.Game.Rulesets.Catch/Properties/AssemblyInfo.cs similarity index 90% rename from osu.Game.Modes.Catch/Properties/AssemblyInfo.cs rename to osu.Game.Rulesets.Catch/Properties/AssemblyInfo.cs index 1d25411e73..42fbc7e082 100644 --- a/osu.Game.Modes.Catch/Properties/AssemblyInfo.cs +++ b/osu.Game.Rulesets.Catch/Properties/AssemblyInfo.cs @@ -7,11 +7,11 @@ using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("osu.Game.Modes.Catch")] +[assembly: AssemblyTitle("osu.Game.Rulesets.Catch")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("osu.Game.Modes.Catch")] +[assembly: AssemblyProduct("osu.Game.Rulesets.Catch")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/osu.Game.Modes.Catch/Scoring/CatchScoreProcessor.cs b/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs similarity index 72% rename from osu.Game.Modes.Catch/Scoring/CatchScoreProcessor.cs rename to osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs index 1b9bedf7fb..3f29547e46 100644 --- a/osu.Game.Modes.Catch/Scoring/CatchScoreProcessor.cs +++ b/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs @@ -1,12 +1,12 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Catch.Judgements; -using osu.Game.Modes.Catch.Objects; -using osu.Game.Modes.Scoring; -using osu.Game.Modes.UI; +using osu.Game.Rulesets.Catch.Judgements; +using osu.Game.Rulesets.Catch.Objects; +using osu.Game.Rulesets.Scoring; +using osu.Game.Rulesets.UI; -namespace osu.Game.Modes.Catch.Scoring +namespace osu.Game.Rulesets.Catch.Scoring { internal class CatchScoreProcessor : ScoreProcessor { diff --git a/osu.Game.Modes.Catch/UI/CatchHitRenderer.cs b/osu.Game.Rulesets.Catch/UI/CatchHitRenderer.cs similarity index 69% rename from osu.Game.Modes.Catch/UI/CatchHitRenderer.cs rename to osu.Game.Rulesets.Catch/UI/CatchHitRenderer.cs index 795904935d..f34585be55 100644 --- a/osu.Game.Modes.Catch/UI/CatchHitRenderer.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchHitRenderer.cs @@ -2,16 +2,16 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Beatmaps; -using osu.Game.Modes.Beatmaps; -using osu.Game.Modes.Catch.Beatmaps; -using osu.Game.Modes.Catch.Judgements; -using osu.Game.Modes.Catch.Objects; -using osu.Game.Modes.Catch.Scoring; -using osu.Game.Modes.Objects.Drawables; -using osu.Game.Modes.Scoring; -using osu.Game.Modes.UI; +using osu.Game.Rulesets.Beatmaps; +using osu.Game.Rulesets.Catch.Beatmaps; +using osu.Game.Rulesets.Catch.Judgements; +using osu.Game.Rulesets.Catch.Objects; +using osu.Game.Rulesets.Catch.Scoring; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Scoring; +using osu.Game.Rulesets.UI; -namespace osu.Game.Modes.Catch.UI +namespace osu.Game.Rulesets.Catch.UI { public class CatchHitRenderer : HitRenderer { diff --git a/osu.Game.Modes.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs similarity index 77% rename from osu.Game.Modes.Catch/UI/CatchPlayfield.cs rename to osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index f8792a7fd5..4b1e6e93cd 100644 --- a/osu.Game.Modes.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -3,12 +3,12 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; -using osu.Game.Modes.Catch.Objects; -using osu.Game.Modes.UI; +using osu.Game.Rulesets.Catch.Objects; +using osu.Game.Rulesets.UI; using OpenTK; -using osu.Game.Modes.Catch.Judgements; +using osu.Game.Rulesets.Catch.Judgements; -namespace osu.Game.Modes.Catch.UI +namespace osu.Game.Rulesets.Catch.UI { public class CatchPlayfield : Playfield { diff --git a/osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj b/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj similarity index 92% rename from osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj rename to osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj index dc1ea5dc23..281d2b5a79 100644 --- a/osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj +++ b/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj @@ -7,8 +7,8 @@ {58F6C80C-1253-4A0E-A465-B8C85EBEADF3} Library Properties - osu.Game.Modes.Catch - osu.Game.Modes.Catch + osu.Game.Rulesets.Catch + osu.Game.Rulesets.Catch v4.5 512 @@ -73,9 +73,9 @@ {C76BF5B3-985E-4D39-95FE-97C9C879B83A} osu.Framework - + {C92A607B-1FDD-4954-9F92-03FF547D9080} - osu.Game.Modes.Osu + osu.Game.Rulesets.Osu {0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D} diff --git a/osu.Game.Modes.Catch/packages.config b/osu.Game.Rulesets.Catch/packages.config similarity index 100% rename from osu.Game.Modes.Catch/packages.config rename to osu.Game.Rulesets.Catch/packages.config diff --git a/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs similarity index 73% rename from osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs rename to osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index c804fd4eeb..847af965cc 100644 --- a/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -2,14 +2,14 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Beatmaps; -using osu.Game.Modes.Mania.Objects; +using osu.Game.Rulesets.Mania.Objects; using System.Collections.Generic; using System; -using osu.Game.Modes.Objects.Types; -using osu.Game.Modes.Beatmaps; -using osu.Game.Modes.Objects; +using osu.Game.Rulesets.Objects.Types; +using osu.Game.Rulesets.Beatmaps; +using osu.Game.Rulesets.Objects; -namespace osu.Game.Modes.Mania.Beatmaps +namespace osu.Game.Rulesets.Mania.Beatmaps { internal class ManiaBeatmapConverter : BeatmapConverter { diff --git a/osu.Game.Modes.Mania/Judgements/ManiaJudgement.cs b/osu.Game.Rulesets.Mania/Judgements/ManiaJudgement.cs similarity index 78% rename from osu.Game.Modes.Mania/Judgements/ManiaJudgement.cs rename to osu.Game.Rulesets.Mania/Judgements/ManiaJudgement.cs index 3ef5b0f29b..8dafbd01a5 100644 --- a/osu.Game.Modes.Mania/Judgements/ManiaJudgement.cs +++ b/osu.Game.Rulesets.Mania/Judgements/ManiaJudgement.cs @@ -1,9 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Judgements; +using osu.Game.Rulesets.Judgements; -namespace osu.Game.Modes.Mania.Judgements +namespace osu.Game.Rulesets.Mania.Judgements { public class ManiaJudgement : Judgement { diff --git a/osu.Game.Modes.Mania/ManiaDifficultyCalculator.cs b/osu.Game.Rulesets.Mania/ManiaDifficultyCalculator.cs similarity index 79% rename from osu.Game.Modes.Mania/ManiaDifficultyCalculator.cs rename to osu.Game.Rulesets.Mania/ManiaDifficultyCalculator.cs index 84e5ee2d72..e9bcc60d2c 100644 --- a/osu.Game.Modes.Mania/ManiaDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Mania/ManiaDifficultyCalculator.cs @@ -2,12 +2,12 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Beatmaps; -using osu.Game.Modes.Beatmaps; -using osu.Game.Modes.Mania.Beatmaps; -using osu.Game.Modes.Mania.Objects; +using osu.Game.Rulesets.Beatmaps; +using osu.Game.Rulesets.Mania.Beatmaps; +using osu.Game.Rulesets.Mania.Objects; using System.Collections.Generic; -namespace osu.Game.Modes.Mania +namespace osu.Game.Rulesets.Mania { public class ManiaDifficultyCalculator : DifficultyCalculator { diff --git a/osu.Game.Modes.Mania/ManiaRuleset.cs b/osu.Game.Rulesets.Mania/ManiaRuleset.cs similarity index 91% rename from osu.Game.Modes.Mania/ManiaRuleset.cs rename to osu.Game.Rulesets.Mania/ManiaRuleset.cs index 030cea7344..26614075b1 100644 --- a/osu.Game.Modes.Mania/ManiaRuleset.cs +++ b/osu.Game.Rulesets.Mania/ManiaRuleset.cs @@ -3,16 +3,16 @@ using osu.Game.Beatmaps; using osu.Game.Graphics; -using osu.Game.Modes.Mania.Mods; -using osu.Game.Modes.Mania.UI; -using osu.Game.Modes.Mods; -using osu.Game.Modes.UI; +using osu.Game.Rulesets.Mania.Mods; +using osu.Game.Rulesets.Mania.UI; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.UI; using osu.Game.Screens.Play; using System.Collections.Generic; -using osu.Game.Modes.Mania.Scoring; -using osu.Game.Modes.Scoring; +using osu.Game.Rulesets.Mania.Scoring; +using osu.Game.Rulesets.Scoring; -namespace osu.Game.Modes.Mania +namespace osu.Game.Rulesets.Mania { public class ManiaRuleset : Ruleset { diff --git a/osu.Game.Modes.Mania/Mods/ManiaMod.cs b/osu.Game.Rulesets.Mania/Mods/ManiaMod.cs similarity index 94% rename from osu.Game.Modes.Mania/Mods/ManiaMod.cs rename to osu.Game.Rulesets.Mania/Mods/ManiaMod.cs index b330680550..68458caeac 100644 --- a/osu.Game.Modes.Mania/Mods/ManiaMod.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaMod.cs @@ -2,10 +2,10 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Graphics; -using osu.Game.Modes.Mods; +using osu.Game.Rulesets.Mods; using System; -namespace osu.Game.Modes.Mania.Mods +namespace osu.Game.Rulesets.Mania.Mods { public class ManiaModNoFail : ModNoFail { diff --git a/osu.Game.Modes.Mania/Objects/Drawable/DrawableNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawable/DrawableNote.cs similarity index 93% rename from osu.Game.Modes.Mania/Objects/Drawable/DrawableNote.cs rename to osu.Game.Rulesets.Mania/Objects/Drawable/DrawableNote.cs index 76999cef21..07a27b1643 100644 --- a/osu.Game.Modes.Mania/Objects/Drawable/DrawableNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawable/DrawableNote.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics.Transforms; using osu.Framework.Graphics; using OpenTK; -namespace osu.Game.Modes.Mania.Objects.Drawable +namespace osu.Game.Rulesets.Mania.Objects.Drawable { public class DrawableNote : Sprite { diff --git a/osu.Game.Modes.Mania/Objects/HoldNote.cs b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs similarity index 79% rename from osu.Game.Modes.Mania/Objects/HoldNote.cs rename to osu.Game.Rulesets.Mania/Objects/HoldNote.cs index 3d95e11118..e8ce1da77f 100644 --- a/osu.Game.Modes.Mania/Objects/HoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/HoldNote.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 -namespace osu.Game.Modes.Mania.Objects +namespace osu.Game.Rulesets.Mania.Objects { public class HoldNote : Note { diff --git a/osu.Game.Modes.Mania/Objects/ManiaBaseHit.cs b/osu.Game.Rulesets.Mania/Objects/ManiaBaseHit.cs similarity index 74% rename from osu.Game.Modes.Mania/Objects/ManiaBaseHit.cs rename to osu.Game.Rulesets.Mania/Objects/ManiaBaseHit.cs index 8b3afc82d9..4c15b69eb7 100644 --- a/osu.Game.Modes.Mania/Objects/ManiaBaseHit.cs +++ b/osu.Game.Rulesets.Mania/Objects/ManiaBaseHit.cs @@ -1,9 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Objects; +using osu.Game.Rulesets.Objects; -namespace osu.Game.Modes.Mania.Objects +namespace osu.Game.Rulesets.Mania.Objects { public abstract class ManiaBaseHit : HitObject { diff --git a/osu.Game.Modes.Mania/Objects/Note.cs b/osu.Game.Rulesets.Mania/Objects/Note.cs similarity index 80% rename from osu.Game.Modes.Mania/Objects/Note.cs rename to osu.Game.Rulesets.Mania/Objects/Note.cs index c36ed8cf7e..5a6d6003db 100644 --- a/osu.Game.Modes.Mania/Objects/Note.cs +++ b/osu.Game.Rulesets.Mania/Objects/Note.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 -namespace osu.Game.Modes.Mania.Objects +namespace osu.Game.Rulesets.Mania.Objects { public class Note : ManiaBaseHit { diff --git a/osu.Game.Modes.Mania/OpenTK.dll.config b/osu.Game.Rulesets.Mania/OpenTK.dll.config similarity index 100% rename from osu.Game.Modes.Mania/OpenTK.dll.config rename to osu.Game.Rulesets.Mania/OpenTK.dll.config diff --git a/osu.Game.Modes.Mania/Properties/AssemblyInfo.cs b/osu.Game.Rulesets.Mania/Properties/AssemblyInfo.cs similarity index 90% rename from osu.Game.Modes.Mania/Properties/AssemblyInfo.cs rename to osu.Game.Rulesets.Mania/Properties/AssemblyInfo.cs index 11c8290f1b..790002acd7 100644 --- a/osu.Game.Modes.Mania/Properties/AssemblyInfo.cs +++ b/osu.Game.Rulesets.Mania/Properties/AssemblyInfo.cs @@ -7,11 +7,11 @@ using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("osu.Game.Modes.Mania")] +[assembly: AssemblyTitle("osu.Game.Rulesets.Mania")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("osu.Game.Modes.Mania")] +[assembly: AssemblyProduct("osu.Game.Rulesets.Mania")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/osu.Game.Modes.Mania/Scoring/ManiaScoreProcessor.cs b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs similarity index 72% rename from osu.Game.Modes.Mania/Scoring/ManiaScoreProcessor.cs rename to osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs index 0f87030e25..ba0304a44a 100644 --- a/osu.Game.Modes.Mania/Scoring/ManiaScoreProcessor.cs +++ b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs @@ -1,12 +1,12 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Mania.Judgements; -using osu.Game.Modes.Mania.Objects; -using osu.Game.Modes.Scoring; -using osu.Game.Modes.UI; +using osu.Game.Rulesets.Mania.Judgements; +using osu.Game.Rulesets.Mania.Objects; +using osu.Game.Rulesets.Scoring; +using osu.Game.Rulesets.UI; -namespace osu.Game.Modes.Mania.Scoring +namespace osu.Game.Rulesets.Mania.Scoring { internal class ManiaScoreProcessor : ScoreProcessor { diff --git a/osu.Game.Modes.Mania/UI/ManiaHitRenderer.cs b/osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs similarity index 71% rename from osu.Game.Modes.Mania/UI/ManiaHitRenderer.cs rename to osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs index ada79e992a..7fb8f95b4c 100644 --- a/osu.Game.Modes.Mania/UI/ManiaHitRenderer.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs @@ -2,16 +2,16 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Beatmaps; -using osu.Game.Modes.Beatmaps; -using osu.Game.Modes.Mania.Beatmaps; -using osu.Game.Modes.Mania.Judgements; -using osu.Game.Modes.Mania.Objects; -using osu.Game.Modes.Mania.Scoring; -using osu.Game.Modes.Objects.Drawables; -using osu.Game.Modes.Scoring; -using osu.Game.Modes.UI; +using osu.Game.Rulesets.Beatmaps; +using osu.Game.Rulesets.Mania.Beatmaps; +using osu.Game.Rulesets.Mania.Judgements; +using osu.Game.Rulesets.Mania.Objects; +using osu.Game.Rulesets.Mania.Scoring; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Scoring; +using osu.Game.Rulesets.UI; -namespace osu.Game.Modes.Mania.UI +namespace osu.Game.Rulesets.Mania.UI { public class ManiaHitRenderer : HitRenderer { diff --git a/osu.Game.Modes.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs similarity index 84% rename from osu.Game.Modes.Mania/UI/ManiaPlayfield.cs rename to osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index deb4ebac25..5eea3d70c0 100644 --- a/osu.Game.Modes.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -3,13 +3,13 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; -using osu.Game.Modes.Mania.Objects; -using osu.Game.Modes.UI; +using osu.Game.Rulesets.Mania.Objects; +using osu.Game.Rulesets.UI; using OpenTK; using OpenTK.Graphics; -using osu.Game.Modes.Mania.Judgements; +using osu.Game.Rulesets.Mania.Judgements; -namespace osu.Game.Modes.Mania.UI +namespace osu.Game.Rulesets.Mania.UI { public class ManiaPlayfield : Playfield { diff --git a/osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj similarity index 89% rename from osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj rename to osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj index a8366a465f..facffa757c 100644 --- a/osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj +++ b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj @@ -7,8 +7,8 @@ {48F4582B-7687-4621-9CBE-5C24197CB536} Library Properties - osu.Game.Modes.Mania - osu.Game.Modes.Mania + osu.Game.Rulesets.Mania + osu.Game.Rulesets.Mania v4.5 512 @@ -66,13 +66,13 @@ {C76BF5B3-985E-4D39-95FE-97C9C879B83A} osu.Framework - + {C92A607B-1FDD-4954-9F92-03FF547D9080} - osu.Game.Modes.Osu + osu.Game.Rulesets.Osu - + {F167E17A-7DE6-4AF5-B920-A5112296C695} - osu.Game.Modes.Taiko + osu.Game.Rulesets.Taiko {0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D} diff --git a/osu.Game.Modes.Mania/packages.config b/osu.Game.Rulesets.Mania/packages.config similarity index 100% rename from osu.Game.Modes.Mania/packages.config rename to osu.Game.Rulesets.Mania/packages.config diff --git a/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs similarity index 87% rename from osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs rename to osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs index 0172112969..0eece7fc4c 100644 --- a/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs +++ b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs @@ -3,15 +3,15 @@ using OpenTK; using osu.Game.Beatmaps; -using osu.Game.Modes.Objects; -using osu.Game.Modes.Osu.Objects; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Osu.Objects; using System.Collections.Generic; -using osu.Game.Modes.Objects.Types; +using osu.Game.Rulesets.Objects.Types; using System; -using osu.Game.Modes.Osu.UI; -using osu.Game.Modes.Beatmaps; +using osu.Game.Rulesets.Osu.UI; +using osu.Game.Rulesets.Beatmaps; -namespace osu.Game.Modes.Osu.Beatmaps +namespace osu.Game.Rulesets.Osu.Beatmaps { internal class OsuBeatmapConverter : BeatmapConverter { diff --git a/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapProcessor.cs b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs similarity index 95% rename from osu.Game.Modes.Osu/Beatmaps/OsuBeatmapProcessor.cs rename to osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs index 912da40f3d..fce0188cda 100644 --- a/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapProcessor.cs +++ b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs @@ -3,12 +3,12 @@ using OpenTK; using osu.Game.Beatmaps; -using osu.Game.Modes.Beatmaps; -using osu.Game.Modes.Objects.Types; -using osu.Game.Modes.Osu.Objects; -using osu.Game.Modes.Osu.Objects.Drawables; +using osu.Game.Rulesets.Beatmaps; +using osu.Game.Rulesets.Objects.Types; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables; -namespace osu.Game.Modes.Osu.Beatmaps +namespace osu.Game.Rulesets.Osu.Beatmaps { internal class OsuBeatmapProcessor : BeatmapProcessor { diff --git a/osu.Game.Modes.Osu/Judgements/OsuJudgement.cs b/osu.Game.Rulesets.Osu/Judgements/OsuJudgement.cs similarity index 89% rename from osu.Game.Modes.Osu/Judgements/OsuJudgement.cs rename to osu.Game.Rulesets.Osu/Judgements/OsuJudgement.cs index e65d3dde3a..d61e179002 100644 --- a/osu.Game.Modes.Osu/Judgements/OsuJudgement.cs +++ b/osu.Game.Rulesets.Osu/Judgements/OsuJudgement.cs @@ -2,11 +2,11 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; -using osu.Game.Modes.Judgements; -using osu.Game.Modes.Osu.Objects.Drawables; +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Framework.Extensions; -namespace osu.Game.Modes.Osu.Judgements +namespace osu.Game.Rulesets.Osu.Judgements { public class OsuJudgement : Judgement { diff --git a/osu.Game.Modes.Osu/Mods/OsuMod.cs b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs similarity index 93% rename from osu.Game.Modes.Osu/Mods/OsuMod.cs rename to osu.Game.Rulesets.Osu/Mods/OsuMod.cs index db2ee26b7a..bdb5f386d0 100644 --- a/osu.Game.Modes.Osu/Mods/OsuMod.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuMod.cs @@ -3,13 +3,13 @@ using osu.Game.Beatmaps; using osu.Game.Graphics; -using osu.Game.Modes.Mods; -using osu.Game.Modes.Osu.Objects; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Osu.Objects; using System; using System.Linq; -using osu.Game.Modes.Scoring; +using osu.Game.Rulesets.Scoring; -namespace osu.Game.Modes.Osu.Mods +namespace osu.Game.Rulesets.Osu.Mods { public class OsuModNoFail : ModNoFail { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Connections/ConnectionRenderer.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/ConnectionRenderer.cs similarity index 83% rename from osu.Game.Modes.Osu/Objects/Drawables/Connections/ConnectionRenderer.cs rename to osu.Game.Rulesets.Osu/Objects/Drawables/Connections/ConnectionRenderer.cs index a680c847ac..192ab0536e 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Connections/ConnectionRenderer.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/ConnectionRenderer.cs @@ -2,10 +2,10 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics.Containers; -using osu.Game.Modes.Objects; +using osu.Game.Rulesets.Objects; using System.Collections.Generic; -namespace osu.Game.Modes.Osu.Objects.Drawables.Connections +namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections { /// /// Connects hit objects visually, for example with follow points. diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Connections/FollowPoint.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs similarity index 93% rename from osu.Game.Modes.Osu/Objects/Drawables/Connections/FollowPoint.cs rename to osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs index 7815e3ba41..e1276f30c4 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Connections/FollowPoint.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -namespace osu.Game.Modes.Osu.Objects.Drawables.Connections +namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections { public class FollowPoint : Container { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs similarity index 94% rename from osu.Game.Modes.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs rename to osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs index f45e4226dd..a4e032050e 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs @@ -4,9 +4,9 @@ using System; using System.Collections.Generic; using OpenTK; -using osu.Game.Modes.Objects.Types; +using osu.Game.Rulesets.Objects.Types; -namespace osu.Game.Modes.Osu.Objects.Drawables.Connections +namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections { public class FollowPointRenderer : ConnectionRenderer { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs similarity index 93% rename from osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs rename to osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index 68c5ec0a45..4c1a74c675 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -3,12 +3,12 @@ using System; using osu.Framework.Graphics; -using osu.Game.Modes.Objects.Drawables; -using osu.Game.Modes.Osu.Objects.Drawables.Pieces; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using OpenTK; -using osu.Game.Modes.Objects.Types; +using osu.Game.Rulesets.Objects.Types; -namespace osu.Game.Modes.Osu.Objects.Drawables +namespace osu.Game.Rulesets.Osu.Objects.Drawables { public class DrawableHitCircle : DrawableOsuHitObject, IDrawableHitObjectWithProxiedApproach { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs similarity index 89% rename from osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuHitObject.cs rename to osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index 816faa0d98..2baf651cc0 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -2,10 +2,10 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.ComponentModel; -using osu.Game.Modes.Objects.Drawables; -using osu.Game.Modes.Osu.Judgements; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Osu.Judgements; -namespace osu.Game.Modes.Osu.Objects.Drawables +namespace osu.Game.Rulesets.Osu.Objects.Drawables { public class DrawableOsuHitObject : DrawableHitObject { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuJudgement.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuJudgement.cs similarity index 76% rename from osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuJudgement.cs rename to osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuJudgement.cs index 647c8faef8..eaa0bb7d27 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableOsuJudgement.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuJudgement.cs @@ -2,12 +2,12 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; -using osu.Game.Modes.Objects.Drawables; -using osu.Game.Modes.Osu.Judgements; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Osu.Judgements; using OpenTK; -using osu.Game.Modes.Judgements; +using osu.Game.Rulesets.Judgements; -namespace osu.Game.Modes.Osu.Objects.Drawables +namespace osu.Game.Rulesets.Osu.Objects.Drawables { public class DrawableOsuJudgement : DrawableJudgement { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs similarity index 95% rename from osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs rename to osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index be326751ba..ed698f5ad3 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -3,13 +3,13 @@ using OpenTK; using osu.Framework.Graphics; -using osu.Game.Modes.Objects.Drawables; -using osu.Game.Modes.Osu.Objects.Drawables.Pieces; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using System.Collections.Generic; using System.Linq; using osu.Framework.Graphics.Containers; -namespace osu.Game.Modes.Osu.Objects.Drawables +namespace osu.Game.Rulesets.Osu.Objects.Drawables { public class DrawableSlider : DrawableOsuHitObject, IDrawableHitObjectWithProxiedApproach { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs similarity index 92% rename from osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs rename to osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs index 188306c857..86baf9f235 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs @@ -4,12 +4,12 @@ using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; -using osu.Game.Modes.Objects.Drawables; -using osu.Game.Modes.Osu.Judgements; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Osu.Judgements; using OpenTK; using OpenTK.Graphics; -namespace osu.Game.Modes.Osu.Objects.Drawables +namespace osu.Game.Rulesets.Osu.Objects.Drawables { public class DrawableSliderTick : DrawableOsuHitObject { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs similarity index 93% rename from osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs rename to osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index d921481290..9ff77a5f3c 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -5,13 +5,13 @@ using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.MathUtils; -using osu.Game.Modes.Objects.Drawables; -using osu.Game.Modes.Osu.Objects.Drawables.Pieces; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using OpenTK; using OpenTK.Graphics; -using osu.Game.Modes.Osu.UI; +using osu.Game.Rulesets.Osu.UI; -namespace osu.Game.Modes.Osu.Objects.Drawables +namespace osu.Game.Rulesets.Osu.Objects.Drawables { public class DrawableSpinner : DrawableOsuHitObject { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/ApproachCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ApproachCircle.cs similarity index 90% rename from osu.Game.Modes.Osu/Objects/Drawables/Pieces/ApproachCircle.cs rename to osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ApproachCircle.cs index fd4ef64350..323f5fb297 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/ApproachCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ApproachCircle.cs @@ -7,7 +7,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces +namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { public class ApproachCircle : Container { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/CirclePiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/CirclePiece.cs similarity index 93% rename from osu.Game.Modes.Osu/Objects/Drawables/Pieces/CirclePiece.cs rename to osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/CirclePiece.cs index 704a6b7490..9a90c07517 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/CirclePiece.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/CirclePiece.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics.Textures; using osu.Framework.Input; using OpenTK; -namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces +namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { public class CirclePiece : Container { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/ExplodePiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ExplodePiece.cs similarity index 90% rename from osu.Game.Modes.Osu/Objects/Drawables/Pieces/ExplodePiece.cs rename to osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ExplodePiece.cs index 97228f610f..e5cf10b88a 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/ExplodePiece.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ExplodePiece.cs @@ -5,7 +5,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using OpenTK; -namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces +namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { public class ExplodePiece : Container { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/FlashPiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/FlashPiece.cs similarity index 89% rename from osu.Game.Modes.Osu/Objects/Drawables/Pieces/FlashPiece.cs rename to osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/FlashPiece.cs index cb60977dab..68ffb756d4 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/FlashPiece.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/FlashPiece.cs @@ -6,7 +6,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using OpenTK; -namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces +namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { public class FlashPiece : Container { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/GlowPiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/GlowPiece.cs similarity index 91% rename from osu.Game.Modes.Osu/Objects/Drawables/Pieces/GlowPiece.cs rename to osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/GlowPiece.cs index 6cffa370cf..8a7b353da1 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/GlowPiece.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/GlowPiece.cs @@ -7,7 +7,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces +namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { public class GlowPiece : Container { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/NumberPiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs similarity index 93% rename from osu.Game.Modes.Osu/Objects/Drawables/Pieces/NumberPiece.cs rename to osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs index 0ebd274246..07b21657a5 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/NumberPiece.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Graphics.Sprites; using OpenTK.Graphics; -namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces +namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { public class NumberPiece : Container { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/RingPiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/RingPiece.cs similarity index 90% rename from osu.Game.Modes.Osu/Objects/Drawables/Pieces/RingPiece.cs rename to osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/RingPiece.cs index 3e172cdc09..a04d3e7a0a 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/RingPiece.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/RingPiece.cs @@ -7,7 +7,7 @@ using osu.Framework.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; -namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces +namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { public class RingPiece : Container { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs similarity index 95% rename from osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBall.cs rename to osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs index becbebf0c7..4cffc1def3 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -7,7 +7,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Input; using OpenTK.Graphics; -namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces +namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { public class SliderBall : CircularContainer, ISliderProgress { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBody.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs similarity index 96% rename from osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBody.cs rename to osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs index e7837471ee..b23fdde4e8 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBody.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs @@ -15,7 +15,7 @@ using OpenTK; using OpenTK.Graphics.ES30; using OpenTK.Graphics; -namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces +namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { public class SliderBody : Container, ISliderProgress { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBouncer.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBouncer.cs similarity index 93% rename from osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBouncer.cs rename to osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBouncer.cs index 196b9fb521..65679dd7d3 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBouncer.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBouncer.cs @@ -5,7 +5,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; -namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces +namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { public class SliderBouncer : Container, ISliderProgress { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs similarity index 80% rename from osu.Game.Modes.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs rename to osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs index 50dab933b0..72024bbe99 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.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 -namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces +namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { public class SpinnerBackground : SpinnerDisc { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs similarity index 95% rename from osu.Game.Modes.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs rename to osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs index a4fce3deb5..71adba74c7 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs @@ -15,7 +15,7 @@ using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; -namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces +namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { public class SpinnerDisc : CircularContainer { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/TrianglesPiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/TrianglesPiece.cs similarity index 89% rename from osu.Game.Modes.Osu/Objects/Drawables/Pieces/TrianglesPiece.cs rename to osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/TrianglesPiece.cs index 26d44f3865..ea3ddb5051 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/TrianglesPiece.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/TrianglesPiece.cs @@ -3,7 +3,7 @@ using osu.Game.Graphics.Backgrounds; -namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces +namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { public class TrianglesPiece : Triangles { diff --git a/osu.Game.Modes.Osu/Objects/HitCircle.cs b/osu.Game.Rulesets.Osu/Objects/HitCircle.cs similarity index 81% rename from osu.Game.Modes.Osu/Objects/HitCircle.cs rename to osu.Game.Rulesets.Osu/Objects/HitCircle.cs index aa45ac7fb9..be969f1e18 100644 --- a/osu.Game.Modes.Osu/Objects/HitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/HitCircle.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 -namespace osu.Game.Modes.Osu.Objects +namespace osu.Game.Rulesets.Osu.Objects { public class HitCircle : OsuHitObject { diff --git a/osu.Game.Modes.Osu/Objects/OsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs similarity index 91% rename from osu.Game.Modes.Osu/Objects/OsuHitObject.cs rename to osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs index 55fc99e41a..723a37ed7b 100644 --- a/osu.Game.Modes.Osu/Objects/OsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs @@ -1,15 +1,15 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Objects; +using osu.Game.Rulesets.Objects; using OpenTK; -using osu.Game.Modes.Osu.Objects.Drawables; -using osu.Game.Modes.Objects.Types; +using osu.Game.Rulesets.Osu.Objects.Drawables; +using osu.Game.Rulesets.Objects.Types; using OpenTK.Graphics; using osu.Game.Beatmaps.Timing; using osu.Game.Database; -namespace osu.Game.Modes.Osu.Objects +namespace osu.Game.Rulesets.Osu.Objects { public abstract class OsuHitObject : HitObject, IHasCombo, IHasPosition { diff --git a/osu.Game.Modes.Osu/Objects/OsuHitObjectDifficulty.cs b/osu.Game.Rulesets.Osu/Objects/OsuHitObjectDifficulty.cs similarity index 97% rename from osu.Game.Modes.Osu/Objects/OsuHitObjectDifficulty.cs rename to osu.Game.Rulesets.Osu/Objects/OsuHitObjectDifficulty.cs index 322f6b077a..1786771dca 100644 --- a/osu.Game.Modes.Osu/Objects/OsuHitObjectDifficulty.cs +++ b/osu.Game.Rulesets.Osu/Objects/OsuHitObjectDifficulty.cs @@ -6,7 +6,7 @@ using System; using System.Diagnostics; using System.Linq; -namespace osu.Game.Modes.Osu.Objects +namespace osu.Game.Rulesets.Osu.Objects { internal class OsuHitObjectDifficulty { diff --git a/osu.Game.Modes.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs similarity index 94% rename from osu.Game.Modes.Osu/Objects/Slider.cs rename to osu.Game.Rulesets.Osu/Objects/Slider.cs index a01c517cb2..167bf21670 100644 --- a/osu.Game.Modes.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -3,15 +3,15 @@ using OpenTK; using osu.Game.Beatmaps.Timing; -using osu.Game.Modes.Objects.Types; +using osu.Game.Rulesets.Objects.Types; using System; using System.Collections.Generic; -using osu.Game.Modes.Objects; +using osu.Game.Rulesets.Objects; using osu.Game.Database; using System.Linq; using osu.Game.Audio; -namespace osu.Game.Modes.Osu.Objects +namespace osu.Game.Rulesets.Osu.Objects { public class Slider : OsuHitObject, IHasCurve { diff --git a/osu.Game.Modes.Osu/Objects/SliderTick.cs b/osu.Game.Rulesets.Osu/Objects/SliderTick.cs similarity index 83% rename from osu.Game.Modes.Osu/Objects/SliderTick.cs rename to osu.Game.Rulesets.Osu/Objects/SliderTick.cs index 67f393b126..7112a39f97 100644 --- a/osu.Game.Modes.Osu/Objects/SliderTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/SliderTick.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 -namespace osu.Game.Modes.Osu.Objects +namespace osu.Game.Rulesets.Osu.Objects { public class SliderTick : OsuHitObject { diff --git a/osu.Game.Modes.Osu/Objects/Spinner.cs b/osu.Game.Rulesets.Osu/Objects/Spinner.cs similarity index 79% rename from osu.Game.Modes.Osu/Objects/Spinner.cs rename to osu.Game.Rulesets.Osu/Objects/Spinner.cs index dd9a6c386a..0a2c05833a 100644 --- a/osu.Game.Modes.Osu/Objects/Spinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Spinner.cs @@ -1,9 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Objects.Types; +using osu.Game.Rulesets.Objects.Types; -namespace osu.Game.Modes.Osu.Objects +namespace osu.Game.Rulesets.Osu.Objects { public class Spinner : OsuHitObject, IHasEndTime { diff --git a/osu.Game.Modes.Osu/OpenTK.dll.config b/osu.Game.Rulesets.Osu/OpenTK.dll.config similarity index 100% rename from osu.Game.Modes.Osu/OpenTK.dll.config rename to osu.Game.Rulesets.Osu/OpenTK.dll.config diff --git a/osu.Game.Modes.Osu/OsuAutoReplay.cs b/osu.Game.Rulesets.Osu/OsuAutoReplay.cs similarity index 96% rename from osu.Game.Modes.Osu/OsuAutoReplay.cs rename to osu.Game.Rulesets.Osu/OsuAutoReplay.cs index ae85bd72d8..6fc005fb6a 100644 --- a/osu.Game.Modes.Osu/OsuAutoReplay.cs +++ b/osu.Game.Rulesets.Osu/OsuAutoReplay.cs @@ -4,16 +4,16 @@ using OpenTK; using osu.Framework.MathUtils; using osu.Game.Beatmaps; -using osu.Game.Modes.Osu.Objects; -using osu.Game.Modes.Osu.Objects.Drawables; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables; using System; using System.Collections.Generic; using System.Diagnostics; using osu.Framework.Graphics; -using osu.Game.Modes.Objects.Types; -using osu.Game.Modes.Replays; +using osu.Game.Rulesets.Objects.Types; +using osu.Game.Rulesets.Replays; -namespace osu.Game.Modes.Osu +namespace osu.Game.Rulesets.Osu { public class OsuAutoReplay : Replay { diff --git a/osu.Game.Modes.Osu/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/OsuDifficultyCalculator.cs similarity index 96% rename from osu.Game.Modes.Osu/OsuDifficultyCalculator.cs rename to osu.Game.Rulesets.Osu/OsuDifficultyCalculator.cs index f3ef47fe27..14b890a055 100644 --- a/osu.Game.Modes.Osu/OsuDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/OsuDifficultyCalculator.cs @@ -2,14 +2,14 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Beatmaps; -using osu.Game.Modes.Beatmaps; -using osu.Game.Modes.Objects.Types; -using osu.Game.Modes.Osu.Beatmaps; -using osu.Game.Modes.Osu.Objects; +using osu.Game.Rulesets.Beatmaps; +using osu.Game.Rulesets.Objects.Types; +using osu.Game.Rulesets.Osu.Beatmaps; +using osu.Game.Rulesets.Osu.Objects; using System; using System.Collections.Generic; -namespace osu.Game.Modes.Osu +namespace osu.Game.Rulesets.Osu { public class OsuDifficultyCalculator : DifficultyCalculator { diff --git a/osu.Game.Modes.Osu/OsuKeyConversionInputManager.cs b/osu.Game.Rulesets.Osu/OsuKeyConversionInputManager.cs similarity index 95% rename from osu.Game.Modes.Osu/OsuKeyConversionInputManager.cs rename to osu.Game.Rulesets.Osu/OsuKeyConversionInputManager.cs index 567c7a35b1..e71f15cd65 100644 --- a/osu.Game.Modes.Osu/OsuKeyConversionInputManager.cs +++ b/osu.Game.Rulesets.Osu/OsuKeyConversionInputManager.cs @@ -11,7 +11,7 @@ using OpenTK.Input; using KeyboardState = osu.Framework.Input.KeyboardState; using MouseState = osu.Framework.Input.MouseState; -namespace osu.Game.Modes.Osu +namespace osu.Game.Rulesets.Osu { public class OsuKeyConversionInputManager : KeyConversionInputManager { diff --git a/osu.Game.Modes.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs similarity index 90% rename from osu.Game.Modes.Osu/OsuRuleset.cs rename to osu.Game.Rulesets.Osu/OsuRuleset.cs index 4de890ac5f..39e911651a 100644 --- a/osu.Game.Modes.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -4,18 +4,18 @@ using OpenTK.Input; using osu.Game.Beatmaps; using osu.Game.Graphics; -using osu.Game.Modes.Mods; -using osu.Game.Modes.Osu.Mods; -using osu.Game.Modes.Osu.Objects; -using osu.Game.Modes.Osu.UI; -using osu.Game.Modes.UI; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Osu.Mods; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.UI; +using osu.Game.Rulesets.UI; using osu.Game.Screens.Play; using System.Collections.Generic; using System.Linq; -using osu.Game.Modes.Osu.Scoring; -using osu.Game.Modes.Scoring; +using osu.Game.Rulesets.Osu.Scoring; +using osu.Game.Rulesets.Scoring; -namespace osu.Game.Modes.Osu +namespace osu.Game.Rulesets.Osu { public class OsuRuleset : Ruleset { diff --git a/osu.Game.Modes.Osu/Properties/AssemblyInfo.cs b/osu.Game.Rulesets.Osu/Properties/AssemblyInfo.cs similarity index 100% rename from osu.Game.Modes.Osu/Properties/AssemblyInfo.cs rename to osu.Game.Rulesets.Osu/Properties/AssemblyInfo.cs diff --git a/osu.Game.Modes.Osu/Scoring/OsuScore.cs b/osu.Game.Rulesets.Osu/Scoring/OsuScore.cs similarity index 71% rename from osu.Game.Modes.Osu/Scoring/OsuScore.cs rename to osu.Game.Rulesets.Osu/Scoring/OsuScore.cs index a0a639a59e..c73cfe3338 100644 --- a/osu.Game.Modes.Osu/Scoring/OsuScore.cs +++ b/osu.Game.Rulesets.Osu/Scoring/OsuScore.cs @@ -1,9 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Scoring; +using osu.Game.Rulesets.Scoring; -namespace osu.Game.Modes.Osu.Scoring +namespace osu.Game.Rulesets.Osu.Scoring { internal class OsuScore : Score { diff --git a/osu.Game.Modes.Osu/Scoring/OsuScoreProcessor.cs b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs similarity index 83% rename from osu.Game.Modes.Osu/Scoring/OsuScoreProcessor.cs rename to osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs index 3b798a2fad..0c38f66abe 100644 --- a/osu.Game.Modes.Osu/Scoring/OsuScoreProcessor.cs +++ b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs @@ -1,13 +1,13 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Objects.Drawables; -using osu.Game.Modes.Osu.Judgements; -using osu.Game.Modes.Osu.Objects; -using osu.Game.Modes.Scoring; -using osu.Game.Modes.UI; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Osu.Judgements; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Scoring; +using osu.Game.Rulesets.UI; -namespace osu.Game.Modes.Osu.Scoring +namespace osu.Game.Rulesets.Osu.Scoring { internal class OsuScoreProcessor : ScoreProcessor { diff --git a/osu.Game.Modes.Osu/UI/OsuHitRenderer.cs b/osu.Game.Rulesets.Osu/UI/OsuHitRenderer.cs similarity index 78% rename from osu.Game.Modes.Osu/UI/OsuHitRenderer.cs rename to osu.Game.Rulesets.Osu/UI/OsuHitRenderer.cs index a514ba6358..687518e6d5 100644 --- a/osu.Game.Modes.Osu/UI/OsuHitRenderer.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuHitRenderer.cs @@ -3,18 +3,18 @@ using OpenTK; using osu.Game.Beatmaps; -using osu.Game.Modes.Beatmaps; -using osu.Game.Modes.Objects.Drawables; -using osu.Game.Modes.Osu.Beatmaps; -using osu.Game.Modes.Osu.Judgements; -using osu.Game.Modes.Osu.Objects; -using osu.Game.Modes.Osu.Objects.Drawables; -using osu.Game.Modes.Osu.Scoring; -using osu.Game.Modes.Scoring; -using osu.Game.Modes.UI; +using osu.Game.Rulesets.Beatmaps; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Osu.Beatmaps; +using osu.Game.Rulesets.Osu.Judgements; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables; +using osu.Game.Rulesets.Osu.Scoring; +using osu.Game.Rulesets.Scoring; +using osu.Game.Rulesets.UI; using osu.Game.Screens.Play; -namespace osu.Game.Modes.Osu.UI +namespace osu.Game.Rulesets.Osu.UI { public class OsuHitRenderer : HitRenderer { diff --git a/osu.Game.Modes.Osu/UI/OsuPlayfield.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs similarity index 88% rename from osu.Game.Modes.Osu/UI/OsuPlayfield.cs rename to osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs index 47e2c1ed16..53eedea073 100644 --- a/osu.Game.Modes.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs @@ -4,16 +4,16 @@ using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Game.Modes.Objects.Drawables; -using osu.Game.Modes.Osu.Objects; -using osu.Game.Modes.Osu.Objects.Drawables; -using osu.Game.Modes.Osu.Objects.Drawables.Connections; -using osu.Game.Modes.UI; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables; +using osu.Game.Rulesets.Osu.Objects.Drawables.Connections; +using osu.Game.Rulesets.UI; using System.Linq; using osu.Game.Graphics.Cursor; -using osu.Game.Modes.Osu.Judgements; +using osu.Game.Rulesets.Osu.Judgements; -namespace osu.Game.Modes.Osu.UI +namespace osu.Game.Rulesets.Osu.UI { public class OsuPlayfield : Playfield { diff --git a/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj similarity index 96% rename from osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj rename to osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj index c98f554ba5..272a35c286 100644 --- a/osu.Game.Modes.Osu/osu.Game.Modes.Osu.csproj +++ b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj @@ -7,8 +7,8 @@ {C92A607B-1FDD-4954-9F92-03FF547D9080} Library Properties - osu.Game.Modes.Osu - osu.Game.Modes.Osu + osu.Game.Rulesets.Osu + osu.Game.Rulesets.Osu v4.5 512 diff --git a/osu.Game.Modes.Osu/packages.config b/osu.Game.Rulesets.Osu/packages.config similarity index 100% rename from osu.Game.Modes.Osu/packages.config rename to osu.Game.Rulesets.Osu/packages.config diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs similarity index 95% rename from osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs rename to osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs index d26cc8ab0b..0b487bfc19 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -2,18 +2,18 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Beatmaps; -using osu.Game.Modes.Objects; -using osu.Game.Modes.Objects.Types; -using osu.Game.Modes.Taiko.Objects; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Objects.Types; +using osu.Game.Rulesets.Taiko.Objects; using System; using System.Collections.Generic; using System.Linq; using osu.Game.Database; using osu.Game.IO.Serialization; using osu.Game.Audio; -using osu.Game.Modes.Beatmaps; +using osu.Game.Rulesets.Beatmaps; -namespace osu.Game.Modes.Taiko.Beatmaps +namespace osu.Game.Rulesets.Taiko.Beatmaps { internal class TaikoBeatmapConverter : BeatmapConverter { diff --git a/osu.Game.Modes.Taiko/Judgements/TaikoDrumRollTickJudgement.cs b/osu.Game.Rulesets.Taiko/Judgements/TaikoDrumRollTickJudgement.cs similarity index 92% rename from osu.Game.Modes.Taiko/Judgements/TaikoDrumRollTickJudgement.cs rename to osu.Game.Rulesets.Taiko/Judgements/TaikoDrumRollTickJudgement.cs index 6ae476b265..78a5b29d36 100644 --- a/osu.Game.Modes.Taiko/Judgements/TaikoDrumRollTickJudgement.cs +++ b/osu.Game.Rulesets.Taiko/Judgements/TaikoDrumRollTickJudgement.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -namespace osu.Game.Modes.Taiko.Judgements +namespace osu.Game.Rulesets.Taiko.Judgements { public class TaikoDrumRollTickJudgement : TaikoJudgement { diff --git a/osu.Game.Modes.Taiko/Judgements/TaikoHitResult.cs b/osu.Game.Rulesets.Taiko/Judgements/TaikoHitResult.cs similarity index 84% rename from osu.Game.Modes.Taiko/Judgements/TaikoHitResult.cs rename to osu.Game.Rulesets.Taiko/Judgements/TaikoHitResult.cs index cbc3919c4f..5fd850d6b0 100644 --- a/osu.Game.Modes.Taiko/Judgements/TaikoHitResult.cs +++ b/osu.Game.Rulesets.Taiko/Judgements/TaikoHitResult.cs @@ -3,7 +3,7 @@ using System.ComponentModel; -namespace osu.Game.Modes.Taiko.Judgements +namespace osu.Game.Rulesets.Taiko.Judgements { public enum TaikoHitResult { diff --git a/osu.Game.Modes.Taiko/Judgements/TaikoJudgement.cs b/osu.Game.Rulesets.Taiko/Judgements/TaikoJudgement.cs similarity index 93% rename from osu.Game.Modes.Taiko/Judgements/TaikoJudgement.cs rename to osu.Game.Rulesets.Taiko/Judgements/TaikoJudgement.cs index 7676ef8c29..7bca59bf11 100644 --- a/osu.Game.Modes.Taiko/Judgements/TaikoJudgement.cs +++ b/osu.Game.Rulesets.Taiko/Judgements/TaikoJudgement.cs @@ -1,11 +1,11 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Judgements; +using osu.Game.Rulesets.Judgements; using osu.Framework.Extensions; -using osu.Game.Modes.Objects.Drawables; +using osu.Game.Rulesets.Objects.Drawables; -namespace osu.Game.Modes.Taiko.Judgements +namespace osu.Game.Rulesets.Taiko.Judgements { public class TaikoJudgement : Judgement { diff --git a/osu.Game.Modes.Taiko/Judgements/TaikoStrongHitJudgement.cs b/osu.Game.Rulesets.Taiko/Judgements/TaikoStrongHitJudgement.cs similarity index 84% rename from osu.Game.Modes.Taiko/Judgements/TaikoStrongHitJudgement.cs rename to osu.Game.Rulesets.Taiko/Judgements/TaikoStrongHitJudgement.cs index ee978d0026..4996cac39e 100644 --- a/osu.Game.Modes.Taiko/Judgements/TaikoStrongHitJudgement.cs +++ b/osu.Game.Rulesets.Taiko/Judgements/TaikoStrongHitJudgement.cs @@ -1,9 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Judgements; +using osu.Game.Rulesets.Judgements; -namespace osu.Game.Modes.Taiko.Judgements +namespace osu.Game.Rulesets.Taiko.Judgements { public class TaikoStrongHitJudgement : TaikoJudgement, IPartialJudgement { diff --git a/osu.Game.Modes.Taiko/Mods/TaikoMod.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoMod.cs similarity index 87% rename from osu.Game.Modes.Taiko/Mods/TaikoMod.cs rename to osu.Game.Rulesets.Taiko/Mods/TaikoMod.cs index 422f0ec250..0b8492ef8c 100644 --- a/osu.Game.Modes.Taiko/Mods/TaikoMod.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoMod.cs @@ -2,13 +2,13 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Beatmaps; -using osu.Game.Modes.Mods; -using osu.Game.Modes.Scoring; -using osu.Game.Modes.Taiko.Objects; -using osu.Game.Modes.Taiko.Replays; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Scoring; +using osu.Game.Rulesets.Taiko.Objects; +using osu.Game.Rulesets.Taiko.Replays; using osu.Game.Users; -namespace osu.Game.Modes.Taiko.Mods +namespace osu.Game.Rulesets.Taiko.Mods { public class TaikoModNoFail : ModNoFail { diff --git a/osu.Game.Modes.Taiko/Objects/BarLine.cs b/osu.Game.Rulesets.Taiko/Objects/BarLine.cs similarity index 80% rename from osu.Game.Modes.Taiko/Objects/BarLine.cs rename to osu.Game.Rulesets.Taiko/Objects/BarLine.cs index ae3c03de5e..0e6ff9f758 100644 --- a/osu.Game.Modes.Taiko/Objects/BarLine.cs +++ b/osu.Game.Rulesets.Taiko/Objects/BarLine.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 -namespace osu.Game.Modes.Taiko.Objects +namespace osu.Game.Rulesets.Taiko.Objects { public class BarLine : TaikoHitObject { diff --git a/osu.Game.Modes.Taiko/Objects/CentreHit.cs b/osu.Game.Rulesets.Taiko/Objects/CentreHit.cs similarity index 79% rename from osu.Game.Modes.Taiko/Objects/CentreHit.cs rename to osu.Game.Rulesets.Taiko/Objects/CentreHit.cs index 258112f045..f82058fe01 100644 --- a/osu.Game.Modes.Taiko/Objects/CentreHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/CentreHit.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 -namespace osu.Game.Modes.Taiko.Objects +namespace osu.Game.Rulesets.Taiko.Objects { public class CentreHit : Hit { diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableBarLine.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs similarity index 94% rename from osu.Game.Modes.Taiko/Objects/Drawables/DrawableBarLine.cs rename to osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs index 59f8aca867..4c83e08bab 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableBarLine.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLine.cs @@ -6,7 +6,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using OpenTK; -namespace osu.Game.Modes.Taiko.Objects.Drawables +namespace osu.Game.Rulesets.Taiko.Objects.Drawables { /// /// A line that scrolls alongside hit objects in the playfield and visualises control points. diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableBarLineMajor.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLineMajor.cs similarity index 94% rename from osu.Game.Modes.Taiko/Objects/Drawables/DrawableBarLineMajor.cs rename to osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLineMajor.cs index 73565e6948..e64682a1e4 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableBarLineMajor.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableBarLineMajor.cs @@ -6,7 +6,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using OpenTK; -namespace osu.Game.Modes.Taiko.Objects.Drawables +namespace osu.Game.Rulesets.Taiko.Objects.Drawables { public class DrawableBarLineMajor : DrawableBarLine { diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableCentreHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableCentreHit.cs similarity index 83% rename from osu.Game.Modes.Taiko/Objects/Drawables/DrawableCentreHit.cs rename to osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableCentreHit.cs index ff5ac859b4..8bb78669ca 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableCentreHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableCentreHit.cs @@ -3,10 +3,10 @@ using osu.Framework.Allocation; using osu.Game.Graphics; -using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; +using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; using OpenTK.Input; -namespace osu.Game.Modes.Taiko.Objects.Drawables +namespace osu.Game.Rulesets.Taiko.Objects.Drawables { public class DrawableCentreHit : DrawableHit { diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableCentreHitStrong.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableCentreHitStrong.cs similarity index 83% rename from osu.Game.Modes.Taiko/Objects/Drawables/DrawableCentreHitStrong.cs rename to osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableCentreHitStrong.cs index bc24e2aa65..434fb9377f 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableCentreHitStrong.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableCentreHitStrong.cs @@ -3,10 +3,10 @@ using osu.Framework.Allocation; using osu.Game.Graphics; -using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; +using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; using OpenTK.Input; -namespace osu.Game.Modes.Taiko.Objects.Drawables +namespace osu.Game.Rulesets.Taiko.Objects.Drawables { public class DrawableCentreHitStrong : DrawableHitStrong { diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs similarity index 92% rename from osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs rename to osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs index 0a0098dd34..4562501ed1 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRoll.cs @@ -5,13 +5,13 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.MathUtils; using osu.Game.Graphics; -using osu.Game.Modes.Objects.Drawables; -using osu.Game.Modes.Taiko.Judgements; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Taiko.Judgements; using OpenTK; using OpenTK.Graphics; -using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; +using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; -namespace osu.Game.Modes.Taiko.Objects.Drawables +namespace osu.Game.Rulesets.Taiko.Objects.Drawables { public class DrawableDrumRoll : DrawableTaikoHitObject { diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRollTick.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs similarity index 87% rename from osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRollTick.cs rename to osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs index 296affedaf..ad4fd30a53 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRollTick.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs @@ -3,12 +3,12 @@ using System; using osu.Framework.Graphics; -using osu.Game.Modes.Objects.Drawables; -using osu.Game.Modes.Taiko.Judgements; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Taiko.Judgements; using OpenTK.Input; -using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; +using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; -namespace osu.Game.Modes.Taiko.Objects.Drawables +namespace osu.Game.Rulesets.Taiko.Objects.Drawables { public class DrawableDrumRollTick : DrawableTaikoHitObject { diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs similarity index 91% rename from osu.Game.Modes.Taiko/Objects/Drawables/DrawableHit.cs rename to osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs index 167fbebd7b..a4a46e3b48 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs @@ -4,12 +4,12 @@ using System; using System.Linq; using osu.Framework.Graphics; -using osu.Game.Modes.Objects.Drawables; -using osu.Game.Modes.Taiko.Judgements; -using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Taiko.Judgements; +using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; using OpenTK.Input; -namespace osu.Game.Modes.Taiko.Objects.Drawables +namespace osu.Game.Rulesets.Taiko.Objects.Drawables { public abstract class DrawableHit : DrawableTaikoHitObject { diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableHitStrong.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHitStrong.cs similarity index 90% rename from osu.Game.Modes.Taiko/Objects/Drawables/DrawableHitStrong.cs rename to osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHitStrong.cs index 4ab029acb3..1c6b12ea43 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableHitStrong.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHitStrong.cs @@ -4,12 +4,12 @@ using System; using System.Linq; using osu.Framework.Input; -using osu.Game.Modes.Objects.Drawables; -using osu.Game.Modes.Taiko.Judgements; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Taiko.Judgements; using OpenTK.Input; -using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; +using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; -namespace osu.Game.Modes.Taiko.Objects.Drawables +namespace osu.Game.Rulesets.Taiko.Objects.Drawables { public abstract class DrawableHitStrong : DrawableHit { diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableRimHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableRimHit.cs similarity index 83% rename from osu.Game.Modes.Taiko/Objects/Drawables/DrawableRimHit.cs rename to osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableRimHit.cs index 5a311d51ef..20e8d36105 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableRimHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableRimHit.cs @@ -3,10 +3,10 @@ using osu.Framework.Allocation; using osu.Game.Graphics; -using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; +using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; using OpenTK.Input; -namespace osu.Game.Modes.Taiko.Objects.Drawables +namespace osu.Game.Rulesets.Taiko.Objects.Drawables { public class DrawableRimHit : DrawableHit { diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableRimHitStrong.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableRimHitStrong.cs similarity index 83% rename from osu.Game.Modes.Taiko/Objects/Drawables/DrawableRimHitStrong.cs rename to osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableRimHitStrong.cs index 5789dfb140..4b1bb62bab 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableRimHitStrong.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableRimHitStrong.cs @@ -3,10 +3,10 @@ using osu.Framework.Allocation; using osu.Game.Graphics; -using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; +using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; using OpenTK.Input; -namespace osu.Game.Modes.Taiko.Objects.Drawables +namespace osu.Game.Rulesets.Taiko.Objects.Drawables { public class DrawableRimHitStrong : DrawableHitStrong { diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableSwell.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs similarity index 95% rename from osu.Game.Modes.Taiko/Objects/Drawables/DrawableSwell.cs rename to osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs index 1e440df69a..57b2576a8b 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableSwell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs @@ -9,14 +9,14 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; -using osu.Game.Modes.Objects.Drawables; -using osu.Game.Modes.Taiko.Judgements; -using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Taiko.Judgements; +using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; using OpenTK; using OpenTK.Graphics; using OpenTK.Input; -namespace osu.Game.Modes.Taiko.Objects.Drawables +namespace osu.Game.Rulesets.Taiko.Objects.Drawables { public class DrawableSwell : DrawableTaikoHitObject { diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs similarity index 91% rename from osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs rename to osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs index f15f2bd152..24aa366944 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs @@ -5,13 +5,13 @@ using System.Collections.Generic; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input; -using osu.Game.Modes.Objects.Drawables; -using osu.Game.Modes.Taiko.Judgements; -using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Taiko.Judgements; +using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; using OpenTK; using OpenTK.Input; -namespace osu.Game.Modes.Taiko.Objects.Drawables +namespace osu.Game.Rulesets.Taiko.Objects.Drawables { public abstract class DrawableTaikoHitObject : DrawableHitObject where TaikoHitType : TaikoHitObject diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CentreHitSymbolPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CentreHitSymbolPiece.cs similarity index 90% rename from osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CentreHitSymbolPiece.cs rename to osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CentreHitSymbolPiece.cs index 0cf4e97b41..ddf1492ecc 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CentreHitSymbolPiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CentreHitSymbolPiece.cs @@ -6,7 +6,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using OpenTK; -namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces +namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces { /// /// The symbol used for centre hit pieces. diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CirclePiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs similarity index 95% rename from osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CirclePiece.cs rename to osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs index 216e05ebc4..9f91488fe3 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CirclePiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Graphics.Backgrounds; using OpenTK.Graphics; -namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces +namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces { /// /// A circle piece which is used uniformly through osu!taiko to visualise hitobjects. diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/ElongatedCirclePiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/ElongatedCirclePiece.cs similarity index 90% rename from osu.Game.Modes.Taiko/Objects/Drawables/Pieces/ElongatedCirclePiece.cs rename to osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/ElongatedCirclePiece.cs index 5431507614..1af3705694 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/ElongatedCirclePiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/ElongatedCirclePiece.cs @@ -3,9 +3,9 @@ using System; using osu.Framework.Graphics.Primitives; -using osu.Game.Modes.Taiko.UI; +using osu.Game.Rulesets.Taiko.UI; -namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces +namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces { public class ElongatedCirclePiece : CirclePiece { diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/RimHitSymbolPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/RimHitSymbolPiece.cs similarity index 91% rename from osu.Game.Modes.Taiko/Objects/Drawables/Pieces/RimHitSymbolPiece.cs rename to osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/RimHitSymbolPiece.cs index 6e19497978..4146edbdf7 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/RimHitSymbolPiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/RimHitSymbolPiece.cs @@ -7,7 +7,7 @@ using osu.Framework.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; -namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces +namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces { /// /// The symbol used for rim hit pieces. diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs similarity index 88% rename from osu.Game.Modes.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs rename to osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs index e491793902..0f703837a9 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs @@ -4,7 +4,7 @@ using osu.Framework.Graphics; using osu.Game.Graphics; -namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces +namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces { /// /// The symbol used for swell pieces. diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs similarity index 91% rename from osu.Game.Modes.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs rename to osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs index 2220438a4a..83b2e59e44 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs @@ -6,7 +6,7 @@ using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; -namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces +namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces { public class TaikoPiece : Container, IHasAccentColour { diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/TickPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TickPiece.cs similarity index 93% rename from osu.Game.Modes.Taiko/Objects/Drawables/Pieces/TickPiece.cs rename to osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TickPiece.cs index 53e795e2e2..c3bc52796c 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/TickPiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TickPiece.cs @@ -7,7 +7,7 @@ using osu.Framework.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; -namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces +namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces { public class TickPiece : TaikoPiece { diff --git a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs b/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs similarity index 94% rename from osu.Game.Modes.Taiko/Objects/DrumRoll.cs rename to osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs index 4f26ffd3a1..4f89fb8248 100644 --- a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Objects.Types; +using osu.Game.Rulesets.Objects.Types; using System; using System.Collections.Generic; using System.Linq; @@ -9,7 +9,7 @@ using osu.Game.Beatmaps.Timing; using osu.Game.Database; using osu.Game.Audio; -namespace osu.Game.Modes.Taiko.Objects +namespace osu.Game.Rulesets.Taiko.Objects { public class DrumRoll : TaikoHitObject, IHasEndTime { diff --git a/osu.Game.Modes.Taiko/Objects/DrumRollTick.cs b/osu.Game.Rulesets.Taiko/Objects/DrumRollTick.cs similarity index 91% rename from osu.Game.Modes.Taiko/Objects/DrumRollTick.cs rename to osu.Game.Rulesets.Taiko/Objects/DrumRollTick.cs index 32e8851b66..01f9caf215 100644 --- a/osu.Game.Modes.Taiko/Objects/DrumRollTick.cs +++ b/osu.Game.Rulesets.Taiko/Objects/DrumRollTick.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 -namespace osu.Game.Modes.Taiko.Objects +namespace osu.Game.Rulesets.Taiko.Objects { public class DrumRollTick : TaikoHitObject { diff --git a/osu.Game.Modes.Taiko/Objects/Hit.cs b/osu.Game.Rulesets.Taiko/Objects/Hit.cs similarity index 93% rename from osu.Game.Modes.Taiko/Objects/Hit.cs rename to osu.Game.Rulesets.Taiko/Objects/Hit.cs index ad8d07d901..136e89124c 100644 --- a/osu.Game.Modes.Taiko/Objects/Hit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Hit.cs @@ -4,7 +4,7 @@ using osu.Game.Beatmaps.Timing; using osu.Game.Database; -namespace osu.Game.Modes.Taiko.Objects +namespace osu.Game.Rulesets.Taiko.Objects { public class Hit : TaikoHitObject { diff --git a/osu.Game.Modes.Taiko/Objects/RimHit.cs b/osu.Game.Rulesets.Taiko/Objects/RimHit.cs similarity index 79% rename from osu.Game.Modes.Taiko/Objects/RimHit.cs rename to osu.Game.Rulesets.Taiko/Objects/RimHit.cs index aae93ec10d..8e09842294 100644 --- a/osu.Game.Modes.Taiko/Objects/RimHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/RimHit.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 -namespace osu.Game.Modes.Taiko.Objects +namespace osu.Game.Rulesets.Taiko.Objects { public class RimHit : Hit { diff --git a/osu.Game.Modes.Taiko/Objects/Swell.cs b/osu.Game.Rulesets.Taiko/Objects/Swell.cs similarity index 83% rename from osu.Game.Modes.Taiko/Objects/Swell.cs rename to osu.Game.Rulesets.Taiko/Objects/Swell.cs index 97101ea797..f74a543ca9 100644 --- a/osu.Game.Modes.Taiko/Objects/Swell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Swell.cs @@ -1,9 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Objects.Types; +using osu.Game.Rulesets.Objects.Types; -namespace osu.Game.Modes.Taiko.Objects +namespace osu.Game.Rulesets.Taiko.Objects { public class Swell : TaikoHitObject, IHasEndTime { diff --git a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs similarity index 93% rename from osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs rename to osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs index ebc9b19d3a..6a6353fde2 100644 --- a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs @@ -3,10 +3,10 @@ using osu.Game.Beatmaps.Timing; using osu.Game.Database; -using osu.Game.Modes.Objects; -using osu.Game.Modes.Taiko.UI; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Taiko.UI; -namespace osu.Game.Modes.Taiko.Objects +namespace osu.Game.Rulesets.Taiko.Objects { public abstract class TaikoHitObject : HitObject { diff --git a/osu.Game.Modes.Taiko/OpenTK.dll.config b/osu.Game.Rulesets.Taiko/OpenTK.dll.config similarity index 100% rename from osu.Game.Modes.Taiko/OpenTK.dll.config rename to osu.Game.Rulesets.Taiko/OpenTK.dll.config diff --git a/osu.Game.Modes.Taiko/Properties/AssemblyInfo.cs b/osu.Game.Rulesets.Taiko/Properties/AssemblyInfo.cs similarity index 90% rename from osu.Game.Modes.Taiko/Properties/AssemblyInfo.cs rename to osu.Game.Rulesets.Taiko/Properties/AssemblyInfo.cs index 94ec895707..89c07517ca 100644 --- a/osu.Game.Modes.Taiko/Properties/AssemblyInfo.cs +++ b/osu.Game.Rulesets.Taiko/Properties/AssemblyInfo.cs @@ -7,11 +7,11 @@ using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("osu.Game.Modes.Taiko")] +[assembly: AssemblyTitle("osu.Game.Rulesets.Taiko")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("osu.Game.Modes.Taiko")] +[assembly: AssemblyProduct("osu.Game.Rulesets.Taiko")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/osu.Game.Modes.Taiko/Replays/TaikoAutoReplay.cs b/osu.Game.Rulesets.Taiko/Replays/TaikoAutoReplay.cs similarity index 93% rename from osu.Game.Modes.Taiko/Replays/TaikoAutoReplay.cs rename to osu.Game.Rulesets.Taiko/Replays/TaikoAutoReplay.cs index 89d974baf9..b44c789be5 100644 --- a/osu.Game.Modes.Taiko/Replays/TaikoAutoReplay.cs +++ b/osu.Game.Rulesets.Taiko/Replays/TaikoAutoReplay.cs @@ -3,11 +3,11 @@ using System; using osu.Game.Beatmaps; -using osu.Game.Modes.Objects.Types; -using osu.Game.Modes.Taiko.Objects; -using osu.Game.Modes.Replays; +using osu.Game.Rulesets.Objects.Types; +using osu.Game.Rulesets.Taiko.Objects; +using osu.Game.Rulesets.Replays; -namespace osu.Game.Modes.Taiko.Replays +namespace osu.Game.Rulesets.Taiko.Replays { public class TaikoAutoReplay : Replay { diff --git a/osu.Game.Modes.Taiko/Replays/TaikoFramedReplayInputHandler.cs b/osu.Game.Rulesets.Taiko/Replays/TaikoFramedReplayInputHandler.cs similarity index 90% rename from osu.Game.Modes.Taiko/Replays/TaikoFramedReplayInputHandler.cs rename to osu.Game.Rulesets.Taiko/Replays/TaikoFramedReplayInputHandler.cs index 44fca4abe7..f6425dd66f 100644 --- a/osu.Game.Modes.Taiko/Replays/TaikoFramedReplayInputHandler.cs +++ b/osu.Game.Rulesets.Taiko/Replays/TaikoFramedReplayInputHandler.cs @@ -1,12 +1,12 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Replays; +using osu.Game.Rulesets.Replays; using System.Collections.Generic; using osu.Framework.Input; using OpenTK.Input; -namespace osu.Game.Modes.Taiko.Replays +namespace osu.Game.Rulesets.Taiko.Replays { internal class TaikoFramedReplayInputHandler : FramedReplayInputHandler { diff --git a/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs similarity index 95% rename from osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs rename to osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs index 987c3181a4..f5e2094cbf 100644 --- a/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs +++ b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs @@ -4,14 +4,14 @@ using System; using osu.Game.Beatmaps; using osu.Game.Database; -using osu.Game.Modes.Objects.Drawables; -using osu.Game.Modes.Scoring; -using osu.Game.Modes.Taiko.Judgements; -using osu.Game.Modes.Taiko.Objects; -using osu.Game.Modes.UI; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Scoring; +using osu.Game.Rulesets.Taiko.Judgements; +using osu.Game.Rulesets.Taiko.Objects; +using osu.Game.Rulesets.UI; using OpenTK; -namespace osu.Game.Modes.Taiko.Scoring +namespace osu.Game.Rulesets.Taiko.Scoring { internal class TaikoScoreProcessor : ScoreProcessor { diff --git a/osu.Game.Modes.Taiko/TaikoDifficultyCalculator.cs b/osu.Game.Rulesets.Taiko/TaikoDifficultyCalculator.cs similarity index 79% rename from osu.Game.Modes.Taiko/TaikoDifficultyCalculator.cs rename to osu.Game.Rulesets.Taiko/TaikoDifficultyCalculator.cs index 453a937b9e..cd61709db8 100644 --- a/osu.Game.Modes.Taiko/TaikoDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Taiko/TaikoDifficultyCalculator.cs @@ -2,12 +2,12 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Beatmaps; -using osu.Game.Modes.Beatmaps; -using osu.Game.Modes.Taiko.Beatmaps; -using osu.Game.Modes.Taiko.Objects; +using osu.Game.Rulesets.Beatmaps; +using osu.Game.Rulesets.Taiko.Beatmaps; +using osu.Game.Rulesets.Taiko.Objects; using System.Collections.Generic; -namespace osu.Game.Modes.Taiko +namespace osu.Game.Rulesets.Taiko { public class TaikoDifficultyCalculator : DifficultyCalculator { diff --git a/osu.Game.Modes.Taiko/TaikoRuleset.cs b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs similarity index 90% rename from osu.Game.Modes.Taiko/TaikoRuleset.cs rename to osu.Game.Rulesets.Taiko/TaikoRuleset.cs index b93c25c55d..3fb2cf6c28 100644 --- a/osu.Game.Modes.Taiko/TaikoRuleset.cs +++ b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs @@ -4,16 +4,16 @@ using OpenTK.Input; using osu.Game.Beatmaps; using osu.Game.Graphics; -using osu.Game.Modes.Mods; -using osu.Game.Modes.Taiko.Mods; -using osu.Game.Modes.Taiko.UI; -using osu.Game.Modes.UI; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Taiko.Mods; +using osu.Game.Rulesets.Taiko.UI; +using osu.Game.Rulesets.UI; using osu.Game.Screens.Play; using System.Collections.Generic; -using osu.Game.Modes.Scoring; -using osu.Game.Modes.Taiko.Scoring; +using osu.Game.Rulesets.Scoring; +using osu.Game.Rulesets.Taiko.Scoring; -namespace osu.Game.Modes.Taiko +namespace osu.Game.Rulesets.Taiko { public class TaikoRuleset : Ruleset { diff --git a/osu.Game.Modes.Taiko/UI/DrawableTaikoJudgement.cs b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoJudgement.cs similarity index 88% rename from osu.Game.Modes.Taiko/UI/DrawableTaikoJudgement.cs rename to osu.Game.Rulesets.Taiko/UI/DrawableTaikoJudgement.cs index 78c9657b40..08fd8dbecc 100644 --- a/osu.Game.Modes.Taiko/UI/DrawableTaikoJudgement.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoJudgement.cs @@ -1,13 +1,13 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Taiko.Judgements; -using osu.Game.Modes.Objects.Drawables; +using osu.Game.Rulesets.Taiko.Judgements; +using osu.Game.Rulesets.Objects.Drawables; using osu.Framework.Allocation; using osu.Game.Graphics; -using osu.Game.Modes.Judgements; +using osu.Game.Rulesets.Judgements; -namespace osu.Game.Modes.Taiko.UI +namespace osu.Game.Rulesets.Taiko.UI { /// /// Text that is shown as judgement when a hit object is hit or missed. diff --git a/osu.Game.Modes.Taiko/UI/HitExplosion.cs b/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs similarity index 91% rename from osu.Game.Modes.Taiko/UI/HitExplosion.cs rename to osu.Game.Rulesets.Taiko/UI/HitExplosion.cs index e4e329523f..2ebdeaa5b0 100644 --- a/osu.Game.Modes.Taiko/UI/HitExplosion.cs +++ b/osu.Game.Rulesets.Taiko/UI/HitExplosion.cs @@ -8,10 +8,10 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; -using osu.Game.Modes.Taiko.Judgements; -using osu.Game.Modes.Taiko.Objects; +using osu.Game.Rulesets.Taiko.Judgements; +using osu.Game.Rulesets.Taiko.Objects; -namespace osu.Game.Modes.Taiko.UI +namespace osu.Game.Rulesets.Taiko.UI { /// /// A circle explodes from the hit target to indicate a hitobject has been hit. diff --git a/osu.Game.Modes.Taiko/UI/HitTarget.cs b/osu.Game.Rulesets.Taiko/UI/HitTarget.cs similarity index 95% rename from osu.Game.Modes.Taiko/UI/HitTarget.cs rename to osu.Game.Rulesets.Taiko/UI/HitTarget.cs index b22dc1d647..fde2623246 100644 --- a/osu.Game.Modes.Taiko/UI/HitTarget.cs +++ b/osu.Game.Rulesets.Taiko/UI/HitTarget.cs @@ -6,9 +6,9 @@ using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Game.Modes.Taiko.Objects; +using osu.Game.Rulesets.Taiko.Objects; -namespace osu.Game.Modes.Taiko.UI +namespace osu.Game.Rulesets.Taiko.UI { /// /// A component that is displayed at the hit position in the taiko playfield. diff --git a/osu.Game.Modes.Taiko/UI/InputDrum.cs b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs similarity index 96% rename from osu.Game.Modes.Taiko/UI/InputDrum.cs rename to osu.Game.Rulesets.Taiko/UI/InputDrum.cs index d238c38e74..999d76ab0b 100644 --- a/osu.Game.Modes.Taiko/UI/InputDrum.cs +++ b/osu.Game.Rulesets.Taiko/UI/InputDrum.cs @@ -12,7 +12,7 @@ using osu.Framework.Graphics.Textures; using osu.Framework.Input; using osu.Game.Graphics; -namespace osu.Game.Modes.Taiko.UI +namespace osu.Game.Rulesets.Taiko.UI { /// /// A component of the playfield that captures input and displays input as a drum. diff --git a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs b/osu.Game.Rulesets.Taiko/UI/TaikoHitRenderer.cs similarity index 88% rename from osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs rename to osu.Game.Rulesets.Taiko/UI/TaikoHitRenderer.cs index 48d4457a53..e42a8432fd 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoHitRenderer.cs @@ -6,21 +6,21 @@ using osu.Framework.MathUtils; using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Timing; -using osu.Game.Modes.Objects.Drawables; -using osu.Game.Modes.Objects.Types; -using osu.Game.Modes.Replays; -using osu.Game.Modes.Scoring; -using osu.Game.Modes.Taiko.Beatmaps; -using osu.Game.Modes.Taiko.Judgements; -using osu.Game.Modes.Taiko.Objects; -using osu.Game.Modes.Taiko.Objects.Drawables; -using osu.Game.Modes.Taiko.Scoring; -using osu.Game.Modes.UI; -using osu.Game.Modes.Taiko.Replays; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Objects.Types; +using osu.Game.Rulesets.Replays; +using osu.Game.Rulesets.Scoring; +using osu.Game.Rulesets.Taiko.Beatmaps; +using osu.Game.Rulesets.Taiko.Judgements; +using osu.Game.Rulesets.Taiko.Objects; +using osu.Game.Rulesets.Taiko.Objects.Drawables; +using osu.Game.Rulesets.Taiko.Scoring; +using osu.Game.Rulesets.UI; +using osu.Game.Rulesets.Taiko.Replays; using OpenTK; -using osu.Game.Modes.Beatmaps; +using osu.Game.Rulesets.Beatmaps; -namespace osu.Game.Modes.Taiko.UI +namespace osu.Game.Rulesets.Taiko.UI { public class TaikoHitRenderer : HitRenderer { diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs similarity index 95% rename from osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs rename to osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index db3a1bc84e..8e6f1c8556 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -4,21 +4,21 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; -using osu.Game.Modes.Taiko.Objects; -using osu.Game.Modes.UI; +using osu.Game.Rulesets.Taiko.Objects; +using osu.Game.Rulesets.UI; using OpenTK; using OpenTK.Graphics; -using osu.Game.Modes.Taiko.Judgements; -using osu.Game.Modes.Objects.Drawables; +using osu.Game.Rulesets.Taiko.Judgements; +using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics.Primitives; using System.Linq; -using osu.Game.Modes.Taiko.Objects.Drawables; +using osu.Game.Rulesets.Taiko.Objects.Drawables; using System; -namespace osu.Game.Modes.Taiko.UI +namespace osu.Game.Rulesets.Taiko.UI { public class TaikoPlayfield : Playfield { diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj similarity index 96% rename from osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj rename to osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj index ee7cb73431..c668b90ec4 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj @@ -7,8 +7,8 @@ {F167E17A-7DE6-4AF5-B920-A5112296C695} Library Properties - osu.Game.Modes.Taiko - osu.Game.Modes.Taiko + osu.Game.Rulesets.Taiko + osu.Game.Rulesets.Taiko v4.5 512 diff --git a/osu.Game.Modes.Taiko/packages.config b/osu.Game.Rulesets.Taiko/packages.config similarity index 100% rename from osu.Game.Modes.Taiko/packages.config rename to osu.Game.Rulesets.Taiko/packages.config diff --git a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs index f7a62fe999..4814af984e 100644 --- a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs @@ -9,7 +9,7 @@ using osu.Game.Beatmaps.Formats; using osu.Game.Tests.Resources; using System.Linq; using osu.Game.Audio; -using osu.Game.Modes.Objects.Types; +using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Tests.Beatmaps.Formats { diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index ddaf33c0fc..b8fcb80aaf 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -63,21 +63,21 @@ {c76bf5b3-985e-4d39-95fe-97c9c879b83a} osu.Framework - + {c92a607b-1fdd-4954-9f92-03ff547d9080} - osu.Game.Modes.Osu + osu.Game.Rulesets.Osu - + {58f6c80c-1253-4a0e-a465-b8c85ebeadf3} - osu.Game.Modes.Catch + osu.Game.Rulesets.Catch - + {48f4582b-7687-4621-9cbe-5c24197cb536} - osu.Game.Modes.Mania + osu.Game.Rulesets.Mania - + {f167e17a-7de6-4af5-b920-a5112296c695} - osu.Game.Modes.Taiko + osu.Game.Rulesets.Taiko {0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D} diff --git a/osu.Game/Beatmaps/Beatmap.cs b/osu.Game/Beatmaps/Beatmap.cs index 7ed0546747..3964fd25a7 100644 --- a/osu.Game/Beatmaps/Beatmap.cs +++ b/osu.Game/Beatmaps/Beatmap.cs @@ -4,7 +4,7 @@ using OpenTK.Graphics; using osu.Game.Beatmaps.Timing; using osu.Game.Database; -using osu.Game.Modes.Objects; +using osu.Game.Rulesets.Objects; using System.Collections.Generic; namespace osu.Game.Beatmaps diff --git a/osu.Game/Beatmaps/DifficultyCalculator.cs b/osu.Game/Beatmaps/DifficultyCalculator.cs index 911aaa7189..727c89049f 100644 --- a/osu.Game/Beatmaps/DifficultyCalculator.cs +++ b/osu.Game/Beatmaps/DifficultyCalculator.cs @@ -1,8 +1,8 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Beatmaps; -using osu.Game.Modes.Objects; +using osu.Game.Rulesets.Beatmaps; +using osu.Game.Rulesets.Objects; using System.Collections.Generic; namespace osu.Game.Beatmaps diff --git a/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs index 452bd595c7..cc9d367a59 100644 --- a/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; using System.IO; -using osu.Game.Modes.Objects; +using osu.Game.Rulesets.Objects; using osu.Game.Database; namespace osu.Game.Beatmaps.Formats diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index 758d2205ac..74a5be698e 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -8,7 +8,7 @@ using OpenTK.Graphics; using osu.Game.Beatmaps.Events; using osu.Game.Beatmaps.Timing; using osu.Game.Beatmaps.Legacy; -using osu.Game.Modes.Objects.Legacy; +using osu.Game.Rulesets.Objects.Legacy; namespace osu.Game.Beatmaps.Formats { @@ -90,16 +90,16 @@ namespace osu.Game.Beatmaps.Formats switch (beatmap.BeatmapInfo.RulesetID) { case 0: - parser = new Modes.Objects.Legacy.Osu.HitObjectParser(); + parser = new Rulesets.Objects.Legacy.Osu.HitObjectParser(); break; case 1: - parser = new Modes.Objects.Legacy.Taiko.HitObjectParser(); + parser = new Rulesets.Objects.Legacy.Taiko.HitObjectParser(); break; case 2: - parser = new Modes.Objects.Legacy.Catch.HitObjectParser(); + parser = new Rulesets.Objects.Legacy.Catch.HitObjectParser(); break; case 3: - parser = new Modes.Objects.Legacy.Mania.HitObjectParser(); + parser = new Rulesets.Objects.Legacy.Mania.HitObjectParser(); break; } break; diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 8ffec25882..894719ac6e 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -5,7 +5,7 @@ using osu.Framework.Audio.Track; using osu.Framework.Configuration; using osu.Framework.Graphics.Textures; using osu.Game.Database; -using osu.Game.Modes.Mods; +using osu.Game.Rulesets.Mods; using System; using System.Collections.Generic; diff --git a/osu.Game/Database/RulesetDatabase.cs b/osu.Game/Database/RulesetDatabase.cs index d19fe56345..b78ca5ffc6 100644 --- a/osu.Game/Database/RulesetDatabase.cs +++ b/osu.Game/Database/RulesetDatabase.cs @@ -7,7 +7,7 @@ using System.IO; using System.Linq; using System.Reflection; using osu.Framework.Platform; -using osu.Game.Modes; +using osu.Game.Rulesets; using SQLite.Net; namespace osu.Game.Database @@ -35,7 +35,7 @@ namespace osu.Game.Database List instances = new List(); - foreach (string file in Directory.GetFiles(Environment.CurrentDirectory, @"osu.Game.Modes.*.dll")) + foreach (string file in Directory.GetFiles(Environment.CurrentDirectory, @"osu.Game.Rulesets.*.dll")) { try { diff --git a/osu.Game/Database/RulesetInfo.cs b/osu.Game/Database/RulesetInfo.cs index c3c0d4343d..322cb10c33 100644 --- a/osu.Game/Database/RulesetInfo.cs +++ b/osu.Game/Database/RulesetInfo.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using osu.Game.Modes; +using osu.Game.Rulesets; using SQLite.Net.Attributes; namespace osu.Game.Database diff --git a/osu.Game/Database/ScoreDatabase.cs b/osu.Game/Database/ScoreDatabase.cs index a2fff7f795..359728070f 100644 --- a/osu.Game/Database/ScoreDatabase.cs +++ b/osu.Game/Database/ScoreDatabase.cs @@ -7,7 +7,7 @@ using System.Linq; using osu.Framework.Platform; using osu.Game.IO.Legacy; using osu.Game.IPC; -using osu.Game.Modes.Scoring; +using osu.Game.Rulesets.Scoring; using SharpCompress.Compressors.LZMA; using SQLite.Net; diff --git a/osu.Game/Graphics/TextAwesome.cs b/osu.Game/Graphics/TextAwesome.cs index 1bae165e45..69b0217444 100644 --- a/osu.Game/Graphics/TextAwesome.cs +++ b/osu.Game/Graphics/TextAwesome.cs @@ -817,13 +817,13 @@ namespace osu.Game.Graphics fa_youtube_play = 0xf16a, fa_youtube_square = 0xf166, - // gamemode icons in circles + // ruleset icons in circles fa_osu_osu_o = 0xe000, fa_osu_mania_o = 0xe001, fa_osu_fruits_o = 0xe002, fa_osu_taiko_o = 0xe003, - // gamemode icons without circles + // ruleset icons without circles fa_osu_filled_circle = 0xe004, fa_osu_cross_o = 0xe005, fa_osu_logo = 0xe006, diff --git a/osu.Game/Online/API/Requests/GetScoresRequest.cs b/osu.Game/Online/API/Requests/GetScoresRequest.cs index 66c5e6c72d..3685d0b9e3 100644 --- a/osu.Game/Online/API/Requests/GetScoresRequest.cs +++ b/osu.Game/Online/API/Requests/GetScoresRequest.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using Newtonsoft.Json; using osu.Framework.IO.Network; using osu.Game.Database; -using osu.Game.Modes.Scoring; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Online.API.Requests { diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 1006008afc..cd89f4bdc7 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -25,7 +25,7 @@ using System.Threading.Tasks; using osu.Framework.Threading; using osu.Game.Database; using osu.Game.Graphics; -using osu.Game.Modes.Scoring; +using osu.Game.Rulesets.Scoring; using osu.Game.Overlays.Notifications; using osu.Game.Screens.Play; @@ -205,7 +205,7 @@ namespace osu.Game OnRulesetChange = r => Ruleset.Value = r, }, t => { - Ruleset.ValueChanged += delegate { Toolbar.SetGameMode(Ruleset.Value); }; + Ruleset.ValueChanged += delegate { Toolbar.SetRuleset(Ruleset.Value); }; Ruleset.TriggerChange(); overlayContent.Add(Toolbar); }); @@ -279,7 +279,7 @@ namespace osu.Game return; } - //central game mode change logic. + //central game screen change logic. if (!currentScreen.ShowOverlays) { options.State = Visibility.Hidden; diff --git a/osu.Game/Overlays/Mods/AssistedSection.cs b/osu.Game/Overlays/Mods/AssistedSection.cs index a1ec7a3fdc..b4263fa309 100644 --- a/osu.Game/Overlays/Mods/AssistedSection.cs +++ b/osu.Game/Overlays/Mods/AssistedSection.cs @@ -4,7 +4,7 @@ using OpenTK.Input; using osu.Framework.Allocation; using osu.Game.Graphics; -using osu.Game.Modes.Mods; +using osu.Game.Rulesets.Mods; namespace osu.Game.Overlays.Mods { diff --git a/osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs b/osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs index 13df5aabfb..0a293416dc 100644 --- a/osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs +++ b/osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs @@ -4,7 +4,7 @@ using OpenTK.Input; using osu.Framework.Allocation; using osu.Game.Graphics; -using osu.Game.Modes.Mods; +using osu.Game.Rulesets.Mods; namespace osu.Game.Overlays.Mods { diff --git a/osu.Game/Overlays/Mods/DifficultyReductionSection.cs b/osu.Game/Overlays/Mods/DifficultyReductionSection.cs index f8ac4551ef..3a373e6f09 100644 --- a/osu.Game/Overlays/Mods/DifficultyReductionSection.cs +++ b/osu.Game/Overlays/Mods/DifficultyReductionSection.cs @@ -4,7 +4,7 @@ using OpenTK.Input; using osu.Framework.Allocation; using osu.Game.Graphics; -using osu.Game.Modes.Mods; +using osu.Game.Rulesets.Mods; namespace osu.Game.Overlays.Mods { diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index b787935d57..f380c19d8a 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -12,8 +12,8 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Input; using osu.Game.Graphics.Sprites; -using osu.Game.Modes.Mods; -using osu.Game.Modes.UI; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.UI; using System; using System.Linq; diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index 0e93a5520d..c2af12f49e 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -9,7 +9,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Input; using osu.Game.Graphics.Sprites; -using osu.Game.Modes.Mods; +using osu.Game.Rulesets.Mods; using System; namespace osu.Game.Overlays.Mods diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index bf7117edf1..dadfb808f7 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -13,7 +13,7 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Sprites; -using osu.Game.Modes.Mods; +using osu.Game.Rulesets.Mods; using System; using System.Collections.Generic; using System.Linq; diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index 4632b55775..86ec6b37e2 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -129,7 +129,7 @@ namespace osu.Game.Overlays.Toolbar } } - public void SetGameMode(RulesetInfo ruleset) => modeSelector.SetGameMode(ruleset); + public void SetRuleset(RulesetInfo ruleset) => modeSelector.SetRuleset(ruleset); protected override void PopIn() { diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs index e4c9db7c5d..1d3260bb23 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs @@ -75,7 +75,7 @@ namespace osu.Game.Overlays.Toolbar Ruleset = ruleset, Action = delegate { - SetGameMode(ruleset); + SetRuleset(ruleset); OnRulesetChange?.Invoke(ruleset); } }); @@ -89,7 +89,7 @@ namespace osu.Game.Overlays.Toolbar Size = new Vector2(modeButtons.DrawSize.X, 1); } - public void SetGameMode(RulesetInfo ruleset) + public void SetRuleset(RulesetInfo ruleset) { foreach (ToolbarModeButton m in modeButtons.Children.Cast()) { diff --git a/osu.Game/Modes/BeatmapStatistic.cs b/osu.Game/Rulesets/BeatmapStatistic.cs similarity index 88% rename from osu.Game/Modes/BeatmapStatistic.cs rename to osu.Game/Rulesets/BeatmapStatistic.cs index d598b81ff4..11ac698851 100644 --- a/osu.Game/Modes/BeatmapStatistic.cs +++ b/osu.Game/Rulesets/BeatmapStatistic.cs @@ -3,7 +3,7 @@ using osu.Game.Graphics; -namespace osu.Game.Modes +namespace osu.Game.Rulesets { public class BeatmapStatistic { diff --git a/osu.Game/Modes/Beatmaps/BeatmapConverter.cs b/osu.Game/Rulesets/Beatmaps/BeatmapConverter.cs similarity index 95% rename from osu.Game/Modes/Beatmaps/BeatmapConverter.cs rename to osu.Game/Rulesets/Beatmaps/BeatmapConverter.cs index c2e5b0affa..07aae6a26e 100644 --- a/osu.Game/Modes/Beatmaps/BeatmapConverter.cs +++ b/osu.Game/Rulesets/Beatmaps/BeatmapConverter.cs @@ -4,10 +4,10 @@ using System; using System.Collections.Generic; using System.Linq; -using osu.Game.Modes.Objects; +using osu.Game.Rulesets.Objects; using osu.Game.Beatmaps; -namespace osu.Game.Modes.Beatmaps +namespace osu.Game.Rulesets.Beatmaps { /// /// Converts a Beatmap for another mode. diff --git a/osu.Game/Modes/Beatmaps/BeatmapProcessor.cs b/osu.Game/Rulesets/Beatmaps/BeatmapProcessor.cs similarity index 89% rename from osu.Game/Modes/Beatmaps/BeatmapProcessor.cs rename to osu.Game/Rulesets/Beatmaps/BeatmapProcessor.cs index ff675a4e5e..ee9fc30f7b 100644 --- a/osu.Game/Modes/Beatmaps/BeatmapProcessor.cs +++ b/osu.Game/Rulesets/Beatmaps/BeatmapProcessor.cs @@ -2,9 +2,9 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Beatmaps; -using osu.Game.Modes.Objects; +using osu.Game.Rulesets.Objects; -namespace osu.Game.Modes.Beatmaps +namespace osu.Game.Rulesets.Beatmaps { /// /// Processes a post-converted Beatmap. diff --git a/osu.Game/Modes/Judgements/DrawableJudgement.cs b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs similarity index 94% rename from osu.Game/Modes/Judgements/DrawableJudgement.cs rename to osu.Game/Rulesets/Judgements/DrawableJudgement.cs index eabcb5c161..3a82827497 100644 --- a/osu.Game/Modes/Judgements/DrawableJudgement.cs +++ b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs @@ -9,9 +9,9 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; -using osu.Game.Modes.Objects.Drawables; +using osu.Game.Rulesets.Objects.Drawables; -namespace osu.Game.Modes.Judgements +namespace osu.Game.Rulesets.Judgements { /// /// A drawable object which visualises the hit result of a . diff --git a/osu.Game/Modes/Judgements/IPartialJudgement.cs b/osu.Game/Rulesets/Judgements/IPartialJudgement.cs similarity index 87% rename from osu.Game/Modes/Judgements/IPartialJudgement.cs rename to osu.Game/Rulesets/Judgements/IPartialJudgement.cs index 2ca1ffce4d..e11270a8c0 100644 --- a/osu.Game/Modes/Judgements/IPartialJudgement.cs +++ b/osu.Game/Rulesets/Judgements/IPartialJudgement.cs @@ -1,10 +1,10 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Objects.Drawables; -using osu.Game.Modes.Scoring; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Scoring; -namespace osu.Game.Modes.Judgements +namespace osu.Game.Rulesets.Judgements { /// /// Inidicates that the judgement this is attached to is a partial judgement and the scoring value may change. diff --git a/osu.Game/Modes/Judgements/Judgement.cs b/osu.Game/Rulesets/Judgements/Judgement.cs similarity index 88% rename from osu.Game/Modes/Judgements/Judgement.cs rename to osu.Game/Rulesets/Judgements/Judgement.cs index 1bf898d25c..ed33cee5d4 100644 --- a/osu.Game/Modes/Judgements/Judgement.cs +++ b/osu.Game/Rulesets/Judgements/Judgement.cs @@ -1,9 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Objects.Drawables; +using osu.Game.Rulesets.Objects.Drawables; -namespace osu.Game.Modes.Judgements +namespace osu.Game.Rulesets.Judgements { public abstract class Judgement { diff --git a/osu.Game/Modes/Mods/IApplicableMod.cs b/osu.Game/Rulesets/Mods/IApplicableMod.cs similarity index 85% rename from osu.Game/Modes/Mods/IApplicableMod.cs rename to osu.Game/Rulesets/Mods/IApplicableMod.cs index 90547f4402..66f3fc5da6 100644 --- a/osu.Game/Modes/Mods/IApplicableMod.cs +++ b/osu.Game/Rulesets/Mods/IApplicableMod.cs @@ -1,10 +1,10 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Objects; -using osu.Game.Modes.UI; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.UI; -namespace osu.Game.Modes.Mods +namespace osu.Game.Rulesets.Mods { /// /// An interface for mods that are applied to a HitRenderer. diff --git a/osu.Game/Modes/Mods/Mod.cs b/osu.Game/Rulesets/Mods/Mod.cs similarity index 95% rename from osu.Game/Modes/Mods/Mod.cs rename to osu.Game/Rulesets/Mods/Mod.cs index b6f09b8506..cfb4d8b8ab 100644 --- a/osu.Game/Modes/Mods/Mod.cs +++ b/osu.Game/Rulesets/Mods/Mod.cs @@ -3,12 +3,12 @@ using osu.Game.Beatmaps; using osu.Game.Graphics; -using osu.Game.Modes.Objects; -using osu.Game.Modes.UI; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.UI; using System; -using osu.Game.Modes.Scoring; +using osu.Game.Rulesets.Scoring; -namespace osu.Game.Modes.Mods +namespace osu.Game.Rulesets.Mods { /// /// The base class for gameplay modifiers. diff --git a/osu.Game/Modes/Mods/ModType.cs b/osu.Game/Rulesets/Mods/ModType.cs similarity index 85% rename from osu.Game/Modes/Mods/ModType.cs rename to osu.Game/Rulesets/Mods/ModType.cs index b1d0e781e1..15ffc4ad63 100644 --- a/osu.Game/Modes/Mods/ModType.cs +++ b/osu.Game/Rulesets/Mods/ModType.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 -namespace osu.Game.Modes.Mods +namespace osu.Game.Rulesets.Mods { public enum ModType { diff --git a/osu.Game/Modes/Objects/BezierApproximator.cs b/osu.Game/Rulesets/Objects/BezierApproximator.cs similarity index 97% rename from osu.Game/Modes/Objects/BezierApproximator.cs rename to osu.Game/Rulesets/Objects/BezierApproximator.cs index 6688e6b2ce..12be591aab 100644 --- a/osu.Game/Modes/Objects/BezierApproximator.cs +++ b/osu.Game/Rulesets/Objects/BezierApproximator.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using OpenTK; -namespace osu.Game.Modes.Objects +namespace osu.Game.Rulesets.Objects { public class BezierApproximator { diff --git a/osu.Game/Modes/Objects/CircularArcApproximator.cs b/osu.Game/Rulesets/Objects/CircularArcApproximator.cs similarity index 96% rename from osu.Game/Modes/Objects/CircularArcApproximator.cs rename to osu.Game/Rulesets/Objects/CircularArcApproximator.cs index 73db5fab29..642793fa3f 100644 --- a/osu.Game/Modes/Objects/CircularArcApproximator.cs +++ b/osu.Game/Rulesets/Objects/CircularArcApproximator.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using osu.Framework.MathUtils; using OpenTK; -namespace osu.Game.Modes.Objects +namespace osu.Game.Rulesets.Objects { public class CircularArcApproximator { diff --git a/osu.Game/Modes/Objects/CurvedHitObject.cs b/osu.Game/Rulesets/Objects/CurvedHitObject.cs similarity index 91% rename from osu.Game/Modes/Objects/CurvedHitObject.cs rename to osu.Game/Rulesets/Objects/CurvedHitObject.cs index ccb3d2497d..517c276242 100644 --- a/osu.Game/Modes/Objects/CurvedHitObject.cs +++ b/osu.Game/Rulesets/Objects/CurvedHitObject.cs @@ -2,10 +2,10 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; -using osu.Game.Modes.Objects.Types; +using osu.Game.Rulesets.Objects.Types; using System.Collections.Generic; -namespace osu.Game.Modes.Objects +namespace osu.Game.Rulesets.Objects { public class CurvedHitObject : HitObject, IHasCurve { diff --git a/osu.Game/Modes/Objects/Drawables/ArmedState.cs b/osu.Game/Rulesets/Objects/Drawables/ArmedState.cs similarity index 80% rename from osu.Game/Modes/Objects/Drawables/ArmedState.cs rename to osu.Game/Rulesets/Objects/Drawables/ArmedState.cs index 2f8d3ad07a..5e57c57f4d 100644 --- a/osu.Game/Modes/Objects/Drawables/ArmedState.cs +++ b/osu.Game/Rulesets/Objects/Drawables/ArmedState.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 -namespace osu.Game.Modes.Objects.Drawables +namespace osu.Game.Rulesets.Objects.Drawables { public enum ArmedState { diff --git a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs similarity index 94% rename from osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs rename to osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index e346a22813..a300eeab31 100644 --- a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -7,13 +7,13 @@ using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; -using osu.Game.Modes.Judgements; +using osu.Game.Rulesets.Judgements; using Container = osu.Framework.Graphics.Containers.Container; -using osu.Game.Modes.Objects.Types; +using osu.Game.Rulesets.Objects.Types; using OpenTK.Graphics; using osu.Game.Audio; -namespace osu.Game.Modes.Objects.Drawables +namespace osu.Game.Rulesets.Objects.Drawables { public abstract class DrawableHitObject : Container, IStateful where TJudgement : Judgement diff --git a/osu.Game/Modes/Objects/Drawables/HitResult.cs b/osu.Game/Rulesets/Objects/Drawables/HitResult.cs similarity index 90% rename from osu.Game/Modes/Objects/Drawables/HitResult.cs rename to osu.Game/Rulesets/Objects/Drawables/HitResult.cs index e036610ae2..7492c0ab96 100644 --- a/osu.Game/Modes/Objects/Drawables/HitResult.cs +++ b/osu.Game/Rulesets/Objects/Drawables/HitResult.cs @@ -3,7 +3,7 @@ using System.ComponentModel; -namespace osu.Game.Modes.Objects.Drawables +namespace osu.Game.Rulesets.Objects.Drawables { public enum HitResult { diff --git a/osu.Game/Modes/Objects/Drawables/IDrawableHitObjectWithProxiedApproach.cs b/osu.Game/Rulesets/Objects/Drawables/IDrawableHitObjectWithProxiedApproach.cs similarity index 83% rename from osu.Game/Modes/Objects/Drawables/IDrawableHitObjectWithProxiedApproach.cs rename to osu.Game/Rulesets/Objects/Drawables/IDrawableHitObjectWithProxiedApproach.cs index 33a1f51414..0314ef3037 100644 --- a/osu.Game/Modes/Objects/Drawables/IDrawableHitObjectWithProxiedApproach.cs +++ b/osu.Game/Rulesets/Objects/Drawables/IDrawableHitObjectWithProxiedApproach.cs @@ -3,7 +3,7 @@ using osu.Framework.Graphics; -namespace osu.Game.Modes.Objects.Drawables +namespace osu.Game.Rulesets.Objects.Drawables { public interface IDrawableHitObjectWithProxiedApproach { diff --git a/osu.Game/Modes/Objects/HitObject.cs b/osu.Game/Rulesets/Objects/HitObject.cs similarity index 95% rename from osu.Game/Modes/Objects/HitObject.cs rename to osu.Game/Rulesets/Objects/HitObject.cs index f362d6de63..240d110976 100644 --- a/osu.Game/Modes/Objects/HitObject.cs +++ b/osu.Game/Rulesets/Objects/HitObject.cs @@ -6,7 +6,7 @@ using osu.Game.Beatmaps.Timing; using osu.Game.Database; using System.Collections.Generic; -namespace osu.Game.Modes.Objects +namespace osu.Game.Rulesets.Objects { /// /// A HitObject describes an object in a Beatmap. diff --git a/osu.Game/Modes/Objects/HitObjectParser.cs b/osu.Game/Rulesets/Objects/HitObjectParser.cs similarity index 85% rename from osu.Game/Modes/Objects/HitObjectParser.cs rename to osu.Game/Rulesets/Objects/HitObjectParser.cs index 5aa9f08589..ea0b5e0d2e 100644 --- a/osu.Game/Modes/Objects/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/HitObjectParser.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 -namespace osu.Game.Modes.Objects +namespace osu.Game.Rulesets.Objects { public abstract class HitObjectParser { diff --git a/osu.Game/Modes/Objects/Legacy/Catch/Hit.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/Hit.cs similarity index 79% rename from osu.Game/Modes/Objects/Legacy/Catch/Hit.cs rename to osu.Game/Rulesets/Objects/Legacy/Catch/Hit.cs index dba7926a79..41dacd1265 100644 --- a/osu.Game/Modes/Objects/Legacy/Catch/Hit.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/Hit.cs @@ -1,9 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Objects.Types; +using osu.Game.Rulesets.Objects.Types; -namespace osu.Game.Modes.Objects.Legacy.Catch +namespace osu.Game.Rulesets.Objects.Legacy.Catch { /// /// Legacy osu!catch Hit-type, used for parsing Beatmaps. diff --git a/osu.Game/Modes/Objects/Legacy/Catch/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/HitObjectParser.cs similarity index 90% rename from osu.Game/Modes/Objects/Legacy/Catch/HitObjectParser.cs rename to osu.Game/Rulesets/Objects/Legacy/Catch/HitObjectParser.cs index 0ef4ed0646..a27244e5bd 100644 --- a/osu.Game/Modes/Objects/Legacy/Catch/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/HitObjectParser.cs @@ -2,10 +2,10 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; -using osu.Game.Modes.Objects.Types; +using osu.Game.Rulesets.Objects.Types; using System.Collections.Generic; -namespace osu.Game.Modes.Objects.Legacy.Catch +namespace osu.Game.Rulesets.Objects.Legacy.Catch { /// /// A HitObjectParser to parse legacy osu!catch Beatmaps. diff --git a/osu.Game/Modes/Objects/Legacy/Catch/Slider.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/Slider.cs similarity index 80% rename from osu.Game/Modes/Objects/Legacy/Catch/Slider.cs rename to osu.Game/Rulesets/Objects/Legacy/Catch/Slider.cs index de71198851..865e56c847 100644 --- a/osu.Game/Modes/Objects/Legacy/Catch/Slider.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/Slider.cs @@ -1,9 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Objects.Types; +using osu.Game.Rulesets.Objects.Types; -namespace osu.Game.Modes.Objects.Legacy.Catch +namespace osu.Game.Rulesets.Objects.Legacy.Catch { /// /// Legacy osu!catch Slider-type, used for parsing Beatmaps. diff --git a/osu.Game/Modes/Objects/Legacy/Catch/Spinner.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/Spinner.cs similarity index 80% rename from osu.Game/Modes/Objects/Legacy/Catch/Spinner.cs rename to osu.Game/Rulesets/Objects/Legacy/Catch/Spinner.cs index a99804a243..7690f42e76 100644 --- a/osu.Game/Modes/Objects/Legacy/Catch/Spinner.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/Spinner.cs @@ -1,9 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Objects.Types; +using osu.Game.Rulesets.Objects.Types; -namespace osu.Game.Modes.Objects.Legacy.Catch +namespace osu.Game.Rulesets.Objects.Legacy.Catch { /// /// Legacy osu!catch Spinner-type, used for parsing Beatmaps. diff --git a/osu.Game/Modes/Objects/Legacy/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs similarity index 96% rename from osu.Game/Modes/Objects/Legacy/HitObjectParser.cs rename to osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs index ec89a63c7a..c915e67ead 100644 --- a/osu.Game/Modes/Objects/Legacy/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs @@ -2,14 +2,14 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; -using osu.Game.Modes.Objects.Types; +using osu.Game.Rulesets.Objects.Types; using System; using System.Collections.Generic; using System.Globalization; using osu.Game.Beatmaps.Formats; using osu.Game.Audio; -namespace osu.Game.Modes.Objects.Legacy +namespace osu.Game.Rulesets.Objects.Legacy { /// /// A HitObjectParser to parse legacy Beatmaps. diff --git a/osu.Game/Modes/Objects/Legacy/HitObjectType.cs b/osu.Game/Rulesets/Objects/Legacy/HitObjectType.cs similarity index 86% rename from osu.Game/Modes/Objects/Legacy/HitObjectType.cs rename to osu.Game/Rulesets/Objects/Legacy/HitObjectType.cs index e203b57c62..9111e6bd12 100644 --- a/osu.Game/Modes/Objects/Legacy/HitObjectType.cs +++ b/osu.Game/Rulesets/Objects/Legacy/HitObjectType.cs @@ -3,7 +3,7 @@ using System; -namespace osu.Game.Modes.Objects.Legacy +namespace osu.Game.Rulesets.Objects.Legacy { [Flags] public enum HitObjectType diff --git a/osu.Game/Modes/Objects/Legacy/Hold.cs b/osu.Game/Rulesets/Objects/Legacy/Hold.cs similarity index 83% rename from osu.Game/Modes/Objects/Legacy/Hold.cs rename to osu.Game/Rulesets/Objects/Legacy/Hold.cs index 6014bf7201..a0a741e8e7 100644 --- a/osu.Game/Modes/Objects/Legacy/Hold.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Hold.cs @@ -2,9 +2,9 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; -using osu.Game.Modes.Objects.Types; +using osu.Game.Rulesets.Objects.Types; -namespace osu.Game.Modes.Objects.Legacy +namespace osu.Game.Rulesets.Objects.Legacy { /// /// Legacy Hold-type, used for parsing "specials" in beatmaps. diff --git a/osu.Game/Modes/Objects/Legacy/Mania/Hit.cs b/osu.Game/Rulesets/Objects/Legacy/Mania/Hit.cs similarity index 79% rename from osu.Game/Modes/Objects/Legacy/Mania/Hit.cs rename to osu.Game/Rulesets/Objects/Legacy/Mania/Hit.cs index 3131bbd89d..8e407fcf92 100644 --- a/osu.Game/Modes/Objects/Legacy/Mania/Hit.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Mania/Hit.cs @@ -1,9 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Objects.Types; +using osu.Game.Rulesets.Objects.Types; -namespace osu.Game.Modes.Objects.Legacy.Mania +namespace osu.Game.Rulesets.Objects.Legacy.Mania { /// /// Legacy osu!mania Hit-type, used for parsing Beatmaps. diff --git a/osu.Game/Modes/Objects/Legacy/Mania/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Mania/HitObjectParser.cs similarity index 90% rename from osu.Game/Modes/Objects/Legacy/Mania/HitObjectParser.cs rename to osu.Game/Rulesets/Objects/Legacy/Mania/HitObjectParser.cs index 1ef01a06b9..98f0459e0a 100644 --- a/osu.Game/Modes/Objects/Legacy/Mania/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Mania/HitObjectParser.cs @@ -2,10 +2,10 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; -using osu.Game.Modes.Objects.Types; +using osu.Game.Rulesets.Objects.Types; using System.Collections.Generic; -namespace osu.Game.Modes.Objects.Legacy.Mania +namespace osu.Game.Rulesets.Objects.Legacy.Mania { /// /// A HitObjectParser to parse legacy osu!mania Beatmaps. diff --git a/osu.Game/Modes/Objects/Legacy/Mania/Slider.cs b/osu.Game/Rulesets/Objects/Legacy/Mania/Slider.cs similarity index 80% rename from osu.Game/Modes/Objects/Legacy/Mania/Slider.cs rename to osu.Game/Rulesets/Objects/Legacy/Mania/Slider.cs index bf8eaa561a..c884ed324b 100644 --- a/osu.Game/Modes/Objects/Legacy/Mania/Slider.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Mania/Slider.cs @@ -1,9 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Objects.Types; +using osu.Game.Rulesets.Objects.Types; -namespace osu.Game.Modes.Objects.Legacy.Mania +namespace osu.Game.Rulesets.Objects.Legacy.Mania { /// /// Legacy osu!mania Slider-type, used for parsing Beatmaps. diff --git a/osu.Game/Modes/Objects/Legacy/Mania/Spinner.cs b/osu.Game/Rulesets/Objects/Legacy/Mania/Spinner.cs similarity index 81% rename from osu.Game/Modes/Objects/Legacy/Mania/Spinner.cs rename to osu.Game/Rulesets/Objects/Legacy/Mania/Spinner.cs index 8183f1129b..3937eb003e 100644 --- a/osu.Game/Modes/Objects/Legacy/Mania/Spinner.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Mania/Spinner.cs @@ -1,9 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Objects.Types; +using osu.Game.Rulesets.Objects.Types; -namespace osu.Game.Modes.Objects.Legacy.Mania +namespace osu.Game.Rulesets.Objects.Legacy.Mania { /// /// Legacy osu!mania Spinner-type, used for parsing Beatmaps. diff --git a/osu.Game/Modes/Objects/Legacy/Osu/Hit.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/Hit.cs similarity index 82% rename from osu.Game/Modes/Objects/Legacy/Osu/Hit.cs rename to osu.Game/Rulesets/Objects/Legacy/Osu/Hit.cs index 397273391a..a30ba9b265 100644 --- a/osu.Game/Modes/Objects/Legacy/Osu/Hit.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Osu/Hit.cs @@ -1,10 +1,10 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Objects.Types; +using osu.Game.Rulesets.Objects.Types; using OpenTK; -namespace osu.Game.Modes.Objects.Legacy.Osu +namespace osu.Game.Rulesets.Objects.Legacy.Osu { /// /// Legacy osu! Hit-type, used for parsing Beatmaps. diff --git a/osu.Game/Modes/Objects/Legacy/Osu/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/HitObjectParser.cs similarity index 90% rename from osu.Game/Modes/Objects/Legacy/Osu/HitObjectParser.cs rename to osu.Game/Rulesets/Objects/Legacy/Osu/HitObjectParser.cs index d063ef8c48..227a4412c4 100644 --- a/osu.Game/Modes/Objects/Legacy/Osu/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Osu/HitObjectParser.cs @@ -2,10 +2,10 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; -using osu.Game.Modes.Objects.Types; +using osu.Game.Rulesets.Objects.Types; using System.Collections.Generic; -namespace osu.Game.Modes.Objects.Legacy.Osu +namespace osu.Game.Rulesets.Objects.Legacy.Osu { /// /// A HitObjectParser to parse legacy osu! Beatmaps. diff --git a/osu.Game/Modes/Objects/Legacy/Osu/Slider.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/Slider.cs similarity index 82% rename from osu.Game/Modes/Objects/Legacy/Osu/Slider.cs rename to osu.Game/Rulesets/Objects/Legacy/Osu/Slider.cs index 24deda85bf..7d90c6d41e 100644 --- a/osu.Game/Modes/Objects/Legacy/Osu/Slider.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Osu/Slider.cs @@ -1,10 +1,10 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Objects.Types; +using osu.Game.Rulesets.Objects.Types; using OpenTK; -namespace osu.Game.Modes.Objects.Legacy.Osu +namespace osu.Game.Rulesets.Objects.Legacy.Osu { /// /// Legacy osu! Slider-type, used for parsing Beatmaps. diff --git a/osu.Game/Modes/Objects/Legacy/Osu/Spinner.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/Spinner.cs similarity index 84% rename from osu.Game/Modes/Objects/Legacy/Osu/Spinner.cs rename to osu.Game/Rulesets/Objects/Legacy/Osu/Spinner.cs index c1c2b34b7c..ad3f9637a7 100644 --- a/osu.Game/Modes/Objects/Legacy/Osu/Spinner.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Osu/Spinner.cs @@ -1,10 +1,10 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Objects.Types; +using osu.Game.Rulesets.Objects.Types; using OpenTK; -namespace osu.Game.Modes.Objects.Legacy.Osu +namespace osu.Game.Rulesets.Objects.Legacy.Osu { /// /// Legacy osu! Spinner-type, used for parsing Beatmaps. diff --git a/osu.Game/Modes/Objects/Legacy/Taiko/Hit.cs b/osu.Game/Rulesets/Objects/Legacy/Taiko/Hit.cs similarity index 78% rename from osu.Game/Modes/Objects/Legacy/Taiko/Hit.cs rename to osu.Game/Rulesets/Objects/Legacy/Taiko/Hit.cs index 73f9b67630..0a9a8ac64c 100644 --- a/osu.Game/Modes/Objects/Legacy/Taiko/Hit.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Taiko/Hit.cs @@ -1,9 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Objects.Types; +using osu.Game.Rulesets.Objects.Types; -namespace osu.Game.Modes.Objects.Legacy.Taiko +namespace osu.Game.Rulesets.Objects.Legacy.Taiko { /// /// Legacy osu!taiko Hit-type, used for parsing Beatmaps. diff --git a/osu.Game/Modes/Objects/Legacy/Taiko/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Taiko/HitObjectParser.cs similarity index 90% rename from osu.Game/Modes/Objects/Legacy/Taiko/HitObjectParser.cs rename to osu.Game/Rulesets/Objects/Legacy/Taiko/HitObjectParser.cs index 80b5b9d1cb..669ee34910 100644 --- a/osu.Game/Modes/Objects/Legacy/Taiko/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Taiko/HitObjectParser.cs @@ -2,10 +2,10 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; -using osu.Game.Modes.Objects.Types; +using osu.Game.Rulesets.Objects.Types; using System.Collections.Generic; -namespace osu.Game.Modes.Objects.Legacy.Taiko +namespace osu.Game.Rulesets.Objects.Legacy.Taiko { /// /// A HitObjectParser to parse legacy osu!taiko Beatmaps. diff --git a/osu.Game/Modes/Objects/Legacy/Taiko/Slider.cs b/osu.Game/Rulesets/Objects/Legacy/Taiko/Slider.cs similarity index 78% rename from osu.Game/Modes/Objects/Legacy/Taiko/Slider.cs rename to osu.Game/Rulesets/Objects/Legacy/Taiko/Slider.cs index b173101fce..18d2d4039d 100644 --- a/osu.Game/Modes/Objects/Legacy/Taiko/Slider.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Taiko/Slider.cs @@ -1,9 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Objects.Types; +using osu.Game.Rulesets.Objects.Types; -namespace osu.Game.Modes.Objects.Legacy.Taiko +namespace osu.Game.Rulesets.Objects.Legacy.Taiko { /// /// Legacy osu!taiko Slider-type, used for parsing Beatmaps. diff --git a/osu.Game/Modes/Objects/Legacy/Taiko/Spinner.cs b/osu.Game/Rulesets/Objects/Legacy/Taiko/Spinner.cs similarity index 80% rename from osu.Game/Modes/Objects/Legacy/Taiko/Spinner.cs rename to osu.Game/Rulesets/Objects/Legacy/Taiko/Spinner.cs index b22f4600c9..1b296b9533 100644 --- a/osu.Game/Modes/Objects/Legacy/Taiko/Spinner.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Taiko/Spinner.cs @@ -1,9 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Objects.Types; +using osu.Game.Rulesets.Objects.Types; -namespace osu.Game.Modes.Objects.Legacy.Taiko +namespace osu.Game.Rulesets.Objects.Legacy.Taiko { /// /// Legacy osu!taiko Spinner-type, used for parsing Beatmaps. diff --git a/osu.Game/Modes/Objects/SliderCurve.cs b/osu.Game/Rulesets/Objects/SliderCurve.cs similarity index 96% rename from osu.Game/Modes/Objects/SliderCurve.cs rename to osu.Game/Rulesets/Objects/SliderCurve.cs index 642a65af21..8bf85e498c 100644 --- a/osu.Game/Modes/Objects/SliderCurve.cs +++ b/osu.Game/Rulesets/Objects/SliderCurve.cs @@ -4,10 +4,10 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.MathUtils; -using osu.Game.Modes.Objects.Types; +using osu.Game.Rulesets.Objects.Types; using OpenTK; -namespace osu.Game.Modes.Objects +namespace osu.Game.Rulesets.Objects { public class SliderCurve { diff --git a/osu.Game/Modes/Objects/Types/CurveType.cs b/osu.Game/Rulesets/Objects/Types/CurveType.cs similarity index 82% rename from osu.Game/Modes/Objects/Types/CurveType.cs rename to osu.Game/Rulesets/Objects/Types/CurveType.cs index ba5d3f37ac..18db712a65 100644 --- a/osu.Game/Modes/Objects/Types/CurveType.cs +++ b/osu.Game/Rulesets/Objects/Types/CurveType.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 -namespace osu.Game.Modes.Objects.Types +namespace osu.Game.Rulesets.Objects.Types { public enum CurveType { diff --git a/osu.Game/Modes/Objects/Types/IHasCombo.cs b/osu.Game/Rulesets/Objects/Types/IHasCombo.cs similarity index 87% rename from osu.Game/Modes/Objects/Types/IHasCombo.cs rename to osu.Game/Rulesets/Objects/Types/IHasCombo.cs index 1ca381372d..f053fdcf49 100644 --- a/osu.Game/Modes/Objects/Types/IHasCombo.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasCombo.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 -namespace osu.Game.Modes.Objects.Types +namespace osu.Game.Rulesets.Objects.Types { /// /// A HitObject that is part of a combo. diff --git a/osu.Game/Modes/Objects/Types/IHasCurve.cs b/osu.Game/Rulesets/Objects/Types/IHasCurve.cs similarity index 95% rename from osu.Game/Modes/Objects/Types/IHasCurve.cs rename to osu.Game/Rulesets/Objects/Types/IHasCurve.cs index 0db799a15f..5ff6d03f6d 100644 --- a/osu.Game/Modes/Objects/Types/IHasCurve.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasCurve.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using OpenTK; -namespace osu.Game.Modes.Objects.Types +namespace osu.Game.Rulesets.Objects.Types { /// /// A HitObject that has a curve. diff --git a/osu.Game/Modes/Objects/Types/IHasDistance.cs b/osu.Game/Rulesets/Objects/Types/IHasDistance.cs similarity index 88% rename from osu.Game/Modes/Objects/Types/IHasDistance.cs rename to osu.Game/Rulesets/Objects/Types/IHasDistance.cs index 87863e64e6..a5e487a0ba 100644 --- a/osu.Game/Modes/Objects/Types/IHasDistance.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasDistance.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 -namespace osu.Game.Modes.Objects.Types +namespace osu.Game.Rulesets.Objects.Types { /// /// A HitObject that has a positional length. diff --git a/osu.Game/Modes/Objects/Types/IHasEndTime.cs b/osu.Game/Rulesets/Objects/Types/IHasEndTime.cs similarity index 89% rename from osu.Game/Modes/Objects/Types/IHasEndTime.cs rename to osu.Game/Rulesets/Objects/Types/IHasEndTime.cs index e96258812c..ac30afe5fb 100644 --- a/osu.Game/Modes/Objects/Types/IHasEndTime.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasEndTime.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 -namespace osu.Game.Modes.Objects.Types +namespace osu.Game.Rulesets.Objects.Types { /// /// A HitObject that ends at a different time than its start time. diff --git a/osu.Game/Modes/Objects/Types/IHasHold.cs b/osu.Game/Rulesets/Objects/Types/IHasHold.cs similarity index 85% rename from osu.Game/Modes/Objects/Types/IHasHold.cs rename to osu.Game/Rulesets/Objects/Types/IHasHold.cs index b9f4939091..82ec790524 100644 --- a/osu.Game/Modes/Objects/Types/IHasHold.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasHold.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 -namespace osu.Game.Modes.Objects.Types +namespace osu.Game.Rulesets.Objects.Types { /// /// A special type of HitObject, mostly used for legacy conversion of "holds". diff --git a/osu.Game/Modes/Objects/Types/IHasPosition.cs b/osu.Game/Rulesets/Objects/Types/IHasPosition.cs similarity index 88% rename from osu.Game/Modes/Objects/Types/IHasPosition.cs rename to osu.Game/Rulesets/Objects/Types/IHasPosition.cs index 094370a090..6eca86656d 100644 --- a/osu.Game/Modes/Objects/Types/IHasPosition.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasPosition.cs @@ -3,7 +3,7 @@ using OpenTK; -namespace osu.Game.Modes.Objects.Types +namespace osu.Game.Rulesets.Objects.Types { /// /// A HitObject that has a starting position. diff --git a/osu.Game/Modes/Objects/Types/IHasRepeats.cs b/osu.Game/Rulesets/Objects/Types/IHasRepeats.cs similarity index 88% rename from osu.Game/Modes/Objects/Types/IHasRepeats.cs rename to osu.Game/Rulesets/Objects/Types/IHasRepeats.cs index a34774d0ef..f7058fd3c9 100644 --- a/osu.Game/Modes/Objects/Types/IHasRepeats.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasRepeats.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 -namespace osu.Game.Modes.Objects.Types +namespace osu.Game.Rulesets.Objects.Types { /// /// A HitObject that spans some length. diff --git a/osu.Game/Modes/Objects/Types/IHasXPosition.cs b/osu.Game/Rulesets/Objects/Types/IHasXPosition.cs similarity index 87% rename from osu.Game/Modes/Objects/Types/IHasXPosition.cs rename to osu.Game/Rulesets/Objects/Types/IHasXPosition.cs index 1f75625e93..b0ad3af7d2 100644 --- a/osu.Game/Modes/Objects/Types/IHasXPosition.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasXPosition.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -namespace osu.Game.Modes.Objects.Types +namespace osu.Game.Rulesets.Objects.Types { /// /// A HitObject that has a starting X-position. diff --git a/osu.Game/Modes/Objects/Types/IHasYPosition.cs b/osu.Game/Rulesets/Objects/Types/IHasYPosition.cs similarity index 87% rename from osu.Game/Modes/Objects/Types/IHasYPosition.cs rename to osu.Game/Rulesets/Objects/Types/IHasYPosition.cs index f746acb939..222e8f762f 100644 --- a/osu.Game/Modes/Objects/Types/IHasYPosition.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasYPosition.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -namespace osu.Game.Modes.Objects.Types +namespace osu.Game.Rulesets.Objects.Types { /// /// A HitObject that has a starting Y-position. diff --git a/osu.Game/Modes/Replays/FramedReplayInputHandler.cs b/osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs similarity index 96% rename from osu.Game/Modes/Replays/FramedReplayInputHandler.cs rename to osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs index 0c1e140ce4..60da35fd91 100644 --- a/osu.Game/Modes/Replays/FramedReplayInputHandler.cs +++ b/osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs @@ -12,7 +12,7 @@ using OpenTK.Input; using KeyboardState = osu.Framework.Input.KeyboardState; using MouseState = osu.Framework.Input.MouseState; -namespace osu.Game.Modes.Replays +namespace osu.Game.Rulesets.Replays { /// /// The ReplayHandler will take a replay and handle the propagation of updates to the input stack. diff --git a/osu.Game/Modes/Replays/Replay.cs b/osu.Game/Rulesets/Replays/Replay.cs similarity index 86% rename from osu.Game/Modes/Replays/Replay.cs rename to osu.Game/Rulesets/Replays/Replay.cs index 62f60358e0..8e9d7cdaad 100644 --- a/osu.Game/Modes/Replays/Replay.cs +++ b/osu.Game/Rulesets/Replays/Replay.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; -namespace osu.Game.Modes.Replays +namespace osu.Game.Rulesets.Replays { public class Replay { diff --git a/osu.Game/Modes/Replays/ReplayButtonState.cs b/osu.Game/Rulesets/Replays/ReplayButtonState.cs similarity index 86% rename from osu.Game/Modes/Replays/ReplayButtonState.cs rename to osu.Game/Rulesets/Replays/ReplayButtonState.cs index d49139226c..be55a153cb 100644 --- a/osu.Game/Modes/Replays/ReplayButtonState.cs +++ b/osu.Game/Rulesets/Replays/ReplayButtonState.cs @@ -3,7 +3,7 @@ using System; -namespace osu.Game.Modes.Replays +namespace osu.Game.Rulesets.Replays { [Flags] public enum ReplayButtonState diff --git a/osu.Game/Modes/Replays/ReplayFrame.cs b/osu.Game/Rulesets/Replays/ReplayFrame.cs similarity index 95% rename from osu.Game/Modes/Replays/ReplayFrame.cs rename to osu.Game/Rulesets/Replays/ReplayFrame.cs index 4cd681beaf..31f952abdf 100644 --- a/osu.Game/Modes/Replays/ReplayFrame.cs +++ b/osu.Game/Rulesets/Replays/ReplayFrame.cs @@ -3,7 +3,7 @@ using OpenTK; -namespace osu.Game.Modes.Replays +namespace osu.Game.Rulesets.Replays { public class ReplayFrame { diff --git a/osu.Game/Modes/Ruleset.cs b/osu.Game/Rulesets/Ruleset.cs similarity index 87% rename from osu.Game/Modes/Ruleset.cs rename to osu.Game/Rulesets/Ruleset.cs index cf0fbe5b6a..5e92d25297 100644 --- a/osu.Game/Modes/Ruleset.cs +++ b/osu.Game/Rulesets/Ruleset.cs @@ -3,13 +3,13 @@ using osu.Game.Beatmaps; using osu.Game.Graphics; -using osu.Game.Modes.Mods; -using osu.Game.Modes.UI; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.UI; using osu.Game.Screens.Play; using System.Collections.Generic; -using osu.Game.Modes.Scoring; +using osu.Game.Rulesets.Scoring; -namespace osu.Game.Modes +namespace osu.Game.Rulesets { public abstract class Ruleset { diff --git a/osu.Game/Modes/Scoring/Score.cs b/osu.Game/Rulesets/Scoring/Score.cs similarity index 93% rename from osu.Game/Modes/Scoring/Score.cs rename to osu.Game/Rulesets/Scoring/Score.cs index b0c123f438..cb7831b04a 100644 --- a/osu.Game/Modes/Scoring/Score.cs +++ b/osu.Game/Rulesets/Scoring/Score.cs @@ -5,12 +5,12 @@ using System; using System.Collections.Generic; using Newtonsoft.Json; using osu.Game.Database; -using osu.Game.Modes.Mods; +using osu.Game.Rulesets.Mods; using osu.Game.Users; using System.IO; -using osu.Game.Modes.Replays; +using osu.Game.Rulesets.Replays; -namespace osu.Game.Modes.Scoring +namespace osu.Game.Rulesets.Scoring { public class Score { diff --git a/osu.Game/Modes/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs similarity index 92% rename from osu.Game/Modes/Scoring/ScoreProcessor.cs rename to osu.Game/Rulesets/Scoring/ScoreProcessor.cs index ba845b84dc..b2c5d8319e 100644 --- a/osu.Game/Modes/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -5,12 +5,12 @@ using System; using System.Collections.Generic; using osu.Framework.Configuration; using osu.Game.Beatmaps; -using osu.Game.Modes.Judgements; -using osu.Game.Modes.Objects; -using osu.Game.Modes.UI; -using osu.Game.Modes.Objects.Drawables; +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.UI; +using osu.Game.Rulesets.Objects.Drawables; -namespace osu.Game.Modes.Scoring +namespace osu.Game.Rulesets.Scoring { public abstract class ScoreProcessor { @@ -62,7 +62,7 @@ namespace osu.Game.Modes.Scoring } /// - /// Creates a Score applicable to the game mode in which this ScoreProcessor resides. + /// Creates a Score applicable to the ruleset in which this ScoreProcessor resides. /// /// The Score. public virtual Score CreateScore() => new Score @@ -193,4 +193,4 @@ namespace osu.Game.Modes.Scoring /// The judgement that triggered this calculation. protected virtual void OnJudgementChanged(TJudgement judgement) { } } -} \ No newline at end of file +} diff --git a/osu.Game/Modes/Scoring/ScoreRank.cs b/osu.Game/Rulesets/Scoring/ScoreRank.cs similarity index 90% rename from osu.Game/Modes/Scoring/ScoreRank.cs rename to osu.Game/Rulesets/Scoring/ScoreRank.cs index 743f24ecd6..f4a6a1e03c 100644 --- a/osu.Game/Modes/Scoring/ScoreRank.cs +++ b/osu.Game/Rulesets/Scoring/ScoreRank.cs @@ -3,7 +3,7 @@ using System.ComponentModel; -namespace osu.Game.Modes.Scoring +namespace osu.Game.Rulesets.Scoring { public enum ScoreRank { diff --git a/osu.Game/Modes/UI/ComboCounter.cs b/osu.Game/Rulesets/UI/ComboCounter.cs similarity index 96% rename from osu.Game/Modes/UI/ComboCounter.cs rename to osu.Game/Rulesets/UI/ComboCounter.cs index 8c0327fa04..d21059cbdb 100644 --- a/osu.Game/Modes/UI/ComboCounter.cs +++ b/osu.Game/Rulesets/UI/ComboCounter.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics.Transforms; using osu.Framework.MathUtils; using osu.Game.Graphics.Sprites; -namespace osu.Game.Modes.UI +namespace osu.Game.Rulesets.UI { public abstract class ComboCounter : Container { diff --git a/osu.Game/Modes/UI/ComboResultCounter.cs b/osu.Game/Rulesets/UI/ComboResultCounter.cs similarity index 95% rename from osu.Game/Modes/UI/ComboResultCounter.cs rename to osu.Game/Rulesets/UI/ComboResultCounter.cs index 63009c5351..4b19b2c1ff 100644 --- a/osu.Game/Modes/UI/ComboResultCounter.cs +++ b/osu.Game/Rulesets/UI/ComboResultCounter.cs @@ -7,7 +7,7 @@ using osu.Framework.MathUtils; using osu.Game.Graphics.UserInterface; using System; -namespace osu.Game.Modes.UI +namespace osu.Game.Rulesets.UI { /// /// Used to display combo with a roll-up animation in results screen. diff --git a/osu.Game/Modes/UI/HealthDisplay.cs b/osu.Game/Rulesets/UI/HealthDisplay.cs similarity index 91% rename from osu.Game/Modes/UI/HealthDisplay.cs rename to osu.Game/Rulesets/UI/HealthDisplay.cs index 4c8d7e4ab8..5c6b9d2fe3 100644 --- a/osu.Game/Modes/UI/HealthDisplay.cs +++ b/osu.Game/Rulesets/UI/HealthDisplay.cs @@ -4,7 +4,7 @@ using osu.Framework.Configuration; using osu.Framework.Graphics.Containers; -namespace osu.Game.Modes.UI +namespace osu.Game.Rulesets.UI { public abstract class HealthDisplay : Container { diff --git a/osu.Game/Modes/UI/HitRenderer.cs b/osu.Game/Rulesets/UI/HitRenderer.cs similarity index 94% rename from osu.Game/Modes/UI/HitRenderer.cs rename to osu.Game/Rulesets/UI/HitRenderer.cs index 3e51b2b44f..098a4d5f03 100644 --- a/osu.Game/Modes/UI/HitRenderer.cs +++ b/osu.Game/Rulesets/UI/HitRenderer.cs @@ -5,21 +5,21 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; -using osu.Game.Modes.Judgements; -using osu.Game.Modes.Mods; -using osu.Game.Modes.Objects; -using osu.Game.Modes.Objects.Drawables; +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Screens.Play; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; -using osu.Game.Modes.Replays; -using osu.Game.Modes.Scoring; +using osu.Game.Rulesets.Replays; +using osu.Game.Rulesets.Scoring; using OpenTK; -using osu.Game.Modes.Beatmaps; +using osu.Game.Rulesets.Beatmaps; -namespace osu.Game.Modes.UI +namespace osu.Game.Rulesets.UI { /// /// Base HitRenderer. Doesn't hold objects. diff --git a/osu.Game/Modes/UI/HudOverlay.cs b/osu.Game/Rulesets/UI/HudOverlay.cs similarity index 95% rename from osu.Game/Modes/UI/HudOverlay.cs rename to osu.Game/Rulesets/UI/HudOverlay.cs index 4902baf9b9..d2169aa32f 100644 --- a/osu.Game/Modes/UI/HudOverlay.cs +++ b/osu.Game/Rulesets/UI/HudOverlay.cs @@ -8,13 +8,13 @@ using osu.Framework.Graphics.Containers; using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Play; -using osu.Game.Modes.Scoring; +using osu.Game.Rulesets.Scoring; using osu.Framework.Input; using OpenTK.Input; using osu.Game.Overlays; using osu.Game.Overlays.Notifications; -namespace osu.Game.Modes.UI +namespace osu.Game.Rulesets.UI { public abstract class HudOverlay : Container { diff --git a/osu.Game/Modes/UI/ModIcon.cs b/osu.Game/Rulesets/UI/ModIcon.cs similarity index 94% rename from osu.Game/Modes/UI/ModIcon.cs rename to osu.Game/Rulesets/UI/ModIcon.cs index 1e0aa89a41..8301796c1f 100644 --- a/osu.Game/Modes/UI/ModIcon.cs +++ b/osu.Game/Rulesets/UI/ModIcon.cs @@ -6,7 +6,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; -namespace osu.Game.Modes.UI +namespace osu.Game.Rulesets.UI { public class ModIcon : Container { diff --git a/osu.Game/Modes/UI/Playfield.cs b/osu.Game/Rulesets/UI/Playfield.cs similarity index 93% rename from osu.Game/Modes/UI/Playfield.cs rename to osu.Game/Rulesets/UI/Playfield.cs index 1e7cf6579c..44d15e42c4 100644 --- a/osu.Game/Modes/UI/Playfield.cs +++ b/osu.Game/Rulesets/UI/Playfield.cs @@ -4,13 +4,13 @@ using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Game.Modes.Objects; -using osu.Game.Modes.Objects.Drawables; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Objects.Drawables; using OpenTK; -using osu.Game.Modes.Judgements; +using osu.Game.Rulesets.Judgements; using osu.Framework.Allocation; -namespace osu.Game.Modes.UI +namespace osu.Game.Rulesets.UI { public abstract class Playfield : Container where TObject : HitObject diff --git a/osu.Game/Modes/UI/StandardComboCounter.cs b/osu.Game/Rulesets/UI/StandardComboCounter.cs similarity index 96% rename from osu.Game/Modes/UI/StandardComboCounter.cs rename to osu.Game/Rulesets/UI/StandardComboCounter.cs index 08bb3add84..ad05c83839 100644 --- a/osu.Game/Modes/UI/StandardComboCounter.cs +++ b/osu.Game/Rulesets/UI/StandardComboCounter.cs @@ -3,7 +3,7 @@ using OpenTK; -namespace osu.Game.Modes.UI +namespace osu.Game.Rulesets.UI { /// /// Uses the 'x' symbol and has a pop-out effect while rolling over. diff --git a/osu.Game/Modes/UI/StandardHealthDisplay.cs b/osu.Game/Rulesets/UI/StandardHealthDisplay.cs similarity index 95% rename from osu.Game/Modes/UI/StandardHealthDisplay.cs rename to osu.Game/Rulesets/UI/StandardHealthDisplay.cs index 12d0f841a2..9294cc3a1a 100644 --- a/osu.Game/Modes/UI/StandardHealthDisplay.cs +++ b/osu.Game/Rulesets/UI/StandardHealthDisplay.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; -namespace osu.Game.Modes.UI +namespace osu.Game.Rulesets.UI { public class StandardHealthDisplay : HealthDisplay, IHasAccentColour { diff --git a/osu.Game/Modes/UI/StandardHudOverlay.cs b/osu.Game/Rulesets/UI/StandardHudOverlay.cs similarity index 96% rename from osu.Game/Modes/UI/StandardHudOverlay.cs rename to osu.Game/Rulesets/UI/StandardHudOverlay.cs index 161a700bef..2e2cb739f5 100644 --- a/osu.Game/Modes/UI/StandardHudOverlay.cs +++ b/osu.Game/Rulesets/UI/StandardHudOverlay.cs @@ -10,7 +10,7 @@ using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Play; -namespace osu.Game.Modes.UI +namespace osu.Game.Rulesets.UI { public class StandardHudOverlay : HudOverlay { diff --git a/osu.Game/Screens/BackgroundScreen.cs b/osu.Game/Screens/BackgroundScreen.cs index fd40141fcb..a9cb93876c 100644 --- a/osu.Game/Screens/BackgroundScreen.cs +++ b/osu.Game/Screens/BackgroundScreen.cs @@ -28,7 +28,7 @@ namespace osu.Game.Screens public override bool Push(Screen screen) { - // When trying to push a non-loaded GameMode, load it asynchronously and re-invoke Push + // When trying to push a non-loaded screen, load it asynchronously and re-invoke Push // once it's done. if (screen.LoadState == LoadState.NotLoaded) { @@ -36,7 +36,7 @@ namespace osu.Game.Screens return true; } - // Make sure the in-progress loading is complete before pushing the GameMode. + // Make sure the in-progress loading is complete before pushing the screen. while (screen.LoadState < LoadState.Loaded) Thread.Sleep(1); diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index 3e832b36fa..d0856bfe3e 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -14,7 +14,7 @@ namespace osu.Game.Screens internal BackgroundScreen Background { get; private set; } /// - /// Override to create a BackgroundMode for the current GameMode. + /// Override to create a BackgroundMode for the current screen. /// Note that the instance created may not be the used instance if it matches the BackgroundMode equality clause. /// protected virtual BackgroundScreen CreateBackground() => null; @@ -99,7 +99,7 @@ namespace osu.Game.Screens if (Background != null && !Background.Equals(nextOsu?.Background)) { if (nextOsu != null) - //We need to use MakeCurrent in case we are jumping up multiple game modes. + //We need to use MakeCurrent in case we are jumping up multiple game screens. nextOsu.Background?.MakeCurrent(); else Background.Exit(); diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index eea6775063..6918cdb3a4 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -14,14 +14,14 @@ using osu.Framework.Screens; using osu.Framework.Timing; using osu.Game.Configuration; using osu.Game.Database; -using osu.Game.Modes; -using osu.Game.Modes.UI; +using osu.Game.Rulesets; +using osu.Game.Rulesets.UI; using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Ranking; using System; using System.Linq; using osu.Framework.Threading; -using osu.Game.Modes.Scoring; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Screens.Play { diff --git a/osu.Game/Screens/Play/ReplayPlayer.cs b/osu.Game/Screens/Play/ReplayPlayer.cs index 4593656a2e..860675b62a 100644 --- a/osu.Game/Screens/Play/ReplayPlayer.cs +++ b/osu.Game/Screens/Play/ReplayPlayer.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Replays; +using osu.Game.Rulesets.Replays; namespace osu.Game.Screens.Play { diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 52f3b9e1ae..19212ec2f4 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -11,8 +11,8 @@ using osu.Game.Graphics; using osu.Framework.Allocation; using System.Linq; using osu.Framework.Timing; -using osu.Game.Modes.Objects; -using osu.Game.Modes.Objects.Types; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Screens.Play { diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index 37770bea3e..3db070d33c 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -5,7 +5,7 @@ using osu.Framework.Screens; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Sprites; -using osu.Game.Modes.Scoring; +using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Backgrounds; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game/Screens/ScreenWhiteBox.cs b/osu.Game/Screens/ScreenWhiteBox.cs index bebdbb8c2a..dca5e17efa 100644 --- a/osu.Game/Screens/ScreenWhiteBox.cs +++ b/osu.Game/Screens/ScreenWhiteBox.cs @@ -33,7 +33,7 @@ namespace osu.Game.Screens { base.OnEntering(last); - //only show the pop button if we are entered form another gamemode. + //only show the pop button if we are entered form another screen. if (last != null) popButton.Alpha = 1; diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index d15e5a9bb8..c37609acd0 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -18,9 +18,9 @@ using osu.Game.Beatmaps.Drawables; using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; -using osu.Game.Modes; -using osu.Game.Modes.Objects; -using osu.Game.Modes.Objects.Types; +using osu.Game.Rulesets; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Screens.Select { diff --git a/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs b/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs index 1e9d6dc831..647398db9e 100644 --- a/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs +++ b/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs @@ -7,7 +7,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Framework.Extensions; -using osu.Game.Modes.Scoring; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Screens.Select.Leaderboards { diff --git a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs index 315611a60c..2abf3c3175 100644 --- a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs @@ -12,7 +12,7 @@ using osu.Framework.Graphics.Primitives; using System; using osu.Framework.Allocation; using osu.Game.Database; -using osu.Game.Modes.Scoring; +using osu.Game.Rulesets.Scoring; using osu.Game.Online.API; using osu.Game.Online.API.Requests; diff --git a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs index 493f351b75..321067d18e 100644 --- a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs @@ -10,10 +10,10 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Framework.Extensions.Color4Extensions; -using osu.Game.Modes.Mods; +using osu.Game.Rulesets.Mods; using osu.Game.Users; using osu.Framework; -using osu.Game.Modes.Scoring; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Screens.Select.Leaderboards { diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 05fd0502ab..5096323540 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -72,8 +72,8 @@ - - + + @@ -103,60 +103,60 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + @@ -168,8 +168,8 @@ - - + + @@ -223,7 +223,7 @@ - + @@ -236,16 +236,16 @@ - + - - + + - - + + @@ -362,9 +362,9 @@ - + - + @@ -383,7 +383,7 @@ - + diff --git a/osu.sln b/osu.sln index c200d2e586..317cfe7da4 100644 --- a/osu.sln +++ b/osu.sln @@ -21,13 +21,13 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Desktop.VisualTests", " EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game.Tests", "osu.Game.Tests\osu.Game.Tests.csproj", "{54377672-20B1-40AF-8087-5CF73BF3953A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game.Modes.Osu", "osu.Game.Modes.Osu\osu.Game.Modes.Osu.csproj", "{C92A607B-1FDD-4954-9F92-03FF547D9080}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game.Rulesets.Osu", "osu.Game.Rulesets.Osu\osu.Game.Rulesets.Osu.csproj", "{C92A607B-1FDD-4954-9F92-03FF547D9080}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game.Modes.Catch", "osu.Game.Modes.Catch\osu.Game.Modes.Catch.csproj", "{58F6C80C-1253-4A0E-A465-B8C85EBEADF3}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game.Rulesets.Catch", "osu.Game.Rulesets.Catch\osu.Game.Rulesets.Catch.csproj", "{58F6C80C-1253-4A0E-A465-B8C85EBEADF3}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game.Modes.Taiko", "osu.Game.Modes.Taiko\osu.Game.Modes.Taiko.csproj", "{F167E17A-7DE6-4AF5-B920-A5112296C695}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game.Rulesets.Taiko", "osu.Game.Rulesets.Taiko\osu.Game.Rulesets.Taiko.csproj", "{F167E17A-7DE6-4AF5-B920-A5112296C695}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game.Modes.Mania", "osu.Game.Modes.Mania\osu.Game.Modes.Mania.csproj", "{48F4582B-7687-4621-9CBE-5C24197CB536}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game.Rulesets.Mania", "osu.Game.Rulesets.Mania\osu.Game.Rulesets.Mania.csproj", "{48F4582B-7687-4621-9CBE-5C24197CB536}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Desktop.Tests", "osu.Desktop.Tests\osu.Desktop.Tests.csproj", "{230AC4F3-7783-49FB-9AEC-B83CDA3B9F3D}" EndProject From 6dc15963e09fdab3b149ac03d9486010f978a1ab Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 16:15:16 +0900 Subject: [PATCH 245/442] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 979fb1ffdf..21a97586f7 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 979fb1ffdfaa08c39ff4f0cdda42e5b313d70534 +Subproject commit 21a97586f7fa8d9aa65b4131824151d88a70b520 From 2ccb8b154f73ddd46407fb6a853a075f9489dafc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 16:47:30 +0900 Subject: [PATCH 246/442] Change conditional ordering to allow player to always run its fadeOut sequence. --- osu.Game/Screens/Play/Player.cs | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 7cee080f61..d0f2e2be5a 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -315,24 +315,23 @@ namespace osu.Game.Screens.Play protected override void OnSuspending(Screen next) { fadeOut(); - base.OnSuspending(next); } protected override bool OnExiting(Screen next) { - if (HasFailed || !ValidForResume) - return false; - - if (pauseOverlay != null && !HitRenderer.HasReplayLoaded) + if (!HasFailed && ValidForResume) { - //pause screen override logic. - if (pauseOverlay?.State == Visibility.Hidden && !canPause) return true; - - if (!IsPaused) // For if the user presses escape quickly when entering the map + if (pauseOverlay != null && !HitRenderer.HasReplayLoaded) { - Pause(); - return true; + //pause screen override logic. + if (pauseOverlay?.State == Visibility.Hidden && !canPause) return true; + + if (!IsPaused) // For if the user presses escape quickly when entering the map + { + Pause(); + return true; + } } } From edd71c0560607df2a8536399a6e80960e9a6e85c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 16:56:01 +0900 Subject: [PATCH 247/442] Tidy up and comment PlayerLoader logic. --- osu.Game/Screens/Play/Player.cs | 4 ++-- osu.Game/Screens/Play/PlayerLoader.cs | 29 +++++++++++++-------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index d0f2e2be5a..f831387626 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -35,7 +35,7 @@ namespace osu.Game.Screens.Play public BeatmapInfo BeatmapInfo; - public Action OnRestart; + public Action RestartRequested; public bool IsPaused => !interpolatedSourceClock.IsRunning; @@ -249,7 +249,7 @@ namespace osu.Game.Screens.Play public void Restart() { ValidForResume = false; - OnRestart?.Invoke(); + RestartRequested?.Invoke(); Exit(); } diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 2f74cd854f..642826753c 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -31,11 +31,16 @@ namespace osu.Game.Screens.Play public PlayerLoader(Player player) { + this.player = player; + + //By default, we want to load the player and never be returned to. + //Note that this may change if the player we load requested a re-run. ValidForResume = false; - player.OnRestart = restart; - - this.player = player; + player.RestartRequested = () => { + showOverlays = false; + ValidForResume = true; + }; Children = new Drawable[] { @@ -45,7 +50,6 @@ namespace osu.Game.Screens.Play Interactive = false, }, }; - } [BackgroundDependencyLoader] @@ -64,13 +68,14 @@ namespace osu.Game.Screens.Play protected override void OnResuming(Screen last) { base.OnResuming(last); - if (last != player) return; - player = new Player + + //we will only be resumed if the player has requested a re-run (see ValidForResume setting above) + LoadComponentAsync(player = new Player { RestartCount = player.RestartCount + 1, - OnRestart = restart - }; - LoadComponentAsync(player, delegate + RestartRequested = player.RestartRequested, + Beatmap = player.Beatmap, + }, p => { if (!Push(player)) Exit(); @@ -78,12 +83,6 @@ namespace osu.Game.Screens.Play }); } - private void restart() - { - showOverlays = false; - ValidForResume = true; - } - protected override void OnEntering(Screen last) { base.OnEntering(last); From ddff26d1675564eb16b16aadbc5f773fad8b5e84 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 17:00:58 +0900 Subject: [PATCH 248/442] Show metadata when loading between retries. Also speeds up the display a bit. --- osu.Game/Screens/Play/PlayerLoader.cs | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 642826753c..55236bace2 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -69,6 +69,8 @@ namespace osu.Game.Screens.Play { base.OnResuming(last); + contentIn(); + //we will only be resumed if the player has requested a re-run (see ValidForResume setting above) LoadComponentAsync(player = new Player { @@ -77,12 +79,26 @@ namespace osu.Game.Screens.Play Beatmap = player.Beatmap, }, p => { + contentOut(); + if (!Push(player)) Exit(); ValidForResume = false; }); } + private void contentIn() + { + Content.ScaleTo(1, 750, EasingTypes.OutQuint); + Content.FadeInFromZero(500); + } + + private void contentOut() + { + Content.ScaleTo(0.7f, 300, EasingTypes.InQuint); + Content.FadeOut(250); + } + protected override void OnEntering(Screen last) { base.OnEntering(last); @@ -90,20 +106,19 @@ namespace osu.Game.Screens.Play Background.FadeTo(0.4f, 250); Content.ScaleTo(0.7f); - Content.ScaleTo(1, 750, EasingTypes.OutQuint); - Content.FadeInFromZero(500); - Delay(1000, true); + contentIn(); + + Delay(500, true); logo.MoveToOffset(new Vector2(0, -180), 500, EasingTypes.InOutExpo); Delay(250, true); info.FadeIn(500); - Delay(2000, true); + Delay(1400, true); - Content.ScaleTo(0.7f, 300, EasingTypes.InQuint); - Content.FadeOut(250); + contentOut(); Delay(250); From 5ba85818dbe7820d778cf39b98eed35679ca477f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 17:07:02 +0900 Subject: [PATCH 249/442] Combine push logic and adjust transitions a bit more. --- osu.Game/Screens/Play/PlayerLoader.cs | 33 ++++++++++++++++----------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 55236bace2..615b138ead 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -33,10 +33,6 @@ namespace osu.Game.Screens.Play { this.player = player; - //By default, we want to load the player and never be returned to. - //Note that this may change if the player we load requested a re-run. - ValidForResume = false; - player.RestartRequested = () => { showOverlays = false; ValidForResume = true; @@ -77,20 +73,17 @@ namespace osu.Game.Screens.Play RestartCount = player.RestartCount + 1, RestartRequested = player.RestartRequested, Beatmap = player.Beatmap, - }, p => - { - contentOut(); - - if (!Push(player)) - Exit(); - ValidForResume = false; }); + + Delay(400); + + Schedule(pushWhenLoaded); } private void contentIn() { - Content.ScaleTo(1, 750, EasingTypes.OutQuint); - Content.FadeInFromZero(500); + Content.ScaleTo(1, 650, EasingTypes.OutQuint); + Content.FadeInFromZero(400); } private void contentOut() @@ -118,6 +111,14 @@ namespace osu.Game.Screens.Play Delay(1400, true); + Schedule(pushWhenLoaded); + } + + private void pushWhenLoaded() + { + if (!player.IsLoaded) + Schedule(pushWhenLoaded); + contentOut(); Delay(250); @@ -128,6 +129,12 @@ namespace osu.Game.Screens.Play if (!Push(player)) Exit(); + else + { + //By default, we want to load the player and never be returned to. + //Note that this may change if the player we load requested a re-run. + ValidForResume = false; + } }); } From 4895a482b4231f76eca622eae8ef7a1a0ccb185a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 17:26:59 +0900 Subject: [PATCH 250/442] That's a lot of white spaces --- osu.Game.Rulesets.Taiko/UI/TaikoHitRenderer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoHitRenderer.cs b/osu.Game.Rulesets.Taiko/UI/TaikoHitRenderer.cs index f4336717d9..baa54ca71b 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoHitRenderer.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoHitRenderer.cs @@ -52,7 +52,7 @@ namespace osu.Game.Rulesets.Taiko.UI int currentBeat = 0; double time = timingPoints[currentTimingPoint].Time; while (time <= lastHitTime) - { + { int nextTimingPoint = currentTimingPoint + 1; if (nextTimingPoint < timingPoints.Count && time > timingPoints[nextTimingPoint].Time) { From d4e75ecec41146d0e5f7271d82ba360b9c52a803 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 18 Apr 2017 17:37:01 +0900 Subject: [PATCH 251/442] Rename to use -index. --- osu.Game.Rulesets.Taiko/UI/TaikoHitRenderer.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoHitRenderer.cs b/osu.Game.Rulesets.Taiko/UI/TaikoHitRenderer.cs index baa54ca71b..db15193ce5 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoHitRenderer.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoHitRenderer.cs @@ -48,20 +48,20 @@ namespace osu.Game.Rulesets.Taiko.UI if (timingPoints.Count == 0) return; - int currentTimingPoint = 0; + int currentIndex = 0; int currentBeat = 0; - double time = timingPoints[currentTimingPoint].Time; + double time = timingPoints[currentIndex].Time; while (time <= lastHitTime) { - int nextTimingPoint = currentTimingPoint + 1; - if (nextTimingPoint < timingPoints.Count && time > timingPoints[nextTimingPoint].Time) + int nextIndex = currentIndex + 1; + if (nextIndex < timingPoints.Count && time > timingPoints[nextIndex].Time) { - currentTimingPoint = nextTimingPoint; - time = timingPoints[currentTimingPoint].Time; + currentIndex = nextIndex; + time = timingPoints[currentIndex].Time; currentBeat = 0; } - var currentPoint = timingPoints[currentTimingPoint]; + var currentPoint = timingPoints[currentIndex]; var barLine = new BarLine { From 784ca2300b667806d2b9103941545be02fd4454b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 18:09:37 +0900 Subject: [PATCH 252/442] Add safety check for when no objects have been assigned. --- osu.Game/Screens/Play/SongProgress.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 19212ec2f4..33acc998d6 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -132,6 +132,9 @@ namespace osu.Game.Screens.Play { base.Update(); + if (objects == null) + return; + double progress = (AudioClock?.CurrentTime ?? Time.Current) / lastHitTime; bar.UpdatePosition((float)progress); From 66865c50ad00163b4cfd0fdbd417306c04bbb526 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 18:10:01 +0900 Subject: [PATCH 253/442] Remove explicit RelativeSize setting. --- osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs | 1 + osu.Game/Rulesets/UI/StandardHudOverlay.cs | 2 +- osu.Game/Screens/Play/SongProgress.cs | 3 +-- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs index a75d70acaf..68391d9236 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs @@ -23,6 +23,7 @@ namespace osu.Desktop.VisualTests.Tests Add(progress = new SongProgress { + RelativeSizeAxes = Axes.X, AudioClock = new StopwatchClock(true), Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, diff --git a/osu.Game/Rulesets/UI/StandardHudOverlay.cs b/osu.Game/Rulesets/UI/StandardHudOverlay.cs index 2e2cb739f5..8c29b1ab3b 100644 --- a/osu.Game/Rulesets/UI/StandardHudOverlay.cs +++ b/osu.Game/Rulesets/UI/StandardHudOverlay.cs @@ -57,7 +57,7 @@ namespace osu.Game.Rulesets.UI Position = new Vector2(0, 30), }; - protected override SongProgress CreateProgress() => new SongProgress() + protected override SongProgress CreateProgress() => new SongProgress { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 33acc998d6..bd29065560 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -4,7 +4,6 @@ using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Primitives; using System; using System.Collections.Generic; using osu.Game.Graphics; @@ -13,6 +12,7 @@ using System.Linq; using osu.Framework.Timing; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; +using osu.Framework.Graphics.Primitives; namespace osu.Game.Screens.Play { @@ -71,7 +71,6 @@ namespace osu.Game.Screens.Play public SongProgress() { - RelativeSizeAxes = Axes.X; Height = progress_height + SongProgressGraph.Column.HEIGHT + handle_size.Y; Y = progress_height; From 417a5ca7131e4d666756774f719e3894cd0ef3d5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 18:29:24 +0900 Subject: [PATCH 254/442] A bit of renaming. --- osu.Game/Screens/Play/SongProgress.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index bd29065560..dd6ba67b2e 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -18,7 +18,7 @@ namespace osu.Game.Screens.Play { public class SongProgress : OverlayContainer { - private const int progress_height = 5; + private const int bottom_bar_height = 5; protected override bool HideOnEscape => false; @@ -71,8 +71,8 @@ namespace osu.Game.Screens.Play public SongProgress() { - Height = progress_height + SongProgressGraph.Column.HEIGHT + handle_size.Y; - Y = progress_height; + Height = bottom_bar_height + SongProgressGraph.Column.HEIGHT + handle_size.Y; + Y = bottom_bar_height; Children = new Drawable[] { @@ -82,9 +82,9 @@ namespace osu.Game.Screens.Play Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, Height = SongProgressGraph.Column.HEIGHT, - Margin = new MarginPadding { Bottom = progress_height }, + Margin = new MarginPadding { Bottom = bottom_bar_height }, }, - bar = new SongProgressBar(progress_height, SongProgressGraph.Column.HEIGHT, handle_size) + bar = new SongProgressBar(bottom_bar_height, SongProgressGraph.Column.HEIGHT, handle_size) { Alpha = 0, Anchor = Anchor.BottomLeft, @@ -113,7 +113,7 @@ namespace osu.Game.Screens.Play private void updateBarVisibility() { bar.FadeTo(barVisible ? 1 : 0, transition_duration, EasingTypes.In); - MoveTo(new Vector2(0, barVisible ? 0 : progress_height), transition_duration, EasingTypes.In); + MoveTo(new Vector2(0, barVisible ? 0 : bottom_bar_height), transition_duration, EasingTypes.In); } protected override void PopIn() From 3b21340e1b9fa21caf319272d373d9d117bbf64a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 18:40:02 +0900 Subject: [PATCH 255/442] Split SquareGraph out and make SongProgressGraph also able to take a list of Objects. --- .../Tests/TestCaseSongProgress.cs | 10 + osu.Game/Screens/Play/SongProgress.cs | 27 +- osu.Game/Screens/Play/SongProgressGraph.cs | 226 ++--------------- osu.Game/Screens/Play/SquareGraph.cs | 235 ++++++++++++++++++ osu.Game/osu.Game.csproj | 1 + 5 files changed, 267 insertions(+), 232 deletions(-) create mode 100644 osu.Game/Screens/Play/SquareGraph.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs index 68391d9236..7c40d21512 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs @@ -16,6 +16,7 @@ namespace osu.Desktop.VisualTests.Tests public override string Description => @"With fake data"; private SongProgress progress; + private SongProgressGraph graph; public override void Reset() { @@ -29,6 +30,14 @@ namespace osu.Desktop.VisualTests.Tests Origin = Anchor.BottomLeft, }); + Add(graph = new SongProgressGraph + { + RelativeSizeAxes = Axes.X, + Height = 200, + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + }); + AddStep("Toggle Bar", progress.ToggleBar); AddWaitStep(5); AddStep("Toggle Bar", progress.ToggleBar); @@ -45,6 +54,7 @@ namespace osu.Desktop.VisualTests.Tests objects.Add(new HitObject { StartTime = i }); progress.Objects = objects; + graph.Objects = objects; } } } diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index dd6ba67b2e..48f2ca14c0 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -41,25 +41,7 @@ namespace osu.Game.Screens.Play { set { - objects = value; - - const int granularity = 200; - - var interval = lastHitTime / granularity; - - var values = new int[granularity]; - - foreach (var h in objects) - { - IHasEndTime end = h as IHasEndTime; - - int startRange = (int)(h.StartTime / interval); - int endRange = (int)((end?.EndTime ?? h.StartTime) / interval); - for (int i = startRange; i <= endRange; i++) - values[i]++; - } - - graph.Values = values; + graph.Objects = objects = value; } } @@ -71,7 +53,7 @@ namespace osu.Game.Screens.Play public SongProgress() { - Height = bottom_bar_height + SongProgressGraph.Column.HEIGHT + handle_size.Y; + Height = bottom_bar_height + SquareGraph.Column.HEIGHT + handle_size.Y; Y = bottom_bar_height; Children = new Drawable[] @@ -81,10 +63,10 @@ namespace osu.Game.Screens.Play RelativeSizeAxes = Axes.X, Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, - Height = SongProgressGraph.Column.HEIGHT, + Height = SquareGraph.Column.HEIGHT, Margin = new MarginPadding { Bottom = bottom_bar_height }, }, - bar = new SongProgressBar(bottom_bar_height, SongProgressGraph.Column.HEIGHT, handle_size) + bar = new SongProgressBar(bottom_bar_height, SquareGraph.Column.HEIGHT, handle_size) { Alpha = 0, Anchor = Anchor.BottomLeft, @@ -138,7 +120,6 @@ namespace osu.Game.Screens.Play bar.UpdatePosition((float)progress); graph.Progress = (int)(graph.ColumnCount * progress); - } } } diff --git a/osu.Game/Screens/Play/SongProgressGraph.cs b/osu.Game/Screens/Play/SongProgressGraph.cs index 4f0cdbf67a..97f25e0a95 100644 --- a/osu.Game/Screens/Play/SongProgressGraph.cs +++ b/osu.Game/Screens/Play/SongProgressGraph.cs @@ -1,235 +1,43 @@ // 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 System.Linq; using System.Collections.Generic; -using osu.Framework; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Containers; -using osu.Framework.Extensions.Color4Extensions; +using osu.Game.Rulesets.Objects.Types; +using osu.Game.Rulesets.Objects; namespace osu.Game.Screens.Play { - public class SongProgressGraph : BufferedContainer + public class SongProgressGraph : SquareGraph { - private Column[] columns = { }; + private IEnumerable objects; - public int ColumnCount => columns.Length; - - public override bool HandleInput => false; - - private int progress; - public int Progress + public IEnumerable Objects { - get { return progress; } set { - if (value == progress) return; - progress = value; + objects = value; - redrawProgress(); - } - } + const int granularity = 200; - private int[] calculatedValues = { }; // values but adjusted to fit the amount of columns - private int[] values; - public int[] Values - { - get { return values; } - set - { - if (value == values) return; - values = value; - recreateGraph(); - } - } + var lastHit = ((objects.Last() as IHasEndTime)?.EndTime ?? objects.Last().StartTime) + 1; - private Color4 fillColour; - public Color4 FillColour - { - get { return fillColour; } - set - { - if (value == fillColour) return; - fillColour = value; + var interval = lastHit / granularity; - redrawFilled(); - } - } + var values = new int[granularity]; - public SongProgressGraph() - { - CacheDrawnFrameBuffer = true; - PixelSnapping = true; - } - - private float lastDrawWidth; - protected override void Update() - { - base.Update(); - - // todo: Recreating in update is probably not the best idea - if (DrawWidth == lastDrawWidth) return; - recreateGraph(); - lastDrawWidth = DrawWidth; - } - - /// - /// Redraws all the columns to match their lit/dimmed state. - /// - private void redrawProgress() - { - for (int i = 0; i < columns.Length; i++) - { - columns[i].State = i <= progress ? ColumnState.Lit : ColumnState.Dimmed; - } - - ForceRedraw(); - } - - /// - /// Redraws the filled amount of all the columns. - /// - private void redrawFilled() - { - for (int i = 0; i < ColumnCount; i++) - { - columns[i].Filled = calculatedValues.ElementAtOrDefault(i); - } - } - - /// - /// Takes and adjusts it to fit the amount of columns. - /// - private void recalculateValues() - { - var newValues = new List(); - - if (values == null) - { - for (float i = 0; i < ColumnCount; i++) - newValues.Add(0); - - return; - } - - float step = values.Length / (float)ColumnCount; - for (float i = 0; i < values.Length; i += step) - { - newValues.Add(values[(int)i]); - } - - calculatedValues = newValues.ToArray(); - } - - /// - /// Recreates the entire graph. - /// - private void recreateGraph() - { - var newColumns = new List(); - - for (float x = 0; x < DrawWidth; x += Column.WIDTH) - { - newColumns.Add(new Column(fillColour) + foreach (var h in objects) { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Position = new Vector2(x, 0), - State = ColumnState.Dimmed, - }); - } + IHasEndTime end = h as IHasEndTime; - columns = newColumns.ToArray(); - Children = columns; - - recalculateValues(); - redrawFilled(); - redrawProgress(); - } - - public class Column : Container, IStateful - { - private readonly Color4 emptyColour = Color4.White.Opacity(100); - private readonly Color4 litColour; - private readonly Color4 dimmedColour = Color4.White.Opacity(175); - - private const float cube_count = 6; - private const float cube_size = 4; - private const float padding = 2; - public const float WIDTH = cube_size + padding; - public const float HEIGHT = cube_count * WIDTH + padding; - - private readonly List drawableRows = new List(); - - private int filled; - public int Filled - { - get { return filled; } - set - { - if (value == filled) return; - filled = value; - - fillActive(); - } - } - - private ColumnState state; - public ColumnState State - { - get { return state; } - set - { - if (value == state) return; - state = value; - - fillActive(); - } - } - - public Column(Color4 litColour) - { - Size = new Vector2(WIDTH, HEIGHT); - this.litColour = litColour; - - for (int r = 0; r < cube_count; r++) - { - drawableRows.Add(new Box - { - EdgeSmoothness = new Vector2(padding / 4), - Size = new Vector2(cube_size), - Position = new Vector2(0, r * WIDTH + padding), - }); + int startRange = (int)(h.StartTime / interval); + int endRange = (int)((end?.EndTime ?? h.StartTime) / interval); + for (int i = startRange; i <= endRange; i++) + values[i]++; } - Children = drawableRows; - - // Reverse drawableRows so when iterating through them they start at the bottom - drawableRows.Reverse(); + Values = values; } - - private void fillActive() - { - Color4 colour = State == ColumnState.Lit ? litColour : dimmedColour; - - for (int i = 0; i < drawableRows.Count; i++) - { - if (Filled == 0) // i <= Filled doesn't work for zero fill - drawableRows[i].Colour = emptyColour; - else - drawableRows[i].Colour = i <= Filled ? colour : emptyColour; - } - } - } - - public enum ColumnState - { - Lit, - Dimmed } } } diff --git a/osu.Game/Screens/Play/SquareGraph.cs b/osu.Game/Screens/Play/SquareGraph.cs new file mode 100644 index 0000000000..9afb1e063a --- /dev/null +++ b/osu.Game/Screens/Play/SquareGraph.cs @@ -0,0 +1,235 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using System.Linq; +using osu.Framework; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using OpenTK; +using OpenTK.Graphics; + +namespace osu.Game.Screens.Play +{ + public class SquareGraph : BufferedContainer + { + private Column[] columns = { }; + + public int ColumnCount => columns.Length; + + public override bool HandleInput => false; + + private int progress; + public int Progress + { + get { return progress; } + set + { + if (value == progress) return; + progress = value; + + redrawProgress(); + } + } + + private int[] calculatedValues = { }; // values but adjusted to fit the amount of columns + private int[] values; + public int[] Values + { + get { return values; } + set + { + if (value == values) return; + values = value; + recreateGraph(); + } + } + + private Color4 fillColour; + public Color4 FillColour + { + get { return fillColour; } + set + { + if (value == fillColour) return; + fillColour = value; + + redrawFilled(); + } + } + + public SquareGraph() + { + CacheDrawnFrameBuffer = true; + PixelSnapping = true; + } + + private float lastDrawWidth; + protected override void Update() + { + base.Update(); + + // todo: Recreating in update is probably not the best idea + if (DrawWidth == lastDrawWidth) return; + recreateGraph(); + lastDrawWidth = DrawWidth; + } + + /// + /// Redraws all the columns to match their lit/dimmed state. + /// + private void redrawProgress() + { + for (int i = 0; i < columns.Length; i++) + { + columns[i].State = i <= progress ? ColumnState.Lit : ColumnState.Dimmed; + } + + ForceRedraw(); + } + + /// + /// Redraws the filled amount of all the columns. + /// + private void redrawFilled() + { + for (int i = 0; i < ColumnCount; i++) + { + columns[i].Filled = calculatedValues.ElementAtOrDefault(i); + } + } + + /// + /// Takes and adjusts it to fit the amount of columns. + /// + private void recalculateValues() + { + var newValues = new List(); + + if (values == null) + { + for (float i = 0; i < ColumnCount; i++) + newValues.Add(0); + + return; + } + + float step = values.Length / (float)ColumnCount; + for (float i = 0; i < values.Length; i += step) + { + newValues.Add(values[(int)i]); + } + + calculatedValues = newValues.ToArray(); + } + + /// + /// Recreates the entire graph. + /// + private void recreateGraph() + { + var newColumns = new List(); + + for (float x = 0; x < DrawWidth; x += Column.WIDTH) + { + newColumns.Add(new Column(fillColour) + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Position = new Vector2(x, 0), + State = ColumnState.Dimmed, + }); + } + + columns = newColumns.ToArray(); + Children = columns; + + recalculateValues(); + redrawFilled(); + redrawProgress(); + } + + public class Column : Container, IStateful + { + private readonly Color4 emptyColour = Color4.White.Opacity(100); + private readonly Color4 litColour; + private readonly Color4 dimmedColour = Color4.White.Opacity(175); + + private const float cube_count = 6; + private const float cube_size = 4; + private const float padding = 2; + public const float WIDTH = cube_size + padding; + public const float HEIGHT = cube_count * WIDTH + padding; + + private readonly List drawableRows = new List(); + + private int filled; + public int Filled + { + get { return filled; } + set + { + if (value == filled) return; + filled = value; + + fillActive(); + } + } + + private ColumnState state; + public ColumnState State + { + get { return state; } + set + { + if (value == state) return; + state = value; + + fillActive(); + } + } + + public Column(Color4 litColour) + { + Size = new Vector2(WIDTH, HEIGHT); + this.litColour = litColour; + + for (int r = 0; r < cube_count; r++) + { + drawableRows.Add(new Box + { + EdgeSmoothness = new Vector2(padding / 4), + Size = new Vector2(cube_size), + Position = new Vector2(0, r * WIDTH + padding), + }); + } + + Children = drawableRows; + + // Reverse drawableRows so when iterating through them they start at the bottom + drawableRows.Reverse(); + } + + private void fillActive() + { + Color4 colour = State == ColumnState.Lit ? litColour : dimmedColour; + + for (int i = 0; i < drawableRows.Count; i++) + { + if (Filled == 0) // i <= Filled doesn't work for zero fill + drawableRows[i].Colour = emptyColour; + else + drawableRows[i].Colour = i <= Filled ? colour : emptyColour; + } + } + } + + public enum ColumnState + { + Lit, + Dimmed + } + } +} \ No newline at end of file diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 5096323540..8421f89058 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -201,6 +201,7 @@ + From 1071645dca4ada0ee73456e73f3a906feaff5bb7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 19:22:45 +0900 Subject: [PATCH 256/442] Flexible cube count (and thus graph height). This also scaled the graph to the height of the maximum value. And much tidying. --- osu.Game/Screens/Play/SongProgress.cs | 8 ++-- osu.Game/Screens/Play/SquareGraph.cs | 54 ++++++++++++++++----------- 2 files changed, 37 insertions(+), 25 deletions(-) diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 48f2ca14c0..6ad76ae361 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -53,7 +53,9 @@ namespace osu.Game.Screens.Play public SongProgress() { - Height = bottom_bar_height + SquareGraph.Column.HEIGHT + handle_size.Y; + const float graph_height = SquareGraph.Column.WIDTH * 6; + + Height = bottom_bar_height + graph_height + handle_size.Y; Y = bottom_bar_height; Children = new Drawable[] @@ -63,10 +65,10 @@ namespace osu.Game.Screens.Play RelativeSizeAxes = Axes.X, Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, - Height = SquareGraph.Column.HEIGHT, + Height = graph_height, Margin = new MarginPadding { Bottom = bottom_bar_height }, }, - bar = new SongProgressBar(bottom_bar_height, SquareGraph.Column.HEIGHT, handle_size) + bar = new SongProgressBar(bottom_bar_height, graph_height, handle_size) { Alpha = 0, Anchor = Anchor.BottomLeft, diff --git a/osu.Game/Screens/Play/SquareGraph.cs b/osu.Game/Screens/Play/SquareGraph.cs index 9afb1e063a..747ade673b 100644 --- a/osu.Game/Screens/Play/SquareGraph.cs +++ b/osu.Game/Screens/Play/SquareGraph.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using osu.Framework; +using osu.Framework.Caching; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -34,7 +35,8 @@ namespace osu.Game.Screens.Play } } - private int[] calculatedValues = { }; // values but adjusted to fit the amount of columns + private float[] calculatedValues = { }; // values but adjusted to fit the amount of columns + private int[] values; public int[] Values { @@ -66,15 +68,19 @@ namespace osu.Game.Screens.Play PixelSnapping = true; } - private float lastDrawWidth; + private Cached layout = new Cached(); + + public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true) + { + if ((invalidation & Invalidation.SizeInParentSpace) > 0) + layout.Invalidate(); + return base.Invalidate(invalidation, source, shallPropagate); + } + protected override void Update() { base.Update(); - - // todo: Recreating in update is probably not the best idea - if (DrawWidth == lastDrawWidth) return; - recreateGraph(); - lastDrawWidth = DrawWidth; + layout.Refresh(recreateGraph); } /// @@ -106,7 +112,7 @@ namespace osu.Game.Screens.Play /// private void recalculateValues() { - var newValues = new List(); + var newValues = new List(); if (values == null) { @@ -116,10 +122,12 @@ namespace osu.Game.Screens.Play return; } + var max = values.Max(); + float step = values.Length / (float)ColumnCount; for (float i = 0; i < values.Length; i += step) { - newValues.Add(values[(int)i]); + newValues.Add((float)values[(int)i] / max); } calculatedValues = newValues.ToArray(); @@ -138,6 +146,7 @@ namespace osu.Game.Screens.Play { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, + Height = DrawHeight, Position = new Vector2(x, 0), State = ColumnState.Dimmed, }); @@ -157,16 +166,15 @@ namespace osu.Game.Screens.Play private readonly Color4 litColour; private readonly Color4 dimmedColour = Color4.White.Opacity(175); - private const float cube_count = 6; + private float cubeCount => DrawHeight / WIDTH; private const float cube_size = 4; private const float padding = 2; public const float WIDTH = cube_size + padding; - public const float HEIGHT = cube_count * WIDTH + padding; private readonly List drawableRows = new List(); - private int filled; - public int Filled + private float filled; + public float Filled { get { return filled; } set @@ -193,10 +201,13 @@ namespace osu.Game.Screens.Play public Column(Color4 litColour) { - Size = new Vector2(WIDTH, HEIGHT); + Width = WIDTH; this.litColour = litColour; + } - for (int r = 0; r < cube_count; r++) + protected override void LoadComplete() + { + for (int r = 0; r < cubeCount; r++) { drawableRows.Add(new Box { @@ -210,19 +221,18 @@ namespace osu.Game.Screens.Play // Reverse drawableRows so when iterating through them they start at the bottom drawableRows.Reverse(); + + fillActive(); } private void fillActive() { Color4 colour = State == ColumnState.Lit ? litColour : dimmedColour; + int countFilled = (int)MathHelper.Clamp(filled * drawableRows.Count, 0, drawableRows.Count); + for (int i = 0; i < drawableRows.Count; i++) - { - if (Filled == 0) // i <= Filled doesn't work for zero fill - drawableRows[i].Colour = emptyColour; - else - drawableRows[i].Colour = i <= Filled ? colour : emptyColour; - } + drawableRows[i].Colour = i < countFilled ? colour : emptyColour; } } @@ -232,4 +242,4 @@ namespace osu.Game.Screens.Play Dimmed } } -} \ No newline at end of file +} From b0f1851e887649b2b808ad0243da43dd4e31c57c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 20:23:03 +0900 Subject: [PATCH 257/442] Adjust visuals slightly. --- osu.Game/Screens/Play/SquareGraph.cs | 31 +++++++++++----------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/osu.Game/Screens/Play/SquareGraph.cs b/osu.Game/Screens/Play/SquareGraph.cs index 747ade673b..43a8253b53 100644 --- a/osu.Game/Screens/Play/SquareGraph.cs +++ b/osu.Game/Screens/Play/SquareGraph.cs @@ -30,7 +30,6 @@ namespace osu.Game.Screens.Play { if (value == progress) return; progress = value; - redrawProgress(); } } @@ -45,7 +44,7 @@ namespace osu.Game.Screens.Play { if (value == values) return; values = value; - recreateGraph(); + layout.Invalidate(); } } @@ -57,7 +56,6 @@ namespace osu.Game.Screens.Play { if (value == fillColour) return; fillColour = value; - redrawFilled(); } } @@ -65,7 +63,6 @@ namespace osu.Game.Screens.Play public SquareGraph() { CacheDrawnFrameBuffer = true; - PixelSnapping = true; } private Cached layout = new Cached(); @@ -89,10 +86,7 @@ namespace osu.Game.Screens.Play private void redrawProgress() { for (int i = 0; i < columns.Length; i++) - { columns[i].State = i <= progress ? ColumnState.Lit : ColumnState.Dimmed; - } - ForceRedraw(); } @@ -102,9 +96,8 @@ namespace osu.Game.Screens.Play private void redrawFilled() { for (int i = 0; i < ColumnCount; i++) - { columns[i].Filled = calculatedValues.ElementAtOrDefault(i); - } + ForceRedraw(); } /// @@ -142,8 +135,9 @@ namespace osu.Game.Screens.Play for (float x = 0; x < DrawWidth; x += Column.WIDTH) { - newColumns.Add(new Column(fillColour) + newColumns.Add(new Column { + LitColour = fillColour, Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Height = DrawHeight, @@ -162,9 +156,9 @@ namespace osu.Game.Screens.Play public class Column : Container, IStateful { - private readonly Color4 emptyColour = Color4.White.Opacity(100); - private readonly Color4 litColour; - private readonly Color4 dimmedColour = Color4.White.Opacity(175); + protected readonly Color4 EmptyColour = Color4.White.Opacity(20); + public Color4 LitColour = Color4.LightBlue; + protected readonly Color4 DimmedColour = Color4.White.Opacity(140); private float cubeCount => DrawHeight / WIDTH; private const float cube_size = 4; @@ -195,14 +189,14 @@ namespace osu.Game.Screens.Play if (value == state) return; state = value; - fillActive(); + if (IsLoaded) + fillActive(); } } - public Column(Color4 litColour) + public Column() { Width = WIDTH; - this.litColour = litColour; } protected override void LoadComplete() @@ -211,7 +205,6 @@ namespace osu.Game.Screens.Play { drawableRows.Add(new Box { - EdgeSmoothness = new Vector2(padding / 4), Size = new Vector2(cube_size), Position = new Vector2(0, r * WIDTH + padding), }); @@ -227,12 +220,12 @@ namespace osu.Game.Screens.Play private void fillActive() { - Color4 colour = State == ColumnState.Lit ? litColour : dimmedColour; + Color4 colour = State == ColumnState.Lit ? LitColour : DimmedColour; int countFilled = (int)MathHelper.Clamp(filled * drawableRows.Count, 0, drawableRows.Count); for (int i = 0; i < drawableRows.Count; i++) - drawableRows[i].Colour = i < countFilled ? colour : emptyColour; + drawableRows[i].Colour = i < countFilled ? colour : EmptyColour; } } From 77dbbe6f342e0dcce5b2991773b5cf1b8752afce Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Apr 2017 14:00:21 +0900 Subject: [PATCH 258/442] Add a placeholder cover URL for users. --- osu.Game/Users/User.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index 6e1de7e3ac..e00d36ccb5 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -19,5 +19,7 @@ namespace osu.Game.Users [JsonProperty(@"colour")] public string Colour; + + public string CoverUrl = @"https://assets.ppy.sh/user-profile-covers/2/08cad88747c235a64fca5f1b770e100f120827ded1ffe3b66bfcd19c940afa65.jpeg"; } } From d51b37cb440c4165e9f10739ad2cee7b75f65654 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Apr 2017 14:01:13 +0900 Subject: [PATCH 259/442] Add a basic implementation of the new design results screen. --- .../Tests/TestCaseResults.cs | 55 +++++ .../osu.Desktop.VisualTests.csproj | 1 + osu.Game/Screens/Play/Player.cs | 7 +- osu.Game/Screens/Ranking/AspectContainer.cs | 17 ++ osu.Game/Screens/Ranking/ResultMode.cs | 9 + osu.Game/Screens/Ranking/ResultModeButton.cs | 105 +++++++++ .../Screens/Ranking/ResultModeTabControl.cs | 28 +++ osu.Game/Screens/Ranking/Results.cs | 219 ++++++++++++++---- osu.Game/Screens/Ranking/ResultsPage.cs | 89 +++++++ .../Screens/Ranking/ResultsRankingPage.cs | 45 ++++ osu.Game/Screens/Ranking/ResultsScorePage.cs | 132 +++++++++++ osu.Game/osu.Game.csproj | 7 + 12 files changed, 662 insertions(+), 52 deletions(-) create mode 100644 osu.Desktop.VisualTests/Tests/TestCaseResults.cs create mode 100644 osu.Game/Screens/Ranking/AspectContainer.cs create mode 100644 osu.Game/Screens/Ranking/ResultMode.cs create mode 100644 osu.Game/Screens/Ranking/ResultModeButton.cs create mode 100644 osu.Game/Screens/Ranking/ResultModeTabControl.cs create mode 100644 osu.Game/Screens/Ranking/ResultsPage.cs create mode 100644 osu.Game/Screens/Ranking/ResultsRankingPage.cs create mode 100644 osu.Game/Screens/Ranking/ResultsScorePage.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseResults.cs b/osu.Desktop.VisualTests/Tests/TestCaseResults.cs new file mode 100644 index 0000000000..18e678e38d --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseResults.cs @@ -0,0 +1,55 @@ +using System.Linq; +using osu.Framework.Allocation; +using osu.Framework.Testing; +using osu.Game.Beatmaps; +using osu.Game.Database; +using osu.Game.Modes; +using osu.Game.Modes.Scoring; +using osu.Game.Screens.Ranking; +using osu.Game.Users; + +namespace osu.Desktop.VisualTests.Tests +{ + internal class TestCaseResults : TestCase + { + private BeatmapDatabase db; + + public override string Description => @"Results after playing."; + + [BackgroundDependencyLoader] + private void load(BeatmapDatabase db) + { + this.db = db; + } + + private WorkingBeatmap beatmap; + + public override void Reset() + { + base.Reset(); + + if (beatmap == null) + { + var beatmapInfo = db.Query().FirstOrDefault(b => b.Mode == PlayMode.Osu); + if (beatmapInfo != null) + beatmap = db.GetWorkingBeatmap(beatmapInfo); + } + + base.Reset(); + + Add(new Results(new Score() + { + TotalScore = 2845370, + Accuracy = 0.98, + Rank = ScoreRank.A, + User = new User + { + Username = "peppy", + } + }) + { + Beatmap = beatmap + }); + } + } + } diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index 80b18c4a9b..10b0d4c491 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -198,6 +198,7 @@ + diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index f831387626..f1b1f7f2fe 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -17,11 +17,11 @@ using osu.Game.Database; using osu.Game.Rulesets; using osu.Game.Rulesets.UI; using osu.Game.Screens.Backgrounds; -using osu.Game.Screens.Ranking; using System; using System.Linq; using osu.Framework.Threading; using osu.Game.Rulesets.Scoring; +using osu.Game.Screens.Ranking; namespace osu.Game.Screens.Play { @@ -266,10 +266,7 @@ namespace osu.Game.Screens.Play Delay(1000); onCompletionEvent = Schedule(delegate { - Push(new Results - { - Score = scoreProcessor.CreateScore() - }); + Push(new Results(scoreProcessor.CreateScore())); }); } diff --git a/osu.Game/Screens/Ranking/AspectContainer.cs b/osu.Game/Screens/Ranking/AspectContainer.cs new file mode 100644 index 0000000000..42e20adeb9 --- /dev/null +++ b/osu.Game/Screens/Ranking/AspectContainer.cs @@ -0,0 +1,17 @@ +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; + +namespace osu.Game.Screens.Ranking +{ + public class AspectContainer : Container + { + protected override void Update() + { + base.Update(); + if (RelativeSizeAxes == Axes.X) + Height = DrawWidth; + else + Width = DrawHeight; + } + } +} \ No newline at end of file diff --git a/osu.Game/Screens/Ranking/ResultMode.cs b/osu.Game/Screens/Ranking/ResultMode.cs new file mode 100644 index 0000000000..b7f030f338 --- /dev/null +++ b/osu.Game/Screens/Ranking/ResultMode.cs @@ -0,0 +1,9 @@ +namespace osu.Game.Screens.Ranking +{ + public enum ResultMode + { + Summary, + Ranking, + Share + } +} \ No newline at end of file diff --git a/osu.Game/Screens/Ranking/ResultModeButton.cs b/osu.Game/Screens/Ranking/ResultModeButton.cs new file mode 100644 index 0000000000..5849cd4e14 --- /dev/null +++ b/osu.Game/Screens/Ranking/ResultModeButton.cs @@ -0,0 +1,105 @@ +using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.UserInterface; +using osu.Game.Graphics; +using OpenTK; +using OpenTK.Graphics; + +namespace osu.Game.Screens.Ranking +{ + public class ResultModeButton : TabItem + { + private readonly FontAwesome icon; + private Color4 activeColour; + private Color4 inactiveColour; + private CircularContainer colouredPart; + + public ResultModeButton(ResultMode mode) : base(mode) + { + switch (mode) + { + case ResultMode.Summary: + icon = FontAwesome.fa_asterisk; + break; + case ResultMode.Ranking: + icon = FontAwesome.fa_list; + break; + case ResultMode.Share: + icon = FontAwesome.fa_camera; + break; + } + } + + public override bool Active + { + get + { + return base.Active; + } + set + { + base.Active = value; + colouredPart.FadeColour(Active ? activeColour : inactiveColour, 200, EasingTypes.OutQuint); + } + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Size = new Vector2(50); + + Masking = true; + CornerRadius = 25; + + activeColour = colours.PinkDarker; + inactiveColour = OsuColour.Gray(0.8f); + + EdgeEffect = new EdgeEffect + { + Colour = Color4.Black.Opacity(0.4f), + Type = EdgeEffectType.Shadow, + Radius = 5, + }; + + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.White, + }, + colouredPart = new CircularContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Size = new Vector2(0.8f), + BorderThickness = 4, + BorderColour = Color4.White, + Colour = inactiveColour, + Children = new Drawable[] + { + new Box + { + AlwaysPresent = true, //for border rendering + RelativeSizeAxes = Axes.Both, + Colour = Color4.Transparent, + }, + new TextAwesome + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Shadow = false, + Colour = OsuColour.Gray(0.95f), + Icon = icon, + TextSize = 20, + } + } + } + }; + } + } +} diff --git a/osu.Game/Screens/Ranking/ResultModeTabControl.cs b/osu.Game/Screens/Ranking/ResultModeTabControl.cs new file mode 100644 index 0000000000..9335f1daef --- /dev/null +++ b/osu.Game/Screens/Ranking/ResultModeTabControl.cs @@ -0,0 +1,28 @@ +using osu.Framework.Graphics; +using osu.Framework.Graphics.Primitives; +using osu.Framework.Graphics.UserInterface; +using OpenTK; + +namespace osu.Game.Screens.Ranking +{ + public class ResultModeTabControl : TabControl + { + public ResultModeTabControl() + { + TabContainer.Anchor = Anchor.BottomCentre; + TabContainer.Origin = Anchor.BottomCentre; + TabContainer.Spacing = new Vector2(15); + + TabContainer.Masking = false; + TabContainer.Padding = new MarginPadding(5); + } + + protected override Dropdown CreateDropdown() => null; + + protected override TabItem CreateTabItem(ResultMode value) => new ResultModeButton(value) + { + Anchor = TabContainer.Anchor, + Origin = TabContainer.Origin + }; + } +} \ No newline at end of file diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index 3db070d33c..3c78efe30b 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -1,93 +1,218 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Screens; +using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Game.Graphics.Sprites; +using osu.Framework.Graphics.Primitives; using osu.Game.Rulesets.Scoring; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Screens; +using osu.Game.Graphics.Containers; using osu.Game.Screens.Backgrounds; using OpenTK; using OpenTK.Graphics; namespace osu.Game.Screens.Ranking { - internal class Results : OsuScreen + public class Results : OsuScreen { - protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap); + private readonly Score score; + private Container circleOuterBackground; + private Container circleOuter; + private Container circleInner; + + private ParallaxContainer backgroundParallax; + + private ResultModeTabControl modeChangeButtons; + + private Container currentPage; private static readonly Vector2 background_blur = new Vector2(20); - private ScoreDisplay scoreDisplay; + protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap); + + private const float overscan = 1.3f; + + private const float circle_outer_scale = 0.96f; + + public Results(Score score) + { + this.score = score; + } protected override void OnEntering(Screen last) { base.OnEntering(last); - Background.Schedule(() => (Background as BackgroundScreenBeatmap)?.BlurTo(background_blur, 1000)); - } + (Background as BackgroundScreenBeatmap)?.BlurTo(background_blur, 2500, EasingTypes.OutQuint); - protected override bool OnExiting(Screen next) - { - Background.Schedule(() => Background.FadeColour(Color4.White, 500)); - return base.OnExiting(next); - } + var allCircles = new[] { circleOuterBackground, circleInner, circleOuter }; - public Score Score - { - set + allCircles.ForEach(c => { - scoreDisplay?.FadeOut(500); - scoreDisplay?.Expire(); + c.FadeOut(); + c.ScaleTo(0); + }); - scoreDisplay = new ScoreDisplay(value) - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - }; + backgroundParallax.FadeOut(); + modeChangeButtons.FadeOut(); + currentPage.FadeOut(); - Add(scoreDisplay); + const float appear_time = 800; - scoreDisplay.FadeIn(500); - scoreDisplay.ScaleTo(0.1f); - scoreDisplay.ScaleTo(1, 1000, EasingTypes.OutElastic); - scoreDisplay.RotateTo(360 * 5, 1000, EasingTypes.OutElastic); + circleOuterBackground.ScaleTo(1, appear_time, EasingTypes.OutQuint); + circleOuterBackground.FadeTo(1, appear_time, EasingTypes.OutQuint); - } + Content.Delay(appear_time * 0.25f, true); + + circleOuter.ScaleTo(1, appear_time, EasingTypes.OutQuint); + circleOuter.FadeTo(1, appear_time, EasingTypes.OutQuint); + + Content.Delay(appear_time * 0.3f, true); + + backgroundParallax.FadeIn(appear_time, EasingTypes.OutQuint); + + circleInner.ScaleTo(1, appear_time, EasingTypes.OutQuint); + circleInner.FadeTo(1, appear_time, EasingTypes.OutQuint); + + Content.Delay(appear_time * 0.4f, true); + + modeChangeButtons.FadeIn(appear_time, EasingTypes.OutQuint); + currentPage.FadeIn(appear_time, EasingTypes.OutQuint); + + Content.DelayReset(); } - } - internal class ScoreDisplay : Container - { - public ScoreDisplay(Score s) + [BackgroundDependencyLoader] + private void load() { - AutoSizeAxes = Axes.Both; - Children = new Drawable[] { - new FillFlowContainer + new AspectContainer { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Vertical, + RelativeSizeAxes = Axes.Y, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Height = overscan, Children = new Drawable[] { - new OsuSpriteText + circleOuterBackground = new CircularContainer { - TextSize = 40, - Text = $@"Accuracy: {s.Accuracy:#0.00%}", + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Masking = true, + Children = new Drawable[] + { + new Box + { + Alpha = 0.2f, + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, + } + } }, - new OsuSpriteText + circleOuter = new CircularContainer { - TextSize = 40, - Text = $@"Score: {s.TotalScore}", + Size = new Vector2(circle_outer_scale), + EdgeEffect = new EdgeEffect + { + Colour = Color4.Black.Opacity(0.4f), + Type = EdgeEffectType.Shadow, + Radius = 15, + }, + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Masking = true, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.White, + }, + backgroundParallax = new ParallaxContainer + { + RelativeSizeAxes = Axes.Both, + ParallaxAmount = 0.01f, + Scale = new Vector2(1 / circle_outer_scale / overscan), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Children = new Drawable[] + { + new Sprite + { + Alpha = 0.5f, + Texture = Beatmap?.Background, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + FillMode = FillMode.Fill + } + } + }, + modeChangeButtons = new ResultModeTabControl + { + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + RelativeSizeAxes = Axes.X, + Height = 50, + Margin = new MarginPadding { Bottom = 110 }, + } + } }, - new OsuSpriteText + circleInner = new CircularContainer { - TextSize = 40, - Text = $@"MaxCombo: {s.MaxCombo}", + Size = new Vector2(0.6f), + EdgeEffect = new EdgeEffect + { + Colour = Color4.Black.Opacity(0.4f), + Type = EdgeEffectType.Shadow, + Radius = 15, + }, + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Masking = true, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.White, + }, + } } } } }; + + modeChangeButtons.AddItem(ResultMode.Summary); + modeChangeButtons.AddItem(ResultMode.Ranking); + modeChangeButtons.AddItem(ResultMode.Share); + + modeChangeButtons.Current.ValueChanged += mode => + { + currentPage?.FadeOut(); + currentPage?.Expire(); + + switch (mode) + { + case ResultMode.Summary: + currentPage = new ResultsScorePage(score); + break; + case ResultMode.Ranking: + currentPage = new ResultsRankingPage(score, Beatmap.BeatmapInfo); + break; + } + + if (currentPage != null) + circleInner.Add(currentPage); + }; + + modeChangeButtons.Current.TriggerChange(); } } -} +} \ No newline at end of file diff --git a/osu.Game/Screens/Ranking/ResultsPage.cs b/osu.Game/Screens/Ranking/ResultsPage.cs new file mode 100644 index 0000000000..514b1616ec --- /dev/null +++ b/osu.Game/Screens/Ranking/ResultsPage.cs @@ -0,0 +1,89 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; +using osu.Game.Modes.Scoring; +using OpenTK; +using OpenTK.Graphics; + +namespace osu.Game.Screens.Ranking +{ + internal class ResultsPage : Container + { + protected Score Score; + private CircularContainer content; + private Box fill; + + protected override Container Content => content; + + public ResultsPage(Score score) + { + Score = score; + RelativeSizeAxes = Axes.Both; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + fill.Delay(400); + fill.FadeInFromZero(600); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + AddInternal(new Drawable[] + { + fill = new Box + { + Alpha = 0, + RelativeSizeAxes = Axes.Both, + Colour = colours.Gray6 + }, + new CircularContainer + { + EdgeEffect = new EdgeEffect + { + Colour = Color4.Black.Opacity(1), + Type = EdgeEffectType.Shadow, + Radius = 15, + }, + RelativeSizeAxes = Axes.Both, + Masking = true, + BorderThickness = 20, + BorderColour = Color4.White, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Children = new Drawable[] + { + new Box{ + RelativeSizeAxes = Axes.Both, + Alpha = 0, + AlwaysPresent = true + }, + } + }, + content = new CircularContainer + { + EdgeEffect = new EdgeEffect + { + Colour = Color4.Black.Opacity(0.4f), + Type = EdgeEffectType.Shadow, + Radius = 15, + }, + RelativeSizeAxes = Axes.Both, + Masking = true, + Size = new Vector2(0.88f), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + } + }); + } + + } +} \ No newline at end of file diff --git a/osu.Game/Screens/Ranking/ResultsRankingPage.cs b/osu.Game/Screens/Ranking/ResultsRankingPage.cs new file mode 100644 index 0000000000..c7a36a6382 --- /dev/null +++ b/osu.Game/Screens/Ranking/ResultsRankingPage.cs @@ -0,0 +1,45 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Sprites; +using osu.Game.Database; +using osu.Game.Graphics; +using osu.Game.Modes.Scoring; +using osu.Game.Screens.Select.Leaderboards; +using OpenTK; + +namespace osu.Game.Screens.Ranking +{ + internal class ResultsRankingPage : ResultsPage + { + private readonly BeatmapInfo beatmap; + + public ResultsRankingPage(Score score, BeatmapInfo beatmap = null) : base(score) + { + this.beatmap = beatmap; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Children = new Drawable[] + { + new Box + { + Colour = colours.GrayE, + RelativeSizeAxes = Axes.Both, + }, + new Leaderboard + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Beatmap = beatmap ?? Score.Beatmap, + Scale = new Vector2(0.7f) + } + }; + } + } +} \ No newline at end of file diff --git a/osu.Game/Screens/Ranking/ResultsScorePage.cs b/osu.Game/Screens/Ranking/ResultsScorePage.cs new file mode 100644 index 0000000000..e8d6ac36bf --- /dev/null +++ b/osu.Game/Screens/Ranking/ResultsScorePage.cs @@ -0,0 +1,132 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Primitives; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; +using osu.Game.Modes.Scoring; +using osu.Game.Screens.Select.Leaderboards; +using osu.Game.Users; +using OpenTK; +using OpenTK.Graphics; + +namespace osu.Game.Screens.Ranking +{ + internal class ResultsScorePage : ResultsPage + { + private ScoreCounter scoreCounter; + + public ResultsScorePage(Score score) : base(score) { } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + const float user_header_height = 150; + + Children = new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Top = user_header_height }, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.White, + }, + } + }, + new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Children = new Drawable[] + { + new UserHeader(Score.User) + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + RelativeSizeAxes = Axes.X, + Height = user_header_height, + }, + new DrawableRank(Score.Rank) + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Size = new Vector2(150, 80), + }, + scoreCounter = new SlowScoreCounter(6) + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Colour = colours.PinkDarker, + TextSize = 60, + }, + } + } + }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + Schedule(() => scoreCounter.Increment(Score.TotalScore)); + } + + private class UserHeader : Container + { + private readonly User user; + private readonly Sprite cover; + + public UserHeader(User user) + { + this.user = user; + Children = new Drawable[] + { + cover = new Sprite + { + FillMode = FillMode.Fill, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + new OsuSpriteText + { + Font = @"Exo2.0-RegularItalic", + Text = user.Username, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + TextSize = 30, + Padding = new MarginPadding { Bottom = 10 }, + } + }; + } + + [BackgroundDependencyLoader] + private void load(TextureStore textures) + { + cover.Texture = textures.Get(user.CoverUrl); + } + } + + private class SlowScoreCounter : ScoreCounter + { + protected override double RollingDuration => 3000; + + protected override EasingTypes RollingEasing => EasingTypes.OutPow10; + + public SlowScoreCounter(uint leading = 0) : base(leading) + { + DisplayedCountSpriteText.Shadow = false; + } + } + } +} \ No newline at end of file diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 8421f89058..887c37e20a 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -202,6 +202,9 @@ + + + @@ -225,6 +228,10 @@ + + + + From 7d32cc85c8e97b1315241d098b48b32aa55401d0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Apr 2017 14:01:47 +0900 Subject: [PATCH 260/442] Make leaderboard scores clickable. --- osu.Game/Screens/Select/Leaderboards/Leaderboard.cs | 3 +++ osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs | 2 +- osu.Game/Screens/Select/PlaySongSelect.cs | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs index 2abf3c3175..2c51429d4c 100644 --- a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs @@ -23,6 +23,8 @@ namespace osu.Game.Screens.Select.Leaderboards private readonly ScrollContainer scrollContainer; private readonly FillFlowContainer scrollFlow; + public Action ScoreSelected; + private IEnumerable scores; public IEnumerable Scores { @@ -52,6 +54,7 @@ namespace osu.Game.Screens.Select.Leaderboards var ls = new LeaderboardScore(s, 1 + i) { AlwaysPresent = true, + Action = () => ScoreSelected?.Invoke(s), State = Visibility.Hidden, }; scrollFlow.Add(ls); diff --git a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs index 321067d18e..b574294587 100644 --- a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs @@ -17,7 +17,7 @@ using osu.Game.Rulesets.Scoring; namespace osu.Game.Screens.Select.Leaderboards { - public class LeaderboardScore : Container, IStateful + public class LeaderboardScore : ClickableContainer, IStateful { public static readonly float HEIGHT = 60; diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 78a8e4c177..c15900eb6d 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -12,6 +12,7 @@ using osu.Game.Graphics; using osu.Game.Overlays.Mods; using osu.Game.Screens.Edit; using osu.Game.Screens.Play; +using osu.Game.Screens.Ranking; namespace osu.Game.Screens.Select { @@ -35,6 +36,8 @@ namespace osu.Game.Screens.Select RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Top = 10, Right = 5 }, }); + + beatmapDetails.Leaderboard.ScoreSelected += s => Push(new Results(s)); } [BackgroundDependencyLoader] From 72fcc09a989dd35e85a27afdbfeb1ce751befc4e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Apr 2017 15:56:52 +0900 Subject: [PATCH 261/442] Add beatmap info and score date. Also adjusts design metrics. --- .../Tests/TestCaseResults.cs | 2 +- osu.Game/Screens/Ranking/Results.cs | 4 +- osu.Game/Screens/Ranking/ResultsPage.cs | 7 +- ...tsRankingPage.cs => ResultsPageRanking.cs} | 9 +- osu.Game/Screens/Ranking/ResultsPageScore.cs | 286 ++++++++++++++++++ osu.Game/Screens/Ranking/ResultsScorePage.cs | 132 -------- osu.Game/osu.Game.csproj | 4 +- 7 files changed, 299 insertions(+), 145 deletions(-) rename osu.Game/Screens/Ranking/{ResultsRankingPage.cs => ResultsPageRanking.cs} (76%) create mode 100644 osu.Game/Screens/Ranking/ResultsPageScore.cs delete mode 100644 osu.Game/Screens/Ranking/ResultsScorePage.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseResults.cs b/osu.Desktop.VisualTests/Tests/TestCaseResults.cs index 18e678e38d..afb8f73853 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseResults.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseResults.cs @@ -37,7 +37,7 @@ namespace osu.Desktop.VisualTests.Tests base.Reset(); - Add(new Results(new Score() + Add(new Results(new Score { TotalScore = 2845370, Accuracy = 0.98, diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index 3c78efe30b..e440799e25 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -201,10 +201,10 @@ namespace osu.Game.Screens.Ranking switch (mode) { case ResultMode.Summary: - currentPage = new ResultsScorePage(score); + currentPage = new ResultsPageScore(score, Beatmap.BeatmapInfo); break; case ResultMode.Ranking: - currentPage = new ResultsRankingPage(score, Beatmap.BeatmapInfo); + currentPage = new ResultsPageRanking(score, Beatmap.BeatmapInfo); break; } diff --git a/osu.Game/Screens/Ranking/ResultsPage.cs b/osu.Game/Screens/Ranking/ResultsPage.cs index 514b1616ec..5cafaf5e44 100644 --- a/osu.Game/Screens/Ranking/ResultsPage.cs +++ b/osu.Game/Screens/Ranking/ResultsPage.cs @@ -6,6 +6,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Modes.Scoring; using OpenTK; @@ -15,15 +16,17 @@ namespace osu.Game.Screens.Ranking { internal class ResultsPage : Container { - protected Score Score; + protected readonly Score Score; + protected readonly BeatmapInfo Beatmap; private CircularContainer content; private Box fill; protected override Container Content => content; - public ResultsPage(Score score) + public ResultsPage(Score score, BeatmapInfo beatmap) { Score = score; + Beatmap = beatmap; RelativeSizeAxes = Axes.Both; } diff --git a/osu.Game/Screens/Ranking/ResultsRankingPage.cs b/osu.Game/Screens/Ranking/ResultsPageRanking.cs similarity index 76% rename from osu.Game/Screens/Ranking/ResultsRankingPage.cs rename to osu.Game/Screens/Ranking/ResultsPageRanking.cs index c7a36a6382..07e9233aba 100644 --- a/osu.Game/Screens/Ranking/ResultsRankingPage.cs +++ b/osu.Game/Screens/Ranking/ResultsPageRanking.cs @@ -12,13 +12,10 @@ using OpenTK; namespace osu.Game.Screens.Ranking { - internal class ResultsRankingPage : ResultsPage + internal class ResultsPageRanking : ResultsPage { - private readonly BeatmapInfo beatmap; - - public ResultsRankingPage(Score score, BeatmapInfo beatmap = null) : base(score) + public ResultsPageRanking(Score score, BeatmapInfo beatmap = null) : base(score, beatmap) { - this.beatmap = beatmap; } [BackgroundDependencyLoader] @@ -36,7 +33,7 @@ namespace osu.Game.Screens.Ranking Origin = Anchor.Centre, Anchor = Anchor.Centre, RelativeSizeAxes = Axes.Both, - Beatmap = beatmap ?? Score.Beatmap, + Beatmap = Beatmap ?? Score.Beatmap, Scale = new Vector2(0.7f) } }; diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs new file mode 100644 index 0000000000..74063203c5 --- /dev/null +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -0,0 +1,286 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Primitives; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; +using osu.Game.Configuration; +using osu.Game.Database; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; +using osu.Game.Modes.Scoring; +using osu.Game.Screens.Select.Leaderboards; +using osu.Game.Users; +using OpenTK; +using OpenTK.Graphics; +using System; + +namespace osu.Game.Screens.Ranking +{ + internal class ResultsPageScore : ResultsPage + { + private ScoreCounter scoreCounter; + + public ResultsPageScore(Score score, BeatmapInfo beatmap) : base(score, beatmap) { } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + const float user_header_height = 120; + + Children = new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Top = user_header_height }, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.White, + }, + } + }, + new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Children = new Drawable[] + { + new UserHeader(Score.User) + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + RelativeSizeAxes = Axes.X, + Height = user_header_height, + }, + new DrawableRank(Score.Rank) + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Size = new Vector2(150, 60), + Margin = new MarginPadding(20), + }, + scoreCounter = new SlowScoreCounter(6) + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Colour = colours.PinkDarker, + TextSize = 50, + }, + new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Colour = colours.PinkDarker, + Shadow = false, + Font = @"Exo2.0-Bold", + TextSize = 16, + Text = "total score", + Margin = new MarginPadding { Bottom = 20 }, + }, + new BeatmapDetails(Beatmap) + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Margin = new MarginPadding { Bottom = 10 }, + }, + new DateDisplay(Score.Date) + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + }, + new Box + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Margin = new MarginPadding { Top = 10, Bottom = 10 }, + Colour = colours.GrayC, + RelativeSizeAxes = Axes.X, + Size = new Vector2(0.75f, 1), + } + } + } + }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + Schedule(() => scoreCounter.Increment(Score.TotalScore)); + } + + private class DateDisplay : Container + { + private DateTime date; + + public DateDisplay(DateTime date) + { + this.date = date; + + AutoSizeAxes = Axes.Y; + + Width = 140; + + Masking = true; + CornerRadius = 5; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = colours.Gray6, + }, + new OsuSpriteText + { + Origin = Anchor.CentreLeft, + Anchor = Anchor.CentreLeft, + Text = date.ToString("HH:mm"), + Padding = new MarginPadding { Left = 10, Right = 10, Top = 5, Bottom = 5 }, + Colour = Color4.White, + }, + new OsuSpriteText + { + Origin = Anchor.CentreRight, + Anchor = Anchor.CentreRight, + Text = date.ToString("yyyy/MM/dd"), + Padding = new MarginPadding { Left = 10, Right = 10, Top = 5, Bottom = 5 }, + Colour = Color4.White, + } + }; + } + } + + private class BeatmapDetails : Container + { + private readonly BeatmapInfo beatmap; + + private Bindable preferUnicode; + + private readonly OsuSpriteText title; + private readonly OsuSpriteText artist; + private readonly OsuSpriteText versionMapper; + + public BeatmapDetails(BeatmapInfo beatmap) + { + this.beatmap = beatmap; + + AutoSizeAxes = Axes.Both; + + Children = new Drawable[] + { + new FillFlowContainer + { + Direction = FillDirection.Vertical, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Children = new Drawable[] + { + title = new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Shadow = false, + TextSize = 24, + Font = @"Exo2.0-BoldItalic", + }, + artist = new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Shadow = false, + TextSize = 20, + Font = @"Exo2.0-BoldItalic", + }, + versionMapper = new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Shadow = false, + TextSize = 16, + Font = @"Exo2.0-Bold", + }, + } + } + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours, OsuConfigManager config) + { + title.Colour = artist.Colour = colours.BlueDarker; + versionMapper.Colour = colours.Gray8; + + versionMapper.Text = $"{beatmap.Version} - mapped by {beatmap.Metadata.Author}"; + + preferUnicode = config.GetBindable(OsuConfig.ShowUnicode); + preferUnicode.ValueChanged += unicode => + { + title.Text = unicode ? beatmap.Metadata.TitleUnicode : beatmap.Metadata.Title; + artist.Text = unicode ? beatmap.Metadata.ArtistUnicode : beatmap.Metadata.Artist; + }; + preferUnicode.TriggerChange(); + } + } + + private class UserHeader : Container + { + private readonly User user; + private readonly Sprite cover; + + public UserHeader(User user) + { + this.user = user; + Children = new Drawable[] + { + cover = new Sprite + { + FillMode = FillMode.Fill, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + new OsuSpriteText + { + Font = @"Exo2.0-RegularItalic", + Text = user.Username, + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + TextSize = 30, + Padding = new MarginPadding { Bottom = 10 }, + } + }; + } + + [BackgroundDependencyLoader] + private void load(TextureStore textures) + { + cover.Texture = textures.Get(user.CoverUrl); + } + } + + private class SlowScoreCounter : ScoreCounter + { + protected override double RollingDuration => 3000; + + protected override EasingTypes RollingEasing => EasingTypes.OutPow10; + + public SlowScoreCounter(uint leading = 0) : base(leading) + { + DisplayedCountSpriteText.Shadow = false; + } + } + } +} \ No newline at end of file diff --git a/osu.Game/Screens/Ranking/ResultsScorePage.cs b/osu.Game/Screens/Ranking/ResultsScorePage.cs deleted file mode 100644 index e8d6ac36bf..0000000000 --- a/osu.Game/Screens/Ranking/ResultsScorePage.cs +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Primitives; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Textures; -using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; -using osu.Game.Graphics.UserInterface; -using osu.Game.Modes.Scoring; -using osu.Game.Screens.Select.Leaderboards; -using osu.Game.Users; -using OpenTK; -using OpenTK.Graphics; - -namespace osu.Game.Screens.Ranking -{ - internal class ResultsScorePage : ResultsPage - { - private ScoreCounter scoreCounter; - - public ResultsScorePage(Score score) : base(score) { } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - const float user_header_height = 150; - - Children = new Drawable[] - { - new Container - { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Top = user_header_height }, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = Color4.White, - }, - } - }, - new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - Children = new Drawable[] - { - new UserHeader(Score.User) - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - RelativeSizeAxes = Axes.X, - Height = user_header_height, - }, - new DrawableRank(Score.Rank) - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Size = new Vector2(150, 80), - }, - scoreCounter = new SlowScoreCounter(6) - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Colour = colours.PinkDarker, - TextSize = 60, - }, - } - } - }; - } - - protected override void LoadComplete() - { - base.LoadComplete(); - Schedule(() => scoreCounter.Increment(Score.TotalScore)); - } - - private class UserHeader : Container - { - private readonly User user; - private readonly Sprite cover; - - public UserHeader(User user) - { - this.user = user; - Children = new Drawable[] - { - cover = new Sprite - { - FillMode = FillMode.Fill, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - }, - new OsuSpriteText - { - Font = @"Exo2.0-RegularItalic", - Text = user.Username, - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - TextSize = 30, - Padding = new MarginPadding { Bottom = 10 }, - } - }; - } - - [BackgroundDependencyLoader] - private void load(TextureStore textures) - { - cover.Texture = textures.Get(user.CoverUrl); - } - } - - private class SlowScoreCounter : ScoreCounter - { - protected override double RollingDuration => 3000; - - protected override EasingTypes RollingEasing => EasingTypes.OutPow10; - - public SlowScoreCounter(uint leading = 0) : base(leading) - { - DisplayedCountSpriteText.Shadow = false; - } - } - } -} \ No newline at end of file diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 887c37e20a..fe331c6356 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -203,8 +203,8 @@ - - + + From 49fc91cf375678bd3aece6f13169282ae6da77bf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Apr 2017 16:28:11 +0900 Subject: [PATCH 262/442] Add an exit transition. --- osu.Game/Screens/Ranking/Results.cs | 45 +++++++++++++++++++---------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index e440799e25..9536f862b0 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.IEnumerableExtensions; @@ -43,13 +44,15 @@ namespace osu.Game.Screens.Ranking this.score = score; } + private const float transition_time = 800; + + private IEnumerable allCircles => new Drawable[] { circleOuterBackground, circleInner, circleOuter }; + protected override void OnEntering(Screen last) { base.OnEntering(last); (Background as BackgroundScreenBeatmap)?.BlurTo(background_blur, 2500, EasingTypes.OutQuint); - var allCircles = new[] { circleOuterBackground, circleInner, circleOuter }; - allCircles.ForEach(c => { c.FadeOut(); @@ -60,31 +63,43 @@ namespace osu.Game.Screens.Ranking modeChangeButtons.FadeOut(); currentPage.FadeOut(); - const float appear_time = 800; + - circleOuterBackground.ScaleTo(1, appear_time, EasingTypes.OutQuint); - circleOuterBackground.FadeTo(1, appear_time, EasingTypes.OutQuint); + circleOuterBackground.ScaleTo(1, transition_time, EasingTypes.OutQuint); + circleOuterBackground.FadeTo(1, transition_time, EasingTypes.OutQuint); - Content.Delay(appear_time * 0.25f, true); + Content.Delay(transition_time * 0.25f, true); - circleOuter.ScaleTo(1, appear_time, EasingTypes.OutQuint); - circleOuter.FadeTo(1, appear_time, EasingTypes.OutQuint); + circleOuter.ScaleTo(1, transition_time, EasingTypes.OutQuint); + circleOuter.FadeTo(1, transition_time, EasingTypes.OutQuint); - Content.Delay(appear_time * 0.3f, true); + Content.Delay(transition_time * 0.3f, true); - backgroundParallax.FadeIn(appear_time, EasingTypes.OutQuint); + backgroundParallax.FadeIn(transition_time, EasingTypes.OutQuint); - circleInner.ScaleTo(1, appear_time, EasingTypes.OutQuint); - circleInner.FadeTo(1, appear_time, EasingTypes.OutQuint); + circleInner.ScaleTo(1, transition_time, EasingTypes.OutQuint); + circleInner.FadeTo(1, transition_time, EasingTypes.OutQuint); - Content.Delay(appear_time * 0.4f, true); + Content.Delay(transition_time * 0.4f, true); - modeChangeButtons.FadeIn(appear_time, EasingTypes.OutQuint); - currentPage.FadeIn(appear_time, EasingTypes.OutQuint); + modeChangeButtons.FadeIn(transition_time, EasingTypes.OutQuint); + currentPage.FadeIn(transition_time, EasingTypes.OutQuint); Content.DelayReset(); } + protected override bool OnExiting(Screen next) + { + allCircles.ForEach(c => + { + c.ScaleTo(0, transition_time, EasingTypes.OutSine); + }); + + Content.FadeOut(transition_time / 4); + + return base.OnExiting(next); + } + [BackgroundDependencyLoader] private void load() { From 968d46a10f7e80f7228e818c791c23ac461921d9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Apr 2017 16:35:00 +0900 Subject: [PATCH 263/442] whitespace. --- osu.Game/Screens/Ranking/Results.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index 9536f862b0..ef455c3944 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -63,8 +63,6 @@ namespace osu.Game.Screens.Ranking modeChangeButtons.FadeOut(); currentPage.FadeOut(); - - circleOuterBackground.ScaleTo(1, transition_time, EasingTypes.OutQuint); circleOuterBackground.FadeTo(1, transition_time, EasingTypes.OutQuint); From 886ac1fb4033f2bab07bdb22ae2ccd7943029c45 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 15:16:50 +0900 Subject: [PATCH 264/442] Add progress graph background and update ruleset references. --- .../Tests/TestCaseResults.cs | 5 ++- osu.Game/Screens/Ranking/Results.cs | 4 +-- osu.Game/Screens/Ranking/ResultsPage.cs | 8 ++--- .../Screens/Ranking/ResultsPageRanking.cs | 8 ++--- osu.Game/Screens/Ranking/ResultsPageScore.cs | 33 +++++++++++++++---- 5 files changed, 38 insertions(+), 20 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseResults.cs b/osu.Desktop.VisualTests/Tests/TestCaseResults.cs index afb8f73853..0bac4b6484 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseResults.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseResults.cs @@ -3,8 +3,7 @@ using osu.Framework.Allocation; using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Database; -using osu.Game.Modes; -using osu.Game.Modes.Scoring; +using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Ranking; using osu.Game.Users; @@ -30,7 +29,7 @@ namespace osu.Desktop.VisualTests.Tests if (beatmap == null) { - var beatmapInfo = db.Query().FirstOrDefault(b => b.Mode == PlayMode.Osu); + var beatmapInfo = db.Query().FirstOrDefault(b => b.RulesetID == 0); if (beatmapInfo != null) beatmap = db.GetWorkingBeatmap(beatmapInfo); } diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index ef455c3944..7fb0f628b9 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -214,10 +214,10 @@ namespace osu.Game.Screens.Ranking switch (mode) { case ResultMode.Summary: - currentPage = new ResultsPageScore(score, Beatmap.BeatmapInfo); + currentPage = new ResultsPageScore(score, Beatmap); break; case ResultMode.Ranking: - currentPage = new ResultsPageRanking(score, Beatmap.BeatmapInfo); + currentPage = new ResultsPageRanking(score, Beatmap); break; } diff --git a/osu.Game/Screens/Ranking/ResultsPage.cs b/osu.Game/Screens/Ranking/ResultsPage.cs index 5cafaf5e44..55d1745c93 100644 --- a/osu.Game/Screens/Ranking/ResultsPage.cs +++ b/osu.Game/Screens/Ranking/ResultsPage.cs @@ -6,9 +6,9 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Game.Database; +using osu.Game.Beatmaps; using osu.Game.Graphics; -using osu.Game.Modes.Scoring; +using osu.Game.Rulesets.Scoring; using OpenTK; using OpenTK.Graphics; @@ -17,13 +17,13 @@ namespace osu.Game.Screens.Ranking internal class ResultsPage : Container { protected readonly Score Score; - protected readonly BeatmapInfo Beatmap; + protected readonly WorkingBeatmap Beatmap; private CircularContainer content; private Box fill; protected override Container Content => content; - public ResultsPage(Score score, BeatmapInfo beatmap) + public ResultsPage(Score score, WorkingBeatmap beatmap) { Score = score; Beatmap = beatmap; diff --git a/osu.Game/Screens/Ranking/ResultsPageRanking.cs b/osu.Game/Screens/Ranking/ResultsPageRanking.cs index 07e9233aba..827abd556e 100644 --- a/osu.Game/Screens/Ranking/ResultsPageRanking.cs +++ b/osu.Game/Screens/Ranking/ResultsPageRanking.cs @@ -4,9 +4,9 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; -using osu.Game.Database; +using osu.Game.Beatmaps; using osu.Game.Graphics; -using osu.Game.Modes.Scoring; +using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Select.Leaderboards; using OpenTK; @@ -14,7 +14,7 @@ namespace osu.Game.Screens.Ranking { internal class ResultsPageRanking : ResultsPage { - public ResultsPageRanking(Score score, BeatmapInfo beatmap = null) : base(score, beatmap) + public ResultsPageRanking(Score score, WorkingBeatmap beatmap = null) : base(score, beatmap) { } @@ -33,7 +33,7 @@ namespace osu.Game.Screens.Ranking Origin = Anchor.Centre, Anchor = Anchor.Centre, RelativeSizeAxes = Axes.Both, - Beatmap = Beatmap ?? Score.Beatmap, + Beatmap = Beatmap.BeatmapInfo ?? Score.Beatmap, Scale = new Vector2(0.7f) } }; diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index 74063203c5..32da5ee841 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -13,12 +13,14 @@ using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; -using osu.Game.Modes.Scoring; using osu.Game.Screens.Select.Leaderboards; using osu.Game.Users; using OpenTK; using OpenTK.Graphics; using System; +using osu.Game.Beatmaps; +using osu.Game.Screens.Play; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Screens.Ranking { @@ -26,7 +28,7 @@ namespace osu.Game.Screens.Ranking { private ScoreCounter scoreCounter; - public ResultsPageScore(Score score, BeatmapInfo beatmap) : base(score, beatmap) { } + public ResultsPageScore(Score score, WorkingBeatmap beatmap) : base(score, beatmap) { } [BackgroundDependencyLoader] private void load(OsuColour colours) @@ -69,12 +71,29 @@ namespace osu.Game.Screens.Ranking Size = new Vector2(150, 60), Margin = new MarginPadding(20), }, - scoreCounter = new SlowScoreCounter(6) + new Container { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Colour = colours.PinkDarker, - TextSize = 50, + RelativeSizeAxes = Axes.X, + Height = 60, + Children = new Drawable[] + { + new SongProgressGraph + { + RelativeSizeAxes = Axes.Both, + Alpha = 0.5f, + Objects = Beatmap.Beatmap.HitObjects, + }, + scoreCounter = new SlowScoreCounter(6) + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Colour = colours.PinkDarker, + Y = 10, + TextSize = 50, + }, + } }, new OsuSpriteText { @@ -87,7 +106,7 @@ namespace osu.Game.Screens.Ranking Text = "total score", Margin = new MarginPadding { Bottom = 20 }, }, - new BeatmapDetails(Beatmap) + new BeatmapDetails(Beatmap.BeatmapInfo) { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, @@ -283,4 +302,4 @@ namespace osu.Game.Screens.Ranking } } } -} \ No newline at end of file +} From 782019e0c7e418c0b275c205d8cc231ae001b5b7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 21:04:59 +0900 Subject: [PATCH 265/442] Make line gradient correct. --- osu.Game/Screens/Ranking/ResultsPageScore.cs | 32 +++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index 32da5ee841..01dde17c51 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -18,9 +18,11 @@ using osu.Game.Users; using OpenTK; using OpenTK.Graphics; using System; +using osu.Framework.Extensions.Color4Extensions; using osu.Game.Beatmaps; using osu.Game.Screens.Play; using osu.Game.Rulesets.Scoring; +using osu.Framework.Graphics.Colour; namespace osu.Game.Screens.Ranking { @@ -117,15 +119,35 @@ namespace osu.Game.Screens.Ranking Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, }, - new Box + new Container { + RelativeSizeAxes = Axes.X, + Size = new Vector2(0.75f, 1), Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Margin = new MarginPadding { Top = 10, Bottom = 10 }, - Colour = colours.GrayC, - RelativeSizeAxes = Axes.X, - Size = new Vector2(0.75f, 1), - } + Children = new Drawable[] + { + new Box + { + ColourInfo = ColourInfo.GradientHorizontal( + colours.GrayC.Opacity(0), + colours.GrayC.Opacity(0.9f)), + RelativeSizeAxes = Axes.Both, + Size = new Vector2(0.5f, 1), + }, + new Box + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + ColourInfo = ColourInfo.GradientHorizontal( + colours.GrayC.Opacity(0.9f), + colours.GrayC.Opacity(0)), + RelativeSizeAxes = Axes.Both, + Size = new Vector2(0.5f, 1), + }, + } + }, } } }; From 28835bd5bd52daf5ee85ee77a7ffb366e44b0601 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 21:24:18 +0900 Subject: [PATCH 266/442] Add back comma separator to score display. --- osu.Game/Screens/Ranking/ResultsPageScore.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index 01dde17c51..5d9437a832 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -321,6 +321,7 @@ namespace osu.Game.Screens.Ranking public SlowScoreCounter(uint leading = 0) : base(leading) { DisplayedCountSpriteText.Shadow = false; + UseCommaSeparator = true; } } } From 32df625d82c31061903cd5709b71a5d38771ac21 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 21:25:33 +0900 Subject: [PATCH 267/442] Adjust text size and padding. --- osu.Game/Screens/Ranking/ResultsPageScore.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index 5d9437a832..0874767f05 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -92,8 +92,8 @@ namespace osu.Game.Screens.Ranking Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Colour = colours.PinkDarker, - Y = 10, - TextSize = 50, + Y = 5, + TextSize = 60, }, } }, @@ -106,7 +106,7 @@ namespace osu.Game.Screens.Ranking Font = @"Exo2.0-Bold", TextSize = 16, Text = "total score", - Margin = new MarginPadding { Bottom = 20 }, + Margin = new MarginPadding { Bottom = 15 }, }, new BeatmapDetails(Beatmap.BeatmapInfo) { From f1bd64a74d50fe583095b6deeeed717c438f5302 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 21:35:11 +0900 Subject: [PATCH 268/442] Adjust colour metrics. --- osu.Game/Screens/Ranking/Results.cs | 2 +- osu.Game/Screens/Ranking/ResultsPage.cs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index 7fb0f628b9..fde1850b71 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -158,7 +158,7 @@ namespace osu.Game.Screens.Ranking { new Sprite { - Alpha = 0.5f, + Alpha = 0.2f, Texture = Beatmap?.Background, Anchor = Anchor.Centre, Origin = Anchor.Centre, diff --git a/osu.Game/Screens/Ranking/ResultsPage.cs b/osu.Game/Screens/Ranking/ResultsPage.cs index 55d1745c93..02eae3643b 100644 --- a/osu.Game/Screens/Ranking/ResultsPage.cs +++ b/osu.Game/Screens/Ranking/ResultsPage.cs @@ -52,9 +52,9 @@ namespace osu.Game.Screens.Ranking { EdgeEffect = new EdgeEffect { - Colour = Color4.Black.Opacity(1), + Colour = colours.GrayF.Opacity(0.8f), Type = EdgeEffectType.Shadow, - Radius = 15, + Radius = 1, }, RelativeSizeAxes = Axes.Both, Masking = true, @@ -75,7 +75,7 @@ namespace osu.Game.Screens.Ranking { EdgeEffect = new EdgeEffect { - Colour = Color4.Black.Opacity(0.4f), + Colour = Color4.Black.Opacity(0.2f), Type = EdgeEffectType.Shadow, Radius = 15, }, @@ -89,4 +89,4 @@ namespace osu.Game.Screens.Ranking } } -} \ No newline at end of file +} From 4a3fc710c47b490806865731734ed3d94730ef43 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 21:35:41 +0900 Subject: [PATCH 269/442] Add temporary combo/accuracy display. --- .../Tests/TestCaseResults.cs | 1 + osu.Game/Screens/Ranking/Results.cs | 49 +++++++++++++++++-- 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseResults.cs b/osu.Desktop.VisualTests/Tests/TestCaseResults.cs index 0bac4b6484..389d32f540 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseResults.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseResults.cs @@ -40,6 +40,7 @@ namespace osu.Desktop.VisualTests.Tests { TotalScore = 2845370, Accuracy = 0.98, + MaxCombo = 123, Rank = ScoreRank.A, User = new User { diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index fde1850b71..019ad21bdb 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -15,6 +15,7 @@ using osu.Game.Graphics.Containers; using osu.Game.Screens.Backgrounds; using OpenTK; using OpenTK.Graphics; +using osu.Game.Graphics; namespace osu.Game.Screens.Ranking { @@ -99,7 +100,7 @@ namespace osu.Game.Screens.Ranking } [BackgroundDependencyLoader] - private void load() + private void load(OsuColour colours) { Children = new Drawable[] { @@ -173,7 +174,49 @@ namespace osu.Game.Screens.Ranking RelativeSizeAxes = Axes.X, Height = 50, Margin = new MarginPadding { Bottom = 110 }, - } + }, + new SpriteText + { + Text = $"{score.MaxCombo}x", + TextSize = 40, + RelativePositionAxes = Axes.X, + Font = @"Exo2.0-Bold", + X = 0.1f, + Colour = colours.BlueDarker, + Anchor = Anchor.CentreLeft, + Origin = Anchor.BottomCentre, + }, + new SpriteText + { + Text = $"max combo", + TextSize = 20, + RelativePositionAxes = Axes.X, + X = 0.1f, + Colour = colours.Gray6, + Anchor = Anchor.CentreLeft, + Origin = Anchor.TopCentre, + }, + new SpriteText + { + Text = $"{score.Accuracy:P2}", + TextSize = 40, + RelativePositionAxes = Axes.X, + Font = @"Exo2.0-Bold", + X = 0.9f, + Colour = colours.BlueDarker, + Anchor = Anchor.CentreLeft, + Origin = Anchor.BottomCentre, + }, + new SpriteText + { + Text = $"accuracy", + TextSize = 20, + RelativePositionAxes = Axes.X, + X = 0.9f, + Colour = colours.Gray6, + Anchor = Anchor.CentreLeft, + Origin = Anchor.TopCentre, + }, } }, circleInner = new CircularContainer @@ -228,4 +271,4 @@ namespace osu.Game.Screens.Ranking modeChangeButtons.Current.TriggerChange(); } } -} \ No newline at end of file +} From dc13d4d4ab193ce3a12c677252724000cba5385d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 21:36:34 +0900 Subject: [PATCH 270/442] Display an actual date/time. --- osu.Desktop.VisualTests/Tests/TestCaseResults.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseResults.cs b/osu.Desktop.VisualTests/Tests/TestCaseResults.cs index 389d32f540..41e9d5adb0 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseResults.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseResults.cs @@ -1,4 +1,5 @@ -using System.Linq; +using System; +using System.Linq; using osu.Framework.Allocation; using osu.Framework.Testing; using osu.Game.Beatmaps; @@ -42,6 +43,7 @@ namespace osu.Desktop.VisualTests.Tests Accuracy = 0.98, MaxCombo = 123, Rank = ScoreRank.A, + Date = DateTime.Now, User = new User { Username = "peppy", From e8d55b5bb5772d8cb025afed421434418ca0388f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 21:38:05 +0900 Subject: [PATCH 271/442] Add back button. --- osu.Game/Screens/Ranking/Results.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index 019ad21bdb..1aa8c5f4cf 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -16,6 +16,7 @@ using osu.Game.Screens.Backgrounds; using OpenTK; using OpenTK.Graphics; using osu.Game.Graphics; +using osu.Game.Graphics.UserInterface; namespace osu.Game.Screens.Ranking { @@ -242,7 +243,13 @@ namespace osu.Game.Screens.Ranking } } } - } + }, + new BackButton + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Action = Exit + }, }; modeChangeButtons.AddItem(ResultMode.Summary); From 2bf560a3710263e134e27038cc7e593c65ca177a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 21:38:29 +0900 Subject: [PATCH 272/442] Disable page three for now. --- osu.Game/Screens/Ranking/Results.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index 1aa8c5f4cf..494755c7dc 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -254,7 +254,7 @@ namespace osu.Game.Screens.Ranking modeChangeButtons.AddItem(ResultMode.Summary); modeChangeButtons.AddItem(ResultMode.Ranking); - modeChangeButtons.AddItem(ResultMode.Share); + //modeChangeButtons.AddItem(ResultMode.Share); modeChangeButtons.Current.ValueChanged += mode => { From 15d62a0c76cf410b4b717f9487f90613dcb4baec Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 21:46:52 +0900 Subject: [PATCH 273/442] Add temporary ScoreRank assignment. --- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index b2c5d8319e..39008c5889 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -71,9 +71,26 @@ namespace osu.Game.Rulesets.Scoring Combo = Combo, MaxCombo = HighestCombo, Accuracy = Accuracy, + Rank = rankFrom(Accuracy), + Date = DateTime.Now, Health = Health, }; + private ScoreRank rankFrom(double acc) + { + if (acc == 1) + return ScoreRank.X; + if (acc > 0.95) + return ScoreRank.S; + if (acc > 0.9) + return ScoreRank.A; + if (acc > 0.8) + return ScoreRank.B; + if (acc > 0.7) + return ScoreRank.C; + return ScoreRank.D; + } + /// /// Resets this ScoreProcessor to a default state. /// From a0d9c14526739cba313d4f05012a5319ef9d1ce4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 21:55:44 +0900 Subject: [PATCH 274/442] Add temporary means of getting the user which is responsible for a resulting play. --- osu.Game.Rulesets.Osu/OsuAutoReplay.cs | 6 ++++++ osu.Game/Rulesets/Replays/Replay.cs | 3 +++ osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 1 + osu.Game/Rulesets/UI/HitRenderer.cs | 8 +++++++- osu.Game/Screens/Play/Player.cs | 5 ++++- 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/OsuAutoReplay.cs b/osu.Game.Rulesets.Osu/OsuAutoReplay.cs index 6fc005fb6a..ee27a37e76 100644 --- a/osu.Game.Rulesets.Osu/OsuAutoReplay.cs +++ b/osu.Game.Rulesets.Osu/OsuAutoReplay.cs @@ -12,6 +12,7 @@ using System.Diagnostics; using osu.Framework.Graphics; using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Replays; +using osu.Game.Users; namespace osu.Game.Rulesets.Osu { @@ -27,6 +28,11 @@ namespace osu.Game.Rulesets.Osu { this.beatmap = beatmap; + User = new User + { + Username = @"Autoplay", + }; + createAutoReplay(); } diff --git a/osu.Game/Rulesets/Replays/Replay.cs b/osu.Game/Rulesets/Replays/Replay.cs index 8e9d7cdaad..17e6324d9d 100644 --- a/osu.Game/Rulesets/Replays/Replay.cs +++ b/osu.Game/Rulesets/Replays/Replay.cs @@ -2,11 +2,14 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; +using osu.Game.Users; namespace osu.Game.Rulesets.Replays { public class Replay { + public User User; + public List Frames = new List(); } } \ No newline at end of file diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 39008c5889..294412e7c0 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -9,6 +9,7 @@ using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.UI; using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Users; namespace osu.Game.Rulesets.Scoring { diff --git a/osu.Game/Rulesets/UI/HitRenderer.cs b/osu.Game/Rulesets/UI/HitRenderer.cs index 098a4d5f03..021de37aae 100644 --- a/osu.Game/Rulesets/UI/HitRenderer.cs +++ b/osu.Game/Rulesets/UI/HitRenderer.cs @@ -91,11 +91,17 @@ namespace osu.Game.Rulesets.UI protected virtual FramedReplayInputHandler CreateReplayInputHandler(Replay replay) => new FramedReplayInputHandler(replay); + public Replay Replay { get; private set; } + /// /// Sets a replay to be used, overriding local input. /// /// The replay, null for local input. - public void SetReplay(Replay replay) => InputManager.ReplayInputHandler = replay != null ? CreateReplayInputHandler(replay) : null; + public void SetReplay(Replay replay) + { + Replay = replay; + InputManager.ReplayInputHandler = replay != null ? CreateReplayInputHandler(replay) : null; + } } /// diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index f1b1f7f2fe..6a7a69c47e 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -22,6 +22,7 @@ using System.Linq; using osu.Framework.Threading; using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Ranking; +using osu.Game.Users; namespace osu.Game.Screens.Play { @@ -266,7 +267,9 @@ namespace osu.Game.Screens.Play Delay(1000); onCompletionEvent = Schedule(delegate { - Push(new Results(scoreProcessor.CreateScore())); + var score = scoreProcessor.CreateScore(); + score.User = HitRenderer.Replay?.User ?? (Game as OsuGame)?.API?.LocalUser?.Value; + Push(new Results(score)); }); } From 49f4981f1ccd904de06da55e84931a0aa8a72686 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 22:07:47 +0900 Subject: [PATCH 275/442] Fix CI issues. --- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 1 - osu.Game/Screens/Play/Player.cs | 1 - osu.Game/Screens/Ranking/Results.cs | 4 ++-- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 294412e7c0..39008c5889 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -9,7 +9,6 @@ using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.UI; using osu.Game.Rulesets.Objects.Drawables; -using osu.Game.Users; namespace osu.Game.Rulesets.Scoring { diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 6a7a69c47e..52518180d9 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -22,7 +22,6 @@ using System.Linq; using osu.Framework.Threading; using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Ranking; -using osu.Game.Users; namespace osu.Game.Screens.Play { diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index 494755c7dc..f4edc11436 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -189,7 +189,7 @@ namespace osu.Game.Screens.Ranking }, new SpriteText { - Text = $"max combo", + Text = "max combo", TextSize = 20, RelativePositionAxes = Axes.X, X = 0.1f, @@ -210,7 +210,7 @@ namespace osu.Game.Screens.Ranking }, new SpriteText { - Text = $"accuracy", + Text = "accuracy", TextSize = 20, RelativePositionAxes = Axes.X, X = 0.9f, From 705e66c7a13a6509f64a8b3f6f2c9553ee24129b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 22:29:58 +0900 Subject: [PATCH 276/442] Fix spinners becoming wonky. --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 9ff77a5f3c..4623fe7f22 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables Position = s.Position; //take up full playfield. - Size = OsuPlayfield.BASE_SIZE; + Size = new Vector2(OsuPlayfield.BASE_SIZE.X); spinner = s; From cef6a014d56a27fe7c4470a6f30ea2c5c29a3da0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 22:31:52 +0900 Subject: [PATCH 277/442] Add a simulated key-up delay to auto replays. Fixes key counter display looking odd. --- osu.Game.Rulesets.Osu/OsuAutoReplay.cs | 2 +- osu.Game.Rulesets.Taiko/Replays/TaikoAutoReplay.cs | 4 ++-- osu.Game/Rulesets/Replays/Replay.cs | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/OsuAutoReplay.cs b/osu.Game.Rulesets.Osu/OsuAutoReplay.cs index 6fc005fb6a..d6eab9eb56 100644 --- a/osu.Game.Rulesets.Osu/OsuAutoReplay.cs +++ b/osu.Game.Rulesets.Osu/OsuAutoReplay.cs @@ -213,7 +213,7 @@ namespace osu.Game.Rulesets.Osu ReplayButtonState button = buttonIndex % 2 == 0 ? ReplayButtonState.Left1 : ReplayButtonState.Right1; - double hEndTime = (h as IHasEndTime)?.EndTime ?? h.StartTime; + double hEndTime = ((h as IHasEndTime)?.EndTime ?? h.StartTime) + KEY_UP_DELAY; ReplayFrame newFrame = new ReplayFrame(h.StartTime, targetPosition.X, targetPosition.Y, button); ReplayFrame endFrame = new ReplayFrame(hEndTime + endDelay, h.EndPosition.X, h.EndPosition.Y, ReplayButtonState.None); diff --git a/osu.Game.Rulesets.Taiko/Replays/TaikoAutoReplay.cs b/osu.Game.Rulesets.Taiko/Replays/TaikoAutoReplay.cs index b44c789be5..a8187d68ab 100644 --- a/osu.Game.Rulesets.Taiko/Replays/TaikoAutoReplay.cs +++ b/osu.Game.Rulesets.Taiko/Replays/TaikoAutoReplay.cs @@ -100,7 +100,7 @@ namespace osu.Game.Rulesets.Taiko.Replays else throw new Exception("Unknown hit object type."); - Frames.Add(new ReplayFrame(endTime + 1, 0, 0, ReplayButtonState.None)); + Frames.Add(new ReplayFrame(endTime + KEY_UP_DELAY, 0, 0, ReplayButtonState.None)); if (i < beatmap.HitObjects.Count - 1) { @@ -113,4 +113,4 @@ namespace osu.Game.Rulesets.Taiko.Replays } } } -} \ No newline at end of file +} diff --git a/osu.Game/Rulesets/Replays/Replay.cs b/osu.Game/Rulesets/Replays/Replay.cs index 8e9d7cdaad..c903c2f56d 100644 --- a/osu.Game/Rulesets/Replays/Replay.cs +++ b/osu.Game/Rulesets/Replays/Replay.cs @@ -7,6 +7,8 @@ namespace osu.Game.Rulesets.Replays { public class Replay { + protected const double KEY_UP_DELAY = 50; + public List Frames = new List(); } -} \ No newline at end of file +} From 2f53f2e248a6a39feb2d91298b1131293b41f07c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 18 Apr 2017 22:35:21 +0900 Subject: [PATCH 278/442] Add license headers. --- osu.Desktop.VisualTests/Tests/TestCaseResults.cs | 5 ++++- osu.Game/Screens/Ranking/AspectContainer.cs | 3 +++ osu.Game/Screens/Ranking/ResultMode.cs | 3 +++ osu.Game/Screens/Ranking/ResultModeButton.cs | 3 +++ osu.Game/Screens/Ranking/ResultModeTabControl.cs | 3 +++ 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseResults.cs b/osu.Desktop.VisualTests/Tests/TestCaseResults.cs index 41e9d5adb0..93e0646255 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseResults.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseResults.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Testing; diff --git a/osu.Game/Screens/Ranking/AspectContainer.cs b/osu.Game/Screens/Ranking/AspectContainer.cs index 42e20adeb9..4699b4ab92 100644 --- a/osu.Game/Screens/Ranking/AspectContainer.cs +++ b/osu.Game/Screens/Ranking/AspectContainer.cs @@ -1,3 +1,6 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Ranking/ResultMode.cs b/osu.Game/Screens/Ranking/ResultMode.cs index b7f030f338..eeb04033ea 100644 --- a/osu.Game/Screens/Ranking/ResultMode.cs +++ b/osu.Game/Screens/Ranking/ResultMode.cs @@ -1,3 +1,6 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + namespace osu.Game.Screens.Ranking { public enum ResultMode diff --git a/osu.Game/Screens/Ranking/ResultModeButton.cs b/osu.Game/Screens/Ranking/ResultModeButton.cs index 5849cd4e14..fc62342860 100644 --- a/osu.Game/Screens/Ranking/ResultModeButton.cs +++ b/osu.Game/Screens/Ranking/ResultModeButton.cs @@ -1,3 +1,6 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game/Screens/Ranking/ResultModeTabControl.cs b/osu.Game/Screens/Ranking/ResultModeTabControl.cs index 9335f1daef..346bff5720 100644 --- a/osu.Game/Screens/Ranking/ResultModeTabControl.cs +++ b/osu.Game/Screens/Ranking/ResultModeTabControl.cs @@ -1,3 +1,6 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + using osu.Framework.Graphics; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.UserInterface; From 3eca32a380359737561d99e69add6c64b38c3410 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 19 Apr 2017 01:37:30 +0900 Subject: [PATCH 279/442] mono now uses msbuild. --- .vscode/tasks.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 03f5bc4c6c..433e5fd2a9 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -8,10 +8,7 @@ "taskName": "build", "isShellCommand": true, "showOutput": "silent", - "command": "xbuild", - "windows": { - "command": "msbuild" - }, + "command": "msbuild", "args": [ // Ask msbuild to generate full paths for file names. "/property:GenerateFullPaths=true" From 83fa143e1725fec6b8511cad23fae0d27aca16b9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 19 Apr 2017 16:02:18 +0900 Subject: [PATCH 280/442] Bring API request structure up-to-date. --- .../Online/API/Requests/GetScoresRequest.cs | 9 ++-- osu.Game/Rulesets/Scoring/Score.cs | 42 +++++++------------ osu.Game/Users/Country.cs | 3 ++ osu.Game/Users/User.cs | 24 ++++++++++- 4 files changed, 43 insertions(+), 35 deletions(-) diff --git a/osu.Game/Online/API/Requests/GetScoresRequest.cs b/osu.Game/Online/API/Requests/GetScoresRequest.cs index 3685d0b9e3..5e6bf1ea9f 100644 --- a/osu.Game/Online/API/Requests/GetScoresRequest.cs +++ b/osu.Game/Online/API/Requests/GetScoresRequest.cs @@ -21,19 +21,16 @@ namespace osu.Game.Online.API.Requests protected override WebRequest CreateWebRequest() { var req = base.CreateWebRequest(); - req.AddParameter(@"c", beatmap.Hash); - req.AddParameter(@"f", beatmap.Path); + //req.AddParameter(@"c", beatmap.Hash); + //req.AddParameter(@"f", beatmap.Path); return req; } - protected override string Target => @"beatmaps/scores"; + protected override string Target => $@"beatmaps/{beatmap.OnlineBeatmapID}/scores"; } public class GetScoresResponse { - [JsonProperty(@"beatmap")] - public BeatmapInfo Beatmap; - [JsonProperty(@"scores")] public IEnumerable Scores; } diff --git a/osu.Game/Rulesets/Scoring/Score.cs b/osu.Game/Rulesets/Scoring/Score.cs index cb7831b04a..a1ff983628 100644 --- a/osu.Game/Rulesets/Scoring/Score.cs +++ b/osu.Game/Rulesets/Scoring/Score.cs @@ -19,32 +19,24 @@ namespace osu.Game.Rulesets.Scoring [JsonProperty(@"score")] public double TotalScore { get; set; } - public double Accuracy { get; set; } - public double Health { get; set; } - [JsonProperty(@"maxcombo")] + [JsonProperty(@"accuracy")] + public double Accuracy { get; set; } + + public double Health { get; set; } = 1; + + [JsonProperty(@"combo")] public int MaxCombo { get; set; } + public int Combo { get; set; } + + [JsonProperty(@"mods")] + protected string[] ModStrings { get; set; } //todo: parse to Mod objects + public Mod[] Mods { get; set; } - private User user; - - public User User - { - get - { - return user ?? new User - { - Username = LegacyUsername, - Id = LegacyUserID - }; - } - - set - { - user = value; - } - } + [JsonProperty(@"user")] + public User User; [JsonProperty(@"replay_data")] public Replay Replay; @@ -54,13 +46,7 @@ namespace osu.Game.Rulesets.Scoring [JsonProperty(@"score_id")] public long OnlineScoreID; - [JsonProperty(@"username")] - public string LegacyUsername; - - [JsonProperty(@"user_id")] - public long LegacyUserID; - - [JsonProperty(@"date")] + [JsonProperty(@"created_at")] public DateTime Date; /// diff --git a/osu.Game/Users/Country.cs b/osu.Game/Users/Country.cs index 960b452682..729629bdb8 100644 --- a/osu.Game/Users/Country.cs +++ b/osu.Game/Users/Country.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using Newtonsoft.Json; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -14,6 +15,7 @@ namespace osu.Game.Users /// /// The name of this country. /// + [JsonProperty(@"name")] public string FullName; /// @@ -24,6 +26,7 @@ namespace osu.Game.Users /// /// Two-letter flag acronym (ISO 3166 standard) /// + [JsonProperty(@"code")] public string FlagName; } diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index 6e1de7e3ac..35d791ef51 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -13,11 +13,33 @@ namespace osu.Game.Users [JsonProperty(@"username")] public string Username; + //[JsonProperty(@"country")] + [JsonIgnore] public Country Country; - public Team Team; + //public Team Team; [JsonProperty(@"colour")] public string Colour; + + [JsonProperty(@"avatarUrl")] + public string AvatarUrl; + + [JsonProperty(@"cover")] + public UserCover Cover; + + public class UserCover + { + [JsonProperty(@"customUrl")] + public string CustomUrl; + + [JsonProperty(@"url")] + public string Url; + + [JsonProperty(@"id")] + public int? Id; + } } + + } From 2783f49267b42f42d80e2b45b8e88073de2ea2ac Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 19 Apr 2017 16:02:51 +0900 Subject: [PATCH 281/442] Fix incorrect EndTimes when processing has not been run on HitObjects before the SongProgressGraph is displayed. --- osu.Game/Screens/Play/SongProgressGraph.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Play/SongProgressGraph.cs b/osu.Game/Screens/Play/SongProgressGraph.cs index 97f25e0a95..20548970e5 100644 --- a/osu.Game/Screens/Play/SongProgressGraph.cs +++ b/osu.Game/Screens/Play/SongProgressGraph.cs @@ -20,9 +20,12 @@ namespace osu.Game.Screens.Play const int granularity = 200; - var lastHit = ((objects.Last() as IHasEndTime)?.EndTime ?? objects.Last().StartTime) + 1; + var lastHit = (objects.Last() as IHasEndTime)?.EndTime ?? 0; - var interval = lastHit / granularity; + if (lastHit == 0) + lastHit = objects.Last().StartTime; + + var interval = (lastHit + 1) / granularity; var values = new int[granularity]; @@ -31,7 +34,7 @@ namespace osu.Game.Screens.Play IHasEndTime end = h as IHasEndTime; int startRange = (int)(h.StartTime / interval); - int endRange = (int)((end?.EndTime ?? h.StartTime) / interval); + int endRange = (int)((end?.EndTime > 0 ? end.EndTime : h.StartTime) / interval); for (int i = startRange; i <= endRange; i++) values[i]++; } From afcd7d7fa08330c1d870df7e56ec0faebe1bf93f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 19 Apr 2017 16:03:00 +0900 Subject: [PATCH 282/442] Format accuracy better in LeaderboardScores. --- osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs index 321067d18e..b211b781ae 100644 --- a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs @@ -204,7 +204,7 @@ namespace osu.Game.Screens.Select.Leaderboards Children = new Drawable[] { maxCombo = new ScoreComponentLabel(FontAwesome.fa_link, Score.MaxCombo.ToString()), - accuracy = new ScoreComponentLabel(FontAwesome.fa_crosshairs, string.Format(Score.Accuracy % 1 == 0 ? @"{0:0}" : @"{0:0.00}", Score.Accuracy)), + accuracy = new ScoreComponentLabel(FontAwesome.fa_crosshairs, string.Format(Score.Accuracy % 1 == 0 ? @"{0:P0}" : @"{0:P2}", Score.Accuracy)), }, }, }, From 3b95fbab7db0761dc0177512f311c953c34ab213 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 19 Apr 2017 15:40:10 +0900 Subject: [PATCH 283/442] Add score statistic tracking (osu!). --- .../Tests/TestCaseResults.cs | 7 +- osu.Game.Rulesets.Osu/Scoring/OsuScore.cs | 14 +++- .../Scoring/OsuScoreProcessor.cs | 36 +++++++++++ osu.Game/Database/ScoreDatabase.cs | 2 +- osu.Game/Rulesets/Scoring/Score.cs | 17 +---- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 29 ++++++--- osu.Game/Rulesets/Scoring/ScoreStatistic.cs | 17 +++++ osu.Game/Screens/Play/Player.cs | 2 +- osu.Game/Screens/Ranking/ResultsPageScore.cs | 64 ++++++++++++++++++- osu.Game/osu.Game.csproj | 1 + 10 files changed, 158 insertions(+), 31 deletions(-) create mode 100644 osu.Game/Rulesets/Scoring/ScoreStatistic.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseResults.cs b/osu.Desktop.VisualTests/Tests/TestCaseResults.cs index 93e0646255..e023b54abe 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseResults.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseResults.cs @@ -7,6 +7,7 @@ using osu.Framework.Allocation; using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Database; +using osu.Game.Rulesets.Osu.Scoring; using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Ranking; using osu.Game.Users; @@ -40,13 +41,17 @@ namespace osu.Desktop.VisualTests.Tests base.Reset(); - Add(new Results(new Score + Add(new Results(new OsuScore { TotalScore = 2845370, Accuracy = 0.98, MaxCombo = 123, Rank = ScoreRank.A, Date = DateTime.Now, + Count300 = 100, + Count100 = 10, + Count50 = 1, + CountMiss = 2, User = new User { Username = "peppy", diff --git a/osu.Game.Rulesets.Osu/Scoring/OsuScore.cs b/osu.Game.Rulesets.Osu/Scoring/OsuScore.cs index c73cfe3338..248576b21d 100644 --- a/osu.Game.Rulesets.Osu/Scoring/OsuScore.cs +++ b/osu.Game.Rulesets.Osu/Scoring/OsuScore.cs @@ -1,11 +1,23 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.Generic; using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Osu.Scoring { - internal class OsuScore : Score + public class OsuScore : Score { + public int Count300; + public int Count100; + public int Count50; + public int CountMiss; + + public override IEnumerable Statistics => new[] { + new ScoreStatistic(@"300", Count300), + new ScoreStatistic(@"100", Count100), + new ScoreStatistic(@"50", Count50), + new ScoreStatistic(@"x", CountMiss), + }; } } diff --git a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs index 0c38f66abe..45253e0793 100644 --- a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs +++ b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs @@ -1,9 +1,11 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.Generic; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Judgements; using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; @@ -26,12 +28,46 @@ namespace osu.Game.Rulesets.Osu.Scoring Health.Value = 1; Accuracy.Value = 1; + + scoreResultCounts.Clear(); + comboResultCounts.Clear(); + } + + private readonly Dictionary scoreResultCounts = new Dictionary(); + private readonly Dictionary comboResultCounts = new Dictionary(); + + public override Score CreateEmptyScore() => new OsuScore(); + + public override Score GetPopulatedScore() + { + var score = (OsuScore)base.GetPopulatedScore(); + + scoreResultCounts.TryGetValue(OsuScoreResult.Hit300, out score.Count300); + scoreResultCounts.TryGetValue(OsuScoreResult.Hit100, out score.Count100); + scoreResultCounts.TryGetValue(OsuScoreResult.Hit50, out score.Count50); + scoreResultCounts.TryGetValue(OsuScoreResult.Miss, out score.CountMiss); + + return score; } protected override void OnNewJudgement(OsuJudgement judgement) { if (judgement != null) { + if (judgement.Result != HitResult.None) + { + int count; + if (scoreResultCounts.TryGetValue(judgement.Score, out count)) + scoreResultCounts[judgement.Score] = count + 1; + else + scoreResultCounts[judgement.Score] = 0; + + if (comboResultCounts.TryGetValue(judgement.Combo, out count)) + comboResultCounts[judgement.Combo] = count + 1; + else + comboResultCounts[judgement.Combo] = 0; + } + switch (judgement.Result) { case HitResult.Hit: diff --git a/osu.Game/Database/ScoreDatabase.cs b/osu.Game/Database/ScoreDatabase.cs index 359728070f..9dacf26e33 100644 --- a/osu.Game/Database/ScoreDatabase.cs +++ b/osu.Game/Database/ScoreDatabase.cs @@ -43,7 +43,7 @@ namespace osu.Game.Database using (SerializationReader sr = new SerializationReader(s)) { var ruleset = rulesets.GetRuleset(sr.ReadByte()).CreateInstance(); - score = ruleset.CreateScoreProcessor().CreateScore(); + score = ruleset.CreateScoreProcessor().CreateEmptyScore(); /* score.Pass = true;*/ var version = sr.ReadInt32(); diff --git a/osu.Game/Rulesets/Scoring/Score.cs b/osu.Game/Rulesets/Scoring/Score.cs index cb7831b04a..bb72237524 100644 --- a/osu.Game/Rulesets/Scoring/Score.cs +++ b/osu.Game/Rulesets/Scoring/Score.cs @@ -93,21 +93,6 @@ namespace osu.Game.Rulesets.Scoring return new Replay { Frames = frames }; } - // [JsonProperty(@"count50")] 0, - //[JsonProperty(@"count100")] 0, - //[JsonProperty(@"count300")] 100, - //[JsonProperty(@"countmiss")] 0, - //[JsonProperty(@"countkatu")] 0, - //[JsonProperty(@"countgeki")] 31, - //[JsonProperty(@"perfect")] true, - //[JsonProperty(@"enabled_mods")] [ - // "DT", - // "FL", - // "HD", - // "HR" - //], - //[JsonProperty(@"rank")] "XH", - //[JsonProperty(@"pp")] 26.1816, - //[JsonProperty(@"replay")] true + public virtual IEnumerable Statistics => new ScoreStatistic[] { }; } } diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 39008c5889..1fe21c8724 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -65,16 +65,7 @@ namespace osu.Game.Rulesets.Scoring /// Creates a Score applicable to the ruleset in which this ScoreProcessor resides. /// /// The Score. - public virtual Score CreateScore() => new Score - { - TotalScore = TotalScore, - Combo = Combo, - MaxCombo = HighestCombo, - Accuracy = Accuracy, - Rank = rankFrom(Accuracy), - Date = DateTime.Now, - Health = Health, - }; + public virtual Score CreateEmptyScore() => new Score(); private ScoreRank rankFrom(double acc) { @@ -119,6 +110,24 @@ namespace osu.Game.Rulesets.Scoring alreadyFailed = true; Failed?.Invoke(); } + + /// + /// Retrieve a score populated with data for the current play this processor is responsible for. + /// + public virtual Score GetPopulatedScore() + { + var score = CreateEmptyScore(); + + score.TotalScore = TotalScore; + score.Combo = Combo; + score.MaxCombo = HighestCombo; + score.Accuracy = Accuracy; + score.Rank = rankFrom(Accuracy); + score.Date = DateTime.Now; + score.Health = Health; + + return score; + } } public abstract class ScoreProcessor : ScoreProcessor diff --git a/osu.Game/Rulesets/Scoring/ScoreStatistic.cs b/osu.Game/Rulesets/Scoring/ScoreStatistic.cs new file mode 100644 index 0000000000..5d1011e829 --- /dev/null +++ b/osu.Game/Rulesets/Scoring/ScoreStatistic.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Rulesets.Scoring +{ + public class ScoreStatistic + { + public readonly string Name; + public readonly object Value; + + public ScoreStatistic(string name, object value) + { + Name = name; + Value = value; + } + } +} diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 52518180d9..8c3f3da58a 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -266,7 +266,7 @@ namespace osu.Game.Screens.Play Delay(1000); onCompletionEvent = Schedule(delegate { - var score = scoreProcessor.CreateScore(); + var score = scoreProcessor.GetPopulatedScore(); score.User = HitRenderer.Replay?.User ?? (Game as OsuGame)?.API?.LocalUser?.Value; Push(new Results(score)); }); diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index 0874767f05..0d485121ed 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -23,6 +23,7 @@ using osu.Game.Beatmaps; using osu.Game.Screens.Play; using osu.Game.Rulesets.Scoring; using osu.Framework.Graphics.Colour; +using System.Linq; namespace osu.Game.Screens.Ranking { @@ -32,6 +33,8 @@ namespace osu.Game.Screens.Ranking public ResultsPageScore(Score score, WorkingBeatmap beatmap) : base(score, beatmap) { } + private FillFlowContainer statisticsContainer; + [BackgroundDependencyLoader] private void load(OsuColour colours) { @@ -148,15 +151,74 @@ namespace osu.Game.Screens.Ranking }, } }, + statisticsContainer = new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Direction = FillDirection.Horizontal, + LayoutDuration = 200, + LayoutEasing = EasingTypes.OutQuint + } } } }; + + statisticsContainer.Children = Score.Statistics.Select(s => new DrawableScoreStatistic(s)); } protected override void LoadComplete() { base.LoadComplete(); - Schedule(() => scoreCounter.Increment(Score.TotalScore)); + + Schedule(() => + { + scoreCounter.Increment(Score.TotalScore); + + int delay = 0; + foreach (var s in statisticsContainer.Children) + { + s.FadeOut(); + s.Delay(delay += 200); + s.FadeIn(300 + delay, EasingTypes.Out); + } + }); + } + + private class DrawableScoreStatistic : Container + { + private readonly ScoreStatistic statistic; + + public DrawableScoreStatistic(ScoreStatistic statistic) + { + this.statistic = statistic; + + AutoSizeAxes = Axes.Both; + Margin = new MarginPadding { Left = 5, Right = 5 }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Children = new Drawable[] + { + new SpriteText { + Text = statistic.Value.ToString().PadLeft(4, '0'), + Colour = colours.Gray7, + TextSize = 30, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + }, + new SpriteText { + Text = statistic.Name, + Colour = colours.Gray7, + Font = @"Exo2.0-Bold", + Y = 26, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + }, + }; + } } private class DateDisplay : Container diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index fe331c6356..4ee1aa0b32 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -153,6 +153,7 @@ + From 1f7ed72dc6697d8f04813dda30ce1ac535497f0b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 19 Apr 2017 17:32:18 +0900 Subject: [PATCH 284/442] Update font/size. --- osu-resources | 2 +- osu.Game/OsuGameBase.cs | 1 + osu.Game/Screens/Ranking/ResultsPageScore.cs | 5 +++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/osu-resources b/osu-resources index ce76f812d3..b90c4ed490 160000 --- a/osu-resources +++ b/osu-resources @@ -1 +1 @@ -Subproject commit ce76f812d3e059233e1dea395b125352f638b2da +Subproject commit b90c4ed490f76f2995662b3a8af3a32b8756a012 diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 371699eab3..efda7ff7a0 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -116,6 +116,7 @@ namespace osu.Game Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-BlackItalic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Venera")); + Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Venera-Light")); OszArchiveReader.Register(); diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index 0874767f05..5a6d492778 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -92,8 +92,8 @@ namespace osu.Game.Screens.Ranking Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Colour = colours.PinkDarker, - Y = 5, - TextSize = 60, + Y = 10, + TextSize = 56, }, } }, @@ -321,6 +321,7 @@ namespace osu.Game.Screens.Ranking public SlowScoreCounter(uint leading = 0) : base(leading) { DisplayedCountSpriteText.Shadow = false; + DisplayedCountSpriteText.Font = @"Venera-Light"; UseCommaSeparator = true; } } From 325af333b903ede960ab8b1c5861ccdb4ca615bf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 19 Apr 2017 17:39:57 +0900 Subject: [PATCH 285/442] Update API responses for chat. --- osu.Game/Online/Chat/Message.cs | 16 ++++++++++++++-- osu.Game/Overlays/ChatOverlay.cs | 6 +++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/osu.Game/Online/Chat/Message.cs b/osu.Game/Online/Chat/Message.cs index b267cf63ac..5d781459e8 100644 --- a/osu.Game/Online/Chat/Message.cs +++ b/osu.Game/Online/Chat/Message.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.ComponentModel; using Newtonsoft.Json; using osu.Game.Users; @@ -16,8 +17,11 @@ namespace osu.Game.Online.Chat [JsonProperty(@"user_id")] public int UserId; - [JsonProperty(@"channel_id")] - public int ChannelId; + [JsonProperty(@"target_type")] + public TargetType TargetType; + + [JsonProperty(@"target_id")] + public int TargetId; [JsonProperty(@"timestamp")] public DateTimeOffset Timestamp; @@ -33,4 +37,12 @@ namespace osu.Game.Online.Chat { } } + + public enum TargetType + { + [Description(@"channel")] + Channel, + [Description(@"user")] + User + } } diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index fc12789b05..db0d89edc7 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -136,11 +136,11 @@ namespace osu.Game.Overlays fetchReq = new GetMessagesRequest(careChannels, lastMessageId); fetchReq.Success += delegate (List messages) { - var ids = messages.Select(m => m.ChannelId).Distinct(); - + var ids = messages.Where(m => m.TargetType == TargetType.Channel).Select(m => m.TargetId).Distinct(); + //batch messages per channel. foreach (var id in ids) - careChannels.Find(c => c.Id == id)?.AddNewMessages(messages.Where(m => m.ChannelId == id)); + careChannels.Find(c => c.Id == id)?.AddNewMessages(messages.Where(m => m.TargetId == id)); lastMessageId = messages.LastOrDefault()?.Id ?? lastMessageId; From 87f6dc9e5abc0e35da383211c77a5b4278873693 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 19 Apr 2017 18:45:33 +0900 Subject: [PATCH 286/442] Change default channel to #lazer. --- osu.Game/Overlays/ChatOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index db0d89edc7..2f1b21dd7b 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -211,7 +211,7 @@ namespace osu.Game.Overlays Scheduler.Add(delegate { loading.FadeOut(100); - addChannel(channels.Find(c => c.Name == @"#osu")); + addChannel(channels.Find(c => c.Name == @"#lazer")); }); //addChannel(channels.Find(c => c.Name == @"#lobby")); From 3129708ccb66ca9c2704c0cff7517b0e1e08da1e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 19 Apr 2017 18:46:26 +0900 Subject: [PATCH 287/442] Add chat sending support. --- .../Online/API/Requests/PostMessageRequest.cs | 33 +++++++++++++ osu.Game/Online/Chat/Channel.cs | 7 ++- osu.Game/Online/Chat/Message.cs | 14 +++++- osu.Game/Overlays/ChatOverlay.cs | 49 +++++++++++++------ osu.Game/osu.Game.csproj | 1 + 5 files changed, 87 insertions(+), 17 deletions(-) create mode 100644 osu.Game/Online/API/Requests/PostMessageRequest.cs diff --git a/osu.Game/Online/API/Requests/PostMessageRequest.cs b/osu.Game/Online/API/Requests/PostMessageRequest.cs new file mode 100644 index 0000000000..52269d9fe8 --- /dev/null +++ b/osu.Game/Online/API/Requests/PostMessageRequest.cs @@ -0,0 +1,33 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Extensions; +using osu.Framework.IO.Network; +using osu.Game.Online.Chat; + +namespace osu.Game.Online.API.Requests +{ + public class PostMessageRequest : APIRequest + { + private readonly Message message; + + public PostMessageRequest(Message message) + { + this.message = message; + } + + protected override WebRequest CreateWebRequest() + { + var req = base.CreateWebRequest(); + + req.Method = HttpMethod.POST; + req.AddParameter(@"target_type", message.TargetType.GetDescription()); + req.AddParameter(@"target_id", message.TargetId.ToString()); + req.AddParameter(@"message", message.Content); + + return req; + } + + protected override string Target => @"chat/messages"; + } +} \ No newline at end of file diff --git a/osu.Game/Online/Chat/Channel.cs b/osu.Game/Online/Chat/Channel.cs index d895b93336..04ebf0a389 100644 --- a/osu.Game/Online/Chat/Channel.cs +++ b/osu.Game/Online/Chat/Channel.cs @@ -3,7 +3,9 @@ using System; using System.Collections.Generic; +using System.Linq; using Newtonsoft.Json; +using osu.Framework.Lists; namespace osu.Game.Online.Chat { @@ -21,7 +23,7 @@ namespace osu.Game.Online.Chat [JsonProperty(@"channel_id")] public int Id; - public List Messages = new List(); + public SortedList Messages = new SortedList((m1, m2) => m1.Id.CompareTo(m2.Id)); //internal bool Joined; @@ -36,7 +38,10 @@ namespace osu.Game.Online.Chat public void AddNewMessages(IEnumerable messages) { + messages = messages.Except(Messages).ToList(); + Messages.AddRange(messages); + purgeOldMessages(); NewMessagesArrived?.Invoke(messages); diff --git a/osu.Game/Online/Chat/Message.cs b/osu.Game/Online/Chat/Message.cs index 5d781459e8..2404bbe109 100644 --- a/osu.Game/Online/Chat/Message.cs +++ b/osu.Game/Online/Chat/Message.cs @@ -11,7 +11,7 @@ namespace osu.Game.Online.Chat public class Message { [JsonProperty(@"message_id")] - public long Id; + public readonly long Id; //todo: this should be inside sender. [JsonProperty(@"user_id")] @@ -36,6 +36,18 @@ namespace osu.Game.Online.Chat public Message() { } + + public override bool Equals(object obj) + { + var objMessage = obj as Message; + + return Id == objMessage?.Id; + } + + public override int GetHashCode() + { + return Id.GetHashCode(); + } } public enum TargetType diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 2f1b21dd7b..5b9d30ee8e 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -89,25 +89,44 @@ namespace osu.Game.Overlays return false; } - private void postMessage(TextBox sender, bool newText) + private void postMessage(TextBox textbox, bool newText) { - var postText = sender.Text; + var postText = textbox.Text; if (!string.IsNullOrEmpty(postText) && api.LocalUser.Value != null) { - //todo: actually send to server - careChannels.FirstOrDefault()?.AddNewMessages(new[] - { - new Message - { - User = api.LocalUser.Value, - Timestamp = DateTimeOffset.Now, - Content = postText - } - }); - } + var currentChannel = careChannels.FirstOrDefault(); - sender.Text = string.Empty; + if (currentChannel == null) return; + + var message = new Message + { + User = api.LocalUser.Value, + Timestamp = DateTimeOffset.Now, + TargetType = TargetType.Channel, //TODO: read this from currentChannel + TargetId = currentChannel.Id, + Content = postText + }; + + textbox.ReadOnly = true; + var req = new PostMessageRequest(message); + + req.Failure += e => + { + textbox.FlashColour(Color4.Red, 1000); + textbox.ReadOnly = false; + }; + + req.Success += m => + { + currentChannel.AddNewMessages(new[] { m }); + + textbox.ReadOnly = false; + textbox.Text = string.Empty; + }; + + api.Queue(req); + } } [BackgroundDependencyLoader] @@ -137,7 +156,7 @@ namespace osu.Game.Overlays fetchReq.Success += delegate (List messages) { var ids = messages.Where(m => m.TargetType == TargetType.Channel).Select(m => m.TargetId).Distinct(); - + //batch messages per channel. foreach (var id in ids) careChannels.Find(c => c.Id == id)?.AddNewMessages(messages.Where(m => m.TargetId == id)); diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 8421f89058..6987776376 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -72,6 +72,7 @@ + From dda3fb85ee54341678d5064d177c939c3d1541a4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 19 Apr 2017 19:07:38 +0900 Subject: [PATCH 288/442] Add user colour support. --- osu.Game/Online/Chat/Drawables/ChatLine.cs | 5 ++++- osu.Game/Online/Chat/Message.cs | 4 ++-- osu.Game/Overlays/ChatOverlay.cs | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/osu.Game/Online/Chat/Drawables/ChatLine.cs b/osu.Game/Online/Chat/Drawables/ChatLine.cs index bfbcf3d707..59e83fd385 100644 --- a/osu.Game/Online/Chat/Drawables/ChatLine.cs +++ b/osu.Game/Online/Chat/Drawables/ChatLine.cs @@ -55,6 +55,9 @@ namespace osu.Game.Online.Chat.Drawables private Color4 getUsernameColour(Message message) { + if (!string.IsNullOrEmpty(message.Sender?.Colour)) + return OsuColour.FromHex(message.Sender.Colour); + //todo: use User instead of Message when user_id is correctly populated. return username_colours[message.UserId % username_colours.Length]; } @@ -91,7 +94,7 @@ namespace osu.Game.Online.Chat.Drawables new OsuSpriteText { Font = @"Exo2.0-BoldItalic", - Text = $@"{Message.User.Username}:", + Text = $@"{Message.Sender.Username}:", Colour = getUsernameColour(Message), TextSize = text_size, Origin = Anchor.TopRight, diff --git a/osu.Game/Online/Chat/Message.cs b/osu.Game/Online/Chat/Message.cs index 2404bbe109..372e43be38 100644 --- a/osu.Game/Online/Chat/Message.cs +++ b/osu.Game/Online/Chat/Message.cs @@ -14,7 +14,7 @@ namespace osu.Game.Online.Chat public readonly long Id; //todo: this should be inside sender. - [JsonProperty(@"user_id")] + [JsonProperty(@"sender_id")] public int UserId; [JsonProperty(@"target_type")] @@ -30,7 +30,7 @@ namespace osu.Game.Online.Chat public string Content; [JsonProperty(@"sender")] - public User User; + public User Sender; [JsonConstructor] public Message() diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 5b9d30ee8e..9b3cdaf49d 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -101,7 +101,7 @@ namespace osu.Game.Overlays var message = new Message { - User = api.LocalUser.Value, + Sender = api.LocalUser.Value, Timestamp = DateTimeOffset.Now, TargetType = TargetType.Channel, //TODO: read this from currentChannel TargetId = currentChannel.Id, From c7246fd2ac4047d4f0a6b64c703be3a168bb1b23 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 19 Apr 2017 19:15:21 +0900 Subject: [PATCH 289/442] Reorganise ChatOverlay to not suck. --- osu.Game/Overlays/ChatOverlay.cs | 218 +++++++++++++++---------------- 1 file changed, 106 insertions(+), 112 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 9b3cdaf49d..457611dfab 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -38,6 +38,10 @@ namespace osu.Game.Overlays private APIAccess api; + private const int transition_length = 500; + + private GetMessagesRequest fetchReq; + public ChatOverlay() { RelativeSizeAxes = Axes.X; @@ -82,6 +86,19 @@ namespace osu.Game.Overlays }); } + public void APIStateChanged(APIAccess api, APIState state) + { + switch (state) + { + case APIState.Online: + initializeChannels(); + break; + default: + messageRequest?.Cancel(); + break; + } + } + protected override bool OnFocus(InputState state) { //this is necessary as inputTextBox is masked away and therefore can't get focus :( @@ -89,6 +106,95 @@ namespace osu.Game.Overlays return false; } + protected override void PopIn() + { + MoveToY(0, transition_length, EasingTypes.OutQuint); + FadeIn(transition_length, EasingTypes.OutQuint); + } + + protected override void PopOut() + { + MoveToY(DrawSize.Y, transition_length, EasingTypes.InSine); + FadeOut(transition_length, EasingTypes.InSine); + } + + [BackgroundDependencyLoader] + private void load(APIAccess api) + { + this.api = api; + api.Register(this); + } + + private long? lastMessageId; + + private List careChannels; + + private void initializeChannels() + { + Clear(); + + careChannels = new List(); + + SpriteText loading; + Add(loading = new OsuSpriteText + { + Text = @"initialising chat...", + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + TextSize = 40, + }); + + messageRequest?.Cancel(); + + ListChannelsRequest req = new ListChannelsRequest(); + req.Success += delegate (List channels) + { + Debug.Assert(careChannels.Count == 0); + + Scheduler.Add(delegate + { + loading.FadeOut(100); + addChannel(channels.Find(c => c.Name == @"#lazer")); + }); + + messageRequest = Scheduler.AddDelayed(fetchNewMessages, 1000, true); + }; + api.Queue(req); + } + + private void addChannel(Channel channel) + { + Add(new DrawableChannel(channel)); + careChannels.Add(channel); + } + + private void fetchNewMessages() + { + if (fetchReq != null) return; + + fetchReq = new GetMessagesRequest(careChannels, lastMessageId); + fetchReq.Success += delegate (List messages) + { + var ids = messages.Where(m => m.TargetType == TargetType.Channel).Select(m => m.TargetId).Distinct(); + + //batch messages per channel. + foreach (var id in ids) + careChannels.Find(c => c.Id == id)?.AddNewMessages(messages.Where(m => m.TargetId == id)); + + lastMessageId = messages.LastOrDefault()?.Id ?? lastMessageId; + + Debug.Write("success!"); + fetchReq = null; + }; + fetchReq.Failure += delegate + { + Debug.Write("failure!"); + fetchReq = null; + }; + + api.Queue(fetchReq); + } + private void postMessage(TextBox textbox, bool newText) { var postText = textbox.Text; @@ -128,117 +234,5 @@ namespace osu.Game.Overlays api.Queue(req); } } - - [BackgroundDependencyLoader] - private void load(APIAccess api) - { - this.api = api; - api.Register(this); - } - - private long? lastMessageId; - - private List careChannels; - - private void addChannel(Channel channel) - { - Add(new DrawableChannel(channel)); - careChannels.Add(channel); - } - - private GetMessagesRequest fetchReq; - - public void FetchNewMessages(APIAccess api) - { - if (fetchReq != null) return; - - fetchReq = new GetMessagesRequest(careChannels, lastMessageId); - fetchReq.Success += delegate (List messages) - { - var ids = messages.Where(m => m.TargetType == TargetType.Channel).Select(m => m.TargetId).Distinct(); - - //batch messages per channel. - foreach (var id in ids) - careChannels.Find(c => c.Id == id)?.AddNewMessages(messages.Where(m => m.TargetId == id)); - - lastMessageId = messages.LastOrDefault()?.Id ?? lastMessageId; - - Debug.Write("success!"); - fetchReq = null; - }; - fetchReq.Failure += delegate - { - Debug.Write("failure!"); - fetchReq = null; - }; - - api.Queue(fetchReq); - } - - private const int transition_length = 500; - - protected override void PopIn() - { - MoveToY(0, transition_length, EasingTypes.OutQuint); - FadeIn(transition_length, EasingTypes.OutQuint); - } - - protected override void PopOut() - { - MoveToY(DrawSize.Y, transition_length, EasingTypes.InSine); - FadeOut(transition_length, EasingTypes.InSine); - } - - public void APIStateChanged(APIAccess api, APIState state) - { - switch (state) - { - case APIState.Online: - initializeChannels(); - break; - default: - messageRequest?.Cancel(); - break; - } - } - - private void initializeChannels() - { - Clear(); - - careChannels = new List(); - - //if (api.State != APIAccess.APIState.Online) - // return; - - SpriteText loading; - Add(loading = new OsuSpriteText - { - Text = @"Loading available channels...", - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - TextSize = 40, - }); - - messageRequest?.Cancel(); - - ListChannelsRequest req = new ListChannelsRequest(); - req.Success += delegate (List channels) - { - Debug.Assert(careChannels.Count == 0); - - Scheduler.Add(delegate - { - loading.FadeOut(100); - addChannel(channels.Find(c => c.Name == @"#lazer")); - }); - - //addChannel(channels.Find(c => c.Name == @"#lobby")); - //addChannel(channels.Find(c => c.Name == @"#english")); - - messageRequest = Scheduler.AddDelayed(() => FetchNewMessages(api), 1000, true); - }; - api.Queue(req); - } } } From 093abd6872316d586195598bc49880db5f53461a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 19 Apr 2017 19:54:03 +0900 Subject: [PATCH 290/442] Add chat toggle button. --- osu.Game/OsuGame.cs | 1 + osu.Game/Overlays/Toolbar/Toolbar.cs | 1 + .../Overlays/Toolbar/ToolbarChatButton.cs | 23 +++++++++++++++++++ osu.Game/osu.Game.csproj | 1 + 4 files changed, 26 insertions(+) create mode 100644 osu.Game/Overlays/Toolbar/ToolbarChatButton.cs diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index cd89f4bdc7..a139c4d6ce 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -194,6 +194,7 @@ namespace osu.Game }; Dependencies.Cache(options); + Dependencies.Cache(chat); Dependencies.Cache(musicController); Dependencies.Cache(notificationManager); Dependencies.Cache(dialogOverlay); diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index 1fd19af557..a5074100c7 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -72,6 +72,7 @@ namespace osu.Game.Overlays.Toolbar AutoSizeAxes = Axes.X, Children = new Drawable[] { + new ToolbarChatButton(), new ToolbarMusicButton(), new ToolbarButton { diff --git a/osu.Game/Overlays/Toolbar/ToolbarChatButton.cs b/osu.Game/Overlays/Toolbar/ToolbarChatButton.cs new file mode 100644 index 0000000000..ca612662e1 --- /dev/null +++ b/osu.Game/Overlays/Toolbar/ToolbarChatButton.cs @@ -0,0 +1,23 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Game.Graphics; + +namespace osu.Game.Overlays.Toolbar +{ + internal class ToolbarChatButton : ToolbarOverlayToggleButton + { + public ToolbarChatButton() + { + Icon = FontAwesome.fa_comments; + } + + [BackgroundDependencyLoader] + private void load(ChatOverlay chat) + { + StateContainer = chat; + Action = chat.ToggleVisibility; + } + } +} \ No newline at end of file diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 6987776376..b17823759d 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -73,6 +73,7 @@ + From efbe471cdafe77cbf47b7b93715339f14f1c31ba Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 19 Apr 2017 20:28:51 +0900 Subject: [PATCH 291/442] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 21a97586f7..dc4ea5be42 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 21a97586f7fa8d9aa65b4131824151d88a70b520 +Subproject commit dc4ea5be425d37f3a0dd09f6acdf6799d42e3d74 From 8e4288168a1a27383c33fe598eb44ff0c51e8ee1 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Wed, 19 Apr 2017 13:47:00 +0200 Subject: [PATCH 292/442] renaming and some changes in TestCaseTooltip --- .../Tests/TestCaseTooltip.cs | 25 +++++++++++-------- osu.Game/Graphics/Cursor/IHasTooltip.cs | 20 ++++++++------- osu.Game/Graphics/Cursor/Tooltip.cs | 20 ++++++++------- 3 files changed, 36 insertions(+), 29 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs b/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs index 870a9f3397..30e486d2b1 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs @@ -33,7 +33,10 @@ namespace osu.Desktop.VisualTests.Tests Children = new Drawable[] { new TooltipContainer("Text with some tooltip"), - new TooltipContainer("and another one"), + new TooltipContainer("and another one with a custom delay") + { + TooltipDelay = 1000, + }, new TooltipTextbox { Text = "a box with a tooltip", @@ -54,11 +57,13 @@ namespace osu.Desktop.VisualTests.Tests }); } - private class TooltipContainer : Container, IHasTooltip + private class TooltipContainer : Container, IHasTooltipWithCustomDelay { private readonly OsuSpriteText text; - public string Tooltip => text.Text; + public string TooltipText => text.Text; + + public int TooltipDelay { get; set; } = Tooltip.DEFAULT_APPEAR_DELAY; public TooltipContainer(string tooltipText) { @@ -75,26 +80,24 @@ namespace osu.Desktop.VisualTests.Tests private class TooltipTextbox : OsuTextBox, IHasTooltip { - public string Tooltip => Text; + public string TooltipText => Text; } - private class TooltipSlider : OsuSliderBar, IHasDelayedTooltip, IHasOverhangingTooltip + private class TooltipSlider : OsuSliderBar, IHasDisappearingTooltip { - public string Tooltip => Current.Value.ToString(); + public string TooltipText => Current.Value.ToString(); - int IHasDelayedTooltip.Delay => Overhanging ? 0 : 250; - - public bool Overhanging { get; set; } + public bool Disappear { get; set; } = true; protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { - Overhanging = true; + Disappear = false; return base.OnMouseDown(state, args); } protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) { - Overhanging = false; + Disappear = true; return base.OnMouseUp(state, args); } } diff --git a/osu.Game/Graphics/Cursor/IHasTooltip.cs b/osu.Game/Graphics/Cursor/IHasTooltip.cs index 576175ff93..e7b6637f2a 100644 --- a/osu.Game/Graphics/Cursor/IHasTooltip.cs +++ b/osu.Game/Graphics/Cursor/IHasTooltip.cs @@ -1,35 +1,37 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework.Graphics; + namespace osu.Game.Graphics.Cursor { - public interface IHasTooltip + public interface IHasTooltip : IDrawable { /// - /// Tooltip that shows when hovering the object + /// Tooltip that shows when hovering the drawable /// - string Tooltip { get; } + string TooltipText { get; } } /// /// Tooltip with custom appear time /// - public interface IHasDelayedTooltip : IHasTooltip + public interface IHasTooltipWithCustomDelay : IHasTooltip { /// /// Time until the tooltip appears (in milliseconds) /// - int Delay { get; } + int TooltipDelay { get; } } /// - /// Tooltip which can show after hovering over the object + /// Tooltip which can decide when to disappear /// - public interface IHasOverhangingTooltip : IHasTooltip + public interface IHasDisappearingTooltip : IHasTooltip { /// - /// Should the tooltip still show? + /// Should the tooltip disappear? /// - bool Overhanging { get; } + bool Disappear { get; } } } diff --git a/osu.Game/Graphics/Cursor/Tooltip.cs b/osu.Game/Graphics/Cursor/Tooltip.cs index 86751ddd65..1efbdf6ba8 100644 --- a/osu.Game/Graphics/Cursor/Tooltip.cs +++ b/osu.Game/Graphics/Cursor/Tooltip.cs @@ -22,7 +22,9 @@ namespace osu.Game.Graphics.Cursor private ScheduledDelegate show; private UserInputManager input; - private IHasOverhangingTooltip overhang; + private IHasDisappearingTooltip disappearingTooltip; + + public const int DEFAULT_APPEAR_DELAY = 250; public string TooltipText { get @@ -43,16 +45,16 @@ namespace osu.Game.Graphics.Cursor { set { - if (value.Position != value.LastPosition && overhang?.Overhanging != true) + if (value.Position != value.LastPosition && disappearingTooltip?.Disappear != false) { show?.Cancel(); TooltipText = string.Empty; IHasTooltip hasTooltip = input.HoveredDrawables.OfType().FirstOrDefault(); if (hasTooltip != null) { - IHasDelayedTooltip delayedTooltip = hasTooltip as IHasDelayedTooltip; - overhang = hasTooltip as IHasOverhangingTooltip; - show = Scheduler.AddDelayed(() => TooltipText = hasTooltip.Tooltip, delayedTooltip?.Delay ?? 250); + IHasTooltipWithCustomDelay delayedTooltip = hasTooltip as IHasTooltipWithCustomDelay; + disappearingTooltip = hasTooltip as IHasDisappearingTooltip; + show = Scheduler.AddDelayed(() => TooltipText = hasTooltip.TooltipText, delayedTooltip?.TooltipDelay ?? DEFAULT_APPEAR_DELAY); } } } @@ -99,11 +101,11 @@ namespace osu.Game.Graphics.Cursor protected override void Update() { - if (overhang?.Overhanging ?? false) - TooltipText = overhang.Tooltip; - else if (overhang != null) + if (disappearingTooltip?.Disappear == false) + TooltipText = disappearingTooltip.TooltipText; + else if (disappearingTooltip != null) { - overhang = null; + disappearingTooltip = null; TooltipText = string.Empty; } } From 4f9c5dd44dbebf9c951a634273eefaaf639f03fc Mon Sep 17 00:00:00 2001 From: Jorolf Date: Wed, 19 Apr 2017 13:47:00 +0200 Subject: [PATCH 293/442] renaming and some changes in TestCaseTooltip --- .../Tests/TestCaseTooltip.cs | 25 +++++++++++-------- osu.Game/Graphics/Cursor/IHasTooltip.cs | 20 ++++++++------- osu.Game/Graphics/Cursor/MenuCursor.cs | 2 +- osu.Game/Graphics/Cursor/Tooltip.cs | 20 ++++++++------- 4 files changed, 37 insertions(+), 30 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs b/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs index 870a9f3397..30e486d2b1 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs @@ -33,7 +33,10 @@ namespace osu.Desktop.VisualTests.Tests Children = new Drawable[] { new TooltipContainer("Text with some tooltip"), - new TooltipContainer("and another one"), + new TooltipContainer("and another one with a custom delay") + { + TooltipDelay = 1000, + }, new TooltipTextbox { Text = "a box with a tooltip", @@ -54,11 +57,13 @@ namespace osu.Desktop.VisualTests.Tests }); } - private class TooltipContainer : Container, IHasTooltip + private class TooltipContainer : Container, IHasTooltipWithCustomDelay { private readonly OsuSpriteText text; - public string Tooltip => text.Text; + public string TooltipText => text.Text; + + public int TooltipDelay { get; set; } = Tooltip.DEFAULT_APPEAR_DELAY; public TooltipContainer(string tooltipText) { @@ -75,26 +80,24 @@ namespace osu.Desktop.VisualTests.Tests private class TooltipTextbox : OsuTextBox, IHasTooltip { - public string Tooltip => Text; + public string TooltipText => Text; } - private class TooltipSlider : OsuSliderBar, IHasDelayedTooltip, IHasOverhangingTooltip + private class TooltipSlider : OsuSliderBar, IHasDisappearingTooltip { - public string Tooltip => Current.Value.ToString(); + public string TooltipText => Current.Value.ToString(); - int IHasDelayedTooltip.Delay => Overhanging ? 0 : 250; - - public bool Overhanging { get; set; } + public bool Disappear { get; set; } = true; protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { - Overhanging = true; + Disappear = false; return base.OnMouseDown(state, args); } protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) { - Overhanging = false; + Disappear = true; return base.OnMouseUp(state, args); } } diff --git a/osu.Game/Graphics/Cursor/IHasTooltip.cs b/osu.Game/Graphics/Cursor/IHasTooltip.cs index 576175ff93..e7b6637f2a 100644 --- a/osu.Game/Graphics/Cursor/IHasTooltip.cs +++ b/osu.Game/Graphics/Cursor/IHasTooltip.cs @@ -1,35 +1,37 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework.Graphics; + namespace osu.Game.Graphics.Cursor { - public interface IHasTooltip + public interface IHasTooltip : IDrawable { /// - /// Tooltip that shows when hovering the object + /// Tooltip that shows when hovering the drawable /// - string Tooltip { get; } + string TooltipText { get; } } /// /// Tooltip with custom appear time /// - public interface IHasDelayedTooltip : IHasTooltip + public interface IHasTooltipWithCustomDelay : IHasTooltip { /// /// Time until the tooltip appears (in milliseconds) /// - int Delay { get; } + int TooltipDelay { get; } } /// - /// Tooltip which can show after hovering over the object + /// Tooltip which can decide when to disappear /// - public interface IHasOverhangingTooltip : IHasTooltip + public interface IHasDisappearingTooltip : IHasTooltip { /// - /// Should the tooltip still show? + /// Should the tooltip disappear? /// - bool Overhanging { get; } + bool Disappear { get; } } } diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index 21d64b795a..da89571b36 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -20,7 +20,7 @@ namespace osu.Game.Graphics.Cursor protected override Drawable CreateCursor() => new Cursor(); private bool dragging; - private Tooltip tooltip; + private readonly Tooltip tooltip; public MenuCursor() { diff --git a/osu.Game/Graphics/Cursor/Tooltip.cs b/osu.Game/Graphics/Cursor/Tooltip.cs index 86751ddd65..1efbdf6ba8 100644 --- a/osu.Game/Graphics/Cursor/Tooltip.cs +++ b/osu.Game/Graphics/Cursor/Tooltip.cs @@ -22,7 +22,9 @@ namespace osu.Game.Graphics.Cursor private ScheduledDelegate show; private UserInputManager input; - private IHasOverhangingTooltip overhang; + private IHasDisappearingTooltip disappearingTooltip; + + public const int DEFAULT_APPEAR_DELAY = 250; public string TooltipText { get @@ -43,16 +45,16 @@ namespace osu.Game.Graphics.Cursor { set { - if (value.Position != value.LastPosition && overhang?.Overhanging != true) + if (value.Position != value.LastPosition && disappearingTooltip?.Disappear != false) { show?.Cancel(); TooltipText = string.Empty; IHasTooltip hasTooltip = input.HoveredDrawables.OfType().FirstOrDefault(); if (hasTooltip != null) { - IHasDelayedTooltip delayedTooltip = hasTooltip as IHasDelayedTooltip; - overhang = hasTooltip as IHasOverhangingTooltip; - show = Scheduler.AddDelayed(() => TooltipText = hasTooltip.Tooltip, delayedTooltip?.Delay ?? 250); + IHasTooltipWithCustomDelay delayedTooltip = hasTooltip as IHasTooltipWithCustomDelay; + disappearingTooltip = hasTooltip as IHasDisappearingTooltip; + show = Scheduler.AddDelayed(() => TooltipText = hasTooltip.TooltipText, delayedTooltip?.TooltipDelay ?? DEFAULT_APPEAR_DELAY); } } } @@ -99,11 +101,11 @@ namespace osu.Game.Graphics.Cursor protected override void Update() { - if (overhang?.Overhanging ?? false) - TooltipText = overhang.Tooltip; - else if (overhang != null) + if (disappearingTooltip?.Disappear == false) + TooltipText = disappearingTooltip.TooltipText; + else if (disappearingTooltip != null) { - overhang = null; + disappearingTooltip = null; TooltipText = string.Empty; } } From fdf5f140dd901f3ba31a62c4cc38023aba5fac69 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 19 Apr 2017 21:02:31 +0900 Subject: [PATCH 294/442] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 21a97586f7..dc4ea5be42 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 21a97586f7fa8d9aa65b4131824151d88a70b520 +Subproject commit dc4ea5be425d37f3a0dd09f6acdf6799d42e3d74 From d04893a43aacd9efb1423309cc596d6382c32378 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Wed, 19 Apr 2017 15:01:05 +0200 Subject: [PATCH 295/442] ---changing--- --- .../Tests/TestCaseTooltip.cs | 10 +- osu.Game/Graphics/Cursor/MenuCursor.cs | 11 +- osu.Game/Graphics/Cursor/Tooltip.cs | 113 --------------- osu.Game/Graphics/Cursor/TooltipContainer.cs | 130 ++++++++++++++++++ osu.Game/osu.Game.csproj | 2 +- 5 files changed, 137 insertions(+), 129 deletions(-) delete mode 100644 osu.Game/Graphics/Cursor/Tooltip.cs create mode 100644 osu.Game/Graphics/Cursor/TooltipContainer.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs b/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs index 30e486d2b1..7ea36e2ad8 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs @@ -32,8 +32,8 @@ namespace osu.Desktop.VisualTests.Tests Spacing = new Vector2(0,10), Children = new Drawable[] { - new TooltipContainer("Text with some tooltip"), - new TooltipContainer("and another one with a custom delay") + new TooltipTextContainer("Text with some tooltip"), + new TooltipTextContainer("and another one with a custom delay") { TooltipDelay = 1000, }, @@ -57,15 +57,15 @@ namespace osu.Desktop.VisualTests.Tests }); } - private class TooltipContainer : Container, IHasTooltipWithCustomDelay + private class TooltipTextContainer : Container, IHasTooltipWithCustomDelay { private readonly OsuSpriteText text; public string TooltipText => text.Text; - public int TooltipDelay { get; set; } = Tooltip.DEFAULT_APPEAR_DELAY; + public int TooltipDelay { get; set; } = TooltipContainer.DEFAULT_APPEAR_DELAY; - public TooltipContainer(string tooltipText) + public TooltipTextContainer(string tooltipText) { AutoSizeAxes = Axes.Both; Children = new[] diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index da89571b36..ceb3296bdf 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -20,12 +20,6 @@ namespace osu.Game.Graphics.Cursor protected override Drawable CreateCursor() => new Cursor(); private bool dragging; - private readonly Tooltip tooltip; - - public MenuCursor() - { - Add(tooltip = new Tooltip()); - } protected override bool OnMouseMove(InputState state) { @@ -43,9 +37,6 @@ namespace osu.Game.Graphics.Cursor ActiveCursor.RotateTo(degrees, 600, EasingTypes.OutQuint); } - tooltip.Position = new Vector2(state.Mouse.Position.X,Math.Min(ActiveCursor.BoundingBox.Bottom, state.Mouse.Position.Y + ActiveCursor.DrawHeight)); - tooltip.MouseState = state.Mouse; - return base.OnMouseMove(state); } @@ -107,7 +98,7 @@ namespace osu.Game.Graphics.Cursor public Cursor() { - AutoSizeAxes = Axes.Both; + Size = new Vector2(42); } [BackgroundDependencyLoader] diff --git a/osu.Game/Graphics/Cursor/Tooltip.cs b/osu.Game/Graphics/Cursor/Tooltip.cs deleted file mode 100644 index 1efbdf6ba8..0000000000 --- a/osu.Game/Graphics/Cursor/Tooltip.cs +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using OpenTK.Graphics; -using osu.Framework.Allocation; -using osu.Framework.Extensions.Color4Extensions; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Primitives; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; -using osu.Framework.Threading; -using osu.Game.Graphics.Sprites; -using System.Linq; - -namespace osu.Game.Graphics.Cursor -{ - public class Tooltip : Container - { - private readonly Box tooltipBackground; - private readonly OsuSpriteText text; - - private ScheduledDelegate show; - private UserInputManager input; - private IHasDisappearingTooltip disappearingTooltip; - - public const int DEFAULT_APPEAR_DELAY = 250; - - public string TooltipText { - get - { - return text.Text; - } - set - { - text.Text = value; - if (string.IsNullOrEmpty(value)) - Hide(); - else - Show(); - } - } - - public IMouseState MouseState - { - set - { - if (value.Position != value.LastPosition && disappearingTooltip?.Disappear != false) - { - show?.Cancel(); - TooltipText = string.Empty; - IHasTooltip hasTooltip = input.HoveredDrawables.OfType().FirstOrDefault(); - if (hasTooltip != null) - { - IHasTooltipWithCustomDelay delayedTooltip = hasTooltip as IHasTooltipWithCustomDelay; - disappearingTooltip = hasTooltip as IHasDisappearingTooltip; - show = Scheduler.AddDelayed(() => TooltipText = hasTooltip.TooltipText, delayedTooltip?.TooltipDelay ?? DEFAULT_APPEAR_DELAY); - } - } - } - } - - public Tooltip() - { - AlwaysPresent = true; - Children = new[] - { - new Container - { - AutoSizeAxes = Axes.Both, - CornerRadius = 5, - Masking = true, - EdgeEffect = new EdgeEffect - { - Type = EdgeEffectType.Shadow, - Colour = Color4.Black.Opacity(40), - Radius = 5, - }, - Children = new Drawable[] - { - tooltipBackground = new Box - { - RelativeSizeAxes = Axes.Both - }, - text = new OsuSpriteText - { - Padding = new MarginPadding(3), - Font = @"Exo2.0-Regular", - } - } - } - }; - } - - [BackgroundDependencyLoader] - private void load(OsuColour colour, UserInputManager input) - { - this.input = input; - tooltipBackground.Colour = colour.Gray3; - } - - protected override void Update() - { - if (disappearingTooltip?.Disappear == false) - TooltipText = disappearingTooltip.TooltipText; - else if (disappearingTooltip != null) - { - disappearingTooltip = null; - TooltipText = string.Empty; - } - } - } -} diff --git a/osu.Game/Graphics/Cursor/TooltipContainer.cs b/osu.Game/Graphics/Cursor/TooltipContainer.cs new file mode 100644 index 0000000000..f7221326d4 --- /dev/null +++ b/osu.Game/Graphics/Cursor/TooltipContainer.cs @@ -0,0 +1,130 @@ +// 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.Allocation; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Cursor; +using osu.Framework.Graphics.Primitives; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Input; +using osu.Framework.Threading; +using osu.Game.Graphics.Sprites; +using System; +using System.Linq; + +namespace osu.Game.Graphics.Cursor +{ + public class TooltipContainer : Container + { + private readonly CursorContainer cursor; + private readonly Tooltip tooltip; + + private ScheduledDelegate show; + private UserInputManager input; + private IHasDisappearingTooltip disappearingTooltip; + + public const int DEFAULT_APPEAR_DELAY = 250; + + public IMouseState MouseState + { + set + { + if (value.Position != value.LastPosition && disappearingTooltip?.Disappear != false) + { + show?.Cancel(); + tooltip.TooltipText = string.Empty; + IHasTooltip hasTooltip = input.HoveredDrawables.OfType().FirstOrDefault(); + if (hasTooltip != null) + { + IHasTooltipWithCustomDelay delayedTooltip = hasTooltip as IHasTooltipWithCustomDelay; + disappearingTooltip = hasTooltip as IHasDisappearingTooltip; + show = Scheduler.AddDelayed(() => tooltip.TooltipText = hasTooltip.TooltipText, delayedTooltip?.TooltipDelay ?? DEFAULT_APPEAR_DELAY); + } + } + } + } + + public TooltipContainer(CursorContainer cursor) + { + this.cursor = cursor; + AlwaysPresent = true; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colour, UserInputManager input) + { + this.input = input; + } + + protected override void Update() + { + if (disappearingTooltip?.Disappear == false) + tooltip.TooltipText = disappearingTooltip.TooltipText; + else if (disappearingTooltip != null) + { + disappearingTooltip = null; + tooltip.TooltipText = string.Empty; + } + } + + protected override bool OnMouseMove(InputState state) + { + Position = new Vector2(state.Mouse.Position.X, Math.Min(cursor.ActiveCursor.BoundingBox.Bottom, state.Mouse.Position.Y + cursor.ActiveCursor.DrawHeight)); + return base.OnMouseMove(state); + } + + public class Tooltip : Container + { + private readonly Box tooltipBackground; + private readonly OsuSpriteText text; + + public string TooltipText + { + set + { + text.Text = value; + if (string.IsNullOrEmpty(value)) + Hide(); + else + Show(); + } + } + + public Tooltip() + { + + AutoSizeAxes = Axes.Both; + CornerRadius = 5; + Masking = true; + EdgeEffect = new EdgeEffect + { + Type = EdgeEffectType.Shadow, + Colour = Color4.Black.Opacity(40), + Radius = 5, + }; + Children = new Drawable[] + { + tooltipBackground = new Box + { + RelativeSizeAxes = Axes.Both + }, + text = new OsuSpriteText + { + Padding = new MarginPadding(3), + Font = @"Exo2.0-Regular", + } + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colour) + { + tooltipBackground.Colour = colour.Gray3; + } + } + } +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 58b484259b..829bc6efbc 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -98,7 +98,7 @@ - + From ea67b41683ac256327c95764ce07f6bf217a37e6 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Thu, 20 Apr 2017 00:42:40 +0200 Subject: [PATCH 296/442] move tooltip outside of the cursor --- .../Tests/TestCaseTooltip.cs | 1 - osu.Game/Graphics/Cursor/MenuCursor.cs | 2 +- osu.Game/Graphics/Cursor/TooltipContainer.cs | 50 ++++++++++--------- osu.Game/OsuGameBase.cs | 5 +- 4 files changed, 30 insertions(+), 28 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs b/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs index 7ea36e2ad8..e7615e63bf 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index ceb3296bdf..8d5f95aad5 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -98,7 +98,7 @@ namespace osu.Game.Graphics.Cursor public Cursor() { - Size = new Vector2(42); + AutoSizeAxes = Axes.Both; } [BackgroundDependencyLoader] diff --git a/osu.Game/Graphics/Cursor/TooltipContainer.cs b/osu.Game/Graphics/Cursor/TooltipContainer.cs index f7221326d4..562f604fca 100644 --- a/osu.Game/Graphics/Cursor/TooltipContainer.cs +++ b/osu.Game/Graphics/Cursor/TooltipContainer.cs @@ -26,32 +26,16 @@ namespace osu.Game.Graphics.Cursor private ScheduledDelegate show; private UserInputManager input; private IHasDisappearingTooltip disappearingTooltip; + private IHasTooltip hasTooltip; public const int DEFAULT_APPEAR_DELAY = 250; - public IMouseState MouseState - { - set - { - if (value.Position != value.LastPosition && disappearingTooltip?.Disappear != false) - { - show?.Cancel(); - tooltip.TooltipText = string.Empty; - IHasTooltip hasTooltip = input.HoveredDrawables.OfType().FirstOrDefault(); - if (hasTooltip != null) - { - IHasTooltipWithCustomDelay delayedTooltip = hasTooltip as IHasTooltipWithCustomDelay; - disappearingTooltip = hasTooltip as IHasDisappearingTooltip; - show = Scheduler.AddDelayed(() => tooltip.TooltipText = hasTooltip.TooltipText, delayedTooltip?.TooltipDelay ?? DEFAULT_APPEAR_DELAY); - } - } - } - } - public TooltipContainer(CursorContainer cursor) { this.cursor = cursor; AlwaysPresent = true; + RelativeSizeAxes = Axes.Both; + Add(tooltip = new Tooltip()); } [BackgroundDependencyLoader] @@ -62,9 +46,9 @@ namespace osu.Game.Graphics.Cursor protected override void Update() { - if (disappearingTooltip?.Disappear == false) - tooltip.TooltipText = disappearingTooltip.TooltipText; - else if (disappearingTooltip != null) + if (tooltip?.IsPresent == true) + tooltip.TooltipText = hasTooltip?.TooltipText; + else if (disappearingTooltip?.Disappear == true && show?.Completed == true) { disappearingTooltip = null; tooltip.TooltipText = string.Empty; @@ -73,7 +57,23 @@ namespace osu.Game.Graphics.Cursor protected override bool OnMouseMove(InputState state) { - Position = new Vector2(state.Mouse.Position.X, Math.Min(cursor.ActiveCursor.BoundingBox.Bottom, state.Mouse.Position.Y + cursor.ActiveCursor.DrawHeight)); + if (((hasTooltip as Drawable)?.Hovering != true && disappearingTooltip?.Disappear != false) || show?.Completed != true) + { + show?.Cancel(); + tooltip.TooltipText = string.Empty; + hasTooltip = input.HoveredDrawables.OfType().FirstOrDefault(); + if (hasTooltip != null) + { + IHasTooltipWithCustomDelay delayedTooltip = hasTooltip as IHasTooltipWithCustomDelay; + disappearingTooltip = hasTooltip as IHasDisappearingTooltip; + show = Scheduler.AddDelayed(delegate + { + tooltip.TooltipText = hasTooltip.TooltipText; + tooltip.Position = new Vector2(state.Mouse.Position.X, Math.Min(cursor.ActiveCursor.BoundingBox.Bottom, state.Mouse.Position.Y + cursor.ActiveCursor.DrawHeight)); + }, delayedTooltip?.TooltipDelay ?? DEFAULT_APPEAR_DELAY); + } + } + return base.OnMouseMove(state); } @@ -87,13 +87,15 @@ namespace osu.Game.Graphics.Cursor set { text.Text = value; - if (string.IsNullOrEmpty(value)) + if (string.IsNullOrEmpty(value) && !Hovering) Hide(); else Show(); } } + public override bool HandleInput => false; + public Tooltip() { diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 371699eab3..b42f8591e4 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -144,9 +144,10 @@ namespace osu.Game AddInternal(ratioContainer = new RatioAdjust { - Children = new[] + Children = new Drawable[] { - Cursor = new MenuCursor { Depth = float.MinValue } + Cursor = new MenuCursor { Depth = float.MinValue }, + new TooltipContainer(Cursor) { Depth = float.MinValue } } }); } From 3e65cab9b723d7999f515ab1c9595cf1749047cb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Apr 2017 10:25:07 +0900 Subject: [PATCH 297/442] Move replay creation logic to ScoreDatabase. --- osu.Game/Database/ScoreDatabase.cs | 34 +++++++++++++++++++++++++++++- osu.Game/Rulesets/Scoring/Score.cs | 30 -------------------------- 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/osu.Game/Database/ScoreDatabase.cs b/osu.Game/Database/ScoreDatabase.cs index 9dacf26e33..2ffe12d50e 100644 --- a/osu.Game/Database/ScoreDatabase.cs +++ b/osu.Game/Database/ScoreDatabase.cs @@ -2,11 +2,13 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Collections.Generic; using System.IO; using System.Linq; using osu.Framework.Platform; using osu.Game.IO.Legacy; using osu.Game.IPC; +using osu.Game.Rulesets.Replays; using osu.Game.Rulesets.Scoring; using SharpCompress.Compressors.LZMA; using SQLite.Net; @@ -104,13 +106,43 @@ namespace osu.Game.Database using (var lzma = new LzmaStream(properties, replayInStream, compressedSize, outSize)) using (var reader = new StreamReader(lzma)) - score.Replay = score.CreateReplay(reader); + score.Replay = createReplay(reader); } } return score; } + /// + /// Creates a replay which is read from a stream. + /// + /// The stream reader. + /// The replay. + private Replay createReplay(StreamReader reader) + { + var frames = new List(); + + float lastTime = 0; + + foreach (var l in reader.ReadToEnd().Split(',')) + { + var split = l.Split('|'); + + if (split.Length < 4 || float.Parse(split[0]) < 0) continue; + + lastTime += float.Parse(split[0]); + + frames.Add(new ReplayFrame( + lastTime, + float.Parse(split[1]), + 384 - float.Parse(split[2]), + (ReplayButtonState)int.Parse(split[3]) + )); + } + + return new Replay { Frames = frames }; + } + protected override void Prepare(bool reset = false) { } diff --git a/osu.Game/Rulesets/Scoring/Score.cs b/osu.Game/Rulesets/Scoring/Score.cs index 5496057304..a87c59606b 100644 --- a/osu.Game/Rulesets/Scoring/Score.cs +++ b/osu.Game/Rulesets/Scoring/Score.cs @@ -49,36 +49,6 @@ namespace osu.Game.Rulesets.Scoring [JsonProperty(@"created_at")] public DateTime Date; - /// - /// Creates a replay which is read from a stream. - /// - /// The stream reader. - /// The replay. - public virtual Replay CreateReplay(StreamReader reader) - { - var frames = new List(); - - float lastTime = 0; - - foreach (var l in reader.ReadToEnd().Split(',')) - { - var split = l.Split('|'); - - if (split.Length < 4 || float.Parse(split[0]) < 0) continue; - - lastTime += float.Parse(split[0]); - - frames.Add(new ReplayFrame( - lastTime, - float.Parse(split[1]), - 384 - float.Parse(split[2]), - (ReplayButtonState)int.Parse(split[3]) - )); - } - - return new Replay { Frames = frames }; - } - public virtual IEnumerable Statistics => new ScoreStatistic[] { }; } } From 6cf026e5c1afe461c5b9d6788e51dd85f6375210 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Apr 2017 11:02:56 +0900 Subject: [PATCH 298/442] Remove OsuScore and change the way statistics are stored (dynamic dictionary). --- osu-framework | 2 +- .../Tests/TestCaseResults.cs | 17 ++++++++------ osu.Game.Rulesets.Osu/Scoring/OsuScore.cs | 23 ------------------- .../Scoring/OsuScoreProcessor.cs | 13 +++++------ .../osu.Game.Rulesets.Osu.csproj | 1 - osu.Game/Rulesets/Scoring/Score.cs | 3 +-- osu.Game/Screens/Ranking/ResultsPageScore.cs | 7 +++--- osu.Game/osu.Game.csproj | 1 + 8 files changed, 23 insertions(+), 44 deletions(-) delete mode 100644 osu.Game.Rulesets.Osu/Scoring/OsuScore.cs diff --git a/osu-framework b/osu-framework index dc4ea5be42..ccf0ff40d1 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit dc4ea5be425d37f3a0dd09f6acdf6799d42e3d74 +Subproject commit ccf0ff40d1261ad328d0182467a1f0c1a858b099 diff --git a/osu.Desktop.VisualTests/Tests/TestCaseResults.cs b/osu.Desktop.VisualTests/Tests/TestCaseResults.cs index e023b54abe..aa3a117667 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseResults.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseResults.cs @@ -2,12 +2,12 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Database; -using osu.Game.Rulesets.Osu.Scoring; using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Ranking; using osu.Game.Users; @@ -41,17 +41,20 @@ namespace osu.Desktop.VisualTests.Tests base.Reset(); - Add(new Results(new OsuScore + Add(new Results(new Score { TotalScore = 2845370, Accuracy = 0.98, MaxCombo = 123, Rank = ScoreRank.A, Date = DateTime.Now, - Count300 = 100, - Count100 = 10, - Count50 = 1, - CountMiss = 2, + Statistics = new Dictionary() + { + { "300", 50 }, + { "100", 20 }, + { "50", 50 }, + { "x", 1 } + }, User = new User { Username = "peppy", @@ -62,4 +65,4 @@ namespace osu.Desktop.VisualTests.Tests }); } } - } +} diff --git a/osu.Game.Rulesets.Osu/Scoring/OsuScore.cs b/osu.Game.Rulesets.Osu/Scoring/OsuScore.cs deleted file mode 100644 index 248576b21d..0000000000 --- a/osu.Game.Rulesets.Osu/Scoring/OsuScore.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System.Collections.Generic; -using osu.Game.Rulesets.Scoring; - -namespace osu.Game.Rulesets.Osu.Scoring -{ - public class OsuScore : Score - { - public int Count300; - public int Count100; - public int Count50; - public int CountMiss; - - public override IEnumerable Statistics => new[] { - new ScoreStatistic(@"300", Count300), - new ScoreStatistic(@"100", Count100), - new ScoreStatistic(@"50", Count50), - new ScoreStatistic(@"x", CountMiss), - }; - } -} diff --git a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs index 45253e0793..470086bf78 100644 --- a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs +++ b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; +using osu.Framework.Extensions; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Judgements; using osu.Game.Rulesets.Osu.Objects; @@ -36,16 +37,14 @@ namespace osu.Game.Rulesets.Osu.Scoring private readonly Dictionary scoreResultCounts = new Dictionary(); private readonly Dictionary comboResultCounts = new Dictionary(); - public override Score CreateEmptyScore() => new OsuScore(); - public override Score GetPopulatedScore() { - var score = (OsuScore)base.GetPopulatedScore(); + var score = base.GetPopulatedScore(); - scoreResultCounts.TryGetValue(OsuScoreResult.Hit300, out score.Count300); - scoreResultCounts.TryGetValue(OsuScoreResult.Hit100, out score.Count100); - scoreResultCounts.TryGetValue(OsuScoreResult.Hit50, out score.Count50); - scoreResultCounts.TryGetValue(OsuScoreResult.Miss, out score.CountMiss); + score.Statistics[@"300"] = scoreResultCounts.GetOrDefault(OsuScoreResult.Hit300); + score.Statistics[@"100"] = scoreResultCounts.GetOrDefault(OsuScoreResult.Hit100); + score.Statistics[@"50"] = scoreResultCounts.GetOrDefault(OsuScoreResult.Hit50); + score.Statistics[@"x"] = scoreResultCounts.GetOrDefault(OsuScoreResult.Miss); return score; } diff --git a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj index 272a35c286..fcad0061e4 100644 --- a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj +++ b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj @@ -72,7 +72,6 @@ - diff --git a/osu.Game/Rulesets/Scoring/Score.cs b/osu.Game/Rulesets/Scoring/Score.cs index a87c59606b..fbbd766a18 100644 --- a/osu.Game/Rulesets/Scoring/Score.cs +++ b/osu.Game/Rulesets/Scoring/Score.cs @@ -7,7 +7,6 @@ using Newtonsoft.Json; using osu.Game.Database; using osu.Game.Rulesets.Mods; using osu.Game.Users; -using System.IO; using osu.Game.Rulesets.Replays; namespace osu.Game.Rulesets.Scoring @@ -49,6 +48,6 @@ namespace osu.Game.Rulesets.Scoring [JsonProperty(@"created_at")] public DateTime Date; - public virtual IEnumerable Statistics => new ScoreStatistic[] { }; + public Dictionary Statistics = new Dictionary(); } } diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index c6953a88fa..88c9da802e 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -18,6 +18,7 @@ using osu.Game.Users; using OpenTK; using OpenTK.Graphics; using System; +using System.Collections.Generic; using osu.Framework.Extensions.Color4Extensions; using osu.Game.Beatmaps; using osu.Game.Screens.Play; @@ -187,9 +188,9 @@ namespace osu.Game.Screens.Ranking private class DrawableScoreStatistic : Container { - private readonly ScoreStatistic statistic; + private readonly KeyValuePair statistic; - public DrawableScoreStatistic(ScoreStatistic statistic) + public DrawableScoreStatistic(KeyValuePair statistic) { this.statistic = statistic; @@ -210,7 +211,7 @@ namespace osu.Game.Screens.Ranking Origin = Anchor.TopCentre, }, new SpriteText { - Text = statistic.Name, + Text = statistic.Key, Colour = colours.Gray7, Font = @"Exo2.0-Bold", Y = 26, diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index fb88dba29c..de6c889f95 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -57,6 +57,7 @@ $(SolutionDir)\packages\SQLite.Net-PCL.3.1.1\lib\net4\SQLite.Net.Platform.Win32.dll True + From a47870b376e59e8d495b5a29067c4a6ef5611526 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Apr 2017 11:16:08 +0900 Subject: [PATCH 299/442] Apply Ruleset to Scores. Reduce complexity of score creation. --- .../Scoring/OsuScoreProcessor.cs | 6 ++--- osu.Game/Database/ScoreDatabase.cs | 2 +- osu.Game/Rulesets/Scoring/Score.cs | 2 ++ osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 12 +--------- osu.Game/Screens/Play/Player.cs | 23 +++++++++++++------ 5 files changed, 22 insertions(+), 23 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs index 470086bf78..7c6bf8344b 100644 --- a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs +++ b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs @@ -37,16 +37,14 @@ namespace osu.Game.Rulesets.Osu.Scoring private readonly Dictionary scoreResultCounts = new Dictionary(); private readonly Dictionary comboResultCounts = new Dictionary(); - public override Score GetPopulatedScore() + public override void PopulateScore(Score score) { - var score = base.GetPopulatedScore(); + base.PopulateScore(score); score.Statistics[@"300"] = scoreResultCounts.GetOrDefault(OsuScoreResult.Hit300); score.Statistics[@"100"] = scoreResultCounts.GetOrDefault(OsuScoreResult.Hit100); score.Statistics[@"50"] = scoreResultCounts.GetOrDefault(OsuScoreResult.Hit50); score.Statistics[@"x"] = scoreResultCounts.GetOrDefault(OsuScoreResult.Miss); - - return score; } protected override void OnNewJudgement(OsuJudgement judgement) diff --git a/osu.Game/Database/ScoreDatabase.cs b/osu.Game/Database/ScoreDatabase.cs index 2ffe12d50e..affbaf4e2b 100644 --- a/osu.Game/Database/ScoreDatabase.cs +++ b/osu.Game/Database/ScoreDatabase.cs @@ -45,7 +45,7 @@ namespace osu.Game.Database using (SerializationReader sr = new SerializationReader(s)) { var ruleset = rulesets.GetRuleset(sr.ReadByte()).CreateInstance(); - score = ruleset.CreateScoreProcessor().CreateEmptyScore(); + score = new Score(); /* score.Pass = true;*/ var version = sr.ReadInt32(); diff --git a/osu.Game/Rulesets/Scoring/Score.cs b/osu.Game/Rulesets/Scoring/Score.cs index fbbd766a18..5d94fde03b 100644 --- a/osu.Game/Rulesets/Scoring/Score.cs +++ b/osu.Game/Rulesets/Scoring/Score.cs @@ -32,6 +32,8 @@ namespace osu.Game.Rulesets.Scoring [JsonProperty(@"mods")] protected string[] ModStrings { get; set; } //todo: parse to Mod objects + public RulesetInfo Ruleset { get; set; } + public Mod[] Mods { get; set; } [JsonProperty(@"user")] diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 1fe21c8724..f31a1a11aa 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -61,12 +61,6 @@ namespace osu.Game.Rulesets.Scoring Reset(); } - /// - /// Creates a Score applicable to the ruleset in which this ScoreProcessor resides. - /// - /// The Score. - public virtual Score CreateEmptyScore() => new Score(); - private ScoreRank rankFrom(double acc) { if (acc == 1) @@ -114,10 +108,8 @@ namespace osu.Game.Rulesets.Scoring /// /// Retrieve a score populated with data for the current play this processor is responsible for. /// - public virtual Score GetPopulatedScore() + public virtual void PopulateScore(Score score) { - var score = CreateEmptyScore(); - score.TotalScore = TotalScore; score.Combo = Combo; score.MaxCombo = HighestCombo; @@ -125,8 +117,6 @@ namespace osu.Game.Rulesets.Scoring score.Rank = rankFrom(Accuracy); score.Date = DateTime.Now; score.Health = Health; - - return score; } } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 8c3f3da58a..fc7cbe170a 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -51,7 +51,7 @@ namespace osu.Game.Screens.Play private IAdjustableClock sourceClock; private IFrameBasedClock interpolatedSourceClock; - private Ruleset ruleset; + private RulesetInfo ruleset; private ScoreProcessor scoreProcessor; protected HitRenderer HitRenderer; @@ -68,6 +68,8 @@ namespace osu.Game.Screens.Play dimLevel = config.GetBindable(OsuConfig.DimLevel); mouseWheelDisabled = config.GetBindable(OsuConfig.MouseDisableWheel); + Ruleset rulesetInstance; + try { if (Beatmap == null) @@ -82,15 +84,17 @@ namespace osu.Game.Screens.Play try { // Try using the preferred user ruleset - ruleset = osu == null ? Beatmap.BeatmapInfo.Ruleset.CreateInstance() : osu.Ruleset.Value.CreateInstance(); - HitRenderer = ruleset.CreateHitRendererWith(Beatmap); + ruleset = osu == null ? Beatmap.BeatmapInfo.Ruleset : osu.Ruleset.Value; } catch (BeatmapInvalidForModeException) { // Default to the beatmap ruleset - ruleset = Beatmap.BeatmapInfo.Ruleset.CreateInstance(); - HitRenderer = ruleset.CreateHitRendererWith(Beatmap); + ruleset = Beatmap.BeatmapInfo.Ruleset; } + + rulesetInstance = ruleset.CreateInstance(); + + HitRenderer = rulesetInstance.CreateHitRendererWith(Beatmap); } catch (Exception e) { @@ -125,7 +129,7 @@ namespace osu.Game.Screens.Play Origin = Anchor.Centre }; - hudOverlay.KeyCounter.Add(ruleset.CreateGameplayKeys()); + hudOverlay.KeyCounter.Add(rulesetInstance.CreateGameplayKeys()); hudOverlay.BindProcessor(scoreProcessor); hudOverlay.BindHitRenderer(HitRenderer); @@ -266,7 +270,12 @@ namespace osu.Game.Screens.Play Delay(1000); onCompletionEvent = Schedule(delegate { - var score = scoreProcessor.GetPopulatedScore(); + var score = new Score + { + Beatmap = Beatmap.BeatmapInfo, + Ruleset = ruleset + }; + scoreProcessor.PopulateScore(score); score.User = HitRenderer.Replay?.User ?? (Game as OsuGame)?.API?.LocalUser?.Value; Push(new Results(score)); }); From 2d5f0f6b76d737f1a2809fbfb12a8950bb3b68f3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Apr 2017 11:23:40 +0900 Subject: [PATCH 300/442] Fix off-by-one counts. --- osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs index 7c6bf8344b..079ee928af 100644 --- a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs +++ b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs @@ -53,16 +53,8 @@ namespace osu.Game.Rulesets.Osu.Scoring { if (judgement.Result != HitResult.None) { - int count; - if (scoreResultCounts.TryGetValue(judgement.Score, out count)) - scoreResultCounts[judgement.Score] = count + 1; - else - scoreResultCounts[judgement.Score] = 0; - - if (comboResultCounts.TryGetValue(judgement.Combo, out count)) - comboResultCounts[judgement.Combo] = count + 1; - else - comboResultCounts[judgement.Combo] = 0; + scoreResultCounts[judgement.Score] = scoreResultCounts.GetOrDefault(judgement.Score) + 1; + comboResultCounts[judgement.Combo] = comboResultCounts.GetOrDefault(judgement.Combo) + 1; } switch (judgement.Result) From 2a422ca5fa9ec0c5015cfa3afc0cb6106fb34c39 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Apr 2017 11:26:02 +0900 Subject: [PATCH 301/442] Remove ScoreStatistic. --- osu.Game/Rulesets/Scoring/ScoreStatistic.cs | 17 ----------------- osu.Game/osu.Game.csproj | 1 - 2 files changed, 18 deletions(-) delete mode 100644 osu.Game/Rulesets/Scoring/ScoreStatistic.cs diff --git a/osu.Game/Rulesets/Scoring/ScoreStatistic.cs b/osu.Game/Rulesets/Scoring/ScoreStatistic.cs deleted file mode 100644 index 5d1011e829..0000000000 --- a/osu.Game/Rulesets/Scoring/ScoreStatistic.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -namespace osu.Game.Rulesets.Scoring -{ - public class ScoreStatistic - { - public readonly string Name; - public readonly object Value; - - public ScoreStatistic(string name, object value) - { - Name = name; - Value = value; - } - } -} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index de6c889f95..752290769d 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -156,7 +156,6 @@ - From 873599b359cb74d839f6047b49687c8b6c234343 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Apr 2017 11:36:50 +0900 Subject: [PATCH 302/442] Fix conversion regression. --- osu.Game/Database/ScoreDatabase.cs | 6 ++++-- osu.Game/Rulesets/Ruleset.cs | 6 ++++++ osu.Game/Screens/Play/Player.cs | 15 ++++++++------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/osu.Game/Database/ScoreDatabase.cs b/osu.Game/Database/ScoreDatabase.cs index affbaf4e2b..99fa9fbf9a 100644 --- a/osu.Game/Database/ScoreDatabase.cs +++ b/osu.Game/Database/ScoreDatabase.cs @@ -44,8 +44,10 @@ namespace osu.Game.Database using (Stream s = storage.GetStream(Path.Combine(replay_folder, replayFilename))) using (SerializationReader sr = new SerializationReader(s)) { - var ruleset = rulesets.GetRuleset(sr.ReadByte()).CreateInstance(); - score = new Score(); + score = new Score + { + Ruleset = rulesets.GetRuleset(sr.ReadByte()) + }; /* score.Pass = true;*/ var version = sr.ReadInt32(); diff --git a/osu.Game/Rulesets/Ruleset.cs b/osu.Game/Rulesets/Ruleset.cs index 5e92d25297..ea35e61b36 100644 --- a/osu.Game/Rulesets/Ruleset.cs +++ b/osu.Game/Rulesets/Ruleset.cs @@ -17,6 +17,12 @@ namespace osu.Game.Rulesets public abstract IEnumerable GetModsFor(ModType type); + /// + /// Attempt to create a HitRenderer for the provided beatmap. + /// + /// + /// Unable to successfully load the beatmap to be usable with this ruleset. + /// public abstract HitRenderer CreateHitRendererWith(WorkingBeatmap beatmap); public abstract DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap); diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index fc7cbe170a..ca27e07262 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -81,20 +81,21 @@ namespace osu.Game.Screens.Play if (Beatmap == null) throw new Exception("Beatmap was not loaded"); + ruleset = osu?.Ruleset.Value ?? Beatmap.BeatmapInfo.Ruleset; + rulesetInstance = ruleset.CreateInstance(); + try { - // Try using the preferred user ruleset - ruleset = osu == null ? Beatmap.BeatmapInfo.Ruleset : osu.Ruleset.Value; + HitRenderer = rulesetInstance.CreateHitRendererWith(Beatmap); } catch (BeatmapInvalidForModeException) { - // Default to the beatmap ruleset + // we may fail to create a HitRenderer if the beatmap cannot be loaded with the user's preferred ruleset + // let's try again forcing the beatmap's ruleset. ruleset = Beatmap.BeatmapInfo.Ruleset; + rulesetInstance = ruleset.CreateInstance(); + HitRenderer = rulesetInstance.CreateHitRendererWith(Beatmap); } - - rulesetInstance = ruleset.CreateInstance(); - - HitRenderer = rulesetInstance.CreateHitRendererWith(Beatmap); } catch (Exception e) { From 1707c2458ed57f7da7f5779ab48d55d9813250d5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Apr 2017 12:11:03 +0900 Subject: [PATCH 303/442] Update exception name. --- osu.Game/Rulesets/UI/HitRenderer.cs | 6 +++--- osu.Game/Screens/Play/Player.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Rulesets/UI/HitRenderer.cs b/osu.Game/Rulesets/UI/HitRenderer.cs index 021de37aae..d2f2cc6021 100644 --- a/osu.Game/Rulesets/UI/HitRenderer.cs +++ b/osu.Game/Rulesets/UI/HitRenderer.cs @@ -131,7 +131,7 @@ namespace osu.Game.Rulesets.UI // Check if the beatmap can be converted if (!converter.CanConvert(beatmap.Beatmap)) - throw new BeatmapInvalidForModeException($"{nameof(Beatmap)} can't be converted for the current ruleset."); + throw new BeatmapInvalidForRulesetException($"{nameof(Beatmap)} can't be converted for the current ruleset."); // Convert the beatmap Beatmap = converter.Convert(beatmap.Beatmap); @@ -279,9 +279,9 @@ namespace osu.Game.Rulesets.UI protected abstract Playfield CreatePlayfield(); } - public class BeatmapInvalidForModeException : Exception + public class BeatmapInvalidForRulesetException : Exception { - public BeatmapInvalidForModeException(string text) + public BeatmapInvalidForRulesetException(string text) : base(text) { } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index ca27e07262..5502723c0d 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -88,7 +88,7 @@ namespace osu.Game.Screens.Play { HitRenderer = rulesetInstance.CreateHitRendererWith(Beatmap); } - catch (BeatmapInvalidForModeException) + catch (BeatmapInvalidForRulesetException) { // we may fail to create a HitRenderer if the beatmap cannot be loaded with the user's preferred ruleset // let's try again forcing the beatmap's ruleset. From 8facf473d15ce5555af24b12b23c71ed475d6b3f Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 20 Apr 2017 13:05:57 +0900 Subject: [PATCH 304/442] Fix drum rolls not being correctly converted to hitcircles. --- osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 0b487bfc19..cf7b9ce710 100644 --- a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -98,11 +98,11 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps double osuDuration = distance / osuVelocity; // If the drum roll is to be split into hit circles, assume the ticks are 1/8 spaced within the duration of one beat - double tickSpacing = Math.Min(speedAdjustedBeatLength / beatmap.BeatmapInfo.Difficulty.SliderTickRate, taikoDuration / repeats) / 8; + double tickSpacing = Math.Min(speedAdjustedBeatLength / beatmap.BeatmapInfo.Difficulty.SliderTickRate, taikoDuration / repeats); if (tickSpacing > 0 && osuDuration < 2 * speedAdjustedBeatLength) { - for (double j = obj.StartTime; j <= distanceData.EndTime + tickSpacing; j += tickSpacing) + for (double j = obj.StartTime; j <= obj.StartTime + taikoDuration + tickSpacing / 8; j += tickSpacing) { // Todo: This should generate different type of hits (including strongs) // depending on hitobject sound additions (not implemented fully yet) From a958c99e2264454f1cc5dd0f704bfe380bbabfe8 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 20 Apr 2017 13:12:43 +0900 Subject: [PATCH 305/442] Make ticks smaller (as per flyte's suggestion). --- osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TickPiece.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TickPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TickPiece.cs index c3bc52796c..1a0d0156e8 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TickPiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TickPiece.cs @@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces /// /// The size of a tick. /// - private const float tick_size = TaikoHitObject.DEFAULT_CIRCLE_DIAMETER / 4; + private const float tick_size = TaikoHitObject.DEFAULT_CIRCLE_DIAMETER / 6; private bool filled; public bool Filled From b11315ca4699ce206e7b348134b31b8d3902b28f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Apr 2017 14:34:29 +0900 Subject: [PATCH 306/442] Remove unnecessary interfaces and simplify tooltip logic. --- .../Tests/TestCaseTooltip.cs | 13 ++-- osu.Game/Graphics/Cursor/IHasTooltip.cs | 22 ------ osu.Game/Graphics/Cursor/TooltipContainer.cs | 67 +++++++++++-------- 3 files changed, 42 insertions(+), 60 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs b/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs index e7615e63bf..3ade142fd4 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs @@ -31,11 +31,8 @@ namespace osu.Desktop.VisualTests.Tests Spacing = new Vector2(0,10), Children = new Drawable[] { - new TooltipTextContainer("Text with some tooltip"), - new TooltipTextContainer("and another one with a custom delay") - { - TooltipDelay = 1000, - }, + new TooltipTextContainer("text with a tooltip"), + new TooltipTextContainer("more text with another tooltip"), new TooltipTextbox { Text = "a box with a tooltip", @@ -56,14 +53,12 @@ namespace osu.Desktop.VisualTests.Tests }); } - private class TooltipTextContainer : Container, IHasTooltipWithCustomDelay + private class TooltipTextContainer : Container, IHasTooltip { private readonly OsuSpriteText text; public string TooltipText => text.Text; - public int TooltipDelay { get; set; } = TooltipContainer.DEFAULT_APPEAR_DELAY; - public TooltipTextContainer(string tooltipText) { AutoSizeAxes = Axes.Both; @@ -82,7 +77,7 @@ namespace osu.Desktop.VisualTests.Tests public string TooltipText => Text; } - private class TooltipSlider : OsuSliderBar, IHasDisappearingTooltip + private class TooltipSlider : OsuSliderBar, IHasTooltip { public string TooltipText => Current.Value.ToString(); diff --git a/osu.Game/Graphics/Cursor/IHasTooltip.cs b/osu.Game/Graphics/Cursor/IHasTooltip.cs index e7b6637f2a..2d166ca9dc 100644 --- a/osu.Game/Graphics/Cursor/IHasTooltip.cs +++ b/osu.Game/Graphics/Cursor/IHasTooltip.cs @@ -12,26 +12,4 @@ namespace osu.Game.Graphics.Cursor /// string TooltipText { get; } } - - /// - /// Tooltip with custom appear time - /// - public interface IHasTooltipWithCustomDelay : IHasTooltip - { - /// - /// Time until the tooltip appears (in milliseconds) - /// - int TooltipDelay { get; } - } - - /// - /// Tooltip which can decide when to disappear - /// - public interface IHasDisappearingTooltip : IHasTooltip - { - /// - /// Should the tooltip disappear? - /// - bool Disappear { get; } - } } diff --git a/osu.Game/Graphics/Cursor/TooltipContainer.cs b/osu.Game/Graphics/Cursor/TooltipContainer.cs index 562f604fca..63d914e013 100644 --- a/osu.Game/Graphics/Cursor/TooltipContainer.cs +++ b/osu.Game/Graphics/Cursor/TooltipContainer.cs @@ -23,55 +23,68 @@ namespace osu.Game.Graphics.Cursor private readonly CursorContainer cursor; private readonly Tooltip tooltip; - private ScheduledDelegate show; - private UserInputManager input; - private IHasDisappearingTooltip disappearingTooltip; - private IHasTooltip hasTooltip; + private ScheduledDelegate findTooltipTask; + private UserInputManager inputManager; - public const int DEFAULT_APPEAR_DELAY = 250; + private const int default_appear_delay = 250; + + private IHasTooltip currentlyDisplayed; + + private IMouseState lastState; public TooltipContainer(CursorContainer cursor) { this.cursor = cursor; AlwaysPresent = true; RelativeSizeAxes = Axes.Both; - Add(tooltip = new Tooltip()); + Add(tooltip = new Tooltip { Alpha = 0 }); } [BackgroundDependencyLoader] private void load(OsuColour colour, UserInputManager input) { - this.input = input; + this.inputManager = input; } protected override void Update() { - if (tooltip?.IsPresent == true) - tooltip.TooltipText = hasTooltip?.TooltipText; - else if (disappearingTooltip?.Disappear == true && show?.Completed == true) + if (tooltip.IsPresent && lastState != null) { - disappearingTooltip = null; - tooltip.TooltipText = string.Empty; + if (currentlyDisplayed != null) + tooltip.TooltipText = currentlyDisplayed.TooltipText; + + //update the position of the displayed tooltip. + tooltip.Position = new Vector2( + lastState.Position.X, + Math.Min(cursor.ActiveCursor.BoundingBox.Bottom, lastState.Position.Y + cursor.ActiveCursor.DrawHeight)); } } protected override bool OnMouseMove(InputState state) { - if (((hasTooltip as Drawable)?.Hovering != true && disappearingTooltip?.Disappear != false) || show?.Completed != true) + lastState = state.Mouse; + + if (currentlyDisplayed?.Hovering != true) { - show?.Cancel(); - tooltip.TooltipText = string.Empty; - hasTooltip = input.HoveredDrawables.OfType().FirstOrDefault(); - if (hasTooltip != null) + if (currentlyDisplayed != null) { - IHasTooltipWithCustomDelay delayedTooltip = hasTooltip as IHasTooltipWithCustomDelay; - disappearingTooltip = hasTooltip as IHasDisappearingTooltip; - show = Scheduler.AddDelayed(delegate - { - tooltip.TooltipText = hasTooltip.TooltipText; - tooltip.Position = new Vector2(state.Mouse.Position.X, Math.Min(cursor.ActiveCursor.BoundingBox.Bottom, state.Mouse.Position.Y + cursor.ActiveCursor.DrawHeight)); - }, delayedTooltip?.TooltipDelay ?? DEFAULT_APPEAR_DELAY); + tooltip.Delay(100); + tooltip.FadeOut(500, EasingTypes.OutQuint); + currentlyDisplayed = null; } + + findTooltipTask?.Cancel(); + findTooltipTask = Scheduler.AddDelayed(delegate + { + var tooltipTarget = inputManager.HoveredDrawables.OfType().FirstOrDefault(); + + if (tooltipTarget == null) return; + + tooltip.TooltipText = tooltipTarget.TooltipText; + tooltip.FadeIn(500, EasingTypes.OutQuint); + + currentlyDisplayed = tooltipTarget; + }, (1 - tooltip.Alpha) * default_appear_delay); } return base.OnMouseMove(state); @@ -87,10 +100,6 @@ namespace osu.Game.Graphics.Cursor set { text.Text = value; - if (string.IsNullOrEmpty(value) && !Hovering) - Hide(); - else - Show(); } } @@ -116,7 +125,7 @@ namespace osu.Game.Graphics.Cursor }, text = new OsuSpriteText { - Padding = new MarginPadding(3), + Padding = new MarginPadding(5), Font = @"Exo2.0-Regular", } }; From ef56058ad2dab9ed31df4109685daa7642446650 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 20 Apr 2017 15:09:29 +0900 Subject: [PATCH 307/442] Drum roll ticks shouldn't be able to result in miss judgements. --- .../Objects/Drawables/DrawableDrumRollTick.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs index ad4fd30a53..56a747467e 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableDrumRollTick.cs @@ -27,11 +27,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables protected override void CheckJudgement(bool userTriggered) { if (!userTriggered) - { - if (Judgement.TimeOffset > HitObject.HitWindow) - Judgement.Result = HitResult.Miss; return; - } if (Math.Abs(Judgement.TimeOffset) < HitObject.HitWindow) { From 3e7639e58f574018c704d453f634aa20c20e1a47 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Apr 2017 15:23:19 +0900 Subject: [PATCH 308/442] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index ccf0ff40d1..c104bf45e7 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit ccf0ff40d1261ad328d0182467a1f0c1a858b099 +Subproject commit c104bf45e7bc85c5ab000c9fe92e6cfbe2bd0ef4 From 61090d918c4adfac59d06057c90483d135f735f6 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 20 Apr 2017 15:26:42 +0900 Subject: [PATCH 309/442] Temporary for taiko lagging on auto replays due to inImportantSection. Note that this isn't a full "as intended" fix, because the full fix is quite big. I'll be saving it for a separate branch/pull-req. --- osu.Game.Rulesets.Osu/OsuAutoReplay.cs | 6 +++--- osu.Game.Rulesets.Taiko/Replays/TaikoAutoReplay.cs | 14 +++++++------- osu.Game/Database/ScoreDatabase.cs | 8 ++++---- osu.Game/Rulesets/Replays/ReplayFrame.cs | 14 +++++++------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/osu.Game.Rulesets.Osu/OsuAutoReplay.cs b/osu.Game.Rulesets.Osu/OsuAutoReplay.cs index 4e10179819..76ddb48730 100644 --- a/osu.Game.Rulesets.Osu/OsuAutoReplay.cs +++ b/osu.Game.Rulesets.Osu/OsuAutoReplay.cs @@ -138,8 +138,8 @@ namespace osu.Game.Rulesets.Osu if (h is Spinner) { - targetPosition.X = Frames[Frames.Count - 1].MouseX; - targetPosition.Y = Frames[Frames.Count - 1].MouseY; + targetPosition.X = Frames[Frames.Count - 1].Position.X; + targetPosition.Y = Frames[Frames.Count - 1].Position.Y; Vector2 difference = spinner_centre - targetPosition; @@ -193,7 +193,7 @@ namespace osu.Game.Rulesets.Osu addFrameToReplay(lastFrame); } - Vector2 lastPosition = new Vector2(lastFrame.MouseX, lastFrame.MouseY); + Vector2 lastPosition = lastFrame.Position; double timeDifference = applyModsToTime(h.StartTime - lastFrame.Time); diff --git a/osu.Game.Rulesets.Taiko/Replays/TaikoAutoReplay.cs b/osu.Game.Rulesets.Taiko/Replays/TaikoAutoReplay.cs index a8187d68ab..df862a5cb0 100644 --- a/osu.Game.Rulesets.Taiko/Replays/TaikoAutoReplay.cs +++ b/osu.Game.Rulesets.Taiko/Replays/TaikoAutoReplay.cs @@ -24,8 +24,8 @@ namespace osu.Game.Rulesets.Taiko.Replays { bool hitButton = true; - Frames.Add(new ReplayFrame(-100000, 320, 240, ReplayButtonState.None)); - Frames.Add(new ReplayFrame(beatmap.HitObjects[0].StartTime - 1000, 320, 240, ReplayButtonState.None)); + Frames.Add(new ReplayFrame(-100000, null, null, ReplayButtonState.None)); + Frames.Add(new ReplayFrame(beatmap.HitObjects[0].StartTime - 1000, null, null, ReplayButtonState.None)); for (int i = 0; i < beatmap.HitObjects.Count; i++) { @@ -64,7 +64,7 @@ namespace osu.Game.Rulesets.Taiko.Replays break; } - Frames.Add(new ReplayFrame(j, 0, 0, button)); + Frames.Add(new ReplayFrame(j, null, null, button)); d = (d + 1) % 4; if (++count > req) break; @@ -74,7 +74,7 @@ namespace osu.Game.Rulesets.Taiko.Replays { foreach (var tick in drumRoll.Ticks) { - Frames.Add(new ReplayFrame(tick.StartTime, 0, 0, hitButton ? ReplayButtonState.Left1 : ReplayButtonState.Left2)); + Frames.Add(new ReplayFrame(tick.StartTime, null, null, hitButton ? ReplayButtonState.Left1 : ReplayButtonState.Left2)); hitButton = !hitButton; } } @@ -95,18 +95,18 @@ namespace osu.Game.Rulesets.Taiko.Replays button = hitButton ? ReplayButtonState.Left1 : ReplayButtonState.Left2; } - Frames.Add(new ReplayFrame(h.StartTime, 0, 0, button)); + Frames.Add(new ReplayFrame(h.StartTime, null, null, button)); } else throw new Exception("Unknown hit object type."); - Frames.Add(new ReplayFrame(endTime + KEY_UP_DELAY, 0, 0, ReplayButtonState.None)); + Frames.Add(new ReplayFrame(endTime + KEY_UP_DELAY, null, null, ReplayButtonState.None)); if (i < beatmap.HitObjects.Count - 1) { double waitTime = beatmap.HitObjects[i + 1].StartTime - 1000; if (waitTime > endTime) - Frames.Add(new ReplayFrame(waitTime, 0, 0, ReplayButtonState.None)); + Frames.Add(new ReplayFrame(waitTime, null, null, ReplayButtonState.None)); } hitButton = !hitButton; diff --git a/osu.Game/Database/ScoreDatabase.cs b/osu.Game/Database/ScoreDatabase.cs index 99fa9fbf9a..8ea836aceb 100644 --- a/osu.Game/Database/ScoreDatabase.cs +++ b/osu.Game/Database/ScoreDatabase.cs @@ -108,7 +108,7 @@ namespace osu.Game.Database using (var lzma = new LzmaStream(properties, replayInStream, compressedSize, outSize)) using (var reader = new StreamReader(lzma)) - score.Replay = createReplay(reader); + score.Replay = createLegacyReplay(reader); } } @@ -116,11 +116,11 @@ namespace osu.Game.Database } /// - /// Creates a replay which is read from a stream. + /// Creates a legacy replay which is read from a stream. /// /// The stream reader. - /// The replay. - private Replay createReplay(StreamReader reader) + /// The legacy replay. + private Replay createLegacyReplay(StreamReader reader) { var frames = new List(); diff --git a/osu.Game/Rulesets/Replays/ReplayFrame.cs b/osu.Game/Rulesets/Replays/ReplayFrame.cs index 31f952abdf..b2bda84851 100644 --- a/osu.Game/Rulesets/Replays/ReplayFrame.cs +++ b/osu.Game/Rulesets/Replays/ReplayFrame.cs @@ -7,12 +7,12 @@ namespace osu.Game.Rulesets.Replays { public class ReplayFrame { - public Vector2 Position => new Vector2(MouseX, MouseY); + public Vector2 Position => new Vector2(MouseX ?? 0, MouseY ?? 0); - public bool IsImportant => MouseLeft || MouseRight; + public bool IsImportant => (MouseX.HasValue && MouseY.HasValue) && (MouseLeft || MouseRight); - public float MouseX; - public float MouseY; + public float? MouseX; + public float? MouseY; public bool MouseLeft => MouseLeft1 || MouseLeft2; public bool MouseRight => MouseRight1 || MouseRight2; @@ -55,10 +55,10 @@ namespace osu.Game.Rulesets.Replays } - public ReplayFrame(double time, float posX, float posY, ReplayButtonState buttonState) + public ReplayFrame(double time, float? mouseX, float? mouseY, ReplayButtonState buttonState) { - MouseX = posX; - MouseY = posY; + MouseX = mouseX; + MouseY = mouseY; ButtonState = buttonState; Time = time; } From 30c3c932b102ee63663c95e04cba3a2257e5b1c1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Apr 2017 15:29:34 +0900 Subject: [PATCH 310/442] Remove redundancies. --- osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs | 14 -------------- osu.Game/Graphics/Cursor/TooltipContainer.cs | 4 ++-- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs b/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs index 3ade142fd4..16bcbccc6a 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs @@ -80,20 +80,6 @@ namespace osu.Desktop.VisualTests.Tests private class TooltipSlider : OsuSliderBar, IHasTooltip { public string TooltipText => Current.Value.ToString(); - - public bool Disappear { get; set; } = true; - - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) - { - Disappear = false; - return base.OnMouseDown(state, args); - } - - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) - { - Disappear = true; - return base.OnMouseUp(state, args); - } } } } diff --git a/osu.Game/Graphics/Cursor/TooltipContainer.cs b/osu.Game/Graphics/Cursor/TooltipContainer.cs index 63d914e013..c06f85e650 100644 --- a/osu.Game/Graphics/Cursor/TooltipContainer.cs +++ b/osu.Game/Graphics/Cursor/TooltipContainer.cs @@ -41,9 +41,9 @@ namespace osu.Game.Graphics.Cursor } [BackgroundDependencyLoader] - private void load(OsuColour colour, UserInputManager input) + private void load(UserInputManager input) { - this.inputManager = input; + inputManager = input; } protected override void Update() From 990c14fbe077dd892f71a80881986c3ebad3d225 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Apr 2017 15:51:30 +0900 Subject: [PATCH 311/442] Keep tooltip's current target while the main button is pressed. Handles drag operations better. --- osu.Game/Graphics/Cursor/TooltipContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Cursor/TooltipContainer.cs b/osu.Game/Graphics/Cursor/TooltipContainer.cs index c06f85e650..30acedb4e7 100644 --- a/osu.Game/Graphics/Cursor/TooltipContainer.cs +++ b/osu.Game/Graphics/Cursor/TooltipContainer.cs @@ -66,7 +66,7 @@ namespace osu.Game.Graphics.Cursor if (currentlyDisplayed?.Hovering != true) { - if (currentlyDisplayed != null) + if (currentlyDisplayed != null && !state.Mouse.HasMainButtonPressed) { tooltip.Delay(100); tooltip.FadeOut(500, EasingTypes.OutQuint); From 00d8cacba8f8a7ac5c242db12a5c34ef55e17420 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Apr 2017 16:05:25 +0900 Subject: [PATCH 312/442] Update visual apperance. --- osu.Game/Graphics/Cursor/TooltipContainer.cs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/osu.Game/Graphics/Cursor/TooltipContainer.cs b/osu.Game/Graphics/Cursor/TooltipContainer.cs index 30acedb4e7..59cd06c7f5 100644 --- a/osu.Game/Graphics/Cursor/TooltipContainer.cs +++ b/osu.Game/Graphics/Cursor/TooltipContainer.cs @@ -68,7 +68,7 @@ namespace osu.Game.Graphics.Cursor { if (currentlyDisplayed != null && !state.Mouse.HasMainButtonPressed) { - tooltip.Delay(100); + tooltip.Delay(150); tooltip.FadeOut(500, EasingTypes.OutQuint); currentlyDisplayed = null; } @@ -92,23 +92,31 @@ namespace osu.Game.Graphics.Cursor public class Tooltip : Container { - private readonly Box tooltipBackground; + private readonly Box background; private readonly OsuSpriteText text; public string TooltipText { set { + if (value == text.Text) return; + text.Text = value; + if (Alpha > 0) + background.FlashColour(Color4.Gray, 200, EasingTypes.Out); } } public override bool HandleInput => false; + private const float text_size = 16; + public Tooltip() { - + AutoSizeDuration = 250; + AutoSizeEasing = EasingTypes.OutQuint; AutoSizeAxes = Axes.Both; + CornerRadius = 5; Masking = true; EdgeEffect = new EdgeEffect @@ -119,12 +127,13 @@ namespace osu.Game.Graphics.Cursor }; Children = new Drawable[] { - tooltipBackground = new Box + background = new Box { RelativeSizeAxes = Axes.Both }, text = new OsuSpriteText { + TextSize = text_size, Padding = new MarginPadding(5), Font = @"Exo2.0-Regular", } @@ -134,7 +143,7 @@ namespace osu.Game.Graphics.Cursor [BackgroundDependencyLoader] private void load(OsuColour colour) { - tooltipBackground.Colour = colour.Gray3; + background.Colour = colour.Gray3; } } } From a884ac215ec194a250b0ed7db3738f004787322d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Apr 2017 16:08:36 +0900 Subject: [PATCH 313/442] Position tooltip better; remove need for lastState. --- osu.Game/Graphics/Cursor/TooltipContainer.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/osu.Game/Graphics/Cursor/TooltipContainer.cs b/osu.Game/Graphics/Cursor/TooltipContainer.cs index 59cd06c7f5..cf68baa313 100644 --- a/osu.Game/Graphics/Cursor/TooltipContainer.cs +++ b/osu.Game/Graphics/Cursor/TooltipContainer.cs @@ -30,8 +30,6 @@ namespace osu.Game.Graphics.Cursor private IHasTooltip currentlyDisplayed; - private IMouseState lastState; - public TooltipContainer(CursorContainer cursor) { this.cursor = cursor; @@ -48,21 +46,18 @@ namespace osu.Game.Graphics.Cursor protected override void Update() { - if (tooltip.IsPresent && lastState != null) + if (tooltip.IsPresent) { if (currentlyDisplayed != null) tooltip.TooltipText = currentlyDisplayed.TooltipText; //update the position of the displayed tooltip. - tooltip.Position = new Vector2( - lastState.Position.X, - Math.Min(cursor.ActiveCursor.BoundingBox.Bottom, lastState.Position.Y + cursor.ActiveCursor.DrawHeight)); + tooltip.Position = ToLocalSpace(cursor.ActiveCursor.ScreenSpaceDrawQuad.Centre) + new Vector2(10); } } protected override bool OnMouseMove(InputState state) { - lastState = state.Mouse; if (currentlyDisplayed?.Hovering != true) { From d12a9a767594bb80d1b91351f6757ad830ed33bd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Apr 2017 16:28:45 +0900 Subject: [PATCH 314/442] Don't run AutoSize transforms when tooltip is already invisible. --- osu.Game/Graphics/Cursor/TooltipContainer.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/Cursor/TooltipContainer.cs b/osu.Game/Graphics/Cursor/TooltipContainer.cs index cf68baa313..4b43ff14c9 100644 --- a/osu.Game/Graphics/Cursor/TooltipContainer.cs +++ b/osu.Game/Graphics/Cursor/TooltipContainer.cs @@ -98,7 +98,12 @@ namespace osu.Game.Graphics.Cursor text.Text = value; if (Alpha > 0) - background.FlashColour(Color4.Gray, 200, EasingTypes.Out); + { + AutoSizeDuration = 250; + background.FlashColour(OsuColour.Gray(0.4f), 1000, EasingTypes.OutQuint); + } + else + AutoSizeDuration = 0; } } @@ -108,7 +113,6 @@ namespace osu.Game.Graphics.Cursor public Tooltip() { - AutoSizeDuration = 250; AutoSizeEasing = EasingTypes.OutQuint; AutoSizeAxes = Axes.Both; From 18bbbdad4c6c4a6dff28d88b617a9a9fde40f80e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Apr 2017 16:28:55 +0900 Subject: [PATCH 315/442] Reduce appear delay slightly. --- osu.Game/Graphics/Cursor/TooltipContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Cursor/TooltipContainer.cs b/osu.Game/Graphics/Cursor/TooltipContainer.cs index 4b43ff14c9..649cebd7ae 100644 --- a/osu.Game/Graphics/Cursor/TooltipContainer.cs +++ b/osu.Game/Graphics/Cursor/TooltipContainer.cs @@ -26,7 +26,7 @@ namespace osu.Game.Graphics.Cursor private ScheduledDelegate findTooltipTask; private UserInputManager inputManager; - private const int default_appear_delay = 250; + private const int default_appear_delay = 220; private IHasTooltip currentlyDisplayed; From 9d975f202f409babe97f236919a46616ffe12e3c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Apr 2017 16:29:05 +0900 Subject: [PATCH 316/442] Make background slightly transparent. --- osu.Game/Graphics/Cursor/TooltipContainer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Cursor/TooltipContainer.cs b/osu.Game/Graphics/Cursor/TooltipContainer.cs index 649cebd7ae..a1f2e282f1 100644 --- a/osu.Game/Graphics/Cursor/TooltipContainer.cs +++ b/osu.Game/Graphics/Cursor/TooltipContainer.cs @@ -128,7 +128,8 @@ namespace osu.Game.Graphics.Cursor { background = new Box { - RelativeSizeAxes = Axes.Both + RelativeSizeAxes = Axes.Both, + Alpha = 0.9f, }, text = new OsuSpriteText { From 9c8cd089272ccdae3019e9b84d9f519f0791d99b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Apr 2017 16:35:55 +0900 Subject: [PATCH 317/442] Don't play sliderbar samples more than once when value has not changed. --- osu.Game/Graphics/UserInterface/OsuSliderBar.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index 180cb88707..7b130311ed 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -12,10 +12,11 @@ using osu.Framework.Input; namespace osu.Game.Graphics.UserInterface { - public class OsuSliderBar : SliderBar where U : struct + public class OsuSliderBar : SliderBar where T : struct { private SampleChannel sample; private double lastSampleTime; + private T lastSampleValue; private readonly Nub nub; private readonly Box leftBox; @@ -84,6 +85,12 @@ namespace osu.Game.Graphics.UserInterface { if (Clock == null || Clock.CurrentTime - lastSampleTime <= 50) return; + + if (Current.Value.Equals(lastSampleValue)) + return; + + lastSampleValue = Current.Value; + lastSampleTime = Clock.CurrentTime; sample.Frequency.Value = 1 + NormalizedValue * 0.2f; From ce5763ed97e055e3bf1227673c422c777603762e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Apr 2017 16:29:46 +0900 Subject: [PATCH 318/442] Remove using. --- osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs | 1 - osu.Game/Graphics/Cursor/TooltipContainer.cs | 1 - 2 files changed, 2 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs b/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs index 16bcbccc6a..02893d0628 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs @@ -7,7 +7,6 @@ using osu.Framework.Testing; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Framework.Configuration; -using osu.Framework.Input; using osu.Game.Graphics.Cursor; using OpenTK; diff --git a/osu.Game/Graphics/Cursor/TooltipContainer.cs b/osu.Game/Graphics/Cursor/TooltipContainer.cs index a1f2e282f1..8a55f1897f 100644 --- a/osu.Game/Graphics/Cursor/TooltipContainer.cs +++ b/osu.Game/Graphics/Cursor/TooltipContainer.cs @@ -13,7 +13,6 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Input; using osu.Framework.Threading; using osu.Game.Graphics.Sprites; -using System; using System.Linq; namespace osu.Game.Graphics.Cursor From 9cb789f4265021c98635b61dea0da954effee427 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Apr 2017 17:10:05 +0900 Subject: [PATCH 319/442] Use 24 hour display for chat times. --- osu.Game/Online/Chat/Drawables/ChatLine.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Online/Chat/Drawables/ChatLine.cs b/osu.Game/Online/Chat/Drawables/ChatLine.cs index 59e83fd385..6bfa25755f 100644 --- a/osu.Game/Online/Chat/Drawables/ChatLine.cs +++ b/osu.Game/Online/Chat/Drawables/ChatLine.cs @@ -86,7 +86,7 @@ namespace osu.Game.Online.Chat.Drawables Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Font = @"Exo2.0-SemiBold", - Text = $@"{Message.Timestamp.LocalDateTime:hh:mm:ss}", + Text = $@"{Message.Timestamp.LocalDateTime:HH:mm:ss}", FixedWidth = true, TextSize = text_size * 0.75f, Alpha = 0.4f, From e92e08f86d805ab1b7e387920d8e2dd72d11c64b Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 20 Apr 2017 17:11:15 +0900 Subject: [PATCH 320/442] Make StandardHealthDisplay glow extrude beyond the end of the bar. --- osu.Game/Rulesets/UI/StandardHealthDisplay.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game/Rulesets/UI/StandardHealthDisplay.cs b/osu.Game/Rulesets/UI/StandardHealthDisplay.cs index 9294cc3a1a..e2016896c9 100644 --- a/osu.Game/Rulesets/UI/StandardHealthDisplay.cs +++ b/osu.Game/Rulesets/UI/StandardHealthDisplay.cs @@ -34,7 +34,8 @@ namespace osu.Game.Rulesets.UI { Colour = glowColour, Radius = 8, - Type = EdgeEffectType.Glow + Roundness = 4, + Type = EdgeEffectType.Glow, }; } } @@ -51,7 +52,7 @@ namespace osu.Game.Rulesets.UI fill = new Container { RelativeSizeAxes = Axes.Both, - Scale = new Vector2(0, 1), + Size = new Vector2(0, 1), Masking = true, Children = new[] { @@ -64,6 +65,6 @@ namespace osu.Game.Rulesets.UI }; } - protected override void SetHealth(float value) => fill.ScaleTo(new Vector2(value, 1), 200, EasingTypes.OutQuint); + protected override void SetHealth(float value) => fill.ResizeTo(new Vector2(value, 1), 200, EasingTypes.OutQuint); } } From 6e3018f36da0afa59e226096632e23d6e7f0e134 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 20 Apr 2017 17:11:58 +0900 Subject: [PATCH 321/442] Add a glow fade based on density of hits. --- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 16 +++++++ osu.Game/Rulesets/UI/HudOverlay.cs | 4 +- osu.Game/Rulesets/UI/StandardHealthDisplay.cs | 45 ++++++++++++++++++- osu.Game/Rulesets/UI/StandardHudOverlay.cs | 11 ++++- 4 files changed, 72 insertions(+), 4 deletions(-) diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index f31a1a11aa..11c1c273e2 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -19,6 +19,11 @@ namespace osu.Game.Rulesets.Scoring /// public event Action Failed; + /// + /// Invoked when a new judgement has occurred. This occurs after the judgement has been processed by the . + /// + public event Action NewJudgement; + /// /// The current total score. /// @@ -105,6 +110,15 @@ namespace osu.Game.Rulesets.Scoring Failed?.Invoke(); } + /// + /// Notifies subscribers of that a new judgement has occurred. + /// + /// The judgement to notify subscribers of. + protected void NotifyNewJudgement(Judgement judgement) + { + NewJudgement?.Invoke(judgement); + } + /// /// Retrieve a score populated with data for the current play this processor is responsible for. /// @@ -177,6 +191,8 @@ namespace osu.Game.Rulesets.Scoring Judgements.Add(judgement); OnNewJudgement(judgement); + + NotifyNewJudgement(judgement); } else OnJudgementChanged(judgement); diff --git a/osu.Game/Rulesets/UI/HudOverlay.cs b/osu.Game/Rulesets/UI/HudOverlay.cs index d2169aa32f..47cf157732 100644 --- a/osu.Game/Rulesets/UI/HudOverlay.cs +++ b/osu.Game/Rulesets/UI/HudOverlay.cs @@ -94,7 +94,7 @@ namespace osu.Game.Rulesets.UI } } - public void BindProcessor(ScoreProcessor processor) + public virtual void BindProcessor(ScoreProcessor processor) { ScoreCounter?.Current.BindTo(processor.TotalScore); AccuracyCounter?.Current.BindTo(processor.Accuracy); @@ -102,7 +102,7 @@ namespace osu.Game.Rulesets.UI HealthDisplay?.Current.BindTo(processor.Health); } - public void BindHitRenderer(HitRenderer hitRenderer) + public virtual void BindHitRenderer(HitRenderer hitRenderer) { hitRenderer.InputManager.Add(KeyCounter.GetReceptor()); } diff --git a/osu.Game/Rulesets/UI/StandardHealthDisplay.cs b/osu.Game/Rulesets/UI/StandardHealthDisplay.cs index e2016896c9..51f47f3b2c 100644 --- a/osu.Game/Rulesets/UI/StandardHealthDisplay.cs +++ b/osu.Game/Rulesets/UI/StandardHealthDisplay.cs @@ -3,15 +3,43 @@ using OpenTK; using OpenTK.Graphics; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Scoring; +using System; namespace osu.Game.Rulesets.UI { public class StandardHealthDisplay : HealthDisplay, IHasAccentColour { + /// + /// The base opacity of the glow. + /// + private const float base_glow_opacity = 0.6f; + + /// + /// The number of sequential hits required within to reach the maximum glow opacity. + /// + private const int glow_max_hits = 8; + + /// + /// The amount of time to delay before fading the glow opacity back to . + /// + /// This is calculated to require a stream snapped to 1/4 at 150bpm to reach the maximum glow opacity with hits. + /// + /// + private const float glow_fade_delay = 100; + + /// + /// The amount of time to fade the glow to after . + /// + private const double glow_fade_time = 500; + private readonly Container fill; public Color4 AccentColour @@ -32,7 +60,7 @@ namespace osu.Game.Rulesets.UI fill.EdgeEffect = new EdgeEffect { - Colour = glowColour, + Colour = glowColour.Opacity(base_glow_opacity), Radius = 8, Roundness = 4, Type = EdgeEffectType.Glow, @@ -65,6 +93,21 @@ namespace osu.Game.Rulesets.UI }; } + public void BindProcessor(ScoreProcessor processor) + { + processor.NewJudgement += onNewJudgement; + } + + private void onNewJudgement(Judgement judgement) + { + if (judgement.Result == HitResult.Miss) + return; + + fill.FadeEdgeEffectTo(Math.Min(1, fill.EdgeEffect.Colour.Linear.A + (1f - base_glow_opacity) / glow_max_hits), 50, EasingTypes.OutQuint); + fill.Delay(glow_fade_delay); + fill.FadeEdgeEffectTo(base_glow_opacity, glow_fade_time, EasingTypes.OutQuint); + } + protected override void SetHealth(float value) => fill.ResizeTo(new Vector2(value, 1), 200, EasingTypes.OutQuint); } } diff --git a/osu.Game/Rulesets/UI/StandardHudOverlay.cs b/osu.Game/Rulesets/UI/StandardHudOverlay.cs index 8c29b1ab3b..7fe830ebef 100644 --- a/osu.Game/Rulesets/UI/StandardHudOverlay.cs +++ b/osu.Game/Rulesets/UI/StandardHudOverlay.cs @@ -8,6 +8,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Primitives; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; +using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Play; namespace osu.Game.Rulesets.UI @@ -75,8 +76,16 @@ namespace osu.Game.Rulesets.UI if (shd != null) { shd.AccentColour = colours.BlueLighter; - shd.GlowColour = colours.BlueDarker.Opacity(0.6f); + shd.GlowColour = colours.BlueDarker; } } + + public override void BindProcessor(ScoreProcessor processor) + { + base.BindProcessor(processor); + + var shd = HealthDisplay as StandardHealthDisplay; + shd?.BindProcessor(processor); + } } } From c87657707fac7ddc8b4317d28334648635364d06 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Apr 2017 17:33:07 +0900 Subject: [PATCH 322/442] Add tooltip to sliderbars. Move interface. --- osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs | 9 ++------- osu.Game/Graphics/{Cursor => }/IHasTooltip.cs | 2 +- osu.Game/Graphics/UserInterface/OsuSliderBar.cs | 5 ++++- osu.Game/osu.Game.csproj | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) rename osu.Game/Graphics/{Cursor => }/IHasTooltip.cs (88%) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs b/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs index 02893d0628..f12b9d71e2 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs @@ -19,7 +19,7 @@ namespace osu.Desktop.VisualTests.Tests public override void Reset() { base.Reset(); - TooltipSlider slider; + OsuSliderBar slider; Children = new Drawable[] { @@ -37,7 +37,7 @@ namespace osu.Desktop.VisualTests.Tests Text = "a box with a tooltip", Size = new Vector2(300,30), }, - slider = new TooltipSlider + slider = new OsuSliderBar { Width = 300, }, @@ -75,10 +75,5 @@ namespace osu.Desktop.VisualTests.Tests { public string TooltipText => Text; } - - private class TooltipSlider : OsuSliderBar, IHasTooltip - { - public string TooltipText => Current.Value.ToString(); - } } } diff --git a/osu.Game/Graphics/Cursor/IHasTooltip.cs b/osu.Game/Graphics/IHasTooltip.cs similarity index 88% rename from osu.Game/Graphics/Cursor/IHasTooltip.cs rename to osu.Game/Graphics/IHasTooltip.cs index 2d166ca9dc..dd51d68c41 100644 --- a/osu.Game/Graphics/Cursor/IHasTooltip.cs +++ b/osu.Game/Graphics/IHasTooltip.cs @@ -3,7 +3,7 @@ using osu.Framework.Graphics; -namespace osu.Game.Graphics.Cursor +namespace osu.Game.Graphics { public interface IHasTooltip : IDrawable { diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index 180cb88707..12d5d2126c 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using OpenTK; using osu.Framework.Allocation; using osu.Framework.Audio; @@ -12,7 +13,7 @@ using osu.Framework.Input; namespace osu.Game.Graphics.UserInterface { - public class OsuSliderBar : SliderBar where U : struct + public class OsuSliderBar : SliderBar, IHasTooltip where U : struct { private SampleChannel sample; private double lastSampleTime; @@ -21,6 +22,8 @@ namespace osu.Game.Graphics.UserInterface private readonly Box leftBox; private readonly Box rightBox; + public string TooltipText => Current.Value.ToString(); + public OsuSliderBar() { Height = 12; diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index fb772cb5c4..6d7a905eed 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -88,12 +88,12 @@ + - From 0de71ab24d52f170a175b1378127aef7ea944cde Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Apr 2017 17:57:58 +0900 Subject: [PATCH 323/442] Add basic tooltip support to OsuSliderBar. --- .../Tests/TestCaseTooltip.cs | 2 +- .../Graphics/UserInterface/OsuSliderBar.cs | 22 +++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs b/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs index f12b9d71e2..633d3036dc 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs @@ -7,8 +7,8 @@ using osu.Framework.Testing; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Framework.Configuration; -using osu.Game.Graphics.Cursor; using OpenTK; +using osu.Game.Graphics; namespace osu.Desktop.VisualTests.Tests { diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index 12d5d2126c..5643ddcec3 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -1,11 +1,11 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using OpenTK; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; @@ -22,7 +22,25 @@ namespace osu.Game.Graphics.UserInterface private readonly Box leftBox; private readonly Box rightBox; - public string TooltipText => Current.Value.ToString(); + public string TooltipText + { + get + { + var bindableDouble = CurrentNumber as BindableNumber; + if (bindableDouble != null) + { + if (bindableDouble.MaxValue == 1 && bindableDouble.MinValue == 0) + return bindableDouble.Value.ToString(@"P0"); + return bindableDouble.Value.ToString(@"n1"); + } + + var bindableInt = CurrentNumber as BindableNumber; + if (bindableInt != null) + return bindableInt.Value.ToString(@"n0"); + + return Current.Value.ToString(); + } + } public OsuSliderBar() { From d7bee7cc95391d4e1b312da70b0fabfa842dfe01 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Apr 2017 18:00:29 +0900 Subject: [PATCH 324/442] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index c104bf45e7..e24091cf7f 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit c104bf45e7bc85c5ab000c9fe92e6cfbe2bd0ef4 +Subproject commit e24091cf7f5bf25602306c11146326079f2a98b0 From f50e43fc4bfe0e360012faf3be822ec732603d2e Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 20 Apr 2017 18:02:09 +0900 Subject: [PATCH 325/442] CI fixes. --- osu.Game/Rulesets/Replays/ReplayFrame.cs | 2 +- osu.Game/Rulesets/UI/StandardHudOverlay.cs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Replays/ReplayFrame.cs b/osu.Game/Rulesets/Replays/ReplayFrame.cs index b2bda84851..b0f62e5271 100644 --- a/osu.Game/Rulesets/Replays/ReplayFrame.cs +++ b/osu.Game/Rulesets/Replays/ReplayFrame.cs @@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Replays { public Vector2 Position => new Vector2(MouseX ?? 0, MouseY ?? 0); - public bool IsImportant => (MouseX.HasValue && MouseY.HasValue) && (MouseLeft || MouseRight); + public bool IsImportant => MouseX.HasValue && MouseY.HasValue && (MouseLeft || MouseRight); public float? MouseX; public float? MouseY; diff --git a/osu.Game/Rulesets/UI/StandardHudOverlay.cs b/osu.Game/Rulesets/UI/StandardHudOverlay.cs index 7fe830ebef..97593ade15 100644 --- a/osu.Game/Rulesets/UI/StandardHudOverlay.cs +++ b/osu.Game/Rulesets/UI/StandardHudOverlay.cs @@ -3,7 +3,6 @@ using OpenTK; using osu.Framework.Allocation; -using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Primitives; using osu.Game.Graphics; From 4e1942f998d7dc6f4c74d9b46988a786ad7ea022 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Apr 2017 18:17:12 +0900 Subject: [PATCH 326/442] Fix tooltips sticking after drag. --- osu.Game/Graphics/Cursor/TooltipContainer.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/Cursor/TooltipContainer.cs b/osu.Game/Graphics/Cursor/TooltipContainer.cs index 8a55f1897f..5f0743746a 100644 --- a/osu.Game/Graphics/Cursor/TooltipContainer.cs +++ b/osu.Game/Graphics/Cursor/TooltipContainer.cs @@ -55,9 +55,20 @@ namespace osu.Game.Graphics.Cursor } } + protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + { + updateTooltipState(state); + return base.OnMouseUp(state, args); + } + protected override bool OnMouseMove(InputState state) { + updateTooltipState(state); + return base.OnMouseMove(state); + } + private void updateTooltipState(InputState state) + { if (currentlyDisplayed?.Hovering != true) { if (currentlyDisplayed != null && !state.Mouse.HasMainButtonPressed) @@ -80,8 +91,6 @@ namespace osu.Game.Graphics.Cursor currentlyDisplayed = tooltipTarget; }, (1 - tooltip.Alpha) * default_appear_delay); } - - return base.OnMouseMove(state); } public class Tooltip : Container From b65b2bdf4cfb6e7f3110cda7fd8e82b7838d9c06 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 20 Apr 2017 18:29:55 +0900 Subject: [PATCH 327/442] Simplify assignment. --- osu.Game.Rulesets.Osu/OsuAutoReplay.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/OsuAutoReplay.cs b/osu.Game.Rulesets.Osu/OsuAutoReplay.cs index 76ddb48730..da30cf4efb 100644 --- a/osu.Game.Rulesets.Osu/OsuAutoReplay.cs +++ b/osu.Game.Rulesets.Osu/OsuAutoReplay.cs @@ -138,8 +138,7 @@ namespace osu.Game.Rulesets.Osu if (h is Spinner) { - targetPosition.X = Frames[Frames.Count - 1].Position.X; - targetPosition.Y = Frames[Frames.Count - 1].Position.Y; + targetPosition = Frames[Frames.Count - 1].Position; Vector2 difference = spinner_centre - targetPosition; From 008ca07b1663c748ee92cfb9521a8713b126e0cc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Apr 2017 18:54:35 +0900 Subject: [PATCH 328/442] Update score to read statistics from server. Also brings some naming up-to-date. --- osu.Game/Rulesets/Scoring/Score.cs | 35 +++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/osu.Game/Rulesets/Scoring/Score.cs b/osu.Game/Rulesets/Scoring/Score.cs index 5d94fde03b..15d8690322 100644 --- a/osu.Game/Rulesets/Scoring/Score.cs +++ b/osu.Game/Rulesets/Scoring/Score.cs @@ -13,18 +13,16 @@ namespace osu.Game.Rulesets.Scoring { public class Score { - [JsonProperty(@"rank")] public ScoreRank Rank { get; set; } [JsonProperty(@"score")] public double TotalScore { get; set; } - [JsonProperty(@"accuracy")] public double Accuracy { get; set; } public double Health { get; set; } = 1; - [JsonProperty(@"combo")] + [JsonProperty(@"max_combo")] public int MaxCombo { get; set; } public int Combo { get; set; } @@ -50,6 +48,37 @@ namespace osu.Game.Rulesets.Scoring [JsonProperty(@"created_at")] public DateTime Date; + [JsonProperty(@"statistics")] + private Dictionary jsonStats + { + set + { + foreach (var kvp in value) + { + string key = kvp.Key; + switch (key) + { + case @"count_300": + key = @"300"; + break; + case @"count_100": + key = @"100"; + break; + case @"count_50": + key = @"50"; + break; + case @"count_miss": + key = @"x"; + break; + default: + continue; + } + + Statistics.Add(key, kvp.Value); + } + } + } + public Dictionary Statistics = new Dictionary(); } } From 86c60ade8514c71b39398bb5e0e0f1db9e569e60 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Apr 2017 19:16:47 +0900 Subject: [PATCH 329/442] Add a percentage-based slider testcase. --- .../Tests/TestCaseTooltip.cs | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs b/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs index 633d3036dc..c536672314 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTooltip.cs @@ -20,6 +20,9 @@ namespace osu.Desktop.VisualTests.Tests { base.Reset(); OsuSliderBar slider; + OsuSliderBar sliderDouble; + + const float width = 400; Children = new Drawable[] { @@ -27,19 +30,23 @@ namespace osu.Desktop.VisualTests.Tests { RelativeSizeAxes = Axes.Both, Direction = FillDirection.Vertical, - Spacing = new Vector2(0,10), + Spacing = new Vector2(0, 10), Children = new Drawable[] { new TooltipTextContainer("text with a tooltip"), new TooltipTextContainer("more text with another tooltip"), new TooltipTextbox { - Text = "a box with a tooltip", - Size = new Vector2(300,30), + Text = "a textbox with a tooltip", + Size = new Vector2(width,30), }, slider = new OsuSliderBar { - Width = 300, + Width = width, + }, + sliderDouble = new OsuSliderBar + { + Width = width, }, }, }, @@ -50,6 +57,12 @@ namespace osu.Desktop.VisualTests.Tests MaxValue = 10, MinValue = 0 }); + + sliderDouble.Current.BindTo(new BindableDouble(0.5) + { + MaxValue = 1, + MinValue = 0 + }); } private class TooltipTextContainer : Container, IHasTooltip From 3acdc1dcfbfeab9f6c247f24bc2754ab086a644a Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 20 Apr 2017 19:36:53 +0900 Subject: [PATCH 330/442] Update palette colours. --- osu.Game/Graphics/OsuColour.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Graphics/OsuColour.cs b/osu.Game/Graphics/OsuColour.cs index d8de4f6346..cd719431e7 100644 --- a/osu.Game/Graphics/OsuColour.cs +++ b/osu.Game/Graphics/OsuColour.cs @@ -80,6 +80,10 @@ namespace osu.Game.Graphics public Color4 GrayE = FromHex(@"eee"); public Color4 GrayF = FromHex(@"fff"); - public Color4 Red = FromHex(@"fc4549"); + public Color4 RedLighter = FromHex(@"ffeded"); + public Color4 RedLight = FromHex(@"ed7787"); + public Color4 Red = FromHex(@"ed1121"); + public Color4 RedDark = FromHex(@"ba0011"); + public Color4 RedDarker = FromHex(@"870000"); } } From 7df35e1197c65613a93eb44893af14b85ff31df4 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 20 Apr 2017 19:45:15 +0900 Subject: [PATCH 331/442] Bind to method instead of exposing ScoreProcessor to HealthDisplay. --- osu.Game/Rulesets/UI/StandardHealthDisplay.cs | 7 +------ osu.Game/Rulesets/UI/StandardHudOverlay.cs | 3 ++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/osu.Game/Rulesets/UI/StandardHealthDisplay.cs b/osu.Game/Rulesets/UI/StandardHealthDisplay.cs index 51f47f3b2c..a0fb0e95ab 100644 --- a/osu.Game/Rulesets/UI/StandardHealthDisplay.cs +++ b/osu.Game/Rulesets/UI/StandardHealthDisplay.cs @@ -93,12 +93,7 @@ namespace osu.Game.Rulesets.UI }; } - public void BindProcessor(ScoreProcessor processor) - { - processor.NewJudgement += onNewJudgement; - } - - private void onNewJudgement(Judgement judgement) + public void Flash(Judgement judgement) { if (judgement.Result == HitResult.Miss) return; diff --git a/osu.Game/Rulesets/UI/StandardHudOverlay.cs b/osu.Game/Rulesets/UI/StandardHudOverlay.cs index 97593ade15..c68e29f98a 100644 --- a/osu.Game/Rulesets/UI/StandardHudOverlay.cs +++ b/osu.Game/Rulesets/UI/StandardHudOverlay.cs @@ -84,7 +84,8 @@ namespace osu.Game.Rulesets.UI base.BindProcessor(processor); var shd = HealthDisplay as StandardHealthDisplay; - shd?.BindProcessor(processor); + if (shd != null) + processor.NewJudgement += shd.Flash; } } } From c7411c47d6310aeac529e23877ed0aab80415e11 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Apr 2017 19:48:53 +0900 Subject: [PATCH 332/442] Update User API stuff. --- osu.Game/Screens/Ranking/ResultsPageScore.cs | 4 ++-- osu.Game/Users/User.cs | 19 ++++++++++++------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index 88c9da802e..1c2a126211 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -371,8 +371,8 @@ namespace osu.Game.Screens.Ranking [BackgroundDependencyLoader] private void load(TextureStore textures) { - if (user.Cover?.Url != null) - cover.Texture = textures.Get(user.Cover?.Url); + if (!string.IsNullOrEmpty(user.CoverUrl)) + cover.Texture = textures.Get(user.CoverUrl); } } diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index 4ce8781964..1361eefcff 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -13,24 +13,29 @@ namespace osu.Game.Users [JsonProperty(@"username")] public string Username; - //[JsonProperty(@"country")] - [JsonIgnore] + [JsonProperty(@"country_code")] + public string CountryCode; + + [JsonProperty(@"country")] public Country Country; //public Team Team; - [JsonProperty(@"colour")] + [JsonProperty(@"profile_colour")] public string Colour; - [JsonProperty(@"avatarUrl")] + [JsonProperty(@"avatar_url")] public string AvatarUrl; - [JsonProperty(@"cover")] - public UserCover Cover; + [JsonProperty(@"cover_url")] + public string CoverUrl; + + //[JsonProperty(@"cover")] + //public UserCover Cover; public class UserCover { - [JsonProperty(@"customUrl")] + [JsonProperty(@"custom_url")] public string CustomUrl; [JsonProperty(@"url")] From 3342a97b20e27a42fcc36040c88e6e7fb7ace4cf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Apr 2017 19:52:32 +0900 Subject: [PATCH 333/442] Remove using. --- osu.Game/Rulesets/UI/StandardHealthDisplay.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Rulesets/UI/StandardHealthDisplay.cs b/osu.Game/Rulesets/UI/StandardHealthDisplay.cs index a0fb0e95ab..3d9a5489dc 100644 --- a/osu.Game/Rulesets/UI/StandardHealthDisplay.cs +++ b/osu.Game/Rulesets/UI/StandardHealthDisplay.cs @@ -10,7 +10,6 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects.Drawables; -using osu.Game.Rulesets.Scoring; using System; namespace osu.Game.Rulesets.UI From ac9f0ccb48bd88e78e4e234340e60f8e6de145e5 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 21 Apr 2017 13:51:40 +0900 Subject: [PATCH 334/442] Fix hit normals always being played, regardless of sound type. --- .../Objects/Legacy/HitObjectParser.cs | 82 ++++++++++--------- 1 file changed, 45 insertions(+), 37 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs index c915e67ead..5031128a79 100644 --- a/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs @@ -108,43 +108,8 @@ namespace osu.Game.Rulesets.Objects.Legacy result.StartTime = Convert.ToDouble(split[2], CultureInfo.InvariantCulture); var soundType = (LegacySoundType)int.Parse(split[4]); - - result.Samples.Add(new SampleInfo - { - Bank = normalSampleBank, - Name = SampleInfo.HIT_NORMAL, - Volume = sampleVolume - }); - - if ((soundType & LegacySoundType.Finish) > 0) - { - result.Samples.Add(new SampleInfo - { - Bank = addSampleBank, - Name = SampleInfo.HIT_FINISH, - Volume = sampleVolume - }); - } - - if ((soundType & LegacySoundType.Whistle) > 0) - { - result.Samples.Add(new SampleInfo - { - Bank = addSampleBank, - Name = SampleInfo.HIT_WHISTLE, - Volume = sampleVolume - }); - } - - if ((soundType & LegacySoundType.Clap) > 0) - { - result.Samples.Add(new SampleInfo - { - Bank = addSampleBank, - Name = SampleInfo.HIT_CLAP, - Volume = sampleVolume - }); - } + result.Samples = convertSoundType(soundType, normalSampleBank, addSampleBank); + result.Samples.ForEach(s => s.Volume = sampleVolume); return result; } @@ -202,6 +167,49 @@ namespace osu.Game.Rulesets.Objects.Legacy /// The hit object. protected abstract HitObject CreateSpinner(Vector2 position, double endTime); + private List convertSoundType(LegacySoundType type, string normalSampleBank, string addSampleBank) + { + List soundTypes = new List(); + + if ((type & LegacySoundType.Normal) > 0) + { + soundTypes.Add(new SampleInfo + { + Bank = normalSampleBank, + Name = SampleInfo.HIT_NORMAL + }); + } + + if ((type & LegacySoundType.Finish) > 0) + { + soundTypes.Add(new SampleInfo + { + Bank = addSampleBank, + Name = SampleInfo.HIT_FINISH + }); + } + + if ((type & LegacySoundType.Whistle) > 0) + { + soundTypes.Add(new SampleInfo + { + Bank = addSampleBank, + Name = SampleInfo.HIT_WHISTLE + }); + } + + if ((type & LegacySoundType.Clap) > 0) + { + soundTypes.Add(new SampleInfo + { + Bank = addSampleBank, + Name = SampleInfo.HIT_CLAP + }); + } + + return soundTypes; + } + [Flags] private enum LegacySoundType { From d656090aab504a2bbb08ad86159ae01424db994b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Apr 2017 20:27:53 +0900 Subject: [PATCH 335/442] Move tooltips below the cursor. --- osu.Game/OsuGameBase.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 48c7890f6e..6eb9747eef 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -147,8 +147,16 @@ namespace osu.Game { Children = new Drawable[] { - Cursor = new MenuCursor { Depth = float.MinValue }, - new TooltipContainer(Cursor) { Depth = float.MinValue } + new Container + { + RelativeSizeAxes = Axes.Both, + Depth = float.MinValue, + Children = new Drawable[] + { + Cursor = new MenuCursor(), + new TooltipContainer(Cursor) { Depth = -1 }, + } + }, } }); } From 2d53ad4c0ad260bc1d91b93cd582f50ee324b362 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Apr 2017 13:45:11 +0900 Subject: [PATCH 336/442] Remove xmldoc-only using usage. --- .../Objects/Drawables/Pieces/ElongatedCirclePiece.cs | 5 ++--- osu.Game/Rulesets/Judgements/IPartialJudgement.cs | 9 +-------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/ElongatedCirclePiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/ElongatedCirclePiece.cs index 1af3705694..bed54d358e 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/ElongatedCirclePiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/ElongatedCirclePiece.cs @@ -3,14 +3,13 @@ using System; using osu.Framework.Graphics.Primitives; -using osu.Game.Rulesets.Taiko.UI; namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces { public class ElongatedCirclePiece : CirclePiece { /// - /// As we are being used to define the absolute size of hits, we need to be given a relative reference of our containing . + /// As we are being used to define the absolute size of hits, we need to be given a relative reference of our containing playfield container. /// public Func PlayfieldLengthReference; @@ -38,4 +37,4 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces Width = (PlayfieldLengthReference?.Invoke() ?? 0) * Length + DrawHeight; } } -} \ No newline at end of file +} diff --git a/osu.Game/Rulesets/Judgements/IPartialJudgement.cs b/osu.Game/Rulesets/Judgements/IPartialJudgement.cs index e11270a8c0..38080835e0 100644 --- a/osu.Game/Rulesets/Judgements/IPartialJudgement.cs +++ b/osu.Game/Rulesets/Judgements/IPartialJudgement.cs @@ -1,22 +1,15 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Rulesets.Objects.Drawables; -using osu.Game.Rulesets.Scoring; - namespace osu.Game.Rulesets.Judgements { /// /// Inidicates that the judgement this is attached to is a partial judgement and the scoring value may change. - /// - /// This judgement will be continually processed by - /// unless the result is a miss and will trigger a full re-process of the when changed. - /// /// public interface IPartialJudgement { /// - /// Indicates that this partial judgement has changed and requires a full re-process of the . + /// Indicates that this partial judgement has changed and requires reprocessing. /// /// This is set to false once the judgement has been re-processed. /// From ef7bc0f92ef50cc3458753f95b8edb21acdc726c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Apr 2017 13:53:11 +0900 Subject: [PATCH 337/442] Update UI controls to understand DisabledChanged. --- osu.Game/Graphics/UserInterface/OsuCheckbox.cs | 7 +++++-- osu.Game/Graphics/UserInterface/OsuSliderBar.cs | 5 +++++ osu.Game/Graphics/UserInterface/OsuTextBox.cs | 5 +++++ osu.Game/Overlays/Options/OptionDropdown.cs | 7 +++++-- osu.Game/Overlays/Options/OptionSlider.cs | 2 -- osu.Game/Overlays/Options/OptionTextBox.cs | 4 +--- 6 files changed, 21 insertions(+), 9 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs index d339388aa5..e81db4954e 100644 --- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs @@ -25,8 +25,6 @@ namespace osu.Game.Graphics.UserInterface { bindable = value; Current.BindTo(bindable); - if (value?.Disabled ?? true) - Alpha = 0.3f; } } @@ -84,6 +82,11 @@ namespace osu.Game.Graphics.UserInterface else sampleUnchecked?.Play(); }; + + Current.DisabledChanged += disabled => + { + Alpha = disabled ? 0.3f : 1; + }; } protected override bool OnHover(InputState state) diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index 6d36c1a585..9b9a774049 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -74,6 +74,11 @@ namespace osu.Game.Graphics.UserInterface Expanded = true, } }; + + Current.DisabledChanged += disabled => + { + Alpha = disabled ? 0.3f : 1; + }; } [BackgroundDependencyLoader] diff --git a/osu.Game/Graphics/UserInterface/OsuTextBox.cs b/osu.Game/Graphics/UserInterface/OsuTextBox.cs index a54b122615..62b10b96ef 100644 --- a/osu.Game/Graphics/UserInterface/OsuTextBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTextBox.cs @@ -33,6 +33,11 @@ namespace osu.Game.Graphics.UserInterface Height = 40; TextContainer.Height = 0.5f; CornerRadius = 5; + + Current.DisabledChanged += disabled => + { + Alpha = disabled ? 0.3f : 1; + }; } [BackgroundDependencyLoader] diff --git a/osu.Game/Overlays/Options/OptionDropdown.cs b/osu.Game/Overlays/Options/OptionDropdown.cs index ee12ba9b05..8642b132df 100644 --- a/osu.Game/Overlays/Options/OptionDropdown.cs +++ b/osu.Game/Overlays/Options/OptionDropdown.cs @@ -34,8 +34,6 @@ namespace osu.Game.Overlays.Options { bindable = value; dropdown.Current.BindTo(bindable); - if (value?.Disabled ?? true) - Alpha = 0.3f; } } @@ -75,6 +73,11 @@ namespace osu.Game.Overlays.Options Items = Items, } }; + + dropdown.Current.DisabledChanged += disabled => + { + Alpha = disabled ? 0.3f : 1; + }; } } } diff --git a/osu.Game/Overlays/Options/OptionSlider.cs b/osu.Game/Overlays/Options/OptionSlider.cs index 1c4b54a080..5c383c74a8 100644 --- a/osu.Game/Overlays/Options/OptionSlider.cs +++ b/osu.Game/Overlays/Options/OptionSlider.cs @@ -35,8 +35,6 @@ namespace osu.Game.Overlays.Options { bindable = value; slider.Current.BindTo(bindable); - if (value?.Disabled ?? true) - Alpha = 0.3f; } } diff --git a/osu.Game/Overlays/Options/OptionTextBox.cs b/osu.Game/Overlays/Options/OptionTextBox.cs index b5ef39c8b2..4927122181 100644 --- a/osu.Game/Overlays/Options/OptionTextBox.cs +++ b/osu.Game/Overlays/Options/OptionTextBox.cs @@ -16,9 +16,7 @@ namespace osu.Game.Overlays.Options { bindable = value; Current.BindTo(bindable); - if (value?.Disabled ?? true) - Alpha = 0.3f; } } } -} \ No newline at end of file +} From bd7341c5a18e68175e0af794b7cf19997b8ea361 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 21 Apr 2017 14:36:28 +0900 Subject: [PATCH 338/442] Restructure reading normal/add/volume members into class to make code a bit more readable/usable. --- .../Objects/Legacy/HitObjectParser.cs | 64 ++++++++++++------- 1 file changed, 40 insertions(+), 24 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs index 5031128a79..9e10b7c69e 100644 --- a/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs @@ -23,9 +23,9 @@ namespace osu.Game.Rulesets.Objects.Legacy bool combo = type.HasFlag(HitObjectType.NewCombo); type &= ~HitObjectType.NewCombo; - int sampleVolume = 0; - string normalSampleBank = null; - string addSampleBank = null; + var soundType = (LegacySoundType)int.Parse(split[4]); + + SampleBankInfo bankInfo = new SampleBankInfo(); HitObject result; @@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Objects.Legacy result = CreateHit(new Vector2(int.Parse(split[0]), int.Parse(split[1])), combo); if (split.Length > 5) - readCustomSampleBanks(split[5], ref normalSampleBank, ref addSampleBank, ref sampleVolume); + readCustomSampleBanks(split[5], bankInfo); } else if ((type & HitObjectType.Slider) > 0) { @@ -76,18 +76,19 @@ namespace osu.Game.Rulesets.Objects.Legacy if (split.Length > 7) length = Convert.ToDouble(split[7], CultureInfo.InvariantCulture); + + if (split.Length > 10) + readCustomSampleBanks(split[10], bankInfo); result = CreateSlider(new Vector2(int.Parse(split[0]), int.Parse(split[1])), combo, points, length, curveType, repeatCount); - if (split.Length > 10) - readCustomSampleBanks(split[10], ref normalSampleBank, ref addSampleBank, ref sampleVolume); } else if ((type & HitObjectType.Spinner) > 0) { result = CreateSpinner(new Vector2(512, 384) / 2, Convert.ToDouble(split[5], CultureInfo.InvariantCulture)); if (split.Length > 6) - readCustomSampleBanks(split[6], ref normalSampleBank, ref addSampleBank, ref sampleVolume); + readCustomSampleBanks(split[6], bankInfo); } else if ((type & HitObjectType.Hold) > 0) { @@ -106,15 +107,12 @@ namespace osu.Game.Rulesets.Objects.Legacy throw new InvalidOperationException($@"Unknown hit object type {type}"); result.StartTime = Convert.ToDouble(split[2], CultureInfo.InvariantCulture); - - var soundType = (LegacySoundType)int.Parse(split[4]); - result.Samples = convertSoundType(soundType, normalSampleBank, addSampleBank); - result.Samples.ForEach(s => s.Volume = sampleVolume); + result.Samples = convertSoundType(soundType, bankInfo); return result; } - private void readCustomSampleBanks(string str, ref string normalSampleBank, ref string addSampleBank, ref int sampleVolume) + private void readCustomSampleBanks(string str, SampleBankInfo bankInfo) { if (string.IsNullOrEmpty(str)) return; @@ -134,9 +132,11 @@ namespace osu.Game.Rulesets.Objects.Legacy if (stringAddBank == @"none") stringAddBank = null; - normalSampleBank = stringBank; - addSampleBank = stringAddBank; - sampleVolume = split.Length > 3 ? int.Parse(split[3]) : 0; + bankInfo.Normal = stringBank; + bankInfo.Add = stringAddBank; + + if (split.Length > 3) + bankInfo.Volume = int.Parse(split[3]); } /// @@ -167,7 +167,7 @@ namespace osu.Game.Rulesets.Objects.Legacy /// The hit object. protected abstract HitObject CreateSpinner(Vector2 position, double endTime); - private List convertSoundType(LegacySoundType type, string normalSampleBank, string addSampleBank) + private List convertSoundType(LegacySoundType type, SampleBankInfo bankInfo) { List soundTypes = new List(); @@ -175,8 +175,9 @@ namespace osu.Game.Rulesets.Objects.Legacy { soundTypes.Add(new SampleInfo { - Bank = normalSampleBank, - Name = SampleInfo.HIT_NORMAL + Bank = bankInfo.Normal, + Name = SampleInfo.HIT_NORMAL, + Volume = bankInfo.Volume }); } @@ -184,8 +185,9 @@ namespace osu.Game.Rulesets.Objects.Legacy { soundTypes.Add(new SampleInfo { - Bank = addSampleBank, - Name = SampleInfo.HIT_FINISH + Bank = bankInfo.Add, + Name = SampleInfo.HIT_FINISH, + Volume = bankInfo.Volume }); } @@ -193,8 +195,9 @@ namespace osu.Game.Rulesets.Objects.Legacy { soundTypes.Add(new SampleInfo { - Bank = addSampleBank, - Name = SampleInfo.HIT_WHISTLE + Bank = bankInfo.Add, + Name = SampleInfo.HIT_WHISTLE, + Volume = bankInfo.Volume }); } @@ -202,14 +205,27 @@ namespace osu.Game.Rulesets.Objects.Legacy { soundTypes.Add(new SampleInfo { - Bank = addSampleBank, - Name = SampleInfo.HIT_CLAP + Bank = bankInfo.Add, + Name = SampleInfo.HIT_CLAP, + Volume = bankInfo.Volume }); } return soundTypes; } + private class SampleBankInfo + { + public string Normal = null; + public string Add = null; + public int Volume = 0; + + public SampleBankInfo Clone() + { + return (SampleBankInfo)MemberwiseClone(); + } + } + [Flags] private enum LegacySoundType { From 83f1f9d7e5a75a0caa3c22d537d700e829266f18 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 21 Apr 2017 14:38:46 +0900 Subject: [PATCH 339/442] Add ability to parse per-repeat sounds. --- .../Objects/Legacy/HitObjectParser.cs | 50 ++++++++++++++++++- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs index 9e10b7c69e..630f6e474d 100644 --- a/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs @@ -80,8 +80,54 @@ namespace osu.Game.Rulesets.Objects.Legacy if (split.Length > 10) readCustomSampleBanks(split[10], bankInfo); - result = CreateSlider(new Vector2(int.Parse(split[0]), int.Parse(split[1])), combo, points, length, curveType, repeatCount); + // Per-repeat sounds + // Populate initial bank infos with the default hit object bank + List repeatBankInfos = new List(); + for (int i = 0; i <= repeatCount; i++) + repeatBankInfos.Add(bankInfo.Clone()); + + // Read any per-repeat banks + if (split.Length > 9 && split[9].Length > 0) + { + string[] sets = split[9].Split('|'); + if (sets.Length > 0) + { + for (int i = 0; i <= repeatCount; i++) + { + if (i >= sets.Length) + break; + + SampleBankInfo info = repeatBankInfos[i]; + readCustomSampleBanks(sets[i], info); + } + } + } + + // Read any per-repeat sample infos + List> sounds = new List>(); + if (split.Length > 8 && split[8].Length > 0) + { + // Per-repeat sample types + string[] adds = split[9].Split('|'); + if (adds.Length > 0) + { + for (int i = 0; i <= repeatCount; i++) + { + if (i >= adds.Length) + { + sounds.Add(convertSoundType(soundType, repeatBankInfos[i])); + continue; + } + + int sound; + int.TryParse(adds[i], out sound); + sounds.Add(convertSoundType((LegacySoundType)sound, repeatBankInfos[i])); + } + } + } + + result = CreateSlider(new Vector2(int.Parse(split[0]), int.Parse(split[1])), combo, points, length, curveType, repeatCount, sounds); } else if ((type & HitObjectType.Spinner) > 0) { @@ -157,7 +203,7 @@ namespace osu.Game.Rulesets.Objects.Legacy /// The slider curve type. /// The slider repeat count. /// The hit object. - protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount); + protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> sounds); /// /// Creates a legacy Spinner-type hit object. From 4a3ae6937d1f1f2d3fa786a3b09620d8420fcf48 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Apr 2017 15:41:22 +0900 Subject: [PATCH 340/442] Improve the look of ScreenWhiteBox. --- osu.Game/Screens/ScreenWhiteBox.cs | 114 +++++++++++++++++++---------- 1 file changed, 77 insertions(+), 37 deletions(-) diff --git a/osu.Game/Screens/ScreenWhiteBox.cs b/osu.Game/Screens/ScreenWhiteBox.cs index dca5e17efa..04432058dc 100644 --- a/osu.Game/Screens/ScreenWhiteBox.cs +++ b/osu.Game/Screens/ScreenWhiteBox.cs @@ -7,12 +7,15 @@ using osu.Framework.Screens; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.Sprites; using osu.Game.Screens.Backgrounds; using osu.Game.Graphics.UserInterface; using OpenTK; using OpenTK.Graphics; +using osu.Framework.Allocation; +using osu.Framework.Audio; +using osu.Game.Graphics; +using osu.Framework.Extensions.Color4Extensions; namespace osu.Game.Screens { @@ -24,8 +27,8 @@ namespace osu.Game.Screens protected virtual IEnumerable PossibleChildren => null; - private readonly Container textContainer; - private readonly Box box; + private readonly FillFlowContainer textContainer; + private readonly Container boxContainer; protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg2"); @@ -40,13 +43,13 @@ namespace osu.Game.Screens Content.Alpha = 0; textContainer.Position = new Vector2(DrawSize.X / 16, 0); - box.ScaleTo(0.2f); - box.RotateTo(-20); + boxContainer.ScaleTo(0.2f); + boxContainer.RotateTo(-20); Content.Delay(300, true); - box.ScaleTo(1, transition_time, EasingTypes.OutElastic); - box.RotateTo(0, transition_time / 2, EasingTypes.OutQuint); + boxContainer.ScaleTo(1, transition_time, EasingTypes.OutElastic); + boxContainer.RotateTo(0, transition_time / 2, EasingTypes.OutQuint); textContainer.MoveTo(Vector2.Zero, transition_time, EasingTypes.OutExpo); Content.FadeIn(transition_time, EasingTypes.OutExpo); @@ -82,36 +85,62 @@ namespace osu.Game.Screens Children = new Drawable[] { - box = new Box + boxContainer = new Container { - RelativeSizeAxes = Axes.Both, Size = new Vector2(0.3f), + RelativeSizeAxes = Axes.Both, + CornerRadius = 20, + Masking = true, Anchor = Anchor.Centre, Origin = Anchor.Centre, - Colour = getColourFor(GetType()), - Alpha = 1, - BlendingMode = BlendingMode.Additive, - }, - textContainer = new Container - { - AutoSizeAxes = Axes.Both, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Children = new[] + Children = new Drawable[] { - new OsuSpriteText + new Box { - Text = GetType().Name, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - TextSize = 50, + RelativeSizeAxes = Axes.Both, + + Colour = getColourFor(GetType()), + Alpha = 0.2f, + BlendingMode = BlendingMode.Additive, }, - new OsuSpriteText + textContainer = new FillFlowContainer { - Text = GetType().Namespace, + AutoSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, - Position = new Vector2(0, 30) + Direction = FillDirection.Vertical, + Children = new[] + { + new TextAwesome + { + Icon = FontAwesome.fa_universal_access, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + TextSize = 50, + }, + new OsuSpriteText + { + Text = GetType().Name, + Colour = getColourFor(GetType()).Lighten(0.8f), + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + TextSize = 50, + }, + new OsuSpriteText + { + Text = "is not yet ready for use!", + TextSize = 20, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + }, + new OsuSpriteText + { + Text = "please check back a bit later.", + TextSize = 14, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + }, + } }, } }, @@ -120,17 +149,15 @@ namespace osu.Game.Screens Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Alpha = 0, - Action = delegate { - Exit(); - } + Action = Exit }, childModeButtons = new FillFlowContainer { Direction = FillDirection.Vertical, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, - RelativeSizeAxes = Axes.Both, - Size = new Vector2(0.1f, 1) + RelativeSizeAxes = Axes.Y, + Size = new Vector2(TwoLayerButton.SIZE_RETRACTED.X, 1) } }; @@ -138,14 +165,11 @@ namespace osu.Game.Screens { foreach (Type t in PossibleChildren) { - childModeButtons.Add(new Button + childModeButtons.Add(new ChildModeButton { Text = $@"{t.Name}", - RelativeSizeAxes = Axes.X, - Size = new Vector2(1, 40), - Anchor = Anchor.BottomRight, - Origin = Anchor.BottomRight, BackgroundColour = getColourFor(t), + HoverColour = getColourFor(t).Lighten(0.2f), Action = delegate { Push(Activator.CreateInstance(t) as Screen); @@ -163,5 +187,21 @@ namespace osu.Game.Screens byte b = (byte)MathHelper.Clamp((hash & 0x0000FF) * 0.8f, 20, 255); return new Color4(r, g, b, 255); } + + public class ChildModeButton : TwoLayerButton + { + public ChildModeButton() + { + Icon = FontAwesome.fa_osu_right_o; + Anchor = Anchor.BottomRight; + Origin = Anchor.BottomRight; + } + + [BackgroundDependencyLoader] + private void load(AudioManager audio) + { + ActivationSound = audio.Sample.Get(@"Menu/menuhit"); + } + } } } From 5aa90df8195ffc8407a6d6fa63d84e48301d320d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Apr 2017 16:03:59 +0900 Subject: [PATCH 341/442] Allow OsuScreens to decide whether ruleset switching should be allowed. Tidies up ToolbarModeSelector a lot by using DI. --- osu.Game/OsuGame.cs | 8 +------ osu.Game/Overlays/Toolbar/Toolbar.cs | 12 +--------- .../Overlays/Toolbar/ToolbarModeSelector.cs | 24 ++++++++++++------- osu.Game/Screens/OsuScreen.cs | 19 ++++++++++++++- osu.Game/Screens/Play/Player.cs | 2 ++ osu.Game/Screens/Play/PlayerLoader.cs | 2 ++ osu.Game/Screens/Ranking/Results.cs | 2 ++ 7 files changed, 41 insertions(+), 28 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index a139c4d6ce..c9f41de5f2 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -203,13 +203,7 @@ namespace osu.Game { Depth = -3, OnHome = delegate { intro?.ChildScreen?.MakeCurrent(); }, - OnRulesetChange = r => Ruleset.Value = r, - }, t => - { - Ruleset.ValueChanged += delegate { Toolbar.SetRuleset(Ruleset.Value); }; - Ruleset.TriggerChange(); - overlayContent.Add(Toolbar); - }); + }, overlayContent.Add); options.StateChanged += delegate { diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index a5074100c7..8c4e9e2ff8 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Input; -using osu.Game.Database; using osu.Game.Graphics; using OpenTK; @@ -20,7 +19,6 @@ namespace osu.Game.Overlays.Toolbar public const float TOOLTIP_HEIGHT = 30; public Action OnHome; - public Action OnRulesetChange; private readonly ToolbarModeSelector modeSelector; private readonly ToolbarUserArea userArea; @@ -53,13 +51,7 @@ namespace osu.Game.Overlays.Toolbar { Action = () => OnHome?.Invoke() }, - modeSelector = new ToolbarModeSelector - { - OnRulesetChange = mode => - { - OnRulesetChange?.Invoke(mode); - } - } + modeSelector = new ToolbarModeSelector() } }, new FillFlowContainer @@ -130,8 +122,6 @@ namespace osu.Game.Overlays.Toolbar } } - public void SetRuleset(RulesetInfo ruleset) => modeSelector.SetRuleset(ruleset); - protected override void PopIn() { MoveToY(0, transition_time, EasingTypes.OutQuint); diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs index 1d3260bb23..209b64e709 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Caching; @@ -12,6 +11,7 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Database; using OpenTK; using OpenTK.Graphics; +using osu.Framework.Configuration; namespace osu.Game.Overlays.Toolbar { @@ -23,7 +23,7 @@ namespace osu.Game.Overlays.Toolbar private readonly Drawable modeButtonLine; private ToolbarModeButton activeButton; - public Action OnRulesetChange; + private readonly Bindable ruleset = new Bindable(); public ToolbarModeSelector() { @@ -66,30 +66,36 @@ namespace osu.Game.Overlays.Toolbar } [BackgroundDependencyLoader] - private void load(RulesetDatabase rulesets) + private void load(RulesetDatabase rulesets, OsuGame game) { - foreach (var ruleset in rulesets.AllRulesets) + foreach (var r in rulesets.AllRulesets) { modeButtons.Add(new ToolbarModeButton { - Ruleset = ruleset, + Ruleset = r, Action = delegate { - SetRuleset(ruleset); - OnRulesetChange?.Invoke(ruleset); + ruleset.Value = r; } }); } + + ruleset.ValueChanged += rulesetChanged; + ruleset.DisabledChanged += disabledChanged; + ruleset.BindTo(game.Ruleset); } + public override bool HandleInput => !ruleset.Disabled; + + private void disabledChanged(bool isDisabled) => FadeColour(isDisabled ? Color4.Gray : Color4.White, 300); + protected override void Update() { base.Update(); - Size = new Vector2(modeButtons.DrawSize.X, 1); } - public void SetRuleset(RulesetInfo ruleset) + private void rulesetChanged(RulesetInfo ruleset) { foreach (ToolbarModeButton m in modeButtons.Children.Cast()) { diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index d0856bfe3e..0b3ecb4f5a 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -5,6 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Screens; using osu.Game.Beatmaps; +using osu.Game.Database; using osu.Game.Graphics.Containers; namespace osu.Game.Screens @@ -25,8 +26,12 @@ namespace osu.Game.Screens internal virtual bool HasLocalCursorDisplayed => false; + internal virtual bool AllowRulesetChange => true; + private readonly Bindable beatmap = new Bindable(); + private readonly Bindable ruleset = new Bindable(); + public WorkingBeatmap Beatmap { get @@ -40,7 +45,7 @@ namespace osu.Game.Screens } [BackgroundDependencyLoader(permitNulls: true)] - private void load(OsuGameBase game) + private void load(OsuGameBase game, OsuGame osuGame) { if (game != null) { @@ -52,11 +57,23 @@ namespace osu.Game.Screens } beatmap.ValueChanged += OnBeatmapChanged; + + if (osuGame != null) + ruleset.BindTo(osuGame.Ruleset); } + /// + /// The global Beatmap was changed. + /// protected virtual void OnBeatmapChanged(WorkingBeatmap beatmap) { + } + protected override void Update() + { + if (!IsCurrentScreen) return; + + ruleset.Disabled = !AllowRulesetChange; } protected override void OnEntering(Screen last) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 5502723c0d..70cf82af80 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -39,6 +39,8 @@ namespace osu.Game.Screens.Play public bool IsPaused => !interpolatedSourceClock.IsRunning; + internal override bool AllowRulesetChange => false; + public bool HasFailed { get; private set; } public int RestartCount; diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 615b138ead..765abd9873 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -27,6 +27,8 @@ namespace osu.Game.Screens.Play private bool showOverlays = true; internal override bool ShowOverlays => showOverlays; + internal override bool AllowRulesetChange => false; + protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap); public PlayerLoader(Player player) diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index f4edc11436..ffe72966f5 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -31,6 +31,8 @@ namespace osu.Game.Screens.Ranking private ResultModeTabControl modeChangeButtons; + internal override bool AllowRulesetChange => false; + private Container currentPage; private static readonly Vector2 background_blur = new Vector2(20); From 25a7d99a8e7b90b1447fdbfcfce02326fe4cb300 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Apr 2017 16:11:24 +0900 Subject: [PATCH 342/442] Remove unused reference. --- osu.Game/Overlays/Toolbar/Toolbar.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index 8c4e9e2ff8..43c3cd32f2 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -20,7 +20,6 @@ namespace osu.Game.Overlays.Toolbar public Action OnHome; - private readonly ToolbarModeSelector modeSelector; private readonly ToolbarUserArea userArea; protected override bool HideOnEscape => false; @@ -51,7 +50,7 @@ namespace osu.Game.Overlays.Toolbar { Action = () => OnHome?.Invoke() }, - modeSelector = new ToolbarModeSelector() + new ToolbarModeSelector() } }, new FillFlowContainer From b4a45973666a8c7e235be7054efc66bf5371bef5 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 21 Apr 2017 16:18:00 +0900 Subject: [PATCH 343/442] Transform legacy HitObjectParsers to give repeat slider sounds, instead of all sounds. --- .../Objects/Legacy/Catch/HitObjectParser.cs | 6 +- .../Objects/Legacy/HitObjectParser.cs | 83 ++++++++++--------- .../Objects/Legacy/Mania/HitObjectParser.cs | 6 +- .../Objects/Legacy/Osu/HitObjectParser.cs | 6 +- .../Objects/Legacy/Taiko/HitObjectParser.cs | 6 +- 5 files changed, 62 insertions(+), 45 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Legacy/Catch/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/HitObjectParser.cs index a27244e5bd..7ce6af85fd 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Catch/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/HitObjectParser.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; +using osu.Game.Audio; using osu.Game.Rulesets.Objects.Types; using System.Collections.Generic; @@ -21,7 +22,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) { return new Slider { @@ -30,7 +31,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch ControlPoints = controlPoints, Distance = length, CurveType = curveType, - RepeatCount = repeatCount + RepeatCount = repeatCount, + RepeatSamples = repeatSamples }; } diff --git a/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs index 630f6e474d..84cc41b575 100644 --- a/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Globalization; using osu.Game.Beatmaps.Formats; using osu.Game.Audio; +using System.Linq; namespace osu.Game.Rulesets.Objects.Legacy { @@ -19,13 +20,13 @@ namespace osu.Game.Rulesets.Objects.Legacy public override HitObject Parse(string text) { string[] split = text.Split(','); - var type = (HitObjectType)int.Parse(split[3]) & ~HitObjectType.ColourHax; + HitObjectType type = (HitObjectType)int.Parse(split[3]) & ~HitObjectType.ColourHax; bool combo = type.HasFlag(HitObjectType.NewCombo); type &= ~HitObjectType.NewCombo; var soundType = (LegacySoundType)int.Parse(split[4]); - - SampleBankInfo bankInfo = new SampleBankInfo(); + var bankInfo = new SampleBankInfo(); + List startSamples = null; HitObject result; @@ -80,54 +81,61 @@ namespace osu.Game.Rulesets.Objects.Legacy if (split.Length > 10) readCustomSampleBanks(split[10], bankInfo); - // Per-repeat sounds + // One node for each repeat + the start and end nodes + int nodes = repeatCount + 2; - // Populate initial bank infos with the default hit object bank - List repeatBankInfos = new List(); - for (int i = 0; i <= repeatCount; i++) - repeatBankInfos.Add(bankInfo.Clone()); + // Populate node sample bank infos with the default hit object sample bank + var nodeBankInfos = new List(); + for (int i = 0; i < nodes; i++) + nodeBankInfos.Add(bankInfo.Clone()); - // Read any per-repeat banks + // Read any per-node sample banks if (split.Length > 9 && split[9].Length > 0) { string[] sets = split[9].Split('|'); - if (sets.Length > 0) + for (int i = 0; i < nodes; i++) { - for (int i = 0; i <= repeatCount; i++) - { - if (i >= sets.Length) - break; + if (i >= sets.Length) + break; - SampleBankInfo info = repeatBankInfos[i]; - readCustomSampleBanks(sets[i], info); - } + SampleBankInfo info = nodeBankInfos[i]; + readCustomSampleBanks(sets[i], info); } } - // Read any per-repeat sample infos - List> sounds = new List>(); + // Populate node sound types with the default hit object sound type + var nodeSoundTypes = new List(); + for (int i = 0; i < nodes; i++) + nodeSoundTypes.Add(soundType); + + // Read any per-node sound types + string[] adds = null; if (split.Length > 8 && split[8].Length > 0) { - // Per-repeat sample types - string[] adds = split[9].Split('|'); - if (adds.Length > 0) + adds = split[8].Split('|'); + for (int i = 0; i < nodes; i++) { - for (int i = 0; i <= repeatCount; i++) - { - if (i >= adds.Length) - { - sounds.Add(convertSoundType(soundType, repeatBankInfos[i])); - continue; - } + if (i >= adds.Length) + break; - int sound; - int.TryParse(adds[i], out sound); - sounds.Add(convertSoundType((LegacySoundType)sound, repeatBankInfos[i])); - } + int sound; + int.TryParse(adds[i], out sound); + nodeSoundTypes[i] = (LegacySoundType)sound; } } - result = CreateSlider(new Vector2(int.Parse(split[0]), int.Parse(split[1])), combo, points, length, curveType, repeatCount, sounds); + // Generate the final per-node samples + var nodeSamples = new List>(nodes); + for (int i = 0; i <= repeatCount; i++) + nodeSamples.Add(convertSoundType(nodeSoundTypes[i], nodeBankInfos[i])); + + // Extract the first node as the first sample + startSamples = nodeSamples[0]; + + // Repeat samples are all the samples excluding the one from the first node (note this includes the end node) + var repeatSamples = nodeSamples.Skip(1).ToList(); + + result = CreateSlider(new Vector2(int.Parse(split[0]), int.Parse(split[1])), combo, points, length, curveType, repeatCount, repeatSamples); } else if ((type & HitObjectType.Spinner) > 0) { @@ -153,7 +161,7 @@ namespace osu.Game.Rulesets.Objects.Legacy throw new InvalidOperationException($@"Unknown hit object type {type}"); result.StartTime = Convert.ToDouble(split[2], CultureInfo.InvariantCulture); - result.Samples = convertSoundType(soundType, bankInfo); + result.Samples = startSamples ?? convertSoundType(soundType, bankInfo); return result; } @@ -202,8 +210,9 @@ namespace osu.Game.Rulesets.Objects.Legacy /// The slider length. /// The slider curve type. /// The slider repeat count. + /// The slider repeat sounds (this includes the end node, but NOT the start node). /// The hit object. - protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> sounds); + protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples); /// /// Creates a legacy Spinner-type hit object. @@ -215,7 +224,7 @@ namespace osu.Game.Rulesets.Objects.Legacy private List convertSoundType(LegacySoundType type, SampleBankInfo bankInfo) { - List soundTypes = new List(); + var soundTypes = new List(); if ((type & LegacySoundType.Normal) > 0) { diff --git a/osu.Game/Rulesets/Objects/Legacy/Mania/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Mania/HitObjectParser.cs index 98f0459e0a..f3b0738b1a 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Mania/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Mania/HitObjectParser.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; +using osu.Game.Audio; using osu.Game.Rulesets.Objects.Types; using System.Collections.Generic; @@ -21,7 +22,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) { return new Slider { @@ -30,7 +31,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania ControlPoints = controlPoints, Distance = length, CurveType = curveType, - RepeatCount = repeatCount + RepeatCount = repeatCount, + RepeatSamples = repeatSamples }; } diff --git a/osu.Game/Rulesets/Objects/Legacy/Osu/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/HitObjectParser.cs index 227a4412c4..fd018c41a2 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Osu/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Osu/HitObjectParser.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; +using osu.Game.Audio; using osu.Game.Rulesets.Objects.Types; using System.Collections.Generic; @@ -21,7 +22,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) { return new Slider { @@ -30,7 +31,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu ControlPoints = controlPoints, Distance = length, CurveType = curveType, - RepeatCount = repeatCount + RepeatCount = repeatCount, + RepeatSamples = repeatSamples }; } diff --git a/osu.Game/Rulesets/Objects/Legacy/Taiko/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Taiko/HitObjectParser.cs index 669ee34910..a297bc5692 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Taiko/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Taiko/HitObjectParser.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; +using osu.Game.Audio; using osu.Game.Rulesets.Objects.Types; using System.Collections.Generic; @@ -20,7 +21,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) { return new Slider { @@ -28,7 +29,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko ControlPoints = controlPoints, Distance = length, CurveType = curveType, - RepeatCount = repeatCount + RepeatCount = repeatCount, + RepeatSamples = repeatSamples }; } From ca824de91c0b0a136a8d6b62dd78b456e320fb27 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 21 Apr 2017 16:18:34 +0900 Subject: [PATCH 344/442] Implement RepeatSamples in IHasRepeats. --- osu.Game.Rulesets.Osu/Objects/Slider.cs | 2 ++ osu.Game/Rulesets/Objects/CurvedHitObject.cs | 6 ++++ osu.Game/Rulesets/Objects/HitObject.cs | 29 ++++++++++++------- .../Rulesets/Objects/Types/IHasRepeats.cs | 5 ++++ 4 files changed, 32 insertions(+), 10 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index 167bf21670..48c871d64d 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -33,6 +33,8 @@ namespace osu.Game.Rulesets.Osu.Objects public double ProgressAt(double progress) => CurveObject.ProgressAt(progress); public int RepeatAt(double progress) => CurveObject.RepeatAt(progress); + public List> RepeatSamples => CurveObject.RepeatSamples; + public List ControlPoints => CurveObject.ControlPoints; public CurveType CurveType => CurveObject.CurveType; public double Distance => CurveObject.Distance; diff --git a/osu.Game/Rulesets/Objects/CurvedHitObject.cs b/osu.Game/Rulesets/Objects/CurvedHitObject.cs index 517c276242..b43c10476a 100644 --- a/osu.Game/Rulesets/Objects/CurvedHitObject.cs +++ b/osu.Game/Rulesets/Objects/CurvedHitObject.cs @@ -4,6 +4,10 @@ using OpenTK; using osu.Game.Rulesets.Objects.Types; using System.Collections.Generic; +using osu.Game.Audio; +using System; +using osu.Game.Beatmaps.Timing; +using osu.Game.Database; namespace osu.Game.Rulesets.Objects { @@ -34,6 +38,8 @@ namespace osu.Game.Rulesets.Objects set { Curve.Distance = value; } } + public List> RepeatSamples { get; set; } = new List>(); + public Vector2 PositionAt(double progress) => Curve.PositionAt(ProgressAt(progress)); public double ProgressAt(double progress) diff --git a/osu.Game/Rulesets/Objects/HitObject.cs b/osu.Game/Rulesets/Objects/HitObject.cs index 240d110976..52f157d472 100644 --- a/osu.Game/Rulesets/Objects/HitObject.cs +++ b/osu.Game/Rulesets/Objects/HitObject.cs @@ -4,6 +4,7 @@ using osu.Game.Audio; using osu.Game.Beatmaps.Timing; using osu.Game.Database; +using osu.Game.Rulesets.Objects.Types; using System.Collections.Generic; namespace osu.Game.Rulesets.Objects @@ -19,7 +20,7 @@ namespace osu.Game.Rulesets.Objects /// /// The time at which the HitObject starts. /// - public double StartTime { get; set; } + public double StartTime; /// /// The samples to be played when this hit object is hit. @@ -36,17 +37,25 @@ namespace osu.Game.Rulesets.Objects ControlPoint overridePoint; ControlPoint timingPoint = timing.TimingPointAt(StartTime, out overridePoint); - foreach (var sample in Samples) - { - if (sample.Volume == 0) - sample.Volume = (overridePoint ?? timingPoint)?.SampleVolume ?? 0; + ControlPoint samplePoint = overridePoint ?? timingPoint; - // If the bank is not assigned a name, assign it from the control point - if (!string.IsNullOrEmpty(sample.Bank)) - continue; + // Initialize first sample + foreach (SampleInfo sample in Samples) + initializeSampleInfo(sample, samplePoint); - sample.Bank = (overridePoint ?? timingPoint)?.SampleBank ?? @"normal"; - } + // Initialize any repeat samples + var repeatData = this as IHasRepeats; + repeatData?.RepeatSamples?.ForEach(r => r.ForEach(s => initializeSampleInfo(s, samplePoint))); + } + + private void initializeSampleInfo(SampleInfo sample, ControlPoint controlPoint) + { + if (sample.Volume == 0) + sample.Volume = controlPoint?.SampleVolume ?? 0; + + // If the bank is not assigned a name, assign it from the control point + if (string.IsNullOrEmpty(sample.Bank)) + sample.Bank = controlPoint?.SampleBank ?? @"normal"; } } } diff --git a/osu.Game/Rulesets/Objects/Types/IHasRepeats.cs b/osu.Game/Rulesets/Objects/Types/IHasRepeats.cs index f7058fd3c9..507f5974f7 100644 --- a/osu.Game/Rulesets/Objects/Types/IHasRepeats.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasRepeats.cs @@ -1,6 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Game.Audio; +using System.Collections.Generic; + namespace osu.Game.Rulesets.Objects.Types { /// @@ -12,5 +15,7 @@ namespace osu.Game.Rulesets.Objects.Types /// The amount of times the HitObject repeats. /// int RepeatCount { get; } + + List> RepeatSamples { get; } } } From 5fdc9819cf6bcd72f0cceab0a5d02653843dbd9f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Apr 2017 16:19:40 +0900 Subject: [PATCH 345/442] Add basic UO support (now called Audio Offset). --- osu.Game/Configuration/OsuConfigManager.cs | 5 +++-- .../Options/Sections/Audio/OffsetOptions.cs | 6 +++--- osu.Game/Screens/Play/Player.cs | 19 ++++++++++++++++--- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index a31c1f882d..d47ed48e99 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -38,6 +38,8 @@ namespace osu.Game.Configuration Set(OsuConfig.KeyOverlay, false); //todo: implement all settings below this line (remove the Disabled set when doing so). + Set(OsuConfig.AudioOffset, 0, -500.0, 500.0); + Set(OsuConfig.MouseSpeed, 1.0).Disabled = true; Set(OsuConfig.BeatmapDirectory, @"Songs").Disabled = true; // TODO: use thi.Disabled = trues Set(OsuConfig.AllowPublicInvites, true).Disabled = true; @@ -103,7 +105,6 @@ namespace osu.Game.Configuration Set(OsuConfig.ManiaSpeedBPMScale, true).Disabled = true; Set(OsuConfig.MenuTip, 0).Disabled = true; Set(OsuConfig.MouseSpeed, 1, 0.4, 6).Disabled = true; - Set(OsuConfig.Offset, 0, -300, 300).Disabled = true; Set(OsuConfig.ScoreMeterScale, 1, 0.5, 2).Disabled = true; //Set(OsuConfig.ScoreMeterScale, 1, 0.5, OsuGame.Tournament ? 10 : 2).Disabled = true; Set(OsuConfig.DistanceSpacing, 0.8, 0.1, 6).Disabled = true; @@ -270,7 +271,7 @@ namespace osu.Game.Configuration MouseDisableButtons, MouseDisableWheel, MouseSpeed, - Offset, + AudioOffset, ScoreMeterScale, DistanceSpacing, EditorBeatDivisor, diff --git a/osu.Game/Overlays/Options/Sections/Audio/OffsetOptions.cs b/osu.Game/Overlays/Options/Sections/Audio/OffsetOptions.cs index 2602565c29..c1f5359585 100644 --- a/osu.Game/Overlays/Options/Sections/Audio/OffsetOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Audio/OffsetOptions.cs @@ -18,10 +18,10 @@ namespace osu.Game.Overlays.Options.Sections.Audio { Children = new Drawable[] { - new OptionSlider + new OptionSlider { - LabelText = "Universal Offset", - Bindable = (BindableInt)config.GetBindable(OsuConfig.Offset) + LabelText = "Audio Offset", + Bindable = (BindableDouble)config.GetBindable(OsuConfig.AudioOffset) }, new OsuButton { diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 5502723c0d..2fcc51d3fd 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -49,13 +49,22 @@ namespace osu.Game.Screens.Play private bool canPause => ValidForResume && !HasFailed && Time.Current >= lastPauseActionTime + pause_cooldown; private IAdjustableClock sourceClock; + private OffsetClock offsetClock; private IFrameBasedClock interpolatedSourceClock; private RulesetInfo ruleset; private ScoreProcessor scoreProcessor; protected HitRenderer HitRenderer; + + #region User Settings + private Bindable dimLevel; + private Bindable mouseWheelDisabled; + private Bindable userAudioOffset; + + #endregion + private SkipButton skipButton; private HudOverlay hudOverlay; @@ -115,7 +124,13 @@ namespace osu.Game.Screens.Play } sourceClock = (IAdjustableClock)track ?? new StopwatchClock(); - interpolatedSourceClock = new InterpolatingFramedClock(sourceClock); + offsetClock = new OffsetClock(sourceClock); + + userAudioOffset = config.GetBindable(OsuConfig.AudioOffset); + userAudioOffset.ValueChanged += v => offsetClock.Offset = v; + userAudioOffset.TriggerChange(); + + interpolatedSourceClock = new InterpolatingFramedClock(offsetClock); Schedule(() => { @@ -360,8 +375,6 @@ namespace osu.Game.Screens.Play Background?.FadeTo(1f, fade_out_duration); } - private Bindable mouseWheelDisabled; - protected override bool OnWheel(InputState state) => mouseWheelDisabled.Value && !IsPaused; } } From a7afde02bf42f8b76adfb4e56c0762df531ab444 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 21 Apr 2017 16:27:35 +0900 Subject: [PATCH 346/442] Oops, apparently normal hit sound should always be added. --- osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs index 84cc41b575..3dcac72db8 100644 --- a/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs @@ -226,15 +226,12 @@ namespace osu.Game.Rulesets.Objects.Legacy { var soundTypes = new List(); - if ((type & LegacySoundType.Normal) > 0) + soundTypes.Add(new SampleInfo { - soundTypes.Add(new SampleInfo - { - Bank = bankInfo.Normal, - Name = SampleInfo.HIT_NORMAL, - Volume = bankInfo.Volume - }); - } + Bank = bankInfo.Normal, + Name = SampleInfo.HIT_NORMAL, + Volume = bankInfo.Volume + }); if ((type & LegacySoundType.Finish) > 0) { From 3f832731c9553e0bb930fb011c58e10cb29cba5f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Apr 2017 17:33:20 +0900 Subject: [PATCH 347/442] Add DoubleTime, HalfTime and Nightcore support. --- osu.Game/Beatmaps/WorkingBeatmap.cs | 19 ++- osu.Game/Rulesets/Mods/IApplicableMod.cs | 2 +- osu.Game/Rulesets/Mods/IApplicableToClock.cs | 15 +++ osu.Game/Rulesets/Mods/Mod.cs | 131 ------------------- osu.Game/Rulesets/Mods/ModAutoplay.cs | 32 +++++ osu.Game/Rulesets/Mods/ModCinema.cs | 13 ++ osu.Game/Rulesets/Mods/ModDoubleTime.cs | 25 ++++ osu.Game/Rulesets/Mods/ModEasy.cs | 18 +++ osu.Game/Rulesets/Mods/ModFlashlight.cs | 15 +++ osu.Game/Rulesets/Mods/ModHalfTime.cs | 25 ++++ osu.Game/Rulesets/Mods/ModHardRock.cs | 16 +++ osu.Game/Rulesets/Mods/ModHidden.cs | 14 ++ osu.Game/Rulesets/Mods/ModNightcore.cs | 25 ++++ osu.Game/Rulesets/Mods/ModNoFail.cs | 18 +++ osu.Game/Rulesets/Mods/ModPerfect.cs | 11 ++ osu.Game/Rulesets/Mods/ModRelax.cs | 16 +++ osu.Game/Rulesets/Mods/ModSuddenDeath.cs | 18 +++ osu.Game/Rulesets/Mods/MultiMod.cs | 14 ++ osu.Game/Rulesets/UI/HitRenderer.cs | 2 +- osu.Game/Screens/Play/Player.cs | 3 + osu.Game/osu.Game.csproj | 15 +++ 21 files changed, 313 insertions(+), 134 deletions(-) create mode 100644 osu.Game/Rulesets/Mods/IApplicableToClock.cs create mode 100644 osu.Game/Rulesets/Mods/ModAutoplay.cs create mode 100644 osu.Game/Rulesets/Mods/ModCinema.cs create mode 100644 osu.Game/Rulesets/Mods/ModDoubleTime.cs create mode 100644 osu.Game/Rulesets/Mods/ModEasy.cs create mode 100644 osu.Game/Rulesets/Mods/ModFlashlight.cs create mode 100644 osu.Game/Rulesets/Mods/ModHalfTime.cs create mode 100644 osu.Game/Rulesets/Mods/ModHardRock.cs create mode 100644 osu.Game/Rulesets/Mods/ModHidden.cs create mode 100644 osu.Game/Rulesets/Mods/ModNightcore.cs create mode 100644 osu.Game/Rulesets/Mods/ModNoFail.cs create mode 100644 osu.Game/Rulesets/Mods/ModPerfect.cs create mode 100644 osu.Game/Rulesets/Mods/ModRelax.cs create mode 100644 osu.Game/Rulesets/Mods/ModSuddenDeath.cs create mode 100644 osu.Game/Rulesets/Mods/MultiMod.cs diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 894719ac6e..7c806a589a 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -8,6 +8,7 @@ using osu.Game.Database; using osu.Game.Rulesets.Mods; using System; using System.Collections.Generic; +using System.Linq; namespace osu.Game.Beatmaps { @@ -26,6 +27,18 @@ namespace osu.Game.Beatmaps BeatmapInfo = beatmapInfo; BeatmapSetInfo = beatmapSetInfo; WithStoryboard = withStoryboard; + + Mods.ValueChanged += mods => applyRateAdjustments(); + } + + private void applyRateAdjustments() + { + var t = track; + if (t == null) return; + + t.ResetRate(); + foreach (var mod in Mods.Value.OfType()) + mod.ApplyToClock(t); } protected abstract Beatmap GetBeatmap(); @@ -66,7 +79,11 @@ namespace osu.Game.Beatmaps { lock (trackLock) { - return track ?? (track = GetTrack()); + if (track != null) return track; + + track = GetTrack(); + applyRateAdjustments(); + return track; } } } diff --git a/osu.Game/Rulesets/Mods/IApplicableMod.cs b/osu.Game/Rulesets/Mods/IApplicableMod.cs index 66f3fc5da6..18e1ae4b3d 100644 --- a/osu.Game/Rulesets/Mods/IApplicableMod.cs +++ b/osu.Game/Rulesets/Mods/IApplicableMod.cs @@ -17,6 +17,6 @@ namespace osu.Game.Rulesets.Mods /// Applies the mod to a HitRenderer. /// /// The HitRenderer to apply the mod to. - void Apply(HitRenderer hitRenderer); + void ApplyToHitRenderer(HitRenderer hitRenderer); } } diff --git a/osu.Game/Rulesets/Mods/IApplicableToClock.cs b/osu.Game/Rulesets/Mods/IApplicableToClock.cs new file mode 100644 index 0000000000..f0502cf346 --- /dev/null +++ b/osu.Game/Rulesets/Mods/IApplicableToClock.cs @@ -0,0 +1,15 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Timing; + +namespace osu.Game.Rulesets.Mods +{ + /// + /// An interface for mods that make adjustments to the track. + /// + public interface IApplicableToClock + { + void ApplyToClock(IAdjustableClock clock); + } +} \ No newline at end of file diff --git a/osu.Game/Rulesets/Mods/Mod.cs b/osu.Game/Rulesets/Mods/Mod.cs index cfb4d8b8ab..a2846c1d2f 100644 --- a/osu.Game/Rulesets/Mods/Mod.cs +++ b/osu.Game/Rulesets/Mods/Mod.cs @@ -1,12 +1,8 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Beatmaps; using osu.Game.Graphics; -using osu.Game.Rulesets.Objects; -using osu.Game.Rulesets.UI; using System; -using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Mods { @@ -45,131 +41,4 @@ namespace osu.Game.Rulesets.Mods /// public virtual Type[] IncompatibleMods => new Type[] { }; } - - public class MultiMod : Mod - { - public override string Name => string.Empty; - public override string Description => string.Empty; - public override double ScoreMultiplier => 0.0; - - public Mod[] Mods; - } - - public abstract class ModNoFail : Mod - { - public override string Name => "NoFail"; - public override FontAwesome Icon => FontAwesome.fa_osu_mod_nofail; - public override string Description => "You can't fail, no matter what."; - public override double ScoreMultiplier => 0.5; - public override bool Ranked => true; - public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModAutoplay) }; - } - - public abstract class ModEasy : Mod - { - public override string Name => "Easy"; - public override FontAwesome Icon => FontAwesome.fa_osu_mod_easy; - public override string Description => "Reduces overall difficulty - larger circles, more forgiving HP drain, less accuracy required."; - public override double ScoreMultiplier => 0.5; - public override bool Ranked => true; - public override Type[] IncompatibleMods => new[] { typeof(ModHardRock) }; - } - - public abstract class ModHidden : Mod - { - public override string Name => "Hidden"; - public override FontAwesome Icon => FontAwesome.fa_osu_mod_hidden; - public override bool Ranked => true; - } - - public abstract class ModHardRock : Mod - { - public override string Name => "Hard Rock"; - public override FontAwesome Icon => FontAwesome.fa_osu_mod_hardrock; - public override string Description => "Everything just got a bit harder..."; - public override Type[] IncompatibleMods => new[] { typeof(ModEasy) }; - } - - public abstract class ModSuddenDeath : Mod - { - public override string Name => "Sudden Death"; - public override FontAwesome Icon => FontAwesome.fa_osu_mod_suddendeath; - public override string Description => "Miss a note and fail."; - public override double ScoreMultiplier => 1; - public override bool Ranked => true; - public override Type[] IncompatibleMods => new[] { typeof(ModNoFail), typeof(ModRelax), typeof(ModAutoplay) }; - } - - public abstract class ModDoubleTime : Mod - { - public override string Name => "Double Time"; - public override FontAwesome Icon => FontAwesome.fa_osu_mod_doubletime; - public override string Description => "Zoooooooooom"; - public override bool Ranked => true; - public override Type[] IncompatibleMods => new[] { typeof(ModHalfTime) }; - } - - public abstract class ModRelax : Mod - { - public override string Name => "Relax"; - public override FontAwesome Icon => FontAwesome.fa_osu_mod_relax; - public override double ScoreMultiplier => 0; - public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(ModNoFail), typeof(ModSuddenDeath) }; - } - - public abstract class ModHalfTime : Mod - { - public override string Name => "Half Time"; - public override FontAwesome Icon => FontAwesome.fa_osu_mod_halftime; - public override string Description => "Less zoom"; - public override bool Ranked => true; - public override Type[] IncompatibleMods => new[] { typeof(ModDoubleTime) }; - } - - public abstract class ModNightcore : ModDoubleTime - { - public override string Name => "Nightcore"; - public override FontAwesome Icon => FontAwesome.fa_osu_mod_nightcore; - public override string Description => "uguuuuuuuu"; - } - - public abstract class ModFlashlight : Mod - { - public override string Name => "Flashlight"; - public override FontAwesome Icon => FontAwesome.fa_osu_mod_flashlight; - public override string Description => "Restricted view area."; - public override bool Ranked => true; - } - - public class ModAutoplay : Mod - { - public override string Name => "Autoplay"; - public override FontAwesome Icon => FontAwesome.fa_osu_mod_auto; - public override string Description => "Watch a perfect automated play through the song"; - public override double ScoreMultiplier => 0; - public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModNoFail) }; - } - - public abstract class ModAutoplay : ModAutoplay, IApplicableMod - where T : HitObject - { - protected abstract Score CreateReplayScore(Beatmap beatmap); - - public void Apply(HitRenderer hitRenderer) - { - hitRenderer.SetReplay(CreateReplayScore(hitRenderer.Beatmap)?.Replay); - } - } - - public abstract class ModPerfect : ModSuddenDeath - { - public override string Name => "Perfect"; - public override string Description => "SS or quit."; - } - - public class ModCinema : ModAutoplay - { - public override string Name => "Cinema"; - public override FontAwesome Icon => FontAwesome.fa_osu_mod_cinema; - } } diff --git a/osu.Game/Rulesets/Mods/ModAutoplay.cs b/osu.Game/Rulesets/Mods/ModAutoplay.cs new file mode 100644 index 0000000000..1217bf835f --- /dev/null +++ b/osu.Game/Rulesets/Mods/ModAutoplay.cs @@ -0,0 +1,32 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using osu.Game.Beatmaps; +using osu.Game.Graphics; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Scoring; +using osu.Game.Rulesets.UI; + +namespace osu.Game.Rulesets.Mods +{ + public abstract class ModAutoplay : ModAutoplay, IApplicableMod + where T : HitObject + { + protected abstract Score CreateReplayScore(Beatmap beatmap); + + public void ApplyToHitRenderer(HitRenderer hitRenderer) + { + hitRenderer.SetReplay(CreateReplayScore(hitRenderer.Beatmap)?.Replay); + } + } + + public class ModAutoplay : Mod + { + public override string Name => "Autoplay"; + public override FontAwesome Icon => FontAwesome.fa_osu_mod_auto; + public override string Description => "Watch a perfect automated play through the song"; + public override double ScoreMultiplier => 0; + public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModNoFail) }; + } +} \ No newline at end of file diff --git a/osu.Game/Rulesets/Mods/ModCinema.cs b/osu.Game/Rulesets/Mods/ModCinema.cs new file mode 100644 index 0000000000..332bd2c5ac --- /dev/null +++ b/osu.Game/Rulesets/Mods/ModCinema.cs @@ -0,0 +1,13 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Graphics; + +namespace osu.Game.Rulesets.Mods +{ + public class ModCinema : ModAutoplay + { + public override string Name => "Cinema"; + public override FontAwesome Icon => FontAwesome.fa_osu_mod_cinema; + } +} \ No newline at end of file diff --git a/osu.Game/Rulesets/Mods/ModDoubleTime.cs b/osu.Game/Rulesets/Mods/ModDoubleTime.cs new file mode 100644 index 0000000000..377a4c2180 --- /dev/null +++ b/osu.Game/Rulesets/Mods/ModDoubleTime.cs @@ -0,0 +1,25 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using osu.Framework.Timing; +using osu.Game.Graphics; + +namespace osu.Game.Rulesets.Mods +{ + public class ModDoubleTime : Mod, IApplicableToClock + { + public override string Name => "Double Time"; + public override FontAwesome Icon => FontAwesome.fa_osu_mod_doubletime; + public override string Description => "Zoooooooooom"; + public override bool Ranked => true; + public override Type[] IncompatibleMods => new[] { typeof(ModHalfTime) }; + + public override double ScoreMultiplier => 1.12; + + public virtual void ApplyToClock(IAdjustableClock clock) + { + clock.Rate = 1.5; + } + } +} \ No newline at end of file diff --git a/osu.Game/Rulesets/Mods/ModEasy.cs b/osu.Game/Rulesets/Mods/ModEasy.cs new file mode 100644 index 0000000000..bef3f04af3 --- /dev/null +++ b/osu.Game/Rulesets/Mods/ModEasy.cs @@ -0,0 +1,18 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using osu.Game.Graphics; + +namespace osu.Game.Rulesets.Mods +{ + public abstract class ModEasy : Mod + { + public override string Name => "Easy"; + public override FontAwesome Icon => FontAwesome.fa_osu_mod_easy; + public override string Description => "Reduces overall difficulty - larger circles, more forgiving HP drain, less accuracy required."; + public override double ScoreMultiplier => 0.5; + public override bool Ranked => true; + public override Type[] IncompatibleMods => new[] { typeof(ModHardRock) }; + } +} \ No newline at end of file diff --git a/osu.Game/Rulesets/Mods/ModFlashlight.cs b/osu.Game/Rulesets/Mods/ModFlashlight.cs new file mode 100644 index 0000000000..63c534dc7d --- /dev/null +++ b/osu.Game/Rulesets/Mods/ModFlashlight.cs @@ -0,0 +1,15 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Graphics; + +namespace osu.Game.Rulesets.Mods +{ + public abstract class ModFlashlight : Mod + { + public override string Name => "Flashlight"; + public override FontAwesome Icon => FontAwesome.fa_osu_mod_flashlight; + public override string Description => "Restricted view area."; + public override bool Ranked => true; + } +} \ No newline at end of file diff --git a/osu.Game/Rulesets/Mods/ModHalfTime.cs b/osu.Game/Rulesets/Mods/ModHalfTime.cs new file mode 100644 index 0000000000..235fc7ad76 --- /dev/null +++ b/osu.Game/Rulesets/Mods/ModHalfTime.cs @@ -0,0 +1,25 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using osu.Framework.Timing; +using osu.Game.Graphics; + +namespace osu.Game.Rulesets.Mods +{ + public abstract class ModHalfTime : Mod, IApplicableToClock + { + public override string Name => "Half Time"; + public override FontAwesome Icon => FontAwesome.fa_osu_mod_halftime; + public override string Description => "Less zoom"; + public override bool Ranked => true; + public override Type[] IncompatibleMods => new[] { typeof(ModDoubleTime) }; + + public override double ScoreMultiplier => 1.12; + + public void ApplyToClock(IAdjustableClock clock) + { + clock.Rate = 0.75; + } + } +} \ No newline at end of file diff --git a/osu.Game/Rulesets/Mods/ModHardRock.cs b/osu.Game/Rulesets/Mods/ModHardRock.cs new file mode 100644 index 0000000000..b729b5ae15 --- /dev/null +++ b/osu.Game/Rulesets/Mods/ModHardRock.cs @@ -0,0 +1,16 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using osu.Game.Graphics; + +namespace osu.Game.Rulesets.Mods +{ + public abstract class ModHardRock : Mod + { + public override string Name => "Hard Rock"; + public override FontAwesome Icon => FontAwesome.fa_osu_mod_hardrock; + public override string Description => "Everything just got a bit harder..."; + public override Type[] IncompatibleMods => new[] { typeof(ModEasy) }; + } +} \ No newline at end of file diff --git a/osu.Game/Rulesets/Mods/ModHidden.cs b/osu.Game/Rulesets/Mods/ModHidden.cs new file mode 100644 index 0000000000..12c788ce54 --- /dev/null +++ b/osu.Game/Rulesets/Mods/ModHidden.cs @@ -0,0 +1,14 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Graphics; + +namespace osu.Game.Rulesets.Mods +{ + public abstract class ModHidden : Mod + { + public override string Name => "Hidden"; + public override FontAwesome Icon => FontAwesome.fa_osu_mod_hidden; + public override bool Ranked => true; + } +} \ No newline at end of file diff --git a/osu.Game/Rulesets/Mods/ModNightcore.cs b/osu.Game/Rulesets/Mods/ModNightcore.cs new file mode 100644 index 0000000000..d04643fb8b --- /dev/null +++ b/osu.Game/Rulesets/Mods/ModNightcore.cs @@ -0,0 +1,25 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Audio; +using osu.Framework.Timing; +using osu.Game.Graphics; + +namespace osu.Game.Rulesets.Mods +{ + public abstract class ModNightcore : ModDoubleTime + { + public override string Name => "Nightcore"; + public override FontAwesome Icon => FontAwesome.fa_osu_mod_nightcore; + public override string Description => "uguuuuuuuu"; + + public override void ApplyToClock(IAdjustableClock clock) + { + var pitchAdjust = clock as IHasPitchAdjust; + if (pitchAdjust != null) + pitchAdjust.PitchAdjust = 1.5; + else + base.ApplyToClock(clock); + } + } +} \ No newline at end of file diff --git a/osu.Game/Rulesets/Mods/ModNoFail.cs b/osu.Game/Rulesets/Mods/ModNoFail.cs new file mode 100644 index 0000000000..0c8726bbc1 --- /dev/null +++ b/osu.Game/Rulesets/Mods/ModNoFail.cs @@ -0,0 +1,18 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using osu.Game.Graphics; + +namespace osu.Game.Rulesets.Mods +{ + public abstract class ModNoFail : Mod + { + public override string Name => "NoFail"; + public override FontAwesome Icon => FontAwesome.fa_osu_mod_nofail; + public override string Description => "You can't fail, no matter what."; + public override double ScoreMultiplier => 0.5; + public override bool Ranked => true; + public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModAutoplay) }; + } +} \ No newline at end of file diff --git a/osu.Game/Rulesets/Mods/ModPerfect.cs b/osu.Game/Rulesets/Mods/ModPerfect.cs new file mode 100644 index 0000000000..35217c8305 --- /dev/null +++ b/osu.Game/Rulesets/Mods/ModPerfect.cs @@ -0,0 +1,11 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Rulesets.Mods +{ + public abstract class ModPerfect : ModSuddenDeath + { + public override string Name => "Perfect"; + public override string Description => "SS or quit."; + } +} \ No newline at end of file diff --git a/osu.Game/Rulesets/Mods/ModRelax.cs b/osu.Game/Rulesets/Mods/ModRelax.cs new file mode 100644 index 0000000000..5491f8fc58 --- /dev/null +++ b/osu.Game/Rulesets/Mods/ModRelax.cs @@ -0,0 +1,16 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using osu.Game.Graphics; + +namespace osu.Game.Rulesets.Mods +{ + public abstract class ModRelax : Mod + { + public override string Name => "Relax"; + public override FontAwesome Icon => FontAwesome.fa_osu_mod_relax; + public override double ScoreMultiplier => 0; + public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(ModNoFail), typeof(ModSuddenDeath) }; + } +} \ No newline at end of file diff --git a/osu.Game/Rulesets/Mods/ModSuddenDeath.cs b/osu.Game/Rulesets/Mods/ModSuddenDeath.cs new file mode 100644 index 0000000000..a7dcbbc9ed --- /dev/null +++ b/osu.Game/Rulesets/Mods/ModSuddenDeath.cs @@ -0,0 +1,18 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using osu.Game.Graphics; + +namespace osu.Game.Rulesets.Mods +{ + public abstract class ModSuddenDeath : Mod + { + public override string Name => "Sudden Death"; + public override FontAwesome Icon => FontAwesome.fa_osu_mod_suddendeath; + public override string Description => "Miss a note and fail."; + public override double ScoreMultiplier => 1; + public override bool Ranked => true; + public override Type[] IncompatibleMods => new[] { typeof(ModNoFail), typeof(ModRelax), typeof(ModAutoplay) }; + } +} \ No newline at end of file diff --git a/osu.Game/Rulesets/Mods/MultiMod.cs b/osu.Game/Rulesets/Mods/MultiMod.cs new file mode 100644 index 0000000000..c5fac250d0 --- /dev/null +++ b/osu.Game/Rulesets/Mods/MultiMod.cs @@ -0,0 +1,14 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Rulesets.Mods +{ + public class MultiMod : Mod + { + public override string Name => string.Empty; + public override string Description => string.Empty; + public override double ScoreMultiplier => 0.0; + + public Mod[] Mods; + } +} \ No newline at end of file diff --git a/osu.Game/Rulesets/UI/HitRenderer.cs b/osu.Game/Rulesets/UI/HitRenderer.cs index d2f2cc6021..a3a806b6a7 100644 --- a/osu.Game/Rulesets/UI/HitRenderer.cs +++ b/osu.Game/Rulesets/UI/HitRenderer.cs @@ -157,7 +157,7 @@ namespace osu.Game.Rulesets.UI return; foreach (var mod in mods.OfType>()) - mod.Apply(this); + mod.ApplyToHitRenderer(this); } /// diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 5502723c0d..5624cd75f9 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -20,6 +20,7 @@ using osu.Game.Screens.Backgrounds; using System; using System.Linq; using osu.Framework.Threading; +using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Ranking; @@ -120,6 +121,8 @@ namespace osu.Game.Screens.Play Schedule(() => { sourceClock.Reset(); + foreach (var mod in Beatmap.Mods.Value.OfType()) + mod.ApplyToClock(sourceClock); }); scoreProcessor = HitRenderer.CreateScoreProcessor(); diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 6d7a905eed..49cc32a6b6 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -109,6 +109,21 @@ + + + + + + + + + + + + + + + From a999c42d8a2b3b04891729685d4d290fc509f66a Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 21 Apr 2017 18:49:49 +0900 Subject: [PATCH 348/442] Split slider samples into head + tail + repeats + body (the original HitObject.Samples). --- osu.Game.Rulesets.Osu/Objects/Slider.cs | 2 ++ osu.Game/Rulesets/Objects/CurvedHitObject.cs | 5 +++-- osu.Game/Rulesets/Objects/HitObject.cs | 12 ++++++++++-- .../Objects/Legacy/Catch/HitObjectParser.cs | 5 ++++- .../Rulesets/Objects/Legacy/HitObjectParser.cs | 17 +++++++++-------- .../Objects/Legacy/Mania/HitObjectParser.cs | 5 ++++- .../Objects/Legacy/Osu/HitObjectParser.cs | 5 ++++- .../Objects/Legacy/Taiko/HitObjectParser.cs | 5 ++++- osu.Game/Rulesets/Objects/Types/IHasCurve.cs | 11 +++++++++++ osu.Game/Rulesets/Objects/Types/IHasRepeats.cs | 3 +++ 10 files changed, 54 insertions(+), 16 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index 48c871d64d..075d03d247 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -34,6 +34,8 @@ namespace osu.Game.Rulesets.Osu.Objects public int RepeatAt(double progress) => CurveObject.RepeatAt(progress); public List> RepeatSamples => CurveObject.RepeatSamples; + public List HeadSamples => CurveObject.HeadSamples; + public List TailSamples => CurveObject.TailSamples; public List ControlPoints => CurveObject.ControlPoints; public CurveType CurveType => CurveObject.CurveType; diff --git a/osu.Game/Rulesets/Objects/CurvedHitObject.cs b/osu.Game/Rulesets/Objects/CurvedHitObject.cs index b43c10476a..57da216445 100644 --- a/osu.Game/Rulesets/Objects/CurvedHitObject.cs +++ b/osu.Game/Rulesets/Objects/CurvedHitObject.cs @@ -6,8 +6,6 @@ using osu.Game.Rulesets.Objects.Types; using System.Collections.Generic; using osu.Game.Audio; using System; -using osu.Game.Beatmaps.Timing; -using osu.Game.Database; namespace osu.Game.Rulesets.Objects { @@ -40,6 +38,9 @@ namespace osu.Game.Rulesets.Objects public List> RepeatSamples { get; set; } = new List>(); + public List HeadSamples { get; set; } = new List(); + public List TailSamples { get; set; } = new List(); + public Vector2 PositionAt(double progress) => Curve.PositionAt(ProgressAt(progress)); public double ProgressAt(double progress) diff --git a/osu.Game/Rulesets/Objects/HitObject.cs b/osu.Game/Rulesets/Objects/HitObject.cs index 52f157d472..fe53a6ad7f 100644 --- a/osu.Game/Rulesets/Objects/HitObject.cs +++ b/osu.Game/Rulesets/Objects/HitObject.cs @@ -24,6 +24,10 @@ namespace osu.Game.Rulesets.Objects /// /// The samples to be played when this hit object is hit. + /// + /// In the case of types, this is the sample of the curve body + /// and can be treated as the default samples for the hit object. + /// /// public List Samples = new List(); @@ -40,12 +44,16 @@ namespace osu.Game.Rulesets.Objects ControlPoint samplePoint = overridePoint ?? timingPoint; // Initialize first sample - foreach (SampleInfo sample in Samples) - initializeSampleInfo(sample, samplePoint); + Samples.ForEach(s => initializeSampleInfo(s, samplePoint)); // Initialize any repeat samples var repeatData = this as IHasRepeats; repeatData?.RepeatSamples?.ForEach(r => r.ForEach(s => initializeSampleInfo(s, samplePoint))); + + // Initialize any curved object samples + var curvedObject = this as CurvedHitObject; + curvedObject?.HeadSamples.ForEach(s => initializeSampleInfo(s, samplePoint)); + curvedObject?.TailSamples.ForEach(s => initializeSampleInfo(s, samplePoint)); } private void initializeSampleInfo(SampleInfo sample, ControlPoint controlPoint) diff --git a/osu.Game/Rulesets/Objects/Legacy/Catch/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/HitObjectParser.cs index 7ce6af85fd..5e8c096da0 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Catch/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/HitObjectParser.cs @@ -22,7 +22,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, + int repeatCount, List headSamples, List tailSamples, List> repeatSamples) { return new Slider { @@ -32,6 +33,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch Distance = length, CurveType = curveType, RepeatCount = repeatCount, + HeadSamples = headSamples, + TailSamples = tailSamples, RepeatSamples = repeatSamples }; } diff --git a/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs index 3dcac72db8..2bf0f0d662 100644 --- a/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs @@ -26,7 +26,6 @@ namespace osu.Game.Rulesets.Objects.Legacy var soundType = (LegacySoundType)int.Parse(split[4]); var bankInfo = new SampleBankInfo(); - List startSamples = null; HitObject result; @@ -129,13 +128,14 @@ namespace osu.Game.Rulesets.Objects.Legacy for (int i = 0; i <= repeatCount; i++) nodeSamples.Add(convertSoundType(nodeSoundTypes[i], nodeBankInfos[i])); - // Extract the first node as the first sample - startSamples = nodeSamples[0]; + // Extract the first and last samples for the head and tail respectively + List headSamples = nodeSamples.First(); + List tailSamples = nodeSamples.Last(); - // Repeat samples are all the samples excluding the one from the first node (note this includes the end node) - var repeatSamples = nodeSamples.Skip(1).ToList(); + // Repeat samples are all the samples between head and tail + var repeatSamples = nodeSamples.Skip(1).TakeWhile(s => s != tailSamples).ToList(); - result = CreateSlider(new Vector2(int.Parse(split[0]), int.Parse(split[1])), combo, points, length, curveType, repeatCount, repeatSamples); + result = CreateSlider(new Vector2(int.Parse(split[0]), int.Parse(split[1])), combo, points, length, curveType, repeatCount, headSamples, tailSamples, repeatSamples); } else if ((type & HitObjectType.Spinner) > 0) { @@ -161,7 +161,7 @@ namespace osu.Game.Rulesets.Objects.Legacy throw new InvalidOperationException($@"Unknown hit object type {type}"); result.StartTime = Convert.ToDouble(split[2], CultureInfo.InvariantCulture); - result.Samples = startSamples ?? convertSoundType(soundType, bankInfo); + result.Samples = convertSoundType(soundType, bankInfo); return result; } @@ -212,7 +212,8 @@ namespace osu.Game.Rulesets.Objects.Legacy /// The slider repeat count. /// The slider repeat sounds (this includes the end node, but NOT the start node). /// The hit object. - protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples); + protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, + int repeatCount, List headSamples, List tailSamples, List> repeatSamples); /// /// Creates a legacy Spinner-type hit object. diff --git a/osu.Game/Rulesets/Objects/Legacy/Mania/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Mania/HitObjectParser.cs index f3b0738b1a..fa75592f74 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Mania/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Mania/HitObjectParser.cs @@ -22,7 +22,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, + int repeatCount, List headSamples, List tailSamples, List> repeatSamples) { return new Slider { @@ -32,6 +33,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania Distance = length, CurveType = curveType, RepeatCount = repeatCount, + HeadSamples = headSamples, + TailSamples = tailSamples, RepeatSamples = repeatSamples }; } diff --git a/osu.Game/Rulesets/Objects/Legacy/Osu/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/HitObjectParser.cs index fd018c41a2..f8310b9075 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Osu/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Osu/HitObjectParser.cs @@ -22,7 +22,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, + int repeatCount, List headSamples, List tailSamples, List> repeatSamples) { return new Slider { @@ -32,6 +33,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu Distance = length, CurveType = curveType, RepeatCount = repeatCount, + HeadSamples = headSamples, + TailSamples = tailSamples, RepeatSamples = repeatSamples }; } diff --git a/osu.Game/Rulesets/Objects/Legacy/Taiko/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Taiko/HitObjectParser.cs index a297bc5692..77a29d9883 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Taiko/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Taiko/HitObjectParser.cs @@ -21,7 +21,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, + int repeatCount, List headSamples, List tailSamples, List> repeatSamples) { return new Slider { @@ -30,6 +31,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko Distance = length, CurveType = curveType, RepeatCount = repeatCount, + HeadSamples = headSamples, + TailSamples = tailSamples, RepeatSamples = repeatSamples }; } diff --git a/osu.Game/Rulesets/Objects/Types/IHasCurve.cs b/osu.Game/Rulesets/Objects/Types/IHasCurve.cs index 5ff6d03f6d..40e0b367de 100644 --- a/osu.Game/Rulesets/Objects/Types/IHasCurve.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasCurve.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using OpenTK; +using osu.Game.Audio; namespace osu.Game.Rulesets.Objects.Types { @@ -26,6 +27,16 @@ namespace osu.Game.Rulesets.Objects.Types /// CurveType CurveType { get; } + /// + /// The samples to be played when the head of the hit object is hit. + /// + List HeadSamples { get; } + + /// + /// The samples to be played when the tail of the hit object is hit. + /// + List TailSamples { get; } + /// /// Computes the position on the curve at a given progress, accounting for repeat logic. /// diff --git a/osu.Game/Rulesets/Objects/Types/IHasRepeats.cs b/osu.Game/Rulesets/Objects/Types/IHasRepeats.cs index 507f5974f7..2fe2424d49 100644 --- a/osu.Game/Rulesets/Objects/Types/IHasRepeats.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasRepeats.cs @@ -16,6 +16,9 @@ namespace osu.Game.Rulesets.Objects.Types /// int RepeatCount { get; } + /// + /// The samples to be played when each repeat node is hit (0 -> first repeat node, 1 -> second repeat node, etc). + /// List> RepeatSamples { get; } } } From 29fe0b471cf508d77ae4e4752046be84862a2694 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 21 Apr 2017 18:52:08 +0900 Subject: [PATCH 349/442] Fix drum rolls not taking into account nodal samples when converting from drum rolls to hit circles. --- .../Beatmaps/TaikoBeatmapConverter.cs | 42 +++++++++++++++---- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs index cf7b9ce710..4806f2568b 100644 --- a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -66,6 +66,7 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps var distanceData = obj as IHasDistance; var repeatsData = obj as IHasRepeats; var endTimeData = obj as IHasEndTime; + var curveData = obj as IHasCurve; // Old osu! used hit sounding to determine various hit type information List samples = obj.Samples; @@ -102,16 +103,43 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps if (tickSpacing > 0 && osuDuration < 2 * speedAdjustedBeatLength) { + var allSamples = new List>(); + + if (curveData != null) + { + allSamples.Add(curveData.HeadSamples); + allSamples.AddRange(curveData.RepeatSamples); + allSamples.Add(curveData.TailSamples); + } + else + allSamples.Add(samples); + + int i = 0; for (double j = obj.StartTime; j <= obj.StartTime + taikoDuration + tickSpacing / 8; j += tickSpacing) { - // Todo: This should generate different type of hits (including strongs) - // depending on hitobject sound additions (not implemented fully yet) - yield return new CentreHit + List currentSamples = allSamples[i]; + bool isRim = currentSamples.Any(s => s.Name == SampleInfo.HIT_CLAP || s.Name == SampleInfo.HIT_WHISTLE); + + if (isRim) { - StartTime = j, - Samples = obj.Samples, - IsStrong = strong, - }; + yield return new RimHit + { + StartTime = j, + Samples = currentSamples, + IsStrong = strong + }; + } + else + { + yield return new CentreHit + { + StartTime = j, + Samples = currentSamples, + IsStrong = strong, + }; + } + + i = (i + 1) % allSamples.Count; } } else From cae4c7c6e5cf75c676f608605098c8a3fe09c29c Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 21 Apr 2017 19:12:16 +0900 Subject: [PATCH 350/442] Combine construction and assignment. --- osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs index 2bf0f0d662..a6464a3118 100644 --- a/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs @@ -108,10 +108,9 @@ namespace osu.Game.Rulesets.Objects.Legacy nodeSoundTypes.Add(soundType); // Read any per-node sound types - string[] adds = null; if (split.Length > 8 && split[8].Length > 0) { - adds = split[8].Split('|'); + string[] adds = split[8].Split('|'); for (int i = 0; i < nodes; i++) { if (i >= adds.Length) From 3345ba180f7468e04af362f71bb1bd7c02fc2740 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Apr 2017 19:26:32 +0900 Subject: [PATCH 351/442] Update with framework rename. --- osu.Game/Beatmaps/WorkingBeatmap.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 7c806a589a..e9271492e4 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -36,7 +36,7 @@ namespace osu.Game.Beatmaps var t = track; if (t == null) return; - t.ResetRate(); + t.ResetSpeedAdjustments(); foreach (var mod in Mods.Value.OfType()) mod.ApplyToClock(t); } From b8c10aa595c40fe2f4474a761c76ae63bc5f84ae Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 21 Apr 2017 19:37:16 +0900 Subject: [PATCH 352/442] Improve xmldoc. --- osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs index a6464a3118..3e31cc9001 100644 --- a/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs @@ -209,7 +209,9 @@ namespace osu.Game.Rulesets.Objects.Legacy /// The slider length. /// The slider curve type. /// The slider repeat count. - /// The slider repeat sounds (this includes the end node, but NOT the start node). + /// The samples to be played when the head of the slider is hit. + /// The samples to be played when the tail of the slider is hit. + /// The samples to be played when the repeat nodes are hit. /// The hit object. protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List headSamples, List tailSamples, List> repeatSamples); From 47f9b2d55bdded642b178c963b23295c27cae4ff Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 21 Apr 2017 19:38:04 +0900 Subject: [PATCH 353/442] Trim whitespace. --- osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs | 2 +- osu.Game/Rulesets/Objects/Types/IHasCurve.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs index 3e31cc9001..d61cad2da3 100644 --- a/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs @@ -76,7 +76,7 @@ namespace osu.Game.Rulesets.Objects.Legacy if (split.Length > 7) length = Convert.ToDouble(split[7], CultureInfo.InvariantCulture); - + if (split.Length > 10) readCustomSampleBanks(split[10], bankInfo); diff --git a/osu.Game/Rulesets/Objects/Types/IHasCurve.cs b/osu.Game/Rulesets/Objects/Types/IHasCurve.cs index 40e0b367de..cbe59422fb 100644 --- a/osu.Game/Rulesets/Objects/Types/IHasCurve.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasCurve.cs @@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Objects.Types /// The samples to be played when the head of the hit object is hit. /// List HeadSamples { get; } - + /// /// The samples to be played when the tail of the hit object is hit. /// From 6c8bd4dfe4f2ce0cee8998c0c6b322e8b4a2e909 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 21 Apr 2017 19:41:46 +0900 Subject: [PATCH 354/442] More trimming. --- osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs index d61cad2da3..2c08a826d7 100644 --- a/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs @@ -234,7 +234,7 @@ namespace osu.Game.Rulesets.Objects.Legacy Name = SampleInfo.HIT_NORMAL, Volume = bankInfo.Volume }); - + if ((type & LegacySoundType.Finish) > 0) { soundTypes.Add(new SampleInfo From 382e656e9fffb3f98fba30cd5feec6013c42b1a8 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 21 Apr 2017 19:51:23 +0900 Subject: [PATCH 355/442] CI fixes. --- osu.Game/Rulesets/Objects/CurvedHitObject.cs | 1 - .../Objects/Legacy/HitObjectParser.cs | 21 ++++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/osu.Game/Rulesets/Objects/CurvedHitObject.cs b/osu.Game/Rulesets/Objects/CurvedHitObject.cs index 57da216445..4d1d437e8a 100644 --- a/osu.Game/Rulesets/Objects/CurvedHitObject.cs +++ b/osu.Game/Rulesets/Objects/CurvedHitObject.cs @@ -5,7 +5,6 @@ using OpenTK; using osu.Game.Rulesets.Objects.Types; using System.Collections.Generic; using osu.Game.Audio; -using System; namespace osu.Game.Rulesets.Objects { diff --git a/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs index 2c08a826d7..124f31cbc1 100644 --- a/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs @@ -226,14 +226,15 @@ namespace osu.Game.Rulesets.Objects.Legacy private List convertSoundType(LegacySoundType type, SampleBankInfo bankInfo) { - var soundTypes = new List(); - - soundTypes.Add(new SampleInfo + var soundTypes = new List { - Bank = bankInfo.Normal, - Name = SampleInfo.HIT_NORMAL, - Volume = bankInfo.Volume - }); + new SampleInfo + { + Bank = bankInfo.Normal, + Name = SampleInfo.HIT_NORMAL, + Volume = bankInfo.Volume + } + }; if ((type & LegacySoundType.Finish) > 0) { @@ -270,9 +271,9 @@ namespace osu.Game.Rulesets.Objects.Legacy private class SampleBankInfo { - public string Normal = null; - public string Add = null; - public int Volume = 0; + public string Normal; + public string Add; + public int Volume; public SampleBankInfo Clone() { From 748f13501a334aed831e0688013b86cb2db7f49c Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 21 Apr 2017 20:04:40 +0900 Subject: [PATCH 356/442] Remove HeadSamples and TailSamples, combine into RepeatSamples. --- osu.Game.Rulesets.Osu/Objects/Slider.cs | 2 -- osu.Game/Rulesets/Objects/CurvedHitObject.cs | 3 --- osu.Game/Rulesets/Objects/HitObject.cs | 5 ----- .../Objects/Legacy/Catch/HitObjectParser.cs | 5 +---- osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs | 13 ++----------- .../Objects/Legacy/Mania/HitObjectParser.cs | 5 +---- .../Rulesets/Objects/Legacy/Osu/HitObjectParser.cs | 5 +---- .../Objects/Legacy/Taiko/HitObjectParser.cs | 5 +---- osu.Game/Rulesets/Objects/Types/IHasCurve.cs | 11 ----------- 9 files changed, 6 insertions(+), 48 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index 075d03d247..48c871d64d 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -34,8 +34,6 @@ namespace osu.Game.Rulesets.Osu.Objects public int RepeatAt(double progress) => CurveObject.RepeatAt(progress); public List> RepeatSamples => CurveObject.RepeatSamples; - public List HeadSamples => CurveObject.HeadSamples; - public List TailSamples => CurveObject.TailSamples; public List ControlPoints => CurveObject.ControlPoints; public CurveType CurveType => CurveObject.CurveType; diff --git a/osu.Game/Rulesets/Objects/CurvedHitObject.cs b/osu.Game/Rulesets/Objects/CurvedHitObject.cs index 4d1d437e8a..83aa67eb70 100644 --- a/osu.Game/Rulesets/Objects/CurvedHitObject.cs +++ b/osu.Game/Rulesets/Objects/CurvedHitObject.cs @@ -37,9 +37,6 @@ namespace osu.Game.Rulesets.Objects public List> RepeatSamples { get; set; } = new List>(); - public List HeadSamples { get; set; } = new List(); - public List TailSamples { get; set; } = new List(); - public Vector2 PositionAt(double progress) => Curve.PositionAt(ProgressAt(progress)); public double ProgressAt(double progress) diff --git a/osu.Game/Rulesets/Objects/HitObject.cs b/osu.Game/Rulesets/Objects/HitObject.cs index fe53a6ad7f..4ebe7137c4 100644 --- a/osu.Game/Rulesets/Objects/HitObject.cs +++ b/osu.Game/Rulesets/Objects/HitObject.cs @@ -49,11 +49,6 @@ namespace osu.Game.Rulesets.Objects // Initialize any repeat samples var repeatData = this as IHasRepeats; repeatData?.RepeatSamples?.ForEach(r => r.ForEach(s => initializeSampleInfo(s, samplePoint))); - - // Initialize any curved object samples - var curvedObject = this as CurvedHitObject; - curvedObject?.HeadSamples.ForEach(s => initializeSampleInfo(s, samplePoint)); - curvedObject?.TailSamples.ForEach(s => initializeSampleInfo(s, samplePoint)); } private void initializeSampleInfo(SampleInfo sample, ControlPoint controlPoint) diff --git a/osu.Game/Rulesets/Objects/Legacy/Catch/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/HitObjectParser.cs index 5e8c096da0..7ce6af85fd 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Catch/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/HitObjectParser.cs @@ -22,8 +22,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, - int repeatCount, List headSamples, List tailSamples, List> repeatSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) { return new Slider { @@ -33,8 +32,6 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch Distance = length, CurveType = curveType, RepeatCount = repeatCount, - HeadSamples = headSamples, - TailSamples = tailSamples, RepeatSamples = repeatSamples }; } diff --git a/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs index 124f31cbc1..1078efdab1 100644 --- a/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Globalization; using osu.Game.Beatmaps.Formats; using osu.Game.Audio; -using System.Linq; namespace osu.Game.Rulesets.Objects.Legacy { @@ -127,14 +126,7 @@ namespace osu.Game.Rulesets.Objects.Legacy for (int i = 0; i <= repeatCount; i++) nodeSamples.Add(convertSoundType(nodeSoundTypes[i], nodeBankInfos[i])); - // Extract the first and last samples for the head and tail respectively - List headSamples = nodeSamples.First(); - List tailSamples = nodeSamples.Last(); - - // Repeat samples are all the samples between head and tail - var repeatSamples = nodeSamples.Skip(1).TakeWhile(s => s != tailSamples).ToList(); - - result = CreateSlider(new Vector2(int.Parse(split[0]), int.Parse(split[1])), combo, points, length, curveType, repeatCount, headSamples, tailSamples, repeatSamples); + result = CreateSlider(new Vector2(int.Parse(split[0]), int.Parse(split[1])), combo, points, length, curveType, repeatCount, nodeSamples); } else if ((type & HitObjectType.Spinner) > 0) { @@ -213,8 +205,7 @@ namespace osu.Game.Rulesets.Objects.Legacy /// The samples to be played when the tail of the slider is hit. /// The samples to be played when the repeat nodes are hit. /// The hit object. - protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, - int repeatCount, List headSamples, List tailSamples, List> repeatSamples); + protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples); /// /// Creates a legacy Spinner-type hit object. diff --git a/osu.Game/Rulesets/Objects/Legacy/Mania/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Mania/HitObjectParser.cs index fa75592f74..f3b0738b1a 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Mania/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Mania/HitObjectParser.cs @@ -22,8 +22,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, - int repeatCount, List headSamples, List tailSamples, List> repeatSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) { return new Slider { @@ -33,8 +32,6 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania Distance = length, CurveType = curveType, RepeatCount = repeatCount, - HeadSamples = headSamples, - TailSamples = tailSamples, RepeatSamples = repeatSamples }; } diff --git a/osu.Game/Rulesets/Objects/Legacy/Osu/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/HitObjectParser.cs index f8310b9075..fd018c41a2 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Osu/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Osu/HitObjectParser.cs @@ -22,8 +22,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, - int repeatCount, List headSamples, List tailSamples, List> repeatSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) { return new Slider { @@ -33,8 +32,6 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu Distance = length, CurveType = curveType, RepeatCount = repeatCount, - HeadSamples = headSamples, - TailSamples = tailSamples, RepeatSamples = repeatSamples }; } diff --git a/osu.Game/Rulesets/Objects/Legacy/Taiko/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Taiko/HitObjectParser.cs index 77a29d9883..a297bc5692 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Taiko/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Taiko/HitObjectParser.cs @@ -21,8 +21,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, - int repeatCount, List headSamples, List tailSamples, List> repeatSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) { return new Slider { @@ -31,8 +30,6 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko Distance = length, CurveType = curveType, RepeatCount = repeatCount, - HeadSamples = headSamples, - TailSamples = tailSamples, RepeatSamples = repeatSamples }; } diff --git a/osu.Game/Rulesets/Objects/Types/IHasCurve.cs b/osu.Game/Rulesets/Objects/Types/IHasCurve.cs index cbe59422fb..5ff6d03f6d 100644 --- a/osu.Game/Rulesets/Objects/Types/IHasCurve.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasCurve.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using OpenTK; -using osu.Game.Audio; namespace osu.Game.Rulesets.Objects.Types { @@ -27,16 +26,6 @@ namespace osu.Game.Rulesets.Objects.Types /// CurveType CurveType { get; } - /// - /// The samples to be played when the head of the hit object is hit. - /// - List HeadSamples { get; } - - /// - /// The samples to be played when the tail of the hit object is hit. - /// - List TailSamples { get; } - /// /// Computes the position on the curve at a given progress, accounting for repeat logic. /// From f750325aa13eb1ad40f519344c681b3783bbf05a Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 21 Apr 2017 20:10:14 +0900 Subject: [PATCH 357/442] Bring up to date. --- .../Beatmaps/TaikoBeatmapConverter.cs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 4806f2568b..1278549f1a 100644 --- a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -103,16 +103,11 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps if (tickSpacing > 0 && osuDuration < 2 * speedAdjustedBeatLength) { - var allSamples = new List>(); - + List> allSamples; if (curveData != null) - { - allSamples.Add(curveData.HeadSamples); - allSamples.AddRange(curveData.RepeatSamples); - allSamples.Add(curveData.TailSamples); - } + allSamples = curveData.RepeatSamples; else - allSamples.Add(samples); + allSamples = new List> { samples }; int i = 0; for (double j = obj.StartTime; j <= obj.StartTime + taikoDuration + tickSpacing / 8; j += tickSpacing) From 45bccf883aa7f4797ef0c434309c9204fad441a7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Apr 2017 20:34:07 +0900 Subject: [PATCH 358/442] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index e24091cf7f..dc31d5bf4f 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit e24091cf7f5bf25602306c11146326079f2a98b0 +Subproject commit dc31d5bf4f10dd2a65a36a5461a0f422f41529d0 From b8f9a2be6edadc92351cafe2c8b8851a5ca47401 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 21 Apr 2017 20:11:12 +0900 Subject: [PATCH 359/442] Whoops fix xmldoc. --- osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs index 1078efdab1..5bacb41b83 100644 --- a/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs @@ -201,9 +201,7 @@ namespace osu.Game.Rulesets.Objects.Legacy /// The slider length. /// The slider curve type. /// The slider repeat count. - /// The samples to be played when the head of the slider is hit. - /// The samples to be played when the tail of the slider is hit. - /// The samples to be played when the repeat nodes are hit. + /// The samples to be played when the repeat nodes are hit. This includes the head and tail of the slider. /// The hit object. protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples); From 5cdbb226f8a135fad00f1dafecb1ad4cc86e67a6 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 21 Apr 2017 20:29:27 +0900 Subject: [PATCH 360/442] Remove CurvedHitObject to make RepeatSamples not tied to curve. --- .../Tests/TestCaseHitObjects.cs | 11 ++--- .../Beatmaps/OsuBeatmapConverter.cs | 14 ++++--- osu.Game.Rulesets.Osu/Objects/Slider.cs | 41 ++++++++++++++----- .../Objects/Legacy/Catch/HitObjectParser.cs | 4 +- .../Rulesets/Objects/Legacy/Catch/Slider.cs | 2 +- .../LegacySlider.cs} | 33 ++++++++------- .../Objects/Legacy/Mania/HitObjectParser.cs | 4 +- .../Rulesets/Objects/Legacy/Mania/Slider.cs | 2 +- .../Objects/Legacy/Osu/HitObjectParser.cs | 4 +- .../Rulesets/Objects/Legacy/Osu/Slider.cs | 2 +- .../Objects/Legacy/Taiko/HitObjectParser.cs | 4 +- .../Rulesets/Objects/Legacy/Taiko/Slider.cs | 2 +- osu.Game/osu.Game.csproj | 2 +- 13 files changed, 74 insertions(+), 51 deletions(-) rename osu.Game/Rulesets/Objects/{CurvedHitObject.cs => Legacy/LegacySlider.cs} (60%) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs index 15b38b3e83..aba37d5b30 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs @@ -62,15 +62,12 @@ namespace osu.Desktop.VisualTests.Tests add(new DrawableSlider(new Slider { StartTime = framedClock.CurrentTime + 600, - CurveObject = new CurvedHitObject + ControlPoints = new List { - ControlPoints = new List - { - new Vector2(-200, 0), - new Vector2(400, 0), - }, - Distance = 400 + new Vector2(-200, 0), + new Vector2(400, 0), }, + Distance = 400, Position = new Vector2(-200, 0), Velocity = 1, TickDistance = 100, diff --git a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs index 0eece7fc4c..3096c1c8a0 100644 --- a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs +++ b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs @@ -19,10 +19,10 @@ namespace osu.Game.Rulesets.Osu.Beatmaps protected override IEnumerable ConvertHitObject(HitObject original, Beatmap beatmap) { - IHasCurve curveData = original as IHasCurve; - IHasEndTime endTimeData = original as IHasEndTime; - IHasPosition positionData = original as IHasPosition; - IHasCombo comboData = original as IHasCombo; + var curveData = original as IHasCurve; + var endTimeData = original as IHasEndTime; + var positionData = original as IHasPosition; + var comboData = original as IHasCombo; if (curveData != null) { @@ -30,7 +30,11 @@ namespace osu.Game.Rulesets.Osu.Beatmaps { StartTime = original.StartTime, Samples = original.Samples, - CurveObject = curveData, + ControlPoints = curveData?.ControlPoints ?? null, + CurveType = curveData?.CurveType ?? CurveType.Catmull, + Distance = curveData?.Distance ?? 0, + RepeatSamples = curveData?.RepeatSamples ?? null, + RepeatCount = curveData?.RepeatCount ?? 1, Position = positionData?.Position ?? Vector2.Zero, NewCombo = comboData?.NewCombo ?? false }; diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index 48c871d64d..dba5b6d43f 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -20,26 +20,33 @@ namespace osu.Game.Rulesets.Osu.Objects /// private const float base_scoring_distance = 100; - public IHasCurve CurveObject { get; set; } - - public SliderCurve Curve => CurveObject.Curve; + public SliderCurve Curve { get; } = new SliderCurve(); public double EndTime => StartTime + RepeatCount * Curve.Distance / Velocity; public double Duration => EndTime - StartTime; public override Vector2 EndPosition => PositionAt(1); - public Vector2 PositionAt(double progress) => CurveObject.PositionAt(progress); - public double ProgressAt(double progress) => CurveObject.ProgressAt(progress); - public int RepeatAt(double progress) => CurveObject.RepeatAt(progress); + public List ControlPoints + { + get { return Curve.ControlPoints; } + set { Curve.ControlPoints = value; } + } - public List> RepeatSamples => CurveObject.RepeatSamples; + public CurveType CurveType + { + get { return Curve.CurveType; } + set { Curve.CurveType = value; } + } - public List ControlPoints => CurveObject.ControlPoints; - public CurveType CurveType => CurveObject.CurveType; - public double Distance => CurveObject.Distance; + public double Distance + { + get { return Curve.Distance; } + set { Curve.Distance = value; } + } - public int RepeatCount => CurveObject.RepeatCount; + public List> RepeatSamples { get; set; } = new List>(); + public int RepeatCount { get; set; } = 1; private int stackHeight; public override int StackHeight @@ -65,6 +72,18 @@ namespace osu.Game.Rulesets.Osu.Objects TickDistance = scoringDistance / difficulty.SliderTickRate; } + public Vector2 PositionAt(double progress) => Curve.PositionAt(ProgressAt(progress)); + + public double ProgressAt(double progress) + { + double p = progress * RepeatCount % 1; + if (RepeatAt(progress) % 2 == 1) + p = 1 - p; + return p; + } + + public int RepeatAt(double progress) => (int)(progress * RepeatCount); + public IEnumerable Ticks { get diff --git a/osu.Game/Rulesets/Objects/Legacy/Catch/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/HitObjectParser.cs index 7ce6af85fd..6575db99e7 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Catch/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/HitObjectParser.cs @@ -31,8 +31,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch ControlPoints = controlPoints, Distance = length, CurveType = curveType, - RepeatCount = repeatCount, - RepeatSamples = repeatSamples + RepeatSamples = repeatSamples, + RepeatCount = repeatCount }; } diff --git a/osu.Game/Rulesets/Objects/Legacy/Catch/Slider.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/Slider.cs index 865e56c847..1e1ae0c213 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Catch/Slider.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/Slider.cs @@ -8,7 +8,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch /// /// Legacy osu!catch Slider-type, used for parsing Beatmaps. /// - internal sealed class Slider : CurvedHitObject, IHasXPosition, IHasCombo + internal sealed class Slider : LegacySlider, IHasXPosition, IHasCombo { public float X { get; set; } diff --git a/osu.Game/Rulesets/Objects/CurvedHitObject.cs b/osu.Game/Rulesets/Objects/Legacy/LegacySlider.cs similarity index 60% rename from osu.Game/Rulesets/Objects/CurvedHitObject.cs rename to osu.Game/Rulesets/Objects/Legacy/LegacySlider.cs index 83aa67eb70..6ecd893be2 100644 --- a/osu.Game/Rulesets/Objects/CurvedHitObject.cs +++ b/osu.Game/Rulesets/Objects/Legacy/LegacySlider.cs @@ -1,21 +1,17 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; using osu.Game.Rulesets.Objects.Types; +using System; using System.Collections.Generic; +using OpenTK; using osu.Game.Audio; -namespace osu.Game.Rulesets.Objects +namespace osu.Game.Rulesets.Objects.Legacy { - public class CurvedHitObject : HitObject, IHasCurve + internal class LegacySlider : HitObject, IHasCurve { - public SliderCurve Curve { get; } = new SliderCurve(); - - public int RepeatCount { get; set; } = 1; - - public double EndTime => 0; - public double Duration => 0; + public SliderCurve Curve { get; set; } = new SliderCurve(); public List ControlPoints { @@ -36,17 +32,24 @@ namespace osu.Game.Rulesets.Objects } public List> RepeatSamples { get; set; } = new List>(); + public int RepeatCount { get; set; } = 1; - public Vector2 PositionAt(double progress) => Curve.PositionAt(ProgressAt(progress)); + public double EndTime { get; set; } + public double Duration { get; set; } + + public Vector2 PositionAt(double progress) + { + throw new NotImplementedException(); + } public double ProgressAt(double progress) { - var p = progress * RepeatCount % 1; - if (RepeatAt(progress) % 2 == 1) - p = 1 - p; - return p; + throw new NotImplementedException(); } - public int RepeatAt(double progress) => (int)(progress * RepeatCount); + public int RepeatAt(double progress) + { + throw new NotImplementedException(); + } } } diff --git a/osu.Game/Rulesets/Objects/Legacy/Mania/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Mania/HitObjectParser.cs index f3b0738b1a..0b2e245413 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Mania/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Mania/HitObjectParser.cs @@ -31,8 +31,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania ControlPoints = controlPoints, Distance = length, CurveType = curveType, - RepeatCount = repeatCount, - RepeatSamples = repeatSamples + RepeatSamples = repeatSamples, + RepeatCount = repeatCount }; } diff --git a/osu.Game/Rulesets/Objects/Legacy/Mania/Slider.cs b/osu.Game/Rulesets/Objects/Legacy/Mania/Slider.cs index c884ed324b..e92685ee7a 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Mania/Slider.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Mania/Slider.cs @@ -8,7 +8,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania /// /// Legacy osu!mania Slider-type, used for parsing Beatmaps. /// - internal sealed class Slider : CurvedHitObject, IHasXPosition, IHasCombo + internal sealed class Slider : LegacySlider, IHasXPosition, IHasCombo { public float X { get; set; } diff --git a/osu.Game/Rulesets/Objects/Legacy/Osu/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/HitObjectParser.cs index fd018c41a2..61db0f6c25 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Osu/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Osu/HitObjectParser.cs @@ -31,8 +31,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu ControlPoints = controlPoints, Distance = length, CurveType = curveType, - RepeatCount = repeatCount, - RepeatSamples = repeatSamples + RepeatSamples = repeatSamples, + RepeatCount = repeatCount }; } diff --git a/osu.Game/Rulesets/Objects/Legacy/Osu/Slider.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/Slider.cs index 7d90c6d41e..3ac28f2fd2 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Osu/Slider.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Osu/Slider.cs @@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu /// /// Legacy osu! Slider-type, used for parsing Beatmaps. /// - internal sealed class Slider : CurvedHitObject, IHasPosition, IHasCombo + internal sealed class Slider : LegacySlider, IHasPosition, IHasCombo { public Vector2 Position { get; set; } diff --git a/osu.Game/Rulesets/Objects/Legacy/Taiko/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Taiko/HitObjectParser.cs index a297bc5692..52d0a5e2d4 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Taiko/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Taiko/HitObjectParser.cs @@ -29,8 +29,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko ControlPoints = controlPoints, Distance = length, CurveType = curveType, - RepeatCount = repeatCount, - RepeatSamples = repeatSamples + RepeatSamples = repeatSamples, + RepeatCount = repeatCount }; } diff --git a/osu.Game/Rulesets/Objects/Legacy/Taiko/Slider.cs b/osu.Game/Rulesets/Objects/Legacy/Taiko/Slider.cs index 18d2d4039d..3666369f74 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Taiko/Slider.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Taiko/Slider.cs @@ -8,7 +8,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko /// /// Legacy osu!taiko Slider-type, used for parsing Beatmaps. /// - internal sealed class Slider : CurvedHitObject, IHasCombo + internal sealed class Slider : LegacySlider, IHasCombo { public bool NewCombo { get; set; } } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 6d7a905eed..be50f85c0c 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -113,6 +113,7 @@ + @@ -134,7 +135,6 @@ - From d7477955ac0f01a791ac0aae913ba99ff87a8548 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 21 Apr 2017 20:42:13 +0900 Subject: [PATCH 361/442] CI fixes. --- osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs | 1 - osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs | 10 +++++----- osu.Game/Rulesets/Objects/HitObject.cs | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs index aba37d5b30..dceb7a9cff 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs @@ -10,7 +10,6 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Framework.Testing; using osu.Framework.Timing; -using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Judgements; using osu.Game.Rulesets.Osu.Objects; diff --git a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs index 3096c1c8a0..7f6f524a7a 100644 --- a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs +++ b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapConverter.cs @@ -30,11 +30,11 @@ namespace osu.Game.Rulesets.Osu.Beatmaps { StartTime = original.StartTime, Samples = original.Samples, - ControlPoints = curveData?.ControlPoints ?? null, - CurveType = curveData?.CurveType ?? CurveType.Catmull, - Distance = curveData?.Distance ?? 0, - RepeatSamples = curveData?.RepeatSamples ?? null, - RepeatCount = curveData?.RepeatCount ?? 1, + ControlPoints = curveData.ControlPoints, + CurveType = curveData.CurveType, + Distance = curveData.Distance, + RepeatSamples = curveData.RepeatSamples, + RepeatCount = curveData.RepeatCount, Position = positionData?.Position ?? Vector2.Zero, NewCombo = comboData?.NewCombo ?? false }; diff --git a/osu.Game/Rulesets/Objects/HitObject.cs b/osu.Game/Rulesets/Objects/HitObject.cs index 4ebe7137c4..12e4ca6df1 100644 --- a/osu.Game/Rulesets/Objects/HitObject.cs +++ b/osu.Game/Rulesets/Objects/HitObject.cs @@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Objects /// /// The samples to be played when this hit object is hit. /// - /// In the case of types, this is the sample of the curve body + /// In the case of types, this is the sample of the curve body /// and can be treated as the default samples for the hit object. /// /// From 4e4372b1d78239940b73fe253f37847f4d96a83a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Apr 2017 20:48:43 +0900 Subject: [PATCH 362/442] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index e24091cf7f..b4e1b9a0eb 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit e24091cf7f5bf25602306c11146326079f2a98b0 +Subproject commit b4e1b9a0eb1782ab8cfc48e305fd295a25c0579e From 96a5d7032dcfc78477c57c48755dfbed45cc2366 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Apr 2017 22:37:55 +0900 Subject: [PATCH 363/442] Fix regression causing menu cursor to stick to screen edges. --- osu.Game/OsuGameBase.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 6eb9747eef..c9d7d856db 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -149,6 +149,7 @@ namespace osu.Game { new Container { + AlwaysReceiveInput = true, RelativeSizeAxes = Axes.Both, Depth = float.MinValue, Children = new Drawable[] From 2d914002394352b201c91afff40121bd579332ad Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 22 Apr 2017 15:35:57 +0900 Subject: [PATCH 364/442] Fix nullref due to framework change. --- .../Options/Sections/Graphics/LayoutOptions.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/Options/Sections/Graphics/LayoutOptions.cs b/osu.Game/Overlays/Options/Sections/Graphics/LayoutOptions.cs index b04f853ec4..9f5e3458f3 100644 --- a/osu.Game/Overlays/Options/Sections/Graphics/LayoutOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Graphics/LayoutOptions.cs @@ -12,8 +12,8 @@ namespace osu.Game.Overlays.Options.Sections.Graphics { protected override string Header => "Layout"; - private OptionSlider letterboxPositionX; - private OptionSlider letterboxPositionY; + private OptionSlider letterboxPositionX; + private OptionSlider letterboxPositionY; private Bindable letterboxing; @@ -35,15 +35,15 @@ namespace osu.Game.Overlays.Options.Sections.Graphics LabelText = "Letterboxing", Bindable = letterboxing, }, - letterboxPositionX = new OptionSlider + letterboxPositionX = new OptionSlider { LabelText = "Horizontal position", - Bindable = (BindableInt)config.GetBindable(FrameworkConfig.LetterboxPositionX) + Bindable = config.GetBindable(FrameworkConfig.LetterboxPositionX) }, - letterboxPositionY = new OptionSlider + letterboxPositionY = new OptionSlider { LabelText = "Vertical position", - Bindable = (BindableInt)config.GetBindable(FrameworkConfig.LetterboxPositionY) + Bindable = config.GetBindable(FrameworkConfig.LetterboxPositionY) }, }; From 307dc3e2e11150d55e59fb6a0ec7b662e3655956 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 22 Apr 2017 15:36:40 +0900 Subject: [PATCH 365/442] Make VSCode use CLR on Windows platform. --- .vscode/launch.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.vscode/launch.json b/.vscode/launch.json index c836ff97bc..876f960836 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -3,6 +3,9 @@ "configurations": [ { "name": "Launch VisualTests", + "windows": { + "type": "clr" + }, "type": "mono", "request": "launch", "program": "${workspaceRoot}/osu.Desktop.VisualTests/bin/Debug/osu!.exe", @@ -15,6 +18,9 @@ }, { "name": "Launch Desktop", + "windows": { + "type": "clr" + }, "type": "mono", "request": "launch", "program": "${workspaceRoot}/osu.Desktop/bin/Debug/osu!.exe", From 8dd77819252f735172cb4da9bf758e406ca064e5 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 22 Apr 2017 16:18:00 +0900 Subject: [PATCH 366/442] Add clr-specific attach request. --- .vscode/launch.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.vscode/launch.json b/.vscode/launch.json index 876f960836..0e07b0a067 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -33,6 +33,11 @@ }, { "name": "Attach", + "windows": { + "type": "clr", + "request": "attach", + "processName": "osu!" + }, "type": "mono", "request": "attach", "address": "localhost", From 0b67cf0e91e3724d7cb5334b7b793371e6362e2b Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 22 Apr 2017 16:30:21 +0900 Subject: [PATCH 367/442] Bring framework up to date. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index b4e1b9a0eb..d0f7f3a97c 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit b4e1b9a0eb1782ab8cfc48e305fd295a25c0579e +Subproject commit d0f7f3a97c11650b2b599a96cd55a446422ac94f From c108a7b48edcae12f4ffedc22cec5323f705bb56 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 22 Apr 2017 16:59:15 +0900 Subject: [PATCH 368/442] Generate portable PDBs + add rebuild task. --- .vscode/tasks.json | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 433e5fd2a9..6918afa620 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -11,7 +11,23 @@ "command": "msbuild", "args": [ // Ask msbuild to generate full paths for file names. - "/property:GenerateFullPaths=true" + "/property:GenerateFullPaths=true", + "/property:DebugType=portable" + ], + // Use the standard MS compiler pattern to detect errors, warnings and infos + "problemMatcher": "$msCompile", + "isBuildCommand": true + }, + { + "taskName": "rebuild", + "isShellCommand": true, + "showOutput": "silent", + "command": "msbuild", + "args": [ + // Ask msbuild to generate full paths for file names. + "/property:GenerateFullPaths=true", + "/property:DebugType=portable", + "/target:Clean,Build" ], // Use the standard MS compiler pattern to detect errors, warnings and infos "problemMatcher": "$msCompile", From 1bb0b96ddcb19bd50c45bea57ad5f6b8c055bd2a Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 22 Apr 2017 20:43:20 +0900 Subject: [PATCH 369/442] Make IHasCurve not depend on a SliderCurve object. --- osu.Game.Rulesets.Osu/Objects/Slider.cs | 2 +- .../OsuDifficultyCalculator.cs | 2 +- .../Rulesets/Objects/Legacy/LegacySlider.cs | 24 ++++--------------- osu.Game/Rulesets/Objects/Types/IHasCurve.cs | 5 ---- 4 files changed, 6 insertions(+), 27 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index dba5b6d43f..4d9d3f97ed 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Osu.Objects /// private const float base_scoring_distance = 100; - public SliderCurve Curve { get; } = new SliderCurve(); + public readonly SliderCurve Curve = new SliderCurve(); public double EndTime => StartTime + RepeatCount * Curve.Distance / Velocity; public double Duration => EndTime - StartTime; diff --git a/osu.Game.Rulesets.Osu/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/OsuDifficultyCalculator.cs index 14b890a055..03b88f49b5 100644 --- a/osu.Game.Rulesets.Osu/OsuDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/OsuDifficultyCalculator.cs @@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Osu protected override void PreprocessHitObjects() { foreach (var h in Objects) - (h as IHasCurve)?.Curve?.Calculate(); + (h as Slider)?.Curve?.Calculate(); } protected override double CalculateInternal(Dictionary categoryDifficulty) diff --git a/osu.Game/Rulesets/Objects/Legacy/LegacySlider.cs b/osu.Game/Rulesets/Objects/Legacy/LegacySlider.cs index 6ecd893be2..96a671fcef 100644 --- a/osu.Game/Rulesets/Objects/Legacy/LegacySlider.cs +++ b/osu.Game/Rulesets/Objects/Legacy/LegacySlider.cs @@ -11,27 +11,11 @@ namespace osu.Game.Rulesets.Objects.Legacy { internal class LegacySlider : HitObject, IHasCurve { - public SliderCurve Curve { get; set; } = new SliderCurve(); + public List ControlPoints { get; set; } + public CurveType CurveType { get; set; } + public double Distance { get; set; } - public List ControlPoints - { - get { return Curve.ControlPoints; } - set { Curve.ControlPoints = value; } - } - - public CurveType CurveType - { - get { return Curve.CurveType; } - set { Curve.CurveType = value; } - } - - public double Distance - { - get { return Curve.Distance; } - set { Curve.Distance = value; } - } - - public List> RepeatSamples { get; set; } = new List>(); + public List> RepeatSamples { get; set; } public int RepeatCount { get; set; } = 1; public double EndTime { get; set; } diff --git a/osu.Game/Rulesets/Objects/Types/IHasCurve.cs b/osu.Game/Rulesets/Objects/Types/IHasCurve.cs index 5ff6d03f6d..399138bc24 100644 --- a/osu.Game/Rulesets/Objects/Types/IHasCurve.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasCurve.cs @@ -11,11 +11,6 @@ namespace osu.Game.Rulesets.Objects.Types /// public interface IHasCurve : IHasDistance, IHasRepeats { - /// - /// The curve. - /// - SliderCurve Curve { get; } - /// /// The control points that shape the curve. /// From ec04ceaece3c2a3bec47164b390bb4f2bf7378af Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 22 Apr 2017 20:53:55 +0900 Subject: [PATCH 370/442] Fix off-by-one on repeatCount. --- osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs index 5bacb41b83..4caaf24da5 100644 --- a/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs @@ -80,7 +80,8 @@ namespace osu.Game.Rulesets.Objects.Legacy readCustomSampleBanks(split[10], bankInfo); // One node for each repeat + the start and end nodes - int nodes = repeatCount + 2; + // Note that the first length of the slider is considered a repeat, but there are no actual repeats happening + int nodes = Math.Max(0, repeatCount - 1) + 2; // Populate node sample bank infos with the default hit object sample bank var nodeBankInfos = new List(); From 99db871e6c881c7d533fa9be227416b4713f305d Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Sat, 22 Apr 2017 20:59:35 +0900 Subject: [PATCH 371/442] Update OsuDifficultyCalculator.cs --- osu.Game.Rulesets.Osu/OsuDifficultyCalculator.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/OsuDifficultyCalculator.cs index 03b88f49b5..5669993e67 100644 --- a/osu.Game.Rulesets.Osu/OsuDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/OsuDifficultyCalculator.cs @@ -3,7 +3,6 @@ using osu.Game.Beatmaps; using osu.Game.Rulesets.Beatmaps; -using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Osu.Beatmaps; using osu.Game.Rulesets.Osu.Objects; using System; @@ -190,4 +189,4 @@ namespace osu.Game.Rulesets.Osu Aim, }; } -} \ No newline at end of file +} From 2af9bf1423c924d532e1f505ca31401b3ffd8460 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 22 Apr 2017 21:33:11 +0900 Subject: [PATCH 372/442] Prefix everything inside Rulesets.Objects.Legacy with "Convert" to avoid naming clashes with Ruleset projects. --- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 10 ++--- .../Legacy/Catch/{Hit.cs => ConvertHit.cs} | 2 +- ...ectParser.cs => ConvertHitObjectParser.cs} | 8 ++-- .../Catch/{Slider.cs => ConvertSlider.cs} | 2 +- .../Catch/{Spinner.cs => ConvertSpinner.cs} | 2 +- ...ectParser.cs => ConvertHitObjectParser.cs} | 18 ++++----- ...tObjectType.cs => ConvertHitObjectType.cs} | 2 +- .../Legacy/{Hold.cs => ConvertHold.cs} | 2 +- .../{LegacySlider.cs => ConvertSlider.cs} | 2 +- .../Legacy/Mania/{Hit.cs => ConvertHit.cs} | 2 +- ...ectParser.cs => ConvertHitObjectParser.cs} | 8 ++-- .../Mania/{Slider.cs => ConvertSlider.cs} | 2 +- .../Mania/{Spinner.cs => ConvertSpinner.cs} | 2 +- .../Legacy/Osu/{Hit.cs => ConvertHit.cs} | 2 +- ...ectParser.cs => ConvertHitObjectParser.cs} | 8 ++-- .../Osu/{Slider.cs => ConvertSlider.cs} | 2 +- .../Osu/{Spinner.cs => ConvertSpinner.cs} | 2 +- .../Legacy/Taiko/{Hit.cs => ConvertHit.cs} | 2 +- ...ectParser.cs => ConvertHitObjectParser.cs} | 8 ++-- .../Taiko/{Slider.cs => ConvertSlider.cs} | 2 +- .../Taiko/{Spinner.cs => ConvertSpinner.cs} | 2 +- osu.Game/osu.Game.csproj | 40 +++++++++---------- 22 files changed, 65 insertions(+), 65 deletions(-) rename osu.Game/Rulesets/Objects/Legacy/Catch/{Hit.cs => ConvertHit.cs} (82%) rename osu.Game/Rulesets/Objects/Legacy/Catch/{HitObjectParser.cs => ConvertHitObjectParser.cs} (85%) rename osu.Game/Rulesets/Objects/Legacy/Catch/{Slider.cs => ConvertSlider.cs} (80%) rename osu.Game/Rulesets/Objects/Legacy/Catch/{Spinner.cs => ConvertSpinner.cs} (84%) rename osu.Game/Rulesets/Objects/Legacy/{HitObjectParser.cs => ConvertHitObjectParser.cs} (92%) rename osu.Game/Rulesets/Objects/Legacy/{HitObjectType.cs => ConvertHitObjectType.cs} (87%) rename osu.Game/Rulesets/Objects/Legacy/{Hold.cs => ConvertHold.cs} (83%) rename osu.Game/Rulesets/Objects/Legacy/{LegacySlider.cs => ConvertSlider.cs} (90%) rename osu.Game/Rulesets/Objects/Legacy/Mania/{Hit.cs => ConvertHit.cs} (82%) rename osu.Game/Rulesets/Objects/Legacy/Mania/{HitObjectParser.cs => ConvertHitObjectParser.cs} (85%) rename osu.Game/Rulesets/Objects/Legacy/Mania/{Slider.cs => ConvertSlider.cs} (80%) rename osu.Game/Rulesets/Objects/Legacy/Mania/{Spinner.cs => ConvertSpinner.cs} (83%) rename osu.Game/Rulesets/Objects/Legacy/Osu/{Hit.cs => ConvertHit.cs} (84%) rename osu.Game/Rulesets/Objects/Legacy/Osu/{HitObjectParser.cs => ConvertHitObjectParser.cs} (85%) rename osu.Game/Rulesets/Objects/Legacy/Osu/{Slider.cs => ConvertSlider.cs} (82%) rename osu.Game/Rulesets/Objects/Legacy/Osu/{Spinner.cs => ConvertSpinner.cs} (85%) rename osu.Game/Rulesets/Objects/Legacy/Taiko/{Hit.cs => ConvertHit.cs} (84%) rename osu.Game/Rulesets/Objects/Legacy/Taiko/{HitObjectParser.cs => ConvertHitObjectParser.cs} (84%) rename osu.Game/Rulesets/Objects/Legacy/Taiko/{Slider.cs => ConvertSlider.cs} (81%) rename osu.Game/Rulesets/Objects/Legacy/Taiko/{Spinner.cs => ConvertSpinner.cs} (84%) diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index 74a5be698e..95213417ed 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -29,7 +29,7 @@ namespace osu.Game.Beatmaps.Formats // TODO: Not sure how far back to go, or differences between versions } - private HitObjectParser parser; + private ConvertHitObjectParser parser; private LegacySampleBank defaultSampleBank; private int defaultSampleVolume = 100; @@ -90,16 +90,16 @@ namespace osu.Game.Beatmaps.Formats switch (beatmap.BeatmapInfo.RulesetID) { case 0: - parser = new Rulesets.Objects.Legacy.Osu.HitObjectParser(); + parser = new Rulesets.Objects.Legacy.Osu.ConvertHitObjectParser(); break; case 1: - parser = new Rulesets.Objects.Legacy.Taiko.HitObjectParser(); + parser = new Rulesets.Objects.Legacy.Taiko.ConvertHitObjectParser(); break; case 2: - parser = new Rulesets.Objects.Legacy.Catch.HitObjectParser(); + parser = new Rulesets.Objects.Legacy.Catch.ConvertHitObjectParser(); break; case 3: - parser = new Rulesets.Objects.Legacy.Mania.HitObjectParser(); + parser = new Rulesets.Objects.Legacy.Mania.ConvertHitObjectParser(); break; } break; diff --git a/osu.Game/Rulesets/Objects/Legacy/Catch/Hit.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHit.cs similarity index 82% rename from osu.Game/Rulesets/Objects/Legacy/Catch/Hit.cs rename to osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHit.cs index 41dacd1265..30c10c302a 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Catch/Hit.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHit.cs @@ -8,7 +8,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch /// /// Legacy osu!catch Hit-type, used for parsing Beatmaps. /// - internal sealed class Hit : HitObject, IHasCombo, IHasXPosition + internal sealed class ConvertHit : HitObject, IHasCombo, IHasXPosition { public float X { get; set; } diff --git a/osu.Game/Rulesets/Objects/Legacy/Catch/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs similarity index 85% rename from osu.Game/Rulesets/Objects/Legacy/Catch/HitObjectParser.cs rename to osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs index 6575db99e7..1550772f8e 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Catch/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs @@ -11,11 +11,11 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch /// /// A HitObjectParser to parse legacy osu!catch Beatmaps. /// - internal class HitObjectParser : Legacy.HitObjectParser + internal class ConvertHitObjectParser : Legacy.ConvertHitObjectParser { protected override HitObject CreateHit(Vector2 position, bool newCombo) { - return new Hit + return new ConvertHit { X = position.X, NewCombo = newCombo, @@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) { - return new Slider + return new ConvertSlider { X = position.X, NewCombo = newCombo, @@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch protected override HitObject CreateSpinner(Vector2 position, double endTime) { - return new Spinner + return new ConvertSpinner { EndTime = endTime }; diff --git a/osu.Game/Rulesets/Objects/Legacy/Catch/Slider.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSlider.cs similarity index 80% rename from osu.Game/Rulesets/Objects/Legacy/Catch/Slider.cs rename to osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSlider.cs index 1e1ae0c213..781fe8f7fa 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Catch/Slider.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSlider.cs @@ -8,7 +8,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch /// /// Legacy osu!catch Slider-type, used for parsing Beatmaps. /// - internal sealed class Slider : LegacySlider, IHasXPosition, IHasCombo + internal sealed class ConvertSlider : Legacy.ConvertSlider, IHasXPosition, IHasCombo { public float X { get; set; } diff --git a/osu.Game/Rulesets/Objects/Legacy/Catch/Spinner.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs similarity index 84% rename from osu.Game/Rulesets/Objects/Legacy/Catch/Spinner.cs rename to osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs index 7690f42e76..0652737b12 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Catch/Spinner.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs @@ -8,7 +8,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch /// /// Legacy osu!catch Spinner-type, used for parsing Beatmaps. /// - internal sealed class Spinner : HitObject, IHasEndTime + internal sealed class ConvertSpinner : HitObject, IHasEndTime { public double EndTime { get; set; } diff --git a/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs similarity index 92% rename from osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs rename to osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index 4caaf24da5..5b6de3bff7 100644 --- a/osu.Game/Rulesets/Objects/Legacy/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -14,28 +14,28 @@ namespace osu.Game.Rulesets.Objects.Legacy /// /// A HitObjectParser to parse legacy Beatmaps. /// - internal abstract class HitObjectParser : Objects.HitObjectParser + internal abstract class ConvertHitObjectParser : Objects.HitObjectParser { public override HitObject Parse(string text) { string[] split = text.Split(','); - HitObjectType type = (HitObjectType)int.Parse(split[3]) & ~HitObjectType.ColourHax; - bool combo = type.HasFlag(HitObjectType.NewCombo); - type &= ~HitObjectType.NewCombo; + ConvertHitObjectType type = (ConvertHitObjectType)int.Parse(split[3]) & ~ConvertHitObjectType.ColourHax; + bool combo = type.HasFlag(ConvertHitObjectType.NewCombo); + type &= ~ConvertHitObjectType.NewCombo; var soundType = (LegacySoundType)int.Parse(split[4]); var bankInfo = new SampleBankInfo(); HitObject result; - if ((type & HitObjectType.Circle) > 0) + if ((type & ConvertHitObjectType.Circle) > 0) { result = CreateHit(new Vector2(int.Parse(split[0]), int.Parse(split[1])), combo); if (split.Length > 5) readCustomSampleBanks(split[5], bankInfo); } - else if ((type & HitObjectType.Slider) > 0) + else if ((type & ConvertHitObjectType.Slider) > 0) { CurveType curveType = CurveType.Catmull; double length = 0; @@ -129,21 +129,21 @@ namespace osu.Game.Rulesets.Objects.Legacy result = CreateSlider(new Vector2(int.Parse(split[0]), int.Parse(split[1])), combo, points, length, curveType, repeatCount, nodeSamples); } - else if ((type & HitObjectType.Spinner) > 0) + else if ((type & ConvertHitObjectType.Spinner) > 0) { result = CreateSpinner(new Vector2(512, 384) / 2, Convert.ToDouble(split[5], CultureInfo.InvariantCulture)); if (split.Length > 6) readCustomSampleBanks(split[6], bankInfo); } - else if ((type & HitObjectType.Hold) > 0) + else if ((type & ConvertHitObjectType.Hold) > 0) { // Note: Hold is generated by BMS converts // Todo: Apparently end time is determined by samples?? // Shouldn't need implementation until mania - result = new Hold + result = new ConvertHold { Position = new Vector2(int.Parse(split[0]), int.Parse(split[1])), NewCombo = combo diff --git a/osu.Game/Rulesets/Objects/Legacy/HitObjectType.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectType.cs similarity index 87% rename from osu.Game/Rulesets/Objects/Legacy/HitObjectType.cs rename to osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectType.cs index 9111e6bd12..09f005e666 100644 --- a/osu.Game/Rulesets/Objects/Legacy/HitObjectType.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectType.cs @@ -6,7 +6,7 @@ using System; namespace osu.Game.Rulesets.Objects.Legacy { [Flags] - public enum HitObjectType + internal enum ConvertHitObjectType { Circle = 1 << 0, Slider = 1 << 1, diff --git a/osu.Game/Rulesets/Objects/Legacy/Hold.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHold.cs similarity index 83% rename from osu.Game/Rulesets/Objects/Legacy/Hold.cs rename to osu.Game/Rulesets/Objects/Legacy/ConvertHold.cs index a0a741e8e7..d79f6e324e 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Hold.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHold.cs @@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Objects.Legacy /// /// Legacy Hold-type, used for parsing "specials" in beatmaps. /// - internal sealed class Hold : HitObject, IHasPosition, IHasCombo, IHasHold + internal sealed class ConvertHold : HitObject, IHasPosition, IHasCombo, IHasHold { public Vector2 Position { get; set; } diff --git a/osu.Game/Rulesets/Objects/Legacy/LegacySlider.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs similarity index 90% rename from osu.Game/Rulesets/Objects/Legacy/LegacySlider.cs rename to osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs index 96a671fcef..06391a9906 100644 --- a/osu.Game/Rulesets/Objects/Legacy/LegacySlider.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs @@ -9,7 +9,7 @@ using osu.Game.Audio; namespace osu.Game.Rulesets.Objects.Legacy { - internal class LegacySlider : HitObject, IHasCurve + internal abstract class ConvertSlider : HitObject, IHasCurve { public List ControlPoints { get; set; } public CurveType CurveType { get; set; } diff --git a/osu.Game/Rulesets/Objects/Legacy/Mania/Hit.cs b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHit.cs similarity index 82% rename from osu.Game/Rulesets/Objects/Legacy/Mania/Hit.cs rename to osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHit.cs index 8e407fcf92..2a65b853b7 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Mania/Hit.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHit.cs @@ -8,7 +8,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania /// /// Legacy osu!mania Hit-type, used for parsing Beatmaps. /// - internal sealed class Hit : HitObject, IHasXPosition, IHasCombo + internal sealed class ConvertHit : HitObject, IHasXPosition, IHasCombo { public float X { get; set; } diff --git a/osu.Game/Rulesets/Objects/Legacy/Mania/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs similarity index 85% rename from osu.Game/Rulesets/Objects/Legacy/Mania/HitObjectParser.cs rename to osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs index 0b2e245413..b21857797f 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Mania/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs @@ -11,11 +11,11 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania /// /// A HitObjectParser to parse legacy osu!mania Beatmaps. /// - internal class HitObjectParser : Legacy.HitObjectParser + internal class ConvertHitObjectParser : Legacy.ConvertHitObjectParser { protected override HitObject CreateHit(Vector2 position, bool newCombo) { - return new Hit + return new ConvertHit { X = position.X, NewCombo = newCombo, @@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) { - return new Slider + return new ConvertSlider { X = position.X, NewCombo = newCombo, @@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania protected override HitObject CreateSpinner(Vector2 position, double endTime) { - return new Spinner + return new ConvertSpinner { X = position.X, EndTime = endTime diff --git a/osu.Game/Rulesets/Objects/Legacy/Mania/Slider.cs b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertSlider.cs similarity index 80% rename from osu.Game/Rulesets/Objects/Legacy/Mania/Slider.cs rename to osu.Game/Rulesets/Objects/Legacy/Mania/ConvertSlider.cs index e92685ee7a..adc0c064bc 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Mania/Slider.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertSlider.cs @@ -8,7 +8,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania /// /// Legacy osu!mania Slider-type, used for parsing Beatmaps. /// - internal sealed class Slider : LegacySlider, IHasXPosition, IHasCombo + internal sealed class ConvertSlider : Legacy.ConvertSlider, IHasXPosition, IHasCombo { public float X { get; set; } diff --git a/osu.Game/Rulesets/Objects/Legacy/Mania/Spinner.cs b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertSpinner.cs similarity index 83% rename from osu.Game/Rulesets/Objects/Legacy/Mania/Spinner.cs rename to osu.Game/Rulesets/Objects/Legacy/Mania/ConvertSpinner.cs index 3937eb003e..f72c5b9894 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Mania/Spinner.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertSpinner.cs @@ -8,7 +8,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania /// /// Legacy osu!mania Spinner-type, used for parsing Beatmaps. /// - internal sealed class Spinner : HitObject, IHasEndTime, IHasXPosition + internal sealed class ConvertSpinner : HitObject, IHasEndTime, IHasXPosition { public double EndTime { get; set; } diff --git a/osu.Game/Rulesets/Objects/Legacy/Osu/Hit.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHit.cs similarity index 84% rename from osu.Game/Rulesets/Objects/Legacy/Osu/Hit.cs rename to osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHit.cs index a30ba9b265..0c1000965c 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Osu/Hit.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHit.cs @@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu /// /// Legacy osu! Hit-type, used for parsing Beatmaps. /// - internal sealed class Hit : HitObject, IHasPosition, IHasCombo + internal sealed class ConvertHit : HitObject, IHasPosition, IHasCombo { public Vector2 Position { get; set; } diff --git a/osu.Game/Rulesets/Objects/Legacy/Osu/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs similarity index 85% rename from osu.Game/Rulesets/Objects/Legacy/Osu/HitObjectParser.cs rename to osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs index 61db0f6c25..e45a161f52 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Osu/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs @@ -11,11 +11,11 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu /// /// A HitObjectParser to parse legacy osu! Beatmaps. /// - internal class HitObjectParser : Legacy.HitObjectParser + internal class ConvertHitObjectParser : Legacy.ConvertHitObjectParser { protected override HitObject CreateHit(Vector2 position, bool newCombo) { - return new Hit + return new ConvertHit { Position = position, NewCombo = newCombo, @@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) { - return new Slider + return new ConvertSlider { Position = position, NewCombo = newCombo, @@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu protected override HitObject CreateSpinner(Vector2 position, double endTime) { - return new Spinner + return new ConvertSpinner { Position = position, EndTime = endTime diff --git a/osu.Game/Rulesets/Objects/Legacy/Osu/Slider.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSlider.cs similarity index 82% rename from osu.Game/Rulesets/Objects/Legacy/Osu/Slider.cs rename to osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSlider.cs index 3ac28f2fd2..75a6d80560 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Osu/Slider.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSlider.cs @@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu /// /// Legacy osu! Slider-type, used for parsing Beatmaps. /// - internal sealed class Slider : LegacySlider, IHasPosition, IHasCombo + internal sealed class ConvertSlider : Legacy.ConvertSlider, IHasPosition, IHasCombo { public Vector2 Position { get; set; } diff --git a/osu.Game/Rulesets/Objects/Legacy/Osu/Spinner.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSpinner.cs similarity index 85% rename from osu.Game/Rulesets/Objects/Legacy/Osu/Spinner.cs rename to osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSpinner.cs index ad3f9637a7..2b2dbe0765 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Osu/Spinner.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertSpinner.cs @@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu /// /// Legacy osu! Spinner-type, used for parsing Beatmaps. /// - internal sealed class Spinner : HitObject, IHasEndTime, IHasPosition + internal sealed class ConvertSpinner : HitObject, IHasEndTime, IHasPosition { public double EndTime { get; set; } diff --git a/osu.Game/Rulesets/Objects/Legacy/Taiko/Hit.cs b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHit.cs similarity index 84% rename from osu.Game/Rulesets/Objects/Legacy/Taiko/Hit.cs rename to osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHit.cs index 0a9a8ac64c..7088cc480b 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Taiko/Hit.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHit.cs @@ -8,7 +8,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko /// /// Legacy osu!taiko Hit-type, used for parsing Beatmaps. /// - internal sealed class Hit : HitObject, IHasCombo + internal sealed class ConvertHit : HitObject, IHasCombo { public bool NewCombo { get; set; } } diff --git a/osu.Game/Rulesets/Objects/Legacy/Taiko/HitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs similarity index 84% rename from osu.Game/Rulesets/Objects/Legacy/Taiko/HitObjectParser.cs rename to osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs index 52d0a5e2d4..2de2f217d1 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Taiko/HitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs @@ -11,11 +11,11 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko /// /// A HitObjectParser to parse legacy osu!taiko Beatmaps. /// - internal class HitObjectParser : Legacy.HitObjectParser + internal class ConvertHitObjectParser : Legacy.ConvertHitObjectParser { protected override HitObject CreateHit(Vector2 position, bool newCombo) { - return new Hit + return new ConvertHit { NewCombo = newCombo, }; @@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) { - return new Slider + return new ConvertSlider { NewCombo = newCombo, ControlPoints = controlPoints, @@ -36,7 +36,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko protected override HitObject CreateSpinner(Vector2 position, double endTime) { - return new Spinner + return new ConvertSpinner { EndTime = endTime }; diff --git a/osu.Game/Rulesets/Objects/Legacy/Taiko/Slider.cs b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertSlider.cs similarity index 81% rename from osu.Game/Rulesets/Objects/Legacy/Taiko/Slider.cs rename to osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertSlider.cs index 3666369f74..b472423a1d 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Taiko/Slider.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertSlider.cs @@ -8,7 +8,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko /// /// Legacy osu!taiko Slider-type, used for parsing Beatmaps. /// - internal sealed class Slider : LegacySlider, IHasCombo + internal sealed class ConvertSlider : Legacy.ConvertSlider, IHasCombo { public bool NewCombo { get; set; } } diff --git a/osu.Game/Rulesets/Objects/Legacy/Taiko/Spinner.cs b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertSpinner.cs similarity index 84% rename from osu.Game/Rulesets/Objects/Legacy/Taiko/Spinner.cs rename to osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertSpinner.cs index 1b296b9533..abef667d91 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Taiko/Spinner.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertSpinner.cs @@ -8,7 +8,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko /// /// Legacy osu!taiko Spinner-type, used for parsing Beatmaps. /// - internal sealed class Spinner : HitObject, IHasEndTime + internal sealed class ConvertSpinner : HitObject, IHasEndTime { public double EndTime { get; set; } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index be50f85c0c..60456602c2 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -109,20 +109,20 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + @@ -135,11 +135,11 @@ - - - - - + + + + + @@ -152,7 +152,7 @@ - + From 35cf4af9e72176f93fc5470cc6692ebcd05ac4c1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 22 Apr 2017 23:17:59 +0900 Subject: [PATCH 373/442] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index d0f7f3a97c..9204b83850 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit d0f7f3a97c11650b2b599a96cd55a446422ac94f +Subproject commit 9204b838504a51ffe7577c103b91270a2687bfb8 From 1d2f19b5a23923daeff1e8dbb83b2a0db65c4e00 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Thu, 20 Apr 2017 14:43:30 +0200 Subject: [PATCH 374/442] change background dim from integer to double --- osu.Game/Configuration/OsuConfigManager.cs | 2 +- .../Overlays/Options/Sections/Gameplay/GeneralOptions.cs | 4 ++-- osu.Game/Screens/Play/Player.cs | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index d47ed48e99..71dc076d61 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -24,7 +24,7 @@ namespace osu.Game.Configuration Set(OsuConfig.MenuCursorSize, 1.0, 0.5f, 2); Set(OsuConfig.GameplayCursorSize, 1.0, 0.5f, 2); - Set(OsuConfig.DimLevel, 30, 0, 100); + Set(OsuConfig.DimLevel, 0.3, 0, 1); Set(OsuConfig.MouseDisableButtons, false); Set(OsuConfig.MouseDisableWheel, false); diff --git a/osu.Game/Overlays/Options/Sections/Gameplay/GeneralOptions.cs b/osu.Game/Overlays/Options/Sections/Gameplay/GeneralOptions.cs index ee6778a47a..167f4f0486 100644 --- a/osu.Game/Overlays/Options/Sections/Gameplay/GeneralOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Gameplay/GeneralOptions.cs @@ -18,10 +18,10 @@ namespace osu.Game.Overlays.Options.Sections.Gameplay { Children = new Drawable[] { - new OptionSlider + new OptionSlider { LabelText = "Background dim", - Bindable = (BindableInt)config.GetBindable(OsuConfig.DimLevel) + Bindable = (BindableDouble)config.GetBindable(OsuConfig.DimLevel) }, new OptionEnumDropdown { diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index a31ac25d60..2668c61eee 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -62,7 +62,7 @@ namespace osu.Game.Screens.Play #region User Settings - private Bindable dimLevel; + private Bindable dimLevel; private Bindable mouseWheelDisabled; private Bindable userAudioOffset; @@ -77,7 +77,7 @@ namespace osu.Game.Screens.Play [BackgroundDependencyLoader(permitNulls: true)] private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config, OsuGame osu) { - dimLevel = config.GetBindable(OsuConfig.DimLevel); + dimLevel = config.GetBindable(OsuConfig.DimLevel); mouseWheelDisabled = config.GetBindable(OsuConfig.MouseDisableWheel); Ruleset rulesetInstance; @@ -316,11 +316,11 @@ namespace osu.Game.Screens.Play base.OnEntering(last); (Background as BackgroundScreenBeatmap)?.BlurTo(Vector2.Zero, 1500, EasingTypes.OutQuint); - Background?.FadeTo((100f - dimLevel) / 100, 1500, EasingTypes.OutQuint); + Background?.FadeTo(1 - (float)dimLevel, 1500, EasingTypes.OutQuint); Content.Alpha = 0; - dimLevel.ValueChanged += newDim => Background?.FadeTo((100f - newDim) / 100, 800); + dimLevel.ValueChanged += newDim => Background?.FadeTo(1 - (float)newDim, 800); Content.ScaleTo(0.7f); From 02249dcd67391a26eb82ee0c25d4df9aec7f433b Mon Sep 17 00:00:00 2001 From: Jorolf Date: Thu, 20 Apr 2017 14:52:06 +0200 Subject: [PATCH 375/442] add a function to OsuSliderBar to manually set the tooltip text --- osu.Game/Graphics/UserInterface/OsuSliderBar.cs | 10 ++++++++-- osu.Game/Overlays/Options/OptionSlider.cs | 16 ++++++++++++++-- .../Options/Sections/Audio/OffsetOptions.cs | 1 + .../Sections/Gameplay/SongSelectOptions.cs | 7 +++++-- .../Options/Sections/Input/MouseOptions.cs | 2 ++ .../Overlays/Options/Sections/SkinSection.cs | 7 +++++-- 6 files changed, 35 insertions(+), 8 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index 9b9a774049..cf141dd320 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -10,6 +10,8 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input; +using System; +using System.Globalization; namespace osu.Game.Graphics.UserInterface { @@ -23,16 +25,20 @@ namespace osu.Game.Graphics.UserInterface private readonly Box leftBox; private readonly Box rightBox; + public Func TooltipTextFunc { get; set; } + public string TooltipText { get { + if (TooltipTextFunc != null) return TooltipTextFunc(Current); + var bindableDouble = CurrentNumber as BindableNumber; if (bindableDouble != null) { - if (bindableDouble.MaxValue == 1 && bindableDouble.MinValue == 0) + if (bindableDouble.MaxValue == 1 && (bindableDouble.MinValue == 0 || bindableDouble.MinValue == -1)) return bindableDouble.Value.ToString(@"P0"); - return bindableDouble.Value.ToString(@"n1"); + return bindableDouble.Value.ToString(@"n1", CultureInfo.InvariantCulture); } var bindableInt = CurrentNumber as BindableNumber; diff --git a/osu.Game/Overlays/Options/OptionSlider.cs b/osu.Game/Overlays/Options/OptionSlider.cs index 5c383c74a8..b6989fb7d2 100644 --- a/osu.Game/Overlays/Options/OptionSlider.cs +++ b/osu.Game/Overlays/Options/OptionSlider.cs @@ -6,15 +6,15 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using System; namespace osu.Game.Overlays.Options { public class OptionSlider : FillFlowContainer where T : struct { - private readonly SliderBar slider; + private readonly OsuSliderBar slider; private readonly SpriteText text; public string LabelText @@ -38,6 +38,18 @@ namespace osu.Game.Overlays.Options } } + public Func TooltipText + { + get + { + return slider.TooltipTextFunc; + } + set + { + slider.TooltipTextFunc = value; + } + } + public OptionSlider() { RelativeSizeAxes = Axes.X; diff --git a/osu.Game/Overlays/Options/Sections/Audio/OffsetOptions.cs b/osu.Game/Overlays/Options/Sections/Audio/OffsetOptions.cs index c1f5359585..2a4fea28d4 100644 --- a/osu.Game/Overlays/Options/Sections/Audio/OffsetOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Audio/OffsetOptions.cs @@ -22,6 +22,7 @@ namespace osu.Game.Overlays.Options.Sections.Audio { LabelText = "Audio Offset", Bindable = (BindableDouble)config.GetBindable(OsuConfig.AudioOffset) + TooltipText = value => value.ToString(@"0ms") }, new OsuButton { diff --git a/osu.Game/Overlays/Options/Sections/Gameplay/SongSelectOptions.cs b/osu.Game/Overlays/Options/Sections/Gameplay/SongSelectOptions.cs index be38a9847a..3a546f5a0d 100644 --- a/osu.Game/Overlays/Options/Sections/Gameplay/SongSelectOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Gameplay/SongSelectOptions.cs @@ -5,6 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Game.Configuration; +using System.Globalization; namespace osu.Game.Overlays.Options.Sections.Gameplay { @@ -20,12 +21,14 @@ namespace osu.Game.Overlays.Options.Sections.Gameplay new OptionSlider { LabelText = "Display beatmaps from", - Bindable = (BindableDouble)config.GetBindable(OsuConfig.DisplayStarsMinimum) + Bindable = (BindableDouble)config.GetBindable(OsuConfig.DisplayStarsMinimum), + TooltipText = value => value.ToString(@"0.## stars", CultureInfo.InvariantCulture) }, new OptionSlider { LabelText = "up to", - Bindable = (BindableDouble)config.GetBindable(OsuConfig.DisplayStarsMaximum) + Bindable = (BindableDouble)config.GetBindable(OsuConfig.DisplayStarsMaximum), + TooltipText = value => value.ToString(@"0.## stars", CultureInfo.InvariantCulture) }, }; } diff --git a/osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs b/osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs index 92be00bdb0..63685aff0d 100644 --- a/osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Globalization; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; @@ -22,6 +23,7 @@ namespace osu.Game.Overlays.Options.Sections.Input { LabelText = "Sensitivity", Bindable = (BindableDouble)config.GetBindable(OsuConfig.MouseSpeed), + TooltipText = value => value.ToString(@"0.##x", CultureInfo.InvariantCulture) }, new OsuCheckbox { diff --git a/osu.Game/Overlays/Options/Sections/SkinSection.cs b/osu.Game/Overlays/Options/Sections/SkinSection.cs index 78f4f1e380..aa681b94b3 100644 --- a/osu.Game/Overlays/Options/Sections/SkinSection.cs +++ b/osu.Game/Overlays/Options/Sections/SkinSection.cs @@ -8,6 +8,7 @@ using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using OpenTK; +using System.Globalization; namespace osu.Game.Overlays.Options.Sections { @@ -62,12 +63,14 @@ namespace osu.Game.Overlays.Options.Sections new OptionSlider { LabelText = "Menu cursor size", - Bindable = (BindableDouble)config.GetBindable(OsuConfig.MenuCursorSize) + Bindable = (BindableDouble)config.GetBindable(OsuConfig.MenuCursorSize), + TooltipText = value => value.ToString(@"0.##x", CultureInfo.InvariantCulture) }, new OptionSlider { LabelText = "Gameplay cursor size", - Bindable = (BindableDouble)config.GetBindable(OsuConfig.GameplayCursorSize) + Bindable = (BindableDouble)config.GetBindable(OsuConfig.GameplayCursorSize), + TooltipText = value => value.ToString(@"0.##x", CultureInfo.InvariantCulture) }, new OsuCheckbox { From e53c4be3561c85b900fffff27f0b11b330238379 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Fri, 21 Apr 2017 13:59:04 +0200 Subject: [PATCH 376/442] I guess this works... --- .../Graphics/UserInterface/OsuSliderBar.cs | 10 ++------ osu.Game/Overlays/Options/OptionSlider.cs | 24 +++++++------------ .../Options/Sections/Audio/OffsetOptions.cs | 8 +++++-- .../Sections/Gameplay/SongSelectOptions.cs | 17 +++++++------ .../Options/Sections/Input/MouseOptions.cs | 11 +++++---- .../Overlays/Options/Sections/SkinSection.cs | 16 +++++++------ 6 files changed, 42 insertions(+), 44 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index cf141dd320..027473921f 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -10,8 +10,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input; -using System; -using System.Globalization; namespace osu.Game.Graphics.UserInterface { @@ -25,20 +23,16 @@ namespace osu.Game.Graphics.UserInterface private readonly Box leftBox; private readonly Box rightBox; - public Func TooltipTextFunc { get; set; } - - public string TooltipText + public virtual string TooltipText { get { - if (TooltipTextFunc != null) return TooltipTextFunc(Current); - var bindableDouble = CurrentNumber as BindableNumber; if (bindableDouble != null) { if (bindableDouble.MaxValue == 1 && (bindableDouble.MinValue == 0 || bindableDouble.MinValue == -1)) return bindableDouble.Value.ToString(@"P0"); - return bindableDouble.Value.ToString(@"n1", CultureInfo.InvariantCulture); + return bindableDouble.Value.ToString(@"n1"); } var bindableInt = CurrentNumber as BindableNumber; diff --git a/osu.Game/Overlays/Options/OptionSlider.cs b/osu.Game/Overlays/Options/OptionSlider.cs index b6989fb7d2..6084a7de80 100644 --- a/osu.Game/Overlays/Options/OptionSlider.cs +++ b/osu.Game/Overlays/Options/OptionSlider.cs @@ -6,15 +6,19 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; -using System; namespace osu.Game.Overlays.Options { - public class OptionSlider : FillFlowContainer where T : struct + public class OptionSlider : OptionSlider> where T: struct { - private readonly OsuSliderBar slider; + } + + public class OptionSlider : FillFlowContainer where T : struct where U : SliderBar, new() + { + private readonly SliderBar slider; private readonly SpriteText text; public string LabelText @@ -38,18 +42,6 @@ namespace osu.Game.Overlays.Options } } - public Func TooltipText - { - get - { - return slider.TooltipTextFunc; - } - set - { - slider.TooltipTextFunc = value; - } - } - public OptionSlider() { RelativeSizeAxes = Axes.X; @@ -62,7 +54,7 @@ namespace osu.Game.Overlays.Options { Alpha = 0, }, - slider = new OsuSliderBar + slider = new U() { Margin = new MarginPadding { Top = 5, Bottom = 5 }, RelativeSizeAxes = Axes.X diff --git a/osu.Game/Overlays/Options/Sections/Audio/OffsetOptions.cs b/osu.Game/Overlays/Options/Sections/Audio/OffsetOptions.cs index 2a4fea28d4..699a5bff81 100644 --- a/osu.Game/Overlays/Options/Sections/Audio/OffsetOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Audio/OffsetOptions.cs @@ -18,11 +18,10 @@ namespace osu.Game.Overlays.Options.Sections.Audio { Children = new Drawable[] { - new OptionSlider + new OptionSlider { LabelText = "Audio Offset", Bindable = (BindableDouble)config.GetBindable(OsuConfig.AudioOffset) - TooltipText = value => value.ToString(@"0ms") }, new OsuButton { @@ -31,5 +30,10 @@ namespace osu.Game.Overlays.Options.Sections.Audio } }; } + + private class OffsetSlider : OsuSliderBar + { + public override string TooltipText => Current.Value.ToString(@"0ms"); + } } } diff --git a/osu.Game/Overlays/Options/Sections/Gameplay/SongSelectOptions.cs b/osu.Game/Overlays/Options/Sections/Gameplay/SongSelectOptions.cs index 3a546f5a0d..1a994ff85b 100644 --- a/osu.Game/Overlays/Options/Sections/Gameplay/SongSelectOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Gameplay/SongSelectOptions.cs @@ -5,7 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Game.Configuration; -using System.Globalization; +using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Options.Sections.Gameplay { @@ -18,20 +18,23 @@ namespace osu.Game.Overlays.Options.Sections.Gameplay { Children = new Drawable[] { - new OptionSlider + new OptionSlider { LabelText = "Display beatmaps from", - Bindable = (BindableDouble)config.GetBindable(OsuConfig.DisplayStarsMinimum), - TooltipText = value => value.ToString(@"0.## stars", CultureInfo.InvariantCulture) + Bindable = (BindableDouble)config.GetBindable(OsuConfig.DisplayStarsMinimum) }, - new OptionSlider + new OptionSlider { LabelText = "up to", - Bindable = (BindableDouble)config.GetBindable(OsuConfig.DisplayStarsMaximum), - TooltipText = value => value.ToString(@"0.## stars", CultureInfo.InvariantCulture) + Bindable = (BindableDouble)config.GetBindable(OsuConfig.DisplayStarsMaximum) }, }; } + + private class StarSlider : OsuSliderBar + { + public override string TooltipText => Current.Value.ToString(@"0.## stars"); + } } } diff --git a/osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs b/osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs index 63685aff0d..0882dbab01 100644 --- a/osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Globalization; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; @@ -19,11 +18,10 @@ namespace osu.Game.Overlays.Options.Sections.Input { Children = new Drawable[] { - new OptionSlider + new OptionSlider { LabelText = "Sensitivity", - Bindable = (BindableDouble)config.GetBindable(OsuConfig.MouseSpeed), - TooltipText = value => value.ToString(@"0.##x", CultureInfo.InvariantCulture) + Bindable = (BindableDouble)config.GetBindable(OsuConfig.MouseSpeed) }, new OsuCheckbox { @@ -57,5 +55,10 @@ namespace osu.Game.Overlays.Options.Sections.Input }, }; } + + private class SensitivitySlider : OsuSliderBar + { + public override string TooltipText => Current.Value.ToString(@"0.##x"); + } } } diff --git a/osu.Game/Overlays/Options/Sections/SkinSection.cs b/osu.Game/Overlays/Options/Sections/SkinSection.cs index aa681b94b3..d76c17f09a 100644 --- a/osu.Game/Overlays/Options/Sections/SkinSection.cs +++ b/osu.Game/Overlays/Options/Sections/SkinSection.cs @@ -8,7 +8,6 @@ using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using OpenTK; -using System.Globalization; namespace osu.Game.Overlays.Options.Sections { @@ -60,17 +59,15 @@ namespace osu.Game.Overlays.Options.Sections LabelText = "Always use skin cursor", Bindable = config.GetBindable(OsuConfig.UseSkinCursor) }, - new OptionSlider + new OptionSlider { LabelText = "Menu cursor size", - Bindable = (BindableDouble)config.GetBindable(OsuConfig.MenuCursorSize), - TooltipText = value => value.ToString(@"0.##x", CultureInfo.InvariantCulture) + Bindable = (BindableDouble)config.GetBindable(OsuConfig.MenuCursorSize) }, - new OptionSlider + new OptionSlider { LabelText = "Gameplay cursor size", - Bindable = (BindableDouble)config.GetBindable(OsuConfig.GameplayCursorSize), - TooltipText = value => value.ToString(@"0.##x", CultureInfo.InvariantCulture) + Bindable = (BindableDouble)config.GetBindable(OsuConfig.GameplayCursorSize) }, new OsuCheckbox { @@ -79,5 +76,10 @@ namespace osu.Game.Overlays.Options.Sections }, }; } + + private class SizeSlider : OsuSliderBar + { + public override string TooltipText => Current.Value.ToString(@"0.##x"); + } } } From b151c71c0e244a922b23bf40e947d29b911c85f0 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Fri, 21 Apr 2017 14:41:00 +0200 Subject: [PATCH 377/442] remove casts --- osu.Game/Overlays/Options/Sections/Audio/OffsetOptions.cs | 2 +- .../Overlays/Options/Sections/Gameplay/SongSelectOptions.cs | 4 ++-- osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs | 2 +- osu.Game/Overlays/Options/Sections/SkinSection.cs | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/Options/Sections/Audio/OffsetOptions.cs b/osu.Game/Overlays/Options/Sections/Audio/OffsetOptions.cs index 699a5bff81..a763a57377 100644 --- a/osu.Game/Overlays/Options/Sections/Audio/OffsetOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Audio/OffsetOptions.cs @@ -21,7 +21,7 @@ namespace osu.Game.Overlays.Options.Sections.Audio new OptionSlider { LabelText = "Audio Offset", - Bindable = (BindableDouble)config.GetBindable(OsuConfig.AudioOffset) + Bindable = config.GetBindable(OsuConfig.AudioOffset) }, new OsuButton { diff --git a/osu.Game/Overlays/Options/Sections/Gameplay/SongSelectOptions.cs b/osu.Game/Overlays/Options/Sections/Gameplay/SongSelectOptions.cs index 1a994ff85b..3ab844d411 100644 --- a/osu.Game/Overlays/Options/Sections/Gameplay/SongSelectOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Gameplay/SongSelectOptions.cs @@ -21,12 +21,12 @@ namespace osu.Game.Overlays.Options.Sections.Gameplay new OptionSlider { LabelText = "Display beatmaps from", - Bindable = (BindableDouble)config.GetBindable(OsuConfig.DisplayStarsMinimum) + Bindable = config.GetBindable(OsuConfig.DisplayStarsMinimum) }, new OptionSlider { LabelText = "up to", - Bindable = (BindableDouble)config.GetBindable(OsuConfig.DisplayStarsMaximum) + Bindable = config.GetBindable(OsuConfig.DisplayStarsMaximum) }, }; } diff --git a/osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs b/osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs index 0882dbab01..fdaa03cb8d 100644 --- a/osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs @@ -21,7 +21,7 @@ namespace osu.Game.Overlays.Options.Sections.Input new OptionSlider { LabelText = "Sensitivity", - Bindable = (BindableDouble)config.GetBindable(OsuConfig.MouseSpeed) + Bindable = config.GetBindable(OsuConfig.MouseSpeed) }, new OsuCheckbox { diff --git a/osu.Game/Overlays/Options/Sections/SkinSection.cs b/osu.Game/Overlays/Options/Sections/SkinSection.cs index d76c17f09a..4461b59abc 100644 --- a/osu.Game/Overlays/Options/Sections/SkinSection.cs +++ b/osu.Game/Overlays/Options/Sections/SkinSection.cs @@ -62,12 +62,12 @@ namespace osu.Game.Overlays.Options.Sections new OptionSlider { LabelText = "Menu cursor size", - Bindable = (BindableDouble)config.GetBindable(OsuConfig.MenuCursorSize) + Bindable = config.GetBindable(OsuConfig.MenuCursorSize) }, new OptionSlider { LabelText = "Gameplay cursor size", - Bindable = (BindableDouble)config.GetBindable(OsuConfig.GameplayCursorSize) + Bindable = config.GetBindable(OsuConfig.GameplayCursorSize) }, new OsuCheckbox { From 60bb45358c8daf48c40cf18de1b1372704365766 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Fri, 21 Apr 2017 14:50:03 +0200 Subject: [PATCH 378/442] remove more casts and usings --- osu.Game/Overlays/Options/Sections/Audio/OffsetOptions.cs | 1 - .../Overlays/Options/Sections/Gameplay/GeneralOptions.cs | 5 ++--- .../Overlays/Options/Sections/Gameplay/SongSelectOptions.cs | 1 - osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs | 1 - osu.Game/Overlays/Options/Sections/SkinSection.cs | 1 - 5 files changed, 2 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/Options/Sections/Audio/OffsetOptions.cs b/osu.Game/Overlays/Options/Sections/Audio/OffsetOptions.cs index a763a57377..78c9688c93 100644 --- a/osu.Game/Overlays/Options/Sections/Audio/OffsetOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Audio/OffsetOptions.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; -using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Overlays/Options/Sections/Gameplay/GeneralOptions.cs b/osu.Game/Overlays/Options/Sections/Gameplay/GeneralOptions.cs index 167f4f0486..99f9ecbaed 100644 --- a/osu.Game/Overlays/Options/Sections/Gameplay/GeneralOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Gameplay/GeneralOptions.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; -using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; @@ -21,7 +20,7 @@ namespace osu.Game.Overlays.Options.Sections.Gameplay new OptionSlider { LabelText = "Background dim", - Bindable = (BindableDouble)config.GetBindable(OsuConfig.DimLevel) + Bindable = config.GetBindable(OsuConfig.DimLevel) }, new OptionEnumDropdown { @@ -36,7 +35,7 @@ namespace osu.Game.Overlays.Options.Sections.Gameplay new OptionSlider { LabelText = "Score meter size", - Bindable = (BindableDouble)config.GetBindable(OsuConfig.ScoreMeterScale) + Bindable = config.GetBindable(OsuConfig.ScoreMeterScale) }, new OsuCheckbox { diff --git a/osu.Game/Overlays/Options/Sections/Gameplay/SongSelectOptions.cs b/osu.Game/Overlays/Options/Sections/Gameplay/SongSelectOptions.cs index 3ab844d411..3b8ec9329b 100644 --- a/osu.Game/Overlays/Options/Sections/Gameplay/SongSelectOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Gameplay/SongSelectOptions.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; -using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs b/osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs index fdaa03cb8d..7b34a371d6 100644 --- a/osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; -using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Overlays/Options/Sections/SkinSection.cs b/osu.Game/Overlays/Options/Sections/SkinSection.cs index 4461b59abc..82ccf740d0 100644 --- a/osu.Game/Overlays/Options/Sections/SkinSection.cs +++ b/osu.Game/Overlays/Options/Sections/SkinSection.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; -using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Game.Configuration; using osu.Game.Graphics; From 1d254f4a56d3de34966793619a0fecdff517dbe9 Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Sun, 23 Apr 2017 00:13:58 -0500 Subject: [PATCH 379/442] Take MusicController back to life --- osu.Game/Beatmaps/WorkingBeatmap.cs | 4 ++-- osu.Game/Overlays/MusicController.cs | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index e9271492e4..6270e780ce 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -18,7 +18,7 @@ namespace osu.Game.Beatmaps public readonly BeatmapSetInfo BeatmapSetInfo; - public readonly Bindable> Mods = new Bindable>(); + public readonly Bindable> Mods = new Bindable>(new Mod[] { }); public readonly bool WithStoryboard; @@ -27,7 +27,7 @@ namespace osu.Game.Beatmaps BeatmapInfo = beatmapInfo; BeatmapSetInfo = beatmapSetInfo; WithStoryboard = withStoryboard; - + Mods.ValueChanged += mods => applyRateAdjustments(); } diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 9d21a0341c..399c352ee3 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -22,6 +22,7 @@ using osu.Game.Database; using osu.Game.Graphics; using osu.Framework.Graphics.Primitives; using osu.Game.Graphics.Sprites; +using osu.Framework.Extensions; using osu.Framework.Extensions.Color4Extensions; namespace osu.Game.Overlays @@ -293,7 +294,7 @@ namespace osu.Game.Overlays trackManager.SetExclusive(current.Track); current.Track.Start(); beatmapSource.Value = current; - }); + }).ContinueWith(task => Schedule(() => task.ThrowIfFaulted())); updateDisplay(current, isNext ? TransformDirection.Next : TransformDirection.Prev); } From 094a0f9639e2e9ed36426770248b53269f6ddcfc Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Sun, 23 Apr 2017 00:36:23 -0500 Subject: [PATCH 380/442] Move MenuMusic logic to MainMenu --- osu.Game/Screens/Menu/Intro.cs | 23 ------------------- osu.Game/Screens/Menu/MainMenu.cs | 37 ++++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 24 deletions(-) diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index 60493ff356..a899e483b4 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -74,17 +74,6 @@ namespace osu.Game.Screens.Menu { menuVoice = config.GetBindable(OsuConfig.MenuVoice); menuMusic = config.GetBindable(OsuConfig.MenuMusic); - if (!menuMusic) - { - trackManager = game.Audio.Track; - choosableBeatmapsetAmmout = beatmaps.Query().Count(); - if (choosableBeatmapsetAmmout > 0) - { - beatmap = beatmaps.GetWithChildren(RNG.Next(1, choosableBeatmapsetAmmout)).Beatmaps[0]; - song = beatmaps.GetWorkingBeatmap(beatmap); - Beatmap = song; - } - } bgm = audio.Track.Get(@"circles"); bgm.Looping = true; @@ -105,23 +94,11 @@ namespace osu.Game.Screens.Menu { if(menuMusic) bgm.Start(); - else if (song != null) - { - Task.Run(() => - { - trackManager.SetExclusive(song.Track); - song.Track.Seek(beatmap.Metadata.PreviewTime); - if (beatmap.Metadata.PreviewTime == -1) - song.Track.Seek(song.Track.Length * .4f); - }); - } LoadComponentAsync(mainMenu = new MainMenu()); Scheduler.AddDelayed(delegate { - if (!menuMusic && song != null) - Task.Run(() => song.Track.Start()); DidLoadMenu = true; Push(mainMenu); }, 2300); diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 59528dad91..59ba52dc58 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -2,8 +2,14 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; +using osu.Framework.Audio.Track; +using osu.Framework.Configuration; using osu.Framework.Graphics; +using osu.Framework.MathUtils; using osu.Framework.Screens; +using osu.Game.Beatmaps; +using osu.Game.Configuration; +using osu.Game.Database; using osu.Game.Graphics.Containers; using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Charts; @@ -15,6 +21,7 @@ using osu.Game.Screens.Select; using osu.Game.Screens.Tournament; using osu.Framework.Input; using OpenTK.Input; +using System.Threading.Tasks; namespace osu.Game.Screens.Menu { @@ -54,11 +61,30 @@ namespace osu.Game.Screens.Menu }; } + private Bindable menuMusic; + private TrackManager trackManager; + private BeatmapInfo beatmap; + private WorkingBeatmap song; + private int choosableBeatmapsetAmmout; + [BackgroundDependencyLoader] - private void load(OsuGame game) + private void load(OsuGame game, OsuConfigManager config, BeatmapDatabase beatmaps) { + menuMusic = config.GetBindable(OsuConfig.MenuMusic); LoadComponentAsync(background); + if (!menuMusic) + { + trackManager = game.Audio.Track; + choosableBeatmapsetAmmout = beatmaps.Query().Count(); + if (choosableBeatmapsetAmmout > 0) + { + beatmap = beatmaps.GetWithChildren(RNG.Next(1, choosableBeatmapsetAmmout)).Beatmaps[0]; + song = beatmaps.GetWorkingBeatmap(beatmap); + Beatmap = song; + } + } + buttons.OnSettings = game.ToggleOptions; preloadSongSelect(); @@ -81,6 +107,15 @@ namespace osu.Game.Screens.Menu { base.OnEntering(last); buttons.FadeInFromZero(500); + if(last is Intro && song != null) + Task.Run(() => + { + trackManager.SetExclusive(song.Track); + song.Track.Seek(beatmap.Metadata.PreviewTime); + if (beatmap.Metadata.PreviewTime == -1) + song.Track.Seek(song.Track.Length * .4f); + song.Track.Start(); + }); } protected override void OnSuspending(Screen next) From 4b69477531afd5b4ed0f589323e0bfe44d3a021d Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Sun, 23 Apr 2017 00:41:15 -0500 Subject: [PATCH 381/442] Trim whitespace --- osu.Game/Beatmaps/WorkingBeatmap.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 6270e780ce..616128dab5 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -27,7 +27,7 @@ namespace osu.Game.Beatmaps BeatmapInfo = beatmapInfo; BeatmapSetInfo = beatmapSetInfo; WithStoryboard = withStoryboard; - + Mods.ValueChanged += mods => applyRateAdjustments(); } From fe35d20defd4249fbacfa7212dd30e9cf8af91b8 Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Sun, 23 Apr 2017 00:50:02 -0500 Subject: [PATCH 382/442] Remove not needed stuff (+typo fix) --- osu.Game/Screens/Menu/Intro.cs | 10 +--------- osu.Game/Screens/Menu/MainMenu.cs | 7 +++---- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index a899e483b4..fe32965e64 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -1,18 +1,14 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Audio.Track; using osu.Framework.Configuration; -using osu.Framework.MathUtils; using osu.Framework.Screens; using osu.Framework.Graphics; -using osu.Game.Beatmaps; using osu.Game.Configuration; -using osu.Game.Database; using osu.Game.Graphics.Containers; using osu.Game.Screens.Backgrounds; using OpenTK.Graphics; @@ -64,13 +60,9 @@ namespace osu.Game.Screens.Menu private Bindable menuVoice; private Bindable menuMusic; - private TrackManager trackManager; - private BeatmapInfo beatmap; - private WorkingBeatmap song; - private int choosableBeatmapsetAmmout; [BackgroundDependencyLoader] - private void load(OsuGameBase game, AudioManager audio, OsuConfigManager config, BeatmapDatabase beatmaps) + private void load(OsuGameBase game, AudioManager audio, OsuConfigManager config) { menuVoice = config.GetBindable(OsuConfig.MenuVoice); menuMusic = config.GetBindable(OsuConfig.MenuMusic); diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 59ba52dc58..b2bb1ff29c 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -65,7 +65,6 @@ namespace osu.Game.Screens.Menu private TrackManager trackManager; private BeatmapInfo beatmap; private WorkingBeatmap song; - private int choosableBeatmapsetAmmout; [BackgroundDependencyLoader] private void load(OsuGame game, OsuConfigManager config, BeatmapDatabase beatmaps) @@ -76,10 +75,10 @@ namespace osu.Game.Screens.Menu if (!menuMusic) { trackManager = game.Audio.Track; - choosableBeatmapsetAmmout = beatmaps.Query().Count(); - if (choosableBeatmapsetAmmout > 0) + int choosableBeatmapsetAmmount = beatmaps.Query().Count(); + if (choosableBeatmapsetAmmount > 0) { - beatmap = beatmaps.GetWithChildren(RNG.Next(1, choosableBeatmapsetAmmout)).Beatmaps[0]; + beatmap = beatmaps.GetWithChildren(RNG.Next(1, choosableBeatmapsetAmmount)).Beatmaps[0]; song = beatmaps.GetWorkingBeatmap(beatmap); Beatmap = song; } From 6a05440e6caba16584b4226273dfbbe8c35f8006 Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Sun, 23 Apr 2017 00:53:21 -0500 Subject: [PATCH 383/442] Only schedule when faulted --- osu.Game/Overlays/MusicController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 399c352ee3..19e742facb 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -294,7 +294,7 @@ namespace osu.Game.Overlays trackManager.SetExclusive(current.Track); current.Track.Start(); beatmapSource.Value = current; - }).ContinueWith(task => Schedule(() => task.ThrowIfFaulted())); + }).ContinueWith(task => Schedule(() => task.ThrowIfFaulted()), TaskContinuationOptions.OnlyOnFaulted); updateDisplay(current, isNext ? TransformDirection.Next : TransformDirection.Prev); } From 30b7a029dcee4af5fb5fc9f877e219ec4922fc1f Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Sun, 23 Apr 2017 00:57:41 -0500 Subject: [PATCH 384/442] Remove for real this time --- osu.Game/Screens/Menu/Intro.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index fe32965e64..f9b95dd7eb 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -62,7 +62,7 @@ namespace osu.Game.Screens.Menu private Bindable menuMusic; [BackgroundDependencyLoader] - private void load(OsuGameBase game, AudioManager audio, OsuConfigManager config) + private void load(AudioManager audio, OsuConfigManager config) { menuVoice = config.GetBindable(OsuConfig.MenuVoice); menuMusic = config.GetBindable(OsuConfig.MenuMusic); From 239f19ad0265e35b985ac33b8ac45e623e476099 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 14:10:44 +0900 Subject: [PATCH 385/442] Fix incorrect line endings. --- osu.Game/osu.Game.csproj | 900 +++++++++++++++++++-------------------- 1 file changed, 450 insertions(+), 450 deletions(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 889c6a3c82..c9a3b08713 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -1,451 +1,451 @@ - - - - - Debug - AnyCPU - {0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D} - Library - Properties - osu.Game - osu.Game - v4.5 - 512 - - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - 6 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false - - - - $(SolutionDir)\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll - - - $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1341\lib\net45\OpenTK.dll - - - $(SolutionDir)\packages\SharpCompress.0.15.2\lib\net45\SharpCompress.dll - - - $(SolutionDir)\packages\SQLite.Net.Core-PCL.3.1.1\lib\portable-win8+net45+wp8+wpa81+MonoAndroid1+MonoTouch1\SQLite.Net.dll - True - - - $(SolutionDir)\packages\SQLite.Net-PCL.3.1.1\lib\net40\SQLite.Net.Platform.Generic.dll - True - - - $(SolutionDir)\packages\SQLite.Net-PCL.3.1.1\lib\net4\SQLite.Net.Platform.Win32.dll - True - - - - - - $(SolutionDir)\packages\DotNetZip.1.10.1\lib\net20\DotNetZip.dll - - - $(SolutionDir)\packages\SQLiteNetExtensions.1.3.0\lib\portable-net45+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1\SQLiteNetExtensions.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {c76bf5b3-985e-4d39-95fe-97c9c879b83a} - osu.Framework - - - {d9a367c9-4c1a-489f-9b05-a0cea2b53b58} - osu.Game.Resources - - - - - osu.licenseheader - - - - - - - - - - + + + + + Debug + AnyCPU + {0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D} + Library + Properties + osu.Game + osu.Game + v4.5 + 512 + + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + 6 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + false + + + + $(SolutionDir)\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll + + + $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1341\lib\net45\OpenTK.dll + + + $(SolutionDir)\packages\SharpCompress.0.15.2\lib\net45\SharpCompress.dll + + + $(SolutionDir)\packages\SQLite.Net.Core-PCL.3.1.1\lib\portable-win8+net45+wp8+wpa81+MonoAndroid1+MonoTouch1\SQLite.Net.dll + True + + + $(SolutionDir)\packages\SQLite.Net-PCL.3.1.1\lib\net40\SQLite.Net.Platform.Generic.dll + True + + + $(SolutionDir)\packages\SQLite.Net-PCL.3.1.1\lib\net4\SQLite.Net.Platform.Win32.dll + True + + + + + + $(SolutionDir)\packages\DotNetZip.1.10.1\lib\net20\DotNetZip.dll + + + $(SolutionDir)\packages\SQLiteNetExtensions.1.3.0\lib\portable-net45+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1\SQLiteNetExtensions.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {c76bf5b3-985e-4d39-95fe-97c9c879b83a} + osu.Framework + + + {d9a367c9-4c1a-489f-9b05-a0cea2b53b58} + osu.Game.Resources + + + + + osu.licenseheader + + + + + + + + + + \ No newline at end of file From a475f1f23744534e06d72ad93bcff62146c42e54 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 14:16:51 +0900 Subject: [PATCH 386/442] Remove redundant qualifier. --- osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index 5b6de3bff7..ad028e0cee 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -14,7 +14,7 @@ namespace osu.Game.Rulesets.Objects.Legacy /// /// A HitObjectParser to parse legacy Beatmaps. /// - internal abstract class ConvertHitObjectParser : Objects.HitObjectParser + internal abstract class ConvertHitObjectParser : HitObjectParser { public override HitObject Parse(string text) { From ee659e73073d01b1fcfbc4e57e75cd7fff252d7d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 18:34:27 +0900 Subject: [PATCH 387/442] Fix decimal display of beatmap details being too precise. --- osu.Game/Screens/Select/BeatmapDetails.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index a0d15101e0..04f3e89c9b 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -49,6 +49,7 @@ namespace osu.Game.Screens.Select set { beatmap = value; + if (beatmap == null) return; description.Text = beatmap.Version; @@ -252,7 +253,7 @@ namespace osu.Game.Screens.Select new Container { RelativeSizeAxes = Axes.X, - Size = new Vector2(1/0.6f, 50), + Size = new Vector2(1 / 0.6f, 50), Children = new[] { retryGraph = new BarGraph @@ -308,7 +309,7 @@ namespace osu.Game.Screens.Select { difficultyValue = value; bar.Length = value / maxValue; - valueText.Text = value.ToString(CultureInfo.InvariantCulture); + valueText.Text = value.ToString("N1", CultureInfo.CurrentCulture); } } @@ -431,4 +432,4 @@ namespace osu.Game.Screens.Select } } } -} \ No newline at end of file +} From 4fa22146b82043a2f14f181af1c0bf9b113b3c43 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 18:48:28 +0900 Subject: [PATCH 388/442] Increase safety of score lookups when leaderboard isn't visible. --- osu.Game/Screens/Select/Leaderboards/Leaderboard.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs index 2c51429d4c..02a412685c 100644 --- a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using System; using osu.Framework.Allocation; +using osu.Framework.Threading; using osu.Game.Database; using osu.Game.Rulesets.Scoring; using osu.Game.Online.API; @@ -93,13 +94,18 @@ namespace osu.Game.Screens.Select.Leaderboards private BeatmapInfo beatmap; + private ScheduledDelegate pendingBeatmapSwitch; + public BeatmapInfo Beatmap { get { return beatmap; } set { beatmap = value; - Schedule(updateScores); + Scores = null; + + pendingBeatmapSwitch?.Cancel(); + pendingBeatmapSwitch = Schedule(updateScores); } } From d6c5654924f4b88d07a134d17d185fc98064b682 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 18:55:49 +0900 Subject: [PATCH 389/442] Reduce paddings and lock in some fixed heights for BeatmapDetails. --- osu.Game/Screens/Select/BeatmapDetailArea.cs | 8 ++++---- osu.Game/Screens/Select/BeatmapDetails.cs | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index ae117254fa..26ec74e299 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -66,16 +66,16 @@ namespace osu.Game.Screens.Select { Details = new BeatmapDetails { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding(5), + RelativeSizeAxes = Axes.X, + Masking = true, + Height = 352, Alpha = 0, }, Leaderboard = new Leaderboard { RelativeSizeAxes = Axes.Both, - } }); } } -} \ No newline at end of file +} diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 04f3e89c9b..462f741dae 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -114,7 +114,6 @@ namespace osu.Game.Screens.Select Direction = FillDirection.Vertical, LayoutDuration = 200, LayoutEasing = EasingTypes.OutQuint, - Padding = new MarginPadding(10) { Top = 25 }, Children = new [] { description = new MetadataSegment("Description"), @@ -149,8 +148,8 @@ namespace osu.Game.Screens.Select RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, - Spacing = new Vector2(0,10), - Padding = new MarginPadding(15) { Top = 25 }, + Spacing = new Vector2(0,5), + Padding = new MarginPadding(10), Children = new [] { circleSize = new DifficultyRow("Circle Size", 7), From e1a2f1bc7aa7b972a0a7be372e6a4bdbbc373fe6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 19:17:11 +0900 Subject: [PATCH 390/442] Add beatmap metrics lookup. --- osu.Game/Database/BeatmapMetrics.cs | 3 + .../API/Requests/GetBeatmapDetailsRequest.cs | 61 ++++++++ osu.Game/Screens/Select/BeatmapDetailArea.cs | 2 +- osu.Game/Screens/Select/BeatmapDetails.cs | 140 ++++++++++++------ osu.Game/osu.Game.csproj | 1 + 5 files changed, 160 insertions(+), 47 deletions(-) create mode 100644 osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs diff --git a/osu.Game/Database/BeatmapMetrics.cs b/osu.Game/Database/BeatmapMetrics.cs index 91320110d0..25de0f0a8d 100644 --- a/osu.Game/Database/BeatmapMetrics.cs +++ b/osu.Game/Database/BeatmapMetrics.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; +using Newtonsoft.Json; namespace osu.Game.Database { @@ -18,11 +19,13 @@ namespace osu.Game.Database /// /// Points of failure on a relative time scale (usually 0..100). /// + [JsonProperty(@"fail")] public IEnumerable Fails { get; set; } /// /// Points of retry on a relative time scale (usually 0..100). /// + [JsonProperty(@"exit")] public IEnumerable Retries { get; set; } } } diff --git a/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs b/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs new file mode 100644 index 0000000000..a3b99331c6 --- /dev/null +++ b/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs @@ -0,0 +1,61 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using Newtonsoft.Json; +using osu.Framework.IO.Network; +using osu.Game.Database; +using osu.Game.Rulesets.Scoring; + +namespace osu.Game.Online.API.Requests +{ + public class GetBeatmapDeatilsRequest : APIRequest + { + private readonly BeatmapInfo beatmap; + + private string lookupString; + + public GetBeatmapDeatilsRequest(BeatmapInfo beatmap) + { + this.beatmap = beatmap; + } + + protected override WebRequest CreateWebRequest() + { + if (beatmap.OnlineBeatmapID > 0) + lookupString = beatmap.OnlineBeatmapID.ToString(); + else + lookupString = $@"lookup?checksum={beatmap.Hash}&filename={beatmap.Path}"; + + var req = base.CreateWebRequest(); + + return req; + } + + protected override string Target => $@"beatmaps/{lookupString}"; + } + + public class GetBeatmapDeatilsResponse : BeatmapMetrics + { + //the online API returns some metrics as a nested object. + [JsonProperty(@"failtimes")] + private BeatmapMetrics failTimes + { + set + { + this.Fails = value.Fails; + this.Retries = value.Retries; + } + } + + //and other metrics in the beatmap set. + [JsonProperty(@"beatmapset")] + private BeatmapMetrics beatmapSet + { + set + { + this.Ratings = value.Ratings; + } + } + } +} diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index 26ec74e299..cc22cca8bf 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -28,7 +28,7 @@ namespace osu.Game.Screens.Select { beatmap = value; Leaderboard.Beatmap = beatmap?.BeatmapInfo; - Details.Beatmap = beatmap?.Beatmap.BeatmapInfo; + Details.Beatmap = beatmap?.BeatmapInfo; } } diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 462f741dae..c5fb5eafaa 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -14,6 +14,10 @@ using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using System.Globalization; using System.Linq; +using osu.Game.Online.API; +using osu.Game.Online.API.Requests; +using osu.Framework.Threading; +using System; namespace osu.Game.Screens.Select { @@ -39,61 +43,101 @@ namespace osu.Game.Screens.Select private readonly BarGraph retryGraph; private readonly BarGraph failGraph; + private ScheduledDelegate pendingBeatmapSwitch; private BeatmapInfo beatmap; + public BeatmapInfo Beatmap { - get - { - return beatmap; - } + get { return beatmap; } set { beatmap = value; - if (beatmap == null) return; - - description.Text = beatmap.Version; - source.Text = beatmap.Metadata.Source; - tags.Text = beatmap.Metadata.Tags; - - circleSize.Value = beatmap.Difficulty.CircleSize; - drainRate.Value = beatmap.Difficulty.DrainRate; - overallDifficulty.Value = beatmap.Difficulty.OverallDifficulty; - approachRate.Value = beatmap.Difficulty.ApproachRate; - stars.Value = (float)beatmap.StarDifficulty; - - if (beatmap.Metrics?.Ratings.Any() ?? false) - { - var ratings = beatmap.Metrics.Ratings.ToList(); - ratingsContainer.Show(); - - negativeRatings.Text = ratings.GetRange(0, ratings.Count / 2).Sum().ToString(); - positiveRatings.Text = ratings.GetRange(ratings.Count / 2, ratings.Count / 2).Sum().ToString(); - ratingsBar.Length = (float)ratings.GetRange(0, ratings.Count / 2).Sum() / ratings.Sum(); - - ratingsGraph.Values = ratings.Select(rating => (float)rating); - } - else - ratingsContainer.Hide(); - - if ((beatmap.Metrics?.Retries.Any() ?? false) && beatmap.Metrics.Fails.Any()) - { - var retries = beatmap.Metrics.Retries; - var fails = beatmap.Metrics.Fails; - retryFailContainer.Show(); - - float maxValue = fails.Zip(retries, (fail, retry) => fail + retry).Max(); - failGraph.MaxValue = maxValue; - retryGraph.MaxValue = maxValue; - - failGraph.Values = fails.Select(fail => (float)fail); - retryGraph.Values = retries.Zip(fails, (retry, fail) => retry + MathHelper.Clamp(fail, 0, maxValue)); - } - else - retryFailContainer.Hide(); + pendingBeatmapSwitch?.Cancel(); + pendingBeatmapSwitch = Schedule(updateStats); } } + private void updateStats() + { + description.Text = beatmap.Version; + source.Text = beatmap.Metadata.Source; + tags.Text = beatmap.Metadata.Tags; + + circleSize.Value = beatmap.Difficulty.CircleSize; + drainRate.Value = beatmap.Difficulty.DrainRate; + overallDifficulty.Value = beatmap.Difficulty.OverallDifficulty; + approachRate.Value = beatmap.Difficulty.ApproachRate; + stars.Value = (float)beatmap.StarDifficulty; + + var requestedBeatmap = beatmap; + if (requestedBeatmap.Metrics == null) + { + var lookup = new GetBeatmapDeatilsRequest(requestedBeatmap); + lookup.Success += res => + { + if (beatmap != requestedBeatmap) + //the beatmap has been changed since we started the lookup. + return; + + requestedBeatmap.Metrics = res; + Schedule(() => updateMetrics(res, true)); + }; + lookup.Failure += e => updateMetrics(null, true); + + api.Queue(lookup); + } + + updateMetrics(requestedBeatmap.Metrics, false); + } + + private void updateMetrics(BeatmapMetrics metrics, bool failOnMissing = true) + { + var hasRatings = metrics?.Ratings.Any() ?? false; + var hasRetriesFails = (metrics?.Retries.Any() ?? false) && metrics.Fails.Any(); + + if (hasRatings) + { + var ratings = metrics.Ratings.ToList(); + ratingsContainer.Show(); + + negativeRatings.Text = ratings.GetRange(0, ratings.Count / 2).Sum().ToString(); + positiveRatings.Text = ratings.GetRange(ratings.Count / 2, ratings.Count / 2).Sum().ToString(); + ratingsBar.Length = (float)ratings.GetRange(0, ratings.Count / 2).Sum() / ratings.Sum(); + + ratingsGraph.Values = ratings.Select(rating => (float)rating); + + ratingsContainer.FadeColour(Color4.White, 500, EasingTypes.Out); + } + else if (failOnMissing) + ratingsGraph.Values = new float[10]; + else + ratingsContainer.FadeColour(Color4.Gray, 500, EasingTypes.Out); + + if (hasRetriesFails) + { + var retries = metrics.Retries; + var fails = metrics.Fails; + retryFailContainer.Show(); + + float maxValue = fails.Zip(retries, (fail, retry) => fail + retry).Max(); + failGraph.MaxValue = maxValue; + retryGraph.MaxValue = maxValue; + + failGraph.Values = fails.Select(fail => (float)fail); + retryGraph.Values = retries.Zip(fails, (retry, fail) => retry + MathHelper.Clamp(fail, 0, maxValue)); + + retryFailContainer.FadeColour(Color4.White, 500, EasingTypes.Out); + } + else if (failOnMissing) + { + failGraph.Values = new float[100]; + retryGraph.Values = new float[100]; + } + else + retryFailContainer.FadeColour(Color4.Gray, 500, EasingTypes.Out); + } + public BeatmapDetails() { Children = new Drawable[] @@ -272,9 +316,13 @@ namespace osu.Game.Screens.Select }; } + private APIAccess api; + [BackgroundDependencyLoader] - private void load(OsuColour colour) + private void load(OsuColour colour, APIAccess api) { + this.api = api; + description.AccentColour = colour.GrayB; source.AccentColour = colour.GrayB; tags.AccentColour = colour.YellowLight; diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index c9a3b08713..c32c5112cf 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -179,6 +179,7 @@ + From 6aa6e5eef7b85911c017f0d91e0b4591e8078e9b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 19:25:27 +0900 Subject: [PATCH 391/442] Store and restore the selected details tab at song select. --- osu.Game/Configuration/OsuConfigManager.cs | 4 ++++ .../Screens/Select/BeatmapDetailAreaTabControl.cs | 13 ++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index d47ed48e99..de3acf7a71 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -4,6 +4,7 @@ using System; using osu.Framework.Configuration; using osu.Framework.Platform; +using osu.Game.Screens.Select; namespace osu.Game.Configuration { @@ -34,6 +35,8 @@ namespace osu.Game.Configuration Set(OsuConfig.MenuParallax, true); + Set(OsuConfig.BeatmapDetailTab, BeatmapDetailTab.Details); + Set(OsuConfig.ShowInterface, true); Set(OsuConfig.KeyOverlay, false); //todo: implement all settings below this line (remove the Disabled set when doing so). @@ -316,6 +319,7 @@ namespace osu.Game.Configuration MenuMusic, MenuVoice, MenuParallax, + BeatmapDetailTab, RawInput, AbsoluteToOsuWindow, ConfineMouse, diff --git a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs index 48a46f0b90..51ec6f7707 100644 --- a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs +++ b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs @@ -4,10 +4,12 @@ using System; using OpenTK.Graphics; using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; @@ -21,15 +23,22 @@ namespace osu.Game.Screens.Select public Action OnFilter; //passed the selected tab and if mods is checked + private Bindable selectedTab; + private void invokeOnFilter() { OnFilter?.Invoke(tabs.Current, modsCheckbox.Current); } [BackgroundDependencyLoader] - private void load(OsuColour colour) + private void load(OsuColour colour, OsuConfigManager config) { modsCheckbox.AccentColour = tabs.AccentColour = colour.YellowLight; + + selectedTab = config.GetBindable(OsuConfig.BeatmapDetailTab); + + tabs.Current.BindTo(selectedTab); + tabs.Current.TriggerChange(); } public BeatmapDetailAreaTabControl() @@ -62,8 +71,6 @@ namespace osu.Game.Screens.Select tabs.Current.ValueChanged += item => invokeOnFilter(); modsCheckbox.Current.ValueChanged += item => invokeOnFilter(); - - tabs.Current.Value = BeatmapDetailTab.Global; } } From c55d406b44365cffad15212fc485b94c211774cf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 19:25:35 +0900 Subject: [PATCH 392/442] Fix nullref possibility. --- osu.Game/Screens/Select/BeatmapDetails.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index c5fb5eafaa..b337e14702 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -60,6 +60,8 @@ namespace osu.Game.Screens.Select private void updateStats() { + if (beatmap == null) return; + description.Text = beatmap.Version; source.Text = beatmap.Metadata.Source; tags.Text = beatmap.Metadata.Tags; From 8b048a6706266b2a67eb44d1a90579275f2c8460 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 19:33:48 +0900 Subject: [PATCH 393/442] Fix typo. --- osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs | 4 ++-- osu.Game/Screens/Select/BeatmapDetails.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs b/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs index a3b99331c6..512938fcf4 100644 --- a/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs +++ b/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs @@ -9,13 +9,13 @@ using osu.Game.Rulesets.Scoring; namespace osu.Game.Online.API.Requests { - public class GetBeatmapDeatilsRequest : APIRequest + public class GetBeatmapDetailsRequest : APIRequest { private readonly BeatmapInfo beatmap; private string lookupString; - public GetBeatmapDeatilsRequest(BeatmapInfo beatmap) + public GetBeatmapDetailsRequest(BeatmapInfo beatmap) { this.beatmap = beatmap; } diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index b337e14702..32e5f2505e 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -75,7 +75,7 @@ namespace osu.Game.Screens.Select var requestedBeatmap = beatmap; if (requestedBeatmap.Metrics == null) { - var lookup = new GetBeatmapDeatilsRequest(requestedBeatmap); + var lookup = new GetBeatmapDetailsRequest(requestedBeatmap); lookup.Success += res => { if (beatmap != requestedBeatmap) From 9670ea9a2aa4dc27e74be470c39fffd9856f0d86 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 20:16:31 +0900 Subject: [PATCH 394/442] CI fixes --- .../API/Requests/GetBeatmapDetailsRequest.cs | 22 ++++--------------- osu.Game/Screens/Select/BeatmapDetails.cs | 5 ++--- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs b/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs index 512938fcf4..593097f616 100644 --- a/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs +++ b/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs @@ -1,11 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Collections.Generic; using Newtonsoft.Json; using osu.Framework.IO.Network; using osu.Game.Database; -using osu.Game.Rulesets.Scoring; namespace osu.Game.Online.API.Requests { @@ -13,25 +11,13 @@ namespace osu.Game.Online.API.Requests { private readonly BeatmapInfo beatmap; - private string lookupString; + private string lookupString => beatmap.OnlineBeatmapID > 0 ? beatmap.OnlineBeatmapID.ToString() : $@"lookup?checksum={beatmap.Hash}&filename={beatmap.Path}"; public GetBeatmapDetailsRequest(BeatmapInfo beatmap) { this.beatmap = beatmap; } - protected override WebRequest CreateWebRequest() - { - if (beatmap.OnlineBeatmapID > 0) - lookupString = beatmap.OnlineBeatmapID.ToString(); - else - lookupString = $@"lookup?checksum={beatmap.Hash}&filename={beatmap.Path}"; - - var req = base.CreateWebRequest(); - - return req; - } - protected override string Target => $@"beatmaps/{lookupString}"; } @@ -43,8 +29,8 @@ namespace osu.Game.Online.API.Requests { set { - this.Fails = value.Fails; - this.Retries = value.Retries; + Fails = value.Fails; + Retries = value.Retries; } } @@ -54,7 +40,7 @@ namespace osu.Game.Online.API.Requests { set { - this.Ratings = value.Ratings; + Ratings = value.Ratings; } } } diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 32e5f2505e..d217fa66fe 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -17,7 +17,6 @@ using System.Linq; using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Framework.Threading; -using System; namespace osu.Game.Screens.Select { @@ -83,9 +82,9 @@ namespace osu.Game.Screens.Select return; requestedBeatmap.Metrics = res; - Schedule(() => updateMetrics(res, true)); + Schedule(() => updateMetrics(res)); }; - lookup.Failure += e => updateMetrics(null, true); + lookup.Failure += e => updateMetrics(null); api.Queue(lookup); } From d84f1f05e2d5faa86245e2343c3d9a3d12be471b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 20:16:53 +0900 Subject: [PATCH 395/442] Add better commenting for ambiguous parameter --- osu.Game/Screens/Select/BeatmapDetails.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index d217fa66fe..63fdfe3717 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -92,6 +92,11 @@ namespace osu.Game.Screens.Select updateMetrics(requestedBeatmap.Metrics, false); } + /// + /// Update displayed metrics. + /// + /// New metrics to overwrite the existing display. Can be null. + /// Whether to hide the display on null or empty metrics. If false, we will dim as if waiting for further updates. private void updateMetrics(BeatmapMetrics metrics, bool failOnMissing = true) { var hasRatings = metrics?.Ratings.Any() ?? false; From c7b789424be41f8ce225ee792662331c0d15bb5a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 20:11:36 +0900 Subject: [PATCH 396/442] Update BeatmapInfoWedge design - Adds colour difficulty strip. - Adjusts paddings. - Fixes source/artist confusion. - Double dash to em-dash. --- .../Drawables/DifficultyColouredContainer.cs | 69 +++++++++++++++++ osu.Game/Beatmaps/Drawables/DifficultyIcon.cs | 61 +++------------ osu.Game/Screens/Select/BeatmapInfoWedge.cs | 76 ++++++++++++++++--- osu.Game/osu.Game.csproj | 1 + 4 files changed, 144 insertions(+), 63 deletions(-) create mode 100644 osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs diff --git a/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs b/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs new file mode 100644 index 0000000000..7c0aa49d2a --- /dev/null +++ b/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs @@ -0,0 +1,69 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics.Containers; +using osu.Game.Database; +using osu.Game.Graphics; +using OpenTK.Graphics; + +namespace osu.Game.Beatmaps.Drawables +{ + internal class DifficultyColouredContainer : Container, IHasAccentColour + { + public Color4 AccentColour { get; set; } + + private readonly BeatmapInfo beatmap; + private OsuColour palette; + + public DifficultyColouredContainer(BeatmapInfo beatmap) + { + this.beatmap = beatmap; + } + + [BackgroundDependencyLoader] + private void load(OsuColour palette) + { + this.palette = palette; + AccentColour = getColour(beatmap); + } + + private enum DifficultyRating + { + Easy, + Normal, + Hard, + Insane, + Expert + } + + private DifficultyRating getDifficultyRating(BeatmapInfo beatmap) + { + var rating = beatmap.StarDifficulty; + + if (rating < 1.5) return DifficultyRating.Easy; + if (rating < 2.25) return DifficultyRating.Normal; + if (rating < 3.75) return DifficultyRating.Hard; + if (rating < 5.25) return DifficultyRating.Insane; + return DifficultyRating.Expert; + } + + private Color4 getColour(BeatmapInfo beatmap) + { + switch (getDifficultyRating(beatmap)) + { + case DifficultyRating.Easy: + return palette.Green; + default: + case DifficultyRating.Normal: + return palette.Yellow; + case DifficultyRating.Hard: + return palette.Pink; + case DifficultyRating.Insane: + return palette.Purple; + case DifficultyRating.Expert: + return palette.Gray0; + } + } + } +} diff --git a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs index 8a9183819c..6b8b267894 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs @@ -3,31 +3,28 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Game.Database; using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; +using System; namespace osu.Game.Beatmaps.Drawables { - internal class DifficultyIcon : Container - { - private readonly BeatmapInfo beatmap; - private OsuColour palette; - public DifficultyIcon(BeatmapInfo beatmap) + internal class DifficultyIcon : DifficultyColouredContainer + { + private BeatmapInfo beatmap; + + public DifficultyIcon(BeatmapInfo beatmap) : base(beatmap) { this.beatmap = beatmap; - const float size = 20; - Size = new Vector2(size); + Size = new Vector2(20); } [BackgroundDependencyLoader] - private void load(OsuColour palette) + private void load(OsuColour colours) { - this.palette = palette; - Children = new[] { new TextAwesome @@ -35,7 +32,7 @@ namespace osu.Game.Beatmaps.Drawables Anchor = Anchor.Centre, Origin = Anchor.Centre, TextSize = Size.X, - Colour = getColour(beatmap), + Colour = AccentColour, Icon = FontAwesome.fa_circle }, new TextAwesome @@ -48,43 +45,5 @@ namespace osu.Game.Beatmaps.Drawables } }; } - - private enum DifficultyRating - { - Easy, - Normal, - Hard, - Insane, - Expert - } - - private DifficultyRating getDifficultyRating(BeatmapInfo beatmap) - { - var rating = beatmap.StarDifficulty; - - if (rating < 1.5) return DifficultyRating.Easy; - if (rating < 2.25) return DifficultyRating.Normal; - if (rating < 3.75) return DifficultyRating.Hard; - if (rating < 5.25) return DifficultyRating.Insane; - return DifficultyRating.Expert; - } - - private Color4 getColour(BeatmapInfo beatmap) - { - switch (getDifficultyRating(beatmap)) - { - case DifficultyRating.Easy: - return palette.Green; - default: - case DifficultyRating.Normal: - return palette.Yellow; - case DifficultyRating.Hard: - return palette.Pink; - case DifficultyRating.Insane: - return palette.Purple; - case DifficultyRating.Expert: - return palette.Gray0; - } - } } -} \ No newline at end of file +} diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index a87d5f58a1..60e6221907 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Linq; using OpenTK; using OpenTK.Graphics; +using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; @@ -148,11 +149,16 @@ namespace osu.Game.Screens.Select }, }, }, - // Text for beatmap info + new DifficultyColourBar(beatmap.BeatmapInfo) + { + RelativeSizeAxes = Axes.Y, + Width = 20, + }, new FillFlowContainer { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, + Name = "Top-aligned metadata", + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, Direction = FillDirection.Vertical, Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 20 }, AutoSizeAxes = Axes.Both, @@ -161,16 +167,32 @@ namespace osu.Game.Screens.Select new OsuSpriteText { Font = @"Exo2.0-MediumItalic", - Text = metadata.Artist + " -- " + metadata.Title, + Text = beatmapInfo.Version, + TextSize = 24, + }, + } + }, + new FillFlowContainer + { + Name = "Bottom-aligned metadata", + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Direction = FillDirection.Vertical, + Margin = new MarginPadding { Top = 15, Left = 25, Right = 10, Bottom = 20 }, + AutoSizeAxes = Axes.Both, + Children = new Drawable[] + { + new OsuSpriteText + { + Font = @"Exo2.0-MediumItalic", + Text = !string.IsNullOrEmpty(metadata.Source) ? metadata.Source + " — " + metadata.Title : metadata.Title, TextSize = 28, - Shadow = true, }, new OsuSpriteText { Font = @"Exo2.0-MediumItalic", - Text = beatmapInfo.Version, + Text = metadata.Artist, TextSize = 17, - Shadow = true, }, new FillFlowContainer { @@ -184,20 +206,18 @@ namespace osu.Game.Screens.Select Font = @"Exo2.0-Medium", Text = "mapped by ", TextSize = 15, - Shadow = true, - }, + }, new OsuSpriteText { Font = @"Exo2.0-Bold", Text = metadata.Author, TextSize = 15, - Shadow = true, - }, + }, } }, new FillFlowContainer { - Margin = new MarginPadding { Top = 20 }, + Margin = new MarginPadding { Top = 20, Left = 10 }, Spacing = new Vector2(40, 0), AutoSizeAxes = Axes.Both, Children = labels @@ -256,5 +276,37 @@ namespace osu.Game.Screens.Select }; } } + + private class DifficultyColourBar : DifficultyColouredContainer + { + public DifficultyColourBar(BeatmapInfo beatmap) : base(beatmap) + { + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + const float full_opacity_ratio = 0.7f; + + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = AccentColour, + Width = full_opacity_ratio, + }, + new Box + { + RelativeSizeAxes = Axes.Both, + RelativePositionAxes = Axes.Both, + Colour = AccentColour, + Alpha = 0.5f, + X = full_opacity_ratio, + Width = 1 - full_opacity_ratio, + } + }; + } + } } } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index c9a3b08713..25df354aea 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -187,6 +187,7 @@ + From 9ecfb4e4bff99cb5af32447ff0a74650e5fd4344 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 20:22:04 +0900 Subject: [PATCH 397/442] Last CI fix. --- osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs b/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs index 593097f616..43e14e59de 100644 --- a/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs +++ b/osu.Game/Online/API/Requests/GetBeatmapDetailsRequest.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using Newtonsoft.Json; -using osu.Framework.IO.Network; using osu.Game.Database; namespace osu.Game.Online.API.Requests From 915ff7cba5a7c3f2b8a9b1d2eb3ee3cef1fc021d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 10:04:32 +0900 Subject: [PATCH 398/442] Add parallel compile flag. --- .vscode/tasks.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 6918afa620..a745d96a9f 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -12,7 +12,8 @@ "args": [ // Ask msbuild to generate full paths for file names. "/property:GenerateFullPaths=true", - "/property:DebugType=portable" + "/property:DebugType=portable", + "/m" ], // Use the standard MS compiler pattern to detect errors, warnings and infos "problemMatcher": "$msCompile", @@ -27,7 +28,8 @@ // Ask msbuild to generate full paths for file names. "/property:GenerateFullPaths=true", "/property:DebugType=portable", - "/target:Clean,Build" + "/target:Clean,Build", + "/m" ], // Use the standard MS compiler pattern to detect errors, warnings and infos "problemMatcher": "$msCompile", From 3c981703304b09fd29516d785fd7e33f286ce5c3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 13:45:18 +0900 Subject: [PATCH 399/442] Use method group for MusicController fault. --- osu.Game/Overlays/MusicController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 19e742facb..f960d9e0ae 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -294,7 +294,7 @@ namespace osu.Game.Overlays trackManager.SetExclusive(current.Track); current.Track.Start(); beatmapSource.Value = current; - }).ContinueWith(task => Schedule(() => task.ThrowIfFaulted()), TaskContinuationOptions.OnlyOnFaulted); + }).ContinueWith(task => Schedule(task.ThrowIfFaulted), TaskContinuationOptions.OnlyOnFaulted); updateDisplay(current, isNext ? TransformDirection.Next : TransformDirection.Prev); } From 2d6fa711d1689ec67ef93ee6d763344596462797 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 13:45:35 +0900 Subject: [PATCH 400/442] Remove unnecessary base.Update() in PlayerInputManager. --- osu.Game/Screens/Play/PlayerInputManager.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Screens/Play/PlayerInputManager.cs b/osu.Game/Screens/Play/PlayerInputManager.cs index 6604dbfc7e..3ac28898a6 100644 --- a/osu.Game/Screens/Play/PlayerInputManager.cs +++ b/osu.Game/Screens/Play/PlayerInputManager.cs @@ -38,8 +38,6 @@ namespace osu.Game.Screens.Play protected override void Update() { - base.Update(); - if (parentClock == null) return; clock.Rate = parentClock.Rate; From 43d09a97346465582be14dcf740df83cfb3dc8ee Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 20:31:25 +0900 Subject: [PATCH 401/442] CI fixes --- osu.Game/Beatmaps/Drawables/DifficultyIcon.cs | 5 ++--- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs index 6b8b267894..a8b63c2502 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs @@ -7,14 +7,13 @@ using osu.Game.Database; using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; -using System; namespace osu.Game.Beatmaps.Drawables { internal class DifficultyIcon : DifficultyColouredContainer { - private BeatmapInfo beatmap; + private readonly BeatmapInfo beatmap; public DifficultyIcon(BeatmapInfo beatmap) : base(beatmap) { @@ -23,7 +22,7 @@ namespace osu.Game.Beatmaps.Drawables } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load() { Children = new[] { diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 60e6221907..646d468bd0 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -284,7 +284,7 @@ namespace osu.Game.Screens.Select } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load() { const float full_opacity_ratio = 0.7f; From b8bf942860ad2aeb881a44af58a96f6b23aa2288 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 24 Apr 2017 22:11:38 +0900 Subject: [PATCH 402/442] Don't use parallel compiling on non-windows platforms. This currently triggers a unhandled exception in msbuild. --- .vscode/tasks.json | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index a745d96a9f..5eaeaa9899 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -10,11 +10,16 @@ "showOutput": "silent", "command": "msbuild", "args": [ - // Ask msbuild to generate full paths for file names. "/property:GenerateFullPaths=true", - "/property:DebugType=portable", - "/m" + "/property:DebugType=portable" ], + "windows": { + "args": [ + "/property:GenerateFullPaths=true", + "/property:DebugType=portable", + "/m" //parallel compiling support. doesn't work well with mono atm + ] + }, // Use the standard MS compiler pattern to detect errors, warnings and infos "problemMatcher": "$msCompile", "isBuildCommand": true @@ -28,9 +33,16 @@ // Ask msbuild to generate full paths for file names. "/property:GenerateFullPaths=true", "/property:DebugType=portable", - "/target:Clean,Build", - "/m" + "/target:Clean,Build" ], + "windows": { + "args": [ + "/property:GenerateFullPaths=true", + "/property:DebugType=portable", + "/target:Clean,Build", + "/m" //parallel compiling support. doesn't work well with mono atm + ] + }, // Use the standard MS compiler pattern to detect errors, warnings and infos "problemMatcher": "$msCompile", "isBuildCommand": true From a6ea6738e59599df76bc24c2015d29931408e5cf Mon Sep 17 00:00:00 2001 From: Jorolf Date: Mon, 24 Apr 2017 17:10:00 +0200 Subject: [PATCH 403/442] add some spaces after commas --- osu.Game/Overlays/Options/OptionSlider.cs | 2 +- osu.Game/Overlays/Options/Sections/Audio/OffsetOptions.cs | 2 +- .../Overlays/Options/Sections/Gameplay/SongSelectOptions.cs | 4 ++-- osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs | 2 +- osu.Game/Overlays/Options/Sections/SkinSection.cs | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/Options/OptionSlider.cs b/osu.Game/Overlays/Options/OptionSlider.cs index 6084a7de80..42bf4170fa 100644 --- a/osu.Game/Overlays/Options/OptionSlider.cs +++ b/osu.Game/Overlays/Options/OptionSlider.cs @@ -16,7 +16,7 @@ namespace osu.Game.Overlays.Options { } - public class OptionSlider : FillFlowContainer where T : struct where U : SliderBar, new() + public class OptionSlider : FillFlowContainer where T : struct where U : SliderBar, new() { private readonly SliderBar slider; private readonly SpriteText text; diff --git a/osu.Game/Overlays/Options/Sections/Audio/OffsetOptions.cs b/osu.Game/Overlays/Options/Sections/Audio/OffsetOptions.cs index 78c9688c93..72c3dd071a 100644 --- a/osu.Game/Overlays/Options/Sections/Audio/OffsetOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Audio/OffsetOptions.cs @@ -17,7 +17,7 @@ namespace osu.Game.Overlays.Options.Sections.Audio { Children = new Drawable[] { - new OptionSlider + new OptionSlider { LabelText = "Audio Offset", Bindable = config.GetBindable(OsuConfig.AudioOffset) diff --git a/osu.Game/Overlays/Options/Sections/Gameplay/SongSelectOptions.cs b/osu.Game/Overlays/Options/Sections/Gameplay/SongSelectOptions.cs index 3b8ec9329b..910eae9a5a 100644 --- a/osu.Game/Overlays/Options/Sections/Gameplay/SongSelectOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Gameplay/SongSelectOptions.cs @@ -17,12 +17,12 @@ namespace osu.Game.Overlays.Options.Sections.Gameplay { Children = new Drawable[] { - new OptionSlider + new OptionSlider { LabelText = "Display beatmaps from", Bindable = config.GetBindable(OsuConfig.DisplayStarsMinimum) }, - new OptionSlider + new OptionSlider { LabelText = "up to", Bindable = config.GetBindable(OsuConfig.DisplayStarsMaximum) diff --git a/osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs b/osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs index 7b34a371d6..4a48c9ec86 100644 --- a/osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Input/MouseOptions.cs @@ -17,7 +17,7 @@ namespace osu.Game.Overlays.Options.Sections.Input { Children = new Drawable[] { - new OptionSlider + new OptionSlider { LabelText = "Sensitivity", Bindable = config.GetBindable(OsuConfig.MouseSpeed) diff --git a/osu.Game/Overlays/Options/Sections/SkinSection.cs b/osu.Game/Overlays/Options/Sections/SkinSection.cs index 82ccf740d0..0e533928a8 100644 --- a/osu.Game/Overlays/Options/Sections/SkinSection.cs +++ b/osu.Game/Overlays/Options/Sections/SkinSection.cs @@ -58,12 +58,12 @@ namespace osu.Game.Overlays.Options.Sections LabelText = "Always use skin cursor", Bindable = config.GetBindable(OsuConfig.UseSkinCursor) }, - new OptionSlider + new OptionSlider { LabelText = "Menu cursor size", Bindable = config.GetBindable(OsuConfig.MenuCursorSize) }, - new OptionSlider + new OptionSlider { LabelText = "Gameplay cursor size", Bindable = config.GetBindable(OsuConfig.GameplayCursorSize) From f329587bd43e078907abe47d05de165b0557024a Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 25 Apr 2017 08:02:09 +0900 Subject: [PATCH 404/442] Fix mismatched braces. --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 646d468bd0..61c1f0cc33 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -206,13 +206,13 @@ namespace osu.Game.Screens.Select Font = @"Exo2.0-Medium", Text = "mapped by ", TextSize = 15, - }, + }, new OsuSpriteText { Font = @"Exo2.0-Bold", Text = metadata.Author, TextSize = 15, - }, + }, } }, new FillFlowContainer From b80fa74f47e334ba6bb7c3de7e7540dcb0e03d35 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Apr 2017 11:11:57 +0900 Subject: [PATCH 405/442] Update README. --- README.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 885c7c7722..3306c9ab25 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,4 @@ -# osu! [![Build status](https://ci.appveyor.com/api/projects/status/u2p01nx7l6og8buh?svg=true)](https://ci.appveyor.com/project/peppy/osu) - - +# osu! [![Build status](https://ci.appveyor.com/api/projects/status/u2p01nx7l6og8buh?svg=true)](https://ci.appveyor.com/project/peppy/osu) [![CodeFactor](https://www.codefactor.io/repository/github/ppy/osu/badge)](https://www.codefactor.io/repository/github/ppy/osu) [osu! on the web](https://osu.ppy.sh) | [dev chat](https://discord.gg/ppy) @@ -12,14 +10,14 @@ This is still heavily under development and is not intended for end-user use. Th # Requirements -- A desktop platform which can compile .NET 4.5. -- Visual Studio or MonoDevelop is recommended. +- A desktop platform which can compile .NET 4.5 (tested on macOS, linux and windows). We recommend using [Visual Studio Code](https://code.visualstudio.com/) (all platforms) or [Visual Studio Community Edition](https://www.visualstudio.com/) (windows only), both of which are free. +- Make sure you initialise and keep submodules up-to-date. # Contributing We welcome all contributions, but keep in mind that we already have a lot of the UI designed. If you wish to work on something with the intention on having it included in the official distribution, please open an issue for discussion and we will give you what you need from a design perspective to proceed. If you want to make *changes* to the design, we recommend you open an issue with your intentions before spending too much time, to ensure no effort is wasted. -Contributions can be made via pull requests to this repository. We hope to credit and reward larger contributions via a [bounty system](https://goo.gl/nFdoyI). If you're unsure of what you can help with, check out the [list](https://github.com/ppy/osu/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+label%3Abounty) of available issues with bounty. +Contributions can be made via pull requests to this repository. We hope to credit and reward larger contributions via a [bounty system](https://www.bountysource.com/teams/ppy). If you're unsure of what you can help with, check out the [list of open issues](https://github.com/ppy/osu-framework/issues). Note that while we already have certain standards in place, nothing is set in stone. If you have an issue with the way code is structured; with any libraries we are using; with any processes involved with contributing, *please* bring it up. I welcome all feedback so we can make contributing to this project as pain-free as possible. From 1df50adc3a0314c6cb67a808d6161bcb7583d6de Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Mon, 24 Apr 2017 22:48:25 -0500 Subject: [PATCH 406/442] Post-merge fixes (and CodeFactor fixes) --- osu.Game/Configuration/OsuConfigManager.cs | 9 +++++---- osu.Game/Screens/Menu/Intro.cs | 5 ++--- osu.Game/Screens/Menu/MainMenu.cs | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index de3acf7a71..c4765fb05c 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -35,12 +35,15 @@ namespace osu.Game.Configuration Set(OsuConfig.MenuParallax, true); + Set(OsuConfig.MenuVoice, true); + Set(OsuConfig.MenuMusic, true); + Set(OsuConfig.BeatmapDetailTab, BeatmapDetailTab.Details); Set(OsuConfig.ShowInterface, true); Set(OsuConfig.KeyOverlay, false); - //todo: implement all settings below this line (remove the Disabled set when doing so). + //todo: implement all settings below this line (remove the Disabled set when doing so). Set(OsuConfig.AudioOffset, 0, -500.0, 500.0); Set(OsuConfig.MouseSpeed, 1.0).Disabled = true; @@ -178,8 +181,7 @@ namespace osu.Game.Configuration Set(OsuConfig.CanForceOptimusCompatibility, true).Disabled = true; Set(OsuConfig.ConfineMouse, Get(OsuConfig.ConfineMouseToFullscreen) ? ConfineMouseMode.Fullscreen : ConfineMouseMode.Never).Disabled = true; - - + GetOriginalBindable(OsuConfig.SavePassword).ValueChanged += delegate { if (Get(OsuConfig.SavePassword)) Set(OsuConfig.SaveUsername, true); @@ -344,6 +346,5 @@ namespace osu.Game.Configuration Ticker, CompatibilityContext, CanForceOptimusCompatibility, - } } diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index f9b95dd7eb..92032e5120 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -72,19 +72,18 @@ namespace osu.Game.Screens.Menu welcome = audio.Sample.Get(@"welcome"); seeya = audio.Sample.Get(@"seeya"); - } protected override void OnEntering(Screen last) { base.OnEntering(last); - if(menuVoice) + if (menuVoice) welcome.Play(); Scheduler.AddDelayed(delegate { - if(menuMusic) + if (menuMusic) bgm.Start(); LoadComponentAsync(mainMenu = new MainMenu()); diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index b2bb1ff29c..32d7835694 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -106,7 +106,7 @@ namespace osu.Game.Screens.Menu { base.OnEntering(last); buttons.FadeInFromZero(500); - if(last is Intro && song != null) + if (last is Intro && song != null) Task.Run(() => { trackManager.SetExclusive(song.Track); From 51c577624bbaf27d114a5ed0b57b058329ca4a60 Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Mon, 24 Apr 2017 22:59:33 -0500 Subject: [PATCH 407/442] Remove BeatmapInfo field --- osu.Game/Configuration/OsuConfigManager.cs | 4 +--- osu.Game/Screens/Menu/MainMenu.cs | 8 +++----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index c4765fb05c..f0279aa2de 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -151,8 +151,6 @@ namespace osu.Game.Configuration Set(OsuConfig.YahooIntegration, false).Disabled = true; Set(OsuConfig.ForceFrameFlush, false).Disabled = true; Set(OsuConfig.DetectPerformanceIssues, true).Disabled = true; - Set(OsuConfig.MenuMusic, true).Disabled = true; - Set(OsuConfig.MenuVoice, true).Disabled = true; Set(OsuConfig.RawInput, false).Disabled = true; Set(OsuConfig.AbsoluteToOsuWindow, Get(OsuConfig.RawInput)).Disabled = true; Set(OsuConfig.ShowMenuTips, true).Disabled = true; @@ -181,7 +179,7 @@ namespace osu.Game.Configuration Set(OsuConfig.CanForceOptimusCompatibility, true).Disabled = true; Set(OsuConfig.ConfineMouse, Get(OsuConfig.ConfineMouseToFullscreen) ? ConfineMouseMode.Fullscreen : ConfineMouseMode.Never).Disabled = true; - + GetOriginalBindable(OsuConfig.SavePassword).ValueChanged += delegate { if (Get(OsuConfig.SavePassword)) Set(OsuConfig.SaveUsername, true); diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 32d7835694..6c393d7498 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -63,7 +63,6 @@ namespace osu.Game.Screens.Menu private Bindable menuMusic; private TrackManager trackManager; - private BeatmapInfo beatmap; private WorkingBeatmap song; [BackgroundDependencyLoader] @@ -78,8 +77,7 @@ namespace osu.Game.Screens.Menu int choosableBeatmapsetAmmount = beatmaps.Query().Count(); if (choosableBeatmapsetAmmount > 0) { - beatmap = beatmaps.GetWithChildren(RNG.Next(1, choosableBeatmapsetAmmount)).Beatmaps[0]; - song = beatmaps.GetWorkingBeatmap(beatmap); + song = beatmaps.GetWorkingBeatmap(beatmaps.GetWithChildren(RNG.Next(1, choosableBeatmapsetAmmount)).Beatmaps[0]); Beatmap = song; } } @@ -110,8 +108,8 @@ namespace osu.Game.Screens.Menu Task.Run(() => { trackManager.SetExclusive(song.Track); - song.Track.Seek(beatmap.Metadata.PreviewTime); - if (beatmap.Metadata.PreviewTime == -1) + song.Track.Seek(song.Beatmap.Metadata.PreviewTime); + if (song.Beatmap.Metadata.PreviewTime == -1) song.Track.Seek(song.Track.Length * .4f); song.Track.Start(); }); From f93adebc52f933ebed8e3ee102d7f29f2f8c1884 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Apr 2017 13:33:34 +0900 Subject: [PATCH 408/442] Minor style fixes. --- osu.Game/Screens/Menu/MainMenu.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 6c393d7498..dc4ec92ee2 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -105,14 +105,16 @@ namespace osu.Game.Screens.Menu base.OnEntering(last); buttons.FadeInFromZero(500); if (last is Intro && song != null) + { Task.Run(() => { trackManager.SetExclusive(song.Track); song.Track.Seek(song.Beatmap.Metadata.PreviewTime); if (song.Beatmap.Metadata.PreviewTime == -1) - song.Track.Seek(song.Track.Length * .4f); + song.Track.Seek(song.Track.Length * 0.4f); song.Track.Start(); }); + } } protected override void OnSuspending(Screen next) From aa534ead7dd5f530541da01bc9a72f54a012302e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Apr 2017 20:52:26 +0900 Subject: [PATCH 409/442] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 9204b83850..cc50d1251b 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 9204b838504a51ffe7577c103b91270a2687bfb8 +Subproject commit cc50d1251b00876331691ea2ce7ed18174e4eded From eb5d3348386cfdcaa9a2b32ea97cff8e63fe2300 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Apr 2017 19:07:07 +0900 Subject: [PATCH 410/442] Add non-toggle support for showing seek bar in SongProgress. --- .../Tests/TestCaseSongProgress.cs | 4 ++-- osu.Game/Screens/Play/SongProgress.cs | 22 ++++++++++++++----- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs index 7c40d21512..6d8aac1d09 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs @@ -38,9 +38,9 @@ namespace osu.Desktop.VisualTests.Tests Origin = Anchor.TopLeft, }); - AddStep("Toggle Bar", progress.ToggleBar); + AddStep("Toggle Bar", () => progress.AllowSeeking = !progress.AllowSeeking); AddWaitStep(5); - AddStep("Toggle Bar", progress.ToggleBar); + AddStep("Toggle Bar", () => progress.AllowSeeking = !progress.AllowSeeking); AddWaitStep(2); AddRepeatStep("New Values", displayNewValues, 5); diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 6ad76ae361..c3e3751a67 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -86,18 +86,28 @@ namespace osu.Game.Screens.Play State = Visibility.Visible; } - private bool barVisible; + private bool allowSeeking; - public void ToggleBar() + public bool AllowSeeking { - barVisible = !barVisible; - updateBarVisibility(); + get + { + return allowSeeking; + } + + set + { + if (allowSeeking == value) return; + + allowSeeking = value; + updateBarVisibility(); + } } private void updateBarVisibility() { - bar.FadeTo(barVisible ? 1 : 0, transition_duration, EasingTypes.In); - MoveTo(new Vector2(0, barVisible ? 0 : bottom_bar_height), transition_duration, EasingTypes.In); + bar.FadeTo(allowSeeking ? 1 : 0, transition_duration, EasingTypes.In); + MoveTo(new Vector2(0, allowSeeking ? 0 : bottom_bar_height), transition_duration, EasingTypes.In); } protected override void PopIn() From d4764824931e7e383f3025568fa861d034c57a0d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Apr 2017 19:07:38 +0900 Subject: [PATCH 411/442] Add basic seeking support when a replay is loaded. --- osu.Game/Screens/Play/Player.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 2668c61eee..47c120f363 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -156,6 +156,11 @@ namespace osu.Game.Screens.Play hudOverlay.Progress.Objects = HitRenderer.Objects; hudOverlay.Progress.AudioClock = interpolatedSourceClock; + hudOverlay.Progress.AllowSeeking = HitRenderer.HasReplayLoaded; + hudOverlay.Progress.OnSeek = progress => + { + sourceClock.Seek(progress * track.Length); + }; //bind HitRenderer to ScoreProcessor and ourselves (for a pass situation) HitRenderer.OnAllJudged += onCompletion; From e003d9fc3cad84a0c7cb41b4d7d046483d3b26e6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Apr 2017 19:09:30 +0900 Subject: [PATCH 412/442] Add basic replay frame accurate "seeking". Previously we were looping over Update, when we should instead have been looping over UpdateSubTree. --- osu.Game/Rulesets/UI/HitRenderer.cs | 2 +- osu.Game/Screens/Play/PlayerInputManager.cs | 54 ++++++++++++++++----- 2 files changed, 43 insertions(+), 13 deletions(-) diff --git a/osu.Game/Rulesets/UI/HitRenderer.cs b/osu.Game/Rulesets/UI/HitRenderer.cs index a3a806b6a7..25d8bae205 100644 --- a/osu.Game/Rulesets/UI/HitRenderer.cs +++ b/osu.Game/Rulesets/UI/HitRenderer.cs @@ -116,7 +116,7 @@ namespace osu.Game.Rulesets.UI where TObject : HitObject { /// - /// The Beatmap + /// The Beatmap /// public Beatmap Beatmap; diff --git a/osu.Game/Screens/Play/PlayerInputManager.cs b/osu.Game/Screens/Play/PlayerInputManager.cs index 3ac28898a6..c6853b3007 100644 --- a/osu.Game/Screens/Play/PlayerInputManager.cs +++ b/osu.Game/Screens/Play/PlayerInputManager.cs @@ -36,6 +36,38 @@ namespace osu.Game.Screens.Play Clock = new FramedClock(clock); } + /// + /// Whether we running up-to-date with our parent clock. + /// If not, we will need to keep processing children until we catch up. + /// + private bool requireMoreUpdateLoops; + + /// + /// Whether we in a valid state (ie. should we keep processing children frames). + /// This should be set to false when the replay is, for instance, waiting for future frames to arrive. + /// + private bool validState; + + protected override bool RequiresChildrenUpdate => base.RequiresChildrenUpdate && validState; + + private bool isAttached => replayInputHandler != null && !UseParentState; + + private const int max_catch_up_updates_per_frame = 50; + + public override bool UpdateSubTree() + { + requireMoreUpdateLoops = true; + validState = true; + + int loops = 0; + + while (validState && requireMoreUpdateLoops && loops++ < 50) + if (!base.UpdateSubTree()) + return false; + + return true; + } + protected override void Update() { if (parentClock == null) return; @@ -43,28 +75,26 @@ namespace osu.Game.Screens.Play clock.Rate = parentClock.Rate; clock.IsRunning = parentClock.IsRunning; - //if a replayHandler is not attached, we should just pass-through. - if (UseParentState || replayInputHandler == null) + if (!isAttached) { clock.CurrentTime = parentClock.CurrentTime; - base.Update(); - return; } - - while (true) + else { double? newTime = replayInputHandler.SetFrameFromTime(parentClock.CurrentTime); if (newTime == null) - //we shouldn't execute for this time value - break; - - if (clock.CurrentTime == parentClock.CurrentTime) - break; + { + // we shouldn't execute for this time value. probably waiting on more replay data. + validState = false; + return; + } clock.CurrentTime = newTime.Value; - base.Update(); } + + requireMoreUpdateLoops = clock.CurrentTime != parentClock.CurrentTime; + base.Update(); } } } From ac5f70b7658e26a36b58dca036d6cad1779f4d95 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 26 Apr 2017 13:48:18 +0900 Subject: [PATCH 413/442] Fix drum roll conversion not generating strong hits. --- osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 1278549f1a..3bbe349c77 100644 --- a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -114,6 +114,7 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps { List currentSamples = allSamples[i]; bool isRim = currentSamples.Any(s => s.Name == SampleInfo.HIT_CLAP || s.Name == SampleInfo.HIT_WHISTLE); + strong = currentSamples.Any(s => s.Name == SampleInfo.HIT_FINISH); if (isRim) { From 28f7e0cdba97e80c882e4d7f11921ef0835117a6 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 26 Apr 2017 14:12:21 +0900 Subject: [PATCH 414/442] Introduce SampleInfoList as List to reduce generic nesting. Fix CI warnings. --- osu.Game.Rulesets.Osu/Objects/Slider.cs | 6 +++--- .../Beatmaps/TaikoBeatmapConverter.cs | 10 +++------- osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs | 4 ++-- osu.Game/Audio/SampleInfoList.cs | 19 +++++++++++++++++++ osu.Game/Rulesets/Objects/HitObject.cs | 2 +- .../Legacy/Catch/ConvertHitObjectParser.cs | 2 +- .../Objects/Legacy/ConvertHitObjectParser.cs | 8 ++++---- .../Rulesets/Objects/Legacy/ConvertSlider.cs | 2 +- .../Legacy/Mania/ConvertHitObjectParser.cs | 2 +- .../Legacy/Osu/ConvertHitObjectParser.cs | 2 +- .../Legacy/Taiko/ConvertHitObjectParser.cs | 2 +- .../Rulesets/Objects/Types/IHasRepeats.cs | 2 +- osu.Game/osu.Game.csproj | 1 + 13 files changed, 39 insertions(+), 23 deletions(-) create mode 100644 osu.Game/Audio/SampleInfoList.cs diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index 4d9d3f97ed..6c0147a3de 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -45,7 +45,7 @@ namespace osu.Game.Rulesets.Osu.Objects set { Curve.Distance = value; } } - public List> RepeatSamples { get; set; } = new List>(); + public List RepeatSamples { get; set; } = new List(); public int RepeatCount { get; set; } = 1; private int stackHeight; @@ -117,12 +117,12 @@ namespace osu.Game.Rulesets.Osu.Objects StackHeight = StackHeight, Scale = Scale, ComboColour = ComboColour, - Samples = Samples.Select(s => new SampleInfo + Samples = new SampleInfoList(Samples.Select(s => new SampleInfo { Bank = s.Bank, Name = @"slidertick", Volume = s.Volume - }).ToList() + })) }; } } diff --git a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 3bbe349c77..0784c94059 100644 --- a/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Rulesets.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -69,7 +69,7 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps var curveData = obj as IHasCurve; // Old osu! used hit sounding to determine various hit type information - List samples = obj.Samples; + SampleInfoList samples = obj.Samples; bool strong = samples.Any(s => s.Name == SampleInfo.HIT_FINISH); @@ -103,16 +103,12 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps if (tickSpacing > 0 && osuDuration < 2 * speedAdjustedBeatLength) { - List> allSamples; - if (curveData != null) - allSamples = curveData.RepeatSamples; - else - allSamples = new List> { samples }; + List allSamples = curveData != null ? curveData.RepeatSamples : new List(new[] { samples }); int i = 0; for (double j = obj.StartTime; j <= obj.StartTime + taikoDuration + tickSpacing / 8; j += tickSpacing) { - List currentSamples = allSamples[i]; + SampleInfoList currentSamples = allSamples[i]; bool isRim = currentSamples.Any(s => s.Name == SampleInfo.HIT_CLAP || s.Name == SampleInfo.HIT_WHISTLE); strong = currentSamples.Any(s => s.Name == SampleInfo.HIT_FINISH); diff --git a/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs b/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs index 4f89fb8248..f79c01b643 100644 --- a/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Rulesets.Taiko/Objects/DrumRoll.cs @@ -82,12 +82,12 @@ namespace osu.Game.Rulesets.Taiko.Objects TickSpacing = tickSpacing, StartTime = t, IsStrong = IsStrong, - Samples = Samples.Select(s => new SampleInfo + Samples = new SampleInfoList(Samples.Select(s => new SampleInfo { Bank = s.Bank, Name = @"slidertick", Volume = s.Volume - }).ToList() + })) }); first = false; diff --git a/osu.Game/Audio/SampleInfoList.cs b/osu.Game/Audio/SampleInfoList.cs new file mode 100644 index 0000000000..75d2d1d23f --- /dev/null +++ b/osu.Game/Audio/SampleInfoList.cs @@ -0,0 +1,19 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; + +namespace osu.Game.Audio +{ + public class SampleInfoList : List + { + public SampleInfoList() + { + } + + public SampleInfoList(IEnumerable elements) + { + AddRange(elements); + } + } +} \ No newline at end of file diff --git a/osu.Game/Rulesets/Objects/HitObject.cs b/osu.Game/Rulesets/Objects/HitObject.cs index 12e4ca6df1..edbdc27365 100644 --- a/osu.Game/Rulesets/Objects/HitObject.cs +++ b/osu.Game/Rulesets/Objects/HitObject.cs @@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Objects /// and can be treated as the default samples for the hit object. /// /// - public List Samples = new List(); + public SampleInfoList Samples = new SampleInfoList(); /// /// Applies default values to this HitObject. diff --git a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs index 1550772f8e..5c534456ef 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertHitObjectParser.cs @@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List repeatSamples) { return new ConvertSlider { diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index ad028e0cee..c5551082ec 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -123,7 +123,7 @@ namespace osu.Game.Rulesets.Objects.Legacy } // Generate the final per-node samples - var nodeSamples = new List>(nodes); + var nodeSamples = new List(nodes); for (int i = 0; i <= repeatCount; i++) nodeSamples.Add(convertSoundType(nodeSoundTypes[i], nodeBankInfos[i])); @@ -204,7 +204,7 @@ namespace osu.Game.Rulesets.Objects.Legacy /// The slider repeat count. /// The samples to be played when the repeat nodes are hit. This includes the head and tail of the slider. /// The hit object. - protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples); + protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List repeatSamples); /// /// Creates a legacy Spinner-type hit object. @@ -214,9 +214,9 @@ namespace osu.Game.Rulesets.Objects.Legacy /// The hit object. protected abstract HitObject CreateSpinner(Vector2 position, double endTime); - private List convertSoundType(LegacySoundType type, SampleBankInfo bankInfo) + private SampleInfoList convertSoundType(LegacySoundType type, SampleBankInfo bankInfo) { - var soundTypes = new List + var soundTypes = new SampleInfoList { new SampleInfo { diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs index 06391a9906..7580404e81 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertSlider.cs @@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.Objects.Legacy public CurveType CurveType { get; set; } public double Distance { get; set; } - public List> RepeatSamples { get; set; } + public List RepeatSamples { get; set; } public int RepeatCount { get; set; } = 1; public double EndTime { get; set; } diff --git a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs index b21857797f..224f068323 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Mania/ConvertHitObjectParser.cs @@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List repeatSamples) { return new ConvertSlider { diff --git a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs index e45a161f52..41bf142831 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Osu/ConvertHitObjectParser.cs @@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List repeatSamples) { return new ConvertSlider { diff --git a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs index 2de2f217d1..0d755d7527 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Taiko/ConvertHitObjectParser.cs @@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko }; } - protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List> repeatSamples) + protected override HitObject CreateSlider(Vector2 position, bool newCombo, List controlPoints, double length, CurveType curveType, int repeatCount, List repeatSamples) { return new ConvertSlider { diff --git a/osu.Game/Rulesets/Objects/Types/IHasRepeats.cs b/osu.Game/Rulesets/Objects/Types/IHasRepeats.cs index 2fe2424d49..5abad2d661 100644 --- a/osu.Game/Rulesets/Objects/Types/IHasRepeats.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasRepeats.cs @@ -19,6 +19,6 @@ namespace osu.Game.Rulesets.Objects.Types /// /// The samples to be played when each repeat node is hit (0 -> first repeat node, 1 -> second repeat node, etc). /// - List> RepeatSamples { get; } + List RepeatSamples { get; } } } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index cc9fe00cdc..cb491055c4 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -71,6 +71,7 @@ + From 4c2985b6d129c74dcdb4b19f17dad449ddf09c9f Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 26 Apr 2017 14:40:40 +0900 Subject: [PATCH 415/442] Use CRLF instead of LF. --- osu.Game/Audio/SampleInfoList.cs | 36 ++++++++++++++++---------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/osu.Game/Audio/SampleInfoList.cs b/osu.Game/Audio/SampleInfoList.cs index 75d2d1d23f..594341bbb1 100644 --- a/osu.Game/Audio/SampleInfoList.cs +++ b/osu.Game/Audio/SampleInfoList.cs @@ -1,19 +1,19 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System.Collections.Generic; - -namespace osu.Game.Audio -{ - public class SampleInfoList : List - { - public SampleInfoList() - { - } - - public SampleInfoList(IEnumerable elements) - { - AddRange(elements); - } - } +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; + +namespace osu.Game.Audio +{ + public class SampleInfoList : List + { + public SampleInfoList() + { + } + + public SampleInfoList(IEnumerable elements) + { + AddRange(elements); + } + } } \ No newline at end of file From 22be765323edf11307b0734724e540409f82aa32 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 26 Apr 2017 14:45:30 +0900 Subject: [PATCH 416/442] Update HitObject.cs --- osu.Game/Rulesets/Objects/HitObject.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Rulesets/Objects/HitObject.cs b/osu.Game/Rulesets/Objects/HitObject.cs index edbdc27365..46fb5fcf70 100644 --- a/osu.Game/Rulesets/Objects/HitObject.cs +++ b/osu.Game/Rulesets/Objects/HitObject.cs @@ -5,7 +5,6 @@ using osu.Game.Audio; using osu.Game.Beatmaps.Timing; using osu.Game.Database; using osu.Game.Rulesets.Objects.Types; -using System.Collections.Generic; namespace osu.Game.Rulesets.Objects { From d9dec9d444dd666e1a618bc31a2ec2db899948c6 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 26 Apr 2017 15:50:08 +0900 Subject: [PATCH 417/442] Implement Taiko difficulty calculation. --- .../Objects/TaikoHitObjectDifficulty.cs | 127 ++++++++++++++++++ .../TaikoDifficultyCalculator.cs | 121 ++++++++++++++++- .../osu.Game.Rulesets.Taiko.csproj | 1 + osu.Game/Beatmaps/DifficultyCalculator.cs | 4 + 4 files changed, 250 insertions(+), 3 deletions(-) create mode 100644 osu.Game.Rulesets.Taiko/Objects/TaikoHitObjectDifficulty.cs diff --git a/osu.Game.Rulesets.Taiko/Objects/TaikoHitObjectDifficulty.cs b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObjectDifficulty.cs new file mode 100644 index 0000000000..5056a52346 --- /dev/null +++ b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObjectDifficulty.cs @@ -0,0 +1,127 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; + +namespace osu.Game.Rulesets.Taiko.Objects +{ + internal class TaikoHitObjectDifficulty + { + /// + /// Factor by how much individual / overall strain decays per second. + /// + /// + /// These values are results of tweaking a lot and taking into account general feedback. + /// + internal const double DECAY_BASE = 0.30; + + private const double type_change_bonus = 0.75; + private const double rhythm_change_bonus = 1.0; + private const double rhythm_change_base_threshold = 0.2; + private const double rhythm_change_base = 2.0; + + internal TaikoHitObject BaseHitObject; + + /// + /// Measures note density in a way + /// + internal double Strain = 1; + + private double timeElapsed = 0; + private int sameTypeSince = 1; + + private bool isRim => BaseHitObject is RimHit; + + public TaikoHitObjectDifficulty(TaikoHitObject baseHitObject) + { + this.BaseHitObject = baseHitObject; + } + + internal void CalculateStrains(TaikoHitObjectDifficulty previousHitObject, double timeRate) + { + // Rather simple, but more specialized things are inherently inaccurate due to the big difference playstyles and opinions make. + // See Taiko feedback thread. + timeElapsed = (BaseHitObject.StartTime - previousHitObject.BaseHitObject.StartTime) / timeRate; + double decay = Math.Pow(DECAY_BASE, timeElapsed / 1000); + + double addition = 1; + + // Only if we are no slider or spinner we get an extra addition + if (previousHitObject.BaseHitObject is Hit && BaseHitObject is Hit + && BaseHitObject.StartTime - previousHitObject.BaseHitObject.StartTime < 1000) // And we only want to check out hitobjects which aren't so far in the past + { + addition += typeChangeAddition(previousHitObject); + addition += rhythmChangeAddition(previousHitObject); + } + + double additionFactor = 1.0; + // Scale AdditionFactor linearly from 0.4 to 1 for TimeElapsed from 0 to 50 + if (timeElapsed < 50.0) + additionFactor = 0.4 + 0.6 * timeElapsed / 50.0; + + Strain = previousHitObject.Strain * decay + addition * additionFactor; + } + + private TypeSwitch lastTypeSwitchEven = TypeSwitch.None; + private double typeChangeAddition(TaikoHitObjectDifficulty previousHitObject) + { + // If we don't have the same hit type, trigger a type change! + if (previousHitObject.isRim != isRim) + { + lastTypeSwitchEven = previousHitObject.sameTypeSince % 2 == 0 ? TypeSwitch.Even : TypeSwitch.Odd; + + // We only want a bonus if the parity of the type switch changes! + switch (previousHitObject.lastTypeSwitchEven) + { + case TypeSwitch.Even: + if (lastTypeSwitchEven == TypeSwitch.Odd) + return type_change_bonus; + break; + case TypeSwitch.Odd: + if (lastTypeSwitchEven == TypeSwitch.Even) + return type_change_bonus; + break; + } + } + // No type change? Increment counter and keep track of last type switch + else + { + lastTypeSwitchEven = previousHitObject.lastTypeSwitchEven; + sameTypeSince = previousHitObject.sameTypeSince + 1; + } + + return 0; + } + + private double rhythmChangeAddition(TaikoHitObjectDifficulty previousHitObject) + { + // We don't want a division by zero if some random mapper decides to put 2 HitObjects at the same time. + if (timeElapsed == 0 || previousHitObject.timeElapsed == 0) + return 0; + + double timeElapsedRatio = Math.Max(previousHitObject.timeElapsed / timeElapsed, timeElapsed / previousHitObject.timeElapsed); + + if (timeElapsedRatio >= 8) + return 0; + + double difference = Math.Log(timeElapsedRatio, rhythm_change_base) % 1.0; + + if (isWithinChangeThreshold(difference)) + return rhythm_change_bonus; + + return 0; + } + + private bool isWithinChangeThreshold(double value) + { + return value > rhythm_change_base_threshold && value < 1 - rhythm_change_base_threshold; + } + + private enum TypeSwitch + { + None, + Even, + Odd + } + } +} \ No newline at end of file diff --git a/osu.Game.Rulesets.Taiko/TaikoDifficultyCalculator.cs b/osu.Game.Rulesets.Taiko/TaikoDifficultyCalculator.cs index cd61709db8..f80c777f05 100644 --- a/osu.Game.Rulesets.Taiko/TaikoDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Taiko/TaikoDifficultyCalculator.cs @@ -6,18 +6,133 @@ using osu.Game.Rulesets.Beatmaps; using osu.Game.Rulesets.Taiko.Beatmaps; using osu.Game.Rulesets.Taiko.Objects; using System.Collections.Generic; +using System.Globalization; +using System; namespace osu.Game.Rulesets.Taiko { - public class TaikoDifficultyCalculator : DifficultyCalculator + internal class TaikoDifficultyCalculator : DifficultyCalculator { - public TaikoDifficultyCalculator(Beatmap beatmap) : base(beatmap) + private const double star_scaling_factor = 0.04125; + + /// + /// In milliseconds. For difficulty calculation we will only look at the highest strain value in each time interval of size STRAIN_STEP. + /// This is to eliminate higher influence of stream over aim by simply having more HitObjects with high strain. + /// The higher this value, the less strains there will be, indirectly giving long beatmaps an advantage. + /// + private const double strain_step = 400; + + /// + /// The weighting of each strain value decays to this number * it's previous value + /// + private const double decay_weight = 0.9; + + /// + /// HitObjects are stored as a member variable. + /// + private List difficultyHitObjects = new List(); + + public TaikoDifficultyCalculator(Beatmap beatmap) + : base(beatmap) { } protected override double CalculateInternal(Dictionary categoryDifficulty) { - return 0; + // Fill our custom DifficultyHitObject class, that carries additional information + difficultyHitObjects.Clear(); + + foreach (var hitObject in Objects) + difficultyHitObjects.Add(new TaikoHitObjectDifficulty(hitObject)); + + // Sort DifficultyHitObjects by StartTime of the HitObjects - just to make sure. + difficultyHitObjects.Sort((a, b) => a.BaseHitObject.StartTime.CompareTo(b.BaseHitObject.StartTime)); + + if (!calculateStrainValues()) return 0; + + double starRating = calculateDifficulty() * star_scaling_factor; + + if (categoryDifficulty != null) + { + categoryDifficulty.Add("Strain", starRating.ToString("0.00", CultureInfo.InvariantCulture)); + categoryDifficulty.Add("Hit window 300", (35 /*HitObjectManager.HitWindow300*/ / TimeRate).ToString("0.00", CultureInfo.InvariantCulture)); + } + + return starRating; + } + + private bool calculateStrainValues() + { + // Traverse hitObjects in pairs to calculate the strain value of NextHitObject from the strain value of CurrentHitObject and environment. + List.Enumerator hitObjectsEnumerator = difficultyHitObjects.GetEnumerator(); + + if (!hitObjectsEnumerator.MoveNext()) return false; + + TaikoHitObjectDifficulty currentHitObject = hitObjectsEnumerator.Current; + TaikoHitObjectDifficulty nextHitObject; + + // First hitObject starts at strain 1. 1 is the default for strain values, so we don't need to set it here. See DifficultyHitObject. + while (hitObjectsEnumerator.MoveNext()) + { + nextHitObject = hitObjectsEnumerator.Current; + nextHitObject.CalculateStrains(currentHitObject, TimeRate); + currentHitObject = nextHitObject; + } + + return true; + } + + private double calculateDifficulty() + { + double actualStrainStep = strain_step * TimeRate; + + // Find the highest strain value within each strain step + List highestStrains = new List(); + double intervalEndTime = actualStrainStep; + double maximumStrain = 0; // We need to keep track of the maximum strain in the current interval + + TaikoHitObjectDifficulty previousHitObject = null; + foreach (var hitObject in difficultyHitObjects) + { + // While we are beyond the current interval push the currently available maximum to our strain list + while (hitObject.BaseHitObject.StartTime > intervalEndTime) + { + highestStrains.Add(maximumStrain); + + // The maximum strain of the next interval is not zero by default! We need to take the last hitObject we encountered, take its strain and apply the decay + // until the beginning of the next interval. + if (previousHitObject == null) + { + maximumStrain = 0; + } + else + { + double decay = Math.Pow(TaikoHitObjectDifficulty.DECAY_BASE, (intervalEndTime - previousHitObject.BaseHitObject.StartTime) / 1000); + maximumStrain = previousHitObject.Strain * decay; + } + + // Go to the next time interval + intervalEndTime += actualStrainStep; + } + + // Obtain maximum strain + maximumStrain = Math.Max(hitObject.Strain, maximumStrain); + + previousHitObject = hitObject; + } + + // Build the weighted sum over the highest strains for each interval + double difficulty = 0; + double weight = 1; + highestStrains.Sort((a, b) => b.CompareTo(a)); // Sort from highest to lowest strain. + + foreach (double strain in highestStrains) + { + difficulty += weight * strain; + weight *= decay_weight; + } + + return difficulty; } protected override BeatmapConverter CreateBeatmapConverter() => new TaikoBeatmapConverter(); diff --git a/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj index c668b90ec4..f890e32f90 100644 --- a/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj +++ b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj @@ -81,6 +81,7 @@ + diff --git a/osu.Game/Beatmaps/DifficultyCalculator.cs b/osu.Game/Beatmaps/DifficultyCalculator.cs index 727c89049f..8e9266b644 100644 --- a/osu.Game/Beatmaps/DifficultyCalculator.cs +++ b/osu.Game/Beatmaps/DifficultyCalculator.cs @@ -35,6 +35,10 @@ namespace osu.Game.Beatmaps protected DifficultyCalculator(Beatmap beatmap) { Objects = CreateBeatmapConverter().Convert(beatmap).HitObjects; + + foreach (var h in Objects) + h.ApplyDefaults(beatmap.TimingInfo, beatmap.BeatmapInfo.Difficulty); + PreprocessHitObjects(); } From 8df3c3f736df7bc1b34a2ecfd1efdf06f7a1b6af Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 26 Apr 2017 16:28:53 +0900 Subject: [PATCH 418/442] Adjust Swell hit speed. --- osu.Game.Rulesets.Taiko/Replays/TaikoAutoReplay.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Replays/TaikoAutoReplay.cs b/osu.Game.Rulesets.Taiko/Replays/TaikoAutoReplay.cs index df862a5cb0..d78e8af589 100644 --- a/osu.Game.Rulesets.Taiko/Replays/TaikoAutoReplay.cs +++ b/osu.Game.Rulesets.Taiko/Replays/TaikoAutoReplay.cs @@ -11,6 +11,8 @@ namespace osu.Game.Rulesets.Taiko.Replays { public class TaikoAutoReplay : Replay { + private const double swell_hit_speed = 50; + private readonly Beatmap beatmap; public TaikoAutoReplay(Beatmap beatmap) @@ -45,12 +47,13 @@ namespace osu.Game.Rulesets.Taiko.Replays int d = 0; int count = 0; int req = swell.RequiredHits; - double hitRate = swell.Duration / req; + double hitRate = Math.Min(swell_hit_speed, swell.Duration / req); for (double j = h.StartTime; j < endTime; j += hitRate) { switch (d) { default: + case 0: button = ReplayButtonState.Left1; break; case 1: @@ -66,7 +69,7 @@ namespace osu.Game.Rulesets.Taiko.Replays Frames.Add(new ReplayFrame(j, null, null, button)); d = (d + 1) % 4; - if (++count > req) + if (++count == req) break; } } From 47cd91fa633ffdb468218fa5a2b7339e8cad2f4a Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 26 Apr 2017 17:04:57 +0900 Subject: [PATCH 419/442] CI fixes. --- .../Objects/TaikoHitObjectDifficulty.cs | 4 +-- .../TaikoDifficultyCalculator.cs | 30 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/TaikoHitObjectDifficulty.cs b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObjectDifficulty.cs index 5056a52346..c8bb73abbb 100644 --- a/osu.Game.Rulesets.Taiko/Objects/TaikoHitObjectDifficulty.cs +++ b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObjectDifficulty.cs @@ -27,14 +27,14 @@ namespace osu.Game.Rulesets.Taiko.Objects /// internal double Strain = 1; - private double timeElapsed = 0; + private double timeElapsed; private int sameTypeSince = 1; private bool isRim => BaseHitObject is RimHit; public TaikoHitObjectDifficulty(TaikoHitObject baseHitObject) { - this.BaseHitObject = baseHitObject; + BaseHitObject = baseHitObject; } internal void CalculateStrains(TaikoHitObjectDifficulty previousHitObject, double timeRate) diff --git a/osu.Game.Rulesets.Taiko/TaikoDifficultyCalculator.cs b/osu.Game.Rulesets.Taiko/TaikoDifficultyCalculator.cs index f80c777f05..33e9510f1c 100644 --- a/osu.Game.Rulesets.Taiko/TaikoDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Taiko/TaikoDifficultyCalculator.cs @@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Taiko /// /// HitObjects are stored as a member variable. /// - private List difficultyHitObjects = new List(); + private readonly List difficultyHitObjects = new List(); public TaikoDifficultyCalculator(Beatmap beatmap) : base(beatmap) @@ -64,22 +64,22 @@ namespace osu.Game.Rulesets.Taiko private bool calculateStrainValues() { // Traverse hitObjects in pairs to calculate the strain value of NextHitObject from the strain value of CurrentHitObject and environment. - List.Enumerator hitObjectsEnumerator = difficultyHitObjects.GetEnumerator(); - - if (!hitObjectsEnumerator.MoveNext()) return false; - - TaikoHitObjectDifficulty currentHitObject = hitObjectsEnumerator.Current; - TaikoHitObjectDifficulty nextHitObject; - - // First hitObject starts at strain 1. 1 is the default for strain values, so we don't need to set it here. See DifficultyHitObject. - while (hitObjectsEnumerator.MoveNext()) + using (List.Enumerator hitObjectsEnumerator = difficultyHitObjects.GetEnumerator()) { - nextHitObject = hitObjectsEnumerator.Current; - nextHitObject.CalculateStrains(currentHitObject, TimeRate); - currentHitObject = nextHitObject; - } + if (!hitObjectsEnumerator.MoveNext()) return false; - return true; + TaikoHitObjectDifficulty current = hitObjectsEnumerator.Current; + + // First hitObject starts at strain 1. 1 is the default for strain values, so we don't need to set it here. See DifficultyHitObject. + while (hitObjectsEnumerator.MoveNext()) + { + var next = hitObjectsEnumerator.Current; + next?.CalculateStrains(current, TimeRate); + current = next; + } + + return true; + } } private double calculateDifficulty() From 01caaf44f373f62fafe26cfdb63f6db1fd88d79e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 26 Apr 2017 18:16:55 +0900 Subject: [PATCH 420/442] Add a decoupled clock to allow for lead-in and lead-out time. --- osu.Game/Screens/Play/Player.cs | 44 +++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 47c120f363..ac9337b802 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -38,7 +38,7 @@ namespace osu.Game.Screens.Play public Action RestartRequested; - public bool IsPaused => !interpolatedSourceClock.IsRunning; + public bool IsPaused => !decoupledClock.IsRunning; internal override bool AllowRulesetChange => false; @@ -51,9 +51,9 @@ namespace osu.Game.Screens.Play private bool canPause => ValidForResume && !HasFailed && Time.Current >= lastPauseActionTime + pause_cooldown; - private IAdjustableClock sourceClock; - private OffsetClock offsetClock; - private IFrameBasedClock interpolatedSourceClock; + private IAdjustableClock adjustableSourceClock; + private FramedOffsetClock offsetClock; + private DecoupleableInterpolatingFramedClock decoupledClock; private RulesetInfo ruleset; @@ -123,23 +123,31 @@ namespace osu.Game.Screens.Play if (track != null) { audio.Track.SetExclusive(track); - sourceClock = track; + adjustableSourceClock = track; } - sourceClock = (IAdjustableClock)track ?? new StopwatchClock(); - offsetClock = new OffsetClock(sourceClock); + adjustableSourceClock = (IAdjustableClock)track ?? new StopwatchClock(); + + decoupledClock = new DecoupleableInterpolatingFramedClock(); + decoupledClock.ChangeSource(adjustableSourceClock); + decoupledClock.IsCoupled = false; + + offsetClock = new FramedOffsetClock(decoupledClock); userAudioOffset = config.GetBindable(OsuConfig.AudioOffset); userAudioOffset.ValueChanged += v => offsetClock.Offset = v; userAudioOffset.TriggerChange(); - interpolatedSourceClock = new InterpolatingFramedClock(offsetClock); - Schedule(() => { - sourceClock.Reset(); + adjustableSourceClock.Reset(); + + var firstObjectTime = HitRenderer.Objects.First().StartTime; + + decoupledClock.Seek(Math.Min(0, firstObjectTime - Math.Max(Beatmap.Beatmap.TimingInfo.BeatLengthAt(firstObjectTime) * 2, Beatmap.BeatmapInfo.AudioLeadIn))); + foreach (var mod in Beatmap.Mods.Value.OfType()) - mod.ApplyToClock(sourceClock); + mod.ApplyToClock(adjustableSourceClock); }); scoreProcessor = HitRenderer.CreateScoreProcessor(); @@ -155,7 +163,7 @@ namespace osu.Game.Screens.Play hudOverlay.BindHitRenderer(HitRenderer); hudOverlay.Progress.Objects = HitRenderer.Objects; - hudOverlay.Progress.AudioClock = interpolatedSourceClock; + hudOverlay.Progress.AudioClock = decoupledClock; hudOverlay.Progress.AllowSeeking = HitRenderer.HasReplayLoaded; hudOverlay.Progress.OnSeek = progress => { @@ -173,7 +181,7 @@ namespace osu.Game.Screens.Play new Container { RelativeSizeAxes = Axes.Both, - Clock = interpolatedSourceClock, + Clock = offsetClock, Children = new Drawable[] { HitRenderer, @@ -229,7 +237,7 @@ namespace osu.Game.Screens.Play skipButton.Action = () => { - sourceClock.Seek(firstHitObject - skip_required_cutoff - fade_time); + decoupledClock.Seek(firstHitObject - skip_required_cutoff - fade_time); skipButton.Action = null; }; @@ -246,7 +254,7 @@ namespace osu.Game.Screens.Play // we want to wait for the source clock to stop so we can be sure all components are in a stable state. if (!IsPaused) { - sourceClock.Stop(); + decoupledClock.Stop(); Schedule(() => Pause(force)); return; @@ -273,7 +281,7 @@ namespace osu.Game.Screens.Play hudOverlay.KeyCounter.IsCounting = true; hudOverlay.Progress.Hide(); pauseOverlay.Hide(); - sourceClock.Start(); + decoupledClock.Start(); } public void Restart() @@ -309,7 +317,7 @@ namespace osu.Game.Screens.Play private void onFail() { - sourceClock.Stop(); + decoupledClock.Stop(); HasFailed = true; failOverlay.Retries = RestartCount; @@ -337,7 +345,7 @@ namespace osu.Game.Screens.Play Delay(750); Schedule(() => { - sourceClock.Start(); + decoupledClock.Start(); initializeSkipButton(); }); From 9d14b6e1e942394ed20f54ae084ba869d599f3c5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 26 Apr 2017 18:17:17 +0900 Subject: [PATCH 421/442] Make SongProgress return the actual time value via OnSeek. --- osu.Game/Screens/Play/Player.cs | 4 ++-- osu.Game/Screens/Play/SongProgress.cs | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index ac9337b802..90918cc93d 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -165,9 +165,9 @@ namespace osu.Game.Screens.Play hudOverlay.Progress.Objects = HitRenderer.Objects; hudOverlay.Progress.AudioClock = decoupledClock; hudOverlay.Progress.AllowSeeking = HitRenderer.HasReplayLoaded; - hudOverlay.Progress.OnSeek = progress => + hudOverlay.Progress.OnSeek = pos => { - sourceClock.Seek(progress * track.Length); + decoupledClock.Seek(pos); }; //bind HitRenderer to ScoreProcessor and ourselves (for a pass situation) diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index c3e3751a67..ed57dad644 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -35,6 +35,8 @@ namespace osu.Game.Screens.Play private double lastHitTime => ((objects.Last() as IHasEndTime)?.EndTime ?? objects.Last().StartTime) + 1; + private double firstHitTime => objects.First().StartTime; + private IEnumerable objects; public IEnumerable Objects @@ -75,7 +77,7 @@ namespace osu.Game.Screens.Play Origin = Anchor.BottomLeft, SeekRequested = delegate (float position) { - OnSeek?.Invoke(position); + OnSeek?.Invoke(firstHitTime + position * (lastHitTime - firstHitTime)); }, }, }; @@ -128,7 +130,7 @@ namespace osu.Game.Screens.Play if (objects == null) return; - double progress = (AudioClock?.CurrentTime ?? Time.Current) / lastHitTime; + double progress = ((AudioClock?.CurrentTime ?? Time.Current) - firstHitTime) / lastHitTime; bar.UpdatePosition((float)progress); graph.Progress = (int)(graph.ColumnCount * progress); From 4656a7170a91e6879efb03f95fb553800b0d1bb5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 26 Apr 2017 18:07:22 +0900 Subject: [PATCH 422/442] Add very basic lead-in support. --- osu.Game/Screens/Play/Player.cs | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 90918cc93d..853a50d855 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -70,6 +70,8 @@ namespace osu.Game.Screens.Play private SkipButton skipButton; + private Container hitRendererContainer; + private HudOverlay hudOverlay; private PauseOverlay pauseOverlay; private FailOverlay failOverlay; @@ -129,9 +131,12 @@ namespace osu.Game.Screens.Play adjustableSourceClock = (IAdjustableClock)track ?? new StopwatchClock(); decoupledClock = new DecoupleableInterpolatingFramedClock(); - decoupledClock.ChangeSource(adjustableSourceClock); decoupledClock.IsCoupled = false; + var firstObjectTime = HitRenderer.Objects.First().StartTime; + decoupledClock.Seek(Math.Min(0, firstObjectTime - Math.Max(Beatmap.Beatmap.TimingInfo.BeatLengthAt(firstObjectTime) * 4, Beatmap.BeatmapInfo.AudioLeadIn))); + decoupledClock.ProcessFrame(); + offsetClock = new FramedOffsetClock(decoupledClock); userAudioOffset = config.GetBindable(OsuConfig.AudioOffset); @@ -142,12 +147,10 @@ namespace osu.Game.Screens.Play { adjustableSourceClock.Reset(); - var firstObjectTime = HitRenderer.Objects.First().StartTime; - - decoupledClock.Seek(Math.Min(0, firstObjectTime - Math.Max(Beatmap.Beatmap.TimingInfo.BeatLengthAt(firstObjectTime) * 2, Beatmap.BeatmapInfo.AudioLeadIn))); - foreach (var mod in Beatmap.Mods.Value.OfType()) mod.ApplyToClock(adjustableSourceClock); + + decoupledClock.ChangeSource(adjustableSourceClock); }); scoreProcessor = HitRenderer.CreateScoreProcessor(); @@ -178,16 +181,20 @@ namespace osu.Game.Screens.Play Children = new Drawable[] { - new Container + hitRendererContainer = new Container { RelativeSizeAxes = Axes.Both, - Clock = offsetClock, Children = new Drawable[] { - HitRenderer, - skipButton = new SkipButton + new Container { - Alpha = 0 + RelativeSizeAxes = Axes.Both, + Clock = offsetClock, + Children = new Drawable[] + { + HitRenderer, + skipButton = new SkipButton { Alpha = 0 }, + } }, } }, @@ -350,8 +357,8 @@ namespace osu.Game.Screens.Play }); //keep in mind this is using the interpolatedSourceClock so won't be run as early as we may expect. - HitRenderer.Alpha = 0; - HitRenderer.FadeIn(750, EasingTypes.OutQuint); + hitRendererContainer.Alpha = 0; + hitRendererContainer.FadeIn(750, EasingTypes.OutQuint); } protected override void OnSuspending(Screen next) From 867c16665b02729cdd3e769e3fece3f823dfd544 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 26 Apr 2017 18:22:09 +0900 Subject: [PATCH 423/442] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index cc50d1251b..0374f02617 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit cc50d1251b00876331691ea2ce7ed18174e4eded +Subproject commit 0374f026179a3509caa7944ef1efbc318e092d2a From b6f838f536948347e051801dda2755cba896c1b2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 26 Apr 2017 18:32:40 +0900 Subject: [PATCH 424/442] Fix potential nullref. --- osu.Game/Screens/Play/Player.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 853a50d855..dcb90846d9 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -89,12 +89,12 @@ namespace osu.Game.Screens.Play if (Beatmap == null) Beatmap = beatmaps.GetWorkingBeatmap(BeatmapInfo, withStoryboard: true); - if ((Beatmap?.Beatmap?.HitObjects.Count ?? 0) == 0) - throw new Exception("No valid objects were found!"); - - if (Beatmap == null) + if (Beatmap?.Beatmap == null) throw new Exception("Beatmap was not loaded"); + if (Beatmap?.Beatmap?.HitObjects.Count == 0) + throw new Exception("No valid objects were found!"); + ruleset = osu?.Ruleset.Value ?? Beatmap.BeatmapInfo.Ruleset; rulesetInstance = ruleset.CreateInstance(); From c2108b7706fe85bf922774d387e61e4b21770291 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 26 Apr 2017 18:32:47 +0900 Subject: [PATCH 425/442] Use object initialiser. --- osu.Game/Screens/Play/Player.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index dcb90846d9..7d001d16bf 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -130,8 +130,7 @@ namespace osu.Game.Screens.Play adjustableSourceClock = (IAdjustableClock)track ?? new StopwatchClock(); - decoupledClock = new DecoupleableInterpolatingFramedClock(); - decoupledClock.IsCoupled = false; + decoupledClock = new DecoupleableInterpolatingFramedClock { IsCoupled = false }; var firstObjectTime = HitRenderer.Objects.First().StartTime; decoupledClock.Seek(Math.Min(0, firstObjectTime - Math.Max(Beatmap.Beatmap.TimingInfo.BeatLengthAt(firstObjectTime) * 4, Beatmap.BeatmapInfo.AudioLeadIn))); From f48d497737a324fb187680592485e4b5031c3326 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 26 Apr 2017 18:56:20 +0900 Subject: [PATCH 426/442] Fix disabling mouse buttons causing auto to stop working. --- .../OsuKeyConversionInputManager.cs | 16 ---------- osu.Game/Screens/Play/PlayerInputManager.cs | 31 +++++++++++++++++++ 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/osu.Game.Rulesets.Osu/OsuKeyConversionInputManager.cs b/osu.Game.Rulesets.Osu/OsuKeyConversionInputManager.cs index e71f15cd65..d60aab90fb 100644 --- a/osu.Game.Rulesets.Osu/OsuKeyConversionInputManager.cs +++ b/osu.Game.Rulesets.Osu/OsuKeyConversionInputManager.cs @@ -2,10 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Linq; -using osu.Framework.Allocation; -using osu.Framework.Configuration; using osu.Framework.Input; -using osu.Game.Configuration; using osu.Game.Screens.Play; using OpenTK.Input; using KeyboardState = osu.Framework.Input.KeyboardState; @@ -17,13 +14,6 @@ namespace osu.Game.Rulesets.Osu { private bool leftViaKeyboard; private bool rightViaKeyboard; - private Bindable mouseDisabled; - - [BackgroundDependencyLoader] - private void load(OsuConfigManager config) - { - mouseDisabled = config.GetBindable(OsuConfig.MouseDisableButtons); - } protected override void TransformState(InputState state) { @@ -40,12 +30,6 @@ namespace osu.Game.Rulesets.Osu if (mouse != null) { - if (mouseDisabled.Value) - { - mouse.SetPressed(MouseButton.Left, false); - mouse.SetPressed(MouseButton.Right, false); - } - if (leftViaKeyboard) mouse.SetPressed(MouseButton.Left, true); if (rightViaKeyboard) diff --git a/osu.Game/Screens/Play/PlayerInputManager.cs b/osu.Game/Screens/Play/PlayerInputManager.cs index 3ac28898a6..180c15e30b 100644 --- a/osu.Game/Screens/Play/PlayerInputManager.cs +++ b/osu.Game/Screens/Play/PlayerInputManager.cs @@ -1,8 +1,12 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using OpenTK.Input; +using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Input; using osu.Framework.Timing; +using osu.Game.Configuration; using osu.Game.Input.Handlers; namespace osu.Game.Screens.Play @@ -28,6 +32,14 @@ namespace osu.Game.Screens.Play } } + private Bindable mouseDisabled; + + [BackgroundDependencyLoader] + private void load(OsuConfigManager config) + { + mouseDisabled = config.GetBindable(OsuConfig.MouseDisableButtons); + } + protected override void LoadComplete() { base.LoadComplete(); @@ -66,5 +78,24 @@ namespace osu.Game.Screens.Play base.Update(); } } + + protected override void TransformState(InputState state) + { + base.TransformState(state); + + // we don't want to transform the state if a replay is present (for now, at least). + if (replayInputHandler != null) return; + + var mouse = state.Mouse as Framework.Input.MouseState; + + if (mouse != null) + { + if (mouseDisabled.Value) + { + mouse.SetPressed(MouseButton.Left, false); + mouse.SetPressed(MouseButton.Right, false); + } + } + } } } From e826f17eb03c2b301704616b286760c1c11e3e87 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 26 Apr 2017 19:25:41 +0900 Subject: [PATCH 427/442] Fix get-set mismatch. --- osu.Game/Screens/Play/PlayerInputManager.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/PlayerInputManager.cs b/osu.Game/Screens/Play/PlayerInputManager.cs index 180c15e30b..a31cf6e288 100644 --- a/osu.Game/Screens/Play/PlayerInputManager.cs +++ b/osu.Game/Screens/Play/PlayerInputManager.cs @@ -19,7 +19,10 @@ namespace osu.Game.Screens.Play private ReplayInputHandler replayInputHandler; public ReplayInputHandler ReplayInputHandler { - get { return replayInputHandler; } + get + { + return replayInputHandler; + } set { if (replayInputHandler != null) RemoveHandler(replayInputHandler); From bd71b236990c0f3aa43a618bbd6f6b62654c3502 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 26 Apr 2017 19:52:51 +0900 Subject: [PATCH 428/442] Update framework again. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 0374f02617..dcbd7a0b6f 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 0374f026179a3509caa7944ef1efbc318e092d2a +Subproject commit dcbd7a0b6f536f6aadf13a720db40a1d76bf52e2 From 08b1d5beb9f33be940163550ff8266338e5941ac Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 26 Apr 2017 20:15:34 +0900 Subject: [PATCH 429/442] Use const where it was inteded. --- osu.Game/Screens/Play/PlayerInputManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/PlayerInputManager.cs b/osu.Game/Screens/Play/PlayerInputManager.cs index c6853b3007..654cde1b75 100644 --- a/osu.Game/Screens/Play/PlayerInputManager.cs +++ b/osu.Game/Screens/Play/PlayerInputManager.cs @@ -61,7 +61,7 @@ namespace osu.Game.Screens.Play int loops = 0; - while (validState && requireMoreUpdateLoops && loops++ < 50) + while (validState && requireMoreUpdateLoops && loops++ < max_catch_up_updates_per_frame) if (!base.UpdateSubTree()) return false; From f261a077d2ff613136b84206ddc94332e28756c1 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Wed, 26 Apr 2017 20:22:03 +0900 Subject: [PATCH 430/442] General fixes/cleanup in Player. --- osu.Game/Screens/Play/Player.cs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 7d001d16bf..37b4cf5b45 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -92,9 +92,6 @@ namespace osu.Game.Screens.Play if (Beatmap?.Beatmap == null) throw new Exception("Beatmap was not loaded"); - if (Beatmap?.Beatmap?.HitObjects.Count == 0) - throw new Exception("No valid objects were found!"); - ruleset = osu?.Ruleset.Value ?? Beatmap.BeatmapInfo.Ruleset; rulesetInstance = ruleset.CreateInstance(); @@ -110,6 +107,9 @@ namespace osu.Game.Screens.Play rulesetInstance = ruleset.CreateInstance(); HitRenderer = rulesetInstance.CreateHitRendererWith(Beatmap); } + + if (!HitRenderer.Objects.Any()) + throw new Exception("Beatmap contains no hit objects!"); } catch (Exception e) { @@ -167,10 +167,7 @@ namespace osu.Game.Screens.Play hudOverlay.Progress.Objects = HitRenderer.Objects; hudOverlay.Progress.AudioClock = decoupledClock; hudOverlay.Progress.AllowSeeking = HitRenderer.HasReplayLoaded; - hudOverlay.Progress.OnSeek = pos => - { - decoupledClock.Seek(pos); - }; + hudOverlay.Progress.OnSeek = pos => decoupledClock.Seek(pos); //bind HitRenderer to ScoreProcessor and ourselves (for a pass situation) HitRenderer.OnAllJudged += onCompletion; @@ -355,7 +352,6 @@ namespace osu.Game.Screens.Play initializeSkipButton(); }); - //keep in mind this is using the interpolatedSourceClock so won't be run as early as we may expect. hitRendererContainer.Alpha = 0; hitRendererContainer.FadeIn(750, EasingTypes.OutQuint); } From cf3e83ca6225340ee507b21ef87c08ff2293cdfb Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Tue, 25 Apr 2017 15:53:21 +0800 Subject: [PATCH 431/442] Save ShowUnicode in framework config. --- osu.Game/Configuration/OsuConfigManager.cs | 11 ----------- .../Options/Sections/General/LanguageOptions.cs | 7 ++++--- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index addb2c2995..7e77de09b0 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -163,16 +163,6 @@ namespace osu.Game.Configuration Set(OsuConfig.UpdateFailCount, 0).Disabled = true; //Set(OsuConfig.TreeSortMode, TreeGroupMode.Show_All).Disabled = true; //Set(OsuConfig.TreeSortMode2, TreeSortMode.Title).Disabled = true; - bool unicodeDefault = false; - switch (Get(OsuConfig.Language)) - { - case @"zh": - case @"ja": - case @"ko": - unicodeDefault = true; - break; - } - Set(OsuConfig.ShowUnicode, unicodeDefault); Set(OsuConfig.PermanentSongInfo, false).Disabled = true; Set(OsuConfig.Ticker, false).Disabled = true; Set(OsuConfig.CompatibilityContext, false).Disabled = true; @@ -339,7 +329,6 @@ namespace osu.Game.Configuration SaveUsername, TreeSortMode, TreeSortMode2, - ShowUnicode, PermanentSongInfo, Ticker, CompatibilityContext, diff --git a/osu.Game/Overlays/Options/Sections/General/LanguageOptions.cs b/osu.Game/Overlays/Options/Sections/General/LanguageOptions.cs index 98b67342cb..1387f981d3 100644 --- a/osu.Game/Overlays/Options/Sections/General/LanguageOptions.cs +++ b/osu.Game/Overlays/Options/Sections/General/LanguageOptions.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; @@ -13,7 +14,7 @@ namespace osu.Game.Overlays.Options.Sections.General protected override string Header => "Language"; [BackgroundDependencyLoader] - private void load(OsuConfigManager config) + private void load(OsuConfigManager osuConfig, FrameworkConfigManager frameworkConfig) { Children = new Drawable[] { @@ -21,12 +22,12 @@ namespace osu.Game.Overlays.Options.Sections.General new OsuCheckbox { LabelText = "Prefer metadata in original language", - Bindable = config.GetBindable(OsuConfig.ShowUnicode) + Bindable = frameworkConfig.GetBindable(FrameworkConfig.ShowUnicode) }, new OsuCheckbox { LabelText = "Use alternative font for chat display", - Bindable = config.GetBindable(OsuConfig.AlternativeChatFont) + Bindable = osuConfig.GetBindable(OsuConfig.AlternativeChatFont) }, }; } From 4cb18361c1193eff3fe53947ac47af45b04d9118 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Wed, 26 Apr 2017 19:41:37 +0800 Subject: [PATCH 432/442] Use localisation engine for unicode text. --- .../Beatmaps/Drawables/BeatmapSetHeader.cs | 26 +++++-------- osu.Game/Overlays/MusicController.cs | 17 ++++---- osu.Game/Screens/Ranking/ResultsPageScore.cs | 39 ++++++++----------- 3 files changed, 36 insertions(+), 46 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs index 534578337f..db8f0b3a50 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs @@ -1,19 +1,18 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . +// Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; using System.Collections.Generic; +using OpenTK; +using OpenTK.Graphics; using osu.Framework.Allocation; -using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; -using osu.Game.Configuration; +using osu.Framework.Localisation; using osu.Game.Graphics.Sprites; -using OpenTK; -using OpenTK.Graphics; namespace osu.Game.Beatmaps.Drawables { @@ -23,8 +22,6 @@ namespace osu.Game.Beatmaps.Drawables private readonly SpriteText title; private readonly SpriteText artist; - private Bindable preferUnicode; - private readonly WorkingBeatmap beatmap; private readonly FillFlowContainer difficultyIcons; @@ -82,15 +79,12 @@ namespace osu.Game.Beatmaps.Drawables } [BackgroundDependencyLoader] - private void load(OsuConfigManager config) + private void load(LocalisationEngine localisation) { - preferUnicode = config.GetBindable(OsuConfig.ShowUnicode); - preferUnicode.ValueChanged += unicode => - { - title.Text = unicode ? beatmap.BeatmapSetInfo.Metadata.TitleUnicode : beatmap.BeatmapSetInfo.Metadata.Title; - artist.Text = unicode ? beatmap.BeatmapSetInfo.Metadata.ArtistUnicode : beatmap.BeatmapSetInfo.Metadata.Artist; - }; - preferUnicode.TriggerChange(); + title.Current = localisation.GetUnicodePreference( + beatmap.BeatmapSetInfo.Metadata.TitleUnicode, beatmap.BeatmapSetInfo.Metadata.Title); + artist.Current = localisation.GetUnicodePreference( + beatmap.BeatmapSetInfo.Metadata.ArtistUnicode, beatmap.BeatmapSetInfo.Metadata.Artist); } private class PanelBackground : BufferedContainer @@ -112,7 +106,7 @@ namespace osu.Game.Beatmaps.Drawables Depth = -1, Direction = FillDirection.Horizontal, RelativeSizeAxes = Axes.Both, - // This makes the gradient not be perfectly horizontal, but diagonal at a ~40° angle + // This makes the gradient not be perfectly horizontal, but diagonal at a ~40° angle Shear = new Vector2(0.8f, 0), Alpha = 0.5f, Children = new[] diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index f960d9e0ae..8fc7eaa69a 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -24,6 +24,7 @@ using osu.Framework.Graphics.Primitives; using osu.Game.Graphics.Sprites; using osu.Framework.Extensions; using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Localisation; namespace osu.Game.Overlays { @@ -41,9 +42,9 @@ namespace osu.Game.Overlays private TrackManager trackManager; private Bindable beatmapSource; - private Bindable preferUnicode; private WorkingBeatmap current; private BeatmapDatabase beatmaps; + private LocalisationEngine localisation; private Container dragContainer; @@ -81,7 +82,7 @@ namespace osu.Game.Overlays } [BackgroundDependencyLoader] - private void load(OsuGameBase game, OsuConfigManager config, BeatmapDatabase beatmaps, OsuColour colours) + private void load(OsuGameBase game, BeatmapDatabase beatmaps, OsuColour colours, LocalisationEngine localisation) { Children = new Drawable[] { @@ -187,8 +188,7 @@ namespace osu.Game.Overlays this.beatmaps = beatmaps; trackManager = game.Audio.Track; - preferUnicode = config.GetBindable(OsuConfig.ShowUnicode); - preferUnicode.ValueChanged += unicode => updateDisplay(current, TransformDirection.None); + this.localisation = localisation; beatmapSource = game.Beatmap ?? new Bindable(); playList = beatmaps.GetAllWithChildren(); @@ -308,16 +308,19 @@ namespace osu.Game.Overlays { Task.Run(() => { - if (beatmap?.Beatmap == null) + if (beatmap?.Beatmap == null) //this is not needed if a placeholder exists { + title.Current = null; title.Text = @"Nothing to play"; + + artist = null; artist.Text = @"Nothing to play"; } else { BeatmapMetadata metadata = beatmap.Beatmap.BeatmapInfo.Metadata; - title.Text = preferUnicode ? metadata.TitleUnicode : metadata.Title; - artist.Text = preferUnicode ? metadata.ArtistUnicode : metadata.Artist; + title.Current = localisation.GetUnicodePreference(metadata.TitleUnicode, metadata.Title); + artist.Current = localisation.GetUnicodePreference(metadata.ArtistUnicode, metadata.Artist); } }); diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index 1c2a126211..0bd64c4c69 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -1,30 +1,29 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; +using System.Collections.Generic; +using System.Linq; +using OpenTK; +using OpenTK.Graphics; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Game.Configuration; +using osu.Framework.Localisation; +using osu.Game.Beatmaps; using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Game.Rulesets.Scoring; +using osu.Game.Screens.Play; using osu.Game.Screens.Select.Leaderboards; using osu.Game.Users; -using OpenTK; -using OpenTK.Graphics; -using System; -using System.Collections.Generic; -using osu.Framework.Extensions.Color4Extensions; -using osu.Game.Beatmaps; -using osu.Game.Screens.Play; -using osu.Game.Rulesets.Scoring; -using osu.Framework.Graphics.Colour; -using System.Linq; namespace osu.Game.Screens.Ranking { @@ -272,8 +271,6 @@ namespace osu.Game.Screens.Ranking { private readonly BeatmapInfo beatmap; - private Bindable preferUnicode; - private readonly OsuSpriteText title; private readonly OsuSpriteText artist; private readonly OsuSpriteText versionMapper; @@ -323,20 +320,16 @@ namespace osu.Game.Screens.Ranking } [BackgroundDependencyLoader] - private void load(OsuColour colours, OsuConfigManager config) + private void load(OsuColour colours, LocalisationEngine localisation) { title.Colour = artist.Colour = colours.BlueDarker; versionMapper.Colour = colours.Gray8; versionMapper.Text = $"{beatmap.Version} - mapped by {beatmap.Metadata.Author}"; - - preferUnicode = config.GetBindable(OsuConfig.ShowUnicode); - preferUnicode.ValueChanged += unicode => - { - title.Text = unicode ? beatmap.Metadata.TitleUnicode : beatmap.Metadata.Title; - artist.Text = unicode ? beatmap.Metadata.ArtistUnicode : beatmap.Metadata.Artist; - }; - preferUnicode.TriggerChange(); + title.Current = localisation.GetUnicodePreference( + beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title); + artist.Current = localisation.GetUnicodePreference( + beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist); } } From 061c3cacbdc5d26d18355fff4ac92af63d750f76 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Wed, 26 Apr 2017 20:04:32 +0800 Subject: [PATCH 433/442] CI fixes. --- osu.Game/Overlays/MusicController.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 8fc7eaa69a..291462c335 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -10,21 +10,20 @@ using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Audio.Track; using osu.Framework.Configuration; +using osu.Framework.Extensions; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Framework.Input; +using osu.Framework.Localisation; using osu.Framework.MathUtils; using osu.Game.Beatmaps; -using osu.Game.Configuration; using osu.Game.Database; using osu.Game.Graphics; -using osu.Framework.Graphics.Primitives; using osu.Game.Graphics.Sprites; -using osu.Framework.Extensions; -using osu.Framework.Extensions.Color4Extensions; -using osu.Framework.Localisation; namespace osu.Game.Overlays { @@ -313,7 +312,7 @@ namespace osu.Game.Overlays title.Current = null; title.Text = @"Nothing to play"; - artist = null; + artist.Current = null; artist.Text = @"Nothing to play"; } else From ad92e6d73293068b440194fa2fbf850ffaa9b8a0 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Thu, 27 Apr 2017 12:42:56 +0800 Subject: [PATCH 434/442] Remove OsuConfig.Language too. --- osu.Game/Configuration/OsuConfigManager.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 7e77de09b0..30cd31c113 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -92,7 +92,6 @@ namespace osu.Game.Configuration Set(OsuConfig.IgnoreBeatmapSamples, false).Disabled = true; Set(OsuConfig.IgnoreBeatmapSkins, false).Disabled = true; Set(OsuConfig.IgnoreList, string.Empty).Disabled = true; - Set(OsuConfig.Language, @"unknown").Disabled = true; Set(OsuConfig.AllowNowPlayingHighlights, false).Disabled = true; Set(OsuConfig.LastVersion, string.Empty).Disabled = true; Set(OsuConfig.LastVersionPermissionsFailed, string.Empty).Disabled = true; From 4ab636cbb80e090867f699707f88e028e79591bb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Apr 2017 17:37:38 +0900 Subject: [PATCH 435/442] Update osu! drawables to use TransformSequences. --- .../Objects/Drawables/DrawableHitCircle.cs | 4 +--- .../Objects/Drawables/DrawableOsuHitObject.cs | 14 ++++++++++---- .../Objects/Drawables/DrawableSlider.cs | 6 ++---- .../Objects/Drawables/DrawableSliderTick.cs | 6 ++---- .../Objects/Drawables/DrawableSpinner.cs | 4 +--- 5 files changed, 16 insertions(+), 18 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index 4c1a74c675..09bfffeefe 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -104,10 +104,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables ApproachCircle.ScaleTo(1.1f, TIME_PREEMPT); } - protected override void UpdateState(ArmedState state) + protected override void UpdateCurrentState(ArmedState state) { - base.UpdateState(state); - ApproachCircle.FadeOut(); double endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index 2baf651cc0..60684f2042 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -21,17 +21,23 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables protected override OsuJudgement CreateJudgement() => new OsuJudgement { MaxScore = OsuScoreResult.Hit300 }; - protected override void UpdateState(ArmedState state) + protected override sealed void UpdateState(ArmedState state) { Flush(); UpdateInitialState(); - Delay(HitObject.StartTime - Time.Current - TIME_PREEMPT + Judgement.TimeOffset, true); + using (BeginAbsoluteSequence(HitObject.StartTime - TIME_PREEMPT, true)) + { + UpdatePreemptState(); - UpdatePreemptState(); + using (BeginDelayedSequence(TIME_PREEMPT + Judgement.TimeOffset, true)) + UpdateCurrentState(state); + } + } - Delay(TIME_PREEMPT, true); + protected virtual void UpdateCurrentState(ArmedState state) + { } protected virtual void UpdatePreemptState() diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index ed698f5ad3..b80f1d7178 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -158,10 +158,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables ball.Alpha = 0; } - protected override void UpdateState(ArmedState state) + protected override void UpdateCurrentState(ArmedState state) { - base.UpdateState(state); - ball.FadeIn(); Delay(slider.Duration, true); @@ -181,4 +179,4 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { void UpdateProgress(double progress, int repeat); } -} \ No newline at end of file +} diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs index 86baf9f235..6b4d40e080 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs @@ -72,10 +72,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables Delay(-animIn); } - protected override void UpdateState(ArmedState state) + protected override void UpdateCurrentState(ArmedState state) { - base.UpdateState(state); - switch (state) { case ArmedState.Idle: @@ -93,4 +91,4 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables } } } -} \ No newline at end of file +} diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 4623fe7f22..90a6d432c4 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -132,10 +132,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables disc.FadeIn(200); } - protected override void UpdateState(ArmedState state) + protected override void UpdateCurrentState(ArmedState state) { - base.UpdateState(state); - Delay(spinner.Duration, true); FadeOut(160); From 59a3e23879891e7c488bb7af95a544e99ec0564f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Apr 2017 17:38:00 +0900 Subject: [PATCH 436/442] Ensure PlayerInputManager's initial time is transferred at load. --- osu.Game/Screens/Play/PlayerInputManager.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/PlayerInputManager.cs b/osu.Game/Screens/Play/PlayerInputManager.cs index f961286818..9707ccbc35 100644 --- a/osu.Game/Screens/Play/PlayerInputManager.cs +++ b/osu.Game/Screens/Play/PlayerInputManager.cs @@ -13,7 +13,7 @@ namespace osu.Game.Screens.Play { public class PlayerInputManager : PassThroughInputManager { - private readonly ManualClock clock = new ManualClock(); + private ManualClock clock; private IFrameBasedClock parentClock; private ReplayInputHandler replayInputHandler; @@ -47,8 +47,14 @@ namespace osu.Game.Screens.Play { base.LoadComplete(); + //our clock will now be our parent's clock, but we want to replace this to allow manual control. parentClock = Clock; - Clock = new FramedClock(clock); + + Clock = new FramedClock(clock = new ManualClock + { + CurrentTime = parentClock.CurrentTime, + Rate = parentClock.Rate, + }); } /// From 12c0a177118a0858526edc6517e0bb5be4dafe35 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Apr 2017 18:07:10 +0900 Subject: [PATCH 437/442] Make FollowPoints dumb; use absolute sequence at renderer level. --- .../Drawables/Connections/FollowPoint.cs | 24 +------------------ .../Connections/FollowPointRenderer.cs | 23 ++++++++++++++---- 2 files changed, 20 insertions(+), 27 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs index e1276f30c4..9f8ff17853 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPoint.cs @@ -12,16 +12,11 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections { public class FollowPoint : Container { - public double StartTime; - public double EndTime; - public Vector2 EndPosition; - private const float width = 8; public FollowPoint() { Origin = Anchor.Centre; - Alpha = 0; Masking = true; AutoSizeAxes = Axes.Both; @@ -45,22 +40,5 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections }, }; } - - protected override void LoadComplete() - { - base.LoadComplete(); - - Delay(StartTime); - FadeIn(DrawableOsuHitObject.TIME_FADEIN); - ScaleTo(1.5f); - ScaleTo(1, DrawableOsuHitObject.TIME_FADEIN, EasingTypes.Out); - MoveTo(EndPosition, DrawableOsuHitObject.TIME_FADEIN, EasingTypes.Out); - - Delay(EndTime - StartTime); - FadeOut(DrawableOsuHitObject.TIME_FADEIN); - - Delay(DrawableOsuHitObject.TIME_FADEIN); - Expire(true); - } } -} \ No newline at end of file +} diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs index a4e032050e..925767b851 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using OpenTK; +using osu.Framework.Graphics; using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections @@ -80,14 +81,28 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections double fadeOutTime = startTime + fraction * duration; double fadeInTime = fadeOutTime - PreEmpt; - Add(new FollowPoint + FollowPoint fp; + + Add(fp = new FollowPoint { - StartTime = fadeInTime, - EndTime = fadeOutTime, Position = pointStartPosition, - EndPosition = pointEndPosition, Rotation = rotation, + Alpha = 0, + Scale = new Vector2(1.5f), }); + + using (fp.BeginAbsoluteSequence(fadeInTime)) + { + fp.FadeIn(DrawableOsuHitObject.TIME_FADEIN); + fp.ScaleTo(1, DrawableOsuHitObject.TIME_FADEIN, EasingTypes.Out); + + fp.MoveTo(pointEndPosition, DrawableOsuHitObject.TIME_FADEIN, EasingTypes.Out); + + fp.Delay(fadeOutTime - fadeInTime); + fp.FadeOut(DrawableOsuHitObject.TIME_FADEIN); + } + + fp.Expire(true); } } prevHitObject = currHitObject; From 94c259bd59a4d93f14fee6a54abe8210992ec5e8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Apr 2017 18:39:40 +0900 Subject: [PATCH 438/442] Remove most usages of DelayReset ButtonSystem requires some more work. --- osu-framework | 2 +- .../Objects/Drawables/DrawableSwell.cs | 5 ++-- .../Graphics/UserInterface/StarCounter.cs | 14 ++++----- osu.Game/Screens/Ranking/Results.cs | 30 ++++++++++--------- .../Tournament/ScrollingTeamContainer.cs | 10 ++----- 5 files changed, 29 insertions(+), 32 deletions(-) diff --git a/osu-framework b/osu-framework index dcbd7a0b6f..07fd653f42 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit dcbd7a0b6f536f6aadf13a720db40a1d76bf52e2 +Subproject commit 07fd653f422bfb7faf382f46b731c18eed24baae diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs index 57b2576a8b..37efd8aba4 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs @@ -148,9 +148,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables var completion = (float)userHits / HitObject.RequiredHits; expandingRing.FadeTo(expandingRing.Alpha + MathHelper.Clamp(completion / 16, 0.1f, 0.6f), 50); - expandingRing.Delay(50); - expandingRing.FadeTo(completion / 8, 2000, EasingTypes.OutQuint); - expandingRing.DelayReset(); + using (expandingRing.BeginDelayedSequence(50)) + expandingRing.FadeTo(completion / 8, 2000, EasingTypes.OutQuint); symbol.RotateTo((float)(completion * HitObject.Duration / 8), 4000, EasingTypes.OutQuint); diff --git a/osu.Game/Graphics/UserInterface/StarCounter.cs b/osu.Game/Graphics/UserInterface/StarCounter.cs index c046749dad..295cdac81d 100644 --- a/osu.Game/Graphics/UserInterface/StarCounter.cs +++ b/osu.Game/Graphics/UserInterface/StarCounter.cs @@ -131,14 +131,14 @@ namespace osu.Game.Graphics.UserInterface foreach (var star in stars.Children) { star.ClearTransforms(true); - if (count <= newValue) - star.Delay(Math.Max(i - count, 0) * animationDelay, true); - else - star.Delay(Math.Max(count - 1 - i, 0) * animationDelay, true); - star.FadeTo(i < newValue ? 1.0f : minStarAlpha, fadingDuration); - star.Icon.ScaleTo(getStarScale(i, newValue), scalingDuration, scalingEasing); - star.DelayReset(); + var delay = (count <= newValue ? Math.Max(i - count, 0) : Math.Max(count - 1 - i, 0)) * animationDelay; + + using (BeginDelayedSequence(delay, true)) + { + star.FadeTo(i < newValue ? 1.0f : minStarAlpha, fadingDuration); + star.Icon.ScaleTo(getStarScale(i, newValue), scalingDuration, scalingEasing); + } i++; } diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index ffe72966f5..5bcaba7813 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -70,24 +70,26 @@ namespace osu.Game.Screens.Ranking circleOuterBackground.ScaleTo(1, transition_time, EasingTypes.OutQuint); circleOuterBackground.FadeTo(1, transition_time, EasingTypes.OutQuint); - Content.Delay(transition_time * 0.25f, true); + using (BeginDelayedSequence(transition_time * 0.25f, true)) + { - circleOuter.ScaleTo(1, transition_time, EasingTypes.OutQuint); - circleOuter.FadeTo(1, transition_time, EasingTypes.OutQuint); + circleOuter.ScaleTo(1, transition_time, EasingTypes.OutQuint); + circleOuter.FadeTo(1, transition_time, EasingTypes.OutQuint); - Content.Delay(transition_time * 0.3f, true); + using (BeginDelayedSequence(transition_time * 0.3f, true)) + { + backgroundParallax.FadeIn(transition_time, EasingTypes.OutQuint); - backgroundParallax.FadeIn(transition_time, EasingTypes.OutQuint); + circleInner.ScaleTo(1, transition_time, EasingTypes.OutQuint); + circleInner.FadeTo(1, transition_time, EasingTypes.OutQuint); - circleInner.ScaleTo(1, transition_time, EasingTypes.OutQuint); - circleInner.FadeTo(1, transition_time, EasingTypes.OutQuint); - - Content.Delay(transition_time * 0.4f, true); - - modeChangeButtons.FadeIn(transition_time, EasingTypes.OutQuint); - currentPage.FadeIn(transition_time, EasingTypes.OutQuint); - - Content.DelayReset(); + using (BeginDelayedSequence(transition_time * 0.4f, true)) + { + modeChangeButtons.FadeIn(transition_time, EasingTypes.OutQuint); + currentPage.FadeIn(transition_time, EasingTypes.OutQuint); + } + } + } } protected override bool OnExiting(Screen next) diff --git a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs index 08f270741c..5783893b3d 100644 --- a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs +++ b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs @@ -106,7 +106,7 @@ namespace osu.Game.Screens.Tournament speedTo(0f, 2000); tracker.FadeIn(200); - delayedStateChangeDelegate = Delay(2300).Schedule(() => scrollState = ScrollState.Stopped); + delayedStateChangeDelegate = Scheduler.AddDelayed(() => scrollState = ScrollState.Stopped, 2300); break; case ScrollState.Stopped: // Find closest to center @@ -144,7 +144,7 @@ namespace osu.Game.Screens.Tournament st.Selected = true; OnSelected?.Invoke(st.Team); - delayedStateChangeDelegate = Delay(10000).Schedule(() => scrollState = ScrollState.Idle); + delayedStateChangeDelegate = Scheduler.AddDelayed(() => scrollState = ScrollState.Idle, 10000); break; case ScrollState.Idle: resetSelected(); @@ -295,11 +295,7 @@ namespace osu.Game.Screens.Tournament } } - private void speedTo(float value, double duration = 0, EasingTypes easing = EasingTypes.None) - { - DelayReset(); - TransformTo(() => speed, value, duration, easing, new TransformScrollSpeed()); - } + private void speedTo(float value, double duration = 0, EasingTypes easing = EasingTypes.None) => TransformTo(() => speed, value, duration, easing, new TransformScrollSpeed()); private enum ScrollState { From e3236429b1cdb248fe28e65b93b413390fab726c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Apr 2017 13:21:03 +0900 Subject: [PATCH 439/442] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 07fd653f42..fc93e11439 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 07fd653f422bfb7faf382f46b731c18eed24baae +Subproject commit fc93e11439b8b391d9e01e208368d96ba85bfa26 From 220c602218dc808d65c132a29a28484d64c58303 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Apr 2017 13:27:20 +0900 Subject: [PATCH 440/442] Fix incorrect modifier order. --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index 60684f2042..57a9804330 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables protected override OsuJudgement CreateJudgement() => new OsuJudgement { MaxScore = OsuScoreResult.Hit300 }; - protected override sealed void UpdateState(ArmedState state) + protected sealed override void UpdateState(ArmedState state) { Flush(); From c95a6fbd0930c292f398197416095d9c9ea57985 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 28 Apr 2017 14:14:14 +0900 Subject: [PATCH 441/442] Use single line for GetUnicodePreference. --- osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs | 6 ++---- osu.Game/Screens/Ranking/ResultsPageScore.cs | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs index db8f0b3a50..db14a48af1 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs @@ -81,10 +81,8 @@ namespace osu.Game.Beatmaps.Drawables [BackgroundDependencyLoader] private void load(LocalisationEngine localisation) { - title.Current = localisation.GetUnicodePreference( - beatmap.BeatmapSetInfo.Metadata.TitleUnicode, beatmap.BeatmapSetInfo.Metadata.Title); - artist.Current = localisation.GetUnicodePreference( - beatmap.BeatmapSetInfo.Metadata.ArtistUnicode, beatmap.BeatmapSetInfo.Metadata.Artist); + title.Current = localisation.GetUnicodePreference(beatmap.BeatmapSetInfo.Metadata.TitleUnicode, beatmap.BeatmapSetInfo.Metadata.Title); + artist.Current = localisation.GetUnicodePreference(beatmap.BeatmapSetInfo.Metadata.ArtistUnicode, beatmap.BeatmapSetInfo.Metadata.Artist); } private class PanelBackground : BufferedContainer diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index 0bd64c4c69..4bfd998c54 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -326,10 +326,8 @@ namespace osu.Game.Screens.Ranking versionMapper.Colour = colours.Gray8; versionMapper.Text = $"{beatmap.Version} - mapped by {beatmap.Metadata.Author}"; - title.Current = localisation.GetUnicodePreference( - beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title); - artist.Current = localisation.GetUnicodePreference( - beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist); + title.Current = localisation.GetUnicodePreference(beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title); + artist.Current = localisation.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist); } } From f202aee2a910005c400f932e34f6b4f85151b6dd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 29 Apr 2017 16:59:23 +0900 Subject: [PATCH 442/442] Fix input not being propagated to the playfield when outside its bounds. --- osu.Game/Rulesets/UI/Playfield.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Rulesets/UI/Playfield.cs b/osu.Game/Rulesets/UI/Playfield.cs index 44d15e42c4..0586c0385a 100644 --- a/osu.Game/Rulesets/UI/Playfield.cs +++ b/osu.Game/Rulesets/UI/Playfield.cs @@ -50,6 +50,7 @@ namespace osu.Game.Rulesets.UI { content = new Container { + AlwaysReceiveInput = true, RelativeSizeAxes = Axes.Both, } }