From 311b5c623c8a41433ffcfe3edef99040a9caed68 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 24 Nov 2016 13:33:32 +0900 Subject: [PATCH 1/8] Adjust difficulty panel offsets slightly. --- osu.Game/Screens/Select/CarouselContainer.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Select/CarouselContainer.cs b/osu.Game/Screens/Select/CarouselContainer.cs index 08220ea69d..8e8185e63c 100644 --- a/osu.Game/Screens/Select/CarouselContainer.cs +++ b/osu.Game/Screens/Select/CarouselContainer.cs @@ -77,6 +77,8 @@ namespace osu.Game.Screens.Select foreach (BeatmapPanel panel in group.BeatmapPanels) { + panel.MoveToX(-50, 500, EasingTypes.OutExpo); + if (panel == SelectedPanel) selectedY = currentY + panel.DrawHeight / 2 - DrawHeight / 2; From 1eb04ff11ed92ab72371ee2b3442c5e8dc8f3587 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 24 Nov 2016 13:35:25 +0900 Subject: [PATCH 2/8] Don't use the overlay suffix for beatmapInfo wedge. --- .../Select/{BeatmapInfoOverlay.cs => BeatmapInfoWedge.cs} | 0 osu.Game/Screens/Select/PlaySongSelect.cs | 6 +++--- 2 files changed, 3 insertions(+), 3 deletions(-) rename osu.Game/Screens/Select/{BeatmapInfoOverlay.cs => BeatmapInfoWedge.cs} (100%) diff --git a/osu.Game/Screens/Select/BeatmapInfoOverlay.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs similarity index 100% rename from osu.Game/Screens/Select/BeatmapInfoOverlay.cs rename to osu.Game/Screens/Select/BeatmapInfoWedge.cs diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 604c4aae28..ba06b797ef 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -40,7 +40,7 @@ namespace osu.Game.Screens.Select private static readonly Vector2 wedged_container_size = new Vector2(0.5f, 225); private static readonly Vector2 wedged_container_shear = new Vector2(0.15f, 0); private static readonly Vector2 wedged_container_start_position = new Vector2(0, 50); - private BeatmapInfoOverlay wedgedBeatmapInfoOverlay; + private BeatmapInfoWedge wedgedBeatmapInfoWedge; private static readonly Vector2 BACKGROUND_BLUR = new Vector2(20); private CancellationTokenSource initialAddSetsTask; @@ -102,7 +102,7 @@ namespace osu.Game.Screens.Select Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, }, - wedgedBeatmapInfoOverlay = new BeatmapInfoOverlay + wedgedBeatmapInfoWedge = new BeatmapInfoWedge { Alpha = 0, Position = wedged_container_start_position, @@ -239,7 +239,7 @@ namespace osu.Game.Screens.Select (Background as BackgroundModeBeatmap)?.BlurTo(BACKGROUND_BLUR, 1000); } - wedgedBeatmapInfoOverlay.UpdateBeatmap(beatmap); + wedgedBeatmapInfoWedge.UpdateBeatmap(beatmap); } /// From ece3bc0e01ebe405ae34deaab16a4e7f94cce3ff Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 24 Nov 2016 13:48:48 +0900 Subject: [PATCH 3/8] Refactor BeatmapInfoWedge to be async. --- .../Drawables/BeatmapBackgroundSprite.cs | 24 ++++++++++++ .../Beatmaps/Drawables/BeatmapSetHeader.cs | 25 +------------ osu.Game/Screens/Select/BeatmapInfoWedge.cs | 37 +++++++++++++------ osu.Game/Screens/Select/PlaySongSelect.cs | 6 +-- osu.Game/osu.Game.csproj | 3 +- 5 files changed, 56 insertions(+), 39 deletions(-) create mode 100644 osu.Game/Beatmaps/Drawables/BeatmapBackgroundSprite.cs diff --git a/osu.Game/Beatmaps/Drawables/BeatmapBackgroundSprite.cs b/osu.Game/Beatmaps/Drawables/BeatmapBackgroundSprite.cs new file mode 100644 index 0000000000..e90829873f --- /dev/null +++ b/osu.Game/Beatmaps/Drawables/BeatmapBackgroundSprite.cs @@ -0,0 +1,24 @@ +//Copyright (c) 2007-2016 ppy Pty Ltd . +//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics.Sprites; + +namespace osu.Game.Beatmaps.Drawables +{ + class BeatmapBackgroundSprite : Sprite + { + private readonly WorkingBeatmap working; + + public BeatmapBackgroundSprite(WorkingBeatmap working) + { + this.working = working; + } + + [BackgroundDependencyLoader] + private void load(OsuGameBase game) + { + Texture = working.Background; + } + } +} diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs index 709885d132..9ab9aaf9f5 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs @@ -156,38 +156,17 @@ namespace osu.Game.Beatmaps.Drawables [BackgroundDependencyLoader] private void load(OsuGameBase game) { - new BeatmapBackground(working) + new BeatmapBackgroundSprite(working) { Anchor = Anchor.Centre, Origin = Anchor.Centre, + FillMode = FillMode.Fill, }.Preload(game, (bg) => { Add(bg); ForceRedraw(); }); } - - class BeatmapBackground : Sprite - { - private readonly WorkingBeatmap working; - - public BeatmapBackground(WorkingBeatmap working) - { - this.working = working; - } - - [BackgroundDependencyLoader] - private void load(OsuGameBase game) - { - Texture = working.Background; - } - - protected override void LoadComplete() - { - base.LoadComplete(); - Scale = new Vector2(1366 / (Texture?.Width ?? 1) * 0.6f); - } - } } } } \ No newline at end of file diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 1e12f03749..c6ed202326 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -1,4 +1,6 @@ using System; +using osu.Framework; +using osu.Framework.Allocation; using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics; @@ -8,31 +10,37 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Beatmaps; using osu.Game.Database; using osu.Framework.Graphics.Colour; +using osu.Game.Beatmaps.Drawables; namespace osu.Game.Screens.Select { - class BeatmapInfoOverlay : Container + class BeatmapInfoWedge : Container { private Container beatmapInfoContainer; + private BaseGame game; + + [BackgroundDependencyLoader] + private void load(BaseGame game) + { + this.game = game; + } + public void UpdateBeatmap(WorkingBeatmap beatmap) { if (beatmap == null) return; - float newDepth = 0; - if (beatmapInfoContainer != null) - { - newDepth = beatmapInfoContainer.Depth - 1; - beatmapInfoContainer.FadeOut(250); - beatmapInfoContainer.Expire(); - } + var lastContainer = beatmapInfoContainer; + + float newDepth = lastContainer?.Depth - 1 ?? 0; FadeIn(250); BeatmapSetInfo beatmapSetInfo = beatmap.BeatmapSetInfo; BeatmapInfo beatmapInfo = beatmap.BeatmapInfo; - Add(beatmapInfoContainer = new BufferedContainer + + (beatmapInfoContainer = new BufferedContainer { Depth = newDepth, PixelSnapping = true, @@ -51,18 +59,17 @@ namespace osu.Game.Screens.Select }, // We use a container, such that we can set the colour gradient to go across the // vertices of the masked container instead of the vertices of the (larger) sprite. - beatmap.Background == null ? new Container() : new Container + new Container { RelativeSizeAxes = Axes.Both, ColourInfo = ColourInfo.GradientVertical(Color4.White, new Color4(1f, 1f, 1f, 0.3f)), Children = new [] { // Zoomed-in and cropped beatmap background - new Sprite + new BeatmapBackgroundSprite(beatmap) { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Texture = beatmap.Background, FillMode = FillMode.Fill, }, }, @@ -117,6 +124,12 @@ namespace osu.Game.Screens.Select } } } + }).Preload(game, delegate(Drawable d) + { + lastContainer?.FadeOut(250); + lastContainer?.Expire(); + + Add(d); }); } } diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index ba06b797ef..76ecdcb64e 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -40,7 +40,7 @@ namespace osu.Game.Screens.Select private static readonly Vector2 wedged_container_size = new Vector2(0.5f, 225); private static readonly Vector2 wedged_container_shear = new Vector2(0.15f, 0); private static readonly Vector2 wedged_container_start_position = new Vector2(0, 50); - private BeatmapInfoWedge wedgedBeatmapInfoWedge; + private BeatmapInfoWedge beatmapInfoWedge; private static readonly Vector2 BACKGROUND_BLUR = new Vector2(20); private CancellationTokenSource initialAddSetsTask; @@ -102,7 +102,7 @@ namespace osu.Game.Screens.Select Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, }, - wedgedBeatmapInfoWedge = new BeatmapInfoWedge + beatmapInfoWedge = new BeatmapInfoWedge { Alpha = 0, Position = wedged_container_start_position, @@ -239,7 +239,7 @@ namespace osu.Game.Screens.Select (Background as BackgroundModeBeatmap)?.BlurTo(BACKGROUND_BLUR, 1000); } - wedgedBeatmapInfoWedge.UpdateBeatmap(beatmap); + beatmapInfoWedge.UpdateBeatmap(beatmap); } /// diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 9cb1535981..9c2bbf086a 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -63,6 +63,7 @@ + @@ -159,7 +160,7 @@ - + From 97cf6008f3f53a79d2c5ff5f5167a2093f0cf777 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 24 Nov 2016 18:52:27 +0900 Subject: [PATCH 4/8] Remove playfield background box. --- osu.Game.Mode.Osu/UI/OsuPlayfield.cs | 9 --------- 1 file changed, 9 deletions(-) diff --git a/osu.Game.Mode.Osu/UI/OsuPlayfield.cs b/osu.Game.Mode.Osu/UI/OsuPlayfield.cs index 94638fd79c..1e69cd78a3 100644 --- a/osu.Game.Mode.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Mode.Osu/UI/OsuPlayfield.cs @@ -37,15 +37,6 @@ namespace osu.Game.Modes.Osu.UI AddInternal(new Drawable[] { - new Box - { - RelativeSizeAxes = Axes.Both, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Colour = Color4.Black, - Depth = float.MinValue, - Alpha = 0.5f, - }, approachCircles = new Container { RelativeSizeAxes = Axes.Both, From 3dff72ac6c4312f46bbabddc3d4f1740df863b3c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 24 Nov 2016 18:58:06 +0900 Subject: [PATCH 5/8] Bypass masking checks for input on playfields. --- osu.Game/Modes/UI/Playfield.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Modes/UI/Playfield.cs b/osu.Game/Modes/UI/Playfield.cs index 8bfd82e407..ff8a03db2a 100644 --- a/osu.Game/Modes/UI/Playfield.cs +++ b/osu.Game/Modes/UI/Playfield.cs @@ -14,6 +14,8 @@ namespace osu.Game.Modes.UI public virtual void Add(DrawableHitObject h) => HitObjects.Add(h); + public override bool Contains(Vector2 screenSpacePos) => true; + public Playfield() { AddInternal(HitObjects = new HitObjectContainer @@ -25,6 +27,8 @@ namespace osu.Game.Modes.UI public class HitObjectContainer : Container { protected override Vector2 DrawScale => new Vector2(DrawSize.X / 512); + + public override bool Contains(Vector2 screenSpacePos) => true; } } } From 6c69bd2ba3c2db6d5feaf4e2607db20bd4e83095 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 24 Nov 2016 21:27:12 +0900 Subject: [PATCH 6/8] Fix regression causing crash on using z/x in player mode. --- osu.Game/Screens/Play/Player.cs | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 14df8d37b4..8691097ebf 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -1,6 +1,7 @@ //Copyright (c) 2007-2016 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.Audio; using osu.Framework.Audio.Track; @@ -125,26 +126,28 @@ namespace osu.Game.Screens.Play { } + bool leftViaKeyboard; + bool rightViaKeyboard; + protected override void TransformState(InputState state) { base.TransformState(state); MouseState mouse = (MouseState)state.Mouse; - foreach (Key k in state.Keyboard.Keys) + if (state.Keyboard != null) { - switch (k) - { - case Key.Z: - mouse.ButtonStates.Find(s => s.Button == MouseButton.Left).State = true; - break; - case Key.X: - mouse.ButtonStates.Find(s => s.Button == MouseButton.Right).State = true; - break; - } + leftViaKeyboard = state.Keyboard.Keys.Contains(Key.Z); + rightViaKeyboard = state.Keyboard.Keys.Contains(Key.X); + } + + if (state.Mouse != null) + { + if (leftViaKeyboard) mouse.ButtonStates.Find(s => s.Button == MouseButton.Left).State = true; + if (rightViaKeyboard) mouse.ButtonStates.Find(s => s.Button == MouseButton.Right).State = true; } } } } -} +} \ No newline at end of file From d9de35141ee39c4f7b2bcb0dd543a953c3bc494a Mon Sep 17 00:00:00 2001 From: Tom94 Date: Thu, 24 Nov 2016 20:24:35 +0100 Subject: [PATCH 7/8] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 1a521bb22c..09c18c415d 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 1a521bb22cfd2c14f58d4cd60fbbfdb70ea8f87b +Subproject commit 09c18c415d280448c44cb73f2c4e60e0092b974c From 495cb926f7045d6e3d491485b5a9a79289339263 Mon Sep 17 00:00:00 2001 From: Tom94 Date: Thu, 24 Nov 2016 20:25:29 +0100 Subject: [PATCH 8/8] Move beatmap panels back to an X of 0 when they are unselected. --- osu.Game/Screens/Select/CarouselContainer.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/CarouselContainer.cs b/osu.Game/Screens/Select/CarouselContainer.cs index 8e8185e63c..cfc36b9caa 100644 --- a/osu.Game/Screens/Select/CarouselContainer.cs +++ b/osu.Game/Screens/Select/CarouselContainer.cs @@ -77,11 +77,11 @@ namespace osu.Game.Screens.Select foreach (BeatmapPanel panel in group.BeatmapPanels) { - panel.MoveToX(-50, 500, EasingTypes.OutExpo); - if (panel == SelectedPanel) selectedY = currentY + panel.DrawHeight / 2 - DrawHeight / 2; + panel.MoveToX(-50, 500, EasingTypes.OutExpo); + movePanel(panel, true, ref currentY); } } @@ -90,7 +90,10 @@ namespace osu.Game.Screens.Select group.Header.MoveToX(0, 500, EasingTypes.OutExpo); foreach (BeatmapPanel panel in group.BeatmapPanels) + { + panel.MoveToX(0, 500, EasingTypes.OutExpo); movePanel(panel, false, ref currentY); + } } }