From 044e4d0acddffaffc1055f9042eaacea365e4b0b Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Mon, 25 Dec 2017 19:11:49 -0600 Subject: [PATCH 01/32] Add blur to background in Player --- osu.Game/Configuration/OsuConfigManager.cs | 2 ++ .../Sections/Gameplay/GeneralSettings.cs | 6 ++++++ osu.Game/Screens/Play/Player.cs | 20 ++++++++++++------- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index f4c7bdb586..d359a0a2d6 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -65,6 +65,7 @@ namespace osu.Game.Configuration // Gameplay Set(OsuSetting.DimLevel, 0.3, 0, 1, 0.01); + Set(OsuSetting.BlurLevel, 0, 0, 1, 0.01); Set(OsuSetting.ShowInterface, true); Set(OsuSetting.KeyOverlay, false); @@ -90,6 +91,7 @@ namespace osu.Game.Configuration GameplayCursorSize, AutoCursorSize, DimLevel, + BlurLevel, ShowStoryboard, KeyOverlay, FloatingComments, diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs index 8ec6af5cd0..95d127a55f 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs @@ -22,6 +22,12 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay Bindable = config.GetBindable(OsuSetting.DimLevel), KeyboardStep = 0.1f }, + new SettingsSlider + { + LabelText = "Background blur", + Bindable = config.GetBindable(OsuSetting.BlurLevel), + KeyboardStep = 0.1f + }, new SettingsCheckbox { LabelText = "Show score overlay", diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 340fc39d52..8430acbc73 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -65,6 +65,7 @@ namespace osu.Game.Screens.Play #region User Settings private Bindable dimLevel; + private Bindable blurLevel; private Bindable showStoryboard; private Bindable mouseWheelDisabled; private Bindable userAudioOffset; @@ -74,7 +75,7 @@ namespace osu.Game.Screens.Play #endregion private BreakOverlay breakOverlay; - private Container storyboardContainer; + private BufferedContainer storyboardContainer; private DrawableStoryboard storyboard; private HUDOverlay hudOverlay; @@ -88,6 +89,7 @@ namespace osu.Game.Screens.Play this.api = api; dimLevel = config.GetBindable(OsuSetting.DimLevel); + blurLevel = config.GetBindable(OsuSetting.BlurLevel); showStoryboard = config.GetBindable(OsuSetting.ShowStoryboard); mouseWheelDisabled = config.GetBindable(OsuSetting.MouseDisableWheel); @@ -147,7 +149,7 @@ namespace osu.Game.Screens.Play Children = new Drawable[] { - storyboardContainer = new Container + storyboardContainer = new BufferedContainer { RelativeSizeAxes = Axes.Both, Clock = offsetClock, @@ -309,9 +311,9 @@ namespace osu.Game.Screens.Play if (!loadedSuccessfully) return; - (Background as BackgroundScreenBeatmap)?.BlurTo(Vector2.Zero, 1000, Easing.OutQuint); + dimLevel.ValueChanged += backgroundLevel_ValueChanged; + blurLevel.ValueChanged += backgroundLevel_ValueChanged; - dimLevel.ValueChanged += dimLevel_ValueChanged; showStoryboard.ValueChanged += showStoryboard_ValueChanged; updateBackgroundElements(); @@ -368,7 +370,7 @@ namespace osu.Game.Screens.Play return true; } - private void dimLevel_ValueChanged(double newValue) + private void backgroundLevel_ValueChanged(double newValue) => updateBackgroundElements(); private void showStoryboard_ValueChanged(bool newValue) @@ -377,6 +379,7 @@ namespace osu.Game.Screens.Play private void updateBackgroundElements() { var opacity = 1 - (float)dimLevel; + var blur = new Vector2((float)blurLevel.Value * 25); if (showStoryboard && storyboard == null) initializeStoryboard(true); @@ -385,14 +388,17 @@ namespace osu.Game.Screens.Play var storyboardVisible = showStoryboard && beatmap.Storyboard.HasDrawable; storyboardContainer.FadeColour(new Color4(opacity, opacity, opacity, 1), 800); - storyboardContainer.FadeTo(storyboardVisible && opacity > 0 ? 1 : 0); + storyboardContainer.FadeTo(storyboardVisible && opacity > 0 ? 1 : 0, 800, Easing.OutQuint); + storyboardContainer.BlurTo(blur, 800, Easing.OutQuint); Background?.FadeTo(!storyboardVisible || beatmap.Background == null ? opacity : 0, 800, Easing.OutQuint); + (Background as BackgroundScreenBeatmap)?.BlurTo(blur, 800, Easing.OutQuint); } private void fadeOut() { - dimLevel.ValueChanged -= dimLevel_ValueChanged; + dimLevel.ValueChanged -= backgroundLevel_ValueChanged; + blurLevel.ValueChanged -= backgroundLevel_ValueChanged; showStoryboard.ValueChanged -= showStoryboard_ValueChanged; const float fade_out_duration = 250; From bc90793b1c59da7ca83bb9a5ca4b6ae1fcd62c72 Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Mon, 25 Dec 2017 19:18:57 -0600 Subject: [PATCH 02/32] Trim whitespace --- osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs index 95d127a55f..0808c18b6f 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs @@ -27,7 +27,7 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay LabelText = "Background blur", Bindable = config.GetBindable(OsuSetting.BlurLevel), KeyboardStep = 0.1f - }, + }, new SettingsCheckbox { LabelText = "Show score overlay", From 3845c7ac7de3f17ea64aa225037915f71280baf4 Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Thu, 28 Dec 2017 14:31:34 -0600 Subject: [PATCH 03/32] Remove bluring of storyboard --- osu.Game/Screens/Play/Player.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 8430acbc73..8b94f41686 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -75,7 +75,7 @@ namespace osu.Game.Screens.Play #endregion private BreakOverlay breakOverlay; - private BufferedContainer storyboardContainer; + private Container storyboardContainer; private DrawableStoryboard storyboard; private HUDOverlay hudOverlay; @@ -149,7 +149,7 @@ namespace osu.Game.Screens.Play Children = new Drawable[] { - storyboardContainer = new BufferedContainer + storyboardContainer = new Container { RelativeSizeAxes = Axes.Both, Clock = offsetClock, @@ -389,7 +389,6 @@ namespace osu.Game.Screens.Play storyboardContainer.FadeColour(new Color4(opacity, opacity, opacity, 1), 800); storyboardContainer.FadeTo(storyboardVisible && opacity > 0 ? 1 : 0, 800, Easing.OutQuint); - storyboardContainer.BlurTo(blur, 800, Easing.OutQuint); Background?.FadeTo(!storyboardVisible || beatmap.Background == null ? opacity : 0, 800, Easing.OutQuint); (Background as BackgroundScreenBeatmap)?.BlurTo(blur, 800, Easing.OutQuint); From df62ca14b7f67007216e0d1726342cd7d2da57ee Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Fri, 29 Dec 2017 23:41:36 -0600 Subject: [PATCH 04/32] Don't unbind when not necessary --- osu.Game/Screens/Play/Player.cs | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 8b94f41686..5346de2bb7 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -311,10 +311,9 @@ namespace osu.Game.Screens.Play if (!loadedSuccessfully) return; - dimLevel.ValueChanged += backgroundLevel_ValueChanged; - blurLevel.ValueChanged += backgroundLevel_ValueChanged; - - showStoryboard.ValueChanged += showStoryboard_ValueChanged; + dimLevel.ValueChanged += value => updateBackgroundElements(); + blurLevel.ValueChanged += value => updateBackgroundElements(); + showStoryboard.ValueChanged += value => updateBackgroundElements(); updateBackgroundElements(); Content.Alpha = 0; @@ -370,12 +369,6 @@ namespace osu.Game.Screens.Play return true; } - private void backgroundLevel_ValueChanged(double newValue) - => updateBackgroundElements(); - - private void showStoryboard_ValueChanged(bool newValue) - => updateBackgroundElements(); - private void updateBackgroundElements() { var opacity = 1 - (float)dimLevel; @@ -396,10 +389,6 @@ namespace osu.Game.Screens.Play private void fadeOut() { - dimLevel.ValueChanged -= backgroundLevel_ValueChanged; - blurLevel.ValueChanged -= backgroundLevel_ValueChanged; - showStoryboard.ValueChanged -= showStoryboard_ValueChanged; - const float fade_out_duration = 250; RulesetContainer?.FadeOut(fade_out_duration); From c92345cf214cf42798cc6c57a7ab10ab5801bc56 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 31 Dec 2017 22:09:07 +0900 Subject: [PATCH 05/32] Give fruit a border From 31865b4d9668952551d6c14a012b563366083d13 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 3 Jan 2018 15:12:27 +0900 Subject: [PATCH 06/32] Rename conflicting variable --- osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs | 2 +- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs | 2 +- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs | 2 +- osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs index 31b374f71d..6328d88758 100644 --- a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs +++ b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs @@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Osu.Beatmaps colourIndex = (colourIndex + 1) % beatmap.ComboColors.Count; } - obj.ComboIndex = comboIndex++; + obj.IndexInCurrentCombo = comboIndex++; obj.ComboColour = beatmap.ComboColors[colourIndex]; } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index 72ca9b37a8..b350cd1656 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -48,7 +48,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables }, number = new NumberPiece { - Text = (HitObject.ComboIndex + 1).ToString(), + Text = (HitObject.IndexInCurrentCombo + 1).ToString(), }, ring = new RingPiece(), flash = new FlashPiece(), diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 5a8bcae277..6217418293 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -54,7 +54,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { StartTime = s.StartTime, Position = s.StackedPosition, - ComboIndex = s.ComboIndex, + IndexInCurrentCombo = s.IndexInCurrentCombo, Scale = s.Scale, ComboColour = s.ComboColour, Samples = s.Samples, diff --git a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs index a3a6527b31..5b32f4525c 100644 --- a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs @@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.Osu.Objects public Color4 ComboColour { get; set; } = Color4.Gray; public virtual bool NewCombo { get; set; } - public int ComboIndex { get; set; } + public int IndexInCurrentCombo { get; set; } public double HitWindowFor(HitResult result) { From 02131d75d4e14cf653fef363eca677b62e86bead Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 3 Jan 2018 16:31:57 +0900 Subject: [PATCH 07/32] Let fruits know what index they are in the beatmap to draw a visual representation --- .../Beatmaps/CatchBeatmapProcessor.cs | 6 ++---- osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs | 14 +++++++++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs index 9901dbde18..bed15ef74a 100644 --- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs +++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs @@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps if (beatmap.ComboColors.Count == 0) return; - int comboIndex = 0; + int index = 0; int colourIndex = 0; CatchHitObject lastObj = null; @@ -31,12 +31,10 @@ namespace osu.Game.Rulesets.Catch.Beatmaps if (obj.NewCombo) { if (lastObj != null) lastObj.LastInCombo = true; - - comboIndex = 0; colourIndex = (colourIndex + 1) % beatmap.ComboColors.Count; } - obj.ComboIndex = comboIndex++; + obj.IndexInBeatmap = index++; obj.ComboColour = beatmap.ComboColors[colourIndex]; lastObj = obj; diff --git a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs index 9952e85c70..bda9f70032 100644 --- a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs @@ -16,7 +16,10 @@ namespace osu.Game.Rulesets.Catch.Objects public float X { get; set; } public Color4 ComboColour { get; set; } = Color4.Gray; - public int ComboIndex { get; set; } + + public int IndexInBeatmap { get; set; } + + public virtual FruitVisualRepresentation VisualRepresentation => (FruitVisualRepresentation)(IndexInBeatmap % 4); public virtual bool NewCombo { get; set; } @@ -44,4 +47,13 @@ namespace osu.Game.Rulesets.Catch.Objects Scale = 1.0f - 0.7f * (difficulty.CircleSize - 5) / 5; } } + + public enum FruitVisualRepresentation + { + Pear, + Grape, + Apple, + Orange, + Banana // banananananannaanana + } } From fd34b36e1a4ee837731ba462811e51f682b2d991 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 3 Jan 2018 16:32:09 +0900 Subject: [PATCH 08/32] Add fruit drawable testcase --- .../Tests/TestCaseFruitObjects.cs | 65 +++++++++++++++++++ .../osu.Game.Rulesets.Catch.csproj | 1 + 2 files changed, 66 insertions(+) create mode 100644 osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs diff --git a/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs b/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs new file mode 100644 index 0000000000..45a6c1c808 --- /dev/null +++ b/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs @@ -0,0 +1,65 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE + +using System; +using System.Collections.Generic; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Rulesets.Catch.Objects; +using osu.Game.Rulesets.Catch.Objects.Drawable; +using osu.Game.Tests.Visual; +using OpenTK; + +namespace osu.Game.Rulesets.Catch.Tests +{ + public class TestCaseFruitObjects : OsuTestCase + { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(CatchHitObject), + typeof(Fruit), + typeof(DrawableCatchHitObject), + typeof(DrawableFruit), + }; + + public TestCaseFruitObjects() + { + Add(new GridContainer + { + RelativeSizeAxes = Axes.Both, + Content = new[] + { + new Drawable[] + { + createDrawable(0), + createDrawable(1), + }, + new Drawable[] + { + createDrawable(2), + createDrawable(3), + }, + } + }); + } + + protected override void Update() + { + base.Update(); + } + + private DrawableFruit createDrawable(int index) => new DrawableFruit(new Fruit + { + StartTime = 1000000, + IndexInBeatmap = index + }) + { + Anchor = Anchor.Centre, + RelativePositionAxes = Axes.Both, + Position = Vector2.Zero, + Alpha = 1, + LifetimeStart = double.NegativeInfinity, + LifetimeEnd = double.PositiveInfinity, + }; + } +} diff --git a/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj b/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj index 16c909e063..b15f05bb09 100644 --- a/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj +++ b/osu.Game.Rulesets.Catch/osu.Game.Rulesets.Catch.csproj @@ -64,6 +64,7 @@ + From cf1f84cc323d87362228a324981839677c9d9d7e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 31 Dec 2017 22:09:07 +0900 Subject: [PATCH 09/32] Give fruit a border --- .../Objects/Drawable/DrawableFruit.cs | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs index 9f46bbd3a4..dbb0ca71cc 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs @@ -4,15 +4,19 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Framework.MathUtils; using osu.Game.Rulesets.Catch.Objects.Drawable.Pieces; using OpenTK; using OpenTK.Graphics; +using System; namespace osu.Game.Rulesets.Catch.Objects.Drawable { public class DrawableFruit : DrawableCatchHitObject { + private Circle border; + public DrawableFruit(Fruit h) : base(h) { @@ -69,7 +73,25 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable AccentColour = AccentColour, }, } - } + }, + border = new Circle + { + Size = new Vector2(Pulp.PULP_SIZE * 3.5f), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + BorderColour = AccentColour, + BorderThickness = 3, + Children = new Framework.Graphics.Drawable[] + { + new Box + { + AlwaysPresent = true, + Colour = AccentColour, + Alpha = 0, + RelativeSizeAxes = Axes.Both + } + } + }, }; if (HitObject.HyperDash) @@ -86,5 +108,11 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable }); } } + + protected override void Update() + { + base.Update(); + border.Alpha = (float)MathHelper.Clamp((HitObject.StartTime - Time.Current) / 1000, 0, 1); + } } } From 921ca6956d1ec892df11debdf31d23590540f72a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 3 Jan 2018 18:26:54 +0900 Subject: [PATCH 10/32] Improve fruit visuals --- .../Objects/CatchHitObject.cs | 38 ++- .../Objects/Drawable/DrawableDroplet.cs | 4 +- .../Objects/Drawable/DrawableFruit.cs | 234 ++++++++++++++---- .../Objects/Drawable/Pieces/Pulp.cs | 11 +- .../Tests/TestCaseFruitObjects.cs | 18 +- 5 files changed, 235 insertions(+), 70 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs index bda9f70032..f36459dc76 100644 --- a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.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.Framework.MathUtils; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Objects; @@ -15,7 +16,36 @@ namespace osu.Game.Rulesets.Catch.Objects public float X { get; set; } - public Color4 ComboColour { get; set; } = Color4.Gray; + public Color4 ComboColour + { + get + { + switch (VisualRepresentation) + { + default: + case FruitVisualRepresentation.Triforce: + return new Color4(17, 136, 170, 255); + case FruitVisualRepresentation.Grape: + return new Color4(204, 102, 0, 255); + case FruitVisualRepresentation.DPad: + return new Color4(121, 9, 13, 255); + case FruitVisualRepresentation.Pineapple: + return new Color4(102, 136, 0, 255); + case FruitVisualRepresentation.Banana: + switch (RNG.Next(0, 3)) + { + default: + return new Color4(255, 240, 0, 255); + case 1: + return new Color4(255, 192, 0, 255); + case 2: + return new Color4(214, 221, 28, 255); + } + } + } + + set { } + } public int IndexInBeatmap { get; set; } @@ -50,10 +80,10 @@ namespace osu.Game.Rulesets.Catch.Objects public enum FruitVisualRepresentation { - Pear, + Triforce, Grape, - Apple, - Orange, + DPad, + Pineapple, Banana // banananananannaanana } } diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs index 2b2a8e7f8d..9fdc4f9cd7 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs @@ -14,9 +14,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable : base(h) { Origin = Anchor.Centre; - - Size = new Vector2(Pulp.PULP_SIZE); - + Size = new Vector2((float)CatchHitObject.OBJECT_RADIUS); AccentColour = h.ComboColour; Masking = false; } diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs index dbb0ca71cc..e1b2b23f71 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.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 System; using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.MathUtils; using osu.Game.Rulesets.Catch.Objects.Drawable.Pieces; using OpenTK; using OpenTK.Graphics; -using System; namespace osu.Game.Rulesets.Catch.Objects.Drawable { @@ -22,65 +22,33 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable { Origin = Anchor.Centre; - Size = new Vector2(Pulp.PULP_SIZE * 2.2f, Pulp.PULP_SIZE * 2.8f); + Size = new Vector2((float)CatchHitObject.OBJECT_RADIUS); AccentColour = HitObject.ComboColour; Masking = false; - Rotation = (float)(RNG.NextDouble() - 0.5f) * 40; + //Rotation = (float)(RNG.NextDouble() - 0.5f) * 40; } [BackgroundDependencyLoader] private void load() { - Children = new Framework.Graphics.Drawable[] + Children = new[] { - //todo: share this more - new BufferedContainer - { - RelativeSizeAxes = Axes.Both, - CacheDrawnFrameBuffer = true, - Children = new Framework.Graphics.Drawable[] - { - new Pulp - { - RelativePositionAxes = Axes.Both, - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - AccentColour = AccentColour, - Scale = new Vector2(0.6f), - }, - new Pulp - { - RelativePositionAxes = Axes.Both, - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - AccentColour = AccentColour, - Y = -0.08f - }, - new Pulp - { - RelativePositionAxes = Axes.Both, - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, - AccentColour = AccentColour, - Y = -0.08f - }, - new Pulp - { - RelativePositionAxes = Axes.Both, - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - AccentColour = AccentColour, - }, - } - }, + createPulp(HitObject.VisualRepresentation), border = new Circle { - Size = new Vector2(Pulp.PULP_SIZE * 3.5f), + EdgeEffect = new EdgeEffectParameters + { + Hollow = true, + Type = EdgeEffectType.Glow, + Radius = 4, + Colour = AccentColour.Darken(1).Opacity(0.8f) + }, + Size = new Vector2(Height * 1.5f), Anchor = Anchor.Centre, Origin = Anchor.Centre, - BorderColour = AccentColour, - BorderThickness = 3, + BorderColour = Color4.White, + BorderThickness = 2.5f, Children = new Framework.Graphics.Drawable[] { new Box @@ -104,11 +72,179 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable AccentColour = Color4.Red, Blending = BlendingMode.Additive, Alpha = 0.5f, - Scale = new Vector2(2) + Scale = new Vector2(1.333f) }); } } + private Framework.Graphics.Drawable createPulp(FruitVisualRepresentation representation) + { + const float large_pulp_3 = 13f; + const float distance_from_centre_3 = 0.23f; + + const float large_pulp_4 = large_pulp_3 * 0.925f; + const float distance_from_centre_4 = distance_from_centre_3 / 0.925f; + + const float small_pulp = large_pulp_3 / 2; + + Vector2 positionAt(float angle, float distance) => new Vector2( + distance * (float)Math.Sin(angle * Math.PI / 180), + distance * (float)Math.Cos(angle * Math.PI / 180)); + + switch (representation) + { + default: + return new Container { }; + case FruitVisualRepresentation.DPad: + return new Container + { + RelativeSizeAxes = Axes.Both, + Children = new Framework.Graphics.Drawable[] + { + new Pulp + { + Anchor = Anchor.TopCentre, + Origin = Anchor.BottomCentre, + AccentColour = AccentColour, + Size = new Vector2(small_pulp), + Y = 0.05f, + }, + new Pulp + { + AccentColour = AccentColour, + Size = new Vector2(large_pulp_4), + Position = positionAt(0, distance_from_centre_4), + }, + new Pulp + { + AccentColour = AccentColour, + Size = new Vector2(large_pulp_4), + Position = positionAt(90, distance_from_centre_4), + }, + new Pulp + { + AccentColour = AccentColour, + Size = new Vector2(large_pulp_4), + Position = positionAt(180, distance_from_centre_4), + }, + new Pulp + { + Size = new Vector2(large_pulp_4), + AccentColour = AccentColour, + Position = positionAt(270, distance_from_centre_4), + }, + } + }; + case FruitVisualRepresentation.Pineapple: + return new Container + { + RelativeSizeAxes = Axes.Both, + Children = new Framework.Graphics.Drawable[] + { + new Pulp + { + Anchor = Anchor.TopCentre, + Origin = Anchor.BottomCentre, + AccentColour = AccentColour, + Size = new Vector2(small_pulp), + Y = 0.1f, + }, + new Pulp + { + AccentColour = AccentColour, + Size = new Vector2(large_pulp_4), + Position = positionAt(45, distance_from_centre_4), + }, + new Pulp + { + AccentColour = AccentColour, + Size = new Vector2(large_pulp_4), + Position = positionAt(135, distance_from_centre_4), + }, + new Pulp + { + AccentColour = AccentColour, + Size = new Vector2(large_pulp_4), + Position = positionAt(225, distance_from_centre_4), + }, + new Pulp + { + Size = new Vector2(large_pulp_4), + AccentColour = AccentColour, + Position = positionAt(315, distance_from_centre_4), + }, + } + }; + case FruitVisualRepresentation.Triforce: + return new Container + { + RelativeSizeAxes = Axes.Both, + Children = new Framework.Graphics.Drawable[] + { + new Pulp + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + AccentColour = AccentColour, + Size = new Vector2(small_pulp), + Y = -0.1f, + }, + new Pulp + { + AccentColour = AccentColour, + Size = new Vector2(large_pulp_3), + Position = positionAt(60, distance_from_centre_3), + }, + new Pulp + { + AccentColour = AccentColour, + Size = new Vector2(large_pulp_3), + Position = positionAt(180, distance_from_centre_3), + }, + new Pulp + { + Size = new Vector2(large_pulp_3), + AccentColour = AccentColour, + Position = positionAt(300, distance_from_centre_3), + }, + } + }; + case FruitVisualRepresentation.Grape: + return new Container + { + RelativeSizeAxes = Axes.Both, + Children = new Framework.Graphics.Drawable[] + { + new Pulp + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + AccentColour = AccentColour, + Size = new Vector2(small_pulp), + }, + new Pulp + { + AccentColour = AccentColour, + Size = new Vector2(large_pulp_3), + Position = positionAt(0, distance_from_centre_3), + }, + new Pulp + { + AccentColour = AccentColour, + Size = new Vector2(large_pulp_3), + Position = positionAt(120, distance_from_centre_3), + }, + new Pulp + { + Size = new Vector2(large_pulp_3), + AccentColour = AccentColour, + Position = positionAt(240, distance_from_centre_3), + }, + } + }; + } + } + protected override void Update() { base.Update(); diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/Pieces/Pulp.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/Pieces/Pulp.cs index 2de266b3f0..22f64c61a0 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/Pieces/Pulp.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/Pieces/Pulp.cs @@ -6,18 +6,17 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; -using OpenTK; using OpenTK.Graphics; namespace osu.Game.Rulesets.Catch.Objects.Drawable.Pieces { public class Pulp : Circle, IHasAccentColour { - public const float PULP_SIZE = (float)CatchHitObject.OBJECT_RADIUS / 2.2f; - public Pulp() { - Size = new Vector2(PULP_SIZE); + RelativePositionAxes = Axes.Both; + Anchor = Anchor.Centre; + Origin = Anchor.Centre; Blending = BlendingMode.Additive; Colour = Color4.White.Opacity(0.9f); @@ -34,8 +33,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable.Pieces EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Glow, - Radius = 5, - Colour = accentColour.Lighten(100), + Radius = 8, + Colour = accentColour.Darken(0.2f).Opacity(0.75f) }; } } diff --git a/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs b/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs index 45a6c1c808..975795863f 100644 --- a/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs +++ b/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.Objects.Drawable; +using osu.Game.Rulesets.Catch.Objects.Drawable.Pieces; using osu.Game.Tests.Visual; using OpenTK; @@ -18,8 +19,11 @@ namespace osu.Game.Rulesets.Catch.Tests { typeof(CatchHitObject), typeof(Fruit), + typeof(Droplet), typeof(DrawableCatchHitObject), typeof(DrawableFruit), + typeof(DrawableDroplet), + typeof(Pulp), }; public TestCaseFruitObjects() @@ -33,25 +37,23 @@ namespace osu.Game.Rulesets.Catch.Tests { createDrawable(0), createDrawable(1), + createDrawable(2), }, new Drawable[] { - createDrawable(2), createDrawable(3), + createDrawable(4), + createDrawable(5), }, } }); } - protected override void Update() - { - base.Update(); - } - private DrawableFruit createDrawable(int index) => new DrawableFruit(new Fruit { - StartTime = 1000000, - IndexInBeatmap = index + StartTime = 1000000000000, + IndexInBeatmap = index, + Scale = 1.5f, }) { Anchor = Anchor.Centre, From b137c3b2caa021c656e9af88b2c6d13dac26501d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 3 Jan 2018 18:35:43 +0900 Subject: [PATCH 11/32] Adjust ticks size --- osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs index 9fdc4f9cd7..73c91c0130 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs @@ -14,7 +14,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable : base(h) { Origin = Anchor.Centre; - Size = new Vector2((float)CatchHitObject.OBJECT_RADIUS); + Size = new Vector2((float)CatchHitObject.OBJECT_RADIUS) / 4; AccentColour = h.ComboColour; Masking = false; } @@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable Child = new Pulp { AccentColour = AccentColour, - Scale = new Vector2(0.8f), + Size = Size }; } } From 4ee845fea8ea3c9113ed60868ea873e035770d13 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 3 Jan 2018 18:38:29 +0900 Subject: [PATCH 12/32] Adjust border thickness and fade out rate of border --- osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs index e1b2b23f71..40f58fd5ea 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs @@ -42,13 +42,13 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable Hollow = true, Type = EdgeEffectType.Glow, Radius = 4, - Colour = AccentColour.Darken(1).Opacity(0.8f) + Colour = AccentColour.Darken(1).Opacity(0.6f) }, Size = new Vector2(Height * 1.5f), Anchor = Anchor.Centre, Origin = Anchor.Centre, BorderColour = Color4.White, - BorderThickness = 2.5f, + BorderThickness = 4f, Children = new Framework.Graphics.Drawable[] { new Box @@ -248,7 +248,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable protected override void Update() { base.Update(); - border.Alpha = (float)MathHelper.Clamp((HitObject.StartTime - Time.Current) / 1000, 0, 1); + + border.Alpha = (float)MathHelper.Clamp((HitObject.StartTime - Time.Current) / 500, 0, 1); } } } From 9bde8d3da1055c11e67b1670f71d0fd9247da929 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 3 Jan 2018 20:52:01 +0900 Subject: [PATCH 13/32] Move combo colouring to test case --- .../Objects/CatchHitObject.cs | 32 +--------- .../Tests/TestCaseFruitObjects.cs | 59 +++++++++++++++---- 2 files changed, 48 insertions(+), 43 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs index f36459dc76..e5f8ad5402 100644 --- a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.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 osu.Framework.MathUtils; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Objects; @@ -16,36 +15,7 @@ namespace osu.Game.Rulesets.Catch.Objects public float X { get; set; } - public Color4 ComboColour - { - get - { - switch (VisualRepresentation) - { - default: - case FruitVisualRepresentation.Triforce: - return new Color4(17, 136, 170, 255); - case FruitVisualRepresentation.Grape: - return new Color4(204, 102, 0, 255); - case FruitVisualRepresentation.DPad: - return new Color4(121, 9, 13, 255); - case FruitVisualRepresentation.Pineapple: - return new Color4(102, 136, 0, 255); - case FruitVisualRepresentation.Banana: - switch (RNG.Next(0, 3)) - { - default: - return new Color4(255, 240, 0, 255); - case 1: - return new Color4(255, 192, 0, 255); - case 2: - return new Color4(214, 221, 28, 255); - } - } - } - - set { } - } + public Color4 ComboColour { get; set; } public int IndexInBeatmap { get; set; } diff --git a/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs b/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs index 975795863f..0b7bc3b186 100644 --- a/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs +++ b/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs @@ -5,11 +5,13 @@ using System; using System.Collections.Generic; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.MathUtils; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.Objects.Drawable; using osu.Game.Rulesets.Catch.Objects.Drawable.Pieces; using osu.Game.Tests.Visual; using OpenTK; +using OpenTK.Graphics; namespace osu.Game.Rulesets.Catch.Tests { @@ -49,19 +51,52 @@ namespace osu.Game.Rulesets.Catch.Tests }); } - private DrawableFruit createDrawable(int index) => new DrawableFruit(new Fruit + private DrawableFruit createDrawable(int index) { - StartTime = 1000000000000, - IndexInBeatmap = index, - Scale = 1.5f, - }) + var fruit = new Fruit + { + StartTime = 1000000000000, + IndexInBeatmap = index, + Scale = 1.5f, + }; + + fruit.ComboColour = colourForRrepesentation(fruit.VisualRepresentation); + + return new DrawableFruit(fruit) + { + Anchor = Anchor.Centre, + RelativePositionAxes = Axes.Both, + Position = Vector2.Zero, + Alpha = 1, + LifetimeStart = double.NegativeInfinity, + LifetimeEnd = double.PositiveInfinity, + }; + } + + private Color4 colourForRrepesentation(FruitVisualRepresentation representation) { - Anchor = Anchor.Centre, - RelativePositionAxes = Axes.Both, - Position = Vector2.Zero, - Alpha = 1, - LifetimeStart = double.NegativeInfinity, - LifetimeEnd = double.PositiveInfinity, - }; + switch (representation) + { + default: + case FruitVisualRepresentation.Triforce: + return new Color4(17, 136, 170, 255); + case FruitVisualRepresentation.Grape: + return new Color4(204, 102, 0, 255); + case FruitVisualRepresentation.DPad: + return new Color4(121, 9, 13, 255); + case FruitVisualRepresentation.Pineapple: + return new Color4(102, 136, 0, 255); + case FruitVisualRepresentation.Banana: + switch (RNG.Next(0, 3)) + { + default: + return new Color4(255, 240, 0, 255); + case 1: + return new Color4(255, 192, 0, 255); + case 2: + return new Color4(214, 221, 28, 255); + } + } + } } } From b03cbaca7749008a639a95c30dfb56a3ead92327 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 3 Jan 2018 20:52:11 +0900 Subject: [PATCH 14/32] Add back random rotation --- osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs index 40f58fd5ea..df8ce2a43e 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs @@ -7,6 +7,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.MathUtils; using osu.Game.Rulesets.Catch.Objects.Drawable.Pieces; using OpenTK; using OpenTK.Graphics; @@ -26,7 +27,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable AccentColour = HitObject.ComboColour; Masking = false; - //Rotation = (float)(RNG.NextDouble() - 0.5f) * 40; + Rotation = (float)(RNG.NextDouble() - 0.5f) * 40; } [BackgroundDependencyLoader] From 3c0631852108bd4a9e019c2a4d2596516fddf539 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 3 Jan 2018 20:55:52 +0900 Subject: [PATCH 15/32] Improve the look of hyperdash fruit --- osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs index df8ce2a43e..92d38f1f60 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs @@ -40,10 +40,10 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable { EdgeEffect = new EdgeEffectParameters { - Hollow = true, + Hollow = !HitObject.HyperDash, Type = EdgeEffectType.Glow, Radius = 4, - Colour = AccentColour.Darken(1).Opacity(0.6f) + Colour = HitObject.HyperDash ? Color4.Red : AccentColour.Darken(1).Opacity(0.6f) }, Size = new Vector2(Height * 1.5f), Anchor = Anchor.Centre, @@ -95,7 +95,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable switch (representation) { default: - return new Container { }; + return new Container(); case FruitVisualRepresentation.DPad: return new Container { From 5f1d360a69cae565db6783ef6402a87eb255cccb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 4 Jan 2018 15:21:33 +0900 Subject: [PATCH 16/32] Fix incorrect file header --- osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs b/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs index 0b7bc3b186..e7ad7135df 100644 --- a/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs +++ b/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs @@ -1,5 +1,5 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; using System.Collections.Generic; From 996a72b279f9355046b13ba836831f82633e78ca Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 4 Jan 2018 15:25:12 +0900 Subject: [PATCH 17/32] Degrade yearin header --- osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs b/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs index e7ad7135df..92d96e3135 100644 --- a/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs +++ b/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2018 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; From 5253ee5c0872dc52ddf6c579c6775b9960ee3447 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 4 Jan 2018 15:34:57 +0900 Subject: [PATCH 18/32] Ignore ruleset test --- osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs b/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs index 92d96e3135..c4fea5ff75 100644 --- a/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs +++ b/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.MathUtils; @@ -15,6 +16,7 @@ using OpenTK.Graphics; namespace osu.Game.Rulesets.Catch.Tests { + [Ignore("getting CI working")] public class TestCaseFruitObjects : OsuTestCase { public override IReadOnlyList RequiredTypes => new[] From f45752c652de311ae32f5a23fcbae165e928126b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 3 Jan 2018 21:31:16 +0900 Subject: [PATCH 19/32] Fix catcher's catchable width being half of what it should --- osu.Game.Rulesets.Catch/UI/CatcherArea.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs index 2bb0f3cd18..988ca1c36e 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs @@ -190,15 +190,15 @@ namespace osu.Game.Rulesets.Catch.UI /// Whether the catch is possible. public bool AttemptCatch(CatchHitObject fruit) { - const double relative_catcher_width = CATCHER_SIZE / 2; + double halfCatcherWidth = CATCHER_SIZE * Math.Abs(Scale.X) * 0.5f; // this stuff wil disappear once we move fruit to non-relative coordinate space in the future. var catchObjectPosition = fruit.X * CatchPlayfield.BASE_WIDTH; var catcherPosition = Position.X * CatchPlayfield.BASE_WIDTH; var validCatch = - catchObjectPosition >= catcherPosition - relative_catcher_width / 2 && - catchObjectPosition <= catcherPosition + relative_catcher_width / 2; + catchObjectPosition >= catcherPosition - halfCatcherWidth && + catchObjectPosition <= catcherPosition + halfCatcherWidth; if (validCatch && fruit.HyperDash) { From 152b846cff2089e59805ad24a8117b5582758ae0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 4 Jan 2018 16:28:36 +0900 Subject: [PATCH 20/32] Fix incorrect scaling of hitobjects in catch --- osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 9 ++++++--- osu.Game/Rulesets/UI/Playfield.cs | 6 ++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index 76dbfa77c6..c1f535ba6b 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Catch.UI private readonly CatcherArea catcherArea; public CatchPlayfield(BeatmapDifficulty difficulty) - : base(Axes.Y) + : base(Axes.Y, BASE_WIDTH) { Container explodingFruitContainer; @@ -32,7 +32,10 @@ namespace osu.Game.Rulesets.Catch.UI Anchor = Anchor.TopCentre; Origin = Anchor.TopCentre; - InternalChildren = new Drawable[] + ScaledContent.Anchor = Anchor.BottomLeft; + ScaledContent.Origin = Anchor.BottomLeft; + + ScaledContent.AddRange(new Drawable[] { content = new Container { @@ -48,7 +51,7 @@ namespace osu.Game.Rulesets.Catch.UI Anchor = Anchor.BottomLeft, Origin = Anchor.TopLeft, } - }; + }); } public bool CheckIfWeCanCatch(CatchHitObject obj) => catcherArea.AttemptCatch(obj); diff --git a/osu.Game/Rulesets/UI/Playfield.cs b/osu.Game/Rulesets/UI/Playfield.cs index b4a26344d5..6752bf5c29 100644 --- a/osu.Game/Rulesets/UI/Playfield.cs +++ b/osu.Game/Rulesets/UI/Playfield.cs @@ -110,6 +110,12 @@ namespace osu.Game.Rulesets.UI //dividing by the customwidth will effectively scale our content to the required container size. protected override Vector2 DrawScale => CustomWidth.HasValue ? new Vector2(DrawSize.X / CustomWidth.Value) : base.DrawScale; + + protected override void Update() + { + base.Update(); + RelativeChildSize = new Vector2(DrawScale.X, base.RelativeChildSize.Y); + } } } } From c8ec27c4dea1a050d964decb2322c8e29ebee6d7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 4 Jan 2018 16:31:41 +0900 Subject: [PATCH 21/32] Remove redundant prefix --- osu.Game/Rulesets/UI/Playfield.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/UI/Playfield.cs b/osu.Game/Rulesets/UI/Playfield.cs index 6752bf5c29..8a4cbcb49c 100644 --- a/osu.Game/Rulesets/UI/Playfield.cs +++ b/osu.Game/Rulesets/UI/Playfield.cs @@ -114,7 +114,7 @@ namespace osu.Game.Rulesets.UI protected override void Update() { base.Update(); - RelativeChildSize = new Vector2(DrawScale.X, base.RelativeChildSize.Y); + RelativeChildSize = new Vector2(DrawScale.X, RelativeChildSize.Y); } } } From 722cad3674051f9bae650cb1249fff4b636a83ae Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 4 Jan 2018 17:25:51 +0900 Subject: [PATCH 22/32] Caught fruit sit behind plate --- osu.Game.Rulesets.Catch/UI/CatcherArea.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs index 988ca1c36e..37970cfcdb 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs @@ -84,12 +84,12 @@ namespace osu.Game.Rulesets.Catch.UI Children = new Drawable[] { - createCatcherSprite(), caughtFruit = new Container { Anchor = Anchor.TopCentre, Origin = Anchor.BottomCentre, - } + }, + createCatcherSprite(), }; } From 5125abf68199713e9253caed0d02b4ef2a59e1a4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 4 Jan 2018 17:27:17 +0900 Subject: [PATCH 23/32] Better plate alignment and stacking logic --- osu.Game.Rulesets.Catch/UI/CatcherArea.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs index 37970cfcdb..5f91b75919 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs @@ -45,7 +45,7 @@ namespace osu.Game.Rulesets.Catch.UI fruit.Position = new Vector2(MovableCatcher.ToLocalSpace(absolutePosition).X - MovableCatcher.DrawSize.X / 2, 0); fruit.Anchor = Anchor.TopCentre; - fruit.Origin = Anchor.BottomCentre; + fruit.Origin = Anchor.Centre; fruit.Scale *= 0.7f; fruit.LifetimeEnd = double.MaxValue; @@ -167,12 +167,18 @@ namespace osu.Game.Rulesets.Catch.UI /// The fruit that was caught. public void Add(DrawableHitObject fruit) { - float distance = fruit.DrawSize.X / 2 * fruit.Scale.X; + float ourRadius = fruit.DrawSize.X / 2 * fruit.Scale.X; + float theirRadius = 0; - while (caughtFruit.Any(f => f.LifetimeEnd == double.MaxValue && Vector2Extensions.DistanceSquared(f.Position, fruit.Position) < distance * distance)) + const float allowance = 6; + + while (caughtFruit.Any(f => + f.LifetimeEnd == double.MaxValue && + Vector2Extensions.Distance(f.Position, fruit.Position) < (ourRadius + (theirRadius = (f.DrawSize.X / 2 * f.Scale.X))) / (allowance / 2))) { - fruit.X += RNG.Next(-5, 5); - fruit.Y -= RNG.Next(0, 5); + float diff = (ourRadius + theirRadius) / allowance; + fruit.X += (RNG.NextSingle() - 0.5f) * 2 * diff; + fruit.Y -= RNG.NextSingle() * diff; } caughtFruit.Add(fruit); From 0bbc15d24a6ba299aa5f3785a1b508f5210b5f3c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 4 Jan 2018 17:51:34 +0900 Subject: [PATCH 24/32] Clamp fruit to plate --- osu.Game.Rulesets.Catch/UI/CatcherArea.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs index 5f91b75919..262ea67742 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs @@ -174,13 +174,15 @@ namespace osu.Game.Rulesets.Catch.UI while (caughtFruit.Any(f => f.LifetimeEnd == double.MaxValue && - Vector2Extensions.Distance(f.Position, fruit.Position) < (ourRadius + (theirRadius = (f.DrawSize.X / 2 * f.Scale.X))) / (allowance / 2))) + Vector2Extensions.Distance(f.Position, fruit.Position) < (ourRadius + (theirRadius = f.DrawSize.X / 2 * f.Scale.X)) / (allowance / 2))) { float diff = (ourRadius + theirRadius) / allowance; fruit.X += (RNG.NextSingle() - 0.5f) * 2 * diff; fruit.Y -= RNG.NextSingle() * diff; } + fruit.X = MathHelper.Clamp(fruit.X, -CATCHER_SIZE / 2, CATCHER_SIZE / 2); + caughtFruit.Add(fruit); var catchObject = (CatchHitObject)fruit.HitObject; From f28053b2fcaf1f6ce01c6d5ae42bf304732c0b87 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 4 Jan 2018 18:13:59 +0900 Subject: [PATCH 25/32] Drop fruit when last in combo is not caught Also cleans up judgement handling a bit --- osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 15 +---- osu.Game.Rulesets.Catch/UI/CatcherArea.cs | 66 +++++++++++++++----- 2 files changed, 53 insertions(+), 28 deletions(-) diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index 76dbfa77c6..c4458dbe9b 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -3,7 +3,6 @@ using osu.Framework.Graphics; using osu.Game.Rulesets.UI; -using OpenTK; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; using osu.Game.Rulesets.Catch.Objects; @@ -63,18 +62,6 @@ namespace osu.Game.Rulesets.Catch.UI fruit.CheckPosition = CheckIfWeCanCatch; } - public override void OnJudgement(DrawableHitObject judgedObject, Judgement judgement) - { - if (judgement.IsHit) - { - Vector2 screenPosition = judgedObject.ScreenSpaceDrawQuad.Centre; - - // todo: don't do this - (judgedObject.Parent as Container)?.Remove(judgedObject); - (judgedObject.Parent as Container)?.Remove(judgedObject); - - catcherArea.Add(judgedObject, screenPosition); - } - } + public override void OnJudgement(DrawableHitObject judgedObject, Judgement judgement) => catcherArea.OnJudgement((DrawableCatchHitObject)judgedObject, judgement); } } diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs index 2bb0f3cd18..63405dce5e 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs @@ -12,6 +12,8 @@ using osu.Framework.Input.Bindings; using osu.Framework.MathUtils; using osu.Game.Beatmaps; using osu.Game.Rulesets.Catch.Objects; +using osu.Game.Rulesets.Catch.Objects.Drawable; +using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects.Drawables; using OpenTK; using OpenTK.Graphics; @@ -39,17 +41,30 @@ namespace osu.Game.Rulesets.Catch.UI }; } - public void Add(DrawableHitObject fruit, Vector2 absolutePosition) + public void OnJudgement(DrawableCatchHitObject fruit, Judgement judgement) { - fruit.RelativePositionAxes = Axes.None; - fruit.Position = new Vector2(MovableCatcher.ToLocalSpace(absolutePosition).X - MovableCatcher.DrawSize.X / 2, 0); + if (judgement.IsHit) + { + var screenSpacePosition = fruit.ScreenSpaceDrawQuad.Centre; - fruit.Anchor = Anchor.TopCentre; - fruit.Origin = Anchor.BottomCentre; - fruit.Scale *= 0.7f; - fruit.LifetimeEnd = double.MaxValue; + fruit.RelativePositionAxes = Axes.None; + fruit.Position = new Vector2(MovableCatcher.ToLocalSpace(screenSpacePosition).X - MovableCatcher.DrawSize.X / 2, 0); - MovableCatcher.Add(fruit); + fruit.Anchor = Anchor.TopCentre; + fruit.Origin = Anchor.Centre; + fruit.Scale *= 0.7f; + fruit.LifetimeEnd = double.MaxValue; + + MovableCatcher.Add(fruit); + } + + if (fruit.HitObject.LastInCombo) + { + if (judgement.IsHit) + MovableCatcher.Explode(); + else + MovableCatcher.Drop(); + } } public bool AttemptCatch(CatchHitObject obj) => MovableCatcher.AttemptCatch(obj); @@ -176,11 +191,6 @@ namespace osu.Game.Rulesets.Catch.UI } caughtFruit.Add(fruit); - - var catchObject = (CatchHitObject)fruit.HitObject; - - if (catchObject.LastInCombo) - explode(); } /// @@ -309,7 +319,35 @@ namespace osu.Game.Rulesets.Catch.UI X = (float)MathHelper.Clamp(X + direction * Clock.ElapsedFrameTime * BASE_SPEED * dashModifier, 0, 1); } - private void explode() + /// + /// Drop any fruit off the plate. + /// + public void Drop() + { + var fruit = caughtFruit.ToArray(); + + foreach (var f in fruit) + { + if (ExplodingFruitTarget != null) + { + f.Anchor = Anchor.TopLeft; + f.Position = caughtFruit.ToSpaceOfOtherDrawable(f.DrawPosition, ExplodingFruitTarget); + + caughtFruit.Remove(f); + + ExplodingFruitTarget.Add(f); + } + + f.MoveToY(f.Y + 75, 750, Easing.InSine); + f.FadeOut(750); + f.Expire(); + } + } + + /// + /// Explode any fruit off the plate. + /// + public void Explode() { var fruit = caughtFruit.ToArray(); From 5bd489863c19249a395c228122d281b3bdcd3408 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 4 Jan 2018 18:20:23 +0900 Subject: [PATCH 26/32] Rename enum --- osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs | 4 ++-- osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs | 4 ++-- osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs index e5f8ad5402..f1df1c57f4 100644 --- a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs @@ -50,9 +50,9 @@ namespace osu.Game.Rulesets.Catch.Objects public enum FruitVisualRepresentation { - Triforce, + Pear, Grape, - DPad, + Raspberry, Pineapple, Banana // banananananannaanana } diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs index 92d38f1f60..6a71a2f162 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableFruit.cs @@ -96,7 +96,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable { default: return new Container(); - case FruitVisualRepresentation.DPad: + case FruitVisualRepresentation.Raspberry: return new Container { RelativeSizeAxes = Axes.Both, @@ -176,7 +176,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable }, } }; - case FruitVisualRepresentation.Triforce: + case FruitVisualRepresentation.Pear: return new Container { RelativeSizeAxes = Axes.Both, diff --git a/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs b/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs index c4fea5ff75..50cb1b150c 100644 --- a/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs +++ b/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs @@ -80,11 +80,11 @@ namespace osu.Game.Rulesets.Catch.Tests switch (representation) { default: - case FruitVisualRepresentation.Triforce: + case FruitVisualRepresentation.Pear: return new Color4(17, 136, 170, 255); case FruitVisualRepresentation.Grape: return new Color4(204, 102, 0, 255); - case FruitVisualRepresentation.DPad: + case FruitVisualRepresentation.Raspberry: return new Color4(121, 9, 13, 255); case FruitVisualRepresentation.Pineapple: return new Color4(102, 136, 0, 255); From 22fc9601eee461eed5304dd75c2c6f32395a0394 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 4 Jan 2018 18:33:57 +0900 Subject: [PATCH 27/32] Add back missing code --- osu.Game.Rulesets.Catch/UI/CatcherArea.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs index 63405dce5e..c266106f58 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs @@ -47,6 +47,11 @@ namespace osu.Game.Rulesets.Catch.UI { var screenSpacePosition = fruit.ScreenSpaceDrawQuad.Centre; + // remove the fruit from its current parent. + // todo: make this less ugly, somehow. + (fruit.Parent as Container)?.Remove(fruit); + (fruit.Parent as Container)?.Remove(fruit); + fruit.RelativePositionAxes = Axes.None; fruit.Position = new Vector2(MovableCatcher.ToLocalSpace(screenSpacePosition).X - MovableCatcher.DrawSize.X / 2, 0); From f660eff4d491d3633796f41943c2d7ec14395016 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 7 Jan 2018 11:57:33 +0900 Subject: [PATCH 28/32] FIx incorrect licence header template --- osu.sln.DotSettings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index 20007e3306..8767e5374a 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -598,7 +598,7 @@ </TypePattern> </Patterns> Copyright (c) 2007-$CURRENT_YEAR$ ppy Pty Ltd <contact@ppy.sh>. -Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE +Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE <Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /> <Policy Inspect="False" Prefix="" Suffix="" Style="AaBb" /> From 2518d16a77f97f7ecb5fbcc4e0932b1212ab613a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 9 Jan 2018 21:34:25 +0900 Subject: [PATCH 29/32] Denote unused variable --- 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 87a7c7dd59..f700bf1a03 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -318,9 +318,9 @@ namespace osu.Game.Screens.Play if (!loadedSuccessfully) return; - dimLevel.ValueChanged += value => updateBackgroundElements(); - blurLevel.ValueChanged += value => updateBackgroundElements(); - showStoryboard.ValueChanged += value => updateBackgroundElements(); + dimLevel.ValueChanged += _ => updateBackgroundElements(); + blurLevel.ValueChanged += _ => updateBackgroundElements(); + showStoryboard.ValueChanged += _ => updateBackgroundElements(); updateBackgroundElements(); Content.Alpha = 0; From fcb197f7b6230c26af195c4e1da5347618d81250 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 9 Jan 2018 22:21:15 +0900 Subject: [PATCH 30/32] Simplify logic --- .../Backgrounds/BackgroundScreenBeatmap.cs | 13 ++++--------- osu.Game/Screens/Play/Player.cs | 15 +++++++++------ 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index dd76ac5421..1ce84289b2 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -4,6 +4,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Textures; +using osu.Framework.Graphics.Transforms; using OpenTK; using osu.Game.Beatmaps; using osu.Game.Graphics.Backgrounds; @@ -19,10 +20,7 @@ namespace osu.Game.Screens.Backgrounds public WorkingBeatmap Beatmap { - get - { - return beatmap; - } + get { return beatmap; } set { if (beatmap == value && beatmap != null) @@ -56,11 +54,8 @@ namespace osu.Game.Screens.Backgrounds Beatmap = beatmap; } - public void BlurTo(Vector2 sigma, double duration, Easing easing = Easing.None) - { - background?.BlurTo(sigma, duration, easing); - blurTarget = sigma; - } + public TransformSequence BlurTo(Vector2 sigma, double duration, Easing easing = Easing.None) + => background?.BlurTo(blurTarget = sigma, duration, easing); public override bool Equals(BackgroundScreen other) { diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index f700bf1a03..79ae8fca30 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -24,10 +24,10 @@ using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Ranking; using osu.Framework.Audio.Sample; using osu.Game.Beatmaps; +using osu.Game.Graphics; using osu.Game.Online.API; using osu.Game.Screens.Play.BreaksOverlay; using osu.Game.Storyboards.Drawables; -using OpenTK.Graphics; namespace osu.Game.Screens.Play { @@ -378,8 +378,9 @@ namespace osu.Game.Screens.Play private void updateBackgroundElements() { + const float duration = 800; + var opacity = 1 - (float)dimLevel; - var blur = new Vector2((float)blurLevel.Value * 25); if (showStoryboard && storyboard == null) initializeStoryboard(true); @@ -387,11 +388,13 @@ namespace osu.Game.Screens.Play var beatmap = Beatmap.Value; var storyboardVisible = showStoryboard && beatmap.Storyboard.HasDrawable; - storyboardContainer.FadeColour(new Color4(opacity, opacity, opacity, 1), 800); - storyboardContainer.FadeTo(storyboardVisible && opacity > 0 ? 1 : 0, 800, Easing.OutQuint); + storyboardContainer + .FadeColour(OsuColour.Gray(opacity), duration, Easing.OutQuint) + .FadeTo(storyboardVisible && opacity > 0 ? 1 : 0, duration, Easing.OutQuint); - Background?.FadeTo(!storyboardVisible || beatmap.Background == null ? opacity : 0, 800, Easing.OutQuint); - (Background as BackgroundScreenBeatmap)?.BlurTo(blur, 800, Easing.OutQuint); + (Background as BackgroundScreenBeatmap)? + .BlurTo(new Vector2((float)blurLevel.Value * 25), duration, Easing.OutQuint)? + .FadeTo(!storyboardVisible || beatmap.Background == null ? opacity : 0, duration, Easing.OutQuint); } private void fadeOut() From c4490b5fe812b819dae0f218091c03e27caefd84 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 9 Jan 2018 22:24:12 +0900 Subject: [PATCH 31/32] Fix incorrect licence header --- osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs b/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs index 50cb1b150c..d406231cc9 100644 --- a/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs +++ b/osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . +// Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; From 9ec8f130a694c785878cf5b17716f94e73c06a97 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 10 Jan 2018 13:24:26 +0900 Subject: [PATCH 32/32] Ensure changes are only applied when we are the current screen --- osu.Game/Screens/Play/Player.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 79ae8fca30..c24b5e0d2a 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -378,6 +378,8 @@ namespace osu.Game.Screens.Play private void updateBackgroundElements() { + if (!IsCurrentScreen) return; + const float duration = 800; var opacity = 1 - (float)dimLevel;